Skip to content

Commit

Permalink
Upgrade Haskell.nix (#205)
Browse files Browse the repository at this point in the history
  • Loading branch information
shane-circuithub committed Oct 14, 2022
1 parent 44d5d0a commit c69504e
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 10 deletions.
18 changes: 9 additions & 9 deletions nix/sources.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
"homepage": "https://input-output-hk.github.io/haskell.nix",
"owner": "input-output-hk",
"repo": "haskell.nix",
"rev": "d457e12916c77cc9342ed7356ffdf266a05ef982",
"sha256": "0z6fr81bi37mw3kaw7g7wg5ayplh72czv3asih2npz7bnadq1al5",
"rev": "0837156c56cb5350dd9bd84eb424187e00aa1e8a",
"sha256": "1djmv5a0vfj78csw2cad6nicrs8iqrp928b9b3v4h7lwwhhzliwl",
"type": "tarball",
"url": "https://github.com/input-output-hk/haskell.nix/archive/d457e12916c77cc9342ed7356ffdf266a05ef982.tar.gz",
"url": "https://github.com/input-output-hk/haskell.nix/archive/0837156c56cb5350dd9bd84eb424187e00aa1e8a.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"niv": {
Expand All @@ -17,10 +17,10 @@
"homepage": "https://github.com/nmattia/niv",
"owner": "nmattia",
"repo": "niv",
"rev": "e0ca65c81a2d7a4d82a189f1e23a48d59ad42070",
"sha256": "1pq9nh1d8nn3xvbdny8fafzw87mj7gsmp6pxkdl65w2g18rmcmzx",
"rev": "acdb1726783637852c01e0ad639ac9cbec28d8c8",
"sha256": "1wszl8q70z6wfgkh2dvgmhhry6qp9nar421qq2ifd17hq2jj9ck3",
"type": "tarball",
"url": "https://github.com/nmattia/niv/archive/e0ca65c81a2d7a4d82a189f1e23a48d59ad42070.tar.gz",
"url": "https://github.com/nmattia/niv/archive/acdb1726783637852c01e0ad639ac9cbec28d8c8.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
},
"nixpkgs": {
Expand All @@ -29,10 +29,10 @@
"homepage": null,
"owner": "nixos",
"repo": "nixpkgs",
"rev": "59b8d9cf24e9fcf10341a0923c9bdca088dca8c8",
"sha256": "08f38v4b2kcxnbapdwrb54bglka92cxj9qlnqlk5px206jyq9v4c",
"rev": "1c1f5649bb9c1b0d98637c8c365228f57126f361",
"sha256": "0f2nvdijyxfgl5kwyb4465pppd5vkhqxddx6v40k2s0z9jfhj0xl",
"type": "tarball",
"url": "https://github.com/nixos/nixpkgs/archive/59b8d9cf24e9fcf10341a0923c9bdca088dca8c8.tar.gz",
"url": "https://github.com/nixos/nixpkgs/archive/1c1f5649bb9c1b0d98637c8c365228f57126f361.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
}
}
22 changes: 21 additions & 1 deletion nix/sources.nix
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,28 @@ let
if spec ? branch then "refs/heads/${spec.branch}" else
if spec ? tag then "refs/tags/${spec.tag}" else
abort "In git source '${name}': Please specify `ref`, `tag` or `branch`!";
submodules = if spec ? submodules then spec.submodules else false;
submoduleArg =
let
nixSupportsSubmodules = builtins.compareVersions builtins.nixVersion "2.4" >= 0;
emptyArgWithWarning =
if submodules == true
then
builtins.trace
(
"The niv input \"${name}\" uses submodules "
+ "but your nix's (${builtins.nixVersion}) builtins.fetchGit "
+ "does not support them"
)
{}
else {};
in
if nixSupportsSubmodules
then { inherit submodules; }
else emptyArgWithWarning;
in
builtins.fetchGit { url = spec.repo; inherit (spec) rev; inherit ref; };
builtins.fetchGit
({ url = spec.repo; inherit (spec) rev; inherit ref; } // submoduleArg);

fetch_local = spec: spec.path;

Expand Down

0 comments on commit c69504e

Please sign in to comment.