nixos-combined-flake/modules/nixos/base/user/default.nix

58 lines
1.1 KiB
Nix

{ config
, lib
, pkgs
, vars
, ...
}:
let
inherit (vars) username name sshKeys;
extraGroups = vars.extraGroups ++ [
"users"
"wheel"
"audio"
"video"
"disk"
"power"
"adm"
"plugdev"
] ++ lib.optionals config.hardware.raspberry-pi.enable [
"i2c"
"spi"
];
basePackages = with pkgs; [ home-manager ];
wslPackages =
if ((builtins.hasAttr "wsl" config) && config.wsl.enable)
then
with pkgs; [
wslu
wsl-open
]
else [ ];
packages = basePackages ++ wslPackages;
in
{
options = {
hardware.raspberry-pi.enable = lib.mkEnableOption "raspberry pi features";
};
config = {
users = {
groups.${username} = { };
users = {
${username} = {
inherit packages extraGroups;
name = username;
uid = 1000;
isNormalUser = true;
home = "/home/${username}";
description = name;
group = config.users.groups.${username}.name;
openssh.authorizedKeys.keys = sshKeys;
shell = pkgs.zsh;
};
};
};
};
}