From 22120649e563e9724224d5239ffc71435d75ac87 Mon Sep 17 00:00:00 2001 From: James Shubin Date: Fri, 26 Sep 2025 23:25:42 -0400 Subject: [PATCH] modules: misc: Add simple flatpak management --- modules/misc/main.mcl | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/modules/misc/main.mcl b/modules/misc/main.mcl index 556432c0..6f277986 100644 --- a/modules/misc/main.mcl +++ b/modules/misc/main.mcl @@ -405,6 +405,45 @@ class copr_enable($name) { } } +# This removes any other flatpak remotes you have. +# XXX: This should be a .d/ style thing. Replace with a "fragments" setup. +class flathub_enable() { + # flatpak + file "/var/lib/flatpak/repo/config" { + state => "exists", + content => deploy.readfile("/files/flatpak/config"), + mode => "u=rw,go=r", + owner => "root", + group => "root", + } +} + +class flatpak_enable($name) { + $ref = $name # eg: im.riot.Riot + + # flatpak list --columns application:full + $p = "/var/lib/flatpak/app/${ref}/current/active/metadata" + + $remote = "flathub" # only one supported for now + + exec "flatpak-install-flathub-${name}" { + cmd => "/usr/bin/flatpak", + args => [ + "install", + "--system", # the default + "--assumeyes", + "--noninteractive", + "--or-update", # why not i guess + "${remote}", + "${ref}", + ], + creates => $p, # TODO: is there something better? + user => "root", # system wide flatpak + + Depend => File["/var/lib/flatpak/repo/config"], + } +} + # For some reason, newly provisioned Fedora machines, don't have their root # partitions consuming 100% of the available space. Fix that. Make sure that # this runs on firstboot and *before* we change any LUKS password, as this only