Wer knattert denn da schon wieder? xmpp:luftraum@chat.c3d2.de?join
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
heliwatch/flake.nix

70 lines
1.9 KiB

{
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, fenix, naersk }:
utils.lib.eachSystem (with utils.lib.system; [ x86_64-linux aarch64-linux ]) (system: let
pkgs = nixpkgs.legacyPackages."${system}";
rust = fenix.packages.${system}.stable.withComponents [
"cargo"
"rustc"
"rust-src" # just for rust-analyzer
"clippy"
];
# Override the version used in naersk
naersk-lib = naersk.lib."${system}".override {
cargo = rust;
rustc = rust;
};
buildRustPackage = args: naersk-lib.buildPackage ({
src = ./.;
targets = [ args.pname ];
cargoBuildOptions = opts: opts ++ [ "-p" args.pname ];
nativeBuildInputs = with pkgs; [ pkg-config ];
buildInputs = with pkgs; [ openssl ];
} // args);
in rec {
# `nix build`
packages.heliwatch = buildRustPackage {
pname = "heliwatch";
};
packages.http-json = buildRustPackage {
pname = "http-json";
};
packages.collectd-stats = buildRustPackage {
pname = "collectd-stats";
};
defaultPackage = packages.heliwatch;
checks = packages;
# `nix run`
apps.heliwatch = utils.lib.mkApp {
drv = packages.heliwatch;
};
defaultApp = apps.heliwatch;
# `nix develop`
devShell = pkgs.mkShell {
nativeBuildInputs = [
fenix.packages.${system}.rust-analyzer
] ++ (with defaultPackage;
nativeBuildInputs ++ buildInputs
);
};
}) // {
overlay = final: prev: {
heliwatch = self.packages.${prev.system};
};
nixosModules.heliwatch = import ./heliwatch/module.nix { inherit self; };
};
}