-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfiguration.nix
1084 lines (951 loc) · 31.4 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
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
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
{
config,
pkgs,
inputs,
username,
...
}:
{
imports = [
# Include the results of the hardware scan.
./hardware-configuration.nix
./networking.nix
# ./steam.nix
# ./hdmi-cec.nix
# ./tuxedo-laptop-second-nvme-drive.nix
];
nix.settings.use-xdg-base-directories = true;
nix.settings.experimental-features = [
"nix-command"
"flakes"
# "auto-allocate-uids"
# "ca-derivations"
# "cgroups"
# "no-url-literals"
# "parse-toml-timestamps"
# "repl-flake"
];
# TODO: remove keys and caches here as they are specified in `./flake.nix`
nix.settings.builders-use-substitutes = true;
nix.settings.substituters = [
"https://cache.nixos.org"
"https://nix-community.cachix.org"
"https://cosmic.cachix.org/"
];
nix.settings.extra-substituters = [
"https://anyrun.cachix.org"
"https://yazi.cachix.org"
];
nix.settings.trusted-public-keys = [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"cosmic.cachix.org-1:Dya9IyXD4xdBehWjrkPv6rtxpmMdRel02smYzA85dPE="
];
nix.settings.extra-trusted-public-keys = [
"anyrun.cachix.org-1:pqBobmOjI7nKlsUMV25u9QHa9btJK65/C8vnO3p346s="
"yazi.cachix.org-1:Dcdz63NZKfvUCbDGngQDAZq6kOroIrFoyO064uvLh8k="
];
nix.settings.trusted-substituters = [ "https://cache.nixos.org" ];
nix.settings.trusted-users = [
# "root"
username
];
nix.settings.warn-dirty = false;
nix.checkConfig = true;
nix.checkAllErrors = true;
# TODO: can this be made dependent on the running machine e.g. NumCPU / 2
nix.settings.cores = 10; # number of cores per build, think `make -j N`
nix.settings.max-jobs = 6; # number of builds that can be ran in parallel
nix.settings.auto-optimise-store = true; # automatically detects files in the store that have identical contents, and replaces them with hard links to a single copy
# nix.settings.access-tokens = [ "github.com=" ];
nix.optimise.automatic = true;
nix.optimise.dates = [ "22:30" ];
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. It‘s perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "23.11"; # Did you read the comment?
# Allow unfree packages e.g. closed-source nvidia drivers
nixpkgs.config.allowUnfree = true;
nixpkgs.config.allowBroken = false;
# Needed by `nixd` lsp
nix.nixPath = [ "nixpkgs=${inputs.nixpkgs}" ];
programs.nh = {
enable = true;
clean.enable = true;
clean.extraArgs = "--keep-since 30d --keep 10";
flake = "/etc/nixos";
};
# system.autoUpgrade.enable = true;
# system.autoUpgrade.allowReboot = true;
# fileSystems."/mnt/ssd1" = {
# # fsType = "btrfs";
# fsType = "ext4";
# # device = "/dev/nvme0n1p1";
# device = "/dev/disk/by-uuid/52D0-5E93";
# # https://manpages.ubuntu.com/manpages/noble/en/man8/mount.8.html#filesystem-independent%20mount%20options
# # options = [
# # "users" # Allows any user to mount and unmount
# # "nofail" # Prevent system from failing if this drive doesn't mount
# # "exec" # Permit execution of binaries and other executable files.
# # "rw" # Mount the filesystem read-write.
# # ];
# };
# allow `perf` as user
boot.kernel.sysctl."kernel.perf_event_paranoid" = -1;
boot.kernel.sysctl."kernel.kptr_restrict" = pkgs.lib.mkForce 0;
# so `perf` can find kernel modules
systemd.tmpfiles.rules = [ "L /lib - - - - /run/current/system/lib" ];
# Bootloader.
boot.loader.efi.canTouchEfiVariables = true;
boot.loader.timeout = 10; # seconds (default is 5)
# boot.loader.timeout = null; # wait indefinitely for user to select
boot.loader.systemd-boot.enable = true;
boot.loader.systemd-boot.memtest86.enable = false;
boot.loader.systemd-boot.configurationLimit = 10; # Make it harder to fill up /boot partition
boot.loader.systemd-boot.consoleMode = "max";
# TODO: try out using `grub` instead of `systemd-boot`
# https://discourse.nixos.org/t/change-bootloader-from-systemd-to-grub/5977
# boot.loader.grub = {
# enable = true;
# useOSProber = false;
# device = "/dev/sda";
# efiSupport = true;
# };
boot.enableContainers = true;
boot.supportedFilesystems = {
ntfs = true; # Be able to mount USB drives with NTFS fs
# btrfs = true;
};
boot.kernelPackages = pkgs.linuxPackages_latest;
# boot.kernelPackages = pkgs.linuxPackages_zen;
# boot.kernelPackages = pkgs.linuxPackages_6_12;
boot.plymouth =
let
# theme = "rings";
theme = "glitch";
in
{
enable = false;
inherit theme;
# TODO: make jetbrains mono available instead
# font = "${pkgs.dejavu_fonts.minimal}/share/fonts/truetype/DejaVuSans.ttf";
# theme = "rings";
# TODO: checkout
# https://github.com/helsinki-systems/plymouth-theme-nixos-bgrt
themePackages = with pkgs; [
# By default we would install all themes
(adi1090x-plymouth-themes.override {
selected_themes = [ theme ];
# nixosBranding = true;
# nixosVersion = config.system.nixosRelease;
})
];
};
# https://www.kernel.org/doc/html/latest/core-api/printk-basics.html
boot.consoleLogLevel = 5;
# boot.initrd.verbose = false;
boot.kernelParams = [
"tuxedo_keyboard.mode=0"
"tuxedo_keyboard.brightness=255"
# "quiet"
"splash"
"boot.shell_on_fail"
"loglevel=3"
"rd.systemd.show_status=true"
"rd.udev.log_level=3"
"udev.log_priority=3"
];
# Hide the OS choice for bootloaders.
# It's still possible to open the bootloader list by pressing any key
# It will just not appear on screen unless a key is pressed
# boot.loader.timeout = 0;
programs.nix-ld.enable = true;
programs.nix-ld.libraries = with pkgs; [
alsa-lib
at-spi2-atk
at-spi2-core
atk
cairo
cups
curl
dbus
expat
fontconfig
freetype
fuse3
gdk-pixbuf
glib
gtk3
icu
libGL
libappindicator-gtk3
libdrm
libglvnd
libnotify
libpulseaudio
libunwind
libusb1
libuuid
libxkbcommon
libxml2
mesa
nspr
nss
openssl
pango
pipewire
stdenv.cc.cc
vulkan-loader
# libegl
# xorg.libX11
# xorg.libXScrnSaver
# xorg.libXcomposite
# xorg.libXcursor
# xorg.libXdamage
# xorg.libXext
# xorg.libXfixes
# xorg.libXi
# xorg.libXrandr
# xorg.libXrender
# xorg.libXtst
# xorg.libxcb
# xorg.libxkbfile
# xorg.libxshmfence
zlib
];
programs.direnv.enable = true;
hardware.i2c.enable = true;
hardware.tuxedo-drivers.enable = true;
hardware.tuxedo-rs = {
enable = true;
tailor-gui.enable = true;
};
# https://lavafroth.is-a.dev/post/android-phone-for-webcam-nixos/
boot.extraModulePackages = with pkgs; [ linuxPackages_latest.v4l2loopback ];
boot.extraModprobeConfig = ''
options v4l2loopback exclusive_caps=1 card_label="Virtual Webcam"
'';
# FIXME: 'evdi' not found
boot.kernelModules = [
"hid-playstation" # needed for bluetooth connectivity to playstation 4 and 5 dualshock controllers, ref: https://www.phoronix.com/news/Sony-DualShock4-PlayStation-Drv
"evdi"
"snd-aloop" # needed for `droidcam`
"v4l2loopback"
"kvm-intel" # support for hardware virtualisation with Intel CPUs
# "kvm-amd"
# "tuxedo_keyboard"
];
# boot.kernelParams = [
# "tuxedo_keyboard.mode=0"
# "tuxedo_keyboard.brightness=255"
# # "tuxedo_keyboard.color_left=0xff0a0a"
# ];
hardware.bluetooth = {
enable = true;
powerOnBoot = true;
package = pkgs.bluez;
settings = { };
input = { };
network = { };
};
# hardware.ubertooth.enable = config.hardware.bluetooth.enable;
# Make it possible to run downloaded appimages
# boot.binfmt.registrations.appimage = {
# wrapInterpreterInShell = false;
# interpreter = "${pkgs.appimage-run}/bin/appimage-run";
# recognitionType = "magic";
# offset = 0;
# mask = ''\xff\xff\xff\xff\x00\x00\x00\x00\xff\xff\xff'';
# magicOrExtension = ''\x7fELF....AI\x02'';
# };
programs.appimage.enable = true;
programs.appimage.binfmt = true;
programs.appimage.package = pkgs.appimage-run.override {
extraPkgs = pkgs: [
pkgs.ffmpeg
pkgs.imagemagick
];
};
environment.variables = {
DIRENV_LOG_FORMAT = ""; # silence `direnv` msgs
# EDITOR = "hx";
# EDITOR = pkgs.lib.getExe pkgs.helix;
# NIXPKGS_ALLOW_UNFREE = "1";
# LIBVA_DRIVER_NAME = "iHD"; # Force intel-media-driver
# https://jqlang.github.io/jq/manual/#colors
};
networking.hostName = "nixos"; # Define your hostname.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,l:localhost,internal.domain";
networking.networkmanager.enable = true;
time.timeZone = "Europe/Copenhagen";
i18n.defaultLocale = "en_US.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = config.i18n.defaultLocale;
LC_IDENTIFICATION = config.i18n.defaultLocale;
LC_MEASUREMENT = config.i18n.defaultLocale;
LC_MONETARY = config.i18n.defaultLocale;
LC_NAME = config.i18n.defaultLocale;
LC_NUMERIC = config.i18n.defaultLocale;
LC_PAPER = config.i18n.defaultLocale;
LC_TELEPHONE = config.i18n.defaultLocale;
LC_TIME = config.i18n.defaultLocale;
};
# Enable the X11 windowing system.
services.xserver.enable = true;
# services.displayManager.defaultSession = "niri";
# Enable the KDE Plasma Desktop Environment.
# TODO: try out https://github.com/khaneliman/catppuccin-sddm-corners
services.displayManager.sddm = {
enable = false;
# catppuccin.enable = true;
wayland.enable = true;
# autoNumlock = true;
# https://man.archlinux.org/man/sddm.conf.5
settings = {
Users = {
RememberLastUser = true;
RememberLastSession = true;
};
# Autologin = {
# Session = "niri";
# User = username;
# };
};
};
# services.xserver.desktopManager.gnome.enable = true;
# services.xserver.displayManager.gdm.enable = true;
services.xserver.desktopManager.gnome.enable = false;
# Exclude applications installed with Gnome
environment.gnome.excludePackages = with pkgs; [
gnome-tour
gnome-connections
epiphany
geary
evince
];
services.desktopManager.plasma6.enable = true;
# TODO: change to en_US
# Configure keymap in X11
services.xserver.xkb.layout = "us,dk";
services.xserver.xkb.variant = "";
# services.xserver.videoDrivers = ["displaylink" "modesetting" "nvidia"];
# services.xserver.videoDrivers = ["displaylink" "modesetting"];
services.xserver.videoDrivers = [ "modesetting" ];
# services.xserver.displayManager.sessionCommands = ''
# ${pkgs.lib.getBin pkgs.xorg.xrandr}/bin/xrandr --setprovideroutputsource 2 0
# '';
nixpkgs.config.packageOverrides = pkgs: {
# Needed for `wl-screenrec`
# https://github.com/intel/intel-hybrid-driver
# `intel-hybrid-driver` is deprecated
# intel-vaapi-driver = pkgs.intel-vaapi-driver.override { enableHybridCodec = true; };
};
hardware.graphics = {
enable = true;
enable32Bit = true;
extraPackages = with pkgs; [
# Needed for `wl-screenrec`
# intel-media-driver # For Broadwell (2014) or newer processors. LIBVA_DRIVER_NAME=iHD
vpl-gpu-rt
# intel-vaapi-driver # For older processors. LIBVA_DRIVER_NAME=i965
];
};
# Configure console keymap
# console.keyMap = "dk-latin1";
console.keyMap = "us";
# console.font = "JetBrainsMono Nerd Font Mono"; # FIXME: not found
# Enable CUPS to print documents.
services.printing.enable = false;
# services.blueman.enable = true;
# Enable sound with pipewire.
# sound.enable = true;
services.pulseaudio.enable = false;
nixpkgs.config.pulseaudio = true;
services.pulseaudio.extraModules = [ pkgs.pulseaudio-modules-bt ];
services.pulseaudio.package = pkgs.puleaudioFull;
security.rtkit.enable = true;
security.polkit.enable = true;
services.pipewire = {
enable = true;
package = pkgs.pipewire.override { x11Support = false; };
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
jack.enable = true;
};
# Define a user account. Don't forget to set a password with ‘passwd’.
programs.fish.enable = true;
# users.defaultUserShell = pkgs.fish;
users.defaultUserShell = pkgs.nushell;
# users.defaultUserShell = pkgs.bash;
users.users.${username} = {
isNormalUser = true;
description = "Kristoffer Sørensen";
# TODO: document why it is necessary to be part of each group
# TODO: use lib.optional to simplify
extraGroups = pkgs.lib.lists.unique (
[
"networkmanager"
"wheel"
"docker"
"storage"
"i2c-dev"
]
++ (if config.virtualisation.podman.enable then [ "podman" ] else [ ])
++ (
# https://nixos.wiki/wiki/Android
if config.programs.adb.enable then
[
"adbusers"
"kvm"
]
else
[ ]
)
);
packages = [ ]; # managed by home-manager, see ./home.nix
};
# TODO: document
users.groups.input.members = [ username ];
fonts.packages = with pkgs; [
nerd-fonts.jetbrains-mono
nerd-fonts.zed-mono
nerd-fonts.victor-mono
nerd-fonts.ubuntu-mono
nerd-fonts.sauce-code-pro
nerd-fonts.commit-mono
nerd-fonts.iosevka
cantarell-fonts
font-awesome
];
# List packages installed in system profile.
environment.systemPackages = with pkgs; [
cyme # a fancier `lsusb`
psmisc
busybox
gnumake
# mullvad-closest
# rainfrog
wayland-utils
alsa-utils # `alsamixer`
# fh # flakehub cli
adbfs-rootless # TODO: only if adb is enabled
# TODO: checkout and experiment with (tir 10 sep 21:58:53 CEST 2024)
# TODO: a laptop does not have numa
# numactl
# numad
# numatop
inetutils
# inputs.nixos-cli.packages.${system}.default
scrcpy # TODO: only if adb is enabled
# distrobox
libinput
# qemu
# quickemu
v4l-utils
edid-decode
keyd
libva-utils # `vainfo`
mozwire
# Gaming
kitty
# mangohud
# protonup
# protonup-qt
# lutris
# heroic
# bottles
wget
atool # {,de}compress various compression formats
helix # text editor
git
gh
# Linux
# btrfs-progs # Tools to interact with btrfs file system partitions
udev
systemctl-tui
systeroid # A more powerful alternative to sysctl(8) with a terminal user interface 🐧
kmon # tui to view state of loaded kernel modules
lshw # list hardware
pciutils # `lscpi`
lsof # "List open file descriptors"
# nvtopPackages.full
ddcutil # control external displays, such as chaning their brightness
findutils # find, locate
moreutils # `sponge` etc.
# Nix(os) tools
nix-prefetch-scripts
nixfmt-rfc-style
nix-output-monitor # `nom`
nvd # nix version diff
cachix
nix-du
nix-btm
nix-derivation
nix-doc
nix-health
nix-inspect
nix-janitor
statix # nix linter
deadnix # detect unused nix code
nixd # nix lsp
manix # TODO: what does it do?
comma
nurl
# Networking inspection tools
ipinfo
dig # lookup dns name resolving
dogdns # loopup dns name resolving, but in rust!
nmap
sniffnet
(pkgs.writers.writeFishBin "logout" { }
# fish
''
set -l session_ids (${pkgs.systemd}/bin/loginctl list-sessions \
| ${pkgs.coreutils}/bin/tail +2 \
| ${pkgs.coreutils}/bin/head -1 \
| string match --regex '\d')
if test (count $session_ids) -gt 1
# TODO: check if in a tty, or send a notify-send
printf '%serror%s: more than one login session active. Not sure what to do, sorry.\n' (set_color red) (set_color normal) >&2
return 1
end
# TODO: change colors to be more legible
${pkgs.gum}/bin/gum confirm "Logout?" --default=true --affirmative "Yes" --negative "No"
and ${pkgs.systemd}/bin/loginctl kill-session $session_ids[1]
''
)
(pkgs.writers.writeFishBin "nixos-diff" { }
# fish
''
set -l reset (set_color normal)
set -l red (set_color red)
set -l options v/verbose h/help
argparse $options -- $argv; or return 2
set -l generations (string match --regex --groups-only '(\d+)' /nix/var/nix/profiles/system-*-link | ${pkgs.coreutils}/bin/sort --numeric-sort)
if test 1 -eq (count $generations)
# Nothing to compare with only 1 generation
printf '%serror%s: only one profile exists, nothing to compare!\n' $red $reset >&2
return 1
end
set -l a
set -l b 0
set -l argc (count $argv)
switch $argc
case 0
# Diff latest profile with the second latest (or the largest one < latest, if that can even happen ...)
# NOTE: use `readlink` instead of `path resolve` as we only want to resolve the symlink once, and not recursively.
set -l active (${pkgs.coreutils}/bin/readlink /nix/var/nix/profiles/system)
set b (string match --regex --groups-only '(\d+)' -- $active)
case 1
# Diff `$argv[1]` with `$argv[1] - 1`
# Error if `$argv[1] == 1`
set b $argv[1]
case 2
# Diff `$argv[1]` with `$argv[2]`
# invariant: `$argv[1] < $argv[2]`
set a $argv[1]
set b $argv[2]
case '*'
# Error
end
if not contains -- $b $generations
printf '%serror%s: "%s" does not match any existing generation ids: [ %s ]\n' $red $reset $b (string join ' ' $generations) >&2
return 2
end
if test -z $a
set -l b_idx (contains --index -- $b $generations)
if test $b_idx -eq 1
printf '%serror%s: when only a single argument is given the upper "%s" cannot be the oldest generation id, pick any of: [ %s ]\n' $red $reset $b (string join ' ' $generations[2..]) >&2
return 2
end
set -l a_idx (math "$b_idx - 1")
set a $generations[$a_idx]
end
if not contains -- $a $generations
printf '%serror%s: "%s" does not match any existing generation ids: [ %s ]\n' $red $reset $a (string join ' ' $generations) >&2
return 2
end
set -l expr ${pkgs.nvd}/bin/nvd diff /nix/var/nix/profiles/system-{$a,$b}-link
echo "evaluating expression:"
echo $expr | ${pkgs.fish}/bin/fish_indent --ansi
echo
eval $expr
''
)
];
programs.hyprland = {
enable = false;
xwayland.enable = true;
# package = pkgs.hyprland;
# TODO: use overlay
package = inputs.hyprland.packages.${pkgs.stdenv.system}.default;
};
programs.niri.enable = true;
programs.niri.package = pkgs.niri;
# programs.niri.package = pkgs.niri-unstable;
# hardware.system76.power-daemon.enable = true;
services.system76-scheduler.enable = true;
programs.river.enable = false;
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
# programs.mtr.enable = true;
# programs.gnupg.agent = {
# enable = true;
# enableSSHSupport = true;
# };
# List services that you want to enable:
services.tailscale.enable = false;
services.tailscale.openFirewall = false;
# services.netbird.enable = true;
services.flatpak.enable = true;
systemd.services.add-flathub-remote = {
wantedBy = [ "multi-user.target" ];
path = [ pkgs.flatpak ];
script = "flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo";
};
# FIXME: get to work
# services.espanso.enable = false;
services.mullvad-vpn.enable = false;
services.mozillavpn.enable = false;
# services.wg-netmanager.enable = true;
# security.pam.services.gdm.enableGnomeKeyring = false;
security.pam.services.gdm.enableGnomeKeyring = false;
programs.seahorse.enable = false;
# services.gnome.gnome-keyring.enable = false;
programs.ssh.askPassword = "${pkgs.x11_ssh_askpass}/libexec/x11-ssh-askpass";
programs.firejail = {
enable = false;
# wrappedBinaries = {
# librewolf = {
# executable = "${pkgs.librewolf}/bin/librewolf";
# profile = "${pkgs.firejail}/etc/firejail/librewolf.profile";
# extraArgs = [
# # Required for U2F USB stick
# "--ignore=private-dev"
# # Enforce dark mode
# "--env=GTK_THEME=Adwaita:dark"
# # Enable system notifications
# "--dbus-user.talk=org.freedesktop.Notifications"
# ];
# };
# };
};
# services.spotifyd.enable = true;
# services.surrealdb.enable = true;
# Enable the OpenSSH daemon.
# services.openssh.enable = true;
# services.jitsi-meet = {
# enable = true;
# excalidraw.enable = true;
# };
services.thermald.enable = true;
services.auto-cpufreq.enable = false;
services.auto-cpufreq.settings = {
battery = {
governor = "powersave";
turbo = "never";
};
charger = {
governor = "performance";
turbo = "auto";
};
};
services.power-profiles-daemon.enable = false;
powerManagement.enable = true;
# Disabled because I used it infrequently, and because it slows down boot time with about 3 seconds.
# Use `systemd-analyse` to get start timings of services
powerManagement.powertop.enable = false;
# services.tlp.enable = true;
# # TODO: check out services.auto-cpufreq
services.tlp = {
enable = true;
settings = {
CPU_SCALING_GOVERNOR_ON_AC = "performance";
CPU_SCALING_GOVERNOR_ON_BAT = "powersave";
CPU_ENERGY_PERF_POLICY_ON_BAT = "power";
CPU_ENERGY_PERF_POLICY_ON_AC = "performance";
CPU_MIN_PERF_ON_AC = 0;
CPU_MAX_PERF_ON_AC = 100;
CPU_MIN_PERF_ON_BAT = 0;
CPU_MAX_PERF_ON_BAT = 20;
# Optional helps save long term battery health
START_CHARGE_THRESH_BAT0 = 20; # 20 and bellow it starts to charge
STOP_CHARGE_THRESH_BAT0 = 80; # 80 and above it stops charging
};
};
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
# It is annoying to sometimes reboot/shutdown and having to wait 2 ENTIRE minutes, which is the default,
# for Systemd to wait patiently for a program to terminate.
systemd.extraConfig = ''
DefaultTimeoutStopSec=15s
'';
# Prevent OOM when building with nix e.g. `nixos-rebuild switch`
# By setting the maximum allowed usage of memory at the same time to be lower than the installed
# currently: laptop with 16 GiB
# TODO: can this be made dependent on the host builder e.g. 80% of total mem
systemd.services.nix-daemon.serviceConfig = {
MemoryHigh = "8G";
MemoryMax = "10G";
};
# xdg.portal = {
# enable = true;
# xdgOpenUsePortal = true;
# wlr.enable = false;
# extraPortals = [
# pkgs.xdg-desktop-portal-gtk
# pkgs.xdg-desktop-portal-kde
# ];
# };
# virtualisation.containers.enable = true;
# virtualisation.containers.cdi.dynamic.nvidia.enable = true;
# virtualisation.docker = {
# enable = true;
# enableOnBoot = true;
# extraPackages = with pkgs; [criu];
# };
virtualisation.containers.enable = true;
# virtualisation.containers.cdi.dynamic.nvidia.enable = true;
virtualisation.podman.enable = true;
virtualisation.podman.extraPackages = [
# pkgs.gvisor
];
# Users must be in the podman group in order to connect. As with Docker, members of this group can gain root access.
virtualisation.podman.dockerSocket.enable =
builtins.elem "podman"
config.users.users.${username}.extraGroups;
virtualisation.podman.autoPrune.enable = false;
virtualisation.podman.autoPrune.dates = "monthly";
virtualisation.podman.defaultNetwork.settings.dns_enabled = true;
virtualisation.podman.dockerCompat = !config.virtualisation.docker.enable;
# needed for `darkman`
# services.geoclue2.enable = false;
# NOTE: temporary fix reported by: https://github.com/NixOS/nixpkgs/issues/327464
environment.etc."geoclue/conf.d/.valid".text = ''created the directory.'';
location.provider = "geoclue2";
# show dots when typing password for sudo
security.sudo.extraConfig = ''
Defaults env_reset,pwfeedback
'';
# TODO: create systemd timer for `nix run 'nixpkgs#nix-index'`
# stylix = {
# enable = true;
# fonts = {
# # monospace = {
# # # package = pkgs.nerdfotns
# # };
# serif = {
# package = pkgs.dejavu_fonts;
# name = "DejaVu Serif";
# };
# sansSerif = {
# package = pkgs.dejavu_fonts;
# name = "DejaVu Sans";
# };
# # TODO: jetbrains mono
# monospace = {
# package = pkgs.dejavu_fonts;
# name = "DejaVu Sans Mono";
# };
# emoji = {
# package = pkgs.noto-fonts-emoji;
# name = "Noto Color Emoji";
# };
# };
# # image = ./assets/imgs/macos-sequoia-dark.png;
# # image = ./macos-sequoia-light.png;
# opacity = {
# applications = 1.0;
# desktop = 1.0;
# terminal = 0.9;
# };
# polarity = "dark"; # or "light"
# targets.fish.enable = false;
# };
# stylix.targets.niri.enable = true;
# FIXME: make work
services.blocky = {
enable = false;
settings = {
ports.dns = 53; # Port for incoming DNS Queries.
upstreams.groups.default = [
"https://one.one.one.one/dns-query" # Using Cloudflare's DNS over HTTPS server for resolving queries.
];
# For initially solving DoH/DoT Requests when no system Resolver is available.
bootstrapDns = {
upstream = "https://one.one.one.one/dns-query";
ips = [
"1.1.1.1"
"1.0.0.1"
];
};
#Enable Blocking of certian domains.
blocking = {
blackLists = {
#Adblocking
ads = [ "https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts" ];
#Another filter for blocking adult sites
adult = [ "https://blocklistproject.github.io/Lists/porn.txt" ];
#You can add additional categories
# social-media = [""];
};
#Configure what block categories are used
clientGroupsBlock = {
default = [
"ads"
"adult"
];
# kids-ipad = ["ads" "adult"];
};
};
caching = {
minTime = "5m";
maxTime = "30m";
prefetching = true;
};
};
};
# KDE partition manager
programs.partition-manager.enable = false;
# programs.regreet.enable = config.services.greetd.enable;
programs.regreet.enable = false;
# https://github.com/rharish101/ReGreet
# services.greetd = {
# enable = !config.services.displayManager.sddm.enable;
# settings = {
# # default_session.command = ''${pkgs.greetd.regreet}/bin/regreet'';
# # default_session.command = ''
# # ${pkgs.greetd.tuigreet}/bin/tuigreet \
# # --time \
# # --remember \
# # --asterisks \
# # --user-menu \
# # --cmd niri-session
# # '';
# };
# };
# niri-session
environment.etc."greetd/environments".text = '''';
services.fwupd.enable = true;
# https://github.com/Shinyzenith/nix-dotfiles/blob/master/host/default.nix
# system = {
# stateVersion = "23.05";
# activationScripts.diff = {
# supportsDryActivation = true;
# text = ''
# ${pkgs.nvd}/bin/nvd --nix-bin-dir=${pkgs.nix}/bin diff /run/current-system "$systemConfig"
# '';
# };
# };
programs.kdeconnect.enable = true;
programs.localsend.enable = false;
programs.nm-applet.enable = false;
programs.usbtop.enable = false;
services.keyd = {
enable = true;
keyboards = {
default = {
ids = [ "*" ];
settings = {
main = {
capslock = "overload(control, esc)";
};
};
};
};
};
# To theme GTK applications and Gnome
programs.dconf.enable = true;
# TODO: checkout this
# https://github.com/Mic92/dotfiles/blob/main/nixos/modules/suspend-on-low-power.nix
# For my ZSA Moonlander keyboard
hardware.keyboard.zsa.enable = true;
# *** Android ***
# sudo waydroid upgrade
# TODO: get this working
# virtualisation.waydroid.enable = false;
# programs.adb.enable = true;
# TODO: `systemctl status avahi-daemon.service` prints this, fix it (tir 10 sep 17:35:56 CEST 2024)
# WARNING: No NSS support for mDNS detected, consider installing nss-mdns!
# *** WARNING: Detected another IPv4 mDNS stack running on this host. This makes mDNS unreliable and is thus not recommended. ***
services.avahi.enable = true;
# TODO: enable if you ever get a device that has this sensor
# hardware.sensor.iio.enable = false;
# services.vnstat.enable = false;