domani/flake.nix

47 lines
1.2 KiB
Nix
Raw Normal View History

2023-05-03 07:58:06 +00:00
{
inputs = {
naersk.url = "github:nix-community/naersk/master";
2023-05-04 12:56:31 +00:00
nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.11";
2023-05-03 07:58:06 +00:00
utils.url = "github:numtide/flake-utils";
2023-05-08 16:25:51 +00:00
rust-overlay.url = "github:oxalica/rust-overlay";
2023-05-03 07:58:06 +00:00
};
2023-05-08 16:25:51 +00:00
outputs = { self, nixpkgs, utils, naersk, rust-overlay }:
2023-05-03 07:58:06 +00:00
utils.lib.eachDefaultSystem (system:
let
2023-05-08 16:25:51 +00:00
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;
};
2023-05-03 07:58:06 +00:00
in
{
2023-05-15 20:58:40 +00:00
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 {
2023-05-08 16:25:51 +00:00
nativeBuildInputs = [
toolchain
2023-05-15 20:58:40 +00:00
pkgs.glibc.static
2023-05-08 16:25:51 +00:00
];
2023-05-04 12:56:31 +00:00
shellHook = ''
2023-05-15 16:03:16 +00:00
source $(pwd)/.env.dev
2023-05-04 12:56:31 +00:00
export CARGO_HOME=$(pwd)/.cargo
'';
2023-05-03 07:58:06 +00:00
};
});
}