-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathflake.nix
77 lines (70 loc) · 2.1 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
{
inputs = {
utils.url = "github:numtide/flake-utils";
naersk.url = "github:nmattia/naersk";
naersk.inputs.nixpkgs.follows = "nixpkgs";
fenix.url = "github:nix-community/fenix";
fenix.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { self, nixpkgs, utils, naersk, fenix, }:
let
systems = [
"i686-linux"
"x86_64-linux"
#"armv6l-linux"
#"armv7l-linux"
"aarch64-linux"
#"riscv64-linux"
];
in utils.lib.eachSystem systems (system:
let
pkgs = nixpkgs.legacyPackages."${system}";
rust = fenix.packages.${system}.stable.withComponents [
"cargo"
"rustc"
"rustfmt"
"clippy"
];
# Override the version used in naersk
naersk-lib = naersk.lib."${system}".override {
cargo = rust;
rustc = rust;
};
in rec {
# `nix build`
packages.ifdyndnsd = naersk-lib.buildPackage {
pname = "ifdyndnsd";
src = ./.;
cargoTestCommands = x:
x ++ [
# clippy
''
cargo clippy --all --all-features --tests -- \
-D clippy::pedantic \
-D warnings \
-A clippy::await-holding-refcell-ref''
# rustfmt
"cargo fmt -- --check"
];
};
defaultPackage = packages.ifdyndnsd;
checks = packages;
# `nix run`
apps.ifdyndnsd = utils.lib.mkApp { drv = packages.ifdyndnsd; };
defaultApp = apps.ifdyndnsd;
# `nix develop`
devShell = pkgs.mkShell {
nativeBuildInputs = with defaultPackage;
nativeBuildInputs ++ buildInputs;
packages = with pkgs; [ cargo-edit rust-analyzer ];
};
}) // {
overlay = final: prev: { inherit (self.packages.${prev.stdenv.system}) ifdyndnsd; };
nixosModule = {
imports = [ ./nixos-module.nix ];
nixpkgs.overlays = [
self.overlay
];
};
};
}