From 6893cbd4da134e1f7075ea54cc6150ffc8fa8625 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tristan=20Dani=C3=ABl=20Maat?= Date: Thu, 30 Nov 2023 08:42:25 +0100 Subject: [PATCH 1/6] Update to Nixos 23.11 --- flake.lock | 83 +++++----- flake.nix | 6 +- .../config/graphical-applications/firefox.nix | 8 +- .../config/tty-applications/default.nix | 2 +- home-config/config/tty-applications/zsh.nix | 5 +- home-modules/firefox-webapp.nix | 2 +- modules/cursor-theme.nix | 4 +- nixos-config/default.nix | 149 +++++++++--------- nixos-config/greeter/default.nix | 2 +- nixos-config/ren/default.nix | 8 +- nixos-config/ren/disko.nix | 54 +++---- nixos-config/yui/games.nix | 33 ++-- nixos-config/yui/nvidia/default.nix | 27 +++- nixos-config/yui/nvidia/wlroots-nvidia.patch | 12 ++ pkgs/applications/emacs/default.nix | 9 +- 15 files changed, 220 insertions(+), 184 deletions(-) create mode 100644 nixos-config/yui/nvidia/wlroots-nvidia.patch diff --git a/flake.lock b/flake.lock index c4b452c4..8197c698 100644 --- a/flake.lock +++ b/flake.lock @@ -8,17 +8,16 @@ ] }, "locked": { - "lastModified": 1696252780, - "narHash": "sha256-sQEjVzzstiaNLyiFJ19EMwwbDSSNDyQZIbPiLonlDCQ=", + "lastModified": 1701295343, + "narHash": "sha256-SgIudU8ju74krGDa3hZlUfPGim16KHnAKi91TMXwTac=", "owner": "ezKEa", "repo": "aagl-gtk-on-nix", - "rev": "0c9d93bdb311f7948f9fb0e98d869316d78eec12", + "rev": "21a0f2059afbae7267f913ac3727bb1205db2a2b", "type": "github" }, "original": { "owner": "ezKEa", "repo": "aagl-gtk-on-nix", - "rev": "0c9d93bdb311f7948f9fb0e98d869316d78eec12", "type": "github" } }, @@ -49,11 +48,11 @@ ] }, "locked": { - "lastModified": 1699781810, - "narHash": "sha256-LD+PIUbm1yQmQmGIbSsc/PB1dtJtGqXFgxRc1C7LlfQ=", + "lastModified": 1700927249, + "narHash": "sha256-iqmIWiEng890/ru7ZBf4nUezFPyRm2fjRTvuwwxqk2o=", "owner": "nix-community", "repo": "disko", - "rev": "2d7d77878c5d70f66f3d676ff66708d8d4f9d7df", + "rev": "3cb78c93e6a02f494aaf6aeb37481c27a2e2ee22", "type": "github" }, "original": { @@ -70,11 +69,11 @@ "rust-analyzer-src": "rust-analyzer-src" }, "locked": { - "lastModified": 1700806945, - "narHash": "sha256-mV25HkKFHDmjp+FEmneLYaRCB7wHOGuZlDFdHUCKAJI=", + "lastModified": 1701325357, + "narHash": "sha256-+CF74n9/AlLwgdCTM5WuKsa/4C1YxJSpRDCfz1ErOl0=", "owner": "nix-community", "repo": "fenix", - "rev": "7ab9ec16d364b564da3aa0e73887b0af133eef59", + "rev": "07a409ce1fe2c6d6e871793394b0cc0e5e262e3b", "type": "github" }, "original": { @@ -86,11 +85,11 @@ "flake-compat": { "flake": false, "locked": { - "lastModified": 1673956053, - "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", "owner": "edolstra", "repo": "flake-compat", - "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", "type": "github" }, "original": { @@ -179,16 +178,16 @@ ] }, "locked": { - "lastModified": 1700392168, - "narHash": "sha256-v5LprEFx3u4+1vmds9K0/i7sHjT0IYGs7u9v54iz/OA=", + "lastModified": 1700814205, + "narHash": "sha256-lWqDPKHRbQfi+zNIivf031BUeyciVOtwCwTjyrhDB5g=", "owner": "nix-community", "repo": "home-manager", - "rev": "28535c3a34d79071f2ccb68671971ce0c0984d7e", + "rev": "aeb2232d7a32530d3448318790534d196bf9427a", "type": "github" }, "original": { "owner": "nix-community", - "ref": "release-23.05", + "ref": "release-23.11", "repo": "home-manager", "type": "github" } @@ -238,11 +237,11 @@ ] }, "locked": { - "lastModified": 1700874698, - "narHash": "sha256-45bXCKIc3BZA3q83vAJi2qcd0mdkWp4bG/AmbBx01TA=", + "lastModified": 1700961605, + "narHash": "sha256-nN5m0OhqmD0gxtpXDvXyqCPQux9L/o1Yr1ALKoaOT9o=", "owner": "fufexan", "repo": "nix-gaming", - "rev": "9ed5f7f0e6f14fb8956ddb8c0ed345d6b4aee2c0", + "rev": "076d7864a6c2d02e41325c03ad3200a8a3739763", "type": "github" }, "original": { @@ -281,11 +280,11 @@ "treefmt-nix": "treefmt-nix" }, "locked": { - "lastModified": 1700730542, - "narHash": "sha256-yiZU9H1exYCJ1BTmkQ+7fjUXIknfFbAXlrH7qLZaj8w=", + "lastModified": 1701183034, + "narHash": "sha256-ziAsUAa0fGfdQ62bYxkffHFrbFbLdcRqooNaTO4cs+E=", "owner": "numtide", "repo": "nixos-anywhere", - "rev": "9c3de7d78d461cd31c86db196ae8b7746c081978", + "rev": "73a6d3fef4c5b4ab9e4ac868f468ec8f9436afa7", "type": "github" }, "original": { @@ -296,11 +295,11 @@ }, "nixos-hardware": { "locked": { - "lastModified": 1700559156, - "narHash": "sha256-gL4epO/qf+wo30JjC3g+b5Bs8UrpxzkhNBBsUYxpw2g=", + "lastModified": 1701250978, + "narHash": "sha256-ohu3cz4edjpGxs2qUTgbs0WrnewOX4crnUJNEB6Jox4=", "owner": "NixOS", "repo": "nixos-hardware", - "rev": "c3abafb01cd7045dba522af29b625bd1e170c2fb", + "rev": "8772491ed75f150f02552c60694e1beff9f46013", "type": "github" }, "original": { @@ -391,11 +390,11 @@ }, "nixpkgs-unstable": { "locked": { - "lastModified": 1700612854, - "narHash": "sha256-yrQ8osMD+vDLGFX7pcwsY/Qr5PUd6OmDMYJZzZi0+zc=", + "lastModified": 1701068326, + "narHash": "sha256-vmMceA+q6hG1yrjb+MP8T0YFDQIrW3bl45e7z24IEts=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "19cbff58383a4ae384dea4d1d0c823d72b49d614", + "rev": "8cfef6986adfb599ba379ae53c9f5631ecd2fd9c", "type": "github" }, "original": { @@ -407,27 +406,27 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1700851152, - "narHash": "sha256-3PWITNJZyA3jz5IGREJRfSykM6xSLmD8u5A3WpBCyDM=", + "lastModified": 1701156937, + "narHash": "sha256-jpMJOFvOTejx211D8z/gz0ErRtQPy6RXxgD2ZB86mso=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "1216a5ba22a93a4a3a3bfdb4bff0f4727c576fcc", + "rev": "7c4c20509c4363195841faa6c911777a134acdf3", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixos-23.05", + "ref": "nixos-23.11", "repo": "nixpkgs", "type": "github" } }, "nurpkgs": { "locked": { - "lastModified": 1700874374, - "narHash": "sha256-aJlAjLZfmXAUvdksPDWXKfUTeqtu0xwTsCyCw8z7N40=", + "lastModified": 1701326726, + "narHash": "sha256-Aqz4GqQzw5sxIavISxxDGDnAp/xezosbVZ7LWS0Cr2M=", "owner": "nix-community", "repo": "NUR", - "rev": "e51798a838e6e49a8c3f0a58054c973829e2f806", + "rev": "428ed7870c61b0ed6764af9970f6cdefbca9bb1c", "type": "github" }, "original": { @@ -480,11 +479,11 @@ "rust-analyzer-src": { "flake": false, "locked": { - "lastModified": 1700744506, - "narHash": "sha256-zE+ncUiKUJjMYVgvLsRnphyk+lPB4fta+4eiXKz4t4I=", + "lastModified": 1701186284, + "narHash": "sha256-euPBY3EmEy7+Jjm2ToRPlSp/qrj0UL9+PRobxVz6+aQ=", "owner": "rust-lang", "repo": "rust-analyzer", - "rev": "cccc7ca2c630865239f68af480878824041c7c05", + "rev": "c7c582afb57bb802715262d7f1ba73b8a86c1c5a", "type": "github" }, "original": { @@ -504,11 +503,11 @@ ] }, "locked": { - "lastModified": 1700362823, - "narHash": "sha256-/H7XgvrYM0IbkpWkcdfkOH0XyBM5ewSWT1UtaLvOgKY=", + "lastModified": 1701127353, + "narHash": "sha256-qVNX0wOl0b7+I35aRu78xUphOyELh+mtUp1KBx89K1Q=", "owner": "Mic92", "repo": "sops-nix", - "rev": "49a87c6c827ccd21c225531e30745a9a6464775c", + "rev": "b1edbf5c0464b4cced90a3ba6f999e671f0af631", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 13363ec1..0aa927c5 100644 --- a/flake.nix +++ b/flake.nix @@ -3,7 +3,7 @@ inputs = { # NixOS related inputs - nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05"; + nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11"; nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable"; nixpkgs-unfree = { url = "github:numtide/nixpkgs-unfree"; @@ -29,7 +29,7 @@ }; aagl = { - url = "github:ezKEa/aagl-gtk-on-nix?rev=0c9d93bdb311f7948f9fb0e98d869316d78eec12"; + url = "github:ezKEa/aagl-gtk-on-nix"; inputs.nixpkgs.follows = "nixpkgs"; }; @@ -43,7 +43,7 @@ # home-manager related inputs home-manager = { - url = "github:nix-community/home-manager/release-23.05"; + url = "github:nix-community/home-manager/release-23.11"; inputs.nixpkgs.follows = "nixpkgs"; }; nurpkgs.url = "github:nix-community/NUR"; diff --git a/home-config/config/graphical-applications/firefox.nix b/home-config/config/graphical-applications/firefox.nix index bc34c436..61fc13e7 100644 --- a/home-config/config/graphical-applications/firefox.nix +++ b/home-config/config/graphical-applications/firefox.nix @@ -38,13 +38,18 @@ in { programs.firefox = { enable = true; - package = pkgs.firefox.override {cfg.enableTridactylNative = true;}; + package = pkgs.firefox.override { + nativeMessagingHosts = [ + pkgs.tridactyl-native + ]; + }; profiles."tlater" = { extensions = with pkgs.nur.repos.rycee.firefox-addons; [ aria2-integration buster-captcha-solver clearurls decentraleyes + indie-wiki-buddy keepassxc-browser libredirect no-pdf-download @@ -57,6 +62,7 @@ in { # cloudhole # devtools-adb-extension # firefox-sticky-window-containers + # warframe-reliquary-prime ]; userChrome = diff --git a/home-config/config/tty-applications/default.nix b/home-config/config/tty-applications/default.nix index 69abd385..a91bf3b4 100644 --- a/home-config/config/tty-applications/default.nix +++ b/home-config/config/tty-applications/default.nix @@ -14,7 +14,7 @@ home.packages = with pkgs; [ bat - exa + eza fd ripgrep screen diff --git a/home-config/config/tty-applications/zsh.nix b/home-config/config/tty-applications/zsh.nix index 63ca2b5b..2781f7a5 100644 --- a/home-config/config/tty-applications/zsh.nix +++ b/home-config/config/tty-applications/zsh.nix @@ -46,10 +46,11 @@ in { enableAutosuggestions = true; enableCompletion = true; - enableSyntaxHighlighting = true; enableVteIntegration = true; defaultKeymap = "emacs"; + syntaxHighlighting.enable = true; + plugins = [ { name = "bgnotify"; @@ -66,7 +67,7 @@ in { ]; shellAliases = { - "ls" = "exa"; + "ls" = "eza"; "winetricks" = "winetricks -q"; "pbcopy" = "xsel --clipboard --input"; "pbpaste" = "xsel --clipboard"; diff --git a/home-modules/firefox-webapp.nix b/home-modules/firefox-webapp.nix index e13180d9..d992c7e5 100644 --- a/home-modules/firefox-webapp.nix +++ b/home-modules/firefox-webapp.nix @@ -87,7 +87,7 @@ in { }; extraArgs = mkOption { - type = listOf string; + type = listOf str; default = []; description = "Extra args to launch Firefox with."; }; diff --git a/modules/cursor-theme.nix b/modules/cursor-theme.nix index a660e763..64900b3f 100644 --- a/modules/cursor-theme.nix +++ b/modules/cursor-theme.nix @@ -4,13 +4,13 @@ pkgs, ... }: let - inherit (lib.types) string nullOr number; + inherit (lib.types) str nullOr number; in { options.theming = { cursor = { theme = lib.mkOption { default = null; - type = nullOr string; + type = nullOr str; description = "The default cursor theme to use. Package must be installed separately"; }; diff --git a/nixos-config/default.nix b/nixos-config/default.nix index b063f623..357963d7 100644 --- a/nixos-config/default.nix +++ b/nixos-config/default.nix @@ -97,7 +97,6 @@ useDHCP = false; useNetworkd = true; }; - systemd.network.wait-online.anyInterface = true; time.timeZone = "Europe/Amsterdam"; @@ -118,37 +117,93 @@ # lot) documentation.man.generateCaches = true; - environment.systemPackages = with pkgs; [ - git # To manage the nixos configuration, all users need git - home-manager # To manage the actual user configuration - pavucontrol # In case the host doesn't have audio, this can't be in the user config - wpa_supplicant_gui # For managing wireless networks + environment = { + systemPackages = with pkgs; [ + git # To manage the nixos configuration, all users need git + home-manager # To manage the actual user configuration + pavucontrol # In case the host doesn't have audio, this can't be in the user config + wpa_supplicant_gui # For managing wireless networks - firefox - ]; + firefox + ]; - environment.extraInit = '' - # Do not want this in the environment. NixOS always sets it and does not - # provide any option not to, so I must unset it myself via the - # environment.extraInit option. - unset -v SSH_ASKPASS - ''; + extraInit = '' + # Do not want this in the environment. NixOS always sets it and does not + # provide any option not to, so I must unset it myself via the + # environment.extraInit option. + unset -v SSH_ASKPASS + ''; - environment.pathsToLink = [ - "/share/zsh" - ]; + pathsToLink = [ + "/share/zsh" + ]; + + # Disable the HFP bluetooth profile, because I always use external + # microphones anyway. It sucks and sometimes devices end up caught + # in it even if I have another microphone. + etc."wireplumber/bluetooth.lua.d/50-bluez-config.lua".text = '' + bluez_monitor.enabled = true + + bluez_monitor.properties = { + ["bluez5.headset-roles"] = "[ ]", + ["bluez5.hfphsp-backend"] = "none", + } + + bluez_monitor.rules = { + { + matches = { + { + -- This matches all cards. + { "device.name", "matches", "bluez_card.*" }, + }, + }, + + apply_properties = { + -- Auto-connect device profiles on start up or when only partial + -- profiles have connected. Disabled by default if the property + -- is not specified. + --["bluez5.auto-connect"] = "[ hfp_hf hsp_hs a2dp_sink hfp_ag hsp_ag a2dp_source ]", + ["bluez5.auto-connect"] = "[ a2dp_sink a2dp_source ]", + + -- Hardware volume control (default: [ hfp_ag hsp_ag a2dp_source ]) + --["bluez5.hw-volume"] = "[ hfp_hf hsp_hs a2dp_sink hfp_ag hsp_ag a2dp_source ]", + ["bluez5.hw-volume"] = "[ a2dp_sink a2dp_source ]", + + -- LDAC encoding quality + -- Available values: auto (Adaptive Bitrate, default) + -- hq (High Quality, 990/909kbps) + -- sq (Standard Quality, 660/606kbps) + -- mq (Mobile use Quality, 330/303kbps) + --["bluez5.a2dp.ldac.quality"] = "auto", + + -- AAC variable bitrate mode + -- Available values: 0 (cbr, default), 1-5 (quality level) + --["bluez5.a2dp.aac.bitratemode"] = 0, + + -- Profile connected first + -- Available values: a2dp-sink (default), headset-head-unit + --["device.profile"] = "a2dp-sink", + + -- Opus Pro Audio encoding mode: audio, voip, lowdelay + --["bluez5.a2dp.opus.pro.application"] = "audio", + --["bluez5.a2dp.opus.pro.bidi.application"] = "audio", + }, + }, + } + ''; + }; programs = { dconf.enable = true; zsh.enable = true; + nano.enable = false; }; - security.pam.services.swaylock = {}; fonts = { - enableDefaultFonts = true; + enableDefaultPackages = true; - fonts = with pkgs; [ + packages = with pkgs; [ hack-font noto-fonts noto-fonts-cjk @@ -195,60 +250,6 @@ fwupd.enable = true; }; - # Disable the HFP bluetooth profile, because I always use external - # microphones anyway. It sucks and sometimes devices end up caught - # in it even if I have another microphone. - environment.etc."wireplumber/bluetooth.lua.d/50-bluez-config.lua".text = '' - bluez_monitor.enabled = true - - bluez_monitor.properties = { - ["bluez5.headset-roles"] = "[ ]", - ["bluez5.hfphsp-backend"] = "none", - } - - bluez_monitor.rules = { - { - matches = { - { - -- This matches all cards. - { "device.name", "matches", "bluez_card.*" }, - }, - }, - - apply_properties = { - -- Auto-connect device profiles on start up or when only partial - -- profiles have connected. Disabled by default if the property - -- is not specified. - --["bluez5.auto-connect"] = "[ hfp_hf hsp_hs a2dp_sink hfp_ag hsp_ag a2dp_source ]", - ["bluez5.auto-connect"] = "[ a2dp_sink a2dp_source ]", - - -- Hardware volume control (default: [ hfp_ag hsp_ag a2dp_source ]) - --["bluez5.hw-volume"] = "[ hfp_hf hsp_hs a2dp_sink hfp_ag hsp_ag a2dp_source ]", - ["bluez5.hw-volume"] = "[ a2dp_sink a2dp_source ]", - - -- LDAC encoding quality - -- Available values: auto (Adaptive Bitrate, default) - -- hq (High Quality, 990/909kbps) - -- sq (Standard Quality, 660/606kbps) - -- mq (Mobile use Quality, 330/303kbps) - --["bluez5.a2dp.ldac.quality"] = "auto", - - -- AAC variable bitrate mode - -- Available values: 0 (cbr, default), 1-5 (quality level) - --["bluez5.a2dp.aac.bitratemode"] = 0, - - -- Profile connected first - -- Available values: a2dp-sink (default), headset-head-unit - --["device.profile"] = "a2dp-sink", - - -- Opus Pro Audio encoding mode: audio, voip, lowdelay - --["bluez5.a2dp.opus.pro.application"] = "audio", - --["bluez5.a2dp.opus.pro.bidi.application"] = "audio", - }, - }, - } - ''; - hardware = { bluetooth.enable = true; enableRedistributableFirmware = true; diff --git a/nixos-config/greeter/default.nix b/nixos-config/greeter/default.nix index 5325297b..3fc636ee 100644 --- a/nixos-config/greeter/default.nix +++ b/nixos-config/greeter/default.nix @@ -49,7 +49,7 @@ in { pciutils ]; - fonts.fonts = [ + fonts.packages = [ flake-inputs.self.packages.${pkgs.system}.phosphor-icons ]; diff --git a/nixos-config/ren/default.nix b/nixos-config/ren/default.nix index e8124959..9bc77993 100644 --- a/nixos-config/ren/default.nix +++ b/nixos-config/ren/default.nix @@ -15,10 +15,10 @@ # https://discourse.nixos.org/t/impermanence-vs-systemd-initrd-w-tpm-unlocking/25167 boot.initrd.systemd.enable = true; - fileSystems = { - "/persist/data".neededForBoot = true; - "/persist/state".neededForBoot = true; - }; + # fileSystems = { + # "/persist/data".neededForBoot = true; + # "/persist/state".neededForBoot = true; + # }; # /etc/sops/ won't be available during early boot because # impermanence runs after the sops secrets setup. diff --git a/nixos-config/ren/disko.nix b/nixos-config/ren/disko.nix index 0faec2bf..271249cc 100644 --- a/nixos-config/ren/disko.nix +++ b/nixos-config/ren/disko.nix @@ -1,41 +1,39 @@ -_: let - disks = [ - "/dev/sda" - ]; -in { +{ disko.devices = { disk = { sda = { type = "disk"; - device = builtins.elemAt disks 0; + device = "/dev/sda"; content = { - type = "table"; - format = "gpt"; - partitions = [ - { - name = "ESP"; + type = "gpt"; + partitions = { + ESP = { start = "1MiB"; end = "128MiB"; - fs-type = "fat32"; - bootable = true; + type = "EF00"; content = { type = "filesystem"; format = "vfat"; mountpoint = "/boot"; + mountOptions = [ + "defaults" + ]; }; - } - { - name = "main"; + }; + + main = { start = "128MiB"; end = "-4G"; content = { type = "luks"; name = "main"; - extraOpenArgs = ["--allow-discards"]; - keyFile = "/tmp/secret.key"; + settings = { + keyFile = "/tmp/secret.key"; + allowDiscards = true; + }; content = { type = "btrfs"; - extraArgs = ["-f"]; # Override existing partition + extraArgs = ["-f"]; subvolumes = { "/root" = { mountpoint = "/"; @@ -56,22 +54,22 @@ in { }; }; }; - } - { - name = "swap"; + }; + + swap = { start = "-4G"; end = "100%"; content = { type = "luks"; name = "swap"; - extraOpenArgs = ["--allow-discards"]; - keyFile = "/tmp/secret.key"; - content = { - type = "swap"; + settings = { + keyFile = "/tmp/secret.key"; + allowDiscards = true; }; + content.type = "swap"; }; - } - ]; + }; + }; }; }; }; diff --git a/nixos-config/yui/games.nix b/nixos-config/yui/games.nix index d6e0f08d..04742144 100644 --- a/nixos-config/yui/games.nix +++ b/nixos-config/yui/games.nix @@ -13,25 +13,27 @@ # Appears to resolve issues with crackling audio under high load services.pipewire.lowLatency.enable = true; - programs.steam.enable = true; - # Make steam controller work hardware.steam-hardware.enable = true; services.joycond.enable = true; - programs.gamescope = { - enable = true; - capSysNice = true; - args = [ - "--steam" - "--expose-wayland" - "--rt" - "-W 1920" - "-H 1080" - "--force-grab-cursor" - "--grab" - "--fullscreen" - ]; + programs = { + steam.enable = true; + anime-game-launcher.enable = true; + gamescope = { + enable = true; + capSysNice = true; + args = [ + "--steam" + "--expose-wayland" + "--rt" + "-W 1920" + "-H 1080" + "--force-grab-cursor" + "--grab" + "--fullscreen" + ]; + }; }; # Star citizen needs more @@ -39,5 +41,4 @@ # AAGL nix.settings = flake-inputs.aagl.nixConfig; - programs.anime-game-launcher.enable = true; } diff --git a/nixos-config/yui/nvidia/default.nix b/nixos-config/yui/nvidia/default.nix index d2ddd90a..e98cdd19 100644 --- a/nixos-config/yui/nvidia/default.nix +++ b/nixos-config/yui/nvidia/default.nix @@ -1,9 +1,17 @@ -{lib, ...}: { +{ + config, + lib, + ... +}: { imports = [ ./vaapi.nix ]; hardware.nvidia = { + # The current stable nvidia driver is utterly broken. Use + # production for now to work around stuff like this: + # https://forums.developer.nvidia.com/t/535-86-05-low-framerate-vulkan-apps-stutter-under-wayland-xwayland/26147 + package = config.boot.kernelPackages.nvidiaPackages.production; modesetting.enable = true; # Power management is required to get nvidia GPUs to behave on # suspend, due to firmware bugs. Aren't nvidia great? @@ -34,6 +42,23 @@ # settings ]; + # Replace a glFlush() with a glFinish() - this prevents stuttering + # and glitching in all kinds of circumstances for the moment. + # + # Apparently I'm waiting for "explicit sync" support, which needs to + # land as a wayland thing. I've seen this work reasonably with VRR + # before, but emacs continued to stutter, so for now this is + # staying. + nixpkgs.overlays = [ + (_: final: { + wlroots_0_16 = final.wlroots_0_16.overrideAttrs (_: { + patches = [ + ./wlroots-nvidia.patch + ]; + }); + }) + ]; + environment.variables = { # Required to run the correct GBM backend for nvidia GPUs on wayland GBM_BACKEND = "nvidia-drm"; diff --git a/nixos-config/yui/nvidia/wlroots-nvidia.patch b/nixos-config/yui/nvidia/wlroots-nvidia.patch new file mode 100644 index 00000000..24e60ee3 --- /dev/null +++ b/nixos-config/yui/nvidia/wlroots-nvidia.patch @@ -0,0 +1,12 @@ +diff --git a/render/gles2/renderer.c b/render/gles2/renderer.c +index 9fe934f7..9662d4ee 100644 +--- a/render/gles2/renderer.c ++++ b/render/gles2/renderer.c +@@ -168,6 +168,6 @@ static bool gles2_bind_buffer(struct wlr_renderer *wlr_renderer, + assert(wlr_egl_is_current(renderer->egl)); + + push_gles2_debug(renderer); +- glFlush(); ++ glFinish(); + glBindFramebuffer(GL_FRAMEBUFFER, 0); + pop_gles2_debug(renderer); diff --git a/pkgs/applications/emacs/default.nix b/pkgs/applications/emacs/default.nix index 2458c19a..a128bfe2 100644 --- a/pkgs/applications/emacs/default.nix +++ b/pkgs/applications/emacs/default.nix @@ -22,14 +22,7 @@ ''; }; - overrides = _self: super: { - dashboard = super.dashboard.overrideAttrs (_old: { - patches = [ - # See https://github.com/emacs-dashboard/emacs-dashboard/issues/81 - ./fix-emacs-dashboard.patch - ]; - }); - }; + overrides = _self: _super: {}; emacsPkgs = (emacsPackagesFor emacsPlatform).overrideScope' overrides; From 3b8c626bde64833e09161edec13a2034c39cffc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tristan=20Dani=C3=ABl=20Maat?= Date: Thu, 30 Nov 2023 12:24:23 +0100 Subject: [PATCH 2/6] nixos-config: Clean up `environment.systemPackages` --- nixos-config/default.nix | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/nixos-config/default.nix b/nixos-config/default.nix index 357963d7..4954505d 100644 --- a/nixos-config/default.nix +++ b/nixos-config/default.nix @@ -119,12 +119,8 @@ environment = { systemPackages = with pkgs; [ - git # To manage the nixos configuration, all users need git - home-manager # To manage the actual user configuration - pavucontrol # In case the host doesn't have audio, this can't be in the user config - wpa_supplicant_gui # For managing wireless networks - - firefox + pavucontrol + wpa_supplicant_gui ]; extraInit = '' @@ -195,6 +191,7 @@ programs = { dconf.enable = true; + git.enable = true; zsh.enable = true; nano.enable = false; }; From 338d726253d357f955d58d6735ba4a4d0fe47346 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tristan=20Dani=C3=ABl=20Maat?= Date: Thu, 30 Nov 2023 13:07:34 +0100 Subject: [PATCH 3/6] sudo: Switch to sudo-rs --- nixos-config/default.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/nixos-config/default.nix b/nixos-config/default.nix index 4954505d..26538f5d 100644 --- a/nixos-config/default.nix +++ b/nixos-config/default.nix @@ -196,6 +196,7 @@ nano.enable = false; }; + security.sudo-rs.enable = true; fonts = { enableDefaultPackages = true; From dfdd93f9b4aeed27d0af2f87b845b751cb451938 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tristan=20Dani=C3=ABl=20Maat?= Date: Thu, 30 Nov 2023 13:34:44 +0100 Subject: [PATCH 4/6] sway: Fix xdg-desktop-portal-wlr crash --- nixos-config/greeter/default.nix | 1 + nixos-config/sway.nix | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/nixos-config/greeter/default.nix b/nixos-config/greeter/default.nix index 3fc636ee..2cfaae8b 100644 --- a/nixos-config/greeter/default.nix +++ b/nixos-config/greeter/default.nix @@ -31,6 +31,7 @@ sway-run = pkgs.writeShellScriptBin "sway-run" '' export XDG_SESSION_TYPE=wayland + export XDG_CURRENT_DESKTOP=sway systemd-cat -t xsession sway ${lib.optionalString unsupported-gpu "--unsupported-gpu"} ''; in { diff --git a/nixos-config/sway.nix b/nixos-config/sway.nix index c0a023e2..85f20d66 100644 --- a/nixos-config/sway.nix +++ b/nixos-config/sway.nix @@ -1,4 +1,20 @@ {pkgs, ...}: { + nixpkgs.overlays = [ + (_: prev: { + # Fix issues with nvidia screencapture bit depth + # See https://github.com/emersion/xdg-desktop-portal-wlr/issues/190 + # TODO(tlater): stop doing this when there's a new release. + xdg-desktop-portal-wlr = prev.xdg-desktop-portal-wlr.overrideAttrs (old: { + src = prev.fetchFromGitHub { + owner = "emersion"; + repo = old.pname; + rev = "b5f387821800e32d4f82001504668d819f02bb4b"; + hash = "sha256-TeTDJVFW0NHZpmTm8PAXTzbzk6kolvY7Vd55YQfJV20="; + }; + }); + }) + ]; + environment.systemPackages = with pkgs; [ bibata-cursors ]; From 12858f4d613dc6669bd0e80380745135d4a29939 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tristan=20Dani=C3=ABl=20Maat?= Date: Fri, 26 Jan 2024 00:37:30 +0100 Subject: [PATCH 5/6] pipewire: Remove the x11 bell --- home-config/config/desktop/pipewire.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/home-config/config/desktop/pipewire.nix b/home-config/config/desktop/pipewire.nix index 06af50ee..1ef2702d 100644 --- a/home-config/config/desktop/pipewire.nix +++ b/home-config/config/desktop/pipewire.nix @@ -9,6 +9,15 @@ in { config = lib.mkIf config.custom.desktop-environment { xdg.configFile."pipewire/pipewire.conf.d/99-rnnoise.conf" = { text = builtins.toJSON { + "context.properties" = { + "link.max-buffers" = 16; + "core.daemon" = true; + "core.name" = "pipewire-0"; + "module.x11.bell" = false; + "module.access" = true; + "module.jackdbus-detect" = false; + }; + "context.modules" = [ { name = "libpipewire-module-filter-chain"; From ef7a580459557fbc289360316380145c821c55b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tristan=20Dani=C3=ABl=20Maat?= Date: Fri, 26 Jan 2024 00:35:47 +0100 Subject: [PATCH 6/6] filesystems: Fix /boot permissions --- nixos-config/default.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nixos-config/default.nix b/nixos-config/default.nix index 26538f5d..6cc3f712 100644 --- a/nixos-config/default.nix +++ b/nixos-config/default.nix @@ -198,6 +198,8 @@ security.sudo-rs.enable = true; + fileSystems."/boot".options = ["umask=0077"]; + fonts = { enableDefaultPackages = true;