refactor(modules): clean up folder structure

This commit is contained in:
Mohammad Rafiq 2025-07-07 19:24:36 +08:00
parent d8aa7f62b4
commit 03fca8b28b
No known key found for this signature in database
12 changed files with 32 additions and 38 deletions

39
nix/meta.nix Normal file
View file

@ -0,0 +1,39 @@
{
lib,
config,
inputs,
...
}:
let
inherit (lib.options) mkOption;
inherit (lib.types) path lazyAttrsOf raw;
inherit (inputs.flake-parts.lib) mkSubmoduleOptions;
inherit (cfg.lib.attrsets) firstAttrNameMatching;
cfg = config.flake;
username = firstAttrNameMatching (_: v: v.primary or false) cfg.manifest.users;
in
{
options.flake = mkSubmoduleOptions {
lib = mkOption {
type = lazyAttrsOf raw;
default = { };
};
paths = {
root = mkOption { type = path; };
secrets = mkOption {
type = path;
readOnly = true;
};
};
admin = mkOption {
type = lazyAttrsOf raw;
default = { };
};
};
config.flake = {
paths.secrets = cfg.paths.root + "/secrets";
admin = cfg.manifest.users.${username} // {
inherit username;
};
};
}