Clojure lib for reading/writing systemd and quadlet config files
Find a file
Arne Brasseur a44f1b9f67 gitignore
2025-11-17 08:29:15 +01:00
bin First steps 2025-11-17 08:09:30 +01:00
specs First steps 2025-11-17 08:09:30 +01:00
src/co/gaiwan write config file 2025-11-17 08:28:48 +01:00
test/co/gaiwan First steps 2025-11-17 08:09:30 +01:00
.gitignore gitignore 2025-11-17 08:29:15 +01:00
bb.edn First steps 2025-11-17 08:09:30 +01:00
deps.edn First steps 2025-11-17 08:09:30 +01:00
README.md write config file 2025-11-17 08:28:48 +01:00
tests.edn First steps 2025-11-17 08:09:30 +01:00

co.gaiwan/systemd-config

Read and write systemd/quadlet type configuration files. In particular this converts back and forth between a pure clojure/edn data structure, and a .service, .container, etc file.

Clojure version:

{:Unit/Description "PostgreSQL"
 :Container/Image "docker.io/library/postgres:17-alpine"
 :Container/Environment {"POSTGRES_PASSWORD" "postgres"
                         "POSTGRES_USER" "postgres"}
 :Container/Volume "%h/pg-data:/var/lib/postgresql/data:Z"
 :Service/Restart "always"
 :Install/WantedBy ["default.target"]}

postgresql.container file

[Unit]
Description=PostgreSQL

[Container]
Image=docker.io/library/postgres:17-alpine
Environment=POSTGRES_PASSWORD=postgres
Environment=POSTGRES_USER=postgres
Volume=%h/oak-data/pg-data:/var/lib/postgresql/data:Z

[Service]
Restart=always

[Install]
WantedBy=default.target

REPL operations

Run all tests

(do (require 'kaocha.repl) (require 'co.gaiwan.systemd-config-test :reload) (kaocha.repl/run-all))

Run specific test

(do (require 'kaocha.repl) (kaocha.repl/run 'co.gaiwan.systemd-config-test/write-val-test))