2024-04-04 11:30:42 +00:00
|
|
|
clan-core:
|
2024-04-03 11:46:17 +00:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
flake-parts-lib,
|
|
|
|
inputs,
|
2024-04-16 10:02:22 +00:00
|
|
|
self,
|
2024-04-03 11:46:17 +00:00
|
|
|
...
|
|
|
|
}:
|
|
|
|
let
|
|
|
|
inherit (lib) mkOption types;
|
|
|
|
buildClan = import ../lib/build-clan {
|
2024-04-04 11:30:42 +00:00
|
|
|
inherit lib clan-core;
|
2024-04-03 11:46:17 +00:00
|
|
|
inherit (inputs) nixpkgs;
|
|
|
|
};
|
|
|
|
cfg = config.clan;
|
|
|
|
in
|
|
|
|
{
|
2024-05-31 15:22:38 +00:00
|
|
|
imports = [
|
|
|
|
# TODO: figure out how to print the deprecation warning
|
|
|
|
# "${inputs.nixpkgs}/nixos/modules/misc/assertions.nix"
|
|
|
|
(lib.mkRenamedOptionModule
|
|
|
|
[
|
|
|
|
"clan"
|
|
|
|
"clanName"
|
|
|
|
]
|
|
|
|
[
|
|
|
|
"clan"
|
|
|
|
"meta"
|
|
|
|
"name"
|
|
|
|
]
|
|
|
|
)
|
|
|
|
(lib.mkRenamedOptionModule
|
|
|
|
[
|
|
|
|
"clan"
|
|
|
|
"clanIcon"
|
|
|
|
]
|
|
|
|
[
|
|
|
|
"clan"
|
|
|
|
"meta"
|
|
|
|
"icon"
|
|
|
|
]
|
|
|
|
)
|
|
|
|
];
|
|
|
|
|
2024-04-03 11:46:17 +00:00
|
|
|
options.clan = {
|
|
|
|
directory = mkOption {
|
|
|
|
type = types.path;
|
|
|
|
description = "The directory containing the clan subdirectory";
|
2024-04-16 10:02:22 +00:00
|
|
|
default = self; # default to the directory of the flake
|
2024-04-03 11:46:17 +00:00
|
|
|
};
|
|
|
|
specialArgs = mkOption {
|
2024-04-05 16:40:08 +00:00
|
|
|
type = types.attrsOf types.raw;
|
2024-04-03 11:46:17 +00:00
|
|
|
default = { };
|
|
|
|
description = "Extra arguments to pass to nixosSystem i.e. useful to make self available";
|
|
|
|
};
|
|
|
|
machines = mkOption {
|
|
|
|
type = types.attrsOf types.raw;
|
|
|
|
default = { };
|
|
|
|
description = "Allows to include machine-specific modules i.e. machines.\${name} = { ... }";
|
|
|
|
};
|
2024-05-31 15:22:38 +00:00
|
|
|
|
|
|
|
# Checks are performed in 'buildClan'
|
|
|
|
# Not everyone uses flake-parts
|
|
|
|
meta = {
|
|
|
|
name = lib.mkOption {
|
|
|
|
type = types.nullOr types.str;
|
|
|
|
default = null;
|
|
|
|
description = "Needs to be (globally) unique, as this determines the folder name where the flake gets downloaded to.";
|
|
|
|
};
|
|
|
|
icon = mkOption {
|
|
|
|
type = types.nullOr types.path;
|
|
|
|
default = null;
|
|
|
|
description = "A path to an icon to be used for the clan in the GUI";
|
|
|
|
};
|
|
|
|
description = mkOption {
|
|
|
|
type = types.nullOr types.str;
|
|
|
|
default = null;
|
|
|
|
description = "A short description of the clan";
|
|
|
|
};
|
2024-04-03 11:46:17 +00:00
|
|
|
};
|
2024-05-31 15:22:38 +00:00
|
|
|
|
2024-04-03 11:46:17 +00:00
|
|
|
pkgsForSystem = mkOption {
|
|
|
|
type = types.functionTo types.raw;
|
|
|
|
default = _system: null;
|
|
|
|
description = "A map from arch to pkgs, if specified this nixpkgs will be only imported once for each system.";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
options.flake = flake-parts-lib.mkSubmoduleOptions {
|
|
|
|
clanInternals = lib.mkOption {
|
|
|
|
type = lib.types.submodule {
|
|
|
|
options = {
|
2024-06-22 19:31:01 +00:00
|
|
|
inventory = lib.mkOption { type = lib.types.attrsOf lib.types.unspecified; };
|
2024-06-24 19:42:55 +00:00
|
|
|
inventoryFile = lib.mkOption { type = lib.types.unspecified; };
|
|
|
|
|
2024-06-25 19:17:01 +00:00
|
|
|
clanModules = lib.mkOption { type = lib.types.attrsOf lib.types.path; };
|
|
|
|
source = lib.mkOption { type = lib.types.path; };
|
2024-05-31 15:22:38 +00:00
|
|
|
meta = lib.mkOption { type = lib.types.attrsOf lib.types.unspecified; };
|
2024-04-15 19:24:22 +00:00
|
|
|
all-machines-json = lib.mkOption { type = lib.types.attrsOf lib.types.unspecified; };
|
2024-04-03 11:46:17 +00:00
|
|
|
machines = lib.mkOption { type = lib.types.attrsOf (lib.types.attrsOf lib.types.unspecified); };
|
|
|
|
machinesFunc = lib.mkOption { type = lib.types.attrsOf (lib.types.attrsOf lib.types.unspecified); };
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
config = {
|
|
|
|
flake = buildClan {
|
|
|
|
inherit (cfg)
|
|
|
|
directory
|
|
|
|
specialArgs
|
|
|
|
machines
|
|
|
|
pkgsForSystem
|
2024-05-31 15:22:38 +00:00
|
|
|
meta
|
2024-04-03 11:46:17 +00:00
|
|
|
;
|
|
|
|
};
|
|
|
|
};
|
2024-04-04 11:30:42 +00:00
|
|
|
_file = __curPos.file;
|
2024-04-03 11:46:17 +00:00
|
|
|
}
|