Skip to content

Commit 92a3cc5

Browse files
authored
Bump haskell.nix (#201)
* Bump haskell.nix * Bump cachix actions * Bump nixpkgs to 2405
1 parent d819410 commit 92a3cc5

File tree

4 files changed

+88
-64
lines changed

4 files changed

+88
-64
lines changed

.github/workflows/build.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ jobs:
99
persist-credentials: false
1010
submodules: true
1111

12-
- uses: cachix/install-nix-action@v20
12+
- uses: cachix/install-nix-action@v27
1313
with:
1414
nix_path: nixpkgs=channel:nixos-unstable
1515

16-
- uses: cachix/cachix-action@v12
16+
- uses: cachix/cachix-action@v15
1717
with:
1818
name: hs-dear-imgui
1919
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'

default.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ haskellNix ? (import (import ./nix/sources.nix)."haskell.nix" { })
44
# haskell.nix provides access to the nixpkgs pins which are used by our CI,
55
# hence you will be more likely to get cache hits when using these.
66
# But you can also just use your own, e.g. '<nixpkgs>'.
7-
, nixpkgsSrc ? haskellNix.sources.nixpkgs-2105
7+
, nixpkgsSrc ? haskellNix.sources.nixpkgs-2305
88

99
# haskell.nix provides some arguments to be passed to nixpkgs, including some
1010
# patches and also the haskell.nix functionality itself as an overlay.

nix/sources.json

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
{
22
"haskell.nix": {
3-
"branch": "master",
3+
"branch": "2024.06.16",
44
"description": "Alternative Haskell Infrastructure for Nixpkgs",
55
"homepage": "https://input-output-hk.github.io/haskell.nix",
66
"owner": "input-output-hk",
77
"repo": "haskell.nix",
8-
"rev": "970c84ad19e84d4ae42075cfe283022394f6effa",
9-
"sha256": "01afbcas324n7j2bpfib7b4fazg5y6k7b74803c0i9ayrs6sgav6",
8+
"rev": "83f1cb67cb3c97553815d5562d070ac754c25686",
9+
"sha256": "1ggs13zdg8c3s9l6m6qd91zghjkxc0vy96vq0zfvpb5sc6bm2fhy",
1010
"type": "tarball",
11-
"url": "https://github.com/input-output-hk/haskell.nix/archive/970c84ad19e84d4ae42075cfe283022394f6effa.tar.gz",
11+
"url": "https://github.com/input-output-hk/haskell.nix/archive/83f1cb67cb3c97553815d5562d070ac754c25686.tar.gz",
1212
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
1313
},
1414
"niv": {
@@ -17,22 +17,22 @@
1717
"homepage": "https://github.com/nmattia/niv",
1818
"owner": "nmattia",
1919
"repo": "niv",
20-
"rev": "e0ca65c81a2d7a4d82a189f1e23a48d59ad42070",
21-
"sha256": "1pq9nh1d8nn3xvbdny8fafzw87mj7gsmp6pxkdl65w2g18rmcmzx",
20+
"rev": "f7c538837892dd2eb83567c9f380a11efb59b53f",
21+
"sha256": "0xl33k24vfc29cg9lnp95kvcq69qbq5fzb7jk9ig4lgrhaarh651",
2222
"type": "tarball",
23-
"url": "https://github.com/nmattia/niv/archive/e0ca65c81a2d7a4d82a189f1e23a48d59ad42070.tar.gz",
23+
"url": "https://github.com/nmattia/niv/archive/f7c538837892dd2eb83567c9f380a11efb59b53f.tar.gz",
2424
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
2525
},
2626
"nixpkgs": {
27-
"branch": "nixos-19.09",
28-
"description": "DEPRECATED! This is an obsolete, read-only mirror of the NixOS/nixpkgs repository.",
29-
"homepage": "https://github.com/NixOS/nixpkgs",
27+
"branch": "24.05",
28+
"description": "Nix Packages collection & NixOS",
29+
"homepage": "",
3030
"owner": "NixOS",
31-
"repo": "nixpkgs-channels",
32-
"rev": "75f4ba05c63be3f147bcc2f7bd4ba1f029cedcb1",
33-
"sha256": "157c64220lf825ll4c0cxsdwg7cxqdx4z559fdp7kpz0g6p8fhhr",
31+
"repo": "nixpkgs",
32+
"rev": "63dacb46bf939521bdc93981b4cbb7ecb58427a0",
33+
"sha256": "1lr1h35prqkd1mkmzriwlpvxcb34kmhc9dnr48gkm8hh089hifmx",
3434
"type": "tarball",
35-
"url": "https://github.com/NixOS/nixpkgs-channels/archive/75f4ba05c63be3f147bcc2f7bd4ba1f029cedcb1.tar.gz",
35+
"url": "https://github.com/NixOS/nixpkgs/archive/63dacb46bf939521bdc93981b4cbb7ecb58427a0.tar.gz",
3636
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
3737
}
3838
}

nix/sources.nix

Lines changed: 71 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -10,29 +10,50 @@ let
1010
let
1111
name' = sanitizeName name + "-src";
1212
in
13-
if spec.builtin or true then
14-
builtins_fetchurl { inherit (spec) url sha256; name = name'; }
15-
else
16-
pkgs.fetchurl { inherit (spec) url sha256; name = name'; };
13+
if spec.builtin or true then
14+
builtins_fetchurl { inherit (spec) url sha256; name = name'; }
15+
else
16+
pkgs.fetchurl { inherit (spec) url sha256; name = name'; };
1717

1818
fetch_tarball = pkgs: name: spec:
1919
let
2020
name' = sanitizeName name + "-src";
2121
in
22-
if spec.builtin or true then
23-
builtins_fetchTarball { name = name'; inherit (spec) url sha256; }
24-
else
25-
pkgs.fetchzip { name = name'; inherit (spec) url sha256; };
22+
if spec.builtin or true then
23+
builtins_fetchTarball { name = name'; inherit (spec) url sha256; }
24+
else
25+
pkgs.fetchzip { name = name'; inherit (spec) url sha256; };
2626

2727
fetch_git = name: spec:
2828
let
2929
ref =
30-
if spec ? ref then spec.ref else
30+
spec.ref or (
3131
if spec ? branch then "refs/heads/${spec.branch}" else
32-
if spec ? tag then "refs/tags/${spec.tag}" else
33-
abort "In git source '${name}': Please specify `ref`, `tag` or `branch`!";
32+
if spec ? tag then "refs/tags/${spec.tag}" else
33+
abort "In git source '${name}': Please specify `ref`, `tag` or `branch`!"
34+
);
35+
submodules = spec.submodules or false;
36+
submoduleArg =
37+
let
38+
nixSupportsSubmodules = builtins.compareVersions builtins.nixVersion "2.4" >= 0;
39+
emptyArgWithWarning =
40+
if submodules
41+
then
42+
builtins.trace
43+
(
44+
"The niv input \"${name}\" uses submodules "
45+
+ "but your nix's (${builtins.nixVersion}) builtins.fetchGit "
46+
+ "does not support them"
47+
)
48+
{ }
49+
else { };
50+
in
51+
if nixSupportsSubmodules
52+
then { inherit submodules; }
53+
else emptyArgWithWarning;
3454
in
35-
builtins.fetchGit { url = spec.repo; inherit (spec) rev; inherit ref; };
55+
builtins.fetchGit
56+
({ url = spec.repo; inherit (spec) rev; inherit ref; } // submoduleArg);
3657

3758
fetch_local = spec: spec.path;
3859

@@ -66,16 +87,16 @@ let
6687
hasNixpkgsPath = builtins.any (x: x.prefix == "nixpkgs") builtins.nixPath;
6788
hasThisAsNixpkgsPath = <nixpkgs> == ./.;
6889
in
69-
if builtins.hasAttr "nixpkgs" sources
70-
then sourcesNixpkgs
71-
else if hasNixpkgsPath && ! hasThisAsNixpkgsPath then
72-
import <nixpkgs> {}
73-
else
74-
abort
75-
''
76-
Please specify either <nixpkgs> (through -I or NIX_PATH=nixpkgs=...) or
77-
add a package called "nixpkgs" to your sources.json.
78-
'';
90+
if builtins.hasAttr "nixpkgs" sources
91+
then sourcesNixpkgs
92+
else if hasNixpkgsPath && ! hasThisAsNixpkgsPath then
93+
import <nixpkgs> { }
94+
else
95+
abort
96+
''
97+
Please specify either <nixpkgs> (through -I or NIX_PATH=nixpkgs=...) or
98+
add a package called "nixpkgs" to your sources.json.
99+
'';
79100

80101
# The actual fetching function.
81102
fetch = pkgs: name: spec:
@@ -95,13 +116,13 @@ let
95116
# the path directly as opposed to the fetched source.
96117
replace = name: drv:
97118
let
98-
saneName = stringAsChars (c: if isNull (builtins.match "[a-zA-Z0-9]" c) then "_" else c) name;
119+
saneName = stringAsChars (c: if (builtins.match "[a-zA-Z0-9]" c) == null then "_" else c) name;
99120
ersatz = builtins.getEnv "NIV_OVERRIDE_${saneName}";
100121
in
101-
if ersatz == "" then drv else
102-
# this turns the string into an actual Nix path (for both absolute and
103-
# relative paths)
104-
if builtins.substring 0 1 ersatz == "/" then /. + ersatz else /. + builtins.getEnv "PWD" + "/${ersatz}";
122+
if ersatz == "" then drv else
123+
# this turns the string into an actual Nix path (for both absolute and
124+
# relative paths)
125+
if builtins.substring 0 1 ersatz == "/" then /. + ersatz else /. + builtins.getEnv "PWD" + "/${ersatz}";
105126

106127
# Ports of functions for older nix versions
107128

@@ -112,7 +133,7 @@ let
112133
);
113134

114135
# https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/lists.nix#L295
115-
range = first: last: if first > last then [] else builtins.genList (n: first + n) (last - first + 1);
136+
range = first: last: if first > last then [ ] else builtins.genList (n: first + n) (last - first + 1);
116137

117138
# https://github.com/NixOS/nixpkgs/blob/0258808f5744ca980b9a1f24fe0b1e6f0fecee9c/lib/strings.nix#L257
118139
stringToCharacters = s: map (p: builtins.substring p 1 s) (range 0 (builtins.stringLength s - 1));
@@ -123,43 +144,46 @@ let
123144
concatStrings = builtins.concatStringsSep "";
124145

125146
# https://github.com/NixOS/nixpkgs/blob/8a9f58a375c401b96da862d969f66429def1d118/lib/attrsets.nix#L331
126-
optionalAttrs = cond: as: if cond then as else {};
147+
optionalAttrs = cond: as: if cond then as else { };
127148

128149
# fetchTarball version that is compatible between all the versions of Nix
129150
builtins_fetchTarball = { url, name ? null, sha256 }@attrs:
130151
let
131152
inherit (builtins) lessThan nixVersion fetchTarball;
132153
in
133-
if lessThan nixVersion "1.12" then
134-
fetchTarball ({ inherit url; } // (optionalAttrs (!isNull name) { inherit name; }))
135-
else
136-
fetchTarball attrs;
154+
if lessThan nixVersion "1.12" then
155+
fetchTarball ({ inherit url; } // (optionalAttrs (name != null) { inherit name; }))
156+
else
157+
fetchTarball attrs;
137158

138159
# fetchurl version that is compatible between all the versions of Nix
139160
builtins_fetchurl = { url, name ? null, sha256 }@attrs:
140161
let
141162
inherit (builtins) lessThan nixVersion fetchurl;
142163
in
143-
if lessThan nixVersion "1.12" then
144-
fetchurl ({ inherit url; } // (optionalAttrs (!isNull name) { inherit name; }))
145-
else
146-
fetchurl attrs;
164+
if lessThan nixVersion "1.12" then
165+
fetchurl ({ inherit url; } // (optionalAttrs (name != null) { inherit name; }))
166+
else
167+
fetchurl attrs;
147168

148169
# Create the final "sources" from the config
149170
mkSources = config:
150-
mapAttrs (
151-
name: spec:
152-
if builtins.hasAttr "outPath" spec
153-
then abort
154-
"The values in sources.json should not have an 'outPath' attribute"
155-
else
156-
spec // { outPath = replace name (fetch config.pkgs name spec); }
157-
) config.sources;
171+
mapAttrs
172+
(
173+
name: spec:
174+
if builtins.hasAttr "outPath" spec
175+
then
176+
abort
177+
"The values in sources.json should not have an 'outPath' attribute"
178+
else
179+
spec // { outPath = replace name (fetch config.pkgs name spec); }
180+
)
181+
config.sources;
158182

159183
# The "config" used by the fetchers
160184
mkConfig =
161185
{ sourcesFile ? if builtins.pathExists ./sources.json then ./sources.json else null
162-
, sources ? if isNull sourcesFile then {} else builtins.fromJSON (builtins.readFile sourcesFile)
186+
, sources ? if sourcesFile == null then { } else builtins.fromJSON (builtins.readFile sourcesFile)
163187
, system ? builtins.currentSystem
164188
, pkgs ? mkPkgs sources system
165189
}: rec {
@@ -171,4 +195,4 @@ let
171195
};
172196

173197
in
174-
mkSources (mkConfig {}) // { __functor = _: settings: mkSources (mkConfig settings); }
198+
mkSources (mkConfig { }) // { __functor = _: settings: mkSources (mkConfig settings); }

0 commit comments

Comments
 (0)