-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
Closed
Labels
0.kind: bugSomething is brokenSomething is broken
Description
Describe the bug
Specifying nixpkgs.config.allowUnfreePredicate in two files, and then importing one from the other, results in only one of the allowUnfreePredicates taking effect. Instead, any package matching any allowUnfreePredicate should be allowed.
Steps To Reproduce
Steps to reproduce the behavior:
- Specify
imports = [./host.nix];,fonts.fonts = [pkgs.corefonts];, andinnixpkgs.config.allowUnfreePredicate = pkg: builtins.elem ( lib.getName pkg ) ( map lib.getName [ pkgs.corefonts ] );
/etc/nixos/configuration.nix - Specify
and
nixpkgs.config.allowUnfreePredicate = pkg: ( builtins.elem ( lib.getName pkg ) ( map lib.getName [ pkgs.steam pkgs.steamPackages.steam ] ) );
programs.steam.enable = true;in/etc/nixos/host.nix. - Run
nixos-rebuild
This command will fail because only the /etc/nixos/configuration.nix allowUnfreePredicate is taken into account, so Steam can't be installed.
Expected behavior
Both pkgs.corefonts and pkgs.steam should be installed, analogous to how environment.systemPackages from imported packages are joined with local environment.systemPackages to install all of them.
Additional context
{
config,
lib,
modulesPath,
pkgs,
specialArgs,
options,
}: let
imports = [
/etc/nixos/cachix.nix
/etc/nixos/root.nix
];
in {
inherit imports;
nixpkgs.config.allowUnfreePredicate = pkg:
(builtins.elem (lib.getName pkg) [
"bar"
])
|| builtins.any (
path: let
package = import path {
inherit config lib modulesPath pkgs specialArgs options;
};
in
if builtins.hasAttr "nixpkgs" package
then package.nixpkgs.config.allowUnfreePredicate pkg
else false
)
imports;
}Notify maintainers
Metadata
- system:
"x86_64-linux" - host os:
Linux 5.15.74, NixOS, 22.05 (Quokka), 22.05.3737.3933d8bb912 - multi-user?:
yes - sandbox:
yes - version:
nix-env (Nix) 2.11.0 - channels(root):
"home-manager-22.05.tar.gz, nixos-22.05" - channels(victor):
"" - nixpkgs:
/nix/var/nix/profiles/per-user/root/channels/nixos
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
0.kind: bugSomething is brokenSomething is broken