Compare commits
2 commits
7b7bcac73a
...
a784b12962
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a784b12962 | ||
|
|
7e7384464a |
7 changed files with 71 additions and 9 deletions
44
.forgejo/workflows/needs-deploy.sh
Executable file
44
.forgejo/workflows/needs-deploy.sh
Executable file
|
|
@ -0,0 +1,44 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# Check for hostname argument
|
||||
if [[ $# -ne 1 ]]; then
|
||||
echo "Usage: $0 <nixos-hostname>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
HOST="$1"
|
||||
REPO_PATH="git+file://$PWD"
|
||||
|
||||
CURRENT_COMMIT=$(git rev-parse HEAD)
|
||||
PREV_COMMIT=$(git rev-parse HEAD^)
|
||||
|
||||
# Check if the host exists at the current commit
|
||||
if ! nix eval --quiet --expr "
|
||||
let
|
||||
flake = builtins.getFlake \"${REPO_PATH}?rev=${CURRENT_COMMIT}\";
|
||||
in
|
||||
builtins.hasAttr \"${HOST}\" flake.nixosConfigurations
|
||||
"; then
|
||||
echo "Error: Host '${HOST}' not found in nixosConfigurations at HEAD."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Now check for derivation change
|
||||
RESULT=$(nix eval --raw --expr "
|
||||
let
|
||||
flake = builtins.getFlake;
|
||||
prev = flake \"${REPO_PATH}?rev=${PREV_COMMIT}\";
|
||||
curr = flake \"${REPO_PATH}?rev=${CURRENT_COMMIT}\";
|
||||
in
|
||||
if prev.nixosConfigurations.\"${HOST}\".config.system.build.toplevel !=
|
||||
curr.nixosConfigurations.\"${HOST}\".config.system.build.toplevel
|
||||
then \"changed\" else \"unchanged\"
|
||||
")
|
||||
|
||||
# Output result
|
||||
if [[ $RESULT == "changed" ]]; then
|
||||
echo "System derivation changed for host '${HOST}' — deploy!"
|
||||
else
|
||||
echo "No change for host '${HOST}' — skip deployment."
|
||||
fi
|
||||
|
|
@ -18,9 +18,6 @@ in
|
|||
deploy = {
|
||||
enable = false;
|
||||
};
|
||||
services = {
|
||||
tty-ips.enable = true;
|
||||
};
|
||||
networking = {
|
||||
hostName = "base";
|
||||
};
|
||||
|
|
|
|||
26
configurations/nixos/caddy/default.nix
Normal file
26
configurations/nixos/caddy/default.nix
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
flake,
|
||||
modulesPath,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (flake) inputs;
|
||||
inherit (inputs) self;
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
self.nixosModules.default
|
||||
"${modulesPath}/virtualisation/lxc-container.nix"
|
||||
];
|
||||
deploy = {
|
||||
address = "unknown.local";
|
||||
};
|
||||
networking = {
|
||||
hostName = "caddy";
|
||||
};
|
||||
environment.systemPackages = [
|
||||
];
|
||||
system.stateVersion = "25.05";
|
||||
}
|
||||
|
|
@ -61,9 +61,6 @@ in
|
|||
deploy = {
|
||||
address = "201:ea26:66c7:657b:3599:63a6:c66c:d388";
|
||||
};
|
||||
services = {
|
||||
tty-ips.enable = true;
|
||||
};
|
||||
networking = {
|
||||
firewall.enable = lib.mkForce false;
|
||||
hostName = "forgejo-runner-tofu";
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ in
|
|||
address = "200:b938:d405:92df:a6e:1ffd:5213:26b";
|
||||
};
|
||||
services = {
|
||||
tty-ips.enable = true;
|
||||
uptime-kuma = {
|
||||
enable = true;
|
||||
settings = {
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ in
|
|||
};
|
||||
|
||||
services = {
|
||||
tty-ips.enable = true;
|
||||
otf = {
|
||||
enable = true;
|
||||
environment = {
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ in
|
|||
options.services.tty-ips = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
default = true;
|
||||
description = "Show interface IPs in TTY login using a dynamic issue file.";
|
||||
};
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue