flake: define flake-parts options for colmena
This allows us to define options on the top level, so that we can write
modules to generate config for multiple hosts.
Idea from
1c51514586
This commit is contained in:
parent
c70b287890
commit
691c180ac1
|
@ -70,7 +70,7 @@
|
|||
|
||||
outputs = inputs@{ self, nixpkgs, nixpkgs-small, nixpkgs-unstable, flake-parts, colmena, ... }:
|
||||
flake-parts.lib.mkFlake { inherit inputs; } {
|
||||
imports = [ ];
|
||||
imports = [ ./flake ];
|
||||
|
||||
systems = [ "x86_64-linux" "aarch64-linux" ];
|
||||
|
||||
|
|
19
flake/colmena.nix
Normal file
19
flake/colmena.nix
Normal file
|
@ -0,0 +1,19 @@
|
|||
# https://git.lix.systems/the-distro/infra/src/commit/fbb23bf517206175764f154ddfd304b9ec501f87/colmena.nix
|
||||
{ lib, ... }: {
|
||||
options.flake.colmena = lib.mkOption {
|
||||
type = lib.types.submodule {
|
||||
freeformType = lib.types.attrsOf (lib.mkOptionType {
|
||||
name = "NixOS module";
|
||||
description = "module containing NixOS options and/or config";
|
||||
descriptionClass = "noun";
|
||||
check = value: builtins.isAttrs value || builtins.isFunction value || builtins.isPath value;
|
||||
merge = loc: defs: {
|
||||
imports = map (def: def.value) defs;
|
||||
};
|
||||
});
|
||||
options.meta = lib.mkOption {
|
||||
type = lib.types.attrs;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
5
flake/default.nix
Normal file
5
flake/default.nix
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
imports = [
|
||||
./colmena.nix
|
||||
];
|
||||
}
|
Loading…
Reference in a new issue