summary refs log tree commit diff
path: root/flake.nix
diff options
context:
space:
mode:
authorMaximilian Bosch <maximilian@mbosch.me>2020-10-12 23:12:41 +0200
committerMaximilian Bosch <maximilian@mbosch.me>2020-10-13 12:05:19 +0200
commit3743c42f23767dca657f1a5d3eb67945e373ff94 (patch)
tree8be9f2e0ede727b1e2380e9088767eb460cf603b /flake.nix
parent58b8ae4127b7ce3103c97ae2d68f71546b2bd494 (diff)
downloadnixpkgs-3743c42f23767dca657f1a5d3eb67945e373ff94.tar
nixpkgs-3743c42f23767dca657f1a5d3eb67945e373ff94.tar.gz
nixpkgs-3743c42f23767dca657f1a5d3eb67945e373ff94.tar.bz2
nixpkgs-3743c42f23767dca657f1a5d3eb67945e373ff94.tar.lz
nixpkgs-3743c42f23767dca657f1a5d3eb67945e373ff94.tar.xz
nixpkgs-3743c42f23767dca657f1a5d3eb67945e373ff94.tar.zst
nixpkgs-3743c42f23767dca657f1a5d3eb67945e373ff94.zip
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.
Diffstat (limited to 'flake.nix')
-rw-r--r--flake.nix2
1 files changed, 1 insertions, 1 deletions
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 = {