-
Notifications
You must be signed in to change notification settings - Fork 0
feat(nix): enhance unfree package configuration in home-manager and NixOS #321
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -31,12 +31,16 @@ in | |||||||||||||||||||||||||||
| inputs.agenix.homeManagerModules.default | ||||||||||||||||||||||||||||
| ]; | ||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||
| nixpkgs.config.allowUnfreePredicate = | ||||||||||||||||||||||||||||
| pkg: | ||||||||||||||||||||||||||||
| builtins.elem (lib.getName pkg) [ | ||||||||||||||||||||||||||||
| "claude-code" | ||||||||||||||||||||||||||||
| "qwen-code" | ||||||||||||||||||||||||||||
| ]; | ||||||||||||||||||||||||||||
| nixpkgs.config = { | ||||||||||||||||||||||||||||
| allowUnfree = true; | ||||||||||||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Configuring allowUnfree = true alongside allowUnfreePredicate is contradictory: allowUnfree = true permits all unfree packages and makes the predicate ineffective. Choose one path—either allow all unfree packages or remove allowUnfree to enforce the predicate. Prompt for AI agents |
||||||||||||||||||||||||||||
| allowUnfreePredicate = | ||||||||||||||||||||||||||||
| pkg: | ||||||||||||||||||||||||||||
| builtins.elem (lib.getName pkg) [ | ||||||||||||||||||||||||||||
| "claude-code" | ||||||||||||||||||||||||||||
| "qwen-code" | ||||||||||||||||||||||||||||
| "crush" | ||||||||||||||||||||||||||||
| ]; | ||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: Conflicting Unfree Settings Allow All PackagesSetting
Comment on lines
+35
to
+42
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The To allow only the specified list of unfree packages, you can define |
||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||
|
Comment on lines
+34
to
+43
|
||||||||||||||||||||||||||||
| nixpkgs.config = { | |
| allowUnfree = true; | |
| allowUnfreePredicate = | |
| pkg: | |
| builtins.elem (lib.getName pkg) [ | |
| "claude-code" | |
| "qwen-code" | |
| "crush" | |
| ]; | |
| }; | |
| nixpkgs.config = { | |
| allowUnfree = true; | |
| }; |
🤖 Prompt for AI Agents
In home-manager/default.nix around lines 34 to 43, remove the redundancy between
allowUnfree and allowUnfreePredicate: either (A) keep allowUnfree = true and
delete the entire allowUnfreePredicate block so all unfree packages are allowed,
or (B) set allowUnfree = false (or remove it) and keep the allowUnfreePredicate
array to selectively allow "claude-code", "qwen-code", and "crush"; apply one of
these two options and ensure the resulting nixpkgs.config is syntactically
valid.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,7 +7,10 @@ | |
| let | ||
| inherit (inputs) nixpkgs home-manager; | ||
| system = "x86_64-linux"; | ||
| pkgs = nixpkgs.legacyPackages.${system}; | ||
| pkgs = import nixpkgs { | ||
| inherit system; | ||
| config.allowUnfree = true; | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This global pkgs = import nixpkgs {
inherit system;
config.allowUnfreePredicate = pkg:
builtins.elem (lib.getName pkg) [
"claude-code" "qwen-code" "crush"
];
};This ensures consistent unfree package restrictions across both NixOS and home-manager. |
||
| }; | ||
| configuration = | ||
| { config, lib, ... }: | ||
| { | ||
|
|
@@ -104,7 +107,6 @@ nixpkgs.lib.nixosSystem { | |
| fsType = "ext4"; | ||
| }; | ||
|
|
||
| nixpkgs.config.allowUnfree = true; | ||
| nixpkgs.pkgs = pkgs; | ||
|
|
||
| fonts.packages = with pkgs; [ | ||
|
|
@@ -118,7 +120,7 @@ nixpkgs.lib.nixosSystem { | |
| home-manager.users."${username}" = import ../../home-manager { | ||
| inherit inputs username system; | ||
| lib = nixpkgs.lib; | ||
| pkgs = nixpkgs.legacyPackages.${system}; | ||
| pkgs = pkgs; | ||
| config = { }; | ||
| }; | ||
| } | ||
|
|
||
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.
Setting
allowUnfree = truehere is redundant and contradictory with theallowUnfreePredicatebelow. When using a predicate to restrict unfree packages to a specific allowlist, you don't need (and shouldn't use)allowUnfree = true. The predicate already enables unfree packages for those matching the condition. More critically, sincehosts/nixos/default.nixnow passes apkgsinstance configured with globalallowUnfree = true(line 12), this home-manager predicate won't effectively restrict packages from that shared pkgs instance.Agent: 🏛 Architecture •