diff options
| author | Seth Flynn <[email protected]> | 2025-02-13 16:54:19 -0500 |
|---|---|---|
| committer | Seth Flynn <[email protected]> | 2025-02-13 22:09:11 -0500 |
| commit | 386ecf3d14ea486aba523b14200fcd2e7e04b9d6 (patch) | |
| tree | c9009fe26ece76f0c9d76ba89895094ee500b054 /modules/nixos/traits | |
| parent | fdd2dd359c1d72b9ebeb676efb4141b5536f160c (diff) | |
nixos: make more "traits" mixins
Diffstat (limited to 'modules/nixos/traits')
| -rw-r--r-- | modules/nixos/traits/containers.nix | 26 | ||||
| -rw-r--r-- | modules/nixos/traits/default.nix | 4 | ||||
| -rw-r--r-- | modules/nixos/traits/resolved.nix | 40 | ||||
| -rw-r--r-- | modules/nixos/traits/tailscale.nix | 52 | ||||
| -rw-r--r-- | modules/nixos/traits/zram.nix | 22 |
5 files changed, 0 insertions, 144 deletions
diff --git a/modules/nixos/traits/containers.nix b/modules/nixos/traits/containers.nix deleted file mode 100644 index b684803..0000000 --- a/modules/nixos/traits/containers.nix +++ /dev/null @@ -1,26 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: -let - cfg = config.traits.containers; -in -{ - options.traits.containers = { - enable = lib.mkEnableOption "support for containers"; - }; - - config = lib.mkIf cfg.enable { - virtualisation = { - podman = { - enable = true; - extraPackages = [ pkgs.podman-compose ]; - autoPrune.enable = true; - }; - - oci-containers.backend = "podman"; - }; - }; -} diff --git a/modules/nixos/traits/default.nix b/modules/nixos/traits/default.nix index aafa445..6b1e796 100644 --- a/modules/nixos/traits/default.nix +++ b/modules/nixos/traits/default.nix @@ -1,16 +1,12 @@ { imports = [ ./arm-builder.nix - ./containers.nix ./determinate.nix ./home-manager.nix ./locale.nix ./mac-builder.nix ./nvd-diff.nix - ./resolved.nix ./secrets.nix - ./tailscale.nix ./users - ./zram.nix ]; } diff --git a/modules/nixos/traits/resolved.nix b/modules/nixos/traits/resolved.nix deleted file mode 100644 index f21f8c3..0000000 --- a/modules/nixos/traits/resolved.nix +++ /dev/null @@ -1,40 +0,0 @@ -{ - config, - lib, - ... -}: -let - cfg = config.traits.resolved; -in -{ - options.traits.resolved = { - enable = lib.mkEnableOption "systemd-resolved as the DNS resolver" // { - default = true; - }; - - networkManagerIntegration = lib.mkEnableOption "integration with network-manager" // { - default = config.networking.networkmanager.enable; - defaultText = "config.networking.networkmanager.enable"; - }; - }; - - config = lib.mkIf cfg.enable ( - lib.mkMerge [ - { - networking.nameservers = [ - "1.1.1.1#one.one.one.one" - "1.0.0.1#one.one.one.one" - ]; - - services.resolved = { - enable = true; - dnsovertls = "true"; - }; - } - - (lib.mkIf cfg.networkManagerIntegration { - networking.networkmanager.dns = "systemd-resolved"; - }) - ] - ); -} diff --git a/modules/nixos/traits/tailscale.nix b/modules/nixos/traits/tailscale.nix deleted file mode 100644 index ea38e5c..0000000 --- a/modules/nixos/traits/tailscale.nix +++ /dev/null @@ -1,52 +0,0 @@ -{ - config, - lib, - secretsDir, - ... -}: -let - cfg = config.traits.tailscale; -in -{ - options.traits.tailscale = { - enable = lib.mkEnableOption "Tailscale"; - ssh.enable = lib.mkEnableOption "Tailscale SSH"; - manageSecrets = lib.mkEnableOption "automatic management of secrets"; - }; - - config = lib.mkIf cfg.enable ( - lib.mkMerge [ - { - networking.firewall = { - # all connections from tailscale are safe...or should be - trustedInterfaces = [ config.services.tailscale.interfaceName ]; - }; - - services.tailscale = { - enable = true; - openFirewall = true; - }; - } - - (lib.mkIf cfg.ssh.enable { - networking.firewall = { - allowedTCPPorts = [ 22 ]; - }; - - services.tailscale = { - extraUpFlags = [ "--ssh" ]; - }; - }) - - (lib.mkIf cfg.manageSecrets { - age.secrets = lib.mkIf cfg.manageSecrets { - tailscaleAuthKey.file = "${secretsDir}/tailscaleAuthKey.age"; - }; - - services.tailscale = { - authKeyFile = config.age.secrets.tailscaleAuthKey.path; - }; - }) - ] - ); -} diff --git a/modules/nixos/traits/zram.nix b/modules/nixos/traits/zram.nix deleted file mode 100644 index f5ba2a9..0000000 --- a/modules/nixos/traits/zram.nix +++ /dev/null @@ -1,22 +0,0 @@ -{ config, lib, ... }: -let - cfg = config.traits.zram; -in -{ - options.traits.zram = { - enable = lib.mkEnableOption "zram and sysctl optimizations"; - }; - - config = lib.mkIf cfg.enable { - # https://github.com/pop-os/default-settings/pull/163 - # https://wiki.archlinux.org/title/Zram#Multiple_zram_devices - boot.kernel.sysctl = { - "vm.swappiness" = 180; - "vm.watermark_boost_factor" = 0; - "vm.watermark_scale_factor" = 125; - "vm.page-cluster" = 0; - }; - - zramSwap.enable = true; - }; -} |
