Skip to content

Commit e680cd8

Browse files
use "source" for source names
this removes a difference to how Nix currently fetches flake references. using a constant is preferrable because renaming the source won't force downstream rebuilds. there probably is no correct solution here, as any choice for the symbolic name is essentially arbitrary, and arguably symbolic names were an unfortunate design decision anyway.
1 parent 723f0ee commit e680cd8

File tree

2 files changed

+8
-20
lines changed

2 files changed

+8
-20
lines changed

nix/sources.nix

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,16 @@ let
77
#
88

99
fetch_file = pkgs: name: spec:
10-
let
11-
name' = sanitizeName name + "-src";
12-
in
1310
if spec.builtin or true then
14-
builtins_fetchurl { inherit (spec) url sha256; name = name'; }
11+
builtins_fetchurl { inherit (spec) url sha256; name = "source"; }
1512
else
16-
pkgs.fetchurl { inherit (spec) url sha256; name = name'; };
13+
pkgs.fetchurl { inherit (spec) url sha256; name = "source"; };
1714

1815
fetch_tarball = pkgs: name: spec:
19-
let
20-
name' = sanitizeName name + "-src";
21-
in
2216
if spec.builtin or true then
23-
builtins_fetchTarball { name = name'; inherit (spec) url sha256; }
17+
builtins_fetchTarball { name = "source"; inherit (spec) url sha256; }
2418
else
25-
pkgs.fetchzip { name = name'; inherit (spec) url sha256; };
19+
pkgs.fetchzip { name = "source"; inherit (spec) url sha256; };
2620

2721
fetch_git = name: spec:
2822
let
@@ -69,16 +63,6 @@ let
6963
# Various helpers
7064
#
7165

72-
# https://github.com/NixOS/nixpkgs/pull/83241/files#diff-c6f540a4f3bfa4b0e8b6bafd4cd54e8bR695
73-
sanitizeName = name:
74-
(
75-
concatMapStrings (s: if builtins.isList s then "-" else s)
76-
(
77-
builtins.split "[^[:alnum:]+._?=-]+"
78-
((x: builtins.elemAt (builtins.match "\\.*(.*)" x) 0) name)
79-
)
80-
);
81-
8266
# The set of packages used when specs are fetched using non-builtins.
8367
mkPkgs = sources: system:
8468
let

src/Niv/Sources.hs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,8 @@ data SourcesNixVersion
181181
| -- formatting fix
182182
-- Apply statix suggestions
183183
V28
184+
| -- always use "source" for store path names
185+
V29
184186
deriving stock (Bounded, Enum, Eq)
185187

186188
-- | A user friendly version
@@ -214,6 +216,7 @@ sourcesVersionToText = \case
214216
V26 -> "26"
215217
V27 -> "27"
216218
V28 -> "28"
219+
V29 -> "29"
217220

218221
latestVersionMD5 :: T.Text
219222
latestVersionMD5 = sourcesVersionToMD5 maxBound
@@ -254,6 +257,7 @@ sourcesVersionToMD5 = \case
254257
V26 -> "937bff93370a064c9000f13cec5867f9"
255258
V27 -> "8031ba9d8fbbc7401c800d0b84278ec8"
256259
V28 -> "26ed55356db7673935329210a4f8c4a5"
260+
V29 -> "77f9fbf2fe7c64e079862e53145a2af9"
257261

258262
-- | The MD5 sum of ./nix/sources.nix
259263
sourcesNixMD5 :: IO T.Text

0 commit comments

Comments
 (0)