feat(users): add shell module, simplify users module
This commit is contained in:
parent
a3ed4c608d
commit
0ca6436522
2 changed files with 18 additions and 7 deletions
17
nix/modules/shell.nix
Normal file
17
nix/modules/shell.nix
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
{ config, lib, ... }:
|
||||||
|
let
|
||||||
|
cfg = config.flake;
|
||||||
|
inherit (cfg.lib) forAllUsers';
|
||||||
|
inherit (lib.attrsets) mapAttrs';
|
||||||
|
in
|
||||||
|
{
|
||||||
|
flake.modules.nixos.default =
|
||||||
|
{ pkgs, ... }:
|
||||||
|
{
|
||||||
|
programs = mapAttrs' (name: value: {
|
||||||
|
name = value.shell;
|
||||||
|
value.enable = true;
|
||||||
|
}) cfg.manifest.users;
|
||||||
|
users.users = forAllUsers' (_: value: { shell = pkgs.${value.shell}; });
|
||||||
|
};
|
||||||
|
}
|
|
@ -6,13 +6,11 @@ let
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
flake.modules.nixos.default =
|
flake.modules.nixos.default =
|
||||||
{ pkgs, config, ... }:
|
{ config, ... }:
|
||||||
{
|
{
|
||||||
#TODO: move sudo/security options elsewhere
|
#TODO: move sudo/security options elsewhere
|
||||||
# security.sudo.wheelNeedsPassword = false;
|
# security.sudo.wheelNeedsPassword = false;
|
||||||
# nix.settings.trusted-users = [ "@wheel" ];
|
# nix.settings.trusted-users = [ "@wheel" ];
|
||||||
#TODO: move to shell config
|
|
||||||
# programs.${owner.shell}.enable = true;
|
|
||||||
#TODO: move ssh key settings elsewhere
|
#TODO: move ssh key settings elsewhere
|
||||||
# users.users.root.openssh.authorizedKeys.keys = [ owner.pubkey ];
|
# users.users.root.openssh.authorizedKeys.keys = [ owner.pubkey ];
|
||||||
users = {
|
users = {
|
||||||
|
@ -22,14 +20,10 @@ in
|
||||||
_: value: {
|
_: value: {
|
||||||
isNormalUser = true;
|
isNormalUser = true;
|
||||||
extraGroups = optional (value.primary or false) "wheel";
|
extraGroups = optional (value.primary or false) "wheel";
|
||||||
# FIXME: remove when we make the shell module
|
|
||||||
ignoreShellProgramCheck = true;
|
|
||||||
shell = pkgs.${value.shell};
|
|
||||||
openssh.authorizedKeys.keys = [ value.pubkey ];
|
openssh.authorizedKeys.keys = [ value.pubkey ];
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
home-manager.users = forAllUsers' (
|
home-manager.users = forAllUsers' (
|
||||||
name: _: {
|
name: _: {
|
||||||
home.username = name;
|
home.username = name;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue