garage/flake.nix

75 lines
2.5 KiB
Nix
Raw Normal View History

2022-11-16 22:21:24 +01:00
{
description =
"Garage, an S3-compatible distributed object store for self-hosted deployments";
2022-11-16 22:21:24 +01:00
# Nixpkgs 24.11 as of 2025-01-12 has rustc v1.82
inputs.nixpkgs.url =
"github:NixOS/nixpkgs/7c4869c47090dd7f9f1bdfb49a22aea026996815";
inputs.flake-compat.url = "github:nix-community/flake-compat";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.crane.url = "github:ipetkov/crane";
inputs.rust-overlay.url = "github:oxalica/rust-overlay";
inputs.rust-overlay.inputs.nixpkgs.follows = "nixpkgs";
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;
in
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
packages =
let
packageFor = target: release: (compile {
inherit system git_version target nixpkgs crane rust-overlay release;
}).garage;
in
{
# default = native release build
default = packageFor null true;
# other = cross-compiled, statically-linked 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;
# non-optimized packages
dev = packageFor null false;
dev-amd64 = packageFor "x86_64-unknown-linux-musl" false;
dev-i386 = packageFor "i686-unknown-linux-musl" false;
dev-arm64 = packageFor "aarch64-unknown-linux-musl" false;
dev-arm = packageFor "armv6l-unknown-linux-musl" false;
};
# ---- developpment shell, for making native builds only ----
devShells =
let
targets = compile {
inherit system git_version nixpkgs crane rust-overlay;
};
in
{
default = targets.devShell;
# import the full shell using `nix develop .#full`
full = pkgs.mkShell {
buildInputs = with pkgs; [
targets.toolchain
# ---- extra packages for dev tasks ----
rust-analyzer
cargo-audit
cargo-outdated
cargo-machete
nixpkgs-fmt
];
};
};
2023-01-04 18:28:56 +01:00
});
2022-11-16 22:21:24 +01:00
}