-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathflake.nix
100 lines (96 loc) · 2.9 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
systems.url = "github:nix-systems/default";
flake-parts.url = "github:hercules-ci/flake-parts";
treefmt-nix = {
url = "github:numtide/treefmt-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
inputs@{
flake-parts,
systems,
...
}:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = import systems;
imports = [
inputs.treefmt-nix.flakeModule
];
perSystem =
{
pkgs,
lib,
config,
...
}:
{
treefmt = {
projectRootFile = "flake.nix";
programs = {
prettier = {
enable = true;
excludes = [
"CHANGELOG.md"
];
};
nixfmt.enable = true;
};
};
checks = {
inherit (config.packages) arguebuf;
};
packages = {
default = config.packages.arguebuf;
arguebuf =
let
npmDeps = pkgs.importNpmLock {
npmRoot = ./.;
};
in
pkgs.buildNpmPackage {
inherit npmDeps;
inherit (npmDeps) pname version;
inherit (pkgs.importNpmLock) npmConfigHook;
src = ./.;
checkPhase = ''
runHook preCheck
${lib.getExe config.packages.link-arguebase}
npm run check
runHook postCheck
'';
meta = with lib; {
description = "Create and analyze argument graphs and serialize them via Protobuf";
license = licenses.mit;
maintainers = with maintainers; [ mirkolenz ];
homepage = "https://github.com/recap-utr/arguebuf-typescript";
};
};
arguebase = pkgs.fetchFromGitHub {
owner = "recap-utr";
repo = "arguebase-public";
rev = "468f32818cebe90a837427f4e5f471463159b637";
hash = "sha256-dF5vJBxVG4qJr+9ZJje27HXU1B+UmP9uzPh+ERUnRsg=";
};
link-arguebase = pkgs.writeShellScriptBin "link-arguebase" ''
mkdir -p data
rm -f data/arguebase
ln -sf ${config.packages.arguebase} data/arguebase
'';
release-env = pkgs.buildEnv {
name = "release-env";
paths = with pkgs; [ nodejs ];
};
};
devShells.default = pkgs.mkShell {
shellHook = ''
${lib.getExe' pkgs.nodejs "npm"} install
${lib.getExe config.packages.link-arguebase}
'';
packages = with pkgs; [ nodejs ];
};
};
};
}