2022-11-16 22:21:24 +01:00
|
|
|
{
|
2023-01-26 12:20:12 +01:00
|
|
|
description =
|
|
|
|
"Garage, an S3-compatible distributed object store for self-hosted deployments";
|
2022-11-16 22:21:24 +01:00
|
|
|
|
2025-01-12 17:34:04 +01:00
|
|
|
# Nixpkgs 24.11 as of 2025-01-12 has rustc v1.82
|
2023-01-26 12:20:12 +01:00
|
|
|
inputs.nixpkgs.url =
|
2025-01-12 17:34:04 +01:00
|
|
|
"github:NixOS/nixpkgs/7c4869c47090dd7f9f1bdfb49a22aea026996815";
|
2023-04-25 14:46:47 +02:00
|
|
|
|
2023-07-16 12:38:08 +03:00
|
|
|
inputs.flake-compat.url = "github:nix-community/flake-compat";
|
|
|
|
|
2025-02-01 21:48:10 +01:00
|
|
|
inputs.flake-utils.url = "github:numtide/flake-utils";
|
2023-04-25 14:46:47 +02:00
|
|
|
|
2025-02-01 21:48:10 +01:00
|
|
|
inputs.crane.url = "github:ipetkov/crane";
|
2023-04-25 14:46:47 +02:00
|
|
|
|
2025-02-01 21:48:10 +01:00
|
|
|
inputs.rust-overlay.url = "github:oxalica/rust-overlay";
|
|
|
|
inputs.rust-overlay.inputs.nixpkgs.follows = "nixpkgs";
|
2025-01-12 18:16:23 +01:00
|
|
|
|
2025-02-01 21:48:10 +01:00
|
|
|
outputs = { self, nixpkgs, flake-utils, crane, rust-overlay, ... }:
|
2023-01-04 18:28:56 +01:00
|
|
|
let
|
|
|
|
git_version = self.lastModifiedDate;
|
|
|
|
compile = import ./nix/compile.nix;
|
2023-07-16 12:38:08 +03:00
|
|
|
in
|
|
|
|
flake-utils.lib.eachDefaultSystem (system:
|
2024-02-07 19:23:32 +01:00
|
|
|
let
|
|
|
|
pkgs = nixpkgs.legacyPackages.${system};
|
2025-02-02 20:25:57 +01:00
|
|
|
packageFor = target: release: (compile {
|
2025-02-02 19:52:41 +01:00
|
|
|
inherit system git_version target nixpkgs crane rust-overlay release;
|
2025-02-02 20:25:57 +01:00
|
|
|
}).garage;
|
2025-02-02 20:31:17 +01:00
|
|
|
testWith = extraTestEnv: (compile {
|
|
|
|
inherit system git_version nixpkgs crane rust-overlay extraTestEnv;
|
|
|
|
release = false;
|
|
|
|
}).garage-test;
|
2024-02-07 19:23:32 +01:00
|
|
|
in
|
|
|
|
{
|
2025-02-02 19:52:41 +01:00
|
|
|
packages = {
|
|
|
|
# default = native release build
|
|
|
|
default = packageFor null true;
|
|
|
|
|
|
|
|
# <arch> = cross-compiled, statically-linked release builds
|
|
|
|
amd64 = packageFor "x86_64-unknown-linux-musl" true;
|
|
|
|
i386 = packageFor "i686-unknown-linux-musl" true;
|
|
|
|
arm64 = packageFor "aarch64-unknown-linux-musl" true;
|
|
|
|
arm = packageFor "armv6l-unknown-linux-musl" true;
|
|
|
|
|
|
|
|
# dev = native dev build
|
|
|
|
dev = packageFor null false;
|
|
|
|
|
|
|
|
# test = cargo test
|
2025-02-02 20:31:17 +01:00
|
|
|
tests = testWith {};
|
|
|
|
tests-lmdb = testWith {
|
|
|
|
GARAGE_TEST_INTEGRATION_DB_ENGINE = "lmdb";
|
|
|
|
};
|
|
|
|
tests-sqlite = testWith {
|
|
|
|
GARAGE_TEST_INTEGRATION_DB_ENGINE = "sqlite";
|
|
|
|
};
|
2025-02-02 19:52:41 +01:00
|
|
|
};
|
2024-02-07 19:23:32 +01:00
|
|
|
|
|
|
|
# ---- developpment shell, for making native builds only ----
|
|
|
|
devShells =
|
|
|
|
let
|
2025-02-01 21:48:10 +01:00
|
|
|
targets = compile {
|
|
|
|
inherit system git_version nixpkgs crane rust-overlay;
|
|
|
|
};
|
2024-02-07 19:23:32 +01:00
|
|
|
in
|
|
|
|
{
|
2025-02-01 21:48:10 +01:00
|
|
|
default = targets.devShell;
|
2024-02-07 19:23:32 +01:00
|
|
|
|
|
|
|
# import the full shell using `nix develop .#full`
|
2025-02-01 21:48:10 +01:00
|
|
|
full = pkgs.mkShell {
|
|
|
|
buildInputs = with pkgs; [
|
|
|
|
targets.toolchain
|
|
|
|
# ---- extra packages for dev tasks ----
|
|
|
|
rust-analyzer
|
|
|
|
cargo-audit
|
|
|
|
cargo-outdated
|
|
|
|
cargo-machete
|
|
|
|
nixpkgs-fmt
|
|
|
|
];
|
|
|
|
};
|
2024-02-07 19:23:32 +01:00
|
|
|
};
|
2023-01-04 18:28:56 +01:00
|
|
|
});
|
2022-11-16 22:21:24 +01:00
|
|
|
}
|