From 6cf28e30a728afa26642b0faa30b47c83b8d035b Mon Sep 17 00:00:00 2001 From: Toast Date: Thu, 28 Sep 2023 13:42:23 +0200 Subject: [PATCH] Flatpak: install flathub using systemd service --- roles/desktop/services/flatpak.nix | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/roles/desktop/services/flatpak.nix b/roles/desktop/services/flatpak.nix index fa658bf..3ff7152 100644 --- a/roles/desktop/services/flatpak.nix +++ b/roles/desktop/services/flatpak.nix @@ -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" ]; }; }