purescript-httpurple/shell.nix

85 lines
2.3 KiB
Nix
Raw Normal View History

{
sources ? import ./sources.nix,
nixpkgs ? sources.nixpkgs,
easy-purescript-nix ? sources.easy-purescript-nix,
niv ? sources.niv,
alejandra ? sources.alejandra,
}: let
niv-overlay = self: _: {
niv = self.symlinkJoin {
name = "niv";
paths = [niv];
buildInputs = [self.makeWrapper];
postBuild = ''
wrapProgram $out/bin/niv \
--add-flags "--sources-file ${toString ./sources.json}"
'';
};
};
2021-11-20 17:35:08 +00:00
easy-purescript-nix-overlay = pkgs: _: {
inherit (import easy-purescript-nix {inherit pkgs;}) purescript purs-tidy spago psa pulp-16_0_0-0;
};
alejandra-overlay = self: _: {
alejandra = (import alejandra)."${self.system}";
};
pkgs = import nixpkgs {
overlays = [
niv-overlay
2021-11-20 17:35:08 +00:00
easy-purescript-nix-overlay
alejandra-overlay
];
};
2019-02-17 07:08:40 +00:00
scripts = pkgs.symlinkJoin {
name = "scripts";
paths = pkgs.lib.mapAttrsToList pkgs.writeShellScriptBin {
build = "spago -x \${1:-spago}.dhall build";
check = "check-format && check-code && check-pulp";
check-code = "spago -x test.dhall test";
check-format = "check-format-purescript && check-format-nix";
check-format-nix = "alejandra --check *.nix";
check-format-purescript = "purs-tidy check src test docs";
check-pulp = "bower install && pulp build";
clean = "rm -rf output .psci_modules .spago";
example = ''
if [ "$1" ]
then
spago -x test.dhall run --main Examples.$1.Main
else
echo "Which example would you like to run?\n\nAvailable examples:"
ls -1 ./docs/Examples | cat -n
read -rp " > " out
if [ "$out" ]
then
$0 $(ls -1 ./docs/Examples | sed "''${out}q;d")
fi
fi
'';
format = "format-purescript && format-nix";
format-nix = "alejandra *.nix";
format-purescript = "purs-tidy format-in-place src test docs";
generate-bower = "spago bump-version patch --no-dry-run";
generate-docs = "spago docs";
repl = "spago repl";
};
};
in
pkgs.mkShell {
buildInputs = [
pkgs.alejandra
pkgs.git
pkgs.niv
pkgs.nodePackages.bower
pkgs.nodejs-16_x
pkgs.psa
pkgs.pulp-16_0_0-0
pkgs.purescript
pkgs.purs-tidy
pkgs.spago
scripts
];
}