forked from emily/nixfiles
fixed deployment
weird thing happen when you try to copy things from a binary cache to a local store
This commit is contained in:
parent
e3ec78b937
commit
1de66b3795
7 changed files with 27 additions and 14 deletions
|
@ -30,7 +30,7 @@ with lib; {
|
|||
|
||||
kyouma.deployment = {
|
||||
tags = [ "all" ];
|
||||
upgradeSystem.enable = true;
|
||||
auto-upgrade.enable = true;
|
||||
};
|
||||
|
||||
security.dhparams.defaultBitSize = 4096;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{ lib, pkgs, ... }: {
|
||||
kyouma.deployment.auto-upgrade.cache = "daemon";
|
||||
nix.gc.options = lib.mkForce "--delete-older-than 60d";
|
||||
nix.settings.trusted-users = [ "build" ];
|
||||
nix.extraOptions = ''
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
{ config, pkgs, lib, modulesPath, ... }:
|
||||
|
||||
with lib; {
|
||||
{ lib, modulesPath, ... }: {
|
||||
imports = [
|
||||
(modulesPath + "/virtualisation/proxmox-lxc.nix")
|
||||
];
|
||||
|
@ -12,7 +10,7 @@ with lib; {
|
|||
machine-type.virtual = true;
|
||||
deployment = {
|
||||
tags = [ "pve-lxc" ];
|
||||
upgradeSystem.allowReboot = false;
|
||||
auto-upgrade.allowReboot = false;
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
owner = "hydra-queue-runner";
|
||||
sopsFile = ../../../secrets/services/hydra.yaml;
|
||||
};
|
||||
kyouma.deployment.auto-upgrade.cache = "daemon";
|
||||
|
||||
services.hydra = {
|
||||
enable = true;
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
({ ... }: {
|
||||
nixpkgs.overlays = [ self.overlays.kyouma self.overlays.otherPkgs ];
|
||||
nixpkgs.hostPlatform.system = system;
|
||||
kyouma.deployment.upgradeSystem.hostName = hostname;
|
||||
kyouma.deployment.auto-upgrade.hostName = hostname;
|
||||
})
|
||||
];
|
||||
};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
with lib;
|
||||
let cfg = config.kyouma.deployment.upgradeSystem;
|
||||
let cfg = config.kyouma.deployment.auto-upgrade;
|
||||
in {
|
||||
options.kyouma.deployment = {
|
||||
tags = mkOption {
|
||||
|
@ -13,8 +13,8 @@ in {
|
|||
default = null;
|
||||
description = "colmena target host override";
|
||||
};
|
||||
upgradeSystem = {
|
||||
enable = mkEnableOption "automatically apply hydra builds";
|
||||
auto-upgrade = {
|
||||
enable = mkEnableOption "automatically upgrade from hydra";
|
||||
allowReboot = mkOption {
|
||||
type = types.bool;
|
||||
default = true;
|
||||
|
@ -25,6 +25,11 @@ in {
|
|||
default = "main";
|
||||
description = "branch to use for updates";
|
||||
};
|
||||
cache = mkOption {
|
||||
type = types.str;
|
||||
default = "https://cache.kyouma.net";
|
||||
description = "Set the binary cache";
|
||||
};
|
||||
hostName = mkOption {
|
||||
type = with types; nullOr str;
|
||||
default = null;
|
||||
|
@ -51,9 +56,11 @@ in {
|
|||
|
||||
serviceConfig = {
|
||||
Type = "oneshot";
|
||||
ExecStart = "${pkgs.upgrade-system}/bin/upgrade-system${optionalString cfg.allowReboot " --allow-reboot"} --branch ${cfg.branch}${
|
||||
optionalString (cfg.hostName != null) " --hostname ${cfg.hostName}"
|
||||
}${optionalString cfg.noDelay " --no-delay"}";
|
||||
ExecStart = "${pkgs.upgrade-system}/bin/upgrade-system${
|
||||
optionalString cfg.allowReboot " --allow-reboot"
|
||||
} --branch ${cfg.branch} --cache ${cfg.cache}${optionalString (cfg.hostName != null) " --hostname ${cfg.hostName}"}${
|
||||
optionalString cfg.noDelay " --no-delay"
|
||||
}";
|
||||
};
|
||||
};
|
||||
systemd.timers.upgrade-system = {
|
||||
|
|
|
@ -4,6 +4,7 @@ set -euo pipefail
|
|||
|
||||
ALLOW_REBOOT=
|
||||
BRANCH="main"
|
||||
BINARY_CACHE=
|
||||
HOST_NAME=$HOSTNAME
|
||||
NO_DELAY=
|
||||
|
||||
|
@ -18,6 +19,11 @@ while [[ $# -gt 0 ]]; do
|
|||
shift
|
||||
shift
|
||||
;;
|
||||
--cache)
|
||||
BINARY_CACHE="$2"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
--hostname)
|
||||
HOST_NAME="$2"
|
||||
shift
|
||||
|
@ -65,7 +71,7 @@ if [[ "$OLD_STORE_PATH" == "$NEW_STORE_PATH" ]]; then
|
|||
fi
|
||||
|
||||
echo "Downloading ${NEW_STORE_PATH}"
|
||||
nix copy --from "https://cache.kyouma.net" "${NEW_STORE_PATH}"
|
||||
nix copy --from "${BINARY_CACHE}" --to "daemon" "${NEW_STORE_PATH}"
|
||||
|
||||
echo "Adding path to system profile"
|
||||
nix-env -p "/nix/var/nix/profiles/system" --set "${NEW_STORE_PATH}"
|
||||
|
|
Loading…
Reference in a new issue