lol

callCabal2nix: Fix calling with a path in the store.

+24 -2
+1 -1
lib/default.nix
··· 93 93 hiPrioSet; 94 94 inherit (sources) pathType pathIsDirectory cleanSourceFilter 95 95 cleanSource sourceByRegex sourceFilesBySuffices 96 - commitIdFromGitRepo cleanSourceWith; 96 + commitIdFromGitRepo cleanSourceWith pathHasContext canCleanSource; 97 97 inherit (modules) evalModules closeModules unifyModuleSyntax 98 98 applyIfFunction unpackSubmodule packSubmodule mergeModules 99 99 mergeModules' mergeOptionDecls evalOptionValue mergeDefinitions
+4
lib/sources.nix
··· 93 93 else lib.head matchRef 94 94 else throw ("Not a .git directory: " + path); 95 95 in lib.flip readCommitFromFile "HEAD"; 96 + 97 + pathHasContext = builtins.hasContext or (lib.hasPrefix builtins.storeDir); 98 + 99 + canCleanSource = src: src ? _isLibCleanSourceWith || !(pathHasContext (toString src)); 96 100 }
+14
pkgs/build-support/safe-discard-string-context.nix
··· 1 + # | Discard the context of a string while ensuring that expected path 2 + # validity invariants hold. 3 + # 4 + # This relies on import-from-derivation, but it is only useful in 5 + # contexts where the string is going to be used in an 6 + # import-from-derivation anyway. 7 + # 8 + # safeDiscardStringContext : String → String 9 + { writeText }: s: 10 + builtins.seq 11 + (import (writeText 12 + "discard.nix" 13 + "${builtins.substring 0 0 s}null\n")) 14 + (builtins.unsafeDiscardStringContext s)
+3 -1
pkgs/development/haskell-modules/make-package-set.nix
··· 146 146 overrideCabal (self.callPackage (haskellSrc2nix { 147 147 inherit name; 148 148 src = pkgs.lib.cleanSourceWith 149 - { inherit src; 149 + { src = if pkgs.lib.canCleanSource src 150 + then src 151 + else pkgs.safeDiscardStringContext src; 150 152 filter = path: type: 151 153 pkgs.lib.hasSuffix "${name}.cabal" path || 152 154 pkgs.lib.hasSuffix "package.yaml" path;
+2
pkgs/top-level/all-packages.nix
··· 20237 20237 wal-g = callPackage ../tools/backup/wal-g {}; 20238 20238 20239 20239 tlwg = callPackage ../data/fonts/tlwg { }; 20240 + 20241 + safeDiscardStringContext = callPackage ../build-support/safe-discard-string-context.nix { }; 20240 20242 }