nix_for_rustaceans/examples/nci/flake.nix

46 lines
1.2 KiB
Nix
Raw Normal View History

2024-07-09 20:55:42 +02:00
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nci = {
url = "github:yusdacra/nix-cargo-integration";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-parts = {
url = "github:hercules-ci/flake-parts";
inputs.nixpkgs-lib.follows = "nixpkgs";
};
};
outputs =
inputs@{ flake-parts, nci, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
2024-07-11 13:49:04 +02:00
systems = [
"x86_64-linux"
"aarch64-linux"
"aarch64-darwin"
"x86_64-darwin"
];
2024-07-09 20:55:42 +02:00
imports = [
nci.flakeModule
./crates.nix
];
perSystem =
{ pkgs, config, ... }:
let
crateName = "my-crate";
crateOutputs = config.nci.outputs.${crateName};
in
{
devShells.default = crateOutputs.devShell;
packages.default = crateOutputs.packages.release;
packages.container = pkgs.dockerTools.streamLayeredImage {
name = crateName;
tag = "latest";
contents = [ ];
config = {
Cmd = [ "${crateOutputs.packages.release}/bin/my-crate" ];
};
};
};
};
}