add a dummy artiq-timestamp.nix, generate through main.nix, use in artiq-manual.nix

This commit is contained in:
Astro 2019-04-23 22:07:43 +02:00
parent 22ba790a3c
commit e75355c6c8
4 changed files with 21 additions and 4 deletions

View File

@ -23,7 +23,7 @@ let
}; };
}) {} boards; }) {} boards;
manualPackages = import ./pkgs/artiq-manual.nix { manualPackages = import ./pkgs/artiq-manual.nix {
inherit stdenv lib fetchgit git python3Packages texlive texinfo; inherit stdenv lib fetchgit python3Packages texlive texinfo;
inherit (pythonDeps) sphinxcontrib-wavedrom; inherit (pythonDeps) sphinxcontrib-wavedrom;
}; };
mainPackages = rec { mainPackages = rec {

View File

@ -1,4 +1,4 @@
{ stdenv, lib, fetchgit, git, python3Packages, texlive, texinfo, sphinxcontrib-wavedrom }: { stdenv, lib, fetchgit, python3Packages, texlive, texinfo, sphinxcontrib-wavedrom }:
let let
artiqVersion = import ./artiq-version.nix; artiqVersion = import ./artiq-version.nix;
@ -18,7 +18,6 @@ let
src = import ./artiq-src.nix { inherit fetchgit; }; src = import ./artiq-src.nix { inherit fetchgit; };
buildInputs = [ buildInputs = [
git
python3Packages.sphinx python3Packages.sphinx_rtd_theme python3Packages.sphinx python3Packages.sphinx_rtd_theme
python3Packages.sphinx-argparse sphinxcontrib-wavedrom python3Packages.sphinx-argparse sphinxcontrib-wavedrom
] ++ ] ++
@ -27,7 +26,7 @@ let
preBuild = '' preBuild = ''
export VERSIONEER_OVERRIDE=${artiqVersion} export VERSIONEER_OVERRIDE=${artiqVersion}
export SOURCE_DATE_EPOCH=`${git}/bin/git log -1 --format=%ct` export SOURCE_DATE_EPOCH=${import ./artiq-timestamp.nix {}}
cd doc/manual cd doc/manual
''; '';
makeFlags = [ target ]; makeFlags = [ target ];

View File

@ -0,0 +1,16 @@
{ pkgs ? import <nixpkgs> {} }:
with pkgs;
let
artiq-timestamp = stdenv.mkDerivation {
name = "artiq-timestamp";
src = import ./artiq-src.nix { inherit fetchgit; };
buildInputs = [ git ];
buildPhase = ''
TIMESTAMP=`${git}/bin/git log -1 --format=%ct`
'';
installPhase = ''
echo \"$TIMESTAMP\" > $out
'';
};
in
builtins.readFile artiq-timestamp

View File

@ -5,6 +5,7 @@ let
'' ''
cp --no-preserve=mode,ownership -R ${./artiq} $out cp --no-preserve=mode,ownership -R ${./artiq} $out
REV=`git --git-dir ${artiqSrc}/.git rev-parse HEAD` REV=`git --git-dir ${artiqSrc}/.git rev-parse HEAD`
TIMESTAMP=`git log -1 --format=%ct`
ARTIQ_SRC_CLEAN=`mktemp -d` ARTIQ_SRC_CLEAN=`mktemp -d`
cp -a ${artiqSrc}/. $ARTIQ_SRC_CLEAN cp -a ${artiqSrc}/. $ARTIQ_SRC_CLEAN
chmod -R 755 $ARTIQ_SRC_CLEAN/.git chmod -R 755 $ARTIQ_SRC_CLEAN/.git
@ -20,6 +21,7 @@ let
} }
EOF EOF
echo \"5e.`cut -c1-8 <<< $REV`\" > $out/pkgs/artiq-version.nix echo \"5e.`cut -c1-8 <<< $REV`\" > $out/pkgs/artiq-version.nix
echo \"$TIMESTAMP\" > $out/pkgs/artiq-timestamp.nix
''; '';
generateTestOkHash = pkgs.runCommand "generate-test-ok-hash" { buildInputs = [ pkgs.nix ]; } generateTestOkHash = pkgs.runCommand "generate-test-ok-hash" { buildInputs = [ pkgs.nix ]; }
'' ''