Compare commits

..

2 Commits

4 changed files with 4 additions and 11 deletions

View File

@ -4,7 +4,6 @@
, rustPlatform , rustPlatform
, makeWrapper , makeWrapper
, mpv , mpv
, wrapped ? false
}: }:
rustPlatform.buildRustPackage rec { rustPlatform.buildRustPackage rec {
@ -37,7 +36,7 @@ rustPlatform.buildRustPackage rec {
}; };
}; };
postInstall = lib.optionalString wrapped '' postInstall = ''
wrapProgram $out/bin/greg-ng \ wrapProgram $out/bin/greg-ng \
--prefix PATH : '${lib.makeBinPath [ mpv ]}' --prefix PATH : '${lib.makeBinPath [ mpv ]}'
''; '';

View File

@ -35,7 +35,7 @@
apps = forAllSystems (system: pkgs: _: { apps = forAllSystems (system: pkgs: _: {
default = self.apps.${system}.greg-ng; default = self.apps.${system}.greg-ng;
greg-ng = let greg-ng = let
package = self.packages.${system}.greg-ng-wrapped; package = self.packages.${system}.greg-ng;
in { in {
type = "app"; type = "app";
program = lib.getExe package; program = lib.getExe package;
@ -63,9 +63,6 @@
packages = forAllSystems (system: pkgs: _: { packages = forAllSystems (system: pkgs: _: {
default = self.packages.${system}.greg-ng; default = self.packages.${system}.greg-ng;
greg-ng = pkgs.callPackage ./default.nix { }; greg-ng = pkgs.callPackage ./default.nix { };
greg-ng-wrapped = pkgs.callPackage ./default.nix {
wrapped = true;
};
}); });
} // { } // {
nixosModules.default = ./module.nix; nixosModules.default = ./module.nix;

View File

@ -109,8 +109,7 @@ in
Restart = "always"; Restart = "always";
RestartSec = 3; RestartSec = 3;
WatchdogSec = lib.mkDefault 15; WatchdogSec = 15;
TimeoutStartSec = lib.mkDefault 30;
RestrictAddressFamilies = [ "AF_UNIX" "AF_INET" "AF_INET6" ]; RestrictAddressFamilies = [ "AF_UNIX" "AF_INET" "AF_INET6" ];
AmbientCapabilities = [ "" ]; AmbientCapabilities = [ "" ];

View File

@ -89,8 +89,6 @@ async fn setup_systemd_watchdog_thread() -> anyhow::Result<()> {
async fn shutdown(mpv: Mpv, proc: Option<tokio::process::Child>) { async fn shutdown(mpv: Mpv, proc: Option<tokio::process::Child>) {
log::info!("Shutting down"); log::info!("Shutting down");
sd_notify::notify(false, &[sd_notify::NotifyState::Stopping])
.unwrap_or_else(|e| log::warn!("Failed to notify systemd that the service is stopping: {}", e));
mpv.disconnect() mpv.disconnect()
.await .await
@ -169,7 +167,7 @@ async fn main() -> anyhow::Result<()> {
}; };
if systemd_mode { if systemd_mode {
match sd_notify::notify(false, &[sd_notify::NotifyState::Ready]) match sd_notify::notify(true, &[sd_notify::NotifyState::Ready])
.context("Failed to notify systemd that the service is ready") .context("Failed to notify systemd that the service is ready")
{ {
Ok(_) => log::trace!("Notified systemd that the service is ready"), Ok(_) => log::trace!("Notified systemd that the service is ready"),