From 9bc651db423bbc81ddb8e89be74378a42e479aa9 Mon Sep 17 00:00:00 2001 From: Tom Hubrecht Date: Tue, 8 Oct 2024 20:49:26 +0200 Subject: [PATCH] chore(nix-patches): Add helper function --- hive.nix | 6 ++---- lib/nix-patches/default.nix | 11 ++++------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/hive.nix b/hive.nix index de7b83a..3835df9 100644 --- a/hive.nix +++ b/hive.nix @@ -2,10 +2,8 @@ let sources' = import ./npins; # Patch sources directly - sources = builtins.mapAttrs ( - name: src: - (patch.base { pkgs = import sources'.nixos-unstable { }; }).applyPatches { inherit name src; } - ) sources'; + sources = builtins.mapAttrs (patch.base { pkgs = import sources'.nixos-unstable { }; }) + .applyPatches' sources'; lib = import (sources.nix-lib + "/src/trivial.nix"); diff --git a/lib/nix-patches/default.nix b/lib/nix-patches/default.nix index 6e03f83..887fe6b 100644 --- a/lib/nix-patches/default.nix +++ b/lib/nix-patches/default.nix @@ -37,20 +37,15 @@ rec { base = { pkgs }: - - let - inherit (pkgs.lib) fakeHash optionalAttrs; - in - rec { mkUrlPatch = attrs: pkgs.fetchpatch ( { - hash = fakeHash; + hash = pkgs.lib.fakeHash; } // attrs - // (optionalAttrs (excludeGitHubManual && !(builtins.hasAttr "includes" attrs)) { + // (pkgs.lib.optionalAttrs (excludeGitHubManual && !(builtins.hasAttr "includes" attrs)) { excludes = (attrs.excludes or [ ]) ++ [ "nixos/doc/manual/*" ]; }) ); @@ -107,6 +102,8 @@ rec { name = "${name}-patched"; }; + + applyPatches' = name: src: applyPatches { inherit name src; }; }; mkNixpkgsSrc = { src, name }: (base { pkgs = import src { }; }).applyPatches { inherit src name; };