blob: bf3d2c7d29c5a7c7dc1142e5b7c3310de8214f2a (
plain)
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
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
|
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running `nixos-help`).
{ config, pkgs, ... }:
let
user = "jp3";
home-manager = builtins.fetchTarball "https://github.com/nix-community/home-manager/archive/release-23.05.tar.gz";
dmenu-src = builtins.fetchTarball "https://git.jptrzy.xyz/dmenu/snapshot/master.tar.gz";
#dwm-src = builtins.fetchTarball "https://git.jptrzy.xyz/dwm/snapshot/master.tar.gz";
dwmblocks-src = builtins.fetchTarball "https://git.jptrzy.xyz/dwmblocks/snapshot/master.tar.gz";
neo-comic-mono-font = builtins.fetchTarball "https://git.jptrzy.xyz/neo-comic-mono-font/snapshot/master.tar.gz";
sent-src = builtins.fetchTarball "https://git.jptrzy.xyz/sent/snapshot/master.tar.gz";
slock-src = builtins.fetchTarball "https://git.jptrzy.xyz/slock/snapshot/master.tar.gz";
dwm-src = /home/${user}/.local/src/dwm;
in {
# NixOS Specific
# Copy the NixOS configuration - /run/current-system/configuration.nix
system.copySystemConfiguration = true;
# Check out https://nixos.org/nixos/options.html).
system.stateVersion = "23.05"; # Did you read the comment?
nixpkgs.config.allowUnfree = true;
nix.extraOptions = ''
experimental-features = nix-command flakes
'';
nix.gc.automatic = true;
imports = [
(import "${home-manager}/nixos")
# Include the results of the hardware scan.
./hardware-configuration.nix
# Autologin on tty1
./autologin.nix
];
nixpkgs.config.packageOverrides = pkgs: {
nur = import (builtins.fetchTarball "https://github.com/nix-community/NUR/archive/master.tar.gz") {
inherit pkgs;
};
vaapiIntel = pkgs.vaapiIntel.override { enableHybridCodec = true; };
angband = pkgs.angband.override {
enableSdl2 = true;
};
};
home-manager.users."${user}" = import ./home-manager/home.nix {
inherit user config pkgs;
inherit (pkgs) lib;
};
security.pam.services."${user}".enableGnomeKeyring = true;
security.wrappers = {
slock = {
owner = "root"; group = "root";
setuid = true;
source = "${pkgs.slock}/bin/slock";
};
};
# BootLoader
boot = {
initrd.luks.devices = { # Decrypt LUKS Partition before accessing LVM(s) partitions
root = {
device = "/dev/sda2";
preLVM = true;
};
};
loader = { # Use the systemd-boot EFI boot loader.
systemd-boot = {
enable = true;
configurationLimit = 3;
};
efi.canTouchEfiVariables = true;
};
};
# System
# Set your time zone.
time.timeZone = "Europe/Warsaw";
users.groups."${user}" = {};
# Define a user account. Don't forget to set a password with ‘passwd’.
users.users."${user}" = {
createHome = true;
isNormalUser = true;
extraGroups = [ "${user}" "wheel" "video" "audio" "disk" "networkmanager" ]; # Enable ‘sudo’ for the user.
group = "users";
home = "/home/${user}";
uid = 1000;
};
# Network
networking = {
hostName = "jp3-x270"; # Define your hostname.
networkmanager.enable = true; # Easiest to use and most distros use this by default.
};
# Enable sound.
sound.enable = true;
hardware = {
bluetooth = {
enable = true;
settings = {
General = {
Enable = "Source,Sink,Media,Socket";
};
};
};
pulseaudio = {
enable = true;
package = pkgs.pulseaudioFull;
extraConfig = "
load-module module-switch-on-connect
";
};
opengl = {
enable = true;
extraPackages = with pkgs; [
intel-media-driver # LIBVA_DRIVER_NAME=iHD
vaapiIntel # LIBVA_DRIVER_NAME=i965 (older but works better for Firefox/Chromium)
vaapiVdpau
libvdpau-va-gl
libGL
];
setLdLibraryPath = true;
};
};
services = {
logind.extraConfig = ''
HandleLidSwitch=suspend
'';
xserver = { # Enable the X11 windowing system.
enable = true;
layout = "pl";
xkbOptions = "caps:escape";
displayManager.sx.enable = true;
windowManager.dwm.enable = true;
libinput = {
enable = true;
touchpad = {
naturalScrolling = true;
clickMethod = "none";
tapping = false;
};
};
};
printing = {
enable = true;
drivers = [
pkgs.hplip
pkgs.hplipWithPlugin
];
};
avahi = {
enable = true;
nssmdns = true;
openFirewall = true;
};
auto-cpufreq.enable = true; # Helps battery life
flatpak.enable = true;
gvfs.enable = true; # Gvfs - Trash and MTP (Smartphones)
dbus.enable = true;
};
# Lock on lid close
#systemd.user.services.systemd-lock-handler = {
# enable = true;
#};
#systemd.services.xautolock-lid-close = {
# enable = true;
# description = "Enable xautolock on lid close";
# before = [ "sleep.target" ];
# wantedBy = [ "sleep.target" ];
# serviceConfig = {
# Type = "forking";
# User = "root";
# Environment = "DISPLAY=:1";
# ExecStartPre = "${pkgs.xorg.xhost}/bin/xhost si:localuser:root";
# ExecStart = "${pkgs.xautolock}/bin/xautolock --locknow";
# };
#};
# Services
# PinEntry for GnuPG
programs.gnupg.agent = {
enable = true;
pinentryFlavor = "gnome3";
enableSSHSupport = true;
};
# Portals
xdg.portal.enable = true;
xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-gtk ];
# Programs
# Enable Sceen Brightness
programs.light.enable = true;
programs.system-config-printer.enable = true;
# Fonts
fonts.fonts = with pkgs; [
noto-fonts
noto-fonts-cjk
noto-fonts-emoji
font-awesome
# Custom
(import "${neo-comic-mono-font}")
];
# Gaming
programs.steam = {
enable = true;
remotePlay.openFirewall = true; # Open ports in the firewall for Steam Remote Play
dedicatedServer.openFirewall = true; # Open ports in the firewall for Source Dedicated Server
};
# Suckless Overlays
nixpkgs.overlays = [
(final: prev: {
dmenu = prev.dmenu.overrideAttrs (old: { src = dmenu-src; });
dwm = prev.dwm.overrideAttrs (old: { src = dwm-src; });
dwmblocks = prev.dwmblocks.overrideAttrs (old: { src = dwmblocks-src; });
sent = prev.dwm.overrideAttrs (old: { src = sent-src; });
slock = prev.slock.overrideAttrs (old: {
src = slock-src;
buildInputs = with pkgs; [
xorg.libXinerama
xorg.libXft
imlib2
] ++ old.buildInputs;
});
})
];
# List packages installed in system profile. To search, run:
environment.binsh = "${pkgs.dash}/bin/dash";
# $ nix search wget
environment.systemPackages = with pkgs; [
#(import /home/.../.local/src/slock/default.nix {
# inherit fetchurl lib stdenv writeText;
# inherit libxcrypt;
# inherit (xorg) xorgproto libX11 libXext libXrandr;
#})
neovim
git
wget
htop
gnumake
gcc
gnupg
pass
killall
shellcheck
# Window Manager
cmus
dconf
dmenu dwm dwmblocks slock
xclip
nsxiv
zathura
pinentry-gnome gcr pinentry-gtk2
# Heavy
alacritty
firefox
gnome.nautilus
pika-backup
pavucontrol
logseq
heroic
lxappearance
fontpreview
ffmpeg
mpv
thunderbird
signal-desktop
w3m
texlive.combined.scheme-full
yt-dlp
curl
ueberzug
libnotify
abaddon # Discord
inkscape gimp krita
cups
arandr
monero-gui
sent
xautolock
fragments # Torrent client
# Gnome Apps without Gnome
gnome.adwaita-icon-theme libsecret gnome.seahorse
# Lanuguages
nil nix-index
# Games
angband
nethack
openttd
dolphin-emu
];
}
|