Skip to content

Commit e159a62

Browse files
Remove buildSpagoLock, purix from repo (#127)
1 parent 83335b3 commit e159a62

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+1809
-5331
lines changed

.github/workflows/ci.yaml

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,28 @@ jobs:
1919
with:
2020
use-flakehub: false
2121

22-
- name: Run flake check
22+
- name: Cache Spago dependencies
23+
uses: actions/cache@v4
24+
with:
25+
path: |
26+
generate/.spago
27+
generate/output
28+
~/.cache/spago
29+
key: spago-${{ runner.os }}-${{ hashFiles('generate/spago.lock') }}
30+
restore-keys: |
31+
spago-${{ runner.os }}-
32+
33+
- name: Run spago tests
34+
run: |
35+
cd generate
36+
nix develop ..# --command bash -c "npm ci && spago test"
37+
38+
- name: Verify manifests
39+
run: |
40+
cd generate
41+
nix develop ..# --command spago run -p bin -m Bin.Main -- verify ../manifests
42+
43+
- name: Run flake checks
2344
run: nix flake check --print-build-logs
2445

2546
check-darwin:

README.md

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
# PureScript Overlay
22

3-
[![daily-update](https://github.com/thomashoneyman/purescript-nix/actions/workflows/daily-update.yaml/badge.svg)](https://github.com/thomashoneyman/purescript-nix/actions/workflows/daily-update.yaml)
4-
[![darwin-support](https://github.com/thomashoneyman/purescript-nix/actions/workflows/darwin-support.yaml/badge.svg)](https://github.com/thomashoneyman/purescript-nix/actions/workflows/darwin-support.yaml)
5-
[![nix-unit-tests](https://github.com/thomashoneyman/purescript-nix/actions/workflows/nix-unit-tests.yaml/badge.svg)](https://github.com/thomashoneyman/purescript-nix/actions/workflows/nix-unit-tests.yaml)
3+
[![CI](https://github.com/thomashoneyman/purescript-overlay/actions/workflows/ci.yaml/badge.svg)](https://github.com/thomashoneyman/purescript-overlay/actions/workflows/ci.yaml)
4+
[![daily-update](https://github.com/thomashoneyman/purescript-overlay/actions/workflows/daily-update.yaml/badge.svg)](https://github.com/thomashoneyman/purescript-overlay/actions/workflows/daily-update.yaml)
65

7-
Pure and reproducible overlay for the standard PureScript toolchain, including support for Nix flakes. The toolchain is auto-updated every day. Currently supported tools:
6+
Pure and reproducible Nix overlay for the standard PureScript toolchain. The toolchain is auto-updated every day. Currently supported tools:
87

98
- `purs`, the compiler
109
- `spago`, the package manager
@@ -27,7 +26,7 @@ If you're looking for a way to *build* your `spago@next`-based projects using Ni
2726

2827
## Usage
2928

30-
In a Nix flake, use the provided overlay when importing nixpkgs to get access to tools like `purs` and `spago` and functions like `buildSpagoLock`. For example, the below flake creates a development shell with recent versions of the PureScript compiler and Spago package manager:
29+
In a Nix flake, use the provided overlay when importing nixpkgs to get access to tools like `purs` and `spago`. For example, the below flake creates a development shell with recent versions of the PureScript compiler and Spago package manager:
3130

3231
```nix
3332
{
@@ -98,4 +97,21 @@ nix shell github:thomashoneyman/purescript-overlay#purs github:thomashoneyman/pu
9897

9998
## Tests
10099

101-
You can run the repository tests using a combination of `nix eval .#lib` (to run the unit tests in Nix) and `nix flake check` (to run the derivation-based tests). Both are executed in CI.
100+
Run all checks locally:
101+
102+
```bash
103+
# Enter the dev shell
104+
nix develop
105+
106+
# Run generator tests
107+
cd generate
108+
npm ci
109+
spago test
110+
111+
# Verify manifests can be read correctly
112+
spago run -p bin -- verify ../manifests
113+
114+
# Check Nix formatting and package derivations
115+
cd ..
116+
nix flake check
117+
```

flake.lock

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

flake.nix

Lines changed: 3 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
inputs = {
55
nixpkgs.url = "github:nixos/nixpkgs/nixos-25.11";
66

7-
slimlock.url = "github:thomashoneyman/slimlock";
8-
slimlock.inputs.nixpkgs.follows = "nixpkgs";
9-
107
flake-compat.url = "github:edolstra/flake-compat";
118
flake-compat.flake = false;
129
};
@@ -15,7 +12,6 @@
1512
{
1613
self,
1714
nixpkgs,
18-
slimlock,
1915
...
2016
}:
2117
let
@@ -36,15 +32,10 @@
3632
inherit system;
3733
overlays = [
3834
self.overlays.default
39-
slimlock.overlays.default
4035
];
4136
};
4237
in
4338
{
44-
# A warning-free top-level flake output suitable for running unit tests via
45-
# e.g. `nix eval .#lib`.
46-
lib = pkgs.callPackage ./nix/tests { };
47-
4839
packages = {
4940
inherit (pkgs)
5041
purs
@@ -72,12 +63,8 @@
7263
program = "${bin}/bin/${bin.pname or bin.name}";
7364
meta = bin.meta or { };
7465
};
75-
apps = pkgs.lib.mapAttrs (_: mkApp) self.packages.${system};
76-
scripts = {
77-
generate = mkApp (pkgs.callPackage ./generate { });
78-
};
7966
in
80-
apps // scripts;
67+
pkgs.lib.mapAttrs (_: mkApp) self.packages.${system};
8168

8269
checks =
8370
let
@@ -133,23 +120,6 @@
133120
pkgs.lib.filterAttrs (k: v: !(k == "spago" && system == "aarch64-darwin")) self.packages.${system}
134121
);
135122

136-
example-checks = pkgs.callPackages ./nix/examples { };
137-
138-
script-checks = {
139-
generate =
140-
let
141-
bin = pkgs.callPackage ./generate { };
142-
manifests = ./manifests;
143-
in
144-
pkgs.runCommand "test-generate" { } ''
145-
mkdir -p $out/bin
146-
set -e
147-
set -x
148-
cp ${bin}/bin/${bin.name} $out/bin/test-generate
149-
${bin}/bin/${bin.name} verify ${manifests}
150-
'';
151-
};
152-
153123
format-checks = {
154124
nix-format =
155125
pkgs.runCommand "nix-format"
@@ -165,14 +135,13 @@
165135
'';
166136
};
167137
in
168-
package-checks // example-checks // script-checks // format-checks;
138+
package-checks // format-checks;
169139

170140
devShells = {
171141
default = pkgs.mkShell {
172142
name = "purescript-overlay";
173143
buildInputs = [
174-
# FIXME: Change when lockfile format stabilizes
175-
self.packages.${system}.spago-0_93_37
144+
self.packages.${system}.spago-unstable
176145
self.packages.${system}.purs-unstable
177146
self.packages.${system}.purs-tidy-unstable
178147
self.packages.${system}.purs-backend-es-unstable

generate/.spec-results

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
[
2+
[
3+
"Manifest Round-trips manifest fixtures",
4+
{
5+
"timestamp": "1765850793897.0",
6+
"success": true
7+
}
8+
]
9+
]

generate/README.md

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22

33
This directory holds a PureScript script that checks for new releases for tools supported in this repository and generates Nix files for them. It's intended to be run as a GitHub Action on a daily basis.
44

5+
## Development
6+
7+
Enter the development shell from the repository root:
8+
9+
```console
10+
nix develop
11+
```
12+
13+
Then run commands from this directory using `spago run`.
14+
515
## Commands
616

717
Supported commands:
@@ -11,43 +21,27 @@ Supported commands:
1121
Given a path to the manifests directory, verifies that the tool can properly read the manifests.
1222

1323
```console
14-
nix run .#generate verify ../manifests
24+
spago run -p bin -- verify ../manifests
1525
```
1626

1727
### Prefetch
1828

1929
Given a path to the manifests directory, looks up recent releases for the supported tools and prints releases that do not appear in the manifests. Does not actually write any information.
2030

2131
```console
22-
nix run .#generate prefetch ../manifests
32+
spago run -p bin -- prefetch ../manifests
2333
```
2434

2535
### Update
2636

2737
Given a path to the manifests directory, looks up recent releases for the supported tools and creates new manifests for releases that don't already appear in the list.
2838

2939
```console
30-
nix run .#generate update ../manifests
40+
spago run -p bin -- update ../manifests
3141
```
3242

3343
Optionally takes a flag `--commit` which will commit the changes and open a pull request against this repository. This command is only available to repository collaborators.
3444

3545
```console
36-
nix run .#generate -- update ../manifests --commit
46+
spago run -p bin -- update ../manifests --commit
3747
```
38-
39-
## Tools
40-
41-
The `purs` compiler is supported at versions going back to 0.13.0. It is built by fetching the tarballs the compiler team uploads to GitHub releases.
42-
43-
The `spago` build tool is supported for all versions implemented in PureScript (as of the time of writing, that's 0.93.4). It is built by associating a GitHub release with a commit SHA, then fetching the repo at that SHA and building its contents using `buildSpagoLock`.
44-
45-
#### Upcoming
46-
47-
I plan to support the rest of the standard PureScript build toolchain, namely `purs-tidy` and `purs-backend-es`. Both will be fetched the same way as Spago, except that (as of the time of writing) they do not have `spago.yaml` files. For this reason, the `generate` script will need to clone these packages, use spago@0.21.0 to run the `migrate` command, then switch to the new Spago to generate a lockfile with `--generate-lockfile`. Then, it can persist the generated `spago.yaml` and `spago.lock` files in a directory in this project so they can be used to build the project source.
48-
49-
Once these packages switch to the new-style Spago then this workaround will not be needed anymore.
50-
51-
## Development Notes
52-
53-
- If you want to open a pull request then you will need to either set the REPO_TOKEN environment variable to a GitHub token with access to the purescript-nix repository or create a .env file that sets REPO_TOKEN=valid-token. If you need to change the token then make sure to update the repository secrets as well.

generate/default.nix

Lines changed: 0 additions & 65 deletions
This file was deleted.

generate/lib/spago.yaml

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
package:
2-
name: lib
3-
dependencies:
4-
- aff-promise
5-
- argonaut-core
6-
- b64
7-
- codec-argonaut
8-
- effect
9-
- fetch
10-
- http-methods
11-
- node-execa
12-
- prelude
13-
- registry-lib
14-
test:
15-
main: Test.Lib
2+
name: lib
163
dependencies:
17-
- spec
18-
- debug
4+
- aff-promise
5+
- argonaut-core
6+
- b64
7+
- codec-argonaut
8+
- effect
9+
- fetch
10+
- http-methods
11+
- node-execa
12+
- prelude
13+
- registry-lib
14+
test:
15+
main: Test.Lib
16+
dependencies:
17+
- spec
18+
- spec-node
19+
- debug

0 commit comments

Comments
 (0)