From e75355c6c8f3d30c04373d2f95e092f561707a67 Mon Sep 17 00:00:00 2001 From: Stephan Maka Date: Tue, 23 Apr 2019 22:07:43 +0200 Subject: [PATCH] add a dummy artiq-timestamp.nix, generate through main.nix, use in artiq-manual.nix --- artiq/default.nix | 2 +- artiq/pkgs/artiq-manual.nix | 5 ++--- artiq/pkgs/artiq-timestamp.nix | 16 ++++++++++++++++ main.nix | 2 ++ 4 files changed, 21 insertions(+), 4 deletions(-) create mode 100644 artiq/pkgs/artiq-timestamp.nix diff --git a/artiq/default.nix b/artiq/default.nix index 6db93a8..51a4989 100644 --- a/artiq/default.nix +++ b/artiq/default.nix @@ -23,7 +23,7 @@ let }; }) {} boards; 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; }; mainPackages = rec { diff --git a/artiq/pkgs/artiq-manual.nix b/artiq/pkgs/artiq-manual.nix index 9cce519..ba10d83 100644 --- a/artiq/pkgs/artiq-manual.nix +++ b/artiq/pkgs/artiq-manual.nix @@ -1,4 +1,4 @@ -{ stdenv, lib, fetchgit, git, python3Packages, texlive, texinfo, sphinxcontrib-wavedrom }: +{ stdenv, lib, fetchgit, python3Packages, texlive, texinfo, sphinxcontrib-wavedrom }: let artiqVersion = import ./artiq-version.nix; @@ -18,7 +18,6 @@ let src = import ./artiq-src.nix { inherit fetchgit; }; buildInputs = [ - git python3Packages.sphinx python3Packages.sphinx_rtd_theme python3Packages.sphinx-argparse sphinxcontrib-wavedrom ] ++ @@ -27,7 +26,7 @@ let preBuild = '' 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 ''; makeFlags = [ target ]; diff --git a/artiq/pkgs/artiq-timestamp.nix b/artiq/pkgs/artiq-timestamp.nix new file mode 100644 index 0000000..cb3cf26 --- /dev/null +++ b/artiq/pkgs/artiq-timestamp.nix @@ -0,0 +1,16 @@ +{ pkgs ? import {} }: +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 diff --git a/main.nix b/main.nix index fe442db..b37b381 100644 --- a/main.nix +++ b/main.nix @@ -5,6 +5,7 @@ let '' cp --no-preserve=mode,ownership -R ${./artiq} $out REV=`git --git-dir ${artiqSrc}/.git rev-parse HEAD` + TIMESTAMP=`git log -1 --format=%ct` ARTIQ_SRC_CLEAN=`mktemp -d` cp -a ${artiqSrc}/. $ARTIQ_SRC_CLEAN chmod -R 755 $ARTIQ_SRC_CLEAN/.git @@ -20,6 +21,7 @@ let } EOF 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 ]; } ''