Compare commits

..

3 Commits

Author SHA1 Message Date
ac34f029ed Update flake. 2025-10-28 15:55:30 +00:00
8d04add7dc Remove code server. 2025-10-28 15:44:09 +00:00
d7a07cebf5 Cleanup old snapshots hourly. 2025-10-28 14:40:28 +00:00
3 changed files with 28 additions and 148 deletions

View File

@@ -60,7 +60,7 @@ in
description = "Timer for cleaning up old snapshots on standby";
wantedBy = [ "timers.target" ];
timerConfig = {
OnCalendar = "daily";
OnCalendar = "hourly";
Persistent = true;
};
};

54
flake.lock generated
View File

@@ -62,11 +62,11 @@
"systems": "systems"
},
"locked": {
"lastModified": 1761247699,
"narHash": "sha256-yMQCRsD6F6eyt0ckCbAHH3W59mav7rbn9hwfUWd+rHU=",
"lastModified": 1761420385,
"narHash": "sha256-bfBSmKNHry6L/NGBmdymmEA5P/XLzuLDRw2kqaHDsLc=",
"owner": "nix-community",
"repo": "browser-previews",
"rev": "5fc2e2d88f87b46b72767fd6fc2d4af7d983f2c7",
"rev": "c5eae237f38310ed4c9bea0f6c19e0fe04ad61ef",
"type": "github"
},
"original": {
@@ -153,11 +153,11 @@
"treefmt-nix": "treefmt-nix"
},
"locked": {
"lastModified": 1761217923,
"narHash": "sha256-usNQQSwmaHdHiRttmH4no/CVTUyEP+sIoAkkRMgdu0g=",
"lastModified": 1761647152,
"narHash": "sha256-zuciw00Auu3tNquWiznfIVxgVZepLsaIqC7cwC1+GQ4=",
"owner": "nix-community",
"repo": "ethereum.nix",
"rev": "8c3827adc7e1ea75b43ad3d7c4f9ab9acc3b6273",
"rev": "7046ba564c47d7cb298493175ea3c3e9b1186c2e",
"type": "github"
},
"original": {
@@ -218,11 +218,11 @@
"nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
"lastModified": 1760813311,
"narHash": "sha256-lbHQ7FXGzt6/IygWvJ1lCq+Txcut3xYYd6VIpF1ojkg=",
"lastModified": 1760948891,
"narHash": "sha256-TmWcdiUUaWk8J4lpjzu4gCGxWY6/Ok7mOK4fIFfBuU4=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "4e627ac2e1b8f1de7f5090064242de9a259dbbc8",
"rev": "864599284fc7c0ba6357ed89ed5e2cd5040f0c04",
"type": "github"
},
"original": {
@@ -732,11 +732,11 @@
]
},
"locked": {
"lastModified": 1760846226,
"narHash": "sha256-xmU8kAsRprJiTGBTaGrwmjBP3AMA9ltlrxHKFuy5JWc=",
"lastModified": 1761451000,
"narHash": "sha256-qBJL6xEIjqYq9zOcG2vf2nPTeVBppNJzvO0LuQWMwMo=",
"owner": "nix-community",
"repo": "nix-index-database",
"rev": "5024e1901239a76b7bf94a4cd27f3507e639d49e",
"rev": "ed6b293161b378a7368cda38659eb8d3d9a0dac4",
"type": "github"
},
"original": {
@@ -763,11 +763,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1761016216,
"narHash": "sha256-G/iC4t/9j/52i/nm+0/4ybBmAF4hzR8CNHC75qEhjHo=",
"lastModified": 1761468971,
"narHash": "sha256-vY2OLVg5ZTobdroQKQQSipSIkHlxOTrIF1fsMzPh8w8=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "481cf557888e05d3128a76f14c76397b7d7cc869",
"rev": "78e34d1667d32d8a0ffc3eba4591ff256e80576e",
"type": "github"
},
"original": {
@@ -809,11 +809,11 @@
},
"nixpkgs-unstable": {
"locked": {
"lastModified": 1760872779,
"narHash": "sha256-c5C907Raf9eY8f1NUXYeju9aUDlm227s/V0OptEbypA=",
"lastModified": 1761349956,
"narHash": "sha256-tH3wHnOJms+U4k/rK2Nn1RfBrhffX92jLP/2VndSn0w=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "63bdb5d90fa2fa11c42f9716ad1e23565613b07c",
"rev": "02f2cb8e0feb4596d20cc52fda73ccee960e3538",
"type": "github"
},
"original": {
@@ -825,11 +825,11 @@
},
"nixpkgs-unstable_2": {
"locked": {
"lastModified": 1761114652,
"narHash": "sha256-f/QCJM/YhrV/lavyCVz8iU3rlZun6d+dAiC3H+CDle4=",
"lastModified": 1761373498,
"narHash": "sha256-Q/uhWNvd7V7k1H1ZPMy/vkx3F8C13ZcdrKjO7Jv7v0c=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "01f116e4df6a15f4ccdffb1bcd41096869fb385c",
"rev": "6a08e6bb4e46ff7fcbb53d409b253f6bad8a28ce",
"type": "github"
},
"original": {
@@ -865,11 +865,11 @@
"systems": "systems_5"
},
"locked": {
"lastModified": 1761222236,
"narHash": "sha256-Um296vYIWjSjm4btukpjyVPLIz5ovQgoAtEYXFb/Jr4=",
"lastModified": 1761657569,
"narHash": "sha256-2D4Tw5Vp52RU5amnBvq0/z+zgZqafwl4bhg8dJBBjXI=",
"owner": "nix-community",
"repo": "nixvim",
"rev": "39443b9f5737b6f8ee0b654eb47d3a64daac1bd0",
"rev": "03c0dabb9a63f52bc2ebf571f3755720df1ca81e",
"type": "github"
},
"original": {
@@ -1085,11 +1085,11 @@
]
},
"locked": {
"lastModified": 1760889407,
"narHash": "sha256-ppIp04fmz+BaTpJs1nIOmPADg02asfQFrFbhb3SmxsE=",
"lastModified": 1761311587,
"narHash": "sha256-Msq86cR5SjozQGCnC6H8C+0cD4rnx91BPltZ9KK613Y=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "3f258dead9fed51f53862366d3a6bc1b622ee7cb",
"rev": "2eddae033e4e74bf581c2d1dfa101f9033dbd2dc",
"type": "github"
},
"original": {

View File

@@ -1,120 +0,0 @@
job "code-server" {
datacenters = ["alo"]
meta {
uuid = uuidv4()
}
group "code" {
network {
port "http" {
to = 8080
}
}
volume "appdata" {
type = "host"
read_only = false
source = "appdata"
}
volume "nix-store" {
type = "host"
read_only = true
source = "nix-store"
}
volume "sw" {
type = "host"
read_only = true
source = "sw"
}
task "server" {
driver = "docker"
config {
image = "codercom/code-server:latest"
ports = ["http"]
volumes = [
"/data/services/code:/home/coder",
]
}
env {
ANTHROPIC_API_KEY = "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"
}
user = "1000"
resources {
cpu = 1000
memory = 1024
}
service {
name = "code"
port = "http"
tags = [
"traefik.enable=true",
"traefik.http.routers.code.entryPoints=websecure",
"traefik.http.routers.code.middlewares=authentik@file",
]
}
volume_mount {
volume = "nix-store"
destination = "/nix/store"
}
volume_mount {
volume = "sw"
destination = "/sw"
}
}
task "setup" {
driver = "exec"
lifecycle {
hook = "prestart"
sidecar = false
}
config {
command = "sh"
args = ["-c", <<EOF
# Set up npm global directory
export NPM_CONFIG_PREFIX=/appdata/code/.npm-global
mkdir -p $NPM_CONFIG_PREFIX
# Check if we should update (weekly check)
WEEK_AGO=$(date -d '7 days ago' +%s 2>/dev/null || date -v-7d +%s 2>/dev/null || echo 0)
LAST_UPDATE=$(stat -c %Y /appdata/code/.claude-last-update 2>/dev/null || echo 0)
if [ ! -f /appdata/code/.claude-installed ] || [ $LAST_UPDATE -lt $WEEK_AGO ]; then
echo "Installing/updating Claude Code..."
/sw/bin/npm install -g @anthropic-ai/claude-code --prefix=$NPM_CONFIG_PREFIX
touch /appdata/code/.claude-installed
touch /appdata/code/.claude-last-update
else
echo "Claude Code is up to date (checked within last week)"
fi
EOF
]
}
user = "1000"
volume_mount {
volume = "appdata"
destination = "/appdata"
}
volume_mount {
volume = "nix-store"
destination = "/nix/store"
}
volume_mount {
volume = "sw"
destination = "/sw"
}
}
}
}