From b7a5fc7197ef73960143b0eaa47366d952911cc5 Mon Sep 17 00:00:00 2001 From: Bun Date: Mon, 24 Mar 2025 04:28:36 -0400 Subject: [PATCH] Split up more nix functions --- modules/home/settings/nix/default.nix | 30 ++++++-------- modules/home/settings/nix/unfree/default.nix | 8 ++++ modules/system/devices/udev/default.nix | 9 +---- .../services/general/portals/default.nix | 4 +- modules/system/settings/nix/default.nix | 39 ++++++++----------- .../system/settings/nix/unfree/default.nix | 8 ++++ 6 files changed, 48 insertions(+), 50 deletions(-) create mode 100644 modules/home/settings/nix/unfree/default.nix create mode 100644 modules/system/settings/nix/unfree/default.nix diff --git a/modules/home/settings/nix/default.nix b/modules/home/settings/nix/default.nix index 08fc5727..02cd9488 100644 --- a/modules/home/settings/nix/default.nix +++ b/modules/home/settings/nix/default.nix @@ -1,24 +1,18 @@ { config, lib, pkgs, unstable, ... }: { - options.nixpkgs.allowUnfreePackages = lib.mkOption { - type = with lib.types; listOf str; + imports = [ ./unfree ]; + + nix = { + package = lib.mkForce pkgs.nix; + settings.experimental-features = [ + "nix-command" + "flakes" + ]; + registry.unstable.flake = unstable; }; - config = { - nix = { - package = lib.mkForce pkgs.nix; - settings.experimental-features = [ - "nix-command" - "flakes" - ]; - registry.unstable.flake = unstable; - }; - - nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) config.nixpkgs.allowUnfreePackages; - - _module.args.pkgsUnstable = import unstable { - inherit (pkgs.stdenv.hostPlatform) system; - inherit (config.nixpkgs) config; - }; + _module.args.pkgsUnstable = import unstable { + inherit (pkgs.stdenv.hostPlatform) system; + inherit (config.nixpkgs) config; }; } diff --git a/modules/home/settings/nix/unfree/default.nix b/modules/home/settings/nix/unfree/default.nix new file mode 100644 index 00000000..c9730546 --- /dev/null +++ b/modules/home/settings/nix/unfree/default.nix @@ -0,0 +1,8 @@ +{ config, lib, ... }: +{ + options.nixpkgs.allowUnfreePackages = lib.mkOption { + type = with lib.types; listOf str; + }; + + config.nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) config.nixpkgs.allowUnfreePackages; +} diff --git a/modules/system/devices/udev/default.nix b/modules/system/devices/udev/default.nix index 3c18a922..584c33be 100644 --- a/modules/system/devices/udev/default.nix +++ b/modules/system/devices/udev/default.nix @@ -1,11 +1,6 @@ -{ pkgs, ... }: +{ config, lib, pkgs, ... }: { - services.udev.packages = [ - (pkgs.writeTextFile { - name = "10-oculus.rules"; - text = ''KERNEL=="hidraw*", ATTRS{idVendor}=="0e6f", ATTRS{idProduct}=="0184", MODE="0660", TAG+="uaccess"''; - destination = "/etc/udev/rules.d/10-oculus.rules"; - }) + services.udev.packages = lib.mkIf config.system.desktop.enable [ (pkgs.writeTextFile { name = "10-pdp.rules"; text = ''SUBSYSTEM=="usb", ATTR{idVendor}=="2833", MODE="0666"''; diff --git a/modules/system/services/general/portals/default.nix b/modules/system/services/general/portals/default.nix index 8ce9e7dd..ab79ac74 100644 --- a/modules/system/services/general/portals/default.nix +++ b/modules/system/services/general/portals/default.nix @@ -9,8 +9,6 @@ chooser_cmd = "${pkgs.slurp}/bin/slurp -f %o -or -B 00000066 -b 00000099"; }; }; - extraPortals = with pkgs; [ - xdg-desktop-portal-gnome - ]; + extraPortals = with pkgs; [ xdg-desktop-portal-gnome ]; }; } diff --git a/modules/system/settings/nix/default.nix b/modules/system/settings/nix/default.nix index 885127ce..04218665 100644 --- a/modules/system/settings/nix/default.nix +++ b/modules/system/settings/nix/default.nix @@ -1,29 +1,24 @@ { config, lib, pkgs, unstable, ... }: { - imports = [ ./gc ]; + imports = [ + ./gc + ./unfree + ]; - options.nixpkgs.allowUnfreePackages = lib.mkOption { - type = with lib.types; listOf str; + nix = { + package = pkgs.lix; + settings = { + experimental-features = [ + "nix-command" + "flakes" + ]; + auto-optimise-store = true; + trusted-users = [ "@wheel" ]; + }; }; - config = { - nix = { - package = pkgs.lix; - settings = { - experimental-features = [ - "nix-command" - "flakes" - ]; - auto-optimise-store = true; - trusted-users = [ "@wheel" ]; - }; - }; - - nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) config.nixpkgs.allowUnfreePackages; - - _module.args.pkgsUnstable = import unstable { - inherit (pkgs.stdenv.hostPlatform) system; - inherit (config.nixpkgs) config; - }; + _module.args.pkgsUnstable = import unstable { + inherit (pkgs.stdenv.hostPlatform) system; + inherit (config.nixpkgs) config; }; } diff --git a/modules/system/settings/nix/unfree/default.nix b/modules/system/settings/nix/unfree/default.nix new file mode 100644 index 00000000..c9730546 --- /dev/null +++ b/modules/system/settings/nix/unfree/default.nix @@ -0,0 +1,8 @@ +{ config, lib, ... }: +{ + options.nixpkgs.allowUnfreePackages = lib.mkOption { + type = with lib.types; listOf str; + }; + + config.nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) config.nixpkgs.allowUnfreePackages; +}