garnet/flake.nix
yuri.meister d9921b3bcf Build Rust crate with Nix via crane sub-flake
Move Rust build into its own flake at rust/flake.nix using crane, and
reference it as an input from the top-level flake. The Haskell build
gets the Rust artifacts (header + static lib) via a haskell.nix
override that symlinks them into place before configure.

Use Cabal's Cgarnet_rs naming convention for extra-bundled-libraries
to satisfy the shared library install phase naming requirements.

Also extract inputs.nix, default.nix, and shell.nix for flake-compat
(nix-build / nix-shell) support.
2026-03-25 16:29:32 +09:00

34 lines
1.3 KiB
Nix

{
inputs = {
nix-haskell.url = "github:reflex-frp/nix-haskell";
flake-compat.follows = "nix-haskell/flake-compat";
nixpkgs.follows = "nix-haskell/nixpkgs";
hls-src = { url = "github:haskell/haskell-language-server/2.13.0.0"; flake = false; };
hs-bindgen-src = { url = "github:well-typed/hs-bindgen/6ca94188abd756a1fb4dd8a4037de3fa7dca0765"; flake = false; };
libclang-src = { url = "github:well-typed/libclang/d6e482df49b88375cf3075928a78ee86c2a068d4"; flake = false; };
flake-utils.url = "github:numtide/flake-utils";
garnet-rs.url = "path:./rust";
garnet-rs.inputs.nix-haskell.follows = "nix-haskell";
garnet-rs.inputs.flake-utils.follows = "flake-utils";
};
outputs = inputs@{ self, nixpkgs, nix-haskell, ... }:
inputs.flake-utils.lib.eachSystem [ "x86_64-linux" ] (system:
let garnet-rs = inputs.garnet-rs.packages.${system}.default;
project = import ./default.nix { inherit system inputs garnet-rs; };
in rec {
defaultPackage = packages.garnet-exe;
packages = rec {
inherit garnet-rs;
garnet = project.hsPkgs.garnet;
garnet-exe = garnet.components.exes.garnet;
garnet-lib = garnet.components.library;
};
devShells.default = import ./shell.nix { inherit system inputs; };
}
);
}