From 38b26a082f99c6f3aabd652a0f94bd75337539c0 Mon Sep 17 00:00:00 2001 From: reidlab Date: Sun, 7 Jun 2026 23:15:03 -0700 Subject: [PATCH] weee new laptoo --- default.nix | 1 - flake.lock | 120 ++++++++++-------- flake.nix | 4 +- hosts/flubber-machine/default.nix | 5 +- .../apple-macbook-air-9-1.nix | 58 --------- hosts/goopnet-interface/default.nix | 5 +- hosts/goopnet-interface/hardware.nix | 25 ++-- hosts/goopnet-interface/meta.nix | 2 +- modules/core/default.nix | 10 +- modules/core/kernel.nix | 2 +- modules/core/nix.nix | 5 +- modules/software/tools/wine.nix | 18 +++ packages/apple-silicon-firmware/default.nix | 30 +++++ packages/wallpapers/default.nix | 4 + 14 files changed, 148 insertions(+), 141 deletions(-) delete mode 100644 hosts/goopnet-interface/apple-macbook-air-9-1.nix create mode 100644 modules/software/tools/wine.nix create mode 100644 packages/apple-silicon-firmware/default.nix diff --git a/default.nix b/default.nix index 97efe5e..3493ddf 100755 --- a/default.nix +++ b/default.nix @@ -10,7 +10,6 @@ in { (mkAliasOptionModule ["hm"] ["home-manager" "users" config.user.name]) inputs.base16.nixosModule inputs.nix-index-database.nixosModules.default - inputs.t2fanrd.nixosModules.t2fanrd inputs.niri.nixosModules.niri ] ++ (mapModulesRec' (toString ./modules) import); diff --git a/flake.lock b/flake.lock index bad1b29..5eda5b7 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,24 @@ { "nodes": { + "asahi": { + "inputs": { + "flake-compat": "flake-compat", + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1780669925, + "narHash": "sha256-inOQx/s7GQjh9bcCjCHXAeX0EHX+sOQUBoo8+bs48ME=", + "owner": "nix-community", + "repo": "nixos-apple-silicon", + "rev": "5880026520a3fd248d59e1c81c4e4e111aefc6af", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixos-apple-silicon", + "type": "github" + } + }, "base16": { "inputs": { "fromYaml": "fromYaml" @@ -22,9 +41,9 @@ "inputs": { "cachyos-kernel": "cachyos-kernel_2", "cachyos-kernel-patches": "cachyos-kernel-patches", - "flake-compat": "flake-compat", + "flake-compat": "flake-compat_2", "flake-parts": "flake-parts", - "nixpkgs": "nixpkgs" + "nixpkgs": "nixpkgs_2" }, "locked": { "lastModified": 1776386586, @@ -75,7 +94,7 @@ }, "catppuccin": { "inputs": { - "nixpkgs": "nixpkgs_2" + "nixpkgs": "nixpkgs_3" }, "locked": { "lastModified": 1776420287, @@ -92,6 +111,21 @@ } }, "flake-compat": { + "locked": { + "lastModified": 1761640442, + "narHash": "sha256-AtrEP6Jmdvrqiv4x2xa5mrtaIp3OEe8uBYCDZDS+hu8=", + "owner": "nix-community", + "repo": "flake-compat", + "rev": "4a56054d8ffc173222d09dad23adf4ba946c8884", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-compat_2": { "flake": false, "locked": { "lastModified": 1767039857, @@ -107,7 +141,7 @@ "type": "github" } }, - "flake-compat_2": { + "flake-compat_3": { "flake": false, "locked": { "lastModified": 1767039857, @@ -329,7 +363,7 @@ "inputs": { "niri-stable": "niri-stable", "niri-unstable": "niri-unstable", - "nixpkgs": "nixpkgs_3", + "nixpkgs": "nixpkgs_4", "nixpkgs-stable": "nixpkgs-stable", "xwayland-satellite-stable": "xwayland-satellite-stable", "xwayland-satellite-unstable": "xwayland-satellite-unstable" @@ -404,7 +438,7 @@ }, "nix-vscode-extensions": { "inputs": { - "nixpkgs": "nixpkgs_4" + "nixpkgs": "nixpkgs_5" }, "locked": { "lastModified": 1777951761, @@ -422,16 +456,16 @@ }, "nixpkgs": { "locked": { - "lastModified": 1776311487, - "narHash": "sha256-9U8bL9X/0R9cZD3Uc/mN37AWvv5dB4WQqqjLRAxQfas=", + "lastModified": 1779560665, + "narHash": "sha256-tpyBcxPpcQb8ukyNF7DoCwfSY3VPsxHoYwj00Cayv5o=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "cc1e0e027707ad53dddae39d3b3e992262c7d8c7", + "rev": "64c08a7ca051951c8eae34e3e3cb1e202fe36786", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixos-unstable-small", + "ref": "nixos-unstable", "repo": "nixpkgs", "type": "github" } @@ -469,16 +503,16 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1776169885, - "narHash": "sha256-l/iNYDZ4bGOAFQY2q8y5OAfBBtrDAaPuRQqWaFHVRXM=", + "lastModified": 1776311487, + "narHash": "sha256-9U8bL9X/0R9cZD3Uc/mN37AWvv5dB4WQqqjLRAxQfas=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "4bd9165a9165d7b5e33ae57f3eecbcb28fb231c9", + "rev": "cc1e0e027707ad53dddae39d3b3e992262c7d8c7", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixos-unstable", + "ref": "nixos-unstable-small", "repo": "nixpkgs", "type": "github" } @@ -500,6 +534,22 @@ } }, "nixpkgs_4": { + "locked": { + "lastModified": 1776169885, + "narHash": "sha256-l/iNYDZ4bGOAFQY2q8y5OAfBBtrDAaPuRQqWaFHVRXM=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "4bd9165a9165d7b5e33ae57f3eecbcb28fb231c9", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_5": { "locked": { "lastModified": 1777207419, "narHash": "sha256-V3bmPWAajDiC+1ClDOp55gianW2EyRJSJOyu1RUQibc=", @@ -515,7 +565,7 @@ "type": "github" } }, - "nixpkgs_5": { + "nixpkgs_6": { "locked": { "lastModified": 1776169885, "narHash": "sha256-l/iNYDZ4bGOAFQY2q8y5OAfBBtrDAaPuRQqWaFHVRXM=", @@ -531,22 +581,6 @@ "type": "github" } }, - "nixpkgs_6": { - "locked": { - "lastModified": 1754214453, - "narHash": "sha256-Q/I2xJn/j1wpkGhWkQnm20nShYnG7TI99foDBpXm1SY=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "5b09dc45f24cf32316283e62aec81ffee3c3e376", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, "nixpkgs_7": { "locked": { "lastModified": 1772542754, @@ -565,6 +599,7 @@ }, "root": { "inputs": { + "asahi": "asahi", "base16": "base16", "cachyos-kernel": "cachyos-kernel", "catppuccin": "catppuccin", @@ -574,9 +609,8 @@ "niri": "niri", "nix-index-database": "nix-index-database", "nix-vscode-extensions": "nix-vscode-extensions", - "nixpkgs": "nixpkgs_5", + "nixpkgs": "nixpkgs_6", "systems": "systems_2", - "t2fanrd": "t2fanrd", "tt-schemes": "tt-schemes", "vicinae": "vicinae", "vicinae-extensions": "vicinae-extensions" @@ -642,24 +676,6 @@ "type": "github" } }, - "t2fanrd": { - "inputs": { - "nixpkgs": "nixpkgs_6" - }, - "locked": { - "lastModified": 1775302822, - "narHash": "sha256-QoK8SYoIc0d/PoRdIUo+fkDNAHZIP2+AJ6PDM9ehGiY=", - "owner": "gnomeddev", - "repo": "t2fanrd", - "rev": "5b1c0c10785b8e8dfe124a4d6aaa7c2becdac65c", - "type": "github" - }, - "original": { - "owner": "gnomeddev", - "repo": "t2fanrd", - "type": "github" - } - }, "tt-schemes": { "flake": false, "locked": { @@ -697,7 +713,7 @@ }, "vicinae-extensions": { "inputs": { - "flake-compat": "flake-compat_2", + "flake-compat": "flake-compat_3", "nixpkgs": [ "nixpkgs" ], diff --git a/flake.nix b/flake.nix index 9bc015d..8ac182a 100644 --- a/flake.nix +++ b/flake.nix @@ -15,9 +15,9 @@ nix-index-database.url = "github:nix-community/nix-index-database"; nix-index-database.inputs.nixpkgs.follows = "nixpkgs"; - cachyos-kernel.url = "github:xddxdd/nix-cachyos-kernel/release"; + asahi.url = "github:nix-community/nixos-apple-silicon"; - t2fanrd.url = "github:gnomeddev/t2fanrd"; + cachyos-kernel.url = "github:xddxdd/nix-cachyos-kernel/release"; niri.url = "github:sodiboo/niri-flake/pull/1731/head"; diff --git a/hosts/flubber-machine/default.nix b/hosts/flubber-machine/default.nix index d797e71..08532f4 100755 --- a/hosts/flubber-machine/default.nix +++ b/hosts/flubber-machine/default.nix @@ -19,9 +19,7 @@ # debug strace ltrace lsof crosspipe # apps - firefox qalculate-gtk krita inkscape onlyoffice-desktopeditors vlc nicotine-plus transmission_4-gtk font-manager obs-studio imhex pwvucontrol nautilus gnome-disk-utility gnome-text-editor baobab file-roller mission-center loupe gnome-weather kdePackages.kdenlive video-trimmer handbrake blanket blockbench - # compatibility - wineWow64Packages.waylandFull winetricks + firefox qalculate-gtk krita inkscape libreoffice-fresh vlc nicotine-plus transmission_4-gtk font-manager obs-studio imhex pwvucontrol nautilus gnome-disk-utility gnome-text-editor baobab file-roller mission-center loupe gnome-weather kdePackages.kdenlive video-trimmer handbrake blanket blockbench # misc bat file which packwiz yt-dlp fastfetch hyfetch trashy wev # games @@ -119,6 +117,7 @@ tools.git.enable = true; tools.gpg.enable = true; tools.rbw.enable = true; + tools.wine.enable = true; }; }; } diff --git a/hosts/goopnet-interface/apple-macbook-air-9-1.nix b/hosts/goopnet-interface/apple-macbook-air-9-1.nix deleted file mode 100644 index 112f7b4..0000000 --- a/hosts/goopnet-interface/apple-macbook-air-9-1.nix +++ /dev/null @@ -1,58 +0,0 @@ -{ pkgs, lib, ... }: -{ - # support power features such as suspend to ram - powerManagement.enable = true; - # tune power saving options on boot - powerManagement.powertop.enable = true; - # thermald proactively prevents overheating on intel CPUs and works well with other tools - services.thermald.enable = true; - # power-profile-daemon for power management - services.power-profiles-daemon.enable = true; - # manage fans for macbook devices - # see: https://github.com/GnomedDev/T2FanRD/blob/5b1c0c10785b8e8dfe124a4d6aaa7c2becdac65c/src/config.rs#L62 - services.mbpfan.enable = false; - services.t2fanrd.enable = true; - services.t2fanrd.config.Fan1 = { - low_temp = 55; - high_temp = 75; - speed_curve = "linear"; - always_full_speed = false; - }; - - # replace basic t2 kernel with cachyos kernel - # same patches and i trust it to be more up to date (one time the "latest" was EOL for t2,,,) - # also interesting how this supports l4 but my big computer doesn't... - boot.kernelPackages = lib.mkForce pkgs.cachyosKernels.linuxPackages-cachyos-latest-lto-x86_64-v4; - - # fix wifi firmware - hardware.apple-t2.firmware.enable = true; - - # fix sleep/suspend - # ty https://github.com/3ulalia/flake/blob/aaddbef19979c6d952f7a763cd9e6225d6330a02/hosts/catalina/default.nix - systemd.services."suspend-fix-t2" = { - enable = true; - unitConfig = { - Description = "Disable and Re-Enable Apple BCE Module (and Wi-Fi)"; - Before = "sleep.target"; - StopWhenUnneeded = "yes"; - }; - serviceConfig = { - User = "root"; - Type = "oneshot"; - RemainAfterExit = "yes"; - ExecStart = [ - "/run/current-system/sw/bin/modprobe -r brcmfmac_wcc" - "/run/current-system/sw/bin/modprobe -r brcmfmac" - "/run/current-system/sw/bin/modprobe -r hci_bcm4377" - "/run/current-system/sw/bin/rmmod -f apple-bce" - ]; - ExecStop = [ - "/run/current-system/sw/bin/modprobe apple-bce" - "/run/current-system/sw/bin/modprobe hci_bcm4377" - "/run/current-system/sw/bin/modprobe brcmfmac" - "/run/current-system/sw/bin/modprobe brmcfmac_wcc" - ]; - }; - wantedBy = ["sleep.target"]; - }; -} diff --git a/hosts/goopnet-interface/default.nix b/hosts/goopnet-interface/default.nix index b391469..17bdd90 100755 --- a/hosts/goopnet-interface/default.nix +++ b/hosts/goopnet-interface/default.nix @@ -19,9 +19,7 @@ # debug strace ltrace lsof crosspipe # apps - firefox qalculate-gtk krita inkscape onlyoffice-desktopeditors vlc nicotine-plus transmission_4-gtk font-manager obs-studio imhex pwvucontrol nautilus gnome-disk-utility gnome-text-editor baobab file-roller mission-center loupe gnome-weather kdePackages.kdenlive video-trimmer handbrake blanket blockbench - # compatibility - wineWow64Packages.waylandFull winetricks + firefox qalculate-gtk krita inkscape libreoffice-fresh vlc nicotine-plus transmission_4-gtk font-manager obs-studio imhex pwvucontrol nautilus gnome-disk-utility gnome-text-editor baobab file-roller mission-center loupe gnome-weather kdePackages.kdenlive video-trimmer handbrake blanket blockbench # misc bat file which packwiz yt-dlp fastfetch hyfetch trashy wev # games @@ -99,7 +97,6 @@ # distractions distractions.discord.enable = true; distractions.discord.vesktop = true; - distractions.steam.enable = true; # tools tools.direnv.enable = true; tools.easyeffects.enable = true; diff --git a/hosts/goopnet-interface/hardware.nix b/hosts/goopnet-interface/hardware.nix index 6506d93..5d37267 100755 --- a/hosts/goopnet-interface/hardware.nix +++ b/hosts/goopnet-interface/hardware.nix @@ -3,27 +3,26 @@ { imports = [ - inputs.hardware.nixosModules.apple-t2 - (inputs.hardware + "/common/cpu/intel/ice-lake") - (inputs.hardware + "/common/gpu/intel/ice-lake") + inputs.asahi.nixosModules.apple-silicon-support inputs.hardware.nixosModules.common-pc-laptop-ssd inputs.hardware.nixosModules.common-pc-laptop (modulesPath + "/installer/scan/not-detected.nix") - - ./apple-macbook-air-9-1.nix ]; boot.initrd.availableKernelModules = [ "xhci_pci" "ehci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" "sdhci_pci" ]; boot.initrd.kernelModules = [ ]; - boot.kernelModules = [ "kvm-intel" ]; + boot.kernelModules = [ ]; boot.extraModulePackages = [ ]; boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; + boot.loader.efi.canTouchEfiVariables = false; + + # this makes wi-fi and stuff like that work + # of course, as usual, this is broadcom to blame. Thanks! + hardware.asahi.peripheralFirmwareDirectory = "${pkgs.my.apple-silicon-firmware}/firmware"; modules.hardware = { - graphics.i915.enable = true; audio.enable = true; bluetooth.enable = true; networking.enable = true; @@ -32,19 +31,19 @@ }; fileSystems."/" = - { device = "/dev/disk/by-uuid/0f09afdc-88e4-4764-818b-77828931278f"; - fsType = "ext4"; + { device = "/dev/disk/by-uuid/be826617-c861-48a2-b135-87138c3d2c1a"; + fsType = "btrfs"; options = [ "noatime" ]; }; fileSystems."/boot" = - { device = "/dev/disk/by-uuid/5659-4909"; + { device = "/dev/disk/by-uuid/BD6E-1D12"; fsType = "vfat"; options = [ "fmask=0022" "dmask=0022" ]; }; swapDevices = - [ { device = "/dev/disk/by-uuid/f54a2257-f498-4ca0-82af-58f31705cce7"; } + [ { device = "/dev/disk/by-uuid/26ebd42b-1dd4-4f4e-935c-b5f9555562dd"; } ]; # Enables DHCP on each ethernet and wireless interface. In case of scripted networking @@ -54,6 +53,4 @@ networking.useDHCP = lib.mkDefault true; # networking.interfaces.end0.useDHCP = lib.mkDefault true; # networking.interfaces.wlan0.useDHCP = lib.mkDefault true; - - hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; } diff --git a/hosts/goopnet-interface/meta.nix b/hosts/goopnet-interface/meta.nix index efab059..38187ab 100644 --- a/hosts/goopnet-interface/meta.nix +++ b/hosts/goopnet-interface/meta.nix @@ -1,3 +1,3 @@ { - system = "x86_64-linux"; + system = "aarch64-linux"; } diff --git a/modules/core/default.nix b/modules/core/default.nix index 2110716..a2beae0 100644 --- a/modules/core/default.nix +++ b/modules/core/default.nix @@ -8,7 +8,11 @@ in { laptop = mkEnableOption "Enable laptop specific tweaks"; }; - config = { - # TODO: add something here loooool - }; + config = mkMerge [ + (mkIf cfg.laptop { + # services that help w/ battery saving + powerManagement.powertop.enable = true; + services.power-profiles-daemon.enable = true; + }) + ]; } diff --git a/modules/core/kernel.nix b/modules/core/kernel.nix index 13e85ff..c445198 100644 --- a/modules/core/kernel.nix +++ b/modules/core/kernel.nix @@ -23,7 +23,7 @@ in { ]; }) (mkIf cfg.v4l2 { - boot.kernelModules = ["v4l2loopback"]; + boot.kernelModules = [ "v4l2loopback" ]; boot.extraModulePackages = with config.boot.kernelPackages; [ v4l2loopback ]; }) ]; diff --git a/modules/core/nix.nix b/modules/core/nix.nix index 71f8164..c2e897b 100644 --- a/modules/core/nix.nix +++ b/modules/core/nix.nix @@ -1,4 +1,5 @@ { lib, pkgs, inputs, config, ... }: + let gcConfig = { automatic = true; @@ -31,7 +32,7 @@ in { "https://niri.cachix.org" "https://vicinae.cachix.org" "https://cache.garnix.io" - # "https://cache.soopy.moe" + "https://nixos-apple-silicon.cachix.org" ]; trusted-public-keys = [ "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" @@ -40,7 +41,7 @@ in { "niri.cachix.org-1:Wv0OmO7PsuocRKzfDoJ3mulSl7Z6oezYhGhR+3W2964=" "vicinae.cachix.org-1:1kDrfienkGHPYbkpNj1mWTr7Fm1+zcenzgTizIcI3oc=" "cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g=" - # "cache.soopy.moe-1:0RZVsQeR+GOh0VQI9rvnHz55nVXkFardDqfm4+afjPo=" + "nixos-apple-silicon.cachix.org-1:8psDu5SA5dAD7qA0zMy5UT292TxeEPzIz8VVEr2Js20=" ]; }; }; diff --git a/modules/software/tools/wine.nix b/modules/software/tools/wine.nix new file mode 100644 index 0000000..bab32f9 --- /dev/null +++ b/modules/software/tools/wine.nix @@ -0,0 +1,18 @@ +{ lib, config, ... }: + +with lib; +let + cfg = config.modules.software.tools.wine; +in { + options.modules.software.tools.wine = { + enable = mkEnableOption "Enable wine, a compatibility layer to run Windows applications on Linux"; + }; + + config = mkIf cfg.enable { + hm.home.packages = with pkgs; [ wineWow64Packages.waylandFull winetricks ]; + + # enable windows NT sync primitive driver (semaphores, mutexes, etc.) + # improves performance on wine 11+ and proton 11+ + boot.kernelModules = [ "ntsync" ]; + }; +} diff --git a/packages/apple-silicon-firmware/default.nix b/packages/apple-silicon-firmware/default.nix new file mode 100644 index 0000000..74ecb45 --- /dev/null +++ b/packages/apple-silicon-firmware/default.nix @@ -0,0 +1,30 @@ +{ lib, stdenvNoCC, fetchFromGitHub }: + +stdenvNoCC.mkDerivation { + pname = "apple-firmware"; + version = "1.0.0"; + + src = fetchFromGitHub { + owner = "binary-star-systems"; + repo = "apple-firmware"; + rev = "72b625c4b160444def3d9f4a9c0c4704cc1a6e60"; + hash = "sha256-h1kseeQnL2I7933fsSUVMjCzZgkAgiGpJVxM60qse5Q="; + }; + + installPhase = '' + runHook preInstall + + mkdir -p "$out/firmware" + cp -r "$src/firmware/." "$out/firmware/" + + runHook postInstall + ''; + + meta = with lib; { + description = "Apple firmware used in m-series (apple silicon) based computers"; + homepage = "https://github.com/binary-star-systems/apple-firmware"; + # idk what to put here: + # license = licenses.ofl; + platforms = [ "aarch64-linux" ]; + }; +} diff --git a/packages/wallpapers/default.nix b/packages/wallpapers/default.nix index bed0644..50ada44 100644 --- a/packages/wallpapers/default.nix +++ b/packages/wallpapers/default.nix @@ -9,8 +9,12 @@ stdenvNoCC.mkDerivation { # later, add XML files to /usr(?)/share/backgrounds # then, it is selectable from places like in gnome and also do the same for KDE installPhase = '' + runHook preInstall + mkdir -p "$out/share/backgrounds" cp -r "$src/img/." "$out/share/backgrounds/" + + runHook postInstall ''; meta = with lib; {