tangled
alpha
login
or
join now
ngp.computer
/
nixos
0
fork
atom
Configuration for my NixOS based systems and Home Manager
0
fork
atom
overview
issues
pulls
pipelines
Add shizuri
ngp.computer
3 months ago
4c3add38
c556cca0
+546
-4
10 changed files
expand all
collapse all
unified
split
flake.nix
gui.nix
host-specific
shizuri
boot.nix
configuration.nix
gs.sh
gui.nix
hardware-configuration.nix
networking.nix
packages.nix
services.nix
+6
flake.nix
reviewed
···
93
93
./host-specific/odin/configuration.nix
94
94
];
95
95
};
96
96
+
nixosConfigurations.shizuri = basicSystem {
97
97
+
unstable = true;
98
98
+
modules = [
99
99
+
./host-specific/shizuri/configuration.nix
100
100
+
];
101
101
+
};
96
102
nixosConfigurations.misaki = basicSystem {
97
103
unstable = true;
98
104
extraGroups = [
-4
gui.nix
reviewed
···
22
22
23
23
# Graphics and parallel compute configuration
24
24
hardware.opengl.extraPackages = [
25
25
-
# TODO: figure out why this doesn't work
26
26
-
# Looks like it requires unfree
27
27
-
# rocmPackages.clr.icd
28
28
-
pkgs.amdvlk
29
25
pkgs.libva
30
26
];
31
27
+6
host-specific/shizuri/boot.nix
reviewed
···
1
1
+
{ ... }:
2
2
+
{
3
3
+
# Use the systemd-boot EFI boot loader.
4
4
+
boot.loader.systemd-boot.enable = true;
5
5
+
boot.loader.efi.canTouchEfiVariables = true;
6
6
+
}
+13
host-specific/shizuri/configuration.nix
reviewed
···
1
1
+
{ ... }:
2
2
+
{
3
3
+
imports = [
4
4
+
# Include the results of the hardware scan.
5
5
+
./hardware-configuration.nix
6
6
+
./boot.nix
7
7
+
./networking.nix
8
8
+
./gui.nix
9
9
+
./packages.nix
10
10
+
./services.nix
11
11
+
];
12
12
+
system.stateVersion = "23.11"; # Did you read the comment?
13
13
+
}
+27
host-specific/shizuri/gs.sh
reviewed
···
1
1
+
#!/usr/bin/env bash
2
2
+
set -xeuo pipefail
3
3
+
4
4
+
gamescopeArgs=(
5
5
+
--adaptive-sync # VRR support
6
6
+
--hdr-enabled
7
7
+
--mangoapp # performance overlay
8
8
+
--rt
9
9
+
--steam
10
10
+
)
11
11
+
steamArgs=(
12
12
+
-pipewire-dmabuf
13
13
+
-tenfoot
14
14
+
)
15
15
+
mangoConfig=(
16
16
+
cpu_temp
17
17
+
gpu_temp
18
18
+
ram
19
19
+
vram
20
20
+
)
21
21
+
mangoVars=(
22
22
+
MANGOHUD=1
23
23
+
MANGOHUD_CONFIG="$(IFS=,; echo "${mangoConfig[*]}")"
24
24
+
)
25
25
+
26
26
+
export "${mangoVars[@]}"
27
27
+
exec gamescope "${gamescopeArgs[@]}" -- steam "${steamArgs[@]}"
+115
host-specific/shizuri/gui.nix
reviewed
···
1
1
+
{ pkgs, ... }:
2
2
+
{
3
3
+
# Enable the X11 windowing system.
4
4
+
services.xserver = {
5
5
+
enable = true;
6
6
+
videoDrivers = [ "amdgpu" ];
7
7
+
};
8
8
+
9
9
+
# Fix for HIP libraries
10
10
+
systemd.tmpfiles.rules = [
11
11
+
"L+ /opt/rocm/hip - - - - ${pkgs.rocmPackages.clr}"
12
12
+
];
13
13
+
14
14
+
# Configure keymap in X11
15
15
+
services.xserver.xkb = {
16
16
+
layout = "us";
17
17
+
variant = "";
18
18
+
};
19
19
+
# services.xserver.xkb.options = "eurosign:e,caps:escape";
20
20
+
21
21
+
# Enable CUPS to print documents.
22
22
+
# services.printing.enable = true;
23
23
+
24
24
+
# Enable sound.
25
25
+
security.rtkit.enable = true;
26
26
+
services.pipewire = {
27
27
+
enable = true;
28
28
+
alsa.enable = true;
29
29
+
alsa.support32Bit = true;
30
30
+
pulse.enable = true;
31
31
+
wireplumber.enable = true;
32
32
+
};
33
33
+
34
34
+
# Graphics and parallel compute configuration
35
35
+
hardware.graphics = {
36
36
+
enable = true;
37
37
+
extraPackages = with pkgs; [
38
38
+
libva
39
39
+
mesa
40
40
+
rocmPackages.clr.icd
41
41
+
];
42
42
+
};
43
43
+
44
44
+
# Enable touchpad support (enabled default in most desktopManager).
45
45
+
# services.xserver.libinput.enable = true;
46
46
+
47
47
+
# Fonts
48
48
+
fonts.packages = with pkgs; [
49
49
+
fira-code
50
50
+
fira-code-symbols
51
51
+
noto-fonts
52
52
+
noto-fonts-cjk-sans
53
53
+
noto-fonts-color-emoji
54
54
+
nerd-fonts.fira-code
55
55
+
];
56
56
+
57
57
+
# Polkit is a dependency of Sway. It's responsible for handling security policies
58
58
+
security.polkit.enable = true;
59
59
+
60
60
+
# Enable the sway window manager
61
61
+
programs.sway = {
62
62
+
enable = false;
63
63
+
#package = unstable.sway;
64
64
+
wrapperFeatures.gtk = true;
65
65
+
};
66
66
+
# Use greetd as the displaymanager
67
67
+
#services.xserver.displayManager.greetd.enable = true;
68
68
+
69
69
+
services.xserver.displayManager.lightdm.enable = false;
70
70
+
71
71
+
#services.displayManager.sddm.enable = true;
72
72
+
#services.displayManager.defaultSession = "sway";
73
73
+
#services.displayManager.autoLogin = {
74
74
+
# enable = true;
75
75
+
# user = "noah";
76
76
+
#};
77
77
+
services.xserver.desktopManager.xfce.enable = false;
78
78
+
services.xserver.desktopManager.lxqt = {
79
79
+
enable = true;
80
80
+
};
81
81
+
services.xscreensaver.enable = true;
82
82
+
security.pam.services.xscreensaver.enable = true;
83
83
+
84
84
+
# i3, for when I need XOrg
85
85
+
services.xserver.windowManager.i3 = {
86
86
+
enable = false;
87
87
+
extraPackages = with pkgs; [
88
88
+
dmenu
89
89
+
i3status
90
90
+
i3lock
91
91
+
i3blocks
92
92
+
];
93
93
+
};
94
94
+
95
95
+
xdg.portal = {
96
96
+
enable = true;
97
97
+
wlr.enable = true;
98
98
+
extraPortals = [
99
99
+
pkgs.xdg-desktop-portal
100
100
+
pkgs.xdg-desktop-portal-wlr
101
101
+
pkgs.xdg-desktop-portal-gtk
102
102
+
pkgs.xdg-desktop-portal-termfilechooser
103
103
+
pkgs.lxqt.xdg-desktop-portal-lxqt
104
104
+
];
105
105
+
};
106
106
+
xdg.mime = {
107
107
+
enable = true;
108
108
+
defaultApplications = {
109
109
+
"x-scheme-handler/http" = "org.firefox.firefox.desktop";
110
110
+
"x-scheme-handler/https" = "org.firefox.firefox.desktop";
111
111
+
};
112
112
+
};
113
113
+
services.dbus.enable = true;
114
114
+
services.gnome.gnome-keyring.enable = true;
115
115
+
}
+84
host-specific/shizuri/hardware-configuration.nix
reviewed
···
1
1
+
# Do not modify this file! It was generated by ‘nixos-generate-config’
2
2
+
# and may be overwritten by future invocations. Please make changes
3
3
+
# to /etc/nixos/configuration.nix instead.
4
4
+
{
5
5
+
config,
6
6
+
lib,
7
7
+
pkgs,
8
8
+
modulesPath,
9
9
+
...
10
10
+
}:
11
11
+
12
12
+
{
13
13
+
imports = [
14
14
+
(modulesPath + "/installer/scan/not-detected.nix")
15
15
+
];
16
16
+
17
17
+
boot.kernelPackages = pkgs.linuxPackages_latest;
18
18
+
boot.initrd.availableKernelModules = [
19
19
+
"nvme"
20
20
+
"xhci_pci"
21
21
+
"thunderbolt"
22
22
+
"usb_storage"
23
23
+
"usbhid"
24
24
+
"uas"
25
25
+
"sd_mod"
26
26
+
];
27
27
+
boot.initrd.kernelModules = [ ];
28
28
+
boot.kernelModules = [ "kvm-amd" ];
29
29
+
boot.extraModulePackages = [ ];
30
30
+
31
31
+
# Bluetooth / wireless configuration
32
32
+
hardware.bluetooth = {
33
33
+
enable = true;
34
34
+
powerOnBoot = true;
35
35
+
settings = {
36
36
+
General = {
37
37
+
# Shows battery charge of connected devices on supported
38
38
+
# Bluetooth adapters. Defaults to 'false'.
39
39
+
Experimental = true;
40
40
+
# When enabled other devices can connect faster to us, however
41
41
+
# the tradeoff is increased power consumption. Defaults to
42
42
+
# 'false'.
43
43
+
FastConnectable = true;
44
44
+
};
45
45
+
Policy = {
46
46
+
# Enable all controllers when they are found. This includes
47
47
+
# adapters present on start as well as adapters that are plugged
48
48
+
# in later on. Defaults to 'true'.
49
49
+
AutoEnable = true;
50
50
+
};
51
51
+
};
52
52
+
};
53
53
+
54
54
+
fileSystems."/" = {
55
55
+
device = "/dev/disk/by-uuid/9a7cbffe-6c10-4220-bb99-4dcea8181dcc";
56
56
+
fsType = "ext4";
57
57
+
};
58
58
+
59
59
+
fileSystems."/boot" = {
60
60
+
device = "/dev/disk/by-uuid/9AC5-62C3";
61
61
+
fsType = "vfat";
62
62
+
options = [
63
63
+
"fmask=0077"
64
64
+
"dmask=0077"
65
65
+
];
66
66
+
};
67
67
+
68
68
+
swapDevices = [ { device = "/dev/disk/by-uuid/a19d8fad-d8d2-4bbe-a233-e645020419ff"; } ];
69
69
+
fileSystems."/srv/mugino" = {
70
70
+
device = "/dev/disk/by-uuid/d832dd9f-1fbb-4ca7-9097-0ba329b838af";
71
71
+
fsType = "ext4";
72
72
+
};
73
73
+
74
74
+
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
75
75
+
# (the default) this is the recommended approach. When using systemd-networkd it's
76
76
+
# still possible to use this option, but it's recommended to use it in conjunction
77
77
+
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
78
78
+
networking.useDHCP = lib.mkDefault true;
79
79
+
# networking.interfaces.enp191s0.useDHCP = lib.mkDefault true;
80
80
+
# networking.interfaces.wlp192s0.useDHCP = lib.mkDefault true;
81
81
+
82
82
+
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
83
83
+
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
84
84
+
}
+78
host-specific/shizuri/networking.nix
reviewed
···
1
1
+
{ ... }:
2
2
+
{
3
3
+
# networking.hostName = "nixos"; # Define your hostname.
4
4
+
# Pick only one of the below networking options.
5
5
+
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
6
6
+
# networking.networkmanager.enable = true; # Easiest to use and most distros use this by default.
7
7
+
networking.hostName = "shizuri";
8
8
+
# I like systemd-networkd
9
9
+
systemd.network.enable = true;
10
10
+
systemd.network.networks."50-wlp2s0" = {
11
11
+
matchConfig.name = "wlp2s0";
12
12
+
networkConfig.DHCP = "yes";
13
13
+
linkConfig.RequiredForOnline = "no";
14
14
+
};
15
15
+
16
16
+
networking.tempAddresses = "disabled";
17
17
+
18
18
+
networking.useNetworkd = true;
19
19
+
# TODO: static IP @ 192.168.1.2
20
20
+
21
21
+
# Configure network proxy if necessary
22
22
+
# networking.proxy.default = "http://user:password@proxy:port/";
23
23
+
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
24
24
+
# Open ports in the firewall.
25
25
+
# networking.firewall.allowedTCPPorts = [ ... ];
26
26
+
# networking.firewall.allowedUDPPorts = [ ... ];
27
27
+
# Or disable the firewall altogether.
28
28
+
# TODO: allow some ports
29
29
+
networking.firewall = {
30
30
+
enable = false;
31
31
+
allowPing = true;
32
32
+
allowedUDPPorts = [ ];
33
33
+
allowedTCPPorts = [
34
34
+
1234
35
35
+
2375
36
36
+
];
37
37
+
};
38
38
+
39
39
+
services.avahi = {
40
40
+
enable = true;
41
41
+
nssmdns4 = true;
42
42
+
nssmdns6 = true;
43
43
+
ipv6 = true;
44
44
+
openFirewall = true;
45
45
+
publish = {
46
46
+
enable = true;
47
47
+
addresses = true;
48
48
+
workstation = true;
49
49
+
userServices = true;
50
50
+
domain = true;
51
51
+
};
52
52
+
};
53
53
+
54
54
+
# NFS mounts
55
55
+
56
56
+
fileSystems = {
57
57
+
"/srv/shokuhou" = {
58
58
+
device = "192.168.1.3:/srv/shokuhou";
59
59
+
fsType = "nfs";
60
60
+
options = [
61
61
+
"nfsvers=4"
62
62
+
"user"
63
63
+
"x-system.automount"
64
64
+
"x-system.idle-timeout=600"
65
65
+
];
66
66
+
};
67
67
+
"/srv/mentalout" = {
68
68
+
device = "192.168.1.3:/srv/mentalout";
69
69
+
fsType = "nfs";
70
70
+
options = [
71
71
+
"nfsvers=4"
72
72
+
"user"
73
73
+
"x-system.automount"
74
74
+
"x-system.idle-timeout=600"
75
75
+
];
76
76
+
};
77
77
+
};
78
78
+
}
+173
host-specific/shizuri/packages.nix
reviewed
···
1
1
+
{ pkgs, lib, ... }:
2
2
+
let # bash script to let dbus know about important env variables and
3
3
+
# propagate them to relevent services run at the end of sway config
4
4
+
# see
5
5
+
# https://github.com/emersion/xdg-desktop-portal-wlr/wiki/"It-doesn't-work"-Troubleshooting-Checklist
6
6
+
# note: this is pretty much the same as /etc/sway/config.d/nixos.conf but also restarts
7
7
+
# some user services to make sure they have the correct environment variables
8
8
+
dbus-sway-environment = pkgs.writeTextFile {
9
9
+
name = "dbus-sway-environment";
10
10
+
destination = "/bin/dbus-sway-environment";
11
11
+
executable = true;
12
12
+
13
13
+
text = ''
14
14
+
dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway
15
15
+
systemctl --user stop pipewire pipewire-media-session xdg-desktop-portal xdg-desktop-portal-wlr
16
16
+
systemctl --user start pipewire pipewire-media-session xdg-desktop-portal xdg-desktop-portal-wlr
17
17
+
'';
18
18
+
};
19
19
+
20
20
+
# currently, there is some friction between sway and gtk:
21
21
+
# https://github.com/swaywm/sway/wiki/GTK-3-settings-on-Wayland
22
22
+
# the suggested way to set gtk settings is with gsettings
23
23
+
# for gsettings to work, we need to tell it where the schemas are
24
24
+
# using the XDG_DATA_DIR environment variable
25
25
+
# run at the end of sway config
26
26
+
configure-gtk = pkgs.writeTextFile {
27
27
+
name = "configure-gtk";
28
28
+
destination = "/bin/configure-gtk";
29
29
+
executable = true;
30
30
+
text =
31
31
+
let
32
32
+
# TODO: figure out why these bindings exist or where they're used
33
33
+
schema = pkgs.gsettings-desktop-schemas;
34
34
+
datadir = "${schema}/share/gsettings-schemas/${schema.name}";
35
35
+
in
36
36
+
''
37
37
+
6 gnome_schema=org.gnome.desktop.interface
38
38
+
gsettings set $gnome_schema gtk-theme 'Dracula'
39
39
+
'';
40
40
+
};
41
41
+
in
42
42
+
{
43
43
+
44
44
+
# List packages installed in system profile. To search, run:
45
45
+
# $ nix search wget
46
46
+
environment.systemPackages = with pkgs; [
47
47
+
mangohud
48
48
+
neovim
49
49
+
appimage-run
50
50
+
tzdata
51
51
+
wget
52
52
+
kitty
53
53
+
file
54
54
+
w3m
55
55
+
fishPlugins.fzf-fish
56
56
+
fzf
57
57
+
qemu
58
58
+
qemu-user
59
59
+
qemu-utils
60
60
+
qemu_full
61
61
+
OVMF
62
62
+
#9p stuff
63
63
+
diod
64
64
+
plan9port
65
65
+
vis
66
66
+
rc
67
67
+
68
68
+
smartmontools
69
69
+
70
70
+
# Sway stuff
71
71
+
wdisplays
72
72
+
mako
73
73
+
bemenu
74
74
+
wl-clipboard
75
75
+
slurp
76
76
+
grim
77
77
+
swayidle
78
78
+
swaylock
79
79
+
adwaita-icon-theme
80
80
+
dracula-theme
81
81
+
glib
82
82
+
xdg-utils
83
83
+
xdg-desktop-portal
84
84
+
wayland
85
85
+
configure-gtk
86
86
+
lxqt.lxqt-menu-data # for lxqt
87
87
+
dbus-sway-environment
88
88
+
dbus
89
89
+
pkg-config
90
90
+
zlib
91
91
+
# why wouldn't I want documentation on my system
92
92
+
man-pages
93
93
+
man-pages-posix
94
94
+
linuxPackages_latest.perf
95
95
+
];
96
96
+
97
97
+
environment.loginShellInit = ''
98
98
+
[[ "$(tty)" = "/dev/tty1" ]] && /home/noah/repos/nixos/gs.sh
99
99
+
'';
100
100
+
101
101
+
documentation.dev.enable = true;
102
102
+
103
103
+
# Fix dynamically linked libraries for unpackaged binaries
104
104
+
programs.nix-ld = {
105
105
+
enable = true;
106
106
+
libraries = with pkgs; [
107
107
+
# Add missing dynamic libraries for unpackaged programs HERE
108
108
+
# NOT in environment.systemPackages
109
109
+
zlib
110
110
+
openssl
111
111
+
sqlite
112
112
+
libunwind
113
113
+
libglvnd
114
114
+
libclang
115
115
+
systemdLibs
116
116
+
];
117
117
+
};
118
118
+
programs.nix-index = {
119
119
+
enable = true;
120
120
+
enableFishIntegration = true;
121
121
+
enableBashIntegration = false;
122
122
+
enableZshIntegration = false;
123
123
+
};
124
124
+
125
125
+
programs.steam = {
126
126
+
enable = true;
127
127
+
remotePlay.openFirewall = true; # Open ports in the firewall for Steam Remote Play
128
128
+
dedicatedServer.openFirewall = true; # Open ports in the firewall for Source Dedicated Server
129
129
+
localNetworkGameTransfers.openFirewall = true; # Open ports in the firewall for Steam Local Network Game Transfers
130
130
+
gamescopeSession.enable = true;
131
131
+
};
132
132
+
programs.gamescope = {
133
133
+
enable = true;
134
134
+
capSysNice = true;
135
135
+
};
136
136
+
# Boot to bigpicture
137
137
+
services.getty.autologinUser = "noah";
138
138
+
139
139
+
programs.appimage = {
140
140
+
enable = true;
141
141
+
binfmt = true;
142
142
+
};
143
143
+
144
144
+
# Run other bins in QEMU
145
145
+
boot.binfmt.emulatedSystems = [
146
146
+
"aarch64-linux"
147
147
+
"riscv64-linux"
148
148
+
];
149
149
+
# UEFI firmware support for QEMU
150
150
+
systemd.tmpfiles.rules = [ "L+ /var/lib/qemu/firmware - - - - ${pkgs.qemu}/share/qemu/firmware" ];
151
151
+
152
152
+
# Logseq uses an ancient version of Electron, so we enable that
153
153
+
nixpkgs.config.permittedInsecurePackages = [ "electron-25.9.0" ];
154
154
+
155
155
+
# I don't care too much about unfree
156
156
+
nixpkgs.config.allowUnfree = true;
157
157
+
# Whitelist some unfree packages
158
158
+
nixpkgs.config.allowUnfreePredicate =
159
159
+
pkg:
160
160
+
builtins.elem (lib.getName pkg) [
161
161
+
"discord"
162
162
+
"spotify"
163
163
+
"obsidian"
164
164
+
"unstable.obsidian"
165
165
+
"tailscale"
166
166
+
"google-chrome"
167
167
+
"slack"
168
168
+
"steam"
169
169
+
"steam-original"
170
170
+
"steam-unwrapped"
171
171
+
"steam-run"
172
172
+
];
173
173
+
}
+44
host-specific/shizuri/services.nix
reviewed
···
1
1
+
{ pkgs, ... }:
2
2
+
{
3
3
+
# Some programs need SUID wrappers, can be configured further or are
4
4
+
# started in user sessions.
5
5
+
# programs.mtr.enable = true;
6
6
+
programs.gnupg.agent = {
7
7
+
enable = true;
8
8
+
enableSSHSupport = false;
9
9
+
};
10
10
+
11
11
+
# Enable the OpenSSH daemon.
12
12
+
services.openssh = {
13
13
+
enable = true;
14
14
+
settings.X11Forwarding = true;
15
15
+
};
16
16
+
17
17
+
# Smart Card daemon
18
18
+
services.pcscd.enable = true;
19
19
+
20
20
+
# This option is for enabling the bolt daemon for managing Thunderbolt/USB4 Devices.
21
21
+
services.hardware.bolt.enable = true;
22
22
+
23
23
+
services.fwupd.enable = true;
24
24
+
25
25
+
services.xrdp = {
26
26
+
enable = true;
27
27
+
openFirewall = true;
28
28
+
defaultWindowManager = "${pkgs.lxqt.lxqt-session}/bin/lxqt-session";
29
29
+
};
30
30
+
31
31
+
# Containers and VMs
32
32
+
virtualisation = {
33
33
+
podman = {
34
34
+
enable = false;
35
35
+
dockerCompat = true;
36
36
+
defaultNetwork.settings.dns_enabled = true;
37
37
+
dockerSocket.enable = true;
38
38
+
};
39
39
+
docker = {
40
40
+
enable = true;
41
41
+
storageDriver = "overlay2";
42
42
+
};
43
43
+
};
44
44
+
}