-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
107 lines (94 loc) · 2.82 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
treefmt-nix = {
url = "github:numtide/treefmt-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
pre-commit-hooks = {
url = "github:cachix/git-hooks.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = {
self,
nixpkgs,
flake-utils,
treefmt-nix,
pre-commit-hooks,
}:
flake-utils.lib.eachSystem [flake-utils.lib.system.x86_64-linux] (
system:
with nixpkgs.legacyPackages.${system}; {
packages = {
rofi-cliphist = rustPlatform.buildRustPackage {
pname = "rofi-cliphist";
version = "0.3.0";
src = lib.cleanSource ./.;
cargoLock = {
lockFile = ./Cargo.lock;
};
meta = with lib; {
description = "Rofi extensions";
homepage = "https://github.com/szaffarano/rofi-cliphist";
license = licenses.mit;
mainProgram = "rofi-cliphist";
maintainers = [];
};
};
};
formatter = let
treefmt = treefmt-nix.lib.evalModule nixpkgs.legacyPackages.${system} ./treefmt.nix;
in
treefmt.config.build.wrapper;
packages.default = self.packages.${system}.rofi-cliphist;
checks = {
pre-commit-check = pre-commit-hooks.lib.${system}.run {
src = self;
hooks = {
alejandra.enable = true;
deadnix.enable = true;
end-of-file-fixer.enable = true;
markdownlint.enable = true;
mixed-line-endings.enable = true;
shfmt = {
enable = true;
entry = "${lib.getExe pkgs.shfmt} -w -l -s -i 2";
};
statix.enable = true;
trim-trailing-whitespace.enable = true;
};
};
};
devShells.default = mkShell {
inherit (self.checks.${pkgs.system}.pre-commit-check) shellHook;
inputsFrom = builtins.attrValues self.packages.${system};
packages = [
# rust
cargo-bloat
cargo-edit
cargo-info
cargo-outdated
cargo-udeps
cargo-watch
clippy
rust-analyzer
# rofi
rofi-wayland
cairo
pango
pkg-config
# tools
git
jq
curl
];
env = {
RUST_BACKTRACE = "1";
RUSTFLAGS = "--cfg rofi_next";
};
};
}
);
}