Skip to content

Commit f28ba70

Browse files
committed
Update to nix 25.5
1 parent f181083 commit f28ba70

5 files changed

Lines changed: 39 additions & 20 deletions

File tree

.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+
cp -r ${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

flake.lock

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

flake.nix

Lines changed: 17 additions & 8 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,12 @@
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 = [ prev.pkgs.spago-bin.spago-0_93_44 prev.pkgs.purescript ];
157+
buildPhase = "spago build";
158+
installPhase = "mkdir $out; cp -r * $out";
153159
};
154160

155161
package-lock =
@@ -245,6 +251,7 @@
245251
inherit system;
246252
overlays = [
247253
purescript-overlay.overlays.default
254+
mkSpagoDerivation.overlays.default
248255
slimlock.overlays.default
249256
registryOverlay
250257
];
@@ -317,6 +324,7 @@
317324
{
318325
nixpkgs.overlays = [
319326
purescript-overlay.overlays.default
327+
mkSpagoDerivation.overlays.default
320328
slimlock.overlays.default
321329
registryOverlay
322330
];
@@ -870,6 +878,7 @@
870878
system = "x86_64-linux";
871879
overlays = [
872880
purescript-overlay.overlays.default
881+
mkSpagoDerivation.overlays.default
873882
slimlock.overlays.default
874883
registryOverlay
875884
];

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+
cp -r ${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)