Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add purs-versions script to list supported registry versions #628

Merged
merged 2 commits into from
Jul 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions app/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
writeText,
nodejs,
compilers,
purs-versions,
dhall,
dhall-json,
git,
Expand Down Expand Up @@ -76,7 +77,7 @@ in {
'';
postFixup = ''
wrapProgram $out/bin/${name} \
--set PATH ${lib.makeBinPath [compilers dhall dhall-json licensee git coreutils gzip gnutar]}
--set PATH ${lib.makeBinPath [compilers purs-versions dhall dhall-json licensee git coreutils gzip gnutar]}
'';
};

Expand Down Expand Up @@ -109,7 +110,7 @@ in {
'';
postFixup = ''
wrapProgram $out/bin/${name} \
--set PATH ${lib.makeBinPath [compilers dhall dhall-json licensee git coreutils gzip gnutar]}
--set PATH ${lib.makeBinPath [compilers purs-versions dhall dhall-json licensee git coreutils gzip gnutar]}
'';
};
}
24 changes: 14 additions & 10 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -71,28 +71,31 @@
#
# To add a new compiler to the list, just update the flake:
# $ nix flake update
compilers = let
# Only include the compiler at normal MAJOR.MINOR.PATCH versions.
stableOnly =
prev.lib.filterAttrs (name: _: (builtins.match "^purs-[0-9]+_[0-9]+_[0-9]+$" name != null))
prev.purs-bin;
in
supportedCompilers = prev.lib.filterAttrs (name: _: (builtins.match "^purs-[0-9]+_[0-9]+_[0-9]+$" name != null)) prev.purs-bin;

# An attrset containing all the PureScript binaries we want to make
# available.
compilers =
prev.symlinkJoin {
name = "purs-compilers";
paths = prev.lib.mapAttrsToList (name: drv:
prev.writeShellScriptBin name ''
exec ${drv}/bin/purs "$@"
'')
stableOnly;
supportedCompilers;
};

purs-versions = prev.writeShellScriptBin "purs-versions" ''
echo ${prev.lib.concatMapStringsSep " " (x: prev.lib.removePrefix "purs-" (builtins.replaceStrings ["_"] ["."] x)) (prev.lib.attrNames supportedCompilers)}
'';
in {
apps = prev.callPackages ./app {
inherit compilers package-lock spago-lock;
inherit compilers purs-versions package-lock spago-lock;
};
scripts = prev.callPackages ./scripts {
inherit compilers package-lock spago-lock;
inherit compilers purs-versions package-lock spago-lock;
};
inherit compilers package-lock spago-lock;
inherit purs-versions compilers package-lock spago-lock;
};
};
in
Expand Down Expand Up @@ -278,6 +281,7 @@
packages = with pkgs; [
# All stable PureScript compilers
registry.compilers
registry.purs-versions

# TODO: Hacky, remove when I can run spago test in a pure env
run-tests-script
Expand Down
3 changes: 2 additions & 1 deletion scripts/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
nodejs,
writeText,
compilers,
purs-versions,
dhall,
dhall-json,
licensee,
Expand Down Expand Up @@ -48,7 +49,7 @@
'';
postFixup = ''
wrapProgram $out/bin/${name} \
--set PATH ${lib.makeBinPath [ compilers dhall dhall-json licensee git coreutils gzip gnutar ]}
--set PATH ${lib.makeBinPath [ compilers purs-versions dhall dhall-json licensee git coreutils gzip gnutar ]}
'';
};
in {
Expand Down