dek-0.1.19 is not a library.
dek
Declarative environment setup. One TOML, any machine.
Install
# or
# setup completions
Usage
Config is loaded from: ./dek.toml, ./dek/, or $XDG_CONFIG_HOME/dek/ (fallback).
Config
# Packages
[] # auto-detects: pacman, apt, brew
= ["curl", "git", "htop"]
[]
= ["build-essential"]
[] # falls back to yay for AUR packages
= ["base-devel", "yay"]
[]
= ["bat", "eza", "ripgrep"]
[]
= ["github.com/junegunn/fzf@latest"]
[]
= ["prettier", "typescript"]
[]
= ["httpie", "tldr"]
[]
= ["poetry", "black"]
[]
= ["jq", "yq"]
# Systemd services
[[]]
= "docker"
= "active"
= true
# User services (systemctl --user, no sudo)
[[]]
= "syncthing"
= "active"
= true
= "user"
# Files
[]
= "~/.zshrc"
[]
= "~/.config/nvim"
[]
= ["export PATH=$HOME/.local/bin:$PATH"]
# Structured line management
[[]]
= "/etc/needrestart/needrestart.conf"
= "$nrconf{restart} = 'l';"
= "#$nrconf{restart} = 'i';"
= "replace"
[[]]
= "/etc/ssh/sshd_config"
= "PermitRootLogin no"
= "^#?PermitRootLogin\\s+"
= "replace"
# Shell
[]
= "ls -larth"
= "git"
[]
= "nvim"
# System
= "Europe/Istanbul"
= "workstation"
# Scripts (installed to ~/.local/bin)
[]
= "scripts/cleanup.sh"
# Custom commands
[[]]
= "setup-db"
= "psql -c 'SELECT 1 FROM pg_database WHERE datname=mydb'"
= "createdb mydb"
# Assertions
[[]]
= "docker --version"
= "Docker version 2[0-9]"
[[]]
= "test -f /etc/hosts"
Package:Binary Syntax
When package and binary names differ:
[]
= ["ripgrep:rg", "fd-find:fd", "bottom:btm"]
Installs ripgrep, checks for rg in PATH.
Split Config
dek/
├── meta.toml # name, description, banner
├── 00-packages.toml
├── 10-services.toml
├── 20-dotfiles.toml
└── optional/
└── extra.toml # only applied when explicitly requested
Files merged alphabetically. Use dek apply extra to include optional configs.
Run Commands
Define reusable commands:
[]
= "Deploy the application"
= ["os.rsync"]
= "rsync -av ./dist/ server:/var/www/"
[]
= "Backup database"
= "scripts/backup.sh" # relative to config dir
Remote
Apply to remote hosts via SSH:
Use -q/--quiet to suppress banners (auto-enabled for multi-host).
Multi-host with Inventory
Ansible-style inventory.ini (one host per line, [groups] and ;comments ignored):
# inventory.ini
[web]
web-01
web-02
web-03
[db]
db-master
Hosts are deployed in parallel. Override inventory path in meta.toml:
= "../devops/inventory.ini"
Deploy Workflow
For build-and-deploy workflows:
# Local build step (runs before remote)
[]
= true
= "mvn package -DskipTests"
# Include build artifacts
[]
= "artifacts/app.jar"
# Deploy to remote
[]
= "/opt/app/app.jar"
[[]]
= "app"
= "active"
# 1. Runs build locally
# 2. Includes fresh jar
# 3. Ships to all app-* hosts in parallel
# 4. Copies jar, restarts service
Inline
Quick installs without a config file:
Test
Spin up a container to test your config:
Bake
Embed config into a standalone binary: