-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathflake.nix
More file actions
98 lines (89 loc) · 2.26 KB
/
flake.nix
File metadata and controls
98 lines (89 loc) · 2.26 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
{
description = "sunsetr: Automatic blue light filter for Wayland";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{
self,
nixpkgs,
rust-overlay,
}:
let
supportedSystems = [ "x86_64-linux" ];
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
pkgsFor =
system:
import nixpkgs {
inherit system;
overlays = [ (import rust-overlay) ];
};
makePackage =
system:
let
pkgs = pkgsFor system;
rustToolchain = pkgs.rust-bin.stable.latest.default;
in
pkgs.rustPlatform.buildRustPackage {
pname = "sunsetr";
version =
let
pkgVer = (builtins.fromTOML (builtins.readFile ./Cargo.toml)).package.version;
commit = self.shortRev or "dev";
in
"${pkgVer}-${commit}";
src = pkgs.lib.fileset.toSource {
root = ./.;
fileset = pkgs.lib.fileset.unions [
./src
./tests
./Cargo.toml
./Cargo.lock
./README.md
];
};
cargoLock = {
lockFile = ./Cargo.lock;
allowBuiltinFetchGit = true;
};
nativeBuildInputs = [
rustToolchain
pkgs.pkg-config
];
buildInputs = [ ];
doCheck = true;
};
in
{
packages = forAllSystems (system: {
sunsetr = makePackage system;
default = makePackage system;
});
checks = forAllSystems (system: {
default = makePackage system;
});
devShells = forAllSystems (
system:
let
pkgs = pkgsFor system;
rustToolchain = pkgs.rust-bin.stable.latest.default;
in
{
default = pkgs.mkShell {
packages = [
rustToolchain
pkgs.cargo-nextest
pkgs.cargo-edit
pkgs.rustfmt
pkgs.clippy
];
nativeBuildInputs = [ pkgs.pkg-config ];
};
}
);
};
}