Skip to content

biutthapa/lipi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lipi - A Concise DSL for System Administration

Overview

Lipi is a Domain-Specific Language (DSL) designed to simplify system administration scripting on UNIX/Linux systems. It provides concise, readable functions for common tasks like package installation, file management, and user input, with built-in package management via ~/.config/lipi/packages.edn.

Repository: https://github.com/biutthapa/lipi

Installation

To install Lipi on your system:

  1. Run the installation script:
    curl -sL https://raw.githubusercontent.com/biutthapa/lipi/main/install-lipi.sh | bash
        
  2. Source your ~/.bashrc to update the PATH:
    source ~/.bashrc
        

This installs Babashka and sets up the lipi command.

Usage

Write scripts with the .lipi extension and run them with:

lipi script.lipi

Scripts must start with:

#!/usr/bin/env lipi
(require '[lipi.core :as lipi])

See examples/setup.lipi for a complete example.

Package Management File

Lipi tracks installed packages in ~/.config/lipi/packages.edn, an EDN map where each key is a package name (keyword), and the value is a map with :method and :version.

Example:

{:stow {:method :apt :version "2.3.1"}
 :emacs-next {:method :guix :version "1.6"}}

CLI Commands

Lipi provides a CLI for managing packages:

  • lipi install <method> <package>: Install a package using the specified method (e.g., apt, guix, brew, snap).
    lipi install apt stow
        
  • lipi remove <package>: Remove a managed package.
    lipi remove stow
        
  • lipi upgrade <package>: Upgrade a managed package.
    lipi upgrade emacs-next
        

Note: remove and upgrade work only on packages listed in ~/.config/lipi/packages.edn.

Core Functions

  • (lipi/lipi-install method-kw package-str): Install and track a package.
  • (lipi/lipi-remove package-str): Remove a tracked package.
  • (lipi/lipi-upgrade package-str): Upgrade a tracked package.
  • (lipi/sh & args): Run a shell command.
  • (lipi/read-with-timeout seconds default): Read input with a timeout.

Check src/lipi/core.clj for all functions.

Example

#!/usr/bin/env lipi
(require '[lipi.core :as lipi])

(lipi/lipi-install :apt "stow")
(lipi/sh "stow .files")

Contributing

Fork this repo, make changes, and submit a pull request. Issues and suggestions are welcome!

License

MIT License. See LICENSE (to be added).

About

A Concise DSL for System Administration

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published