summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Parri <simonparri@ganzeria.com>2025-06-14 17:06:54 -0500
committerSimon Parri <simonparri@ganzeria.com>2025-06-14 17:06:54 -0500
commit684ce4eac37ca022ad253fcb37bed5c17a301f33 (patch)
tree96620dee7b2024fefd3e8427e122e5f9288dbe17
parent94c63b5d30fae31b0b10f874bf5dc36d5d636275 (diff)
downloadnixos-config-684ce4eac37ca022ad253fcb37bed5c17a301f33.tar.gz
nixos-config-684ce4eac37ca022ad253fcb37bed5c17a301f33.zip
modules/unfree: Add unfree module and use it
-rw-r--r--hosts/tomato/hardware.nix1
-rw-r--r--modules/default.nix1
-rw-r--r--modules/unfree.nix19
3 files changed, 21 insertions, 0 deletions
diff --git a/hosts/tomato/hardware.nix b/hosts/tomato/hardware.nix
index 7fdb646..f08e788 100644
--- a/hosts/tomato/hardware.nix
+++ b/hosts/tomato/hardware.nix
@@ -39,6 +39,7 @@ in
linux-firmware
broadcom-bt-firmware
];
+ this.unfree.allowed = ["broadcom-bt-firmware"];
nixpkgs.hostPlatform = "x86_64-linux";
}
diff --git a/modules/default.nix b/modules/default.nix
index 034a4e3..f2c7560 100644
--- a/modules/default.nix
+++ b/modules/default.nix
@@ -12,6 +12,7 @@
./syslog.nix
./hosts.nix
./bluetooth.nix
+ ./unfree.nix
./overlays
];
diff --git a/modules/unfree.nix b/modules/unfree.nix
new file mode 100644
index 0000000..f7712f2
--- /dev/null
+++ b/modules/unfree.nix
@@ -0,0 +1,19 @@
+{ lib, config, ... }:
+
+cfg = config.this.unfree;
+inherit (builtins) elem;
+inherit (lib) getName;
+in
+{
+ options = {
+ this.unfree.allowed = lib.mkOption {
+ type = with lib.types; listOf str;
+ default = [];
+ };
+ };
+
+ config = {
+ nixpkgs.config.allowUnfreePredicate =
+ pkg: elem (getName pkg) cfg.allowed;
+ };
+}