rec { version = "1.0.0"; package = { pkgsNix, buildSystem, hostSystem, }: let hostSystemTarget = builtins.getAttr hostSystem { "x86_64-linux" = "x86_64-unknown-linux-musl"; "aarch64-linux" = "aarch64-unknown-linux-musl"; "i686-linux" = "i686-unknown-linux-musl"; "armv6l-linux" = "armv6l-unknown-linux-musleabihf"; }; pkgs = pkgsNix.default { inherit buildSystem hostSystem; }; src = pkgs.applyPatches { name = "garage-v${version}-patched"; src = builtins.fetchGit { name = "garage-v${version}"; url = "https://git.deuxfleurs.fr/Deuxfleurs/garage.git"; rev = "ff093ddbb8485409f389abe7b5e569cb38d222d2"; }; patches = [ ./common-nix-system.patch ]; }; common = (import "${src}/nix/common.nix") { system = buildSystem; }; compile = (import "${src}/nix/compile.nix") { system = buildSystem; target = hostSystemTarget; pkgsSrc = pkgsNix.src; cargo2nixOverlay = common.cargo2nixOverlay; release = true; git_version = version; # subset of the default release features, as defined in: # https://git.deuxfleurs.fr/Deuxfleurs/garage/src/commit/ff093ddbb8485409f389abe7b5e569cb38d222d2/nix/compile.nix#L171 features = [ "garage/bundled-libs" "garage/lmdb" "garage/sqlite" "garage/metrics" "garage/syslog" ]; }; in compile.workspace.garage { compileMode = "build"; }; }