Created
August 24, 2026 02:42
-
-
Save qweered/c3ed7d8b22bc9dac59717b1f148d9522 to your computer and use it in GitHub Desktop.
nixpkgs: make allowUnfree default to true (used by qweered/hyprnixos via nixpkgs-patcher)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Make nixpkgs' `allowUnfree` default to true. | |
| This is what github:numtide/nixpkgs-unfree does, minus the second nixpkgs | |
| instance: that flake is `import nixpkgs { config.allowUnfree = true; ... }` | |
| re-exposed as `legacyPackages`, so it carries no nixpkgs source tree of its | |
| own -- nixpkgs-patcher and `nixpkgs.flake.source` both need a real tree, and | |
| its GitHub tarball pin would not share a store path with our channel tarball. | |
| `nixpkgs.config.allowUnfree` already covers the system closure. What this | |
| patch adds is the ad-hoc CLI: `nixpkgs.flake.source` pins the registry and | |
| NIX_PATH to the patched tree, and nixpkgs' own `legacyPackages` is | |
| `import ./. { }` with no config, so flipping the option default is what makes | |
| `nix shell nixpkgs#<unfree>` work purely, without NIXPKGS_ALLOW_UNFREE=1. | |
| `pkgs/top-level/config.nix` is eval-only -- it is never copied into a | |
| derivation -- so no package rebuilds. The only thing that changes is the | |
| patched-nixpkgs tree itself and the registry/NIX_PATH pin that follows it. | |
| diff --git a/pkgs/top-level/config.nix b/pkgs/top-level/config.nix | |
| --- a/pkgs/top-level/config.nix | |
| +++ b/pkgs/top-level/config.nix | |
| @@ -251,7 +251,7 @@ | |
| allowUnfree = mkOption { | |
| type = types.bool; | |
| - default = false; | |
| + default = true; | |
| # getEnv part is in check-meta.nix | |
| defaultText = literalExpression ''false || builtins.getEnv "NIXPKGS_ALLOW_UNFREE" == "1"''; | |
| description = '' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment