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

54 lines
1.1 KiB
Nix

{ config, lib, pkgs, vars, ... }:
let
inherit (vars) username name locale hostname sshKeys;
baseGroups = [
"users"
"wheel"
];
rpiGroups =
if config.hardware.raspberry-pi.enable then [
"audio"
"video"
"plugdev"
"adm"
"disk"
"i2c"
"spi"
"power"
] else [ ];
extraGroups = baseGroups ++ rpiGroups;
basePackages = with pkgs; [ home-manager ];
wslPackages =
if 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;
};
};
};
};
}