From 04d4446d2e41900aa92033238059e8fe03a36779 Mon Sep 17 00:00:00 2001 From: Gabriele Modena Date: Wed, 7 Feb 2024 22:47:56 +0100 Subject: [PATCH 1/2] systemd: start unit after multi-user.targer. Start the flatpak-managed-install service after multi-user.target. This should ensure that network interfaces are up, and connectivity has been established. --- modules/home-manager.nix | 7 ++++--- modules/nixos.nix | 11 ++++++----- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/modules/home-manager.nix b/modules/home-manager.nix index c1b2d7f..8249578 100644 --- a/modules/home-manager.nix +++ b/modules/home-manager.nix @@ -18,17 +18,18 @@ in systemd.user.services."flatpak-managed-install" = { Unit = { After = [ - "network.target" + "multi-user.target" # ensures that network & connectivity have been setup. ]; }; Install = { WantedBy = [ - "default.target" + "default.target" # multi-user target with a GUI. For a desktop, this is typically going to be the graphical.target ]; }; Service = { - Type = "oneshot"; + Type = "oneshot"; # TODO: should this be an async startup, to avoid blocking on network at boot ? ExecStart = import ./installer.nix { inherit cfg pkgs lib installation; }; + RemainAfterExit = "yes"; }; }; diff --git a/modules/nixos.nix b/modules/nixos.nix index 39d8013..cb7da6a 100644 --- a/modules/nixos.nix +++ b/modules/nixos.nix @@ -8,14 +8,15 @@ in config = lib.mkIf config.services.flatpak.enable { systemd.services."flatpak-managed-install" = { - wants = [ - "network-online.target" - ]; wantedBy = [ - "multi-user.target" + "default.target" # multi-user target with a GUI. For a desktop, this is typically going to be the graphical.target + ]; + after = [ + "multi-user.target" # ensures that network & connectivity have been setup. ]; serviceConfig = { - Type = "oneshot"; + Type = "oneshot"; # TODO: should this be an async startup, to avoid blocking on network at boot ? + RemainAfterExit = "yes"; ExecStart = import ./installer.nix { inherit cfg pkgs lib installation; }; }; }; From d18c064d9f012268c41e2bd4b30466502aabcf27 Mon Sep 17 00:00:00 2001 From: Gabriele Modena Date: Wed, 14 Feb 2024 10:56:51 +0100 Subject: [PATCH 2/2] nixos: home-manager: remove RemainAfterExit This is not really needed, since state changes will be handled by a timer. --- modules/home-manager.nix | 1 - modules/nixos.nix | 1 - 2 files changed, 2 deletions(-) diff --git a/modules/home-manager.nix b/modules/home-manager.nix index 8249578..6d49cf2 100644 --- a/modules/home-manager.nix +++ b/modules/home-manager.nix @@ -29,7 +29,6 @@ in Service = { Type = "oneshot"; # TODO: should this be an async startup, to avoid blocking on network at boot ? ExecStart = import ./installer.nix { inherit cfg pkgs lib installation; }; - RemainAfterExit = "yes"; }; }; diff --git a/modules/nixos.nix b/modules/nixos.nix index cb7da6a..e057d98 100644 --- a/modules/nixos.nix +++ b/modules/nixos.nix @@ -16,7 +16,6 @@ in ]; serviceConfig = { Type = "oneshot"; # TODO: should this be an async startup, to avoid blocking on network at boot ? - RemainAfterExit = "yes"; ExecStart = import ./installer.nix { inherit cfg pkgs lib installation; }; }; };