domani/flake.nix
2023-05-15 22:58:40 +02:00

47 lines
1.2 KiB
Nix

{
inputs = {
naersk.url = "github:nix-community/naersk/master";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.11";
utils.url = "github:numtide/flake-utils";
rust-overlay.url = "github:oxalica/rust-overlay";
};
outputs = { self, nixpkgs, utils, naersk, rust-overlay }:
utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ (import rust-overlay) ];
};
toolchain = pkgs.rust-bin.fromRustupToolchainFile ./rust-toolchain.toml;
naersk-lib = pkgs.callPackage naersk {
cargo = toolchain;
rustc = toolchain;
};
in
{
defaultPackage = naersk-lib.buildPackage {
src = ./.;
doCheck = false;
nativeBuildInputs = [ pkgs.pkgsStatic.stdenv.cc ];
CARGO_BUILD_TARGET = "x86_64-unknown-linux-musl";
CARGO_BUILD_RUSTFLAGS = "-C target-feature=+crt-static";
};
devShell = pkgs.mkShell {
nativeBuildInputs = [
toolchain
pkgs.glibc.static
];
shellHook = ''
source $(pwd)/.env.dev
export CARGO_HOME=$(pwd)/.cargo
'';
};
});
}