Compare commits

...

2 commits

Author SHA1 Message Date
Jermeiah S
a784b12962
added tool for checking deployment requirement
All checks were successful
/ test (push) Successful in 42s
2025-06-20 13:54:11 -04:00
Jermeiah S
7e7384464a
made tty-ip enabled by default 2025-06-20 13:53:04 -04:00
7 changed files with 71 additions and 9 deletions

View 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

View file

@ -18,9 +18,6 @@ in
deploy = {
enable = false;
};
services = {
tty-ips.enable = true;
};
networking = {
hostName = "base";
};

View 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";
}

View file

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

View file

@ -19,7 +19,6 @@ in
address = "200:b938:d405:92df:a6e:1ffd:5213:26b";
};
services = {
tty-ips.enable = true;
uptime-kuma = {
enable = true;
settings = {

View file

@ -26,7 +26,6 @@ in
};
services = {
tty-ips.enable = true;
otf = {
enable = true;
environment = {

View file

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