-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfiguration.nix
175 lines (156 loc) · 3.77 KB
/
configuration.nix
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
{
pkgs,
inputs,
config,
...
}:
let
user_id = 1000;
username = "e";
in
{
imports = [
inputs.hardware-configuration.outPath
./vm.nix
./nvidia.nix
];
hardware = {
# Required for sway to start
graphics = {
enable = true;
enable32Bit = true;
};
bluetooth = {
enable = true;
powerOnBoot = true;
};
};
nix.settings.experimental-features = [
"nix-command"
"flakes"
];
environment = {
systemPackages = with pkgs; [
git
];
sessionVariables = {
# faster rustc linker times
RUSTFLAGS = "-C linker=clang -C link-arg=-fuse-ld=${pkgs.mold}/bin/mold";
# it puts into $HOME/go by default
GOPATH = "$HOME/.go";
# fixes invisible cursors in Sway
WLR_NO_HARDWARE_CURSORS = "1";
};
};
### Fonts
fonts = {
packages = with pkgs; [
noto-fonts
noto-fonts-cjk-sans
noto-fonts-emoji
(nerdfonts.override {
fonts = [
"JetBrainsMono"
];
})
texlivePackages.xcharter
];
fontconfig = {
enable = true;
defaultFonts = {
monospace = [ "JetBrainsMono NF" ];
sansSerif = [ "Noto Sans" ];
serif = [ "Noto Serif" ];
emoji = [ "Noto Emoji" ];
};
};
};
# To set up Sway using Home Manager, first you must enable Polkit in your nix configuration: https://wiki.nixos.org/wiki/Sway
security.polkit.enable = true;
users.users.${username} = {
initialPassword = "e";
uid = user_id;
isNormalUser = true;
extraGroups = [
# allow using `sudo`
"wheel"
# allow configuring wifi
"networkmanager"
];
shell = pkgs.u.nushell;
};
networking = {
hostName = "nixos";
firewall.enable = true;
networkmanager.enable = true;
};
services = {
libinput.enable = true;
# adds all executables to /usr/bin to be able to run
# various scripts on NixOS
envfs.enable = true;
# required for Vial (keyboard configurator)
udev.extraRules = ''
KERNEL=="hidraw*", SUBSYSTEM=="hidraw", ATTRS{serial}=="*vial:f64c2b3c*", MODE="0660", GROUP="users", TAG+="uaccess", TAG+="udev-acl"
'';
};
### Locale
time.timeZone = "Europe/London";
i18n.defaultLocale = "en_GB.UTF-8";
### Sound
# rtkit is optional but recommended https://wiki.nixos.org/wiki/PipeWire
security.rtkit.enable = true;
services.pipewire = {
package = pkgs.u.pipewire;
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
};
### SSH
services.openssh = {
enable = true;
settings = {
PermitRootLogin = "no";
PasswordAuthentication = false;
};
};
environment.sessionVariables.SSH_AUTH_SOCK = "/run/user/${builtins.toString user_id}/ssh-agent";
programs.ssh.startAgent = true;
# service add ssh key on login
systemd.user.services.ssh-add-key = {
wantedBy = [ "default.target" ];
after = [ "ssh-agent.service" ];
serviceConfig = {
Type = "oneshot";
ExecStartPre = "${pkgs.coreutils-full}/bin/sleep 1";
ExecStart = [
"${pkgs.openssh}/bin/ssh-add ${config.users.users.${username}.home}/.ssh/id_ed25519"
];
Restart = "on-failure";
RestartSec = 1;
};
};
### Kernel
fileSystems."/".options = [
"noatime"
"nodiratime"
"discard"
];
boot = {
kernelPackages = pkgs.linuxPackages_latest;
kernelParams = [
"intel_pstate=no_hwp"
"quiet"
];
loader.efi.canTouchEfiVariables = true;
loader.grub = {
enable = true;
device = "nodev";
efiSupport = true;
};
# see instructions in README for how to configure LUKS encryption
initrd.luks.devices.cryptroot.device = "/dev/disk/by-partlabel/luks_root";
};
system.stateVersion = "24.11";
}