Flatpak: install flathub using systemd service

This commit is contained in:
Toast 2023-09-28 13:42:23 +02:00
parent 0dd4f4c956
commit 6cf28e30a7

View file

@ -2,11 +2,18 @@
{
services.flatpak.enable = true;
system.activationScripts = {
flatpak.text = ''
echo "adding flatpak repos..."
repo=${pkgs.fetchurl { url = "https://dl.flathub.org/repo/flathub.flatpakrepo"; hash = "sha256-M3HdJQ5h2eFjNjAHP+/aFTzUQm9y9K+gwzc64uj+oDo="; } }
${pkgs.flatpak}/bin/flatpak remote-add --if-not-exists flathub $repo
'';
/*
Create systemd service that adds flathub after getting network
This adds it automatically, which avoids the whack ass way I was
doing that before
*/
systemd.services.flathub-add = {
description = "Add flathub repo to system flatpak install";
script = "${pkgs.flatpak}/bin/flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo";
serviceConfig.Type = "oneshot";
wantedBy = [ "network-online.target" ];
# Run after networking is working
after = [ "NetworkManager-wait-online.service" ];
};
}