Skip to content

Commit 825d02b

Browse files
authored
Update to spago 0.93.44 and Nixpkgs 25.5 (#701)
1 parent e7269e6 commit 825d02b

File tree

13 files changed

+3583
-1884
lines changed

13 files changed

+3583
-1884
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/node_modules
22
/output
3+
/output-es
34
/scratch
45
/.vscode
56

app/default.nix

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
makeWrapper,
33
lib,
44
stdenv,
5-
purix,
6-
purs-backend-es,
5+
purs-backend-es-unstable,
76
esbuild,
87
writeText,
98
nodejs,
@@ -32,16 +31,27 @@ let
3231
"buildPhase"
3332
"installPhase"
3433
];
35-
nativeBuildInputs = [ purs-backend-es ];
34+
nativeBuildInputs = [ purs-backend-es-unstable ];
3635
buildPhase = ''
3736
ln -s ${package-lock}/js/node_modules .
38-
cp -r ${spago-lock.registry-app}/output .
37+
ln -s ${spago-lock}/output .
3938
echo "Optimizing with purs-backend-es..."
4039
purs-backend-es build
4140
'';
4241
installPhase = ''
43-
mkdir $out
44-
mv output-es $out/output
42+
mkdir $out;
43+
cp -r output-es $out/output;
44+
# This for loop exists because purs-backend-es finds the corefn.json files
45+
# just fine, but doesn't find the foreign.js files.
46+
# I suspect this is because of a quirky interaction between Nix and `copyFile`,
47+
# but I'm not sure how to fix it so we work around it by copying the foreign
48+
# modules by hand.
49+
for dir in output/*/; do
50+
subdir=$(basename "$dir")
51+
if [ -f "output/$subdir/foreign.js" ]; then
52+
cp "output/$subdir/foreign.js" "$out/output/$subdir/" || true;
53+
fi
54+
done
4555
'';
4656
};
4757
in

app/spago.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,5 @@ package:
7575
test:
7676
main: Test.Registry.Main
7777
dependencies:
78+
- registry-test-utils
7879
- spec

flake.lock

Lines changed: 74 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
description = "The PureScript Registry";
33

44
inputs = {
5-
nixpkgs.url = "github:nixos/nixpkgs/release-24.05";
5+
nixpkgs.url = "github:nixos/nixpkgs/release-25.05";
66
flake-utils.url = "github:numtide/flake-utils";
77

88
flake-compat.url = "github:edolstra/flake-compat";
@@ -11,6 +11,10 @@
1111
purescript-overlay.url = "github:thomashoneyman/purescript-overlay";
1212
purescript-overlay.inputs.nixpkgs.follows = "nixpkgs";
1313

14+
mkSpagoDerivation.url = "github:jeslie0/mkSpagoDerivation";
15+
mkSpagoDerivation.inputs.nixpkgs.follows = "nixpkgs";
16+
mkSpagoDerivation.inputs.ps-overlay.follows = "purescript-overlay";
17+
1418
slimlock.url = "github:thomashoneyman/slimlock";
1519
slimlock.inputs.nixpkgs.follows = "nixpkgs";
1620
};
@@ -21,6 +25,7 @@
2125
nixpkgs,
2226
flake-utils,
2327
purescript-overlay,
28+
mkSpagoDerivation,
2429
slimlock,
2530
...
2631
}:
@@ -44,6 +49,7 @@
4449
./foreign
4550
./lib
4651
./scripts
52+
./test-utils
4753
./spago.lock
4854
./spago.yaml
4955
]
@@ -76,7 +82,7 @@
7682
# We don't want to force everyone to update their configs if they aren't
7783
# normally on flakes.
7884
nixFlakes = prev.writeShellScriptBin "nixFlakes" ''
79-
exec ${prev.nixFlakes}/bin/nix --experimental-features "nix-command flakes" "$@"
85+
exec ${prev.nixVersions.stable}/bin/nix --experimental-features "nix-command flakes" "$@"
8086
'';
8187

8288
# Detects arguments to 'git' containing a URL and replaces them with a
@@ -144,12 +150,15 @@
144150
# Packages associated with the registry, ie. in this repository.
145151
registry =
146152
let
147-
spago-lock = prev.purix.buildSpagoLock {
148-
src = fileset.toSource {
149-
root = ./.;
150-
fileset = pureScriptFileset;
151-
};
152-
corefn = true;
153+
spago-lock = prev.mkSpagoDerivation {
154+
name = "registry";
155+
src = ./.;
156+
nativeBuildInputs = [
157+
prev.pkgs.spago-bin.spago-0_93_44
158+
prev.pkgs.purescript
159+
];
160+
buildPhase = "spago build";
161+
installPhase = "mkdir $out; cp -r * $out";
153162
};
154163

155164
package-lock =
@@ -245,6 +254,7 @@
245254
inherit system;
246255
overlays = [
247256
purescript-overlay.overlays.default
257+
mkSpagoDerivation.overlays.default
248258
slimlock.overlays.default
249259
registryOverlay
250260
];
@@ -265,12 +275,12 @@
265275
set -euo pipefail
266276
WORKDIR=$(mktemp -d)
267277
cp spago.yaml spago.lock $WORKDIR
268-
cp -a app foreign lib scripts types $WORKDIR
278+
cp -a app foreign lib scripts test-utils types $WORKDIR
269279
ln -s ${pkgs.registry.package-lock}/js/node_modules $WORKDIR/node_modules
270280
271281
pushd $WORKDIR
272282
export HEALTHCHECKS_URL=${defaultEnv.HEALTHCHECKS_URL}
273-
${pkgs.spago-bin.spago-0_93_19}/bin/spago test
283+
${pkgs.spago-bin.spago-0_93_44}/bin/spago test
274284
275285
popd
276286
'';
@@ -317,6 +327,7 @@
317327
{
318328
nixpkgs.overlays = [
319329
purescript-overlay.overlays.default
330+
mkSpagoDerivation.overlays.default
320331
slimlock.overlays.default
321332
registryOverlay
322333
];
@@ -853,7 +864,7 @@
853864

854865
# Development tooling
855866
purs
856-
spago-bin.spago-0_93_19 # until new lockfile format supported by overlay
867+
spago-bin.spago-0_93_44
857868
purs-tidy-unstable
858869
purs-backend-es-unstable
859870
];
@@ -870,6 +881,7 @@
870881
system = "x86_64-linux";
871882
overlays = [
872883
purescript-overlay.overlays.default
884+
mkSpagoDerivation.overlays.default
873885
slimlock.overlays.default
874886
registryOverlay
875887
];

foreign/spago.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,5 @@ package:
4747
- node-execa
4848
- node-fs
4949
- node-process
50+
- registry-test-utils
5051
- spec

lib/spago.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,5 @@ package:
5151
- json
5252
- node-child-process
5353
- node-execa
54+
- registry-test-utils
5455
- spec
55-
- unsafe-coerce

scripts/default.nix

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
makeWrapper,
33
lib,
44
stdenv,
5-
purix,
65
esbuild,
76
nodejs,
87
writeText,
@@ -37,7 +36,7 @@ let
3736
'';
3837
buildPhase = ''
3938
ln -s ${package-lock}/js/node_modules .
40-
cp -r ${spago-lock.registry-scripts}/output .
39+
ln -s ${spago-lock}/output .
4140
cp ${entrypoint} entrypoint.js
4241
esbuild entrypoint.js --bundle --outfile=${name}.js --platform=node --packages=external
4342
'';

0 commit comments

Comments
 (0)