-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
116 lines (96 loc) · 2.91 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
{
description = "Flake for Holochain app development";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs?ref=24.05";
flake-parts.url = "github:hercules-ci/flake-parts";
crane = {
url = "github:ipetkov/crane";
};
holonix = {
url = "github:holochain/holonix?ref=main-0.3";
};
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
advisory-db = {
url = "github:rustsec/advisory-db";
flake = false;
};
};
outputs =
inputs@{ flake-parts
, crane
, fenix
, advisory-db
, ...
}:
flake-parts.lib.mkFlake { inherit inputs; } {
systems = builtins.attrNames inputs.holonix.devShells;
perSystem =
{ inputs'
, config
, pkgs
, system
, lib
, ...
}:
let
craneLib = crane.lib.${system};
src = craneLib.cleanCargoSource (craneLib.path ./checked_cli);
checkedCliCrateInfo = craneLib.crateNameFromCargoToml { cargoToml = ./checked_cli/Cargo.toml; };
# Common arguments can be set here to avoid repeating them later
commonArgs = {
pname = checkedCliCrateInfo.pname;
version = checkedCliCrateInfo.version;
inherit src;
strictDeps = true;
};
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
checkedCli = craneLib.buildPackage (commonArgs // {
inherit cargoArtifacts;
});
in
{
formatter = pkgs.nixpkgs-fmt;
checks = {
inherit checkedCli;
checkedCliClippy = craneLib.cargoClippy (commonArgs // {
inherit cargoArtifacts;
cargoClippyExtraArgs = "--all-targets -- --deny warnings";
});
checkedCliDoc = craneLib.cargoDoc (commonArgs // {
inherit cargoArtifacts;
});
checkedCliFmt = craneLib.cargoFmt (commonArgs // {
inherit src;
});
# Multiple packages failing through Holochain dependencies...
# checkedCliAudit = craneLib.cargoAudit {
# inherit src advisory-db;
# };
};
packages = {
default = checkedCli;
};
apps.default = checkedCli;
devShells.default = pkgs.mkShell {
packages = (with inputs'.holonix.packages; [
holochain
lair-keystore
hc-launch
hc-scaffold
hn-introspect
rust
]) ++ (with pkgs; [
nodejs_22
minisign
libsodium
go
upx # For binary size optimisation. Not currently working with `checked_cli`, try again later
binaryen # For wasm-opt, optimising wasms before packaging
]);
};
};
};
}