From 1f5d121fd079e81fcd02ffe8cc28f19f7f6f128e Mon Sep 17 00:00:00 2001 From: Pim Kunis Date: Fri, 29 Dec 2023 13:41:01 +0100 Subject: [PATCH] restructure nixos modules --- nixos/default.nix | 2 +- nixos/modules/{custom => }/backups.nix | 0 nixos/modules/{custom => }/data-disk.nix | 0 nixos/modules/{custom => }/default.nix | 0 nixos/modules/disk-config.nix | 33 ------------------- nixos/modules/{custom => }/disko.nix | 0 nixos/modules/{custom => }/k3s/bootstrap.nix | 0 nixos/modules/{custom => }/k3s/default.nix | 0 .../modules/{custom => }/ssh-certificates.nix | 7 ++-- .../{custom => }/terraform-database.nix | 4 +-- 10 files changed, 7 insertions(+), 39 deletions(-) rename nixos/modules/{custom => }/backups.nix (100%) rename nixos/modules/{custom => }/data-disk.nix (100%) rename nixos/modules/{custom => }/default.nix (100%) delete mode 100644 nixos/modules/disk-config.nix rename nixos/modules/{custom => }/disko.nix (100%) rename nixos/modules/{custom => }/k3s/bootstrap.nix (100%) rename nixos/modules/{custom => }/k3s/default.nix (100%) rename nixos/modules/{custom => }/ssh-certificates.nix (91%) rename nixos/modules/{custom => }/terraform-database.nix (92%) diff --git a/nixos/default.nix b/nixos/default.nix index 954c6d6..345dc44 100644 --- a/nixos/default.nix +++ b/nixos/default.nix @@ -1,7 +1,7 @@ { pkgs, config, lib, modulesPath, ... }: { imports = [ (modulesPath + "/installer/scan/not-detected.nix") - ./modules/custom + ./modules ]; boot = { diff --git a/nixos/modules/custom/backups.nix b/nixos/modules/backups.nix similarity index 100% rename from nixos/modules/custom/backups.nix rename to nixos/modules/backups.nix diff --git a/nixos/modules/custom/data-disk.nix b/nixos/modules/data-disk.nix similarity index 100% rename from nixos/modules/custom/data-disk.nix rename to nixos/modules/data-disk.nix diff --git a/nixos/modules/custom/default.nix b/nixos/modules/default.nix similarity index 100% rename from nixos/modules/custom/default.nix rename to nixos/modules/default.nix diff --git a/nixos/modules/disk-config.nix b/nixos/modules/disk-config.nix deleted file mode 100644 index b02df2f..0000000 --- a/nixos/modules/disk-config.nix +++ /dev/null @@ -1,33 +0,0 @@ -{ - disko.devices = { - disk = { - vdb = { - device = "/dev/nvme0n1"; - type = "disk"; - content = { - type = "gpt"; - partitions = { - ESP = { - type = "EF00"; - size = "500M"; - content = { - type = "filesystem"; - format = "vfat"; - mountpoint = "/boot"; - }; - }; - root = { - end = "-4G"; - content = { - type = "filesystem"; - format = "btrfs"; - mountpoint = "/"; - }; - }; - swap = { size = "100%"; }; - }; - }; - }; - }; - }; -} diff --git a/nixos/modules/custom/disko.nix b/nixos/modules/disko.nix similarity index 100% rename from nixos/modules/custom/disko.nix rename to nixos/modules/disko.nix diff --git a/nixos/modules/custom/k3s/bootstrap.nix b/nixos/modules/k3s/bootstrap.nix similarity index 100% rename from nixos/modules/custom/k3s/bootstrap.nix rename to nixos/modules/k3s/bootstrap.nix diff --git a/nixos/modules/custom/k3s/default.nix b/nixos/modules/k3s/default.nix similarity index 100% rename from nixos/modules/custom/k3s/default.nix rename to nixos/modules/k3s/default.nix diff --git a/nixos/modules/custom/ssh-certificates.nix b/nixos/modules/ssh-certificates.nix similarity index 91% rename from nixos/modules/custom/ssh-certificates.nix rename to nixos/modules/ssh-certificates.nix index d4c5a9d..79d28bf 100644 --- a/nixos/modules/custom/ssh-certificates.nix +++ b/nixos/modules/ssh-certificates.nix @@ -3,7 +3,8 @@ let cfg = config.custom.ssh; hostCert = builtins.toFile "host_ed25519-cert.pub" cfg.hostCert; userCert = builtins.toFile "user_ed25519-cert.pub" cfg.userCert; -in { +in +{ options = { custom = { ssh = { @@ -31,7 +32,7 @@ in { hostKey = lib.mkOption { default = - ../../secrets/${config.networking.hostName}_host_ed25519.age; + ../secrets/${config.networking.hostName}_host_ed25519.age; type = lib.types.path; description = '' SSH host key @@ -40,7 +41,7 @@ in { userKey = lib.mkOption { default = - ../../secrets/${config.networking.hostName}_user_ed25519.age; + ../secrets/${config.networking.hostName}_user_ed25519.age; type = lib.types.path; description = '' SSH user key diff --git a/nixos/modules/custom/terraform-database.nix b/nixos/modules/terraform-database.nix similarity index 92% rename from nixos/modules/custom/terraform-database.nix rename to nixos/modules/terraform-database.nix index 7c92ed8..fd0ab9b 100644 --- a/nixos/modules/custom/terraform-database.nix +++ b/nixos/modules/terraform-database.nix @@ -30,7 +30,7 @@ in { settings = let serverCert = builtins.toFile "postgresql_server.crt" - (builtins.readFile ../../postgresql_server.crt); + (builtins.readFile ../postgresql_server.crt); in { ssl = true; @@ -48,7 +48,7 @@ in { networking.firewall.allowedTCPPorts = [ 5432 ]; age.secrets."postgresql_server.key" = { - file = ../../secrets/postgresql_server.key.age; + file = ../secrets/postgresql_server.key.age; mode = "400"; owner = builtins.toString config.ids.uids.postgres; group = builtins.toString config.ids.gids.postgres;