From b428768fe1c0c0a7a20b487697d94f2cc09c4ba9 Mon Sep 17 00:00:00 2001 From: Philipp Mandler Date: Wed, 15 Jan 2025 19:09:19 +0100 Subject: [PATCH] nix: Convert timestamp to iso date on build --- flake.nix | 4 ++-- nix/pkgs/frontend.nix | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.nix b/flake.nix index 6c13f447..f26ec96e 100644 --- a/flake.nix +++ b/flake.nix @@ -52,7 +52,7 @@ versionInfo = { commitHash = if (self ? rev) then self.rev else self.dirtyRev; - commitDate = lib.readFile "${prev.runCommand "timestamp" { env.when = self.lastModified; } "echo -n `date -d @$when --iso-8601=s` > $out"}"; + commitDate = self.lastModified; }; }; }); @@ -85,7 +85,7 @@ inherit pkgs lib; versionInfo = { commitHash = if (self ? rev) then self.rev else self.dirtyRev; - commitDate = lib.readFile "${pkgs.runCommand "timestamp" { env.when = self.lastModified; } "echo -n `date -d @$when --iso-8601=s` > $out"}"; + commitDate = self.lastModified; }; }); }; diff --git a/nix/pkgs/frontend.nix b/nix/pkgs/frontend.nix index e90f2aec..4033130b 100644 --- a/nix/pkgs/frontend.nix +++ b/nix/pkgs/frontend.nix @@ -44,7 +44,7 @@ pkgs.buildNpmPackage (lib.fix (self: { versionExports = ([ ] ++ (lib.optional (versionInfo ? commitHash) ''export COMMIT_HASH="${versionInfo.commitHash}"'') ++ (lib.optional (versionInfo ? commitDate) - ''export COMMIT_DATE="${versionInfo.commitDate}"'')); + ''export COMMIT_DATE="$(date -d @${versionInfo.commitDate} --iso-8601=s"''); in '' ${lib.concatStringsSep "\n" versionExports} '';