Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
7e33425
feat: initial draft of default-flatpaks v2
xynydev Sep 22, 2024
851ecfd
chore: streamline logging
xynydev Sep 26, 2024
2cd4439
chore: replace json with yaml as generated config format
xynydev Sep 26, 2024
a45fc97
feat: set up groundwork for post boot scripts
xynydev Sep 26, 2024
1415893
feat: rename installations -> configurations, initial implementation …
xynydev Oct 11, 2024
da675a4
fix: put executable files into /usr/libexec/
xynydev Nov 10, 2024
6510afa
fix: improve fedora remote detection and removal
xynydev Nov 10, 2024
7185ef5
feat: implement notifications for system flatpak setup
xynydev Nov 10, 2024
28a0238
chore(default-flatpaks): No need to expose `DISPLAY` for notify-send
fiftydinar Nov 10, 2024
92f501a
Merge branch 'main' into nu-flatpaks
fiftydinar Nov 10, 2024
9498a79
chore(default-flatpaks): Update service & add timers to match v1
fiftydinar Nov 10, 2024
dd5ae9e
chore(default-flatpaks): Copy & enable timers instead of services
fiftydinar Nov 10, 2024
ed42c96
chore(default-flatpaks): Fix typo for copying `user-flatpak-setup` timer
fiftydinar Nov 10, 2024
81d210a
chore(default-flatpaks): Copy post-boot files directly instead of pla…
fiftydinar Nov 10, 2024
d83856d
chore(default-flatpaks): Forgot to remove copying step of post-boot f…
fiftydinar Nov 10, 2024
832041a
Merge branch 'main' into nu-flatpaks
fiftydinar Dec 4, 2024
5f13d9d
Merge branch 'main' into nu-flatpaks
xynydev Jan 6, 2025
97fea21
chore: update to be in accordance with cli support for nushell
xynydev Jan 6, 2025
4b23110
feat: allow usage of fedora flatpak remote, remove fedora flatpaks an…
xynydev Jan 19, 2025
2de6e0b
feat: refactor schema to support multiple versions of the module
xynydev Jan 19, 2025
ba33ac5
Merge branch 'main' into nu-flatpaks
xynydev Jan 19, 2025
56fa555
docs: separate docs for separate module versions
xynydev Jan 19, 2025
fefcde5
fix: copy user-flatpak-setup.timer to correct directory
xynydev Jan 19, 2025
44fb906
chore: correctly document default values in schema
xynydev Jan 19, 2025
aa74130
fix: better flathub package checking
xynydev Feb 18, 2025
b42d1e4
feat: warn users when giving this module v1 configuration
xynydev Feb 18, 2025
5c032d2
fix: prevent addition of http get result into unavailablePackages list
xynydev Feb 18, 2025
ab7db0d
fix: mkdir before cp
xynydev Feb 18, 2025
0083dce
chore: fix () semantics problems highlighted by debugger
xynydev Jun 15, 2025
ffd8d5a
feat: bluebuild-flatpak-manager CLI
xynydev Jun 15, 2025
993d5c6
feat: alert user when trying to use module with old configuration
xynydev Jun 15, 2025
8f790b8
docs: write basic documentation page and rewrite example
xynydev Jun 15, 2025
6a5f88b
Merge branch 'main' into nu-flatpaks
xynydev Jun 15, 2025
2439215
fix: attempt to use configFile variable without dollar sign
xynydev Jun 15, 2025
19bd31e
fix: no such things as .configurations
xynydev Jun 15, 2025
41476ba
fix: ensure no empty list is printed
xynydev Jun 15, 2025
d1e4864
docs: add a quick note about learning to use the flatpak manager tool
xynydev Jun 15, 2025
188d0e8
fix(schema): distinquish between versions
xynydev Jul 20, 2025
10070cb
fix: add noninteractive flag to flatpak install commands
xynydev Jul 20, 2025
0e173e9
fix: ensure repo to be used is enabled
xynydev Jul 20, 2025
2f99df4
chore: ignore errors in notify wrapper just in case
xynydev Jul 20, 2025
f62e37e
chore: add link to announcement
xynydev Jul 26, 2025
2cf31c5
docs: run through languagetool
xynydev Jul 26, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 83 additions & 0 deletions modules/default-flatpaks/v2/default-flatpaks.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
#!/usr/bin/env nu

const flathubURL = "https://dl.flathub.org/repo/flathub.flatpakrepo"

const defaultConfiguration = {
notify: true
scope: user
repo: {
url: $flathubURL
name: "flathub"
title: "Flathub"
}
install: []
}

const usrSharePath = "/usr/share/bluebuild/default-flatpaks"
const configPath = $"($usrSharePath)/configuration.yaml"

