From a31f6cdcee0aac9889c04de18880c1ea215260c0 Mon Sep 17 00:00:00 2001 From: ulic-youthlic Date: Fri, 20 Feb 2026 12:23:35 +0800 Subject: [PATCH] feat: Add nixpkgs-patcher for patch nixpkgs --- flake.lock | 98 ++++++++++++++++++++-------- flake.nix | 25 +++---- flake/nixos.nix | 3 +- flake/perSystem.nix | 6 +- overlays/modifications/default.nix | 2 - overlays/modifications/fix-rqbit.nix | 5 -- 6 files changed, 85 insertions(+), 54 deletions(-) delete mode 100644 overlays/modifications/fix-rqbit.nix diff --git a/flake.lock b/flake.lock index 73482b8..6ce0484 100644 --- a/flake.lock +++ b/flake.lock @@ -112,9 +112,7 @@ "nixpkgs": [ "nixpkgs" ], - "utils": [ - "flake-utils" - ] + "utils": "utils" }, "locked": { "lastModified": 1770019181, @@ -380,7 +378,7 @@ }, "flake-utils": { "inputs": { - "systems": "systems_2" + "systems": "systems_3" }, "locked": { "lastModified": 1731533236, @@ -398,7 +396,7 @@ }, "flake-utils_2": { "inputs": { - "systems": "systems_4" + "systems": "systems_5" }, "locked": { "lastModified": 1731533236, @@ -579,9 +577,7 @@ }, "lix-module": { "inputs": { - "flake-utils": [ - "flake-utils" - ], + "flake-utils": "flake-utils", "flakey-profile": "flakey-profile", "lix": "lix", "nixpkgs": [ @@ -704,7 +700,7 @@ "nixpkgs": [ "nixpkgs" ], - "systems": "systems_3" + "systems": "systems_4" }, "locked": { "lastModified": 1771059089, @@ -795,22 +791,6 @@ "type": "github" } }, - "nixpkgs-485603": { - "locked": { - "lastModified": 1769860058, - "narHash": "sha256-xiC+Y8ylTYFhY2KaGs1p/bSinsBHQ42nrjsFDn9EajQ=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "b9c50b93fcf500dbd398ddc84829f6751b97fb47", - "type": "github" - }, - "original": { - "owner": "nixos", - "ref": "refs/pull/485603/head", - "repo": "nixpkgs", - "type": "github" - } - }, "nixpkgs-lib": { "locked": { "lastModified": 1769909678, @@ -826,6 +806,33 @@ "type": "github" } }, + "nixpkgs-patch-rqbit-bump": { + "flake": false, + "locked": { + "narHash": "sha256-BZRSSNDskFySuJ0L2W/FRlHFeaaOZBrwbhXgYn8KbeY=", + "type": "file", + "url": "https://github.com/nixos/nixpkgs/pull/485603.diff" + }, + "original": { + "type": "file", + "url": "https://github.com/nixos/nixpkgs/pull/485603.diff" + } + }, + "nixpkgs-patcher": { + "locked": { + "lastModified": 1769207991, + "narHash": "sha256-SwGLSB3H/Lq2gPa2/yCtmcUn8E/fVuPtZ5qnjrDj62s=", + "owner": "gepbird", + "repo": "nixpkgs-patcher", + "rev": "2e59a7b94478f67e3ac2b221f737fe75c2175edc", + "type": "github" + }, + "original": { + "owner": "gepbird", + "repo": "nixpkgs-patcher", + "type": "github" + } + }, "nixpkgs-stable": { "locked": { "lastModified": 1767313136, @@ -990,7 +997,7 @@ "inputs": { "flake-parts": "flake-parts_5", "nixpkgs": "nixpkgs_7", - "systems": "systems_5" + "systems": "systems_6" }, "locked": { "lastModified": 1771023756, @@ -1116,7 +1123,6 @@ "disko": "disko", "emacs-overlay": "emacs-overlay", "flake-parts": "flake-parts_2", - "flake-utils": "flake-utils", "helix": "helix", "home-manager": "home-manager", "lanzaboote": "lanzaboote", @@ -1128,7 +1134,8 @@ "nix4nvchad": "nix4nvchad", "nixos-hardware": "nixos-hardware", "nixpkgs": "nixpkgs_6", - "nixpkgs-485603": "nixpkgs-485603", + "nixpkgs-patch-rqbit-bump": "nixpkgs-patch-rqbit-bump", + "nixpkgs-patcher": "nixpkgs-patcher", "nixvim": "nixvim", "noctalia": "noctalia", "nur": "nur", @@ -1233,7 +1240,7 @@ "nixpkgs" ], "nur": "nur_2", - "systems": "systems_6", + "systems": "systems_7", "tinted-foot": "tinted-foot", "tinted-kitty": "tinted-kitty", "tinted-schemes": "tinted-schemes", @@ -1344,6 +1351,21 @@ "type": "github" } }, + "systems_7": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "tinted-foot": { "flake": false, "locked": { @@ -1443,6 +1465,24 @@ "type": "github" } }, + "utils": { + "inputs": { + "systems": "systems_2" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "xwayland-satellite-stable": { "flake": false, "locked": { diff --git a/flake.nix b/flake.nix index cc15964..dbbd394 100644 --- a/flake.nix +++ b/flake.nix @@ -3,14 +3,14 @@ outputs = { flake-parts, - flake-utils, home-manager, treefmt-nix, nixpkgs, + nixpkgs-patcher, ... } @ inputs: let nixpkgs-lib = nixpkgs.lib; - lib = nixpkgs-lib.extend (import ./lib); + lib = nixpkgs-lib.extend (final: prev: nixpkgs-lib.recursiveUpdate {nixpkgs-patcher = nixpkgs-patcher.lib;} (import ./lib final prev)); in flake-parts.lib.mkFlake { @@ -22,7 +22,7 @@ } ( {lib, ...}: { - systems = flake-utils.lib.defaultSystems; + systems = ["x86_64-linux"]; imports = [ home-manager.flakeModules.home-manager @@ -51,11 +51,14 @@ # nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable-small"; # nixpkgs.url = "github:NixOS/nixpkgs/master"; ## update rqbit - nixpkgs-485603 = { + nixpkgs-patch-rqbit-bump = { + url = "https://github.com/nixos/nixpkgs/pull/485603.diff"; + flake = false; + }; + nixpkgs-patcher = { type = "github"; - owner = "nixos"; - repo = "nixpkgs"; - ref = "refs/pull/485603/head"; + owner = "gepbird"; + repo = "nixpkgs-patcher"; }; lix-module = { @@ -63,7 +66,6 @@ # url = "git+https://git.lix.systems/lix-project/nixos-module"; inputs = { nixpkgs.follows = "nixpkgs"; - flake-utils.follows = "flake-utils"; }; }; @@ -124,12 +126,6 @@ inputs."nixpkgs-lib".follows = "nixpkgs"; }; - flake-utils = { - type = "github"; - owner = "numtide"; - repo = "flake-utils"; - }; - sops-nix = { type = "github"; owner = "Mic92"; @@ -164,7 +160,6 @@ repo = "deploy-rs"; inputs = { nixpkgs.follows = "nixpkgs"; - utils.follows = "flake-utils"; }; }; diff --git a/flake/nixos.nix b/flake/nixos.nix index 092191a..29b70d7 100644 --- a/flake/nixos.nix +++ b/flake/nixos.nix @@ -14,7 +14,8 @@ in { }; nixosConfigurations = let makeNixosConfiguration = hostName: - lib.nixosSystem { + lib.nixpkgs-patcher.nixosSystem { + nixpkgsPatcher.inputs = inputs; modules = [(rootPath + "/nixos/configurations/${hostName}")]; specialArgs = { inherit diff --git a/flake/perSystem.nix b/flake/perSystem.nix index 7d2c42a..3134e47 100644 --- a/flake/perSystem.nix +++ b/flake/perSystem.nix @@ -14,9 +14,11 @@ inputs', ... }: let - inherit (inputs) nixpkgs; + patchedNixpkgs = lib.nixpkgs-patcher.patchNixpkgs { + inherit system inputs; + }; in { - _module.args.pkgs = import nixpkgs { + _module.args.pkgs = import patchedNixpkgs { localSystem = {inherit system;}; config = { allowUnfree = true; diff --git a/overlays/modifications/default.nix b/overlays/modifications/default.nix index 2cccd38..55bcd91 100644 --- a/overlays/modifications/default.nix +++ b/overlays/modifications/default.nix @@ -16,8 +16,6 @@ in ./vim.nix ./prismlauncher.nix - ./fix-rqbit.nix - # Nur ./nur.nix ] diff --git a/overlays/modifications/fix-rqbit.nix b/overlays/modifications/fix-rqbit.nix deleted file mode 100644 index 266f515..0000000 --- a/overlays/modifications/fix-rqbit.nix +++ /dev/null @@ -1,5 +0,0 @@ -{inputs, ...}: _final: prev: let - inherit (prev.stdenv.hostPlatform) system; -in { - rqbit = inputs.nixpkgs-485603.legacyPackages.${system}.rqbit; -}