Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 4 additions & 20 deletions nix/sources.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,16 @@ let
#

fetch_file = pkgs: name: spec:
let
name' = sanitizeName name + "-src";
in
if spec.builtin or true then
builtins_fetchurl { inherit (spec) url sha256; name = name'; }
builtins_fetchurl { inherit (spec) url sha256; name = "source"; }
else
pkgs.fetchurl { inherit (spec) url sha256; name = name'; };
pkgs.fetchurl { inherit (spec) url sha256; name = "source"; };

fetch_tarball = pkgs: name: spec:
let
name' = sanitizeName name + "-src";
in
if spec.builtin or true then
builtins_fetchTarball { name = name'; inherit (spec) url sha256; }
builtins_fetchTarball { name = "source"; inherit (spec) url sha256; }
else
pkgs.fetchzip { name = name'; inherit (spec) url sha256; };
pkgs.fetchzip { name = "source"; inherit (spec) url sha256; };

fetch_git = name: spec:
let
Expand Down Expand Up @@ -69,16 +63,6 @@ let
# Various helpers
#

# https://github.com/NixOS/nixpkgs/pull/83241/files#diff-c6f540a4f3bfa4b0e8b6bafd4cd54e8bR695
sanitizeName = name:
(
concatMapStrings (s: if builtins.isList s then "-" else s)
(
builtins.split "[^[:alnum:]+._?=-]+"
((x: builtins.elemAt (builtins.match "\\.*(.*)" x) 0) name)
)
);

# The set of packages used when specs are fetched using non-builtins.
mkPkgs = sources: system:
let
Expand Down
4 changes: 4 additions & 0 deletions src/Niv/Sources.hs
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@ data SourcesNixVersion
| -- formatting fix
-- Apply statix suggestions
V28
| -- always use "source" for store path names
V29
deriving stock (Bounded, Enum, Eq)

-- | A user friendly version
Expand Down Expand Up @@ -214,6 +216,7 @@ sourcesVersionToText = \case
V26 -> "26"
V27 -> "27"
V28 -> "28"
V29 -> "29"

latestVersionMD5 :: T.Text
latestVersionMD5 = sourcesVersionToMD5 maxBound
Expand Down Expand Up @@ -254,6 +257,7 @@ sourcesVersionToMD5 = \case
V26 -> "937bff93370a064c9000f13cec5867f9"
V27 -> "8031ba9d8fbbc7401c800d0b84278ec8"
V28 -> "26ed55356db7673935329210a4f8c4a5"
V29 -> "77f9fbf2fe7c64e079862e53145a2af9"

-- | The MD5 sum of ./nix/sources.nix
sourcesNixMD5 :: IO T.Text
Expand Down