-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
63 lines (56 loc) · 1.74 KB
/
Copy pathflake.nix
File metadata and controls
63 lines (56 loc) · 1.74 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
{
description = "plugkill - hardware kill-switch daemon that shuts down the system on device changes (USB, Thunderbolt, SD card, power, network, lid)";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = {
self,
nixpkgs,
flake-utils,
}:
flake-utils.lib.eachSystem
[
"x86_64-linux"
"aarch64-linux"
]
(
system: let
pkgs = nixpkgs.legacyPackages.${system};
in {
packages.default = pkgs.rustPlatform.buildRustPackage {
pname = "plugkill";
version = (builtins.fromTOML (builtins.readFile ./crates/plugkill/Cargo.toml)).package.version;
src = pkgs.lib.cleanSource ./.;
cargoHash = "sha256-v5KEq5rd1Hwe1r3/PBlfQX85Gc7RMTfyuuB895w7aVw=";
# Integration tests require /sys/bus/usb/devices which is unavailable in the Nix sandbox
checkFlags = [
"--skip=test_list_devices_no_root"
"--skip=test_generate_whitelist_no_root"
];
meta = {
description = "Hardware kill-switch daemon -- shuts down the system when device changes are detected";
license = pkgs.lib.licenses.gpl3Plus;
platforms = [
"x86_64-linux"
"aarch64-linux"
];
mainProgram = "plugkill";
};
};
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
cargo
rustc
rust-analyzer
clippy
rustfmt
];
};
}
)
// {
nixosModules.default = import ./nix/module.nix self;
nixosModules.relay = import ./nix/relay-module.nix self;
};
}