diff --git a/flake.nix b/flake.nix index e632778b..b909383e 100644 --- a/flake.nix +++ b/flake.nix @@ -211,11 +211,8 @@ (flake-utils.lib.eachDefaultSystem ( system: let - pkgs = import nixpkgs { - inherit system; - config.allowUnfree = true; - overlays = [ self.overlays.default ]; - }; + n = import ./patches { inherit self nixpkgs system; }; + inherit (n) pkgs; in { devShells.default = pkgs.mkShell { diff --git a/lib/flake-helpers.nix b/lib/flake-helpers.nix index bcc8c02f..a9f9bdd3 100644 --- a/lib/flake-helpers.nix +++ b/lib/flake-helpers.nix @@ -70,7 +70,7 @@ in }: let inherit (self.outputs.nixosConfigurations.${hostname}) config; - n = import ../patches { inherit nixpkgs system; }; + n = import ../patches { inherit self nixpkgs system; }; nixosSystem = if n.patched then import (n.nixpkgs + "/nixos/lib/eval-config.nix") else n.nixpkgs.lib.nixosSystem; @@ -109,14 +109,18 @@ in mkNixDarwinConfig = { hostname, + system ? "aarch64-darwin", nix-darwin ? inputs.nix-darwin, + nixpkgs ? inputs.nixpkgs, extraModules ? [ ], }: let - inherit (self.outputs.darwinConfigurations.${hostname}) pkgs; + n = import ../patches { inherit self nixpkgs system; }; + inherit (n) pkgs; in { darwinConfigurations.${hostname} = nix-darwin.lib.darwinSystem { + inherit pkgs system; modules = [ ( { lib, ... }: @@ -154,6 +158,7 @@ in deviceType ? "desktop", extraModules ? [ ], system ? "x86_64-linux", + nixpkgs ? inputs.nixpkgs, home-manager ? inputs.home-manager, # This value determines the Home Manager release that your # configuration is compatible with. This helps avoid breakage @@ -165,9 +170,12 @@ in # changes in each release. stateVersion ? "24.05", }: + let + n = import ../patches { inherit self nixpkgs system; }; + in { homeConfigurations.${hostname} = home-manager.lib.homeManagerConfiguration { - pkgs = self.outputs.legacyPackages.${system}; + inherit (n) pkgs; modules = [ ( { ... }: diff --git a/patches/default.nix b/patches/default.nix index a154e48e..1c567f47 100644 --- a/patches/default.nix +++ b/patches/default.nix @@ -1,6 +1,16 @@ -{ nixpkgs, system, ... }: +{ + self, + nixpkgs, + system, + ... +}: let - inherit (nixpkgs.legacyPackages.${system}) applyPatches callPackage; + pkgs = import nixpkgs { + inherit system; + config.allowUnfree = true; + overlays = [ self.overlays.default ]; + }; + inherit (pkgs) applyPatches callPackage; patches = callPackage ./patches.nix { }; nixpkgs' = applyPatches { inherit patches; @@ -12,9 +22,14 @@ if patches != [ ] then { patched = true; nixpkgs = nixpkgs'; + pkgs = import nixpkgs' { + inherit system; + config.allowUnfree = true; + overlays = [ self.overlays.default ]; + }; } else { patched = false; - inherit nixpkgs; + inherit nixpkgs pkgs; }