Commit a2556465 authored by Alexandre Delanoë's avatar Alexandre Delanoë

Merge branch 'build-with-nix' of...

Merge branch 'build-with-nix' of ssh://gitlab.iscpif.fr:20022/gargantext/purescript-gargantext into dev
parents 943ab04f 42f42477
This diff is collapsed.
import (
builtins.fetchTarball {
url = "https://github.com/nixos/nixpkgs/archive/ece829033b7b8f4e81261fef5427144df4147bc4.tar.gz";
sha256 = "07n91k3d9i9pym8npsszha9mnvg4d1r0l0ldnhk4g8sx15vv1br5";
}
)
This diff is collapsed.
{ pkgs ? import ./pinned.nix {} }:
let
easy-ps = import (
pkgs.fetchFromGitHub {
owner = "justinwoo";
repo = "easy-purescript-nix";
rev = "14e7d85431e9f9838d7107d18cb79c7fa534f54e";
sha256 = "0lmkppidmhnayv0919990ifdd61f9d23dzjzr8amz7hjgc74yxs0";
}
) {
inherit pkgs;
};
soba = import (
pkgs.fetchFromGitHub {
owner = "justinwoo";
repo = "soba";
rev = "2add8804bce7e7c1ab5eb1c3d8f6783e938a04d3";
sha256 = "1qagyklcllr2sxdb315prw33af6g37762zgk2ahh3ifxpns6ifxx";
}
) {
inherit pkgs;
};
purs-packages = import ./purs-packages.nix { inherit pkgs; };
cpPackage = pp:
let
target = ".psc-package/local/${pp.name}/${pp.version}";
in
''
mkdir -p ${target}
cp --no-preserve=mode,ownership,timestamp -r ${pp.fetched.outPath}/* ${target}
'';
install-purs-packages = pkgs.writeShellScriptBin "install-purs-packages" ''
#!/usr/bin/env bash
${builtins.toString (builtins.map cpPackage (builtins.attrValues purs-packages))}
echo done installing deps.
'';
build-purs = pkgs.writeShellScriptBin "build-purs" ''
#!/usr/bin/env bash
purs compile "src/**/*.purs" ".psc-package/*/*/*/src/**/*.purs"
'';
storePath = x: ''"${x.fetched.outPath}/src/**/*.purs"'';
build-purs-from-store = pkgs.writeShellScriptBin "build-purs-from-store" ''
#!/usr/bin/env bash
purs compile "src/**/*.purs" \
${builtins.toString (builtins.map storePath (builtins.attrValues purs-packages))}
'';
in
pkgs.mkShell {
buildInputs = [
easy-ps.purs
easy-ps.psc-package
soba
install-purs-packages
build-purs
build-purs-from-store
pkgs.yarn
];
}
## how to build the project with nix dependencies:
#
# 1. start a nix shell (e.g. `nix-shell -j 20`, this uses 20 jobs to fetch deps)
# 2. run `yarn` to install npm deps
# 3. run `install-purs-packages` if you want dependencies locally, available for psc-package and for inspection
# 4. run `build-purs` to build from local sources. otherwise use `build-purs-from-store`.
#
# note that the purescript compiler uses filepaths and timestamps, so using the above two commands
# interchangeably will lead to constant rebuilding of the entire project.
#
## how to update purs-packages.nix
#
# 1. run `soba insdhall` to generate packages.json
# 2. run `soba nix` to generate a nix derivation from packages.json
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment