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