From f6137cb149cf8ef3f79e5f699fce9e76e3ab999f Mon Sep 17 00:00:00 2001 From: Benedikt Ritter Date: Sun, 27 Oct 2024 11:08:31 +0100 Subject: [PATCH] virtualisation: Make parallels handling more lazy Moves the condition to allow parallels as an unfree module up one level. This is required for users who don't instantiate their own nixpkgs instance which causes `options.nixpkgs.pkgs.isDefined` being false. In this case, although `cfg.parallels.enable` is false, the `allowUnfreePredicate` will still be set resulting an error complaining about `allowUnfreePredicate` option being used but not defined. --- modules/nixos/virtualisation.nix | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/modules/nixos/virtualisation.nix b/modules/nixos/virtualisation.nix index 9a16724..1b79f56 100644 --- a/modules/nixos/virtualisation.nix +++ b/modules/nixos/virtualisation.nix @@ -97,10 +97,8 @@ in # parallels hardware.parallels.enable = lib.mkIf cfg.parallels.enable (lib.mkDefault true); - nixpkgs.config = lib.mkIf (!options.nixpkgs.pkgs.isDefined) { - allowUnfreePredicate = lib.mkIf cfg.parallels.enable ( - pkg: builtins.elem (lib.getName pkg) [ "prl-tools" ] - ); + nixpkgs.config = lib.mkIf (!options.nixpkgs.pkgs.isDefined && cfg.parallels.enable) { + allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ "prl-tools" ]; }; }; }