-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfiguration.nix
274 lines (229 loc) · 8.11 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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page, on
# https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
{pkgs, ...}: {
imports = [
# Include the results of the hardware scan.
./hardware-configuration.nix
];
# Use the systemd-boot EFI boot loader.
boot.loader.systemd-boot = {
enable = true;
editor = false;
configurationLimit = 16;
};
boot.loader.efi.canTouchEfiVariables = true;
boot.kernelPackages = pkgs.linuxPackages_6_11;
nix.gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 30d";
};
# Pick only one of the below networking options.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
networking.networkmanager.enable = true; # Easiest to use and most distros use this by default.
# Set your time zone.
time.timeZone = "America/Los_Angeles";
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# Select internationalisation properties.
i18n.defaultLocale = "en_US.UTF-8";
console = {
font = "Lat2-Terminus16";
useXkbConfig = true; # use xkb.options in tty.
};
# Enable the X11 windowing system.
programs.xwayland.enable = true;
services.xserver = {
enable = true;
autoRepeatDelay = 200;
autoRepeatInterval = 30;
# Use modesetting.
videoDrivers = ["modesetting" "intel"];
# Use xsession.
desktopManager.session = [
{
name = "xsession";
start = ''
${pkgs.runtimeShell} $HOME/.xsession &
waitPID=$!
'';
}
];
xkb = {
layout = "us";
options = "caps:escape";
};
# Disable synpatics because it's bad.
synaptics.enable = false;
};
# Enable libinput support for touchpad / mouse.
services.libinput = {
enable = true;
# Natural scrolling for regular mice.
mouse = {
naturalScrolling = true;
};
# Natural scrolling and the other usual options for touchpads.
touchpad = {
accelSpeed = "0.17";
naturalScrolling = true;
disableWhileTyping = true;
tapping = true;
# Don't reserve small regions of the touchpad to act as tappable buttons.
clickMethod = "clickfinger";
};
};
# Enable TLP.
services.tlp.enable = true;
# Trim.
services.fstrim.enable = true;
# Enable firmware updates.
services.fwupd.enable = true;
# Enable Tailscale.
services.tailscale = {
enable = true;
useRoutingFeatures = "client";
};
# Enable CUPS to print documents.
# Note: not right now. I don't have the patience.
# services.printing.enable = true;
# Polkit.
security.polkit.enable = true;
security.polkit.extraConfig = ''
polkit.addRule(function (action, subject) {
if (action.id == "net.reactivated.fprint.device.enroll" && (subject.isInGroup("users") || subject.isInGroup("wheel"))) {
return polkit.Result.YES;
}
})
'';
# Fingerprint reader.
services.fprintd.enable = true;
security.pam.services = let
lid-is-open = pkgs.writeShellApplication {
name = "pam-lid-is-open";
runtimeInputs = [pkgs.gnugrep];
text = ''
set -eu
${pkgs.gnugrep}/bin/grep -qPe 'state:[[:space:]]*closed' "$1"
'';
};
text = ''
# Account management.
account required pam_unix.so # unix (order 10900)
# Authentication management.
auth sufficient pam_unix.so likeauth try_first_pass # unix (order 11600)
auth [success=1 default=ignore] pam_exec.so quiet ${lid-is-open}/bin/pam-lid-is-open /proc/acpi/button/lid/LID0/state
auth sufficient /nix/store/fq4vbhdk8dqywxirg3wb99zidfss7sbi-fprintd-1.94.2/lib/security/pam_fprintd.so timeout=10 # fprintd (order 11400)
auth required pam_deny.so # deny (order 12400)
# Password management.
password sufficient pam_unix.so nullok yescrypt # unix (order 10200)
# Session management.
session required pam_env.so conffile=/etc/pam/environment readenv=0 # env (order 10100)
session required pam_unix.so # unix (order 10200)
'';
in {
i3lock.text = text;
i3lock-color.text = text;
sudo.text = ''
# Account management.
account required pam_unix.so # unix (order 10900)
# Authentication management.
auth sufficient pam_unix.so likeauth try_first_pass # unix (order 11600)
auth [success=1 default=ignore] pam_exec.so quiet ${lid-is-open}/bin/pam-lid-is-open /proc/acpi/button/lid/LID0/state
auth sufficient /nix/store/fq4vbhdk8dqywxirg3wb99zidfss7sbi-fprintd-1.94.2/lib/security/pam_fprintd.so timeout=10 # fprintd (order 11400)
auth required pam_deny.so # deny (order 12400)
# Password management.
password sufficient pam_unix.so nullok yescrypt # unix (order 10200)
# Session management.
session required pam_env.so conffile=/etc/pam/environment readenv=0 # env (order 10100)
session required pam_unix.so # unix (order 10200)
'';
};
# Enable sound.
# NOTE: sound.enable removed, pipewire enabled by default.
# sound.enable = true;
# hardware.pulseaudio.enable = true;
security.rtkit.enable = true;
# OpenGL.
hardware.graphics.enable = true;
hardware.graphics.extraPackages = [
pkgs.mesa
pkgs.mesa.drivers
pkgs.vaapiIntel
pkgs.vaapiVdpau
pkgs.libvdpau-va-gl
pkgs.intel-media-driver
];
# Bluetooth.
hardware.bluetooth.enable = true;
services.blueman.enable = true;
# Set up regular user and some packages that should be available out of the gate.
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = [
pkgs.bash
pkgs.coreutils
pkgs.curl
pkgs.openssh
pkgs.wget
];
programs = {
fish.enable = true; # This probably isn't needed, really.
zsh.enable = true; # Needed for a few scripts.
neovim.enable = true; # Backup editor.
git.enable = true; # To fetch dotfiles.
};
# List services that you want to enable:
# For keyring access. Necessary for 1Password.
services.gnome.gnome-keyring.enable = true;
programs.seahorse.enable = true;
# Enable the OpenSSH daemon.
services.openssh = {
enable = true;
settings = {
PasswordAuthentication = false;
};
};
programs.ssh.startAgent = true;
# logind-friendly locker.
# TODO: probably move this to home-manager.
programs.xss-lock = {
enable = true;
lockerCommand = "${pkgs.i3lock}/bin/i3lock --color=000000";
};
# Because Gnome has infected the rest of the ecosystem.
programs.dconf.enable = true;
# Thunderbolt daemon.
services.hardware.bolt.enable = true;
# Ambient light sensor.
hardware.sensor.iio.enable = true;
# Thermal management.
services.thermald.enable = true;
# Screen brightness.
services.illum.enable = true;
# Battery access.
services.upower.enable = true;
# Open ports in the firewall (if needed).
networking.firewall.enable = true;
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# This option defines the first version of NixOS you have installed on this particular machine,
# and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions.
#
# Most users should NEVER change this value after the initial install, for any reason,
# even if you've upgraded your system to a new NixOS release.
#
# This value does NOT affect the Nixpkgs version your packages and OS are pulled from,
# so changing it will NOT upgrade your system.
#
# This value being lower than the current NixOS release does NOT mean your system is
# out of date, out of support, or vulnerable.
#
# Do NOT change this value unless you have manually inspected all the changes it would make to your configuration,
# and migrated your data accordingly.
#
# For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion .
system.stateVersion = "23.11"; # Did you read the comment?
}