Skip to content

Commit 6271604

Browse files
authored
Merge pull request #1 from avieth/avieth/misc-patches
Bring `avieth/misc-patches` into `MercuryTechnologies/ours`
2 parents 986a65b + 37c7bf9 commit 6271604

File tree

4 files changed

+19
-6
lines changed

4 files changed

+19
-6
lines changed

lib/cabal-project-parser.nix

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ let
8484
subdirs = if repo ? subdir
8585
then pkgs.lib.filter (x: x != "") (pkgs.lib.splitString " " repo.subdir)
8686
else ["."];
87+
# All repos served via ssh or git protocols are usually private
88+
is-private = pkgs.lib.substring 0 4 repo.location != "http";
8789
};
8890

8991
# Parse a source-repository-package and return data of `type: git` repositories

lib/call-cabal-project-to-nix.nix

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -227,13 +227,21 @@ let
227227
(if inputMap.${repoData.url}.rev != repoData.ref
228228
then throw "${inputMap.${repoData.url}.rev} may not match ${repoData.ref} for ${repoData.url} use \"${repoData.url}/${repoData.ref}\" as the inputMap key if ${repoData.ref} is a branch or tag that points to ${inputMap.${repoData.url}.rev}."
229229
else inputMap.${repoData.url})
230-
else if repoData.sha256 != null
230+
else if repoData.sha256 != null && !repoData.is-private
231231
then fetchgit { inherit (repoData) url sha256; rev = repoData.ref; }
232232
else
233-
let drv = builtins.fetchGit { inherit (repoData) url ref; };
234-
in __trace "WARNING: No sha256 found for source-repository-package ${repoData.url} ${repoData.ref} download may fail in restricted mode (hydra)"
235-
(__trace "Consider adding `--sha256: ${hashPath drv}` to the ${cabalProjectFileName} file or passing in a sha256map argument"
236-
drv);
233+
let
234+
# If the "tag" is a hash, we'll use 'rev', otherwise we'll use
235+
# 'ref'. Using a commit hash as a 'ref' doesn't do what we want.
236+
refOrRev = if builtins.match "[0-9a-f]*" (repoData.ref) != null
237+
then { rev = repoData.ref; }
238+
else { inherit (repoData) ref; };
239+
drv = builtins.fetchGit ({ inherit (repoData) url; } // refOrRev);
240+
maybeTrace = x: if repoData.sha256 != null then x else
241+
__trace "WARNING: No sha256 found for source-repository-package ${repoData.url} ${repoData.ref} download may fail in restricted mode (hydra)"
242+
(__trace "Consider adding `--sha256: ${hashPath drv}` to the ${cabalProjectFileName} file or passing in a sha256map argument"
243+
x);
244+
in maybeTrace drv;
237245
in {
238246
# Download the source-repository-package commit and add it to a minimal git
239247
# repository that `cabal` will be able to access from a non fixed output derivation.

lib/pkgconf-nixpkgs-map.nix

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ pkgs:
4545
"gstreamer-plugins-base-0.10" = [ "gst-plugins-base" ];
4646
"gstreamer-video-1.0" = [ "gst-plugins-base" ];
4747
"gtk-x11-2.0" = [ "gtk_x11" ];
48+
"ical" = [ "libical" ];
4849
"icudata" = [ "icu" ];
4950
"icui18n" = [ "icu" ];
5051
"icuuc" = [ "icu" ];
@@ -5742,4 +5743,4 @@ pkgs:
57425743
else if pkgs ? gdk_pixbuf
57435744
then [ pkgs.gdk_pixbuf ]
57445745
else [];
5745-
}
5746+
}

lib/system-nixpkgs-map.nix

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ in
9595
# compile C sources (https://github.com/fpco/odbc/blob/master/cbits/odbc.c)
9696
odbc = [ unixODBC ];
9797
opencv = [ opencv3 ];
98+
ical = [ libical ];
9899
icuuc = [ icu ];
99100
icui18n = [ icu ];
100101
icu-i18n = [ icu ];
@@ -114,6 +115,7 @@ in
114115
GeoIP = [ geoip ];
115116
pulse-simple = [ libpulseaudio ];
116117
oath = [ liboauth ];
118+
mcrypt = [ libmcrypt ];
117119
}
118120
# -- windows
119121
// { advapi32 = null; gdi32 = null; imm32 = null; msimg32 = null;

0 commit comments

Comments
 (0)