Skip to content

Declarative Syntax

tspillow! edited this page Sep 25, 2026 · 7 revisions

Introduction

The declarative system that Sinix Linux is a powerful and efficient system coded in Lua and will be configured by you in Lua.

How it works is that it was coded to reserve local functions and "APIs" that run commands and structure calculations to get to the desired result.

In the source code of the declarative system, there are 3 files, absolute.lua, main.lua and add-pkg.lua.

absolute.lua has these functions: run_cmd (runs a command), is_package_installed (checks if the queried package(s) is(are) installed), is_service_enabled (checks if the queried service(s) is(are) enabled) and sys_engine.apply_packages (probably self-explanatory.)

For further investigation or whatever, the source code is here.

1: Get started

In your Sinix system, you should have a directory called /etc/sinix.

It's where the source code and the configuration is; To start configuring, create or edit a file called config.lua with your favorite text editor.

Important

If you misspell the name of the config file, it will break everything!

For this example, we will use Neovim.

nvim /etc/sinix/config.lua

Press i in your keyboard to enter Insert Mode so you can code.

1.5: Structure

To not overwhelm you, i will be simple.

config.lua uses tables, similar to JSON or TOML.

A normal structure will look like this:

return {
        hostname = "something",
        packages = {
                  "hyprland",
                  "hyprlock"
        },
        dotfiles = {
        }
}

return is used because it returns the values to main.lua and(or) absolute.lua.

See the structure? You will use this, use your own desired packages and dotfiles (will be covered later) and rebuild.

You may use the sinix-rebuild script that enforces the changes and reconfigures your system.

sinix-rebuild

If bash can't find it:

./usr/bin/sinix-rebuild

Note

(it uses the actual path and the lil dot (.) makes bash execute as a script)

It will spit out verbose and information, and enforces the changes you wish.

2: Packages

You can install packages within the declarative system in 2 ways: Automatic and Manual.

Manual

The Manual way consists of editing the config.lua and rebuilding.

nvim /etc/sinix/config.lua

Then in the packages block:

        packages = {
                  "something",
                  "something-else"
        },

And rebuild:

sinix-rebuild

Automatic

Literally, just try to install something with pacman -S.

pacman -S firefox cava

Note

You do not need to use sudo before pacman -S, because the declarative system might already ask for the password or even bypass it.

Then the declarative system handles the process, running pacman -Sy --noconfirm firefox cava in the background, and also do whatever the config file wants too.

It also detects whether a package in the config is already installed and tells you in the terminal window.

3: Dotfiles

You can also manage your dotfiles in ~/.config in config.lua.

    dotfiles = {
        { 
            src = "/etc/sinix/.cfg/kitty/", 
            dest = "~/.config/kitty" 
        }
    }

This creates a Symbolic link between the folders, sharing their functionality between themselves.

And the best part, you can also use a completely custom folder and simply do the same!

    dotfiles = {
        { 
            src = "imissthatkindofEOFthekindwhereyouwererootforme/", 
            dest = "~/.config/" 
        }
    }

4: Services

Services can be disabled and enabled:

    services = {
        NetworkManager = "enabled",
        greetd         = "enabled",
        bluetooth      = "disabled"
    }

Then in the background when you rebuild, it will run sudo systemctl enable --now NetworkManager.service greetd.service bluetooth.service.

You can still use the command yourself normally. Suggest if we should add an alias for this that adds to the config and does it.

Clone this wiki locally