From 3743c42f23767dca657f1a5d3eb67945e373ff94 Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Mon, 12 Oct 2020 23:12:41 +0200 Subject: [PATCH] flake.nix: allow inclusion of `nixpkgs` as `path:/.../` When adding `nixpkgs` as flake-input using the `path`-fetcher, you currently get the following error since neither `lastModifiedDate` nor `lastModified` are stored in `flake.lock` for paths: ``` error: --- EvalError --------------------------------------------------------------------------- nix-build at: (48:71) in file: /nix/store/147clg8svaxyj7pl80ra9kmmm72mdg94-source/flake.nix 47| system.nixos.versionSuffix = 48| ".${final.substring 0 8 (self.lastModifiedDate or self.lastModified)}.${self.shortRev or "dirty"}"; | ^ 49| system.nixos.revision = final.mkIf (self ? rev) self.rev; attribute 'lastModified' missing ``` This patch adds the fallback-value `19700101` to `versionSuffix` if none of `lastModified{,Date}` are set in the lockfile. --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 8440c460b16..cf0185d3ad6 100644 --- a/flake.nix +++ b/flake.nix @@ -45,7 +45,7 @@ modules ++ [ { system.nixos.versionSuffix = - ".${final.substring 0 8 (self.lastModifiedDate or self.lastModified)}.${self.shortRev or "dirty"}"; + ".${final.substring 0 8 (self.lastModifiedDate or self.lastModified or "19700101")}.${self.shortRev or "dirty"}"; system.nixos.revision = final.mkIf (self ? rev) self.rev; system.build = {