packages/cachix: init with patch

This commit is contained in:
Max Headroom 2023-12-01 17:45:27 +01:00
parent 24722bf586
commit 4b34be5916
3 changed files with 26 additions and 1 deletions

View file

@ -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;
};
}

View file

@ -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

View file

@ -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, _) ->