-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
126 lines (117 loc) · 3.2 KB
/
flake.nix
File metadata and controls
126 lines (117 loc) · 3.2 KB
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
117
118
119
120
121
122
123
124
125
126
{
description = "GitPulse – a TUI dashboard for monitoring git repository status";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
crane.url = "github:ipetkov/crane";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{
self,
nixpkgs,
crane,
rust-overlay,
...
}:
let
systems = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
forAllSystems = fn: nixpkgs.lib.genAttrs systems fn;
mkPkgs = system:
import nixpkgs {
inherit system;
overlays = [ rust-overlay.overlays.default ];
};
mkCraneLib = pkgs:
let
toolchain = pkgs.rust-bin.stable.latest.minimal.override {
extensions = [ "clippy" ];
};
in
(crane.mkLib pkgs).overrideToolchain toolchain;
in
{
packages = forAllSystems (system:
let
pkgs = mkPkgs system;
craneLib = mkCraneLib pkgs;
src = craneLib.cleanCargoSource ./.;
commonArgs = {
inherit src;
pname = "gitocular";
strictDeps = true;
nativeCheckInputs = [ pkgs.git ];
};
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
gitocular = craneLib.buildPackage (commonArgs // {
inherit cargoArtifacts;
meta = {
description = "A TUI dashboard for monitoring git repository status";
homepage = "https://github.com/krfl/gitocular";
license = pkgs.lib.licenses.asl20;
mainProgram = "gitocular";
};
});
in
{
default = gitocular;
inherit gitocular;
}
);
checks = forAllSystems (system:
let
pkgs = mkPkgs system;
craneLib = mkCraneLib pkgs;
src = craneLib.cleanCargoSource ./.;
commonArgs = {
inherit src;
pname = "gitocular";
strictDeps = true;
nativeCheckInputs = [ pkgs.git ];
};
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
in
{
gitocular = self.packages.${system}.default;
gitocular-clippy = craneLib.cargoClippy (commonArgs // {
inherit cargoArtifacts;
cargoClippyExtraArgs = "--workspace -- -D warnings";
});
gitocular-tests = craneLib.cargoTest (commonArgs // {
inherit cargoArtifacts;
});
}
);
devShells = forAllSystems (system:
let
pkgs = mkPkgs system;
toolchain = pkgs.rust-bin.stable.latest.default.override {
extensions = [
"rust-src"
"rust-analyzer"
"clippy"
];
};
in
{
default = pkgs.mkShell {
packages = [
toolchain
pkgs.cargo-watch
pkgs.git
];
};
}
);
overlays.default = final: _prev: {
gitocular = self.packages.${final.system}.default;
};
};
}