-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
110 lines (104 loc) · 3.04 KB
/
flake.nix
File metadata and controls
110 lines (104 loc) · 3.04 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
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
git-hooks-nix = {
url = "github:cachix/git-hooks.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-parts = {
url = "github:hercules-ci/flake-parts";
inputs.nixpkgs-lib.follows = "nixpkgs";
};
systems.url = "github:nix-systems/default";
rust-flake = {
url = "github:juspay/rust-flake";
inputs.nixpkgs.follows = "nixpkgs";
};
treefmt-nix = {
url = "github:numtide/treefmt-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
inputs:
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
systems = import inputs.systems;
imports = [
inputs.rust-flake.flakeModules.default
inputs.rust-flake.flakeModules.nixpkgs
inputs.treefmt-nix.flakeModule
inputs.git-hooks-nix.flakeModule
];
perSystem =
{
self',
pkgs,
lib,
config,
...
}:
let
name = "qremote";
in
{
rust-project = {
src =
let
filterCargoSources =
path: type:
config.rust-project.crane-lib.filterCargoSources path type
&& !(lib.hasSuffix ".toml" path && !lib.hasSuffix "Cargo.toml" path);
in
lib.cleanSourceWith {
src = inputs.self;
filter = path: type: filterCargoSources path type || lib.hasInfix "assets/" path;
};
crates.${name}.crane.args = {
strictDeps = true;
buildInputs = with pkgs; [
pkg-config
];
nativeBuildInputs =
with pkgs;
[ pkg-config ]
++ (lib.optionals (!stdenv.isDarwin) [
(libxkbcommon.override { withWaylandTools = true; })
xdotool
]);
};
};
packages.default = self'.packages.qremote;
devShells.default = pkgs.mkShell {
name = "${name}-shell";
inputsFrom = [
self'.devShells.rust
config.treefmt.build.devShell
config.pre-commit.devShell
];
};
pre-commit = {
check.enable = true;
settings.hooks = {
cargo-check.enable = true;
clippy.enable = true;
treefmt.enable = true;
};
};
treefmt = {
projectRootFile = "rust-toolchain.toml"; # Used to find the project root
flakeCheck = false; # pre-commit-hooks checks this
programs = {
rustfmt = {
enable = true;
edition = "2024";
};
biome.enable = true;
mdformat.enable = true;
nixfmt.enable = true;
statix.enable = true;
taplo.enable = true;
};
};
};
};
}