From 44ea3691edfa243219810142d5ba98d64910c676 Mon Sep 17 00:00:00 2001 From: Mick Pollard <261833+aussielunix@users.noreply.github.com> Date: Sat, 22 Jun 2024 17:57:49 +1000 Subject: [PATCH] migrate to new repo layout --- config/README.md | 56 ------------------- {config => files}/files/usr/.gitkeep | 0 .../conf.d/90-disable-randomization.conf | 0 {config => files}/files/usr/etc/chrony.conf | 0 .../files/usr/etc/sysctl.d/hardening.conf | 0 .../files/usr/etc/systemd/resolved.conf | 0 .../usr/share/ublue-os/just/60-custom.just | 0 modules/.gitkeep | 0 modules/README.md | 25 --------- recipes/recipe.yml | 12 ++-- {config => tmp}/scripts/disablecups.sh | 0 {config => tmp}/scripts/example.sh | 0 12 files changed, 8 insertions(+), 85 deletions(-) delete mode 100644 config/README.md rename {config => files}/files/usr/.gitkeep (100%) rename {config => files}/files/usr/etc/NetworkManager/conf.d/90-disable-randomization.conf (100%) rename {config => files}/files/usr/etc/chrony.conf (100%) rename {config => files}/files/usr/etc/sysctl.d/hardening.conf (100%) rename {config => files}/files/usr/etc/systemd/resolved.conf (100%) rename {config => files}/files/usr/share/ublue-os/just/60-custom.just (100%) delete mode 100644 modules/.gitkeep delete mode 100644 modules/README.md rename {config => tmp}/scripts/disablecups.sh (100%) rename {config => tmp}/scripts/example.sh (100%) diff --git a/config/README.md b/config/README.md deleted file mode 100644 index 53892ed..0000000 --- a/config/README.md +++ /dev/null @@ -1,56 +0,0 @@ -# Configuring your image - -The main file of your is *the recipe file*. You can have multiple recipe files, and the ones to build are declared in the matrix section of [build.yml](../.github/workflows/build.yml). - -## Basic options - -At the top of the recipe, there are four *mandatory* configuration options. - -`name:` is the name of the image that is used when rebasing to it. For example, the name "sapphire" would result in the final URL of the container being `ghcr.io//sapphire`. - -`description:` is a short description of your image that will be attached to your image's metadata. - -`base-image:` is the URL of the image your image will be built upon. - -`image-version:` is the version tag of the `base-image` that will be pulled. For example, Universal Blue's images build with Fedora version tags (`38`, `39`), with the `latest` tag for the latest major version, and [many other tags](https://github.com/ublue-os/main/pkgs/container/base-main/versions?filters%5Bversion_type%5D=tagged). - -## Modules - -The core of startingpoint's configuration is built around the idea of modules. Modules are scripts in the [`../modules`](../modules/) directory that you configure under `modules:` in the recipe. They are executed in order, and can run arbitrary shell commands and write any files. - -This repository fetches some useful default modules from [`ublue-os/bling`](https://github.com/ublue-os/bling/), like [`rpm-ostree`](https://universal-blue.org/tinker/modules/rpm-ostree) for pseudo-declarative package management, [`bling`](https://universal-blue.org/tinker/modules/bling) for pulling extra components from [`ublue-os/bling`](https://github.com/ublue-os/bling), and [`files`](https://universal-blue.org/tinker/modules/files) for copying files from the `config/files/` directory into your image. - -For a comprehensive list of modules, their in-depth documentation and example configuration, check out [the Modules page on the website](https://universal-blue.org/tinker/modules/). - -### Building multiple images and including module configuration from other files - -To build multiple images, you need to create another recipe.yml file, which you should name based on what kind of image you want it to build. Then, edit the [`build.yml`](../.github/workflows/build.yml) file. Inside the file, under `jobs: strategy: matrix:`, there's a list of recipe files to build images, which you need to add your new recipe file to. These should be paths to files inside the `config` directory. - -Module configuration can be included from other files using the `from-file` syntax. The value should be a path to a file inside the `config` directory. For example, the following snippet could be used to include the configuration for installing a set of packages common to multiple images. -```yaml -modules: - - from-file: common-packages.yml -``` -And inside config/common-packages.yml -```yaml -type: rpm-ostree -install: - - i3 - - dunst - - rofi - - kitty -``` -An external module can also include multiple modules. -```yaml -# config/common.yml -modules: - - type: files - files: - - usr: /usr - - type: rpm-ostree - install: - - i3 - - dunst - - rofi - - kitty -``` diff --git a/config/files/usr/.gitkeep b/files/files/usr/.gitkeep similarity index 100% rename from config/files/usr/.gitkeep rename to files/files/usr/.gitkeep diff --git a/config/files/usr/etc/NetworkManager/conf.d/90-disable-randomization.conf b/files/files/usr/etc/NetworkManager/conf.d/90-disable-randomization.conf similarity index 100% rename from config/files/usr/etc/NetworkManager/conf.d/90-disable-randomization.conf rename to files/files/usr/etc/NetworkManager/conf.d/90-disable-randomization.conf diff --git a/config/files/usr/etc/chrony.conf b/files/files/usr/etc/chrony.conf similarity index 100% rename from config/files/usr/etc/chrony.conf rename to files/files/usr/etc/chrony.conf diff --git a/config/files/usr/etc/sysctl.d/hardening.conf b/files/files/usr/etc/sysctl.d/hardening.conf similarity index 100% rename from config/files/usr/etc/sysctl.d/hardening.conf rename to files/files/usr/etc/sysctl.d/hardening.conf diff --git a/config/files/usr/etc/systemd/resolved.conf b/files/files/usr/etc/systemd/resolved.conf similarity index 100% rename from config/files/usr/etc/systemd/resolved.conf rename to files/files/usr/etc/systemd/resolved.conf diff --git a/config/files/usr/share/ublue-os/just/60-custom.just b/files/files/usr/share/ublue-os/just/60-custom.just similarity index 100% rename from config/files/usr/share/ublue-os/just/60-custom.just rename to files/files/usr/share/ublue-os/just/60-custom.just diff --git a/modules/.gitkeep b/modules/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/modules/README.md b/modules/README.md deleted file mode 100644 index e5bee1b..0000000 --- a/modules/README.md +++ /dev/null @@ -1,25 +0,0 @@ -# Making modules - -If you want to extend Startingpoint with custom functionality that requires configuration, you should create a module. Modules are scripts in the subdirectories of this directory. The `type:` key in the recipe.yml should be used as both the name of the folder and script, with the script having an additional `.sh` suffix. Creating a custom module with the same name as a default module will override it. - -Each module intended for public usage should include a `README.md` file inside it's directory with a short description of the module and documentation for each configuration option. - -Modules get only the configuration options given to them in the recipe.yml, not the configuration of other modules or any top-level keys. The configuration is given as the first argument as a single-line json string. You can check out the default modules for examples on how to parse such string using `yq` or `jq`. - -Additionally, each module has access to four environment variables, `CONFIG_DIRECTORY` pointing to the directory containing the confiuration files for the build (`/tmp/config`), `IMAGE_NAME` being the name of the image as declared in the recipe, `BASE_IMAGE` being the URL of the container image used as the base (FROM) in the image, and `OS_VERSION` being the `VERSION_ID` from `/usr/lib/os-release`. - -A helper bash function called `get_yaml_array` is exported from the main build script. -```bash -# "$1" is the first cli argument, being the module configuration. -# If you need to read from some other JSON string, just replace "$1" with "$VARNAME". -get_yaml_array OUTPUT_VAR_NAME '.yq.key.to.array[]' "$1" -for THING in "${OUTPUT_VAR_NAME[@]}"; do - echo "$THING" -done -``` - -All bash-based modules should start with the following lines to ensure the image builds fail on errors, and that the correct shell is used to run them. -```bash -#!/usr/bin/env bash -set -oue pipefail -``` \ No newline at end of file diff --git a/recipes/recipe.yml b/recipes/recipe.yml index d7b75de..09dcc2d 100644 --- a/recipes/recipe.yml +++ b/recipes/recipe.yml @@ -61,17 +61,21 @@ modules: repo-name: flathub repo-title: "Flathub (system-wide)" install: + - com.discordapp.Discord - org.keepassxc.KeePassXC - org.mozilla.firefox - - com.discordapp.Discord - org.tigervnc.vncviewer + - org.videolan.VLC remove: [] - type: gnome-extensions install: - space-barluchrioh.v25 - just-perfection-desktopjust-perfection.v28 - appindicatorsupportrgcjonas.gmail.com.v58 - - type: script - scripts: - - disablecups.sh + - type: systemd + system: + disabled: + - cups + masked: + - cups - type: signing diff --git a/config/scripts/disablecups.sh b/tmp/scripts/disablecups.sh similarity index 100% rename from config/scripts/disablecups.sh rename to tmp/scripts/disablecups.sh diff --git a/config/scripts/example.sh b/tmp/scripts/example.sh similarity index 100% rename from config/scripts/example.sh rename to tmp/scripts/example.sh