Skip to content

Using setups

ExistingPerson edited this page Jul 14, 2025 · 3 revisions

Setups are json files with list of packages to install. Better-pkg comes with preconfigured setups, but you can export and create your own.

System Setup

Install recommended or specialized software groups:

better-pkg setup recommended
better-pkg setup gaming
better-pkg setup security

List available setup options:

better-pkg setup --list-options

Custom Setup

Install packages from your own configuration file:

better-pkg setup-custom myconfig.json

Remove packages from your configuration file:

better-pkg setup-remove myconfig.json

Making Configuration file

First, export installed packages using:

better-pkg setup-export @c-all

Next you can add following sections:

  • name, description, created, author, version, notes - Info that shows before running setup.
  • requirements - What you need to run setup.
  • plugins - List of better-pkg plugins to install.
  • repos - Repositories to add.
  • mkdir - Directories to create.
  • touch - Files to create. Can be a string (just the path) or an object with path and optional content.
  • betterpkg_config - Custom better-pkg configuration (aliases, history, etc.) - must be full config.
  • env - Environment variables to set for the session.
  • app-env - Application-specific environment variables (informational).
  • systemd - Systemd services to enable and start.
  • files - URLs or local paths to install from (e.g., .deb, .AppImage).
  • commands - Shell commands to run. Can be a string or an object with run and optional if condition.
  • actions - Special actions (update, cleanup, upgrade, repair).
  • post_commands - Shell commands to run after all installations.

Example:

{
  "name": "My Setup",
  "description": "Example custom setup for better-pkg",
  "created": "2025-07-07",
  "author": "Your Name",
  "version": "1.0",
  "notes": [
    "This is an example setup file.",
    "You can add any notes here."
  ],
  "requirements": [
    {
      "if": { "command_exists": "git" },
      "message": "Git must be installed.",
      "strict": false
    }
  ],
  "plugins": [
    "myplugin"
  ],
  "repos": [
    {
      "manager": "apt",
      "url": "ppa:graphics-drivers/ppa"
    },
    "https://flathub.org/repo/flathub.flatpakrepo"
  ],
  "mkdir": [
    "~/Projects",
    "~/Games"
  ],
  "touch": [
    "~/Projects/README.md",
    {
      "path": "~/Projects/hello.txt",
      "content": "Hello world!\nThis file was created by better-pkg."
    }
  ],
  "betterpkg_config": {
    "aliases": {
      "@a-my-fav": ["firefox", "nautilus"]
    },
    "history": "true"
  },
  "env": {
    "MY_ENV_VAR": "test"
  },
  "app-env": {
    "FLATPAK_ENV_VAR": "value"
  },
  "systemd": [
    "cups",
    "ssh"
  ],
  "files": [
    "https://github.com/oguzhaninan/Stacer/releases/download/v1.1.0/Stacer_1.1.0_amd64.appimage"
  ],
  "commands": [
    "echo 'Welcome to setup_custom!'",
    {
      "run": "date",
      "if": { "env": "DISPLAY" }
    }
  ],
  "packages": {
    "htop": ["apt", "pacman"],
    "vim": ["apt", "pacman"]
  },
  "flatpak": {
    "org.gimp.GIMP": "flatpak"
  },
  "brew": {
    "ranger": "brew"
  },
  "actions": [
    "update",
    "cleanup",
    {
      "run": "echo 'Post-update action!'",
      "if": { "distro": ["debian", "ubuntu"] }
    }
  ],
  "post_commands": [
    "echo 'Setup finished!'"
  ]
}

Clone this wiki locally