feat(meta): use manifest to define system configurations

This commit is contained in:
Mohammad Rafiq 2025-07-15 21:54:00 +08:00
parent 96321d4026
commit 084caa727b
No known key found for this signature in database
18 changed files with 125 additions and 131 deletions

View file

@ -6,11 +6,11 @@
}:
let
cfg = config.flake;
inherit (cfg.paths) secrets;
inherit (builtins) readFile;
inherit (lib.meta) getExe;
inherit (lib.strings) trim;
inherit (cfg.admin) username pubkey;
inherit (cfg.paths) secrets;
inherit (config.manifest.admin) username pubkey;
in
{
flake.modules = {

View file

@ -1,12 +1,12 @@
{ config, ... }:
let
cfg = config.flake;
inherit (config.manifest) admin;
in
{
flake.modules.nixos.default = {
security.sudo.wheelNeedsPassword = false;
nix.settings.trusted-users = [ "@wheel" ];
users.users.${cfg.admin.username}.extraGroups = [ "wheel" ];
users.users.${admin.username}.extraGroups = [ "wheel" ];
};
flake.modules.darwin.default.security = {
sudo.extraConfig = "%admin ALL = (ALL) NOPASSWD: ALL";

View file

@ -1,6 +1,7 @@
{ config, lib, ... }:
let
cfg = config.flake;
inherit (config.manifest) users admin;
inherit (cfg.lib.modules) userListToAttrs forAllUsers';
inherit (lib.lists) findFirstIndex;
inherit (builtins) attrNames;
@ -36,12 +37,12 @@ in
flake.modules.darwin.default =
{ config, ... }:
{
system.primaryUser = cfg.admin.username;
users.knownUsers = attrNames cfg.manifest.users;
system.primaryUser = admin.username;
users.knownUsers = attrNames users;
users.users = forAllUsers' (
name: _: {
home = "/Users/${name}";
uid = 501 + (findFirstIndex (x: x == name) null (attrNames cfg.manifest.users));
uid = 501 + (findFirstIndex (x: x == name) null (attrNames users));
}
);
home-manager.users = forAllUsers' (