diff --git a/hosts/nixos/configuration.nix b/hosts/nixos/configuration.nix index f6f6ce5..bc19cfc 100644 --- a/hosts/nixos/configuration.nix +++ b/hosts/nixos/configuration.nix @@ -7,13 +7,33 @@ inputs.sops-nix.nixosModules.sops inputs.lanzaboote.nixosModules.lanzaboote ./hardware-configuration.nix - ] ++ ( - let - modulesPath = ./modules; - moduleFiles = builtins.attrNames (builtins.readDir modulesPath); - in - map (module: modulesPath + ("/" + module)) moduleFiles - ); + ] ++ [ + ../../modules/core/packages.nix + ../../modules/core/time.nix + ../../modules/core/sops.nix + ../../modules/graphical/environment.nix + ../../modules/graphical/greetd.nix + ../../modules/graphical/hyprland.nix + ../../modules/graphical/steam.nix + ../../modules/graphical/thunar.nix + ../../modules/graphical/xfconf.nix + ../../modules/graphical/xserver.nix + ../../modules/graphical/flatpak.nix + ../../modules/graphical/ratbagd.nix + ../../modules/programs/nh.nix + ../../modules/programs/nix-ld.nix + ../../modules/programs/ssh.nix + ../../modules/programs/ydotool.nix + ../../modules/programs/zsh.nix + ../../modules/services/tailscale.nix + ../../modules/services/udisks2.nix + ../../modules/services/zerotierone.nix + ./modules/boot.nix + ./modules/network.nix + ./modules/users.nix + ./modules/hardware.nix + ./modules/services/restic.nix + ]; system.stateVersion = "25.05"; nix.settings.experimental-features = [ "nix-command" "flakes" ]; diff --git a/hosts/nixos/modules/programs/default.nix b/hosts/nixos/modules/programs/default.nix deleted file mode 100644 index e9c8523..0000000 --- a/hosts/nixos/modules/programs/default.nix +++ /dev/null @@ -1,15 +0,0 @@ -{ config, pkgs, ... }: - -{ - imports = [ - ./zsh.nix - ./hyprland.nix - ./thunar.nix - ./xfconf.nix - ./ssh.nix - ./ydotool.nix - ./steam.nix - ./nix-ld.nix - ./nh.nix - ]; -} diff --git a/hosts/nixos/modules/services/default.nix b/hosts/nixos/modules/services/default.nix deleted file mode 100644 index 05d62bd..0000000 --- a/hosts/nixos/modules/services/default.nix +++ /dev/null @@ -1,14 +0,0 @@ -{ config, pkgs, ... }: - -{ - imports = [ - ./xserver.nix - ./greetd.nix - ./tailscale.nix - ./flatpak.nix - ./restic.nix - ./zerotierone.nix - ./udisks2.nix - ./ratbagd.nix - ]; -} diff --git a/hosts/vps/configuration.nix b/hosts/vps/configuration.nix index 14d53c4..eca215f 100644 --- a/hosts/vps/configuration.nix +++ b/hosts/vps/configuration.nix @@ -3,13 +3,22 @@ { imports = [ inputs.sops-nix.nixosModules.sops - ] ++ ( - let - modulesPath = ./modules; - moduleFiles = builtins.attrNames (builtins.readDir modulesPath); - in - map (module: modulesPath + ("/" + module)) moduleFiles - ); + ../../modules/core/filesystem.nix + ../../modules/core/sops.nix + ../../modules/services/tailscale.nix + ../../modules/services/caddy.nix + ../../modules/services/forgejo.nix + ../../modules/services/openssh.nix + ../../modules/services/restic-rest-server.nix + ../../modules/services/trilium-server.nix + ../../modules/services/vaultwarden.nix + ../../modules/services/zipline.nix + ./modules/boot.nix + ./modules/network.nix + ./modules/users.nix + ./modules/tailscale.nix + ./modules/services/restic.nix + ]; system.stateVersion = "23.11"; nix.settings.experimental-features = [ "nix-command" "flakes" ]; diff --git a/hosts/vps/modules/services/default.nix b/hosts/vps/modules/services/default.nix deleted file mode 100644 index 5a36ff4..0000000 --- a/hosts/vps/modules/services/default.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ - imports = [ - ./tailscale.nix - ./vaultwarden.nix - ./openssh.nix - ./zipline.nix - ./caddy.nix - ./forgejo.nix - ./restic.nix - ./restic-rest-server.nix - ]; -} diff --git a/hosts/vps/modules/sops.nix b/hosts/vps/modules/sops.nix deleted file mode 100644 index b125b37..0000000 --- a/hosts/vps/modules/sops.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ rootPath, ... }: - -{ - sops.defaultSopsFile = rootPath + /secrets/secrets.yaml; - sops.defaultSopsFormat = "yaml"; - - sops.age.keyFile = "/home/toast/.config/sops/age/keys.txt"; -} diff --git a/hosts/vps/modules/tailscale.nix b/hosts/vps/modules/tailscale.nix new file mode 100644 index 0000000..6e4ad24 --- /dev/null +++ b/hosts/vps/modules/tailscale.nix @@ -0,0 +1,7 @@ +{ + services.tailscale = { + useRoutingFeatures = "both"; + permitCertUid = "caddy"; + extraUpFlags = [ "--ssh" ]; + }; +} diff --git a/hosts/vps/modules/filesystem.nix b/modules/core/filesystem.nix similarity index 100% rename from hosts/vps/modules/filesystem.nix rename to modules/core/filesystem.nix diff --git a/hosts/nixos/modules/packages.nix b/modules/core/packages.nix similarity index 100% rename from hosts/nixos/modules/packages.nix rename to modules/core/packages.nix diff --git a/hosts/nixos/modules/sops.nix b/modules/core/sops.nix similarity index 100% rename from hosts/nixos/modules/sops.nix rename to modules/core/sops.nix diff --git a/hosts/nixos/modules/time.nix b/modules/core/time.nix similarity index 100% rename from hosts/nixos/modules/time.nix rename to modules/core/time.nix diff --git a/hosts/nixos/modules/environment.nix b/modules/graphical/environment.nix similarity index 100% rename from hosts/nixos/modules/environment.nix rename to modules/graphical/environment.nix diff --git a/hosts/nixos/modules/services/flatpak.nix b/modules/graphical/flatpak.nix similarity index 100% rename from hosts/nixos/modules/services/flatpak.nix rename to modules/graphical/flatpak.nix diff --git a/hosts/nixos/modules/services/greetd.nix b/modules/graphical/greetd.nix similarity index 100% rename from hosts/nixos/modules/services/greetd.nix rename to modules/graphical/greetd.nix diff --git a/hosts/nixos/modules/programs/hyprland.nix b/modules/graphical/hyprland.nix similarity index 100% rename from hosts/nixos/modules/programs/hyprland.nix rename to modules/graphical/hyprland.nix diff --git a/hosts/nixos/modules/services/ratbagd.nix b/modules/graphical/ratbagd.nix similarity index 100% rename from hosts/nixos/modules/services/ratbagd.nix rename to modules/graphical/ratbagd.nix diff --git a/hosts/nixos/modules/programs/steam.nix b/modules/graphical/steam.nix similarity index 100% rename from hosts/nixos/modules/programs/steam.nix rename to modules/graphical/steam.nix diff --git a/hosts/nixos/modules/programs/thunar.nix b/modules/graphical/thunar.nix similarity index 100% rename from hosts/nixos/modules/programs/thunar.nix rename to modules/graphical/thunar.nix diff --git a/hosts/nixos/modules/programs/xfconf.nix b/modules/graphical/xfconf.nix similarity index 100% rename from hosts/nixos/modules/programs/xfconf.nix rename to modules/graphical/xfconf.nix diff --git a/hosts/nixos/modules/services/xserver.nix b/modules/graphical/xserver.nix similarity index 100% rename from hosts/nixos/modules/services/xserver.nix rename to modules/graphical/xserver.nix diff --git a/hosts/nixos/modules/programs/nh.nix b/modules/programs/nh.nix similarity index 100% rename from hosts/nixos/modules/programs/nh.nix rename to modules/programs/nh.nix diff --git a/hosts/nixos/modules/programs/nix-ld.nix b/modules/programs/nix-ld.nix similarity index 100% rename from hosts/nixos/modules/programs/nix-ld.nix rename to modules/programs/nix-ld.nix diff --git a/hosts/nixos/modules/programs/ssh.nix b/modules/programs/ssh.nix similarity index 100% rename from hosts/nixos/modules/programs/ssh.nix rename to modules/programs/ssh.nix diff --git a/hosts/nixos/modules/programs/ydotool.nix b/modules/programs/ydotool.nix similarity index 100% rename from hosts/nixos/modules/programs/ydotool.nix rename to modules/programs/ydotool.nix diff --git a/hosts/nixos/modules/programs/zsh.nix b/modules/programs/zsh.nix similarity index 100% rename from hosts/nixos/modules/programs/zsh.nix rename to modules/programs/zsh.nix diff --git a/hosts/vps/modules/services/caddy.nix b/modules/services/caddy.nix similarity index 100% rename from hosts/vps/modules/services/caddy.nix rename to modules/services/caddy.nix diff --git a/hosts/vps/modules/services/forgejo.nix b/modules/services/forgejo.nix similarity index 100% rename from hosts/vps/modules/services/forgejo.nix rename to modules/services/forgejo.nix diff --git a/hosts/vps/modules/services/openssh.nix b/modules/services/openssh.nix similarity index 100% rename from hosts/vps/modules/services/openssh.nix rename to modules/services/openssh.nix diff --git a/hosts/vps/modules/services/restic-rest-server.nix b/modules/services/restic-rest-server.nix similarity index 100% rename from hosts/vps/modules/services/restic-rest-server.nix rename to modules/services/restic-rest-server.nix diff --git a/modules/services/tailscale.nix b/modules/services/tailscale.nix new file mode 100644 index 0000000..a9e7521 --- /dev/null +++ b/modules/services/tailscale.nix @@ -0,0 +1,10 @@ +{ config, ... }: + +{ + sops.secrets."tailscale/authkey" = { }; + + services.tailscale = { + enable = true; + authKeyFile = config.sops.secrets."tailscale/authkey".path; + }; +} diff --git a/modules/services/trilium-server.nix b/modules/services/trilium-server.nix new file mode 100644 index 0000000..3a6fc5e --- /dev/null +++ b/modules/services/trilium-server.nix @@ -0,0 +1,7 @@ +{ + services.trilium-server = { + enable = true; + host = "127.0.0.1"; + port = 8080; + }; +} diff --git a/hosts/nixos/modules/services/udisks2.nix b/modules/services/udisks2.nix similarity index 100% rename from hosts/nixos/modules/services/udisks2.nix rename to modules/services/udisks2.nix diff --git a/hosts/vps/modules/services/vaultwarden.nix b/modules/services/vaultwarden.nix similarity index 100% rename from hosts/vps/modules/services/vaultwarden.nix rename to modules/services/vaultwarden.nix diff --git a/hosts/nixos/modules/services/zerotierone.nix b/modules/services/zerotierone.nix similarity index 100% rename from hosts/nixos/modules/services/zerotierone.nix rename to modules/services/zerotierone.nix diff --git a/hosts/vps/modules/services/zipline.nix b/modules/services/zipline.nix similarity index 100% rename from hosts/vps/modules/services/zipline.nix rename to modules/services/zipline.nix