From 635583669f8a1cad80b45f25b21c138ef6cf69b6 Mon Sep 17 00:00:00 2001 From: Hektor Misplon Date: Sun, 22 Feb 2026 14:08:19 +0100 Subject: [PATCH] refactor: add home 'allowedUnfree' option --- modules/audio/default.nix | 7 ++- modules/common/default.nix | 88 +++++++++++++++++++++----------------- 2 files changed, 53 insertions(+), 42 deletions(-) diff --git a/modules/audio/default.nix b/modules/audio/default.nix index 2067c73..dc6435a 100644 --- a/modules/audio/default.nix +++ b/modules/audio/default.nix @@ -1,6 +1,9 @@ -_: - { + nixpkgs.allowedUnfree = [ + "spotify" + "spotify-unwrapped" + ]; + security.rtkit.enable = true; services = { pulseaudio.enable = false; diff --git a/modules/common/default.nix b/modules/common/default.nix index 3f62336..531ef8f 100644 --- a/modules/common/default.nix +++ b/modules/common/default.nix @@ -1,58 +1,66 @@ -let - flakePath = "/home/h/nix"; -in { inputs, outputs, dotsPath, + config, ... }: +let + inherit (inputs.nixpkgs) lib; +in { imports = [ inputs.home-manager.nixosModules.default ]; - system.stateVersion = "25.05"; - - nix.settings.experimental-features = [ - "nix-command" - "flakes" - ]; - - nixpkgs.config.allowUnfree = true; - - home-manager = { - useGlobalPkgs = true; - useUserPackages = true; - extraSpecialArgs = { - inherit inputs outputs dotsPath; - }; + options.nixpkgs.allowedUnfree = lib.mkOption { + type = lib.types.listOf lib.types.str; + default = [ ]; }; - nix = { - optimise = { - automatic = true; - dates = [ "05:00" ]; - }; - gc = { - automatic = true; - dates = "weekly"; - options = "--delete-older-than 30d"; - }; - }; + config = { + system.stateVersion = "25.05"; - system.autoUpgrade = { - enable = true; - flake = flakePath; - flags = [ - "--recreate-lock-file" - "--commit-lock-file" - "--print-build-logs" - "--refresh" + nix.settings.experimental-features = [ + "nix-command" + "flakes" ]; - dates = "05:00"; - randomizedDelaySec = "45min"; - allowReboot = false; + + nixpkgs.config.allowUnfreePredicate = + pkg: builtins.elem (lib.getName pkg) config.nixpkgs.allowedUnfree; + + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + extraSpecialArgs = { + inherit inputs outputs dotsPath; + }; + }; + + nix = { + optimise = { + automatic = true; + dates = [ "05:00" ]; + }; + gc = { + automatic = true; + dates = "weekly"; + options = "--delete-older-than 30d"; + }; + }; + + system.autoUpgrade = { + enable = true; + flags = [ + "--recreate-lock-file" + "--commit-lock-file" + "--print-build-logs" + "--refresh" + ]; + dates = "05:00"; + randomizedDelaySec = "45min"; + allowReboot = false; + }; }; }