From 9a860d7715bc4828035c37f40cd5159ee910f4de Mon Sep 17 00:00:00 2001 From: alexion Date: Mon, 20 Jul 2026 13:02:26 -0400 Subject: [PATCH] refactor: flatten the single-file lib and system directories Each held one default.nix, so the directory added a level to descend without grouping anything. They are now lib.nix and system.nix beside flake.nix, which reads as the flake's own scaffolding. The shared base config's reference to the shared secrets file was relative to the directory it sat in, so it moves with the file. Verified to build the same system toplevel as before the move. --- flake.nix | 2 +- lib/default.nix => lib.nix | 20 +++++++++----------- system/default.nix => system.nix | 2 +- 3 files changed, 11 insertions(+), 13 deletions(-) rename lib/default.nix => lib.nix (77%) rename system/default.nix => system.nix (98%) diff --git a/flake.nix b/flake.nix index db74320..b1babdf 100644 --- a/flake.nix +++ b/flake.nix @@ -49,7 +49,7 @@ { self, nixpkgs, ... }@inputs: let inherit (nixpkgs) lib; - my = import ./lib { inherit lib inputs self; }; + my = import ./lib.nix { inherit lib inputs self; }; in { # Helper functions for discovering and building hosts. diff --git a/lib/default.nix b/lib.nix similarity index 77% rename from lib/default.nix rename to lib.nix index 3fa5dc1..6447e30 100644 --- a/lib/default.nix +++ b/lib.nix @@ -46,17 +46,15 @@ let inherit inputs; my = self.lib; }; - modules = - (collectNixFiles (self + "/modules")) - ++ [ - inputs.home-manager.nixosModules.home-manager - inputs.chaotic.nixosModules.default - inputs.disko.nixosModules.disko - inputs.sops-nix.nixosModules.sops - (self + "/system") - (self + "/hosts/${hostName}") - { networking.hostName = hostName; } - ]; + modules = (collectNixFiles (self + "/modules")) ++ [ + inputs.home-manager.nixosModules.home-manager + inputs.chaotic.nixosModules.default + inputs.disko.nixosModules.disko + inputs.sops-nix.nixosModules.sops + (self + "/system.nix") + (self + "/hosts/${hostName}") + { networking.hostName = hostName; } + ]; }; # Discover every host (a subdirectory of `hostsDir`) and build each one. diff --git a/system/default.nix b/system.nix similarity index 98% rename from system/default.nix rename to system.nix index f638be6..9fd38dd 100644 --- a/system/default.nix +++ b/system.nix @@ -93,7 +93,7 @@ in # satisfy the secret below. # Clearing both `sshKeyPaths` defaults keeps the SSH host keys out of the # decryption path. - sops.defaultSopsFile = ../secrets/shared.yaml; + sops.defaultSopsFile = ./secrets/shared.yaml; sops.age.keyFile = "/var/lib/sops-nix/key.txt"; sops.age.sshKeyPaths = [ ]; sops.gnupg.sshKeyPaths = [ ];