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.
This commit is contained in:
Maximilian Bosch 2020-10-12 23:12:41 +02:00
parent 58b8ae4127
commit 3743c42f23
No known key found for this signature in database
GPG Key ID: 091DBF4D1FC46B8E
1 changed files with 1 additions and 1 deletions

View File

@ -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 = {