heliwatch/flake.nix

60 lines
1.7 KiB
Nix
Raw Normal View History

2021-10-30 01:18:04 +02:00
{
inputs = {
utils.url = "github:numtide/flake-utils";
naersk.url = "github:nmattia/naersk";
mozillapkgs.url = "github:mozilla/nixpkgs-mozilla";
mozillapkgs.flake = false;
};
outputs = { self, nixpkgs, utils, naersk, mozillapkgs }:
utils.lib.eachDefaultSystem (system: let
pkgs = nixpkgs.legacyPackages."${system}";
mozilla = pkgs.callPackage (mozillapkgs + "/package-set.nix") {};
rust = (mozilla.rustChannelOf {
channel = "stable";
date = "2021-10-04";
sha256 = "0swglfa63i14fpgg98agx4b5sz0nckn6phacfy3k6imknsiv8mrg";
}).rust;
# Override the version used in naersk
naersk-lib = naersk.lib."${system}".override {
cargo = rust;
rustc = rust;
};
2021-11-08 23:32:39 +01:00
buildRustPackage = args: naersk-lib.buildPackage ({
2021-11-09 01:13:27 +01:00
src = ./.;
targets = [ args.pname ];
2021-10-30 01:18:04 +02:00
nativeBuildInputs = with pkgs; [ pkg-config ];
buildInputs = with pkgs; [ openssl ];
2021-11-08 23:32:39 +01:00
} // args);
in rec {
# `nix build`
packages.heliwatch = buildRustPackage {
pname = "heliwatch";
};
packages.http-json = buildRustPackage {
pname = "http-json";
};
packages.collectd-stats = buildRustPackage {
pname = "collectd-stats";
2021-10-30 01:18:04 +02:00
};
defaultPackage = packages.heliwatch;
2021-11-08 23:32:39 +01:00
checks = packages;
2021-10-30 01:18:04 +02:00
# `nix run`
apps.heliwatch = utils.lib.mkApp {
drv = packages.heliwatch;
};
defaultApp = apps.heliwatch;
# `nix develop`
devShell = pkgs.mkShell {
nativeBuildInputs = with defaultPackage;
nativeBuildInputs ++ buildInputs;
};
2021-10-30 01:59:17 +02:00
}) // {
2021-11-09 01:06:53 +01:00
nixosModules.heliwatch = import ./heliwatch/module.nix { inherit self; };
2021-10-30 01:59:17 +02:00
};
2021-10-30 01:18:04 +02:00
}