-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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: fix nixpkgs config
#4304
Conversation
lol |
Finally 👌 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test case, adapted from the linked issue:
{
inputs.home-manager = {
url = "github:gerg-l/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
outputs = {
self,
nixpkgs,
home-manager,
}: let
system = "x86_64-linux";
allowUnfree = {nixpkgs.config.allowUnfree = true;};
in {
homeConfigurations.test = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.${system};
modules = [
{
home = {
username = "test";
homeDirectory = "/home/test";
stateVersion = "22.11";
};
}
allowUnfree
({pkgs, ...}: {
home.packages = [pkgs.unrar];
})
];
};
};
}
nix run github:nix-community/home-manager -- --flake .#test build
completes successfully
Looks promising. Please make sure to follow the checklist, especially the commit message. |
Finally! Edit: (why the thumbs down? I'm so confused) |
yup, dealing with it now |
config
/overlays
#2942 config
/overlays
3b7a5dc
to
ee55fd4
Compare
alright ignore my struggling with naming all should be good now |
It should be noted that this fix is still a hack, and the idiomatic solution IMO is to change the |
I'm curious why |
Linking LnL7/nix-darwin@f9724c4 just in case it's useful to anyone; Home Manager doesn't seem to have quite the brokenness that plagued nix-darwin at the time, but hopefully it offers some food for thought on how external users of the module system should handle specifying a package set and the kind of interface I ended up settling on. |
that's basically what I'm saying, I could easily make a PR to switch it. but it'd obviously be a very breaking change |
I think this leaves two options for what we could do:
I'm not sure what's the best decision to go with here. But in my head, that's kind of what it comes down to. We could get something working and clean it up after. Or we could wait it out before properly implementing it. So what do you guys think is the right move? |
This comment was marked as outdated.
This comment was marked as outdated.
Wait what out? The issue is over a year old. There's no reason to hold back a 1 LOC nonintrusive change for something that should never have been in HM to begin with. As far as I know there is no "schedule" for breaking changes in HM either, only that it needs to follow the guidelines in the manual. The general consensus for such types of changes would be deprecate (warn) first whenever possible. If you want stability you would stick to the release branch, so this change would only be merged to the release branch until at least 23.11. PS the thumbs down on your first comment is because +1 comments are basically spam and add nothing to the conversation. |
There is no need to break compatibility to support specifying a package set in other ways. |
that's not really what I mean, if you're using the current idiomatic solution: pkgs = inputs.nixpkgs.legacyPackages.<system> inline everything it looks like this: _module.args.pkgs = import inputs.nixpkgs.legacyPackages.<system>.path {
system = "<system>";
inherit (config.nixpkgs) config overlays ;
} which is not that bad but if you're using pkgs = import inputs.nixpkgs {
system = "<system>";
overlays = [...];
config = {...};
} then you're instantiating _module.args.pkgs = import (import inputs.nixpkgs {
system = "<system>";
overlays = [...];
config = {...};
}).path {
system = "<system>";
inherit (config.nixpkgs) config overlays;
}; I'm very active in the unofficial NixOS discord server and I see this ALL. THE. TIME. My thoughts are deprecate passing IMO the idiomatic solution looks like this nixpkgs.system = "<system>";
_module.args.pkgs = import nixpkgs {
inherit (config.nixpkgs) config overlays;
} |
Sure, I agree the current behaviour is bad, just that a better behaviour can be supported without breaking existing use. (That said, passing a package set in directly is useful if you want to immutably override the package set and use |
that can easily be done with a |
It's not quite that simple; Home Manager needs |
tracked down the commits to blame for this: |
Should a test be added, to check that it won't break in the future? |
What would break? The actual fix to how |
Turns out |
Is anybody looking to merge this? |
I don't really know what else could be done... |
Thanks! Looks good to me so finally merged now. Apologies for the long delay. |
This might have closed #2954 too |
I think this workaround can be removed. I am however not sure in which version of home-manager that came in. Probably we cannot yet merge this since its not in `release-23.05` branch as this templates refer to. nix-community/home-manager#4304
With [1], this should now be taken into account properly. [1]: nix-community/home-manager#4304
I think this workaround can be removed. I am however not sure in which version of home-manager that came in. Probably we cannot yet merge this since its not in `release-23.05` branch as this templates refer to. nix-community/home-manager#4304
Description
Closes #2942
Checklist
Change is backwards compatible.
Code formatted with
./format
.Code tested through
nix-shell --pure tests -A run.all
ornix develop --ignore-environment .#all
using Flakes.Test cases updated/added. See example.
Commit messages are formatted like
See CONTRIBUTING for more information and recent commit messages for examples.
If this PR adds a new module
Maintainer CC