-
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
72 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/* | ||
A module to import into flakes based on flake-parts. | ||
Makes integration into a flake easy and tidy. | ||
See https://flake.parts, https://flake.parts/options/agenix-rekey | ||
*/ | ||
{ | ||
lib, | ||
self, | ||
config, | ||
flake-parts-lib, | ||
... | ||
}: let | ||
inherit | ||
(lib) | ||
mkOption | ||
types | ||
; | ||
in { | ||
options = { | ||
flake = flake-parts-lib.mkSubmoduleOptions { | ||
topology = mkOption { | ||
type = types.lazyAttrsOf types.unspecified; | ||
default = | ||
lib.mapAttrs | ||
(_system: config': | ||
import ./. { | ||
inherit (config'.topology) pkgs; | ||
modules = | ||
config'.topology.modules | ||
++ [ | ||
{inherit (config'.topology) nixosConfigurations;} | ||
]; | ||
}) | ||
config.allSystems; | ||
defaultText = "Automatically filled by nix-topology"; | ||
readOnly = true; | ||
description = '' | ||
The evaluated topology configuration, for each of the specified systems. | ||
Build the output by running `nix build .#topology.$system.config.output`. | ||
''; | ||
}; | ||
}; | ||
|
||
perSystem = flake-parts-lib.mkPerSystemOption ({ | ||
lib, | ||
pkgs, | ||
... | ||
}: { | ||
options.topology = { | ||
nixosConfigurations = mkOption { | ||
type = types.lazyAttrsOf types.unspecified; | ||
description = "All nixosSystems that should be evaluated for topology definitions."; | ||
default = self.nixosConfigurations; | ||
defaultText = lib.literalExpression "self.nixosConfigurations"; | ||
}; | ||
pkgs = mkOption { | ||
type = types.unspecified; | ||
description = "The package set to use for the topology evaluation on this system."; | ||
default = pkgs; | ||
defaultText = lib.literalExpression "pkgs # (module argument)"; | ||
}; | ||
modules = mkOption { | ||
type = types.listOf types.unspecified; | ||
description = "A list of additional topology modules to evaluate in your global topology."; | ||
default = []; | ||
}; | ||
}; | ||
}); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters