I have a flake which includes a package which has submodules
its a buildRustPackage but it doesn’t seem to grab submodules. here is my flake
# flake.nix
{
inputs = {
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "nixpkgs/nixpkgs-unstable";
naersk.url = "github:nmattia/naersk";
};
outputs = { self, fenix, flake-utils, nixpkgs, naersk,}:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system} // { inherit (fenix.packages.${system}.latest) cargo rustc rust-src; };
inherit (pkgs) lib stdenv;
package = with pkgs; (makeRustPlatform { inherit (pkgs) rustc cargo; }).buildRustPackage rec {
pname = "wezterm";
nativeBuildInputs = pkgs.wezterm.nativeBuildInputs;
buildInputs = pkgs.wezterm.buildInputs;
cargoSha256 = "sha256-dVf0044Q+6dMw9BitxXAt0JLO6A0A68wmhagLvHMuzA";
src = ./.;
version = "HEAD";
postInstall = ''
mkdir -p $terminfo/share/terminfo/w $out/nix-support
tic -x -o $terminfo/share/terminfo termwiz/data/wezterm.terminfo
echo "$terminfo" >> $out/nix-support/propagated-user-env-packages
'';
outputs = [ "out" "terminfo" ];
postPatch = ''
echo ${version} > .tag
'';
preFixup = lib.optionalString stdenv.isLinux ''
for artifact in wezterm wezterm-gui wezterm-mux-server strip-ansi-escapes; do
patchelf --set-rpath "${lib.makeLibraryPath buildInputs}" $out/bin/$artifact
done
'' + lib.optionalString stdenv.isDarwin ''
mkdir -p "$out/Applications"
OUT_APP="$out/Applications/WezTerm.app"
cp -r assets/macos/WezTerm.app "$OUT_APP"
rm $OUT_APP/*.dylib
cp -r assets/shell-integration/* "$OUT_APP"
ln -s $out/bin/{wezterm,wezterm-mux-server,wezterm-gui,strip-ansi-escapes} "$OUT_APP"
'';
# prevent further changes to the RPATH
dontPatchELF = true;
};
# package = (pkgs.makeRustPlatform {
# inherit (fenix.packages.${system}.latest) cargo rustc rust-src;
# }).buildRustPackage rec { };
in
rec {
devShell = pkgs.mkShell {
inherit (defaultPackage) nativeBuildInputs;
buildInputs = with pkgs; [ rust-analyzer rustfmt ] ++ defaultPackage.buildInputs;
RUST_SRC_PATH = "${pkgs.rust-src}/lib/rustlib/src/rust/library";
};
defaultPackage = package;
});
}