Skip to content

Commit

Permalink
feat: organize kubernetes in subdirectories
Browse files Browse the repository at this point in the history
  • Loading branch information
oliver-ni committed Jun 19, 2024
1 parent 7d8753d commit 096c179
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,23 @@
./profiles/base.nix
];

# Put modules for specific hosts here.
hosts = nixpkgs.lib.mapAttrs'
(filename: _: {
name = nixpkgs.lib.nameFromURL filename ".";
value = [ ./hosts/${filename} ];
})
(builtins.readDir ./hosts);

kubernetesModules = builtins.filter
(path: nixpkgs.lib.hasSuffix ".nix" path)
(nixpkgs.lib.mapAttrsToList
(filename: _: ./kubernetes/${filename})
(builtins.readDir ./kubernetes));
fs = nixpkgs.lib.fileset;
allNixFiles = fs.fileFilter (file: file.hasExt "nix") ./.;

kubernetesExtraModules = fs.toList
(fs.intersection allNixFiles ./kubernetes/extras);

kubernetesModules = fs.toList
(fs.intersection
(fs.fileFilter (file: file.hasExt "nix") ./.)
(fs.difference ./kubernetes ./kubernetes/extras));

openApiSpec = ./kube-openapi.json;

Expand Down Expand Up @@ -92,7 +96,7 @@
packages = forAllSystems (system: pkgs: {
kubernetes = transpire.lib.${system}.build.cluster {
inherit openApiSpec;
modules = kubernetesModules ++ [ ./kubernetes/extras/vault-secrets.nix ];
modules = kubernetesModules ++ kubernetesExtraModules;
};

# This is used for the `push-vault-secrets` app
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 096c179

Please sign in to comment.