particle-os-modules/modules/default-flatpaks/default-flatpaks.tsp
xyny a639f1f64f
refactor(default-flatpaks): version 2 (nushell) (#336)
* feat: initial draft of default-flatpaks v2

this version just sets up the config file but nothing to read it and install the flatpaks after boot

* chore: streamline logging

* chore: replace json with yaml as generated config format

* feat: set up groundwork for post boot scripts

* feat: rename installations -> configurations, initial implementation of post-boot part

* fix: put executable files into /usr/libexec/

* fix: improve fedora remote detection and removal

* feat: implement notifications for system flatpak setup

* chore(default-flatpaks): No need to expose `DISPLAY` for notify-send

* chore(default-flatpaks): Update service & add timers to match v1

* chore(default-flatpaks): Copy & enable timers instead of services

* chore(default-flatpaks): Fix typo for copying `user-flatpak-setup` timer

* chore(default-flatpaks): Copy post-boot files directly instead of placing them in `/usr/share/...`

* chore(default-flatpaks): Forgot to remove copying step of post-boot files to `/usr/share/...`

* chore: update to be in accordance with cli support for nushell

* feat: allow usage of fedora flatpak remote, remove fedora flatpaks and runtimes

* feat: refactor schema to support multiple versions of the module

* docs: separate docs for separate module versions

* fix: copy user-flatpak-setup.timer to correct directory

* chore: correctly document default values in schema

* fix: better flathub package checking
- use API url
- check everything before erroring out

* feat: warn users when giving this module v1 configuration

* fix: prevent addition of http get result into unavailablePackages list

* fix: mkdir before cp

* chore: fix () semantics problems highlighted by debugger

* feat: bluebuild-flatpak-manager CLI

* feat: alert user when trying to use module with old configuration

* docs: write basic documentation page and rewrite example

* fix: attempt to use configFile variable without dollar sign

* fix: no such things as .configurations
(the file is the array)

* fix: ensure no empty list is printed

* docs: add a quick note about learning to use the flatpak manager tool

* fix(schema): distinquish between versions

Co-authored-by: Gerald Pinder <gmpinder@gmail.com>

* fix: add noninteractive flag to flatpak install commands

* fix: ensure repo to be used is enabled

* chore: ignore errors in notify wrapper just in case

* chore: add link to announcement

* docs: run through languagetool

---------

Co-authored-by: fiftydinar <65243233+fiftydinar@users.noreply.github.com>
Co-authored-by: Gerald Pinder <gmpinder@gmail.com>
2025-07-26 14:09:39 +00:00

94 lines
2.9 KiB
Text

import "@typespec/json-schema";
using TypeSpec.JsonSchema;
@jsonSchema("/modules/default-flatpaks.json")
@oneOf
union DefaultFlatpaksModule {
DefaultFlatpaksV1;
DefaultFlatpaksV2;
}
@jsonSchema("/modules/default-flatpaks-latest.json")
model DefaultFlatpaksModuleLatest {
...DefaultFlatpaksModuleV2;
}
@jsonSchema("/modules/default-flatpaks-v1.json")
model DefaultFlatpaksV1 {
/** The default-flatpaks module can be used to install or uninstall flatpaks from a configurable remote on every boot.
* using version: v1
* https://blue-build.org/reference/modules/default-flatpaks/
*/
type: "default-flatpaks@v1" | "default-flatpaks";
/** Whether to send a notification after the install/uninstall is finished. */
notify?: boolean = false;
/** Configuration for system flatpaks. */
system?: {
/** URL of the repo to add. Defaults to Flathub's URL. */
`repo-url`?: string = "https://dl.flathub.org/repo/flathub.flatpakrepo";
/** Name for the repo to add. */
`repo-name`?: string = "flathub";
/** Pretty title for the repo to add. Not set by default. */
`repo-title`?: string;
/** List of Flatpak IDs to install from the repo. */
install?: Array<string>;
/** List of Flatpak IDs to remove. */
remove?: Array<string>;
};
/** Configuration for user flatpaks. */
user?: {
/** URL of the repo to add. Defaults to Flathub's URL. */
`repo-url`?: string = "https://dl.flathub.org/repo/flathub.flatpakrepo";
/** Name for the repo to add. */
`repo-name`?: string = "flathub";
/** Pretty title for the repo to add. Not set by default. */
`repo-title`?: string;
/** List of Flatpak IDs to install from the repo. */
install?: Array<string>;
/** List of Flatpak IDs to remove. */
remove?: Array<string>;
};
}
@jsonSchema("/modules/default-flatpaks-v2.json")
model DefaultFlatpaksV2 {
/** The default-flatpaks module can be used to install Flatpaks from a configurable remote on every boot.
* using version: v2
* https://blue-build.org/reference/modules/default-flatpaks/
*/
type: "default-flatpaks@v2" | "default-flatpaks@latest" | "default-flatpaks";
configurations: Array<{
/** Whether to notify users about Flatpak installation. */
notify?: boolean = true;
/** Whether to perform this configuration for system-wide or separately for each user. */
scope?: "system" | "user" = "user";
/** Details of the Flatpak repository to set up. If omitted, Flathub will be used by default. */
repo?: {
/** Flatpak repository URL. */
url?: string = "https://dl.flathub.org/repo/flathub.flatpakrepo";
/** Flatpak repository name. */
name?: string = "flathub";
/** Flatpak repository formatted title. */
title?: string = "Flathub";
};
/** List of Flatpak IDs to install from the repo. */
install?: Array<string>;
}>;
}