update toolchain #924
9 changed files with 52 additions and 134 deletions
|
@ -16,7 +16,7 @@ steps:
|
||||||
- name: build
|
- name: build
|
||||||
image: nixpkgs/nix:nixos-22.05
|
image: nixpkgs/nix:nixos-22.05
|
||||||
commands:
|
commands:
|
||||||
- nix-build --no-build-output --attr clippy.amd64 --argstr git_version ${CI_COMMIT_TAG:-$CI_COMMIT_SHA}
|
- nix-build --no-build-output --attr pkgs.amd64.debug --argstr git_version ${CI_COMMIT_TAG:-$CI_COMMIT_SHA}
|
||||||
|
|
||||||
- name: unit + func tests
|
- name: unit + func tests
|
||||||
image: nixpkgs/nix:nixos-22.05
|
image: nixpkgs/nix:nixos-22.05
|
||||||
|
@ -24,7 +24,7 @@ steps:
|
||||||
GARAGE_TEST_INTEGRATION_EXE: result-bin/bin/garage
|
GARAGE_TEST_INTEGRATION_EXE: result-bin/bin/garage
|
||||||
GARAGE_TEST_INTEGRATION_PATH: tmp-garage-integration
|
GARAGE_TEST_INTEGRATION_PATH: tmp-garage-integration
|
||||||
commands:
|
commands:
|
||||||
- nix-build --no-build-output --attr clippy.amd64 --argstr git_version ${CI_COMMIT_TAG:-$CI_COMMIT_SHA}
|
- nix-build --no-build-output --attr pkgs.amd64.debug --argstr git_version ${CI_COMMIT_TAG:-$CI_COMMIT_SHA}
|
||||||
- nix-build --no-build-output --attr test.amd64
|
- nix-build --no-build-output --attr test.amd64
|
||||||
- ./result/bin/garage_db-*
|
- ./result/bin/garage_db-*
|
||||||
- ./result/bin/garage_api-*
|
- ./result/bin/garage_api-*
|
||||||
|
@ -43,5 +43,5 @@ steps:
|
||||||
- name: integration tests
|
- name: integration tests
|
||||||
image: nixpkgs/nix:nixos-22.05
|
image: nixpkgs/nix:nixos-22.05
|
||||||
commands:
|
commands:
|
||||||
- nix-build --no-build-output --attr clippy.amd64 --argstr git_version ${CI_COMMIT_TAG:-$CI_COMMIT_SHA}
|
- nix-build --no-build-output --attr pkgs.amd64.debug --argstr git_version ${CI_COMMIT_TAG:-$CI_COMMIT_SHA}
|
||||||
- nix-shell --attr ci --run ./script/test-smoke.sh || (cat /tmp/garage.log; false)
|
- nix-shell --attr ci --run ./script/test-smoke.sh || (cat /tmp/garage.log; false)
|
||||||
|
|
27
Cargo.nix
27
Cargo.nix
|
@ -25,6 +25,7 @@ args@{
|
||||||
target ? null,
|
target ? null,
|
||||||
codegenOpts ? null,
|
codegenOpts ? null,
|
||||||
profileOpts ? null,
|
profileOpts ? null,
|
||||||
|
cargoUnstableFlags ? null,
|
||||||
rustcLinkFlags ? null,
|
rustcLinkFlags ? null,
|
||||||
rustcBuildFlags ? null,
|
rustcBuildFlags ? null,
|
||||||
mkRustCrate,
|
mkRustCrate,
|
||||||
|
@ -51,7 +52,7 @@ else let
|
||||||
rootFeatures' = expandFeatures rootFeatures;
|
rootFeatures' = expandFeatures rootFeatures;
|
||||||
overridableMkRustCrate = f:
|
overridableMkRustCrate = f:
|
||||||
let
|
let
|
||||||
drvs = genDrvsByProfile profilesByName ({ profile, profileName }: mkRustCrate ({ inherit release profile hostPlatformCpu hostPlatformFeatures target profileOpts codegenOpts rustcLinkFlags rustcBuildFlags; } // (f profileName)));
|
drvs = genDrvsByProfile profilesByName ({ profile, profileName }: mkRustCrate ({ inherit release profile hostPlatformCpu hostPlatformFeatures target profileOpts codegenOpts cargoUnstableFlags rustcLinkFlags rustcBuildFlags; } // (f profileName)));
|
||||||
in { compileMode ? null, profileName ? decideProfile compileMode release }:
|
in { compileMode ? null, profileName ? decideProfile compileMode release }:
|
||||||
let drv = drvs.${profileName}; in if compileMode == null then drv else drv.override { inherit compileMode; };
|
let drv = drvs.${profileName}; in if compileMode == null then drv else drv.override { inherit compileMode; };
|
||||||
in
|
in
|
||||||
|
@ -1756,7 +1757,7 @@ in
|
||||||
name = "format_table";
|
name = "format_table";
|
||||||
version = "0.1.1";
|
version = "0.1.1";
|
||||||
registry = "unknown";
|
registry = "unknown";
|
||||||
src = fetchCrateLocal (workspaceSrc + "/src/format-table");
|
src = fetchCrateLocal workspaceSrc;
|
||||||
});
|
});
|
||||||
|
|
||||||
"registry+https://github.com/rust-lang/crates.io-index".futures."0.3.30" = overridableMkRustCrate (profileName: rec {
|
"registry+https://github.com/rust-lang/crates.io-index".futures."0.3.30" = overridableMkRustCrate (profileName: rec {
|
||||||
|
@ -1914,7 +1915,7 @@ in
|
||||||
name = "garage";
|
name = "garage";
|
||||||
version = "1.0.1";
|
version = "1.0.1";
|
||||||
registry = "unknown";
|
registry = "unknown";
|
||||||
src = fetchCrateLocal (workspaceSrc + "/src/garage");
|
src = fetchCrateLocal workspaceSrc;
|
||||||
features = builtins.concatLists [
|
features = builtins.concatLists [
|
||||||
(lib.optional (rootFeatures' ? "garage/bundled-libs" || rootFeatures' ? "garage/default") "bundled-libs")
|
(lib.optional (rootFeatures' ? "garage/bundled-libs" || rootFeatures' ? "garage/default") "bundled-libs")
|
||||||
(lib.optional (rootFeatures' ? "garage/consul-discovery") "consul-discovery")
|
(lib.optional (rootFeatures' ? "garage/consul-discovery") "consul-discovery")
|
||||||
|
@ -1992,7 +1993,7 @@ in
|
||||||
name = "garage_api";
|
name = "garage_api";
|
||||||
version = "1.0.1";
|
version = "1.0.1";
|
||||||
registry = "unknown";
|
registry = "unknown";
|
||||||
src = fetchCrateLocal (workspaceSrc + "/src/api");
|
src = fetchCrateLocal workspaceSrc;
|
||||||
features = builtins.concatLists [
|
features = builtins.concatLists [
|
||||||
(lib.optional (rootFeatures' ? "garage/default" || rootFeatures' ? "garage/k2v" || rootFeatures' ? "garage_api/k2v") "k2v")
|
(lib.optional (rootFeatures' ? "garage/default" || rootFeatures' ? "garage/k2v" || rootFeatures' ? "garage_api/k2v") "k2v")
|
||||||
(lib.optional (rootFeatures' ? "garage/default" || rootFeatures' ? "garage/metrics" || rootFeatures' ? "garage_api/metrics") "metrics")
|
(lib.optional (rootFeatures' ? "garage/default" || rootFeatures' ? "garage/metrics" || rootFeatures' ? "garage_api/metrics") "metrics")
|
||||||
|
@ -2056,7 +2057,7 @@ in
|
||||||
name = "garage_block";
|
name = "garage_block";
|
||||||
version = "1.0.1";
|
version = "1.0.1";
|
||||||
registry = "unknown";
|
registry = "unknown";
|
||||||
src = fetchCrateLocal (workspaceSrc + "/src/block");
|
src = fetchCrateLocal workspaceSrc;
|
||||||
features = builtins.concatLists [
|
features = builtins.concatLists [
|
||||||
(lib.optional (rootFeatures' ? "garage/system-libs" || rootFeatures' ? "garage_block/system-libs") "system-libs")
|
(lib.optional (rootFeatures' ? "garage/system-libs" || rootFeatures' ? "garage_block/system-libs") "system-libs")
|
||||||
];
|
];
|
||||||
|
@ -2089,7 +2090,7 @@ in
|
||||||
name = "garage_db";
|
name = "garage_db";
|
||||||
version = "1.0.1";
|
version = "1.0.1";
|
||||||
registry = "unknown";
|
registry = "unknown";
|
||||||
src = fetchCrateLocal (workspaceSrc + "/src/db");
|
src = fetchCrateLocal workspaceSrc;
|
||||||
features = builtins.concatLists [
|
features = builtins.concatLists [
|
||||||
(lib.optional (rootFeatures' ? "garage/bundled-libs" || rootFeatures' ? "garage/default" || rootFeatures' ? "garage_db/bundled-libs") "bundled-libs")
|
(lib.optional (rootFeatures' ? "garage/bundled-libs" || rootFeatures' ? "garage/default" || rootFeatures' ? "garage_db/bundled-libs") "bundled-libs")
|
||||||
(lib.optional (rootFeatures' ? "garage_db/default") "default")
|
(lib.optional (rootFeatures' ? "garage_db/default") "default")
|
||||||
|
@ -2118,7 +2119,7 @@ in
|
||||||
name = "garage_model";
|
name = "garage_model";
|
||||||
version = "1.0.1";
|
version = "1.0.1";
|
||||||
registry = "unknown";
|
registry = "unknown";
|
||||||
src = fetchCrateLocal (workspaceSrc + "/src/model");
|
src = fetchCrateLocal workspaceSrc;
|
||||||
features = builtins.concatLists [
|
features = builtins.concatLists [
|
||||||
(lib.optional (rootFeatures' ? "garage_model/default") "default")
|
(lib.optional (rootFeatures' ? "garage_model/default") "default")
|
||||||
(lib.optional (rootFeatures' ? "garage/default" || rootFeatures' ? "garage/k2v" || rootFeatures' ? "garage_api/k2v" || rootFeatures' ? "garage_model/k2v") "k2v")
|
(lib.optional (rootFeatures' ? "garage/default" || rootFeatures' ? "garage/k2v" || rootFeatures' ? "garage_api/k2v" || rootFeatures' ? "garage_model/k2v") "k2v")
|
||||||
|
@ -2157,7 +2158,7 @@ in
|
||||||
name = "garage_net";
|
name = "garage_net";
|
||||||
version = "1.0.1";
|
version = "1.0.1";
|
||||||
registry = "unknown";
|
registry = "unknown";
|
||||||
src = fetchCrateLocal (workspaceSrc + "/src/net");
|
src = fetchCrateLocal workspaceSrc;
|
||||||
features = builtins.concatLists [
|
features = builtins.concatLists [
|
||||||
[ "default" ]
|
[ "default" ]
|
||||||
(lib.optional (rootFeatures' ? "garage_net/opentelemetry" || rootFeatures' ? "garage_net/telemetry") "opentelemetry")
|
(lib.optional (rootFeatures' ? "garage_net/opentelemetry" || rootFeatures' ? "garage_net/telemetry") "opentelemetry")
|
||||||
|
@ -2194,7 +2195,7 @@ in
|
||||||
name = "garage_rpc";
|
name = "garage_rpc";
|
||||||
version = "1.0.1";
|
version = "1.0.1";
|
||||||
registry = "unknown";
|
registry = "unknown";
|
||||||
src = fetchCrateLocal (workspaceSrc + "/src/rpc");
|
src = fetchCrateLocal workspaceSrc;
|
||||||
features = builtins.concatLists [
|
features = builtins.concatLists [
|
||||||
(lib.optional (rootFeatures' ? "garage/consul-discovery" || rootFeatures' ? "garage_rpc/consul-discovery") "consul-discovery")
|
(lib.optional (rootFeatures' ? "garage/consul-discovery" || rootFeatures' ? "garage_rpc/consul-discovery") "consul-discovery")
|
||||||
(lib.optional (rootFeatures' ? "garage/consul-discovery" || rootFeatures' ? "garage_rpc/consul-discovery" || rootFeatures' ? "garage_rpc/err-derive") "err-derive")
|
(lib.optional (rootFeatures' ? "garage/consul-discovery" || rootFeatures' ? "garage_rpc/consul-discovery" || rootFeatures' ? "garage_rpc/err-derive") "err-derive")
|
||||||
|
@ -2243,7 +2244,7 @@ in
|
||||||
name = "garage_table";
|
name = "garage_table";
|
||||||
version = "1.0.1";
|
version = "1.0.1";
|
||||||
registry = "unknown";
|
registry = "unknown";
|
||||||
src = fetchCrateLocal (workspaceSrc + "/src/table");
|
src = fetchCrateLocal workspaceSrc;
|
||||||
dependencies = {
|
dependencies = {
|
||||||
arc_swap = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".arc-swap."1.6.0" { inherit profileName; }).out;
|
arc_swap = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".arc-swap."1.6.0" { inherit profileName; }).out;
|
||||||
async_trait = (buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".async-trait."0.1.77" { profileName = "__noProfile"; }).out;
|
async_trait = (buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".async-trait."0.1.77" { profileName = "__noProfile"; }).out;
|
||||||
|
@ -2268,7 +2269,7 @@ in
|
||||||
name = "garage_util";
|
name = "garage_util";
|
||||||
version = "1.0.1";
|
version = "1.0.1";
|
||||||
registry = "unknown";
|
registry = "unknown";
|
||||||
src = fetchCrateLocal (workspaceSrc + "/src/util");
|
src = fetchCrateLocal workspaceSrc;
|
||||||
features = builtins.concatLists [
|
features = builtins.concatLists [
|
||||||
(lib.optional (rootFeatures' ? "garage/default" || rootFeatures' ? "garage/k2v" || rootFeatures' ? "garage_api/k2v" || rootFeatures' ? "garage_model/k2v" || rootFeatures' ? "garage_util/k2v") "k2v")
|
(lib.optional (rootFeatures' ? "garage/default" || rootFeatures' ? "garage/k2v" || rootFeatures' ? "garage_api/k2v" || rootFeatures' ? "garage_model/k2v" || rootFeatures' ? "garage_util/k2v") "k2v")
|
||||||
];
|
];
|
||||||
|
@ -2312,7 +2313,7 @@ in
|
||||||
name = "garage_web";
|
name = "garage_web";
|
||||||
version = "1.0.1";
|
version = "1.0.1";
|
||||||
registry = "unknown";
|
registry = "unknown";
|
||||||
src = fetchCrateLocal (workspaceSrc + "/src/web");
|
src = fetchCrateLocal workspaceSrc;
|
||||||
dependencies = {
|
dependencies = {
|
||||||
err_derive = (buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".err-derive."0.3.1" { profileName = "__noProfile"; }).out;
|
err_derive = (buildRustPackages."registry+https://github.com/rust-lang/crates.io-index".err-derive."0.3.1" { profileName = "__noProfile"; }).out;
|
||||||
futures = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures."0.3.30" { inherit profileName; }).out;
|
futures = (rustPackages."registry+https://github.com/rust-lang/crates.io-index".futures."0.3.30" { inherit profileName; }).out;
|
||||||
|
@ -3148,7 +3149,7 @@ in
|
||||||
name = "k2v-client";
|
name = "k2v-client";
|
||||||
version = "0.0.4";
|
version = "0.0.4";
|
||||||
registry = "unknown";
|
registry = "unknown";
|
||||||
src = fetchCrateLocal (workspaceSrc + "/src/k2v-client");
|
src = fetchCrateLocal workspaceSrc;
|
||||||
features = builtins.concatLists [
|
features = builtins.concatLists [
|
||||||
(lib.optional (rootFeatures' ? "k2v-client/clap" || rootFeatures' ? "k2v-client/cli") "clap")
|
(lib.optional (rootFeatures' ? "k2v-client/clap" || rootFeatures' ? "k2v-client/cli") "clap")
|
||||||
(lib.optional (rootFeatures' ? "k2v-client/cli") "cli")
|
(lib.optional (rootFeatures' ? "k2v-client/cli") "cli")
|
||||||
|
|
|
@ -45,11 +45,4 @@ in {
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
clippy = {
|
|
||||||
amd64 = (compile {
|
|
||||||
inherit system git_version pkgsSrc cargo2nixOverlay;
|
|
||||||
target = "x86_64-unknown-linux-musl";
|
|
||||||
compiler = "clippy";
|
|
||||||
}).workspace.garage { compileMode = "build"; };
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
28
flake.lock
28
flake.lock
|
@ -12,17 +12,17 @@
|
||||||
"rust-overlay": "rust-overlay"
|
"rust-overlay": "rust-overlay"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1666087781,
|
"lastModified": 1705129117,
|
||||||
"narHash": "sha256-trKVdjMZ8mNkGfLcY5LsJJGtdV3xJDZnMVrkFjErlcs=",
|
"narHash": "sha256-LgdDHibvimzYhxBK3kxCk2gAL7k4Hyigl5KI0X9cijA=",
|
||||||
"owner": "Alexis211",
|
"owner": "cargo2nix",
|
||||||
"repo": "cargo2nix",
|
"repo": "cargo2nix",
|
||||||
"rev": "a7a61179b66054904ef6a195d8da736eaaa06c36",
|
"rev": "ae19a9e1f8f0880c088ea155ab66cee1fa001f59",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "Alexis211",
|
"owner": "cargo2nix",
|
||||||
"repo": "cargo2nix",
|
"repo": "cargo2nix",
|
||||||
"rev": "a7a61179b66054904ef6a195d8da736eaaa06c36",
|
"rev": "ae19a9e1f8f0880c088ea155ab66cee1fa001f59",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -58,17 +58,17 @@
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1724681257,
|
"lastModified": 1736692550,
|
||||||
"narHash": "sha256-EJRuc5Qp7yfXko5ZNeEMYAs4DzAvkCyALuJ/tGllhN4=",
|
"narHash": "sha256-7tk8xH+g0sJkKLTJFOxphJxxOjMDFMWv24nXslaU2ro=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "0239aeb2f82ea27ccd6b61582b8f7fb8750eeada",
|
"rev": "7c4869c47090dd7f9f1bdfb49a22aea026996815",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "0239aeb2f82ea27ccd6b61582b8f7fb8750eeada",
|
"rev": "7c4869c47090dd7f9f1bdfb49a22aea026996815",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -91,17 +91,17 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1724638882,
|
"lastModified": 1736649126,
|
||||||
"narHash": "sha256-ap2jIQi/FuUHR6HCht6ASWhoz8EiB99XmI8Esot38VE=",
|
"narHash": "sha256-XCw5sv/ePsroqiF3lJM6Y2X9EhPdHeE47gr3Q8b0UQw=",
|
||||||
"owner": "oxalica",
|
"owner": "oxalica",
|
||||||
"repo": "rust-overlay",
|
"repo": "rust-overlay",
|
||||||
"rev": "19b70f147b9c67a759e35824b241f1ed92e46694",
|
"rev": "162ab0edc2936508470199b2e8e6c444a2535019",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "oxalica",
|
"owner": "oxalica",
|
||||||
"repo": "rust-overlay",
|
"repo": "rust-overlay",
|
||||||
"rev": "19b70f147b9c67a759e35824b241f1ed92e46694",
|
"rev": "162ab0edc2936508470199b2e8e6c444a2535019",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
13
flake.nix
13
flake.nix
|
@ -2,24 +2,27 @@
|
||||||
description =
|
description =
|
||||||
"Garage, an S3-compatible distributed object store for self-hosted deployments";
|
"Garage, an S3-compatible distributed object store for self-hosted deployments";
|
||||||
|
|
||||||
# Nixpkgs 24.05 as of 2024-08-26 has rustc v1.77
|
# Nixpkgs 24.11 as of 2025-01-12 has rustc v1.82
|
||||||
inputs.nixpkgs.url =
|
inputs.nixpkgs.url =
|
||||||
"github:NixOS/nixpkgs/0239aeb2f82ea27ccd6b61582b8f7fb8750eeada";
|
"github:NixOS/nixpkgs/7c4869c47090dd7f9f1bdfb49a22aea026996815";
|
||||||
|
|
||||||
inputs.flake-compat.url = "github:nix-community/flake-compat";
|
inputs.flake-compat.url = "github:nix-community/flake-compat";
|
||||||
|
|
||||||
inputs.cargo2nix = {
|
inputs.cargo2nix = {
|
||||||
# As of 2022-10-18: two small patches over unstable branch, one for clippy and one to fix feature detection
|
# As of 2022-10-18: two small patches over unstable branch, one for clippy and one to fix feature detection
|
||||||
url = "github:Alexis211/cargo2nix/a7a61179b66054904ef6a195d8da736eaaa06c36";
|
#url = "github:Alexis211/cargo2nix/a7a61179b66054904ef6a195d8da736eaaa06c36";
|
||||||
|
|
||||||
# As of 2023-04-25:
|
# As of 2023-04-25:
|
||||||
# - my two patches were merged into unstable (one for clippy and one to "fix" feature detection)
|
# - my two patches were merged into unstable (one for clippy and one to "fix" feature detection)
|
||||||
# - rustc v1.66
|
# - rustc v1.66
|
||||||
# url = "github:cargo2nix/cargo2nix/8fb57a670f7993bfc24099c33eb9c5abb51f29a2";
|
# url = "github:cargo2nix/cargo2nix/8fb57a670f7993bfc24099c33eb9c5abb51f29a2";
|
||||||
|
|
||||||
# Rust overlay as of 2024-08-26
|
# Mainline cargo2nix as of of 2025-01-12 (branch release-0.11.0)
|
||||||
|
url = "github:cargo2nix/cargo2nix/ae19a9e1f8f0880c088ea155ab66cee1fa001f59";
|
||||||
|
|
||||||
|
# Rust overlay as of 2025-01-12
|
||||||
inputs.rust-overlay.url =
|
inputs.rust-overlay.url =
|
||||||
"github:oxalica/rust-overlay/19b70f147b9c67a759e35824b241f1ed92e46694";
|
"github:oxalica/rust-overlay/162ab0edc2936508470199b2e8e6c444a2535019";
|
||||||
|
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
inputs.flake-compat.follows = "flake-compat";
|
inputs.flake-compat.follows = "flake-compat";
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{ system, target ? null, pkgsSrc, cargo2nixOverlay, compiler ? "rustc"
|
{ system, target ? null, pkgsSrc, cargo2nixOverlay
|
||||||
, release ? false, git_version ? null, features ? null, }:
|
, release ? false, git_version ? null, features ? null, }:
|
||||||
|
|
||||||
let
|
let
|
||||||
|
@ -20,24 +20,10 @@ let
|
||||||
};
|
};
|
||||||
|
|
||||||
toolchainOptions = {
|
toolchainOptions = {
|
||||||
rustVersion = "1.77.0";
|
rustVersion = "1.78.0";
|
||||||
extraRustComponents = [ "clippy" ];
|
extraRustComponents = [ "clippy" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
buildEnv = (drv:
|
|
||||||
{
|
|
||||||
rustc = drv.setBuildEnv;
|
|
||||||
clippy = ''
|
|
||||||
${drv.setBuildEnv or ""}
|
|
||||||
echo
|
|
||||||
echo --- BUILDING WITH CLIPPY ---
|
|
||||||
echo
|
|
||||||
|
|
||||||
export NIX_RUST_BUILD_FLAGS="''${NIX_RUST_BUILD_FLAGS} --deny warnings"
|
|
||||||
export RUSTC="''${CLIPPY_DRIVER}"
|
|
||||||
'';
|
|
||||||
}.${compiler});
|
|
||||||
|
|
||||||
/* Cargo2nix provides many overrides by default, you can take inspiration from them:
|
/* Cargo2nix provides many overrides by default, you can take inspiration from them:
|
||||||
https://github.com/cargo2nix/cargo2nix/blob/master/overlay/overrides.nix
|
https://github.com/cargo2nix/cargo2nix/blob/master/overlay/overrides.nix
|
||||||
|
|
||||||
|
@ -46,9 +32,7 @@ let
|
||||||
*/
|
*/
|
||||||
packageOverrides = pkgs:
|
packageOverrides = pkgs:
|
||||||
pkgs.rustBuilder.overrides.all ++ [
|
pkgs.rustBuilder.overrides.all ++ [
|
||||||
/* [1] We add some logic to compile our crates with clippy, it provides us many additional lints
|
/* [1] We need to alter Nix hardening to make static binaries: PIE,
|
||||||
|
|
||||||
[2] We need to alter Nix hardening to make static binaries: PIE,
|
|
||||||
Position Independent Executables seems to be supported only on amd64. Having
|
Position Independent Executables seems to be supported only on amd64. Having
|
||||||
this flag set either 1. make our executables crash or 2. compile as dynamic on some platforms.
|
this flag set either 1. make our executables crash or 2. compile as dynamic on some platforms.
|
||||||
Here, we deactivate it. Later (find `codegenOpts`), we reactivate it for supported targets
|
Here, we deactivate it. Later (find `codegenOpts`), we reactivate it for supported targets
|
||||||
|
@ -56,11 +40,11 @@ let
|
||||||
PIE is a feature used by ASLR, which helps mitigate security issues.
|
PIE is a feature used by ASLR, which helps mitigate security issues.
|
||||||
Learn more about Nix Hardening at: https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/cc-wrapper/add-hardening.sh
|
Learn more about Nix Hardening at: https://github.com/NixOS/nixpkgs/blob/master/pkgs/build-support/cc-wrapper/add-hardening.sh
|
||||||
|
|
||||||
[3] We want to inject the git version while keeping the build deterministic.
|
[2] We want to inject the git version while keeping the build deterministic.
|
||||||
As we do not want to consider the .git folder as part of the input source,
|
As we do not want to consider the .git folder as part of the input source,
|
||||||
we ask the user (the CI often) to pass the value to Nix.
|
we ask the user (the CI often) to pass the value to Nix.
|
||||||
|
|
||||||
[4] We don't want libsodium-sys and zstd-sys to try to use pkgconfig to build against a system library.
|
[3] We don't want libsodium-sys and zstd-sys to try to use pkgconfig to build against a system library.
|
||||||
However the features to do so get activated for some reason (due to a bug in cargo2nix?),
|
However the features to do so get activated for some reason (due to a bug in cargo2nix?),
|
||||||
so disable them manually here.
|
so disable them manually here.
|
||||||
*/
|
*/
|
||||||
|
@ -68,7 +52,7 @@ let
|
||||||
name = "garage";
|
name = "garage";
|
||||||
overrideAttrs = drv:
|
overrideAttrs = drv:
|
||||||
(if git_version != null then {
|
(if git_version != null then {
|
||||||
# [3]
|
# [2]
|
||||||
preConfigure = ''
|
preConfigure = ''
|
||||||
${drv.preConfigure or ""}
|
${drv.preConfigure or ""}
|
||||||
export GIT_VERSION="${git_version}"
|
export GIT_VERSION="${git_version}"
|
||||||
|
@ -76,86 +60,21 @@ let
|
||||||
} else
|
} else
|
||||||
{ }) // {
|
{ }) // {
|
||||||
# [1]
|
# [1]
|
||||||
setBuildEnv = (buildEnv drv);
|
|
||||||
# [2]
|
|
||||||
hardeningDisable = [ "pie" ];
|
hardeningDisable = [ "pie" ];
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
|
|
||||||
(pkgs.rustBuilder.rustLib.makeOverride {
|
|
||||||
name = "garage_rpc";
|
|
||||||
overrideAttrs = drv: { # [1]
|
|
||||||
setBuildEnv = (buildEnv drv);
|
|
||||||
};
|
|
||||||
})
|
|
||||||
|
|
||||||
(pkgs.rustBuilder.rustLib.makeOverride {
|
|
||||||
name = "garage_db";
|
|
||||||
overrideAttrs = drv: { # [1]
|
|
||||||
setBuildEnv = (buildEnv drv);
|
|
||||||
};
|
|
||||||
})
|
|
||||||
|
|
||||||
(pkgs.rustBuilder.rustLib.makeOverride {
|
|
||||||
name = "garage_util";
|
|
||||||
overrideAttrs = drv: { # [1]
|
|
||||||
setBuildEnv = (buildEnv drv);
|
|
||||||
};
|
|
||||||
})
|
|
||||||
|
|
||||||
(pkgs.rustBuilder.rustLib.makeOverride {
|
|
||||||
name = "garage_table";
|
|
||||||
overrideAttrs = drv: { # [1]
|
|
||||||
setBuildEnv = (buildEnv drv);
|
|
||||||
};
|
|
||||||
})
|
|
||||||
|
|
||||||
(pkgs.rustBuilder.rustLib.makeOverride {
|
|
||||||
name = "garage_block";
|
|
||||||
overrideAttrs = drv: { # [1]
|
|
||||||
setBuildEnv = (buildEnv drv);
|
|
||||||
};
|
|
||||||
})
|
|
||||||
|
|
||||||
(pkgs.rustBuilder.rustLib.makeOverride {
|
|
||||||
name = "garage_model";
|
|
||||||
overrideAttrs = drv: { # [1]
|
|
||||||
setBuildEnv = (buildEnv drv);
|
|
||||||
};
|
|
||||||
})
|
|
||||||
|
|
||||||
(pkgs.rustBuilder.rustLib.makeOverride {
|
|
||||||
name = "garage_api";
|
|
||||||
overrideAttrs = drv: { # [1]
|
|
||||||
setBuildEnv = (buildEnv drv);
|
|
||||||
};
|
|
||||||
})
|
|
||||||
|
|
||||||
(pkgs.rustBuilder.rustLib.makeOverride {
|
|
||||||
name = "garage_web";
|
|
||||||
overrideAttrs = drv: { # [1]
|
|
||||||
setBuildEnv = (buildEnv drv);
|
|
||||||
};
|
|
||||||
})
|
|
||||||
|
|
||||||
(pkgs.rustBuilder.rustLib.makeOverride {
|
|
||||||
name = "k2v-client";
|
|
||||||
overrideAttrs = drv: { # [1]
|
|
||||||
setBuildEnv = (buildEnv drv);
|
|
||||||
};
|
|
||||||
})
|
|
||||||
|
|
||||||
(pkgs.rustBuilder.rustLib.makeOverride {
|
(pkgs.rustBuilder.rustLib.makeOverride {
|
||||||
name = "libsodium-sys";
|
name = "libsodium-sys";
|
||||||
overrideArgs = old: {
|
overrideArgs = old: {
|
||||||
features = [ ]; # [4]
|
features = [ ]; # [3]
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
|
|
||||||
(pkgs.rustBuilder.rustLib.makeOverride {
|
(pkgs.rustBuilder.rustLib.makeOverride {
|
||||||
name = "zstd-sys";
|
name = "zstd-sys";
|
||||||
overrideArgs = old: {
|
overrideArgs = old: {
|
||||||
features = [ ]; # [4]
|
features = [ ]; # [3]
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
|
|
|
@ -115,7 +115,7 @@ in
|
||||||
shellHook = ''
|
shellHook = ''
|
||||||
function refresh_cache {
|
function refresh_cache {
|
||||||
pass show deuxfleurs/nix_priv_key > /tmp/nix-signing-key.sec
|
pass show deuxfleurs/nix_priv_key > /tmp/nix-signing-key.sec
|
||||||
for attr in clippy.amd64 test.amd64 pkgs.{amd64,i386,arm,arm64}.release; do
|
for attr in pkgs.amd64.debug test.amd64 pkgs.{amd64,i386,arm,arm64}.release; do
|
||||||
echo "Updating cache for ''${attr}"
|
echo "Updating cache for ''${attr}"
|
||||||
nix copy -j8 \
|
nix copy -j8 \
|
||||||
--to 's3://nix?endpoint=garage.deuxfleurs.fr®ion=garage&secret-key=/tmp/nix-signing-key.sec' \
|
--to 's3://nix?endpoint=garage.deuxfleurs.fr®ion=garage&secret-key=/tmp/nix-signing-key.sec' \
|
||||||
|
|
|
@ -279,7 +279,8 @@ impl DataLayout {
|
||||||
u16::from_be_bytes([
|
u16::from_be_bytes([
|
||||||
hash.as_slice()[HASH_DRIVE_BYTES.0],
|
hash.as_slice()[HASH_DRIVE_BYTES.0],
|
||||||
hash.as_slice()[HASH_DRIVE_BYTES.1],
|
hash.as_slice()[HASH_DRIVE_BYTES.1],
|
||||||
]) as usize % DRIVE_NPART
|
]) as usize
|
||||||
|
% DRIVE_NPART
|
||||||
}
|
}
|
||||||
|
|
||||||
fn block_dir_from(&self, hash: &Hash, dir: &PathBuf) -> PathBuf {
|
fn block_dir_from(&self, hash: &Hash, dir: &PathBuf) -> PathBuf {
|
||||||
|
|
|
@ -279,7 +279,8 @@ impl<'a> LockedHelper<'a> {
|
||||||
.local_aliases
|
.local_aliases
|
||||||
.get(alias_name)
|
.get(alias_name)
|
||||||
.cloned()
|
.cloned()
|
||||||
.flatten() != Some(bucket_id)
|
.flatten()
|
||||||
|
!= Some(bucket_id)
|
||||||
{
|
{
|
||||||
return Err(GarageError::Message(format!(
|
return Err(GarageError::Message(format!(
|
||||||
"Bucket {:?} does not have alias {} in namespace of key {}",
|
"Bucket {:?} does not have alias {} in namespace of key {}",
|
||||||
|
|
Loading…
Reference in a new issue