nixConfig/packages/flake-module.nix

29 lines
1.3 KiB
Nix

{inputs, ...}: {
perSystem = {
pkgs,
system,
self',
...
}: {
# We build the alias to sieve tool here, this is a two step process, we first generate
# a nix expression with the crate2nix tool from nixpkgs that directly calls rustc
# and thus bypasses cargo. We could also generate this file by hand and version it,
# but that would need regeneration every time some dependency is updated, so we
# opt for build time generation. Afterwards we import and evaluate the generated
# nix expression to build the package. For the explicit solution see:
# https://nix-community.github.io/crate2nix/00_guides/30_generating/
# and for the documentation to this one
# https://nix-community.github.io/crate2nix/00_guides/31_auto_generating/
# as this module uses idf and forces builds during the evaluation it might
# have drastic performance implications, see
# https://nix.dev/manual/nix/2.24/language/import-from-derivation
packages.alias-to-sieve = let
alias-to-sieve-nix = inputs.crate2nix.tools.${system}.generatedCargoNix {
name = "alias-to-sieve";
src = ./alias-to-sieve;
};
in
(pkgs.callPackage alias-to-sieve-nix {}).rootCrate.build;
checks.alias-to-sieve = self'.packages.alias-to-sieve.override {runTests = true;};
};
}