-
Notifications
You must be signed in to change notification settings - Fork 1
/
flake.nix
56 lines (47 loc) · 1.52 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
{
description = "A tool that reads zpool statuses (especially health) and writes them to a directory in prometheus textfile format.";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
fenix.url = "github:nix-community/fenix";
fenix.inputs.nixpkgs.follows = "nixpkgs";
gitignore = {
url = "github:hercules-ci/gitignore.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = {
self,
nixpkgs,
flake-utils,
fenix,
gitignore,
...
}:
flake-utils.lib.eachDefaultSystem
(system: let
pkgs = import nixpkgs {inherit system;};
nativeBuildInputs = with pkgs; [pkg-config zfs.dev];
rustPlatform = pkgs.makeRustPlatform {
inherit (fenix.packages.${system}.stable) cargo rustc;
};
inherit (gitignore.lib) gitignoreSource;
in rec {
devShells.default = pkgs.mkShell {
inherit nativeBuildInputs;
};
formatter = pkgs.alejandra;
packages.zpool-exporter-textfile = rustPlatform.buildRustPackage rec {
pname = "zpool-exporter-textfile";
version = (builtins.fromTOML (builtins.readFile ./Cargo.toml)).package.version;
inherit nativeBuildInputs;
src = gitignoreSource ./.;
cargoLock.lockFile = ./Cargo.lock;
buildInputs = nativeBuildInputs;
};
defaultPackage = packages.zpool-exporter-textfile;
})
// {
nixosModules.zpool-exporter-textfile = import ./nixos {flake = self;};
};
}