purescript-httpurple/shell.nix

77 lines
2.0 KiB
Nix
Raw Normal View History

{ sources ? import ./sources.nix }:
2019-02-17 07:08:40 +00:00
let
niv-overlay = self: _: {
niv = self.symlinkJoin {
name = "niv";
paths = [ sources.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 sources.easy-purescript-nix { inherit pkgs; }) purescript purs-tidy spago;
};
pkgs = import sources.nixpkgs {
overlays = [
niv-overlay
2021-11-20 17:35:08 +00:00
easy-purescript-nix-overlay
];
};
build = pkgs.writeShellScriptBin "build" ''
if [ "$1" == "test" ]
then
spago -x test.dhall build
else
spago build
fi
'';
check = pkgs.writeShellScriptBin "check" "check-format && check-code";
check-code = pkgs.writeShellScriptBin "check-code" "spago -x test.dhall test";
check-format = pkgs.writeShellScriptBin "check-format" "purs-tidy check src test docs";
clean = pkgs.writeShellScriptBin "clean" "rm -rf output .psci_modules .spago";
docs = pkgs.writeShellScriptBin "docs" "spago docs";
example = pkgs.writeShellScriptBin "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 = pkgs.writeShellScriptBin "format" "purs-tidy format-in-place src test docs";
repl = pkgs.writeShellScriptBin "repl" "spago repl";
2019-02-17 07:08:40 +00:00
in
pkgs.mkShell {
buildInputs = [
pkgs.git
pkgs.niv
pkgs.nodePackages.bower
pkgs.nodePackages.pulp
2019-02-17 07:08:40 +00:00
pkgs.nodejs
pkgs.purescript
pkgs.purs-tidy
pkgs.spago
build
check
check-code
check-format
clean
docs
example
format
repl
2019-02-17 07:08:40 +00:00
];
shellHook = "export PATH=$PATH:$PWD/node_modules/.bin";
}