···1010 laptop from 2021 to early 2025. Dormant.
1111 - **`pappardelle`**: A Lenovo XiaoXin Pro / IdeaPad Pro 5 14-inch 2025 (14IAH10).
1212 Current main laptop (and PC in general really).
1313+ - `bavette`: A pre-production Lenovo IdeaPad Duet 3 (`wormdingler`).
1414+ Cute little 11-inch phablet that took me ages to get NixOS working on.
13151416- Mobile phones, named after cheeses
1517 - `ricotta`: A Chinese iPhone 12. Mostly used as a hotspot machine and for
···11+{
22+ lib,
33+ pkgs,
44+ ...
55+}:
66+{
77+ imports = [
88+ ./common.nix
99+ ];
1010+1111+ services = {
1212+ # Some things sadly don't like being in Nixpkgs
1313+ flatpak.enable = true;
1414+1515+ # Makes sure auto-mounting disks still work when not using a
1616+ # traditional desktop environment like GNOME or KDE
1717+ udisks2.enable = true;
1818+1919+ upower.enable = true;
2020+2121+ # Nobody likes PulseAudio in this household
2222+ pulseaudio.enable = false;
2323+2424+ pipewire = {
2525+ enable = true;
2626+ pulse.enable = true;
2727+2828+ # Some weird apps still talk to ALSA directly
2929+ alsa.enable = true;
3030+3131+ # JACK should only be necessary for some professional audio
3232+ # software (e.g. DAWs like Ardour or video editing software
3333+ # like DaVinci Resolve), but we enable it no matter what
3434+ jack.enable = true;
3535+ };
3636+3737+ # Printing
3838+ printing = {
3939+ enable = true;
4040+ browsing = true;
4141+ };
4242+ avahi.enable = true;
4343+ };
4444+4545+ # Real-time audio software like DAWs are
4646+ # *crippled* without rtkit
4747+ security.rtkit.enable = true;
4848+4949+ networking.networkmanager.enable = true;
5050+5151+ # Update the system timezone according to physical location
5252+ systemd.services.automatic-timezoned.enable = true;
5353+5454+5555+ # Expose proxy
5656+ networking.firewall.allowedTCPPorts = [ 2080 ];
5757+5858+ # Show a pretty diff
5959+ system = {
6060+ # Thank @luishfonseca for this
6161+ # https://github.com/luishfonseca/dotfiles/blob/ab7625ec406b48493eda701911ad1cd017ce5bc1/modules/upgrade-diff.nix
6262+ activationScripts.diff = {
6363+ supportsDryActivation = true;
6464+ text = ''
6565+ ${lib.getExe pkgs.nvd} --nix-bin-dir=${pkgs.nix}/bin diff /run/current-system "$systemConfig"
6666+ '';
6767+ };
6868+ };
6969+7070+ specialisation.china.configuration = {
7171+ # cache.nixos.org is *unbearably* slow when accessed from Mainland China.
7272+ # Fortunately, mirror sites exist... Hooray(?)
7373+ nix.settings.substituters = map (url: "${url}/nix-channels/store") [
7474+ "https://mirrors.ustc.edu.cn"
7575+ "https://mirrors6.tuna.tsinghua.edu.cn"
7676+ "https://mirrors.tuna.tsinghua.edu.cn"
7777+ # "https://mirror.sjtu.edu.cn" # FIXME: buggy?
7878+ ];
7979+8080+ # Redirect all traffic through proxy
8181+ networking.proxy.allProxy = "http://127.0.0.1:2080";
8282+ nix.settings.impure-env = [
8383+ "all_proxy=http://127.0.0.1:2080"
8484+ "GOPROXY=https://goproxy.cn"
8585+ ];
8686+8787+ # Make the auto upgrade mechanism upgrade to the correct specialization
8888+ # so that proxies don't just randomly break the next day
8989+ system.autoUpgrade.flags = [
9090+ "--specialisation"
9191+ "china"
9292+ ];
9393+ };
9494+9595+ # Use native Wayland when possible
9696+ environment.variables = {
9797+ # This *should* be enough for most Electron apps
9898+ ELECTRON_OZONE_PLATFORM_HINT = "auto";
9999+100100+ # Apply Nixpkgs-specific flags too
101101+ NIXOS_OZONE_WL = "1";
102102+103103+ # Some SDL 2 apps are very naughty and don't work nicely under Wayland
104104+ SDL_VIDEODRIVER = "x11";
105105+106106+ # SDL 3 should be able to use native Wayland just fine.
107107+ SDL_VIDEO_DRIVER = "wayland";
108108+ };
109109+110110+ # Disable DualSense/DualShock 4 touchpad acting as mouse
111111+ # See https://wiki.archlinux.org/title/Gamepad#Disable_touchpad_acting_as_mouse
112112+ services.udev.extraRules = ''
113113+ # USB
114114+ ATTRS{name}=="Sony Interactive Entertainment Wireless Controller Touchpad", ENV{LIBINPUT_IGNORE_DEVICE}="1"
115115+ # Bluetooth
116116+ ATTRS{name}=="Wireless Controller Touchpad", ENV{LIBINPUT_IGNORE_DEVICE}="1"
117117+ '';
118118+119119+ # Fix the pairing process with a DualSense controller
120120+ hardware.bluetooth.settings = {
121121+ General.UserspaceHID = false;
122122+ };
123123+}
+4-103
systems/laptop.nix
···11# Laptop configuration for when I'm on the move
22{
33- lib,
43 pkgs,
54 ...
65}:
76{
87 imports = [
99- ./common.nix
88+ ./desktop.nix
109 ../users
1110 ];
1211···4140 ];
4241 };
43424444- services = {
4545- # Some things sadly don't like being in Nixpkgs
4646- flatpak.enable = true;
4747-4848- # Makes sure auto-mounting disks still work when not using a
4949- # traditional desktop environment like GNOME or KDE
5050- udisks2.enable = true;
5151-5252- upower.enable = true;
5353-5454- # Dynamically adjust performance settings based on load
5555- # instead of power-profile-daemon's rigid profiles
5656- tlp.enable = true;
5757-5858- # Nobody likes PulseAudio in this household
5959- pulseaudio.enable = false;
6060-6161- pipewire = {
6262- enable = true;
6363- pulse.enable = true;
6464-6565- # Some weird apps still talk to ALSA directly
6666- alsa.enable = true;
6767-6868- # JACK should only be necessary for some professional audio
6969- # software (e.g. DAWs like Ardour or video editing software
7070- # like DaVinci Resolve), but we enable it no matter what
7171- jack.enable = true;
7272- };
7373-7474- # Printing
7575- printing = {
7676- enable = true;
7777- browsing = true;
7878- };
7979- avahi.enable = true;
8080- };
8181-8282- # Real-time audio software like DAWs are
8383- # *crippled* without rtkit
8484- security.rtkit.enable = true;
8585-8686- # Use native Wayland when possible
8787- environment.variables = {
8888- # This *should* be enough for most Electron apps
8989- ELECTRON_OZONE_PLATFORM_HINT = "auto";
9090-9191- # Apply Nixpkgs-specific flags too
9292- NIXOS_OZONE_WL = "1";
9393-9494- # Some SDL 2 apps are very naughty and don't work nicely under Wayland
9595- SDL_VIDEODRIVER = "x11";
9696-9797- # SDL 3 should be able to use native Wayland just fine.
9898- SDL_VIDEO_DRIVER = "wayland";
9999- };
100100-101101- networking.networkmanager.enable = true;
4343+ # Dynamically adjust performance settings based on load
4444+ # instead of power-profile-daemon's rigid profiles
4545+ services.tlp.enable = true;
1024610347 # Allow GPU usage monitoring utilities like `intel_gpu_top`
10448 # to function without superuser access
10549 boot.kernel.sysctl."kernel.perf_event_paranoid" = 0;
106106-107107- # Update the system timezone according to physical location
108108- systemd.services.automatic-timezoned.enable = true;
109109-110110- # Expose proxy
111111- networking.firewall.allowedTCPPorts = [ 2080 ];
112112-113113- # Show a pretty diff
114114- system = {
115115- # Thank @luishfonseca for this
116116- # https://github.com/luishfonseca/dotfiles/blob/ab7625ec406b48493eda701911ad1cd017ce5bc1/modules/upgrade-diff.nix
117117- activationScripts.diff = {
118118- supportsDryActivation = true;
119119- text = ''
120120- ${lib.getExe pkgs.nvd} --nix-bin-dir=${pkgs.nix}/bin diff /run/current-system "$systemConfig"
121121- '';
122122- };
123123- };
124124-125125- specialisation.china.configuration = {
126126- # cache.nixos.org is *unbearably* slow when accessed from Mainland China.
127127- # Fortunately, mirror sites exist... Hooray(?)
128128- nix.settings.substituters = map (url: "${url}/nix-channels/store") [
129129- "https://mirrors.ustc.edu.cn"
130130- "https://mirrors6.tuna.tsinghua.edu.cn"
131131- "https://mirrors.tuna.tsinghua.edu.cn"
132132- # "https://mirror.sjtu.edu.cn" # FIXME: buggy?
133133- ];
134134-135135- # Redirect all traffic through proxy
136136- networking.proxy.allProxy = "http://127.0.0.1:2080";
137137- nix.settings.impure-env = [
138138- "all_proxy=http://127.0.0.1:2080"
139139- "GOPROXY=https://goproxy.cn"
140140- ];
141141-142142- # Make the auto upgrade mechanism upgrade to the correct specialization
143143- # so that proxies don't just randomly break the next day
144144- system.autoUpgrade.flags = [
145145- "--specialisation"
146146- "china"
147147- ];
148148- };
14950}