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

nixos/top-level: change extraDependencies from packages to paths #237259

Merged
merged 4 commits into from
Jun 27, 2023

Conversation

ncfavier
Copy link
Member

I was once again trying to work around NixOS/nix#3995 by (recursively) adding my flake inputs to system.extraDependencies; this time nixd, which depends on flake-parts, which depends on the lib subdirectory of nixpkgs.

This fails because the subdirectory flake does not pass types.package.check: it's not a derivation, and it's not a store path either (it's a subdirectory of a store path).

Change the type to path, because there's no "store path or descendant" type. Honestly I'm not sure why anyone would ever use types.package at this point.

Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 23.11 Release Notes (or backporting 23.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

@ncfavier ncfavier requested a review from roberth June 11, 2023 22:53
@ncfavier ncfavier requested a review from dasJ as a code owner June 11, 2023 22:53
@github-actions github-actions bot added 6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: module (update) This PR changes an existing module in `nixos/` labels Jun 11, 2023
@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild 10.rebuild-linux: 1-10 labels Jun 11, 2023
@roberth
Copy link
Member

roberth commented Jun 12, 2023

because there's no "store path or descendant" type.

We could call that types.pathInStore perhaps.

Honestly I'm not sure why anyone would ever use types.package at this point.

Packages and paths should be treated differently, because packages can have multiple outputs. I'm pretty sure extraDependencies doesn't treat packages like packages. What even is the implied usage for those packages? Should it keep .doc? Does that even make sense? We should probably rename it to extraPaths, so that you can guess the behavior correctly, as it effectively just takes the outPath.

@ncfavier
Copy link
Member Author

Added pathInStore.

I'm not sure extraPaths is less ambiguous than extraDependencies so I've left the option name alone.

lib/types.nix Outdated Show resolved Hide resolved
lib/tests/modules.sh Outdated Show resolved Hide resolved
@ofborg ofborg bot added the 2.status: merge conflict This PR has merge conflicts with the target branch label Jun 26, 2023
@ncfavier ncfavier removed the 2.status: merge conflict This PR has merge conflicts with the target branch label Jun 26, 2023
@ofborg ofborg bot added 2.status: merge conflict This PR has merge conflicts with the target branch and removed 2.status: merge conflict This PR has merge conflicts with the target branch labels Jun 26, 2023
@Janik-Haag Janik-Haag added the 12.approvals: 1 This PR was reviewed and approved by one reputable person label Jun 27, 2023
ncfavier and others added 4 commits June 27, 2023 11:48
Allows adding subdirectory flake inputs that aren't top-level store paths.
Add missing test cases. I think the .links case should be rejected
even though it's technically a path in the store.
Now that the lib is tested with Nix 2.3, this isn't needed any more and
causes warnings.
@ncfavier ncfavier merged commit 3ef988c into NixOS:master Jun 27, 2023
@github-actions
Copy link
Contributor

Successfully created backport PR for release-23.05:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
6.topic: nixos Issues or PRs affecting NixOS modules, or package usability issues specific to NixOS 8.has: documentation 8.has: module (update) This PR changes an existing module in `nixos/` 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild 10.rebuild-linux: 1-10 12.approvals: 1 This PR was reviewed and approved by one reputable person
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants