From b4020d43160155661edceeb7099bdbb6909f5649 Mon Sep 17 00:00:00 2001 From: Toast Date: Sun, 14 Jan 2024 01:11:19 +0100 Subject: [PATCH] Flake: apply patch to nixpkgs-unstable This feels really dirty, but it works and it's less effort that switching to something like flake-utils that can do this for you --- flake.lock | 29 +++++++++++++++++++++-------- flake.nix | 42 +++++++++++++++++++++++++++++------------- 2 files changed, 50 insertions(+), 21 deletions(-) diff --git a/flake.lock b/flake.lock index d3c6b94..40c3bb1 100644 --- a/flake.lock +++ b/flake.lock @@ -26,7 +26,7 @@ "catppuccin-vsc": { "inputs": { "nixpkgs": [ - "nixpkgs-unstable" + "nixpkgs-unstable-raw" ] }, "locked": { @@ -101,7 +101,7 @@ "home-manager-unstable": { "inputs": { "nixpkgs": [ - "nixpkgs-unstable" + "nixpkgs-unstable-raw" ] }, "locked": { @@ -143,7 +143,7 @@ "inputs": { "nix-github-actions": "nix-github-actions", "nixpkgs": [ - "nixpkgs-unstable" + "nixpkgs-unstable-raw" ] }, "locked": { @@ -236,7 +236,7 @@ "nix-index-db-unstable": { "inputs": { "nixpkgs": [ - "nixpkgs-unstable" + "nixpkgs-unstable-raw" ] }, "locked": { @@ -284,7 +284,19 @@ "type": "indirect" } }, - "nixpkgs-unstable": { + "nixpkgs-pr280779": { + "flake": false, + "locked": { + "narHash": "sha256-eP6JaUafbs7ulve2jOsidJKM28bKzcLgoQ4WKXN1k4I=", + "type": "file", + "url": "https://github.com/NixOS/nixpkgs/pull/280779.patch" + }, + "original": { + "type": "file", + "url": "https://github.com/NixOS/nixpkgs/pull/280779.patch" + } + }, + "nixpkgs-unstable-raw": { "locked": { "lastModified": 1704722960, "narHash": "sha256-mKGJ3sPsT6//s+Knglai5YflJUF2DGj7Ai6Ynopz0kI=", @@ -305,7 +317,7 @@ "home-manager-unstable" ], "nixpkgs": [ - "nixpkgs-unstable" + "nixpkgs-unstable-raw" ] }, "locked": { @@ -335,7 +347,8 @@ "nix-index-db-unstable": "nix-index-db-unstable", "nixos-hardware": "nixos-hardware", "nixpkgs": "nixpkgs", - "nixpkgs-unstable": "nixpkgs-unstable", + "nixpkgs-pr280779": "nixpkgs-pr280779", + "nixpkgs-unstable-raw": "nixpkgs-unstable-raw", "plasma-manager": "plasma-manager", "vscode-extensions": "vscode-extensions" } @@ -375,7 +388,7 @@ "flake-compat": "flake-compat", "flake-utils": "flake-utils", "nixpkgs": [ - "nixpkgs-unstable" + "nixpkgs-unstable-raw" ] }, "locked": { diff --git a/flake.nix b/flake.nix index 75ab5e1..a7cdc98 100755 --- a/flake.nix +++ b/flake.nix @@ -3,7 +3,12 @@ inputs = { nixpkgs.url = "nixpkgs/nixos-23.11"; - nixpkgs-unstable.url = "nixpkgs/nixos-unstable"; + nixpkgs-unstable-raw.url = "nixpkgs/nixos-unstable"; + + nixpkgs-pr280779 = { + url = "file+https://github.com/NixOS/nixpkgs/pull/280779.patch"; + flake = false; + }; agenix = { url = "github:ryantm/agenix"; @@ -20,14 +25,14 @@ home-manager-unstable = { url = "github:nix-community/home-manager/"; - inputs.nixpkgs.follows = "nixpkgs-unstable"; + inputs.nixpkgs.follows = "nixpkgs-unstable-raw"; }; nixos-hardware.url = "github:NixOS/nixos-hardware/master"; jovian = { url = "github:Jovian-Experiments/Jovian-NixOS"; - inputs.nixpkgs.follows = "nixpkgs-unstable"; + inputs.nixpkgs.follows = "nixpkgs-unstable-raw"; }; nix-impermanence.url = "github:nix-community/impermanence"; @@ -43,30 +48,41 @@ nix-index-db-unstable = { url = "github:Mic92/nix-index-database"; - inputs.nixpkgs.follows = "nixpkgs-unstable"; + inputs.nixpkgs.follows = "nixpkgs-unstable-raw"; }; plasma-manager = { url = "github:pjones/plasma-manager"; - inputs.nixpkgs.follows = "nixpkgs-unstable"; + inputs.nixpkgs.follows = "nixpkgs-unstable-raw"; inputs.home-manager.follows = "home-manager-unstable"; }; catppuccin-vsc = { url = "github:catppuccin/vscode"; - inputs.nixpkgs.follows = "nixpkgs-unstable"; + inputs.nixpkgs.follows = "nixpkgs-unstable-raw"; }; vscode-extensions = { url = "github:nix-community/nix-vscode-extensions"; - inputs.nixpkgs.follows = "nixpkgs-unstable"; + inputs.nixpkgs.follows = "nixpkgs-unstable-raw"; }; nix-flatpak.url = github:gmodena/nix-flatpak/main; }; - outputs = { ... } @inputs: with inputs; { - + outputs = { ... } @inputs: with inputs; + # Patch nixpkgs + # https://ertt.ca/nix/patch-nixpkgs/ + let + nixpkgs-unstable-patched = nixpkgs.legacyPackages.x86_64-linux.applyPatches { + name = "patched-nixpkgs-unstable"; + src = nixpkgs-unstable-raw; + patches = [ nixpkgs-pr280779 ]; + }; + # https://discourse.nixos.org/t/proper-way-of-applying-patch-to-system-managed-via-flake/21073/26 + nixpkgs-unstable = (import "${nixpkgs-unstable-patched}/flake.nix").outputs { self = inputs.self; }; + in + { devShells.x86_64-linux.default = nixpkgs.legacyPackages.x86_64-linux.mkShell { name = "Environment for toast's nixos configurations"; # The agenix cli is not needed to activate a configuration, so instead of installing it @@ -82,7 +98,7 @@ ''; }; packages = { - x86_64-linux = with import nixpkgs-unstable { system = "x86_64-linux"; }; { + x86_64-linux = with import nixpkgs-unstable-raw { system = "x86_64-linux"; }; { pseint = callPackage ./pkgs/pseint.nix {}; anything-sync-daemon = callPackage ./pkgs/anything-sync-daemon {}; discord-krisp-fixer = callPackage ./pkgs/discord-krisp-fixer {}; @@ -91,7 +107,7 @@ nixosConfigurations = { Archie = nixpkgs-unstable.lib.nixosSystem { system = "x86_64-linux"; - specialArgs = { systemPkgs = inputs.nixpkgs-unstable; flakeSelf = self; }; + specialArgs = { systemPkgs = inputs.nixpkgs-unstable-raw; flakeSelf = self; }; /* I used to set up nixpkgs in the flake, but doing that made defining overlays in modules impossible (or at least I could @@ -113,7 +129,7 @@ SurfaceGo = nixpkgs-unstable.lib.nixosSystem { system = "x86_64-linux"; - specialArgs = { systemPkgs = inputs.nixpkgs-unstable; flakeSelf = self; }; + specialArgs = { systemPkgs = inputs.nixpkgs-unstable-raw; flakeSelf = self; }; modules = [ agenix.nixosModules.default home-manager-unstable.nixosModule @@ -128,7 +144,7 @@ SteamDeck = nixpkgs-unstable.lib.nixosSystem { system = "x86_64-linux"; - specialArgs = { systemPkgs = inputs.nixpkgs-unstable; flakeSelf = self; }; + specialArgs = { systemPkgs = inputs.nixpkgs-unstable-raw; flakeSelf = self; }; modules = [ agenix.nixosModules.default jovian.nixosModules.default