Skip to content

Instantly share code, notes, and snippets.

View Lillecarl's full-sized avatar
πŸ¦•
Dinosaurs are a lie!

Carl Lillecarl

πŸ¦•
Dinosaurs are a lie!
View GitHub Profile
[I] lillecarl@penguin ~/C/hetzkube> nix run --show-trace --builders "eu.nixbuild.net x86_64-linux" --argstr stage full --file . kubenix.deploymentScript -- --prune --yes
+ /nix/store/pkfz23vs8g5clavxd6fndaxc166rmgxz-preDeployScript/bin/preDeployScript /nix/store/w45zqmvnk0pywq4i76shgrgbafxynwhq-manifest.json
+ export 'NIX_SSHOPTS=-i /home/lillecarl/Code/hetzkube/tmp/ed25519-hetzkube'
+ NIX_SSHOPTS='-i /home/lillecarl/Code/hetzkube/tmp/ed25519-hetzkube'
+ nix copy --substitute-on-destination --no-check-sigs --from 'local?read-only=true' --to 'ssh-ng://nix@nixbuild.lillecarl.com?port=2222' /nix/store/w45zqmvnk0pywq4i76shgrgbafxynwhq-manifest.json -v
/etc/ssh/ssh_config line 53: Unsupported option "gssapiauthentication"
copying 3 paths...
copying path '/nix/store/0zzzgk6vpr2i2r1qq435ha9ibahfzbh8-python3.13-cheapam-0.1.0' to 'ssh-ng://nix@nixbuild.lillecarl.com'...
copying path '/nix/store/s6anpzgs0lmmx7x5hm22wxrmhfdpmzza-python3.13-cheapam-0.1.0' to 'ssh-ng://nix@nixbuild.lillecarl.com'...
copying path '/nix/sto
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: nix-csi
namespace: nix-csi
rules:
- apiGroups:
- ""
resources:
- nodes
apiVersion: v1
items:
- apiVersion: cilium.io/v2
kind: CiliumClusterwideNetworkPolicy
metadata:
annotations:
kluctl.io/deployment-item-dir: default
creationTimestamp: "2025-11-17T22:24:53Z"
generation: 3
labels:
apiVersion: v1
kind: Pod
metadata:
creationTimestamp: "2025-11-02T21:23:43Z"
generateName: ctest-656cddf679-
generation: 1
labels:
app: ctest
pod-template-hash: 656cddf679
name: ctest-656cddf679-dj8pt
@Lillecarl
Lillecarl / nix-timegc.py
Created October 27, 2025 14:01
A smarter way to collect garbage(?)
#!/usr/bin/env python3
import argparse
import sqlite3
import subprocess
import os
import sys
from sqlite3 import Connection
from datetime import datetime, timedelta
from pathlib import Path
[lillecarl@shitbox] in ~/C/easykubenix [πŸŽ‹ main][🐚fish]
[18:03:51]❯ cat $(nix build --file . eval.config.kluctl.projectDir)/**/** 2>/dev/null
[bat error]: '/nix/store/smm9fd70zsvn4nfrsd25dwxv5cxx6hxp-kluctlProject/CustomResourceDefinition' is a directory.
───────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
β”‚ File: /nix/store/smm9fd70zsvn4nfrsd25dwxv5cxx6hxp-kluctlProject/CustomResourceDefinition/easykubenix.yaml
───────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
1 β”‚ {"apiVersion":"v1","items":[],"kind":"List"}
───────┴──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
[bat error]: '/nix/store/smm9fd70zsvn4nfrsd25dwxv5cxx6hxp-kluctlProject/def
From b39df2392ba95b50d6a4864188063ee354313170 Mon Sep 17 00:00:00 2001
From: Carl Andersson <git@lillecarl.com>
Date: Mon, 13 Oct 2025 13:08:24 +0200
Subject: [PATCH] Add namespacing to kubernetes.resources
This way we can't collide when rendering manifests and such.
I took too much inspiration from kubenix when putting the original API together!
---
cluster-config/cilium.nix | 2 +-
cluster-config/cnpg.nix | 2 +-
{
pkgs ? import <nixpkgs> { },
}:
let
manifest = pkgs.writeTextFile {
name = "test-manifest.yaml";
text = ''
apiVersion: v1
kind: ConfigMap
metadata:
@Lillecarl
Lillecarl / kluapply.fish
Last active October 7, 2025 12:13
Use kluctl deploy --prune
#! /usr/bin/env fish
# Defined via `source`
function kluapply --description 'Deploy YAML with kluctl'
argparse --ignore-unknown 'd/discriminator=' 'f/file=' -- $argv
or return 1
set discriminator $_flag_discriminator
set filepath $_flag_file
if test -z "$discriminator"
#!/usr/bin/env python3
"""
nix-touch: Update Nix store path registration times for LRU garbage collection
This tool updates the registrationTime field in the Nix database for a store path
and its dependencies, effectively marking them as "recently used" for GC purposes.
"""
import argparse
import sqlite3