aboutsummaryrefslogtreecommitdiff
path: root/nix
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2024-02-13 11:24:56 +0100
committerAlex Auvolat <alex@adnab.me>2024-02-13 11:36:28 +0100
commitcf2af186fcc0c8f581a966454b6cd4720d3821f0 (patch)
tree37a978ba9ffb780fc828cff7b8ec93662d50884f /nix
parentdb48dd3d6c1f9e86a62e9b8edfce2c1620bcd5f3 (diff)
parent823078b4cdaf93e09de0847c5eaa75beb7b26b7f (diff)
downloadgarage-cf2af186fcc0c8f581a966454b6cd4720d3821f0.tar.gz
garage-cf2af186fcc0c8f581a966454b6cd4720d3821f0.zip
Merge branch 'main' into next-0.10
Diffstat (limited to 'nix')
-rw-r--r--nix/common.nix1
-rw-r--r--nix/compile.nix25
-rw-r--r--nix/kaniko.nix24
-rw-r--r--nix/manifest-tool.nix24
-rw-r--r--nix/toolchain.nix31
5 files changed, 3 insertions, 102 deletions
diff --git a/nix/common.nix b/nix/common.nix
index 323c3882..1ad809bb 100644
--- a/nix/common.nix
+++ b/nix/common.nix
@@ -14,4 +14,5 @@ rec {
pkgsSrc = flake.defaultNix.inputs.nixpkgs;
cargo2nix = flake.defaultNix.inputs.cargo2nix;
cargo2nixOverlay = cargo2nix.overlays.default;
+ devShells = builtins.getAttr builtins.currentSystem flake.defaultNix.devShells;
}
diff --git a/nix/compile.nix b/nix/compile.nix
index efd88bbf..1e712710 100644
--- a/nix/compile.nix
+++ b/nix/compile.nix
@@ -19,30 +19,9 @@ let
overlays = [ cargo2nixOverlay ];
};
- /* Cargo2nix is built for rustOverlay which installs Rust from Mozilla releases.
- This is fine for 64-bit platforms, but for 32-bit platforms, we need our own Rust
- to avoid incompatibilities with time_t between different versions of musl
- (>= 1.2.0 shipped by NixOS, < 1.2.0 with which rustc was built), which lead to compilation breakage.
- So we want a Rust release that is bound to our Nix repository to avoid these problems.
- See here for more info: https://musl.libc.org/time64.html
- Because Cargo2nix does not support the Rust environment shipped by NixOS,
- we emulate the structure of the Rust object created by rustOverlay.
- In practise, rustOverlay ships rustc+cargo in a single derivation while
- NixOS ships them in separate ones. We reunite them with symlinkJoin.
- */
- toolchainOptions = if target == null || target == "x86_64-unknown-linux-musl"
- || target == "aarch64-unknown-linux-musl" then {
- rustVersion = "1.68.0";
+ toolchainOptions = {
+ rustVersion = "1.73.0";
extraRustComponents = [ "clippy" ];
- } else {
- rustToolchain = pkgs.symlinkJoin {
- name = "rust-static-toolchain-${target}";
- paths = [
- pkgs.rustPlatform.rust.cargo
- pkgs.rustPlatform.rust.rustc
- # clippy not needed, it only runs on amd64
- ];
- };
};
buildEnv = (drv:
diff --git a/nix/kaniko.nix b/nix/kaniko.nix
deleted file mode 100644
index 8380fa2f..00000000
--- a/nix/kaniko.nix
+++ /dev/null
@@ -1,24 +0,0 @@
-pkgs:
-pkgs.buildGoModule rec {
- pname = "kaniko";
- version = "1.9.2";
-
- src = pkgs.fetchFromGitHub {
- owner = "GoogleContainerTools";
- repo = "kaniko";
- rev = "v${version}";
- sha256 = "dXQ0/o1qISv+sjNVIpfF85bkbM9sGOGwqVbWZpMWfMY=";
- };
-
- vendorSha256 = null;
-
- checkPhase = "true";
-
- meta = with pkgs.lib; {
- description =
- "kaniko is a tool to build container images from a Dockerfile, inside a container or Kubernetes cluster.";
- homepage = "https://github.com/GoogleContainerTools/kaniko";
- license = licenses.asl20;
- platforms = platforms.linux;
- };
-}
diff --git a/nix/manifest-tool.nix b/nix/manifest-tool.nix
deleted file mode 100644
index 1090a6ef..00000000
--- a/nix/manifest-tool.nix
+++ /dev/null
@@ -1,24 +0,0 @@
-pkgs:
-pkgs.buildGoModule rec {
- pname = "manifest-tool";
- version = "2.0.5";
-
- src = pkgs.fetchFromGitHub {
- owner = "estesp";
- repo = "manifest-tool";
- rev = "v${version}";
- sha256 = "hjCGKnE0yrlnF/VIzOwcDzmQX3Wft+21KCny/opqdLg=";
- } + "/v2";
-
- vendorSha256 = null;
-
- checkPhase = "true";
-
- meta = with pkgs.lib; {
- description =
- "Command line tool to create and query container image manifest list/indexes";
- homepage = "https://github.com/estesp/manifest-tool";
- license = licenses.asl20;
- platforms = platforms.linux;
- };
-}
diff --git a/nix/toolchain.nix b/nix/toolchain.nix
deleted file mode 100644
index 532db74e..00000000
--- a/nix/toolchain.nix
+++ /dev/null
@@ -1,31 +0,0 @@
-{ system ? builtins.currentSystem, }:
-
-with import ./common.nix;
-
-let
- platforms = [
- #"x86_64-unknown-linux-musl"
- "i686-unknown-linux-musl"
- #"aarch64-unknown-linux-musl"
- "armv6l-unknown-linux-musleabihf"
- ];
- pkgsList = builtins.map (target:
- import pkgsSrc {
- inherit system;
- crossSystem = {
- config = target;
- isStatic = true;
- };
- overlays = [ cargo2nixOverlay ];
- }) platforms;
- pkgsHost = import pkgsSrc { };
- lib = pkgsHost.lib;
- kaniko = (import ./kaniko.nix) pkgsHost;
- winscp = (import ./winscp.nix) pkgsHost;
- manifestTool = (import ./manifest-tool.nix) pkgsHost;
-in lib.flatten (builtins.map (pkgs: [
- pkgs.rustPlatform.rust.rustc
- pkgs.rustPlatform.rust.cargo
- pkgs.buildPackages.stdenv.cc
-]) pkgsList) ++ [ kaniko winscp manifestTool ]
-