summaryrefslogtreecommitdiff
path: root/modules/nixos/traits
diff options
context:
space:
mode:
Diffstat (limited to 'modules/nixos/traits')
-rw-r--r--modules/nixos/traits/24.05-compat.nix16
-rw-r--r--modules/nixos/traits/auto-upgrade.nix22
-rw-r--r--modules/nixos/traits/containers.nix14
-rw-r--r--modules/nixos/traits/home-manager.nix5
-rw-r--r--modules/nixos/traits/locale.nix14
-rw-r--r--modules/nixos/traits/nvidia.nix64
-rw-r--r--modules/nixos/traits/secrets.nix10
-rw-r--r--modules/nixos/traits/tailscale.nix20
-rw-r--r--modules/nixos/traits/users/default.nix6
-rw-r--r--modules/nixos/traits/users/seth.nix14
-rw-r--r--modules/nixos/traits/zram.nix10
11 files changed, 100 insertions, 95 deletions
diff --git a/modules/nixos/traits/24.05-compat.nix b/modules/nixos/traits/24.05-compat.nix
index 26dcbca..b6422d1 100644
--- a/modules/nixos/traits/24.05-compat.nix
+++ b/modules/nixos/traits/24.05-compat.nix
@@ -1,5 +1,17 @@
-{lib, ...}: {
+{ lib, ... }:
+{
imports = lib.optionals (lib.versionOlder lib.version "24.11pre") [
- (lib.mkAliasOptionModule ["hardware" "graphics" "extraPackages"] ["hardware" "opengl" "extraPackages"])
+ (lib.mkAliasOptionModule
+ [
+ "hardware"
+ "graphics"
+ "extraPackages"
+ ]
+ [
+ "hardware"
+ "opengl"
+ "extraPackages"
+ ]
+ )
];
}
diff --git a/modules/nixos/traits/auto-upgrade.nix b/modules/nixos/traits/auto-upgrade.nix
index bdb919c..1e65445 100644
--- a/modules/nixos/traits/auto-upgrade.nix
+++ b/modules/nixos/traits/auto-upgrade.nix
@@ -1,10 +1,8 @@
-{
- config,
- lib,
- ...
-}: let
+{ config, lib, ... }:
+let
cfg = config.traits.autoUpgrade;
-in {
+in
+{
options.traits.autoUpgrade = {
enable = lib.mkEnableOption "automatic updates";
};
@@ -14,16 +12,14 @@ in {
enable = true;
/*
- a workflow updates the flake every 24h at ~0:00UTC/8:00EST;
- most devices of mine will be in EST currently. this could probably be
- "01:00" or "daily" but i think that's a bit of a risk if i ever change/
- dont set the time zone for a device and forget about this lol
+ a workflow updates the flake every 24h at ~0:00UTC/8:00EST;
+ most devices of mine will be in EST currently. this could probably be
+ "01:00" or "daily" but i think that's a bit of a risk if i ever change/
+ dont set the time zone for a device and forget about this lol
*/
dates = lib.mkDefault "02:00";
flake = "github:getchoo/flake#${config.networking.hostName}";
- flags = [
- "--refresh"
- ];
+ flags = [ "--refresh" ];
};
};
}
diff --git a/modules/nixos/traits/containers.nix b/modules/nixos/traits/containers.nix
index 5170c34..d13c658 100644
--- a/modules/nixos/traits/containers.nix
+++ b/modules/nixos/traits/containers.nix
@@ -4,10 +4,12 @@
options,
pkgs,
...
-}: let
+}:
+let
cfg = config.traits.containers;
- enableNvidia = lib.elem "nvidia" (config.services.xserver.videoDrivers or []);
-in {
+ enableNvidia = lib.elem "nvidia" (config.services.xserver.videoDrivers or [ ]);
+in
+{
options.traits.containers = {
enable = lib.mkEnableOption "containers support";
};
@@ -18,7 +20,7 @@ in {
virtualisation = {
podman = {
enable = true;
- extraPackages = with pkgs; [podman-compose];
+ extraPackages = with pkgs; [ podman-compose ];
autoPrune.enable = true;
};
@@ -26,9 +28,7 @@ in {
};
}
- (lib.mkIf enableNvidia {
- hardware.nvidia-container-toolkit.enable = true;
- })
+ (lib.mkIf enableNvidia { hardware.nvidia-container-toolkit.enable = true; })
]
);
}
diff --git a/modules/nixos/traits/home-manager.nix b/modules/nixos/traits/home-manager.nix
index 01af5b1..687f01d 100644
--- a/modules/nixos/traits/home-manager.nix
+++ b/modules/nixos/traits/home-manager.nix
@@ -1,3 +1,4 @@
-{inputs, ...}: {
- imports = [inputs.home-manager.nixosModules.home-manager];
+{ inputs, ... }:
+{
+ imports = [ inputs.home-manager.nixosModules.home-manager ];
}
diff --git a/modules/nixos/traits/locale.nix b/modules/nixos/traits/locale.nix
index 1de19ce..bd30819 100644
--- a/modules/nixos/traits/locale.nix
+++ b/modules/nixos/traits/locale.nix
@@ -1,10 +1,8 @@
-{
- config,
- lib,
- ...
-}: let
+{ config, lib, ... }:
+let
cfg = config.traits.locale;
-in {
+in
+{
options.traits.locale = {
en_US = {
enable = lib.mkEnableOption "en_US locale";
@@ -14,9 +12,7 @@ in {
config = lib.mkMerge [
(lib.mkIf cfg.en_US.enable {
i18n = {
- supportedLocales = [
- "en_US.UTF-8/UTF-8"
- ];
+ supportedLocales = [ "en_US.UTF-8/UTF-8" ];
defaultLocale = "en_US.UTF-8";
};
diff --git a/modules/nixos/traits/nvidia.nix b/modules/nixos/traits/nvidia.nix
index 303d902..5fec7db 100644
--- a/modules/nixos/traits/nvidia.nix
+++ b/modules/nixos/traits/nvidia.nix
@@ -3,49 +3,53 @@
lib,
pkgs,
...
-}: let
+}:
+let
cfg = config.traits.nvidia;
usingNvidia = lib.elem "nvidia" config.services.xserver.videoDrivers;
-in {
+in
+{
options.traits.nvidia = {
enable = lib.mkEnableOption "NVIDIA drivers";
nvk.enable = lib.mkEnableOption "NVK specialisation";
};
- config = lib.mkIf cfg.enable (lib.mkMerge [
- {
- boot.kernelParams = lib.optional usingNvidia "nvidia_drm.fbdev=1";
+ config = lib.mkIf cfg.enable (
+ lib.mkMerge [
+ {
+ boot.kernelParams = lib.optional usingNvidia "nvidia_drm.fbdev=1";
- services.xserver.videoDrivers = ["nvidia"];
+ services.xserver.videoDrivers = [ "nvidia" ];
- hardware = {
- graphics.extraPackages = [pkgs.vaapiVdpau];
- nvidia = {
- package = lib.mkDefault config.boot.kernelPackages.nvidiaPackages.latest;
- modesetting.enable = true;
- };
- };
- }
-
- (lib.mkIf cfg.nvk.enable {
- specialisation = {
- nvk.configuration = {
- boot = {
- kernelParams = ["nouveau.config=NvGspRm=1"];
- initrd.kernelModules = ["nouveau"];
+ hardware = {
+ graphics.extraPackages = [ pkgs.vaapiVdpau ];
+ nvidia = {
+ package = lib.mkDefault config.boot.kernelPackages.nvidiaPackages.latest;
+ modesetting.enable = true;
};
+ };
+ }
- environment.sessionVariables = {
- MESA_VK_VERSION_OVERRIDE = "1.3";
- };
+ (lib.mkIf cfg.nvk.enable {
+ specialisation = {
+ nvk.configuration = {
+ boot = {
+ kernelParams = [ "nouveau.config=NvGspRm=1" ];
+ initrd.kernelModules = [ "nouveau" ];
+ };
+
+ environment.sessionVariables = {
+ MESA_VK_VERSION_OVERRIDE = "1.3";
+ };
- hardware.graphics.extraPackages = lib.mkForce [];
+ hardware.graphics.extraPackages = lib.mkForce [ ];
- services.xserver.videoDrivers = lib.mkForce ["modesetting"];
+ services.xserver.videoDrivers = lib.mkForce [ "modesetting" ];
- system.nixos.tags = ["with-nvk"];
+ system.nixos.tags = [ "with-nvk" ];
+ };
};
- };
- })
- ]);
+ })
+ ]
+ );
}
diff --git a/modules/nixos/traits/secrets.nix b/modules/nixos/traits/secrets.nix
index 862e76f..af66969 100644
--- a/modules/nixos/traits/secrets.nix
+++ b/modules/nixos/traits/secrets.nix
@@ -3,14 +3,16 @@
lib,
inputs,
...
-}: let
+}:
+let
cfg = config.traits.secrets;
-in {
+in
+{
options.traits.secrets = {
enable = lib.mkEnableOption "secrets management";
};
- imports = [inputs.agenix.nixosModules.default];
+ imports = [ inputs.agenix.nixosModules.default ];
config = lib.mkIf cfg.enable {
_module.args = {
@@ -18,7 +20,7 @@ in {
};
age = {
- identityPaths = ["/etc/age/key"];
+ identityPaths = [ "/etc/age/key" ];
};
};
}
diff --git a/modules/nixos/traits/tailscale.nix b/modules/nixos/traits/tailscale.nix
index a7d8c06..73c74e3 100644
--- a/modules/nixos/traits/tailscale.nix
+++ b/modules/nixos/traits/tailscale.nix
@@ -3,24 +3,24 @@
lib,
secretsDir,
...
-}: let
+}:
+let
cfg = config.traits.tailscale;
-in {
+in
+{
options.traits.tailscale = {
enable = lib.mkEnableOption "Tailscale";
ssh.enable = lib.mkEnableOption "Tailscale SSH";
- manageSecrets =
- lib.mkEnableOption "automatic secrets management"
- // {
- default = config.traits.secrets.enable && cfg.ssh.enable;
- };
+ manageSecrets = lib.mkEnableOption "automatic secrets management" // {
+ default = config.traits.secrets.enable && cfg.ssh.enable;
+ };
};
config = lib.mkIf cfg.enable (
lib.mkMerge [
{
networking.firewall = {
- trustedInterfaces = [config.services.tailscale.interfaceName];
+ trustedInterfaces = [ config.services.tailscale.interfaceName ];
};
services.tailscale = {
@@ -31,11 +31,11 @@ in {
(lib.mkIf cfg.ssh.enable {
networking.firewall = {
- allowedTCPPorts = [22];
+ allowedTCPPorts = [ 22 ];
};
services.tailscale = {
- extraUpFlags = ["--ssh"];
+ extraUpFlags = [ "--ssh" ];
};
})
diff --git a/modules/nixos/traits/users/default.nix b/modules/nixos/traits/users/default.nix
index a81dacf..df767b4 100644
--- a/modules/nixos/traits/users/default.nix
+++ b/modules/nixos/traits/users/default.nix
@@ -1,5 +1 @@
-{
- imports = [
- ./seth.nix
- ];
-}
+{ imports = [ ./seth.nix ]; }
diff --git a/modules/nixos/traits/users/seth.nix b/modules/nixos/traits/users/seth.nix
index 9ebb6c8..4b84892 100644
--- a/modules/nixos/traits/users/seth.nix
+++ b/modules/nixos/traits/users/seth.nix
@@ -3,15 +3,15 @@
lib,
secretsDir,
...
-}: let
+}:
+let
cfg = config.traits.users.seth;
-in {
+in
+{
options.traits.users.seth = {
- manageSecrets =
- lib.mkEnableOption "automatic secrets management"
- // {
- default = config.traits.secrets.enable;
- };
+ manageSecrets = lib.mkEnableOption "automatic secrets management" // {
+ default = config.traits.secrets.enable;
+ };
};
config = lib.mkMerge [
diff --git a/modules/nixos/traits/zram.nix b/modules/nixos/traits/zram.nix
index 337137a..d0c6a36 100644
--- a/modules/nixos/traits/zram.nix
+++ b/modules/nixos/traits/zram.nix
@@ -1,10 +1,8 @@
-{
- config,
- lib,
- ...
-}: let
+{ config, lib, ... }:
+let
cfg = config.traits.zram;
-in {
+in
+{
options.traits.zram = {
enable = lib.mkEnableOption "zram setup & configuration";
};