def main [configStr: string] {
let config = $configStr | from yaml

let configurations = $config.configurations | each {|configuration|
mut merged = $defaultConfiguration | merge $configuration
$merged.repo = $defaultConfiguration.repo | merge $merged.repo # make sure all repo properties exist

print $"Validating configuration of (ansi default_italic)($merged.install | length)(ansi reset) Flatpaks from (ansi default_italic)($merged.repo.title)(ansi reset)"

if (not ($merged.scope == "system" or $merged.scope == "user")) {
print $"(ansi red_bold)Scope must be either(ansi reset) (ansi blue_italic)system(ansi reset) (ansi red_bold)or(ansi reset) (ansi blue_italic)user(ansi reset)"
print $"(ansi blue)Your input:(ansi reset) ($merged.scope)"
exit 1
}
if (not ($merged.notify == true or $merged.notify == false)) {
print $"(ansi red_bold)Notify must be either(ansi reset) (ansi blue_italic)true(ansi reset) (ansi red_bold)or(ansi reset) (ansi blue_italic)false(ansi reset)"
print $"(ansi blue)Your input:(ansi reset) ($merged.notify)"
exit 1
}
if ($merged.repo.url == $flathubURL) {
checkFlathub $merged.install
}

print $"Validation successful!"

$merged
}


if (not ($configPath | path exists)) {
mkdir ($configPath | path dirname)
'[]'| save $configPath
}

open $configPath
| append $configurations
| to yaml | save -f $configPath

print $"(ansi green_bold)Successfully generated following configurations:(ansi reset)"
print ($configurations | to yaml)

print "Setting up Flatpak setup services..."

cp -r ($"($env.MODULE_DIRECTORY)/default-flatpaks/post-boot/*" | into glob) $usrSharePath

cp $"($usrSharePath)/system-flatpak-setup.service" /usr/lib/systemd/system/system-flatpak-setup.service
cp $"($usrSharePath)/user-flatpak-setup.service" /usr/lib/systemd/user/user-flatpak-setup.service
systemctl enable --force system-flatpak-setup.service
systemctl enable --force --global user-flatpak-setup.service

chmod +x $"($usrSharePath)/system-flatpak-setup"
Comment thread
xynydev marked this conversation as resolved.
Outdated
chmod +x $"($usrSharePath)/user-flatpak-setup"
}

def checkFlathub [packages: list<string>] {
print "Checking if configured packages exist on Flathub..."
$packages | each { |package|
try {
let _ = http get $"https://flathub.org/apps/($package)"
} catch {
print $"(ansi red_bold)Package(ansi reset) (ansi default_italic)($package)(ansi reset) (ansi red_bold)does not exist on Flathub, which is the specified repository for it to be installed from.(ansi reset)"
exit 1
}
}
}
41 changes: 41 additions & 0 deletions modules/default-flatpaks/v2/post-boot/system-flatpak-setup
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/usr/bin/env nu

const usrSharePath = "/usr/share/bluebuild/default-flatpaks"
const configPath = $"($usrSharePath)/configuration.yaml"

def main [] {
let configFile = open $configPath

if (flatpak remotes | str contains fedora) {
Comment thread
fiftydinar marked this conversation as resolved.
Outdated
/usr/bin/gnome-software --quit
/usr/lib/fedora-third-party/fedora-third-party-opt-out
/usr/bin/fedora-third-party disable
Comment thread
xynydev marked this conversation as resolved.

flatpak remote-delete --system fedora --force
flatpak remote-delete --system fedora-testing --force

# TODO remove Fedora Flatpaks
}

$configFile.configurations | where scope == system | each { |config|
flatpak remote-add --system --if-not-exists $config.repo.name $config.repo.url --title $config.repo.title

if ($config.notify) {
# TODO implement notification sending
# (notify-send
# --app-name "Automatic Flatpak Installation Service"
# $"Starting automated installation of ($config.install | length) Flatpak\(s) from ($config.repo.title)..."
# )
}

flatpak install --system $config.repo.name ...$config.install

if ($config.notify) {
# (notify-send
# --app-name "Automatic Flatpak Installation Service"
# $"Finished automated installation of ($config.install | length) Flatpak\(s) from ($config.repo.title)!"
# ($config.install | str join ', ')
# )
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[Unit]
Description=Manage system flatpaks
Wants=network-online.target
After=network-online.target

[Service]
Type=oneshot
ExecStart=/usr/share/bluebuild/default-flatpaks/system-flatpak-setup
Restart=on-failure
RestartSec=30
StartLimitInterval=0

[Install]
WantedBy=multi-user.target
34 changes: 34 additions & 0 deletions modules/default-flatpaks/v2/post-boot/user-flatpak-setup
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/env nu

const usrSharePath = "/usr/share/bluebuild/default-flatpaks"
const configPath = $"($usrSharePath)/configuration.yaml"

def main [] {
let configFile = open $configPath

if (flatpak remotes | str contains fedora) {
Comment thread
fiftydinar marked this conversation as resolved.
Outdated
flatpak remote-delete --user fedora --force
flatpak remote-delete --user fedora-testing --force
}

$configFile.configurations | where scope == user | each { |config|
flatpak remote-add --user --if-not-exists $config.repo.name $config.repo.url --title $config.repo.title

if ($config.notify) {
(notify-send
--app-name "Automatic Flatpak Installation Service"
$"Starting automated installation of ($config.install | length) Flatpak\(s) from ($config.repo.title)..."
)
}

flatpak install --user $config.repo.name ...$config.install

if ($config.notify) {
(notify-send
--app-name "Automatic Flatpak Installation Service"
$"Finished automated installation of ($config.install | length) Flatpak\(s) from ($config.repo.title)!"
($config.install | str join ', ')
)
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[Unit]
Description=Configure Flatpaks for current user
Wants=network-online.target
After=system-flatpak-setup.service

[Service]
Type=simple
ExecStart=/usr/share/bluebuild/default-flatpaks/user-flatpak-setup
Restart=on-failure
RestartSec=30
StartLimitInterval=0

[Install]
WantedBy=default.target