From 5f75419fd3e7faf76eea7a4c8dccdfa0170a65dd Mon Sep 17 00:00:00 2001 From: "Yang, Bo" Date: Wed, 3 Apr 2024 18:57:42 +0000 Subject: [PATCH] Switch to new version of https://github.com/containers/skopeo/pull/2277 --- flake-modules/kubernetes.nix | 26 ++++++++++++-------------- flake.lock | 11 +++++------ flake.nix | 2 +- 3 files changed, 18 insertions(+), 21 deletions(-) diff --git a/flake-modules/kubernetes.nix b/flake-modules/kubernetes.nix index 048365b..8074260 100644 --- a/flake-modules/kubernetes.nix +++ b/flake-modules/kubernetes.nix @@ -55,6 +55,15 @@ topLevel@{ flake-parts-lib, inputs, lib, ... }: { ]; options.perSystem = flake-parts-lib.mkPerSystemOption ( perSystem@{ pkgs, system, inputs', ... }: { + packages.skopeo-nix2container = inputs'.nix2container.packages.skopeo-nix2container.overrideAttrs (old: { + patches = old.patches or [ ] ++ [ + (pkgs.fetchpatch { + # Add --image-parallel-copies flag + url = "https://github.com/Atry/skopeo/commit/db8701ceb6c88da8def345d539e67c27e026a04b.patch"; + hash = "sha256-VTG/uf2yw+AiGHgyjKHkrFoEO+0Ne9wtjICmBomTHss="; + }) + ]; + }); ml-ops.runtime = runtime: { config.launcher = launcher: { options.kubernetes = lib.mkOption { @@ -201,26 +210,15 @@ topLevel@{ flake-parts-lib, inputs, lib, ... }: { default = [ ]; }; config.base-package = - let - skopeo-nix2container = inputs.nix2container.packages.${system}.skopeo-nix2container.overrideAttrs (old: { - patches = old.patches or [ ] ++ [ - (pkgs.fetchpatch { - # Add --max-parallel-downloads flag - url = "https://github.com/Atry/skopeo/commit/98312aa4a3137728162d12706e621a4cb5b35787.patch"; - hash = "sha256-wXO5FovWLe4Ghaq10NPDkfnJPYp8hBz0M1Zk51Lq/gw="; - }) - ]; - }); - in pkgs.writeShellScriptBin "${runtime.config._module.args.name}-push-image-to-registry.sh" '' read -a skopeoCopyArgsArray <<< "$SKOPEO_ARGS" ${lib.escapeShellArgs [ - "${skopeo-nix2container}/bin/skopeo" + "${perSystem.config.packages.skopeo-nix2container}/bin/skopeo" "--insecure-policy" "copy" - "--max-parallel-downloads" + "--image-parallel-copies" "64" ]} \ ${ @@ -458,7 +456,7 @@ topLevel@{ flake-parts-lib, inputs, lib, ... }: { ml-ops.devcontainer.devenvShellModule = { packages = [ pkgs.kubectl - inputs'.nix2container.packages.skopeo-nix2container + perSystem.config.packages.skopeo-nix2container ]; }; } diff --git a/flake.lock b/flake.lock index 6d630ce..8a4a56f 100644 --- a/flake.lock +++ b/flake.lock @@ -382,16 +382,15 @@ ] }, "locked": { - "lastModified": 1711658454, - "narHash": "sha256-H+qu0fX7PcNevGABSWq1lQlK8mrnzR/gKvlSGY0eq00=", - "owner": "Atry", + "lastModified": 1711883218, + "narHash": "sha256-XKHhQJ0tk/S/LbYJb31VVvZKWdb+uCFnvEuUQZJkP9o=", + "owner": "nlewo", "repo": "nix2container", - "rev": "8d18e89b327bd8a378fb59e459e5a00cf3b42a58", + "rev": "2154ad0459abfa258edaab038b4716f474656e99", "type": "github" }, "original": { - "owner": "Atry", - "ref": "max-parallel-downloads-64", + "owner": "nlewo", "repo": "nix2container", "type": "github" } diff --git a/flake.nix b/flake.nix index 441f53c..6c8f717 100644 --- a/flake.nix +++ b/flake.nix @@ -35,7 +35,7 @@ url = "github:rrbutani/nix-mk-shell-bin"; }; nix2container = { - url = "github:Atry/nix2container/max-parallel-downloads-64"; + url = "github:nlewo/nix2container"; inputs.nixpkgs.follows = "nixpkgs"; }; nixos-generators = {