-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathflake.nix
83 lines (67 loc) · 2.3 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
{
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}";
});
checks = {
inherit syndterm;
clippy = craneLib.cargoClippy (commonArgs // {
inherit cargoArtifacts;
cargoClippyExtraArgs = "--workspace -- --deny warnings";
});
fmt = craneLib.cargoFmt commonArgs;
};
in {
inherit checks;
packages.default = self.packages."${system}".syndterm;
packages.syndterm = syndterm;
devShells.default = craneLib.devShell {
packages = with pkgs; [
# cargo and rustc provided by default
just
cargo-nextest
graphql-client
nixfmt
rust-analyzer
];
};
});
}