feat(nixos): pass hostName to nixosSystem, move hm modules

This commit is contained in:
Mohammad Rafiq 2025-07-07 06:48:19 +08:00
parent f71c65f639
commit 94e045e0f3
No known key found for this signature in database
4 changed files with 7 additions and 5 deletions

30
nix/modules/users.nix Normal file
View file

@ -0,0 +1,30 @@
{ config, lib, ... }:
let
inherit (config.flake.lib) flattenAttrs;
inherit (lib.attrsets) filterAttrs;
owner = flattenAttrs (filterAttrs (_: v: (v.primary or false)) config.flake.manifest.users);
in
{
flake.modules.nixos.default =
{ pkgs, ... }:
{
#TODO: move sudo/security options elsewhere
security.sudo.wheelNeedsPassword = false;
nix.settings.trusted-users = [ "@wheel" ];
#TODO: move to shell config
programs.${owner.shell}.enable = true;
#TODO: move ssh key settings elsewhere
users = {
mutableUsers = false;
groups.users.gid = 100;
users.root.openssh.authorizedKeys.keys = [ owner.pubkey ];
users.${owner.username} = {
isNormalUser = true;
# hashedPasswordFile
extraGroups = [ "wheel" ];
shell = pkgs.${owner.shell};
openssh.authorizedKeys.keys = [ owner.pubkey ];
};
};
};
}