1
1
mirror of https://github.com/nmattia/niv.git synced 2024-10-06 12:27:35 +03:00

Add the ability to pass submodules to builtins.fetchGit

This commit is contained in:
George Shammas 2022-02-05 17:25:12 -05:00 committed by Nicolas Mattia
parent 5830a4dd34
commit 9cb7ef336b
2 changed files with 7 additions and 1 deletions

View File

@ -31,8 +31,10 @@ 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;
in
builtins.fetchGit { url = spec.repo; inherit (spec) rev; inherit ref; };
builtins.fetchGit { url = spec.repo; inherit (spec) rev; inherit ref; }
// (if builtins.compareVersions builtins.nixVersion "2.4" >= 0 then { inherit submodules; } else { });
fetch_local = spec: spec.path;

View File

@ -171,6 +171,8 @@ data SourcesNixVersion
V23
| -- Fix NIV_OVERRIDE_{name} for sandbox
V24
| -- Add the ability to pass submodules to fetchGit
V25
deriving stock (Bounded, Enum, Eq)
-- | A user friendly version
@ -200,6 +202,7 @@ sourcesVersionToText = \case
V22 -> "22"
V23 -> "23"
V24 -> "24"
V25 -> "25"
latestVersionMD5 :: T.Text
latestVersionMD5 = sourcesVersionToMD5 maxBound
@ -236,6 +239,7 @@ sourcesVersionToMD5 = \case
V22 -> "935d1d2f0bf95fda977a6e3a7e548ed4"
V23 -> "4111204b613ec688e2669516dd313440"
V24 -> "116c2d936f1847112fef0013771dab28"
V25 -> "6612caee5814670e5e4d9dd1b71b5f70"
-- | The MD5 sum of ./nix/sources.nix
sourcesNixMD5 :: IO T.Text