nix: update default.nix and shell.nix with new crane build

This commit is contained in:
Alex 2025-02-02 19:55:18 +01:00
parent 6b727dc6c1
commit bcaced807a
3 changed files with 23 additions and 43 deletions

View file

@ -1,48 +1,28 @@
{ system ? builtins.currentSystem, git_version ? null, }: { system ? builtins.currentSystem, git_version ? "unknown", }:
with import ./nix/common.nix; with import ./nix/common.nix;
let let
pkgs = import pkgsSrc { }; pkgs = import nixpkgs { };
compile = import ./nix/compile.nix; compile = import ./nix/compile.nix;
build_debug_and_release = (target: { compileWith = args: compile ({
debug = (compile { inherit system git_version nixpkgs;
inherit system target git_version pkgsSrc cargo2nixOverlay; crane = flake.inputs.crane;
release = false; rust-overlay = flake.inputs.rust-overlay;
}).workspace.garage { compileMode = "build"; }; } // args);
release = (compile { build_release = target: (compile {
inherit system target git_version pkgsSrc cargo2nixOverlay; inherit target;
release = true; release = true;
}).workspace.garage { compileMode = "build"; }; }).garage;
});
test = (rustPkgs:
pkgs.symlinkJoin {
name = "garage-tests";
paths =
builtins.map (key: rustPkgs.workspace.${key} { compileMode = "test"; })
(builtins.attrNames rustPkgs.workspace);
});
in { in {
pkgs = { releasePackages = {
amd64 = build_debug_and_release "x86_64-unknown-linux-musl"; amd64 = build_release "x86_64-unknown-linux-musl";
i386 = build_debug_and_release "i686-unknown-linux-musl"; i386 = build_release "i686-unknown-linux-musl";
arm64 = build_debug_and_release "aarch64-unknown-linux-musl"; arm64 = build_release "aarch64-unknown-linux-musl";
arm = build_debug_and_release "armv6l-unknown-linux-musleabihf"; arm = build_release "armv6l-unknown-linux-musleabihf";
};
test = {
amd64 = test (compile {
inherit system git_version pkgsSrc cargo2nixOverlay;
target = "x86_64-unknown-linux-musl";
features = [
"garage/bundled-libs"
"garage/k2v"
"garage/lmdb"
"garage/sqlite"
];
});
}; };
flakePackages = flake.packages.${system};
} }

View file

@ -10,9 +10,9 @@ let
flake = (import flake-compat { system = builtins.currentSystem; src = ../.; }); flake = (import flake-compat { system = builtins.currentSystem; src = ../.; });
in in
rec {
pkgsSrc = flake.defaultNix.inputs.nixpkgs; {
cargo2nix = flake.defaultNix.inputs.cargo2nix; flake = flake.defaultNix;
cargo2nixOverlay = cargo2nix.overlays.default; nixpkgs = flake.defaultNix.inputs.nixpkgs;
devShells = builtins.getAttr builtins.currentSystem flake.defaultNix.devShells; devShells = flake.defaultNix.devShells.${builtins.currentSystem};
} }

View file

@ -3,7 +3,7 @@
with import ./nix/common.nix; with import ./nix/common.nix;
let let
pkgs = import pkgsSrc { pkgs = import nixpkgs {
inherit system; inherit system;
}; };
winscp = (import ./nix/winscp.nix) pkgs; winscp = (import ./nix/winscp.nix) pkgs;