From 4b34be591613a38806f0671ec062136157643cda Mon Sep 17 00:00:00 2001 From: Max Date: Fri, 1 Dec 2023 17:45:27 +0100 Subject: [PATCH] packages/cachix: init with patch --- .../services/cachix-deploy-agent/agent.nix | 3 ++- packages/patched-derivations.nix | 2 ++ ...gent-dont-switch-for-kernel-upgrades.patch | 22 +++++++++++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 patches/base/cachix/deploy-agent-dont-switch-for-kernel-upgrades.patch diff --git a/cluster/services/cachix-deploy-agent/agent.nix b/cluster/services/cachix-deploy-agent/agent.nix index c982681..83b82a0 100644 --- a/cluster/services/cachix-deploy-agent/agent.nix +++ b/cluster/services/cachix-deploy-agent/agent.nix @@ -1,4 +1,4 @@ -{ config, ... }: +{ config, depot, ... }: { age.secrets.cachixDeployToken.file = ./credentials/${config.networking.hostName}.age; @@ -6,5 +6,6 @@ services.cachix-agent = { enable = true; credentialsFile = config.age.secrets.cachixDeployToken.path; + package = depot.packages.cachix; }; } diff --git a/packages/patched-derivations.nix b/packages/patched-derivations.nix index 2514b4a..8930f66 100644 --- a/packages/patched-derivations.nix +++ b/packages/patched-derivations.nix @@ -16,6 +16,8 @@ let }; in with tools; super: rec { + cachix = patch super.cachix "patches/base/cachix"; + dvc = patch (super.dvc.overrideAttrs (old: let filteredBaseDeps = super.lib.subtractLists [ super.python3Packages.dvc-data diff --git a/patches/base/cachix/deploy-agent-dont-switch-for-kernel-upgrades.patch b/patches/base/cachix/deploy-agent-dont-switch-for-kernel-upgrades.patch new file mode 100644 index 0000000..01a2155 --- /dev/null +++ b/patches/base/cachix/deploy-agent-dont-switch-for-kernel-upgrades.patch @@ -0,0 +1,22 @@ +diff --git a/cachix/src/Cachix/Deploy/Activate.hs b/cachix/src/Cachix/Deploy/Activate.hs +index 0f54ce6..2bc0d7d 100644 +--- a/src/Cachix/Deploy/Activate.hs ++++ b/src/Cachix/Deploy/Activate.hs +@@ -122,6 +122,8 @@ getActivationScript profile storePath = do + isNixDarwin <- checkPath "darwin-version" + isHomeManager <- checkPath "hm-version" + user <- InstallationMode.getUser ++ oldKernelPath <- Directory.getSymbolicLinkTarget "/run/booted-system/kernel" ++ newKernelPath <- Directory.getSymbolicLinkTarget $ toS storePath "kernel" + let systemProfileDir = "/nix/var/nix/profiles" + let perUserProfileDir = systemProfileDir "per-user" toS user + let mkProfilePath profileBaseDir defaultProfile = +@@ -136,7 +138,7 @@ getActivationScript profile storePath = do + let profilePath = mkProfilePath systemProfileDir "system" + in ( profilePath, + [ setNewProfile profilePath, +- (toS storePath "bin/switch-to-configuration", ["switch"]) ++ (toS storePath "bin/switch-to-configuration", [if oldKernelPath == newKernelPath then "switch" else "boot"]) + ] + ) + (_, True, _) ->