-
-
Notifications
You must be signed in to change notification settings - Fork 7
/
flake.nix
71 lines (68 loc) · 1.83 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
{
description =
"qrscan - Scan a QR code in the terminal using the system camera or a given image";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs";
nix.url = "github:domenkozar/nix/relaxed-flakes";
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
};
outputs = { self, nixpkgs, nix, ... }:
let
systems = [
"x86_64-linux"
"i686-linux"
"x86_64-darwin"
"aarch64-linux"
"aarch64-darwin"
];
forAllSystems = f:
builtins.listToAttrs (map
(name: {
inherit name;
value = f name;
})
systems);
in
{
packages = forAllSystems (system:
let pkgs = import nixpkgs { inherit system; };
in
{
qrscan = pkgs.rustPlatform.buildRustPackage rec {
name = "qrscan";
src = ./.;
cargoLock = { lockFile = ./Cargo.lock; };
nativeBuildInputs = [ pkgs.rustPlatform.bindgenHook ];
doCheck = false; # No access to internet
};
});
defaultPackage = forAllSystems (system: self.packages.${system}.qrscan);
devShells = forAllSystems (system:
let
pkgs = import nixpkgs { inherit system; };
devRequirements = with pkgs; [
gcc
gnumake
clippy
cargo
rustc
rustfmt
rust-analyzer
openssl
pkg-config
];
in
{
default = pkgs.mkShell {
RUST_BACKTRACE = 1;
LIBCLANG_PATH = "${pkgs.llvmPackages.libclang.lib}/lib";
buildInputs = devRequirements;
packages = devRequirements;
nativeBuildInputs = [ pkgs.rustPlatform.bindgenHook ];
};
});
};
}