Split up more nix functions

This commit is contained in:
Bun 2025-03-24 04:28:36 -04:00
parent 0b8d1f4eaf
commit b7a5fc7197
6 changed files with 48 additions and 50 deletions

View file

@ -1,24 +1,18 @@
{ config, lib, pkgs, unstable, ... }: { config, lib, pkgs, unstable, ... }:
{ {
options.nixpkgs.allowUnfreePackages = lib.mkOption { imports = [ ./unfree ];
type = with lib.types; listOf str;
nix = {
package = lib.mkForce pkgs.nix;
settings.experimental-features = [
"nix-command"
"flakes"
];
registry.unstable.flake = unstable;
}; };
config = { _module.args.pkgsUnstable = import unstable {
nix = { inherit (pkgs.stdenv.hostPlatform) system;
package = lib.mkForce pkgs.nix; inherit (config.nixpkgs) config;
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;
};
}; };
} }

View file

@ -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;
}

View file

@ -1,11 +1,6 @@
{ pkgs, ... }: { config, lib, pkgs, ... }:
{ {
services.udev.packages = [ services.udev.packages = lib.mkIf config.system.desktop.enable [
(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";
})
(pkgs.writeTextFile { (pkgs.writeTextFile {
name = "10-pdp.rules"; name = "10-pdp.rules";
text = ''SUBSYSTEM=="usb", ATTR{idVendor}=="2833", MODE="0666"''; text = ''SUBSYSTEM=="usb", ATTR{idVendor}=="2833", MODE="0666"'';

View file

@ -9,8 +9,6 @@
chooser_cmd = "${pkgs.slurp}/bin/slurp -f %o -or -B 00000066 -b 00000099"; chooser_cmd = "${pkgs.slurp}/bin/slurp -f %o -or -B 00000066 -b 00000099";
}; };
}; };
extraPortals = with pkgs; [ extraPortals = with pkgs; [ xdg-desktop-portal-gnome ];
xdg-desktop-portal-gnome
];
}; };
} }

View file

@ -1,29 +1,24 @@
{ config, lib, pkgs, unstable, ... }: { config, lib, pkgs, unstable, ... }:
{ {
imports = [ ./gc ]; imports = [
./gc
./unfree
];
options.nixpkgs.allowUnfreePackages = lib.mkOption { nix = {
type = with lib.types; listOf str; package = pkgs.lix;
settings = {
experimental-features = [
"nix-command"
"flakes"
];
auto-optimise-store = true;
trusted-users = [ "@wheel" ];
};
}; };
config = { _module.args.pkgsUnstable = import unstable {
nix = { inherit (pkgs.stdenv.hostPlatform) system;
package = pkgs.lix; inherit (config.nixpkgs) config;
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;
};
}; };
} }

View file

@ -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;
}