-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
50 lines (42 loc) · 1.62 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
{
description = "map-accumulate";
inputs = { flake-utils.url = "github:numtide/flake-utils"; };
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
inherit (pkgs) lib stdenv;
src = lib.cleanSourceWith {
name = "map-accumulate-src";
filter = name: type:
let baseName = baseNameOf (toString name);
in (lib.cleanSourceFilter name type
&& !(lib.hasSuffix ".nix" baseName && isFile type)
&& !(lib.hasSuffix ".patch" baseName && isFile type));
src = pkgs.nix-gitignore.gitignoreRecursiveSource "" ./.;
};
# See the listing @ <https://github.com/NixOS/nixpkgs/blob/1e1396aafccff9378b8f3d0c686e277c226398cf/lib/sources.nix#L23-L26>
isFile = type: type == "regular";
# allow inspecting what the 'cleaned' source files consist of.
cleanedSrc = stdenv.mkDerivation {
inherit src;
name = "cleaned-source";
buildPhase = "";
installPhase = ''
mkdir -p $out
cp -r ./* $out
'';
};
in {
devShell = # used by `nix develop`
pkgs.mkShell {
name = "map-accumulate-devshell";
buildInputs = (with pkgs; [ nixfmt nodejs ])
++ (with pkgs.elmPackages; [ elm elm-format elm-json elm-test ]);
shellHook = ''
export PATH=$(git rev-parse --show-toplevel)/node_modules/.bin/:$PATH
'';
};
packages = { inherit cleanedSrc; };
});
}