2022-12-21 21:18:03 +00:00
|
|
|
|
{ config, pkgs, lib, ... }: {
|
2022-04-29 01:56:21 +00:00
|
|
|
|
|
2022-05-06 03:01:56 +00:00
|
|
|
|
options = {
|
2022-04-29 01:56:21 +00:00
|
|
|
|
|
2022-05-06 03:01:56 +00:00
|
|
|
|
passwordHash = lib.mkOption {
|
2022-10-02 14:48:51 +00:00
|
|
|
|
type = lib.types.nullOr lib.types.str;
|
2022-05-06 03:01:56 +00:00
|
|
|
|
description = "Password created with mkpasswd -m sha-512";
|
2022-12-06 17:56:29 +00:00
|
|
|
|
default = null;
|
2022-10-01 18:28:32 +00:00
|
|
|
|
# Test it by running: mkpasswd -m sha-512 --salt "PZYiMGmJIIHAepTM"
|
2022-05-06 03:01:56 +00:00
|
|
|
|
};
|
2022-04-29 01:56:21 +00:00
|
|
|
|
|
2022-05-06 03:01:56 +00:00
|
|
|
|
};
|
|
|
|
|
|
2022-12-21 21:18:03 +00:00
|
|
|
|
config = lib.mkIf (pkgs.stdenv.isLinux) {
|
2022-05-06 03:01:56 +00:00
|
|
|
|
|
2022-05-15 02:51:57 +00:00
|
|
|
|
# Allows us to declaritively set password
|
|
|
|
|
users.mutableUsers = false;
|
|
|
|
|
|
2022-05-06 03:01:56 +00:00
|
|
|
|
# Define a user account. Don't forget to set a password with ‘passwd’.
|
|
|
|
|
users.users.${config.user} = {
|
|
|
|
|
|
|
|
|
|
# Create a home directory for human user
|
|
|
|
|
isNormalUser = true;
|
|
|
|
|
|
|
|
|
|
# Automatically create a password to start
|
|
|
|
|
hashedPassword = config.passwordHash;
|
|
|
|
|
|
|
|
|
|
extraGroups = [
|
|
|
|
|
"wheel" # Sudo privileges
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
};
|
2022-04-29 01:56:21 +00:00
|
|
|
|
|
2022-05-09 00:49:42 +00:00
|
|
|
|
home-manager.users.${config.user}.xdg = {
|
2023-03-09 03:56:07 +00:00
|
|
|
|
|
|
|
|
|
# Allow Nix to manage the default applications list
|
|
|
|
|
mimeApps.enable = true;
|
|
|
|
|
|
|
|
|
|
# Set directories for application defaults
|
2022-05-09 00:49:42 +00:00
|
|
|
|
userDirs = {
|
|
|
|
|
enable = true;
|
|
|
|
|
createDirectories = true;
|
|
|
|
|
documents = "$HOME/documents";
|
2022-05-11 03:45:50 +00:00
|
|
|
|
download = config.userDirs.download;
|
2022-05-09 00:49:42 +00:00
|
|
|
|
music = "$HOME/media/music";
|
|
|
|
|
pictures = "$HOME/media/images";
|
|
|
|
|
videos = "$HOME/media/videos";
|
|
|
|
|
desktop = "$HOME/other/desktop";
|
|
|
|
|
publicShare = "$HOME/other/public";
|
|
|
|
|
templates = "$HOME/other/templates";
|
|
|
|
|
extraConfig = { XDG_DEV_DIR = "$HOME/dev"; };
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2022-04-29 01:56:21 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|