diff --git a/flake-parts/dev-shells.nix b/flake-parts/dev-shells.nix index 5649b16..ebc5ad8 100644 --- a/flake-parts/dev-shells.nix +++ b/flake-parts/dev-shells.nix @@ -29,8 +29,8 @@ _: { packages = [ pkgs.nebula pkgs.bitwarden-cli - self'.packages.nebula-recert-host - self'.packages.nebula-recert-all-hosts + self'.packages.nebula-regen-host-cert + self'.packages.nebula-regen-all-host-certs ]; shellHook = '' diff --git a/flake-parts/scripts.nix b/flake-parts/scripts.nix index 7308cc4..c2a0782 100644 --- a/flake-parts/scripts.nix +++ b/flake-parts/scripts.nix @@ -10,16 +10,9 @@ { packages = "${self}/scripts" - |> lib.filesystem.listFilesRecursive - |> lib.map (file: { - name = - file - |> lib.unsafeDiscardStringContext - |> lib.removePrefix "${self}/scripts/" - |> lib.removeSuffix ".nix" - |> lib.replaceString "/" "-"; - value = import file { inherit self' pkgs lib; }; - }) - |> lib.listToAttrs; + |> builtins.readDir + |> lib.attrNames + |> lib.map (name: name |> lib.removeSuffix ".nix") + |> self.lib.genAttrs (name: import "${self}/scripts/${name}.nix" { inherit self' pkgs lib; }); }; } diff --git a/scripts/nebula/recert-all-hosts.nix b/scripts/nebula-regen-all-host-certs.nix similarity index 82% rename from scripts/nebula/recert-all-hosts.nix rename to scripts/nebula-regen-all-host-certs.nix index d143bda..23f3ded 100644 --- a/scripts/nebula/recert-all-hosts.nix +++ b/scripts/nebula-regen-all-host-certs.nix @@ -1,11 +1,11 @@ { self', pkgs, ... }: pkgs.writeShellApplication { - name = "nebula-recert-all-hosts"; + name = "nebula-regen-all-host-certs"; runtimeInputs = [ pkgs.bitwarden-cli pkgs.jq - self'.packages.nebula-recert-host + self'.packages.nebula-regen-host-cert ]; text = '' @@ -23,7 +23,7 @@ pkgs.writeShellApplication { for host in $hosts; do echo "Regenerating certificate for $host..." - nebula-recert-host "$host" "$ca_key" + nebula-regen-host-cert "$host" "$ca_key" done echo "Done!" diff --git a/scripts/nebula/recert-host.nix b/scripts/nebula-regen-host-cert.nix similarity index 97% rename from scripts/nebula/recert-host.nix rename to scripts/nebula-regen-host-cert.nix index 0db5bf2..1dd03f4 100644 --- a/scripts/nebula/recert-host.nix +++ b/scripts/nebula-regen-host-cert.nix @@ -1,6 +1,6 @@ { pkgs, ... }: pkgs.writeShellApplication { - name = "nebula-recert-host"; + name = "nebula-regen-host-cert"; runtimeInputs = [ pkgs.nebula