From 8872b78a077f6a1ebb96e469df351632ae25acae Mon Sep 17 00:00:00 2001 From: Kat Inskip Date: Mon, 5 Feb 2024 19:30:04 -0800 Subject: [PATCH] feat(misc): laptop fixes --- flake.lock | 84 +++++++++++++++--------------- home/environments/kde/kde.nix | 3 ++ home/environments/kde/konawall.nix | 2 +- home/profiles/graphical/vscode.nix | 11 ++-- nixos/environments/kde/xserver.nix | 5 +- nixos/hardware/intel_gpu.nix | 13 +++++ nixos/profiles/graphical/fonts.nix | 3 ++ nixos/profiles/laptop/powertop.nix | 23 +++++++- systems/koishi.nix | 18 ++++--- 9 files changed, 104 insertions(+), 58 deletions(-) create mode 100644 nixos/hardware/intel_gpu.nix diff --git a/flake.lock b/flake.lock index 777dc1e2..13774130 100644 --- a/flake.lock +++ b/flake.lock @@ -3,11 +3,11 @@ "arcexprs": { "flake": false, "locked": { - "lastModified": 1704566766, - "narHash": "sha256-siDifNnxNDasICxpk5EiirzkeMybsU87EME/du/07mU=", + "lastModified": 1706385294, + "narHash": "sha256-mGqas+TDp2DtR7ufx10SDlKnL+aRZ/jhbkGYlF8NLO4=", "owner": "arcnmx", "repo": "nixexprs", - "rev": "430ea6ab7e12b43ebeb4bcee33c26808102cf423", + "rev": "aa081527557408f1fb5dca56a19f817cd3577b47", "type": "github" }, "original": { @@ -71,11 +71,11 @@ ] }, "locked": { - "lastModified": 1704277720, - "narHash": "sha256-meAKNgmh3goankLGWqqpw73pm9IvXjEENJloF0coskE=", + "lastModified": 1706833576, + "narHash": "sha256-w7BL0EWRts+nD1lbLECIuz6fRzmmV+z8oWwoY7womR0=", "owner": "lnl7", "repo": "nix-darwin", - "rev": "0dd382b70c351f528561f71a0a7df82c9d2be9a4", + "rev": "bdbae6ecff8fcc322bf6b9053c0b984912378af7", "type": "github" }, "original": { @@ -98,11 +98,11 @@ ] }, "locked": { - "lastModified": 1703087360, - "narHash": "sha256-0VUbWBW8VyiDRuimMuLsEO4elGuUw/nc2WDeuO1eN1M=", + "lastModified": 1704875591, + "narHash": "sha256-eWRLbqRcrILgztU/m/k7CYLzETKNbv0OsT2GjkaNm8A=", "owner": "serokell", "repo": "deploy-rs", - "rev": "b709d63debafce9f5645a5ba550c9e0983b3d1f7", + "rev": "1776009f1f3fb2b5d236b84d9815f2edee463a9b", "type": "github" }, "original": { @@ -220,11 +220,11 @@ ] }, "locked": { - "lastModified": 1704498488, - "narHash": "sha256-yINKdShHrtjdiJhov+q0s3Y3B830ujRoSbHduUNyKag=", + "lastModified": 1707114923, + "narHash": "sha256-LDYPWa+BgxHSNEye93SyIPgz5u3RAfh78P9KyO+rQzI=", "owner": "nix-community", "repo": "home-manager", - "rev": "51e44a13acea71b36245e8bd8c7db53e0a3e61ee", + "rev": "afcedcf2c8e424d0465e823cf833eb3adebe1db7", "type": "github" }, "original": { @@ -244,11 +244,11 @@ ] }, "locked": { - "lastModified": 1700075394, - "narHash": "sha256-LKPbXdmQNM+NtxVYEd0SFb7gti0p3l9WDjDsDbccjUQ=", + "lastModified": 1707190092, + "narHash": "sha256-yn9ng8nXcbsWZ2RZ1DgWvYE4YykmfSh4eDye7wS9G8U=", "owner": "kittywitch", "repo": "konawall-py", - "rev": "bfb74c7acacaff5024ba2b107bd8775e516f84db", + "rev": "a461bf400fae30ed513e97adfa7ac741cdf6e0c7", "type": "github" }, "original": { @@ -296,11 +296,11 @@ ] }, "locked": { - "lastModified": 1704503938, - "narHash": "sha256-CWLVbRQJksiyTvPyks3bylwYjvx7KsaG1WUX1OfbAwc=", + "lastModified": 1706922828, + "narHash": "sha256-LW/is1Y4nzzcuKDh2qTySvEaVGy6wqOflSDcHZDg6H4=", "owner": "Infinidoge", "repo": "nix-minecraft", - "rev": "932a025182e736383e26b6c7f9dddeaa184c2e5a", + "rev": "ccb58cd173960992558b6127b423621090866b45", "type": "github" }, "original": { @@ -316,11 +316,11 @@ ] }, "locked": { - "lastModified": 1703992163, - "narHash": "sha256-709CGmwU34dxv8DjSpRBZ+HibVJIVaFcA4JH+GFnhyM=", + "lastModified": 1707016097, + "narHash": "sha256-V4lHr6hFQ3rK650dh64Xffxsf4kse9vUYWsM+ldjkco=", "owner": "Mic92", "repo": "nix-index-database", - "rev": "d6510ce144f5da7dd9bac667ba3d5a4946c00d11", + "rev": "3e3dad2808379c522138e2e8b0eb73500721a237", "type": "github" }, "original": { @@ -361,11 +361,11 @@ }, "nixos-hardware": { "locked": { - "lastModified": 1704458188, - "narHash": "sha256-f6BYEuIqnbrs6J/9m1/1VdkJ6d63hO9kUC09kTPuOqE=", + "lastModified": 1706834982, + "narHash": "sha256-3CfxA7gZ+DVv/N9Pvw61bV5Oe/mWfxYPyVQGqp9TMJA=", "owner": "NixOS", "repo": "nixos-hardware", - "rev": "172385318068519900a7d71c1024242fa6af75f0", + "rev": "83e571bb291161682b9c3ccd48318f115143a550", "type": "github" }, "original": { @@ -376,11 +376,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1704194953, - "narHash": "sha256-RtDKd8Mynhe5CFnVT8s0/0yqtWFMM9LmCzXv/YKxnq4=", + "lastModified": 1706913249, + "narHash": "sha256-x3M7iV++CsvRXI1fpyFPduGELUckZEhSv0XWnUopAG8=", "owner": "nixos", "repo": "nixpkgs", - "rev": "bd645e8668ec6612439a9ee7e71f7eac4099d4f6", + "rev": "e92b6015881907e698782c77641aa49298330223", "type": "github" }, "original": { @@ -392,11 +392,11 @@ }, "nixpkgs-stable": { "locked": { - "lastModified": 1703950681, - "narHash": "sha256-veU5bE4eLOmi7aOzhE7LfZXcSOONRMay0BKv01WHojo=", + "lastModified": 1705957679, + "narHash": "sha256-Q8LJaVZGJ9wo33wBafvZSzapYsjOaNjP/pOnSiKVGHY=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "0aad9113182747452dbfc68b93c86e168811fa6c", + "rev": "9a333eaa80901efe01df07eade2c16d183761fa3", "type": "github" }, "original": { @@ -416,11 +416,11 @@ ] }, "locked": { - "lastModified": 1704383901, - "narHash": "sha256-i2+yzhc13omN+z9K8W3/+23g7D6yWfLb5Qn5f8VVvZI=", + "lastModified": 1707045317, + "narHash": "sha256-o2NZJcNu2/M3qycZ2Z9sgIESQEBFmihbbA7//sp7yVA=", "owner": "pjones", "repo": "plasma-manager", - "rev": "f11fd526015b5e6b3622c660eda4c4a13d7592bc", + "rev": "290cd65b65e2da11ca9fda69781ea9beb8a6f6ac", "type": "github" }, "original": { @@ -503,11 +503,11 @@ "nixpkgs-stable": "nixpkgs-stable" }, "locked": { - "lastModified": 1703991717, - "narHash": "sha256-XfBg2dmDJXPQEB8EdNBnzybvnhswaiAkUeeDj7fa/hQ=", + "lastModified": 1707015547, + "narHash": "sha256-YZr0OrqWPdbwBhxpBu69D32ngJZw8AMgZtJeaJn0e94=", "owner": "Mic92", "repo": "sops-nix", - "rev": "cfdbaf68d00bc2f9e071f17ae77be4b27ff72fa6", + "rev": "23f61b897c00b66855074db471ba016e0cda20dd", "type": "github" }, "original": { @@ -634,11 +634,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1701680307, - "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", + "lastModified": 1705309234, + "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=", "owner": "numtide", "repo": "flake-utils", - "rev": "4022d587cbbfd70fe950c1e2083a02621806a725", + "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26", "type": "github" }, "original": { @@ -660,11 +660,11 @@ ] }, "locked": { - "lastModified": 1704496463, - "narHash": "sha256-/LOWVVLccTJyNoS06bWAoTe+dtFfgM19uqpN0vjsBoc=", + "lastModified": 1707162675, + "narHash": "sha256-ZojPqn5+cuuqCt/VVGo+uuRxYLtMomahHseFj9HB3O8=", "owner": "nix-community", "repo": "NixOS-WSL", - "rev": "d2fd320bab0aa486383bbf5f13d5d8120700f911", + "rev": "4bb6b2e814be63caa115038e917c6c25b7fc2ac1", "type": "github" }, "original": { diff --git a/home/environments/kde/kde.nix b/home/environments/kde/kde.nix index 7281b888..72088cea 100644 --- a/home/environments/kde/kde.nix +++ b/home/environments/kde/kde.nix @@ -8,6 +8,9 @@ _: { "kdeglobals"."WM"."inactiveBackground" = "231,232,235"; "kdeglobals"."WM"."inactiveBlend" = "231,232,235"; "kdeglobals"."WM"."inactiveForeground" = "163,165,172"; + "kdeglobals"."General"."BrowserApplication" = "firefox.desktop"; + "kdeglobals"."General"."TerminalApplication" = "wezterm start --cwd ."; + "kdeglobals"."General"."TerminalService" = "org.wezfurlong.wezterm.desktop"; "kxkbrc"."Layout"."Options" = "terminate:ctrl_alt_bksp,ctrl:nocaps"; "kxkbrc"."Layout"."ResetOldOptions" = true; "plasmarc"."Theme"."name" = "Arc"; diff --git a/home/environments/kde/konawall.nix b/home/environments/kde/konawall.nix index 2ef15020..09b9d36d 100644 --- a/home/environments/kde/konawall.nix +++ b/home/environments/kde/konawall.nix @@ -13,7 +13,7 @@ Type=Application ''; konawallConfig = { - interval = 300; + interval = 30 * 60; rotate = true; source = "konachan"; tags = [ diff --git a/home/profiles/graphical/vscode.nix b/home/profiles/graphical/vscode.nix index c9f8cf79..b4acb635 100644 --- a/home/profiles/graphical/vscode.nix +++ b/home/profiles/graphical/vscode.nix @@ -2,16 +2,13 @@ programs.vscode = { enable = true; extensions = with pkgs.vscode-extensions; [ - kamadorueda.alejandra - mkhl.direnv - mhutchie.git-graph - golang.go - hashicorp.terraform - arrterian.nix-env-selector - jnoortheen.nix-ide vscodevim.vim catppuccin.catppuccin-vsc github.copilot + kamadorueda.alejandra + mkhl.direnv + hashicorp.terraform + jnoortheen.nix-ide ]; userSettings = { "nix.enableLanguageServer" = true; diff --git a/nixos/environments/kde/xserver.nix b/nixos/environments/kde/xserver.nix index 59a1ca43..37c617e9 100644 --- a/nixos/environments/kde/xserver.nix +++ b/nixos/environments/kde/xserver.nix @@ -1,4 +1,7 @@ -_: { +{ pkgs, ... }: { + environment.systemPackages = with pkgs; [ + xclip + ]; services.xserver = { enable = true; displayManager.sddm.enable = true; diff --git a/nixos/hardware/intel_gpu.nix b/nixos/hardware/intel_gpu.nix new file mode 100644 index 00000000..21a03e6f --- /dev/null +++ b/nixos/hardware/intel_gpu.nix @@ -0,0 +1,13 @@ +{ pkgs, ... }: { + services.xserver.videoDrivers = [ "intel" ]; + hardware.opengl = { + enable = true; + driSupport = true; + extraPackages = with pkgs; [ + intel-media-driver + vaapiIntel + vaapiVdpau + libvdpau-va-gl + ]; + }; +} diff --git a/nixos/profiles/graphical/fonts.nix b/nixos/profiles/graphical/fonts.nix index de807289..02de72b0 100644 --- a/nixos/profiles/graphical/fonts.nix +++ b/nixos/profiles/graphical/fonts.nix @@ -5,6 +5,9 @@ twitter-color-emoji iosevka-bin monaspace + corefonts + vistafonts + open-dyslexic ]; enableDefaultPackages = true; fontDir.enable = true; diff --git a/nixos/profiles/laptop/powertop.nix b/nixos/profiles/laptop/powertop.nix index f11279db..655d71cd 100644 --- a/nixos/profiles/laptop/powertop.nix +++ b/nixos/profiles/laptop/powertop.nix @@ -1,3 +1,24 @@ -_: { +{ + pkgs, + lib, + ... +}: { powerManagement.powertop.enable = true; + systemd.services.powertop.serviceConfig.ExecStartPost = let + deviceList = [ + "ThinkPad Dock" + "Razer" + "YubiKey" + "Keychron" + ]; + inherit (lib.strings) concatMapStrings; + deviceCommands = + concatMapStrings (device: '' + for f in $(${pkgs.gnugrep}/bin/grep -Rl "${device}" /sys/bus/usb/devices/*/product); do + ${pkgs.coreutils}/bin/echo on > $(dirname $f)/power/control + done + '') + deviceList; + execStartPost = pkgs.writeShellScriptBin "powertop-execStartPost" deviceCommands; + in "${execStartPost}/bin/powertop-execStartPost"; } diff --git a/systems/koishi.nix b/systems/koishi.nix index a30af9df..d2be41fa 100644 --- a/systems/koishi.nix +++ b/systems/koishi.nix @@ -1,7 +1,12 @@ _: let - hostConfig = {tree, ...}: { + hostConfig = {tree, pkgs, ...}: { imports = - (with tree.nixos.profiles; [ + (with tree.nixos.hardware; [ + intel_cpu + intel_gpu + uefi + ]) + ++ (with tree.nixos.profiles; [ graphical wireless laptop @@ -19,6 +24,10 @@ _: let kde ]); + environment.systemPackages = with pkgs; [ + parsec-bin + ]; + fileSystems = { "/" = { device = "/dev/disk/by-uuid/a664de0f-9883-420e-acc5-b9602a23e816"; @@ -30,10 +39,6 @@ _: let }; }; - machine = { - cpuVendor = "intel"; - }; - networking.networkmanager.wifi.backend = "iwd"; swapDevices = [ @@ -42,6 +47,7 @@ _: let boot = { supportedFilesystems = ["xfs"]; + extraModprobeConfig = "options snd_hda_intel power_save=1 power_save_controller=Y"; initrd = { availableKernelModules = ["xhci_pci" "nvme" "usb_storage" "sd_mod" "sr_mod" "rtsx_usb_sdmmc"]; luks.devices."cryptroot".device = "/dev/disk/by-uuid/f0ea08b4-6af7-4d90-a2ad-edd5672a2105";