Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flake.nix: allow inclusion of nixpkgs as path:/.../ #100363

Merged
merged 1 commit into from Oct 13, 2020

Conversation

Ma27
Copy link
Member

@Ma27 Ma27 commented Oct 12, 2020

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.

Motivation for this change
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@Ma27 Ma27 added the 9.needs: port to stable A PR needs a backport to the stable release. label Oct 12, 2020
flake.nix Outdated Show resolved Hide resolved
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.
@edolstra edolstra merged commit 0acab87 into NixOS:master Oct 13, 2020
@Ma27 Ma27 deleted the flake-no-modification-rev branch October 13, 2020 11:19
@Ma27
Copy link
Member Author

Ma27 commented Oct 13, 2020

Ported to stable as f7fe019.

@Ma27 Ma27 added 8.has: port to stable A PR already has a backport to the stable release. and removed 9.needs: port to stable A PR needs a backport to the stable release. labels Oct 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
8.has: port to stable A PR already has a backport to the stable release. 10.rebuild-darwin: 0 10.rebuild-linux: 0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants