-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathflake.nix
114 lines (89 loc) · 3.23 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
{
description = "syndicationd";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/release-23.11";
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
crane = {
url = "github:ipetkov/crane";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, fenix, crane, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem (system:
let
overlays = [ fenix.overlays.default ];
pkgs = import nixpkgs { inherit system overlays; };
rustToolchain = fenix.packages.${system}.fromToolchainFile {
file = ./rust-toolchain.toml;
# sha256 = pkgs.lib.fakeSha256;
sha256 = "sha256-SXRtAuO4IqNOQq+nLbrsDFbVk+3aVA8NNpSZsKlVH/8=";
};
craneLib = crane.lib.${system}.overrideToolchain rustToolchain;
src = craneLib.cleanCargoSource (craneLib.path ./.);
commonArgs = {
inherit src;
strictDeps = true;
# pname and version required, so set dummpy values
pname = "syndicationd-workspace";
version = "0.1";
builtInputs = [ ] ++ pkgs.lib.optionals pkgs.stdenv.isDarwin [ ];
};
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
syndtermCrate = craneLib.crateNameFromCargoToml {
cargoToml = ./syndterm/Cargo.toml;
};
syndterm = craneLib.buildPackage (commonArgs // {
inherit cargoArtifacts;
inherit (syndtermCrate) pname version;
cargoExtraArgs = "--package ${syndtermCrate.pname}";
});
syndapiCrate =
craneLib.crateNameFromCargoToml { cargoToml = ./syndapi/Cargo.toml; };
syndapi = craneLib.buildPackage (commonArgs // {
inherit cargoArtifacts;
inherit (syndapiCrate) pname version;
cargoExtraArgs = "--package ${syndapiCrate.pname}";
});
checks = {
inherit syndterm syndapi;
clippy = craneLib.cargoClippy (commonArgs // {
inherit cargoArtifacts;
cargoClippyExtraArgs = "--workspace -- --deny warnings";
});
nextest = craneLib.cargoNextest (commonArgs // {
inherit cargoArtifacts;
CARGO_PROFILE = "";
});
fmt = craneLib.cargoFmt commonArgs;
};
ci_packages = with pkgs; [
just
nushell # just set nu as shell
];
dev_packages = with pkgs;
[ cargo-nextest graphql-client nixfmt rust-analyzer ] ++ ci_packages;
in {
inherit checks;
packages.default = self.packages."${system}".syndterm;
packages.syndterm = syndterm;
packages.syndapi = syndapi;
apps.default = flake-utils.lib.mkApp { drv = syndterm; };
devShells.default = craneLib.devShell {
packages = dev_packages;
shellHook = ''
exec nu
'';
};
devShells.ci = craneLib.devShell { packages = ci_packages; };
});
nixConfig = {
extra-substituters = [ "https://syndicationd.cachix.org" ];
extra-trusted-public-keys = [
"syndicationd.cachix.org-1:qeH9C3xDqR831xEuDcfhGEUslMMjGroPPMOwiZfyiJQ="
];
};
}