From 214bf51d4d5f313efdb48f8f3e075c324e2a0c8c Mon Sep 17 00:00:00 2001 From: Jonni Liljamo Date: Sat, 20 Jul 2024 16:17:59 +0300 Subject: [PATCH] feat(modules/unfree): unfree core module --- flake.nix | 1 - modules/default.nix | 5 +++++ modules/unfree.nix | 19 +++++++++++++++++++ roles/steam.nix | 11 +++++------ systems/profiles/desktop/default.nix | 1 + systems/profiles/laptop/default.nix | 1 + 6 files changed, 31 insertions(+), 7 deletions(-) create mode 100644 modules/default.nix create mode 100644 modules/unfree.nix diff --git a/flake.nix b/flake.nix index de40f30..4da1794 100644 --- a/flake.nix +++ b/flake.nix @@ -34,7 +34,6 @@ outputs = inputs: inputs.flake-parts.lib.mkFlake {inherit inputs;} { imports = [ - #./hm-modules ./systems ]; diff --git a/modules/default.nix b/modules/default.nix new file mode 100644 index 0000000..9df894a --- /dev/null +++ b/modules/default.nix @@ -0,0 +1,5 @@ +{ + imports = [ + ./unfree.nix + ]; +} diff --git a/modules/unfree.nix b/modules/unfree.nix new file mode 100644 index 0000000..bc009c2 --- /dev/null +++ b/modules/unfree.nix @@ -0,0 +1,19 @@ +{ + config, + lib, + ... +}: let + cfg = config.arta.unfree; +in { + options.arta.unfree = { + allow = lib.mkOption { + type = lib.types.listOf lib.types.str; + default = []; + }; + }; + + config = { + nixpkgs.config.allowUnfreePredicate = pkg: + builtins.elem (lib.getName pkg) cfg.allow; + }; +} diff --git a/roles/steam.nix b/roles/steam.nix index d0373ed..63325a8 100644 --- a/roles/steam.nix +++ b/roles/steam.nix @@ -11,12 +11,11 @@ in { }; config = lib.mkIf cfg.enable { - nixpkgs.config.allowUnfreePredicate = pkg: - builtins.elem (lib.getName pkg) [ - "steam-run" - "steam-original" - "steam" - ]; + arta.unfree.allow = [ + "steam-run" + "steam-original" + "steam" + ]; programs.steam = { enable = true; diff --git a/systems/profiles/desktop/default.nix b/systems/profiles/desktop/default.nix index e4402e1..226476e 100644 --- a/systems/profiles/desktop/default.nix +++ b/systems/profiles/desktop/default.nix @@ -9,6 +9,7 @@ inputs @ { impermanence.nixosModules.impermanence home-manager.nixosModules.home-manager + ../../../modules ../../../roles ]; specialArgs = { diff --git a/systems/profiles/laptop/default.nix b/systems/profiles/laptop/default.nix index e4402e1..226476e 100644 --- a/systems/profiles/laptop/default.nix +++ b/systems/profiles/laptop/default.nix @@ -9,6 +9,7 @@ inputs @ { impermanence.nixosModules.impermanence home-manager.nixosModules.home-manager + ../../../modules ../../../roles ]; specialArgs = { -- 2.44.1