-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
101 lines (88 loc) · 2.25 KB
/
flake.nix
File metadata and controls
101 lines (88 loc) · 2.25 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
{
inputs = {
nixpkgs = {
url = "github:NixOS/nixpkgs/nixos-unstable";
};
flake-parts = {
url = "github:hercules-ci/flake-parts";
};
crane = {
url = "github:ipetkov/crane";
};
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs = {
nixpkgs = {
follows = "nixpkgs";
};
};
};
};
outputs = {
self,
nixpkgs,
flake-parts,
crane,
rust-overlay,
...
} @ inputs: let
system = "x86_64-linux";
pkgs = import nixpkgs {
inherit system;
overlays = [(import rust-overlay)];
};
rustToolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
craneLib = (crane.mkLib pkgs).overrideToolchain rustToolchain;
hyprhook = pkgs.callPackage ./nix/package.nix {inherit craneLib;};
inherit (hyprhook.passthru) src commonArgs cargoArtifacts;
in
flake-parts.lib.mkFlake {inherit inputs;} {
systems = [system];
flake = {
nixosModules = rec {
hyprhook = import ./nix/module.nix self;
default = hyprhook;
};
};
perSystem = {
config,
system,
...
}: {
formatter = pkgs.alejandra;
checks = {
fmt = craneLib.cargoFmt {inherit src;};
clippy = craneLib.cargoClippy (
commonArgs
// {
inherit cargoArtifacts;
cargoClippyExtraArgs = "--all-targets -- --deny warnings";
}
);
};
packages = {
default = hyprhook;
inherit hyprhook;
};
devShells.default = craneLib.devShell {
checks = self.checks.${system};
nativeBuildInputs = with pkgs; [
rust-analyzer
cargo-watch
];
RUST_SRC_PATH = "${rustToolchain}/lib/rustlib/src/rust/library";
RUST_BACKTRACE = 1;
};
};
};
nixConfig = {
extra-substituters = [
"https://nix-community.cachix.org"
"https://clemenscodes.cachix.org"
];
extra-trusted-public-keys = [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"clemenscodes.cachix.org-1:yEwW1YgttL2xdsyfFDz/vv8zZRhRGMeDQsKKmtV1N18="
];
};
}