-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathusers.nix
More file actions
73 lines (63 loc) · 1.67 KB
/
users.nix
File metadata and controls
73 lines (63 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
{ config, options, pkgs, lib, ... }:
let
cfg = config.my-config;
in
{
options = with pkgs.lib; {
my-config = {
handle = mkOption {
type = types.str;
default = "vidbina";
description = "Handle under which to configure the user. This is the Nix keyname and may be different from the username, but for good measure should not.";
};
uid = mkOption {
type = types.ints.positive;
default = 1988;
};
name = mkOption {
type = types.str;
default = cfg.handle;
};
email = mkOption {
type = types.str;
default = "vid@bina.me";
};
description = mkOption {
type = types.str;
default = "David Asabina <vid@bina.me>";
};
};
};
config = {
# Define a user account. Don't forget to set a password with ‘passwd’.
users = {
defaultUserShell = pkgs.zsh;
users = (lib.genAttrs [ cfg.handle ] (username: with cfg; {
inherit uid name description; # from cfg
isNormalUser = true;
createHome = true;
home = "/home/${username}";
extraGroups = [
"beep"
"dialout"
"lp"
"network"
"networkmanager"
"wheel"
"wireshark"
];
initialPassword = "#unsecure";
}));
};
environment = {
variables = {
# https://doc.qt.io/qt-5/highdpi.html
QT_SCREEN_SCALE_FACTORS = "2";
};
};
# TODO: Refactor into a smarter implementation
# Something that is more multi-user compatible
# The current config is single-user oriented
nix.settings.trusted-users = [ cfg.handle ];
};
}