78 lines
1.9 KiB
Nix
78 lines
1.9 KiB
Nix
{
|
|
description = "Rust-Nix";
|
|
|
|
inputs = {
|
|
flake-parts = {
|
|
url = "github:hercules-ci/flake-parts";
|
|
inputs.nixpkgs-lib.follows = "nixpkgs";
|
|
};
|
|
rust-overlay.url = "github:oxalica/rust-overlay";
|
|
crate2nix.url = "github:nix-community/crate2nix";
|
|
|
|
# Development
|
|
|
|
devshell = {
|
|
url = "github:numtide/devshell";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
};
|
|
|
|
nixConfig = {
|
|
allow-import-from-derivation = true;
|
|
};
|
|
|
|
outputs =
|
|
inputs @ { self
|
|
, nixpkgs
|
|
, flake-parts
|
|
, rust-overlay
|
|
, crate2nix
|
|
, ...
|
|
}: flake-parts.lib.mkFlake { inherit inputs; } {
|
|
systems = [
|
|
"x86_64-linux"
|
|
"aarch64-linux"
|
|
"x86_64-darwin"
|
|
"aarch64-darwin"
|
|
];
|
|
|
|
imports = [
|
|
./nix/rust-overlay/flake-module.nix
|
|
./nix/devshell/flake-module.nix
|
|
];
|
|
|
|
perSystem = { system, pkgs, lib, inputs', ... }:
|
|
let
|
|
# If you dislike IFD, you can also generate it with `crate2nix generate`
|
|
# on each dependency change and import it here with `import ./Cargo.nix`.
|
|
cargoNix = inputs.crate2nix.tools.${system}.appliedCargoNix {
|
|
name = "rustnix";
|
|
src = ./.;
|
|
};
|
|
in
|
|
rec {
|
|
checks = {
|
|
rustnix = cargoNix.rootCrate.build.override {
|
|
runTests = true;
|
|
};
|
|
};
|
|
|
|
packages = rec {
|
|
rustnix = cargoNix.rootCrate.build;
|
|
default = packages.rustnix;
|
|
dockerImage = pkgs.dockerTools.buildImage {
|
|
name = "lispers";
|
|
config = { Cmd = [ "${rustnix}/bin/lispers" ]; };
|
|
};
|
|
|
|
inherit (pkgs) rust-toolchain;
|
|
|
|
rust-toolchain-versions = pkgs.writeScriptBin "rust-toolchain-versions" ''
|
|
${pkgs.rust-toolchain}/bin/cargo --version
|
|
${pkgs.rust-toolchain}/bin/rustc --version
|
|
'';
|
|
};
|
|
};
|
|
};
|
|
}
|