-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathflake.nix
47 lines (41 loc) · 1.55 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
{
description = "backpressure-queue";
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 = "backpressure-queue-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 = "backpressure-queue-devshell";
buildInputs = with pkgs; [ nixfmt nodejs ];
shellHook = ''
export PATH=$(git rev-parse --show-toplevel)/node_modules/.bin/:$PATH
'';
};
packages = { inherit cleanedSrc; };
});
}