Compare commits
1 Commits
c15feac958
...
4ff9f663eb
Author | SHA1 | Date |
---|---|---|
Oystein Kristoffer Tveit | 4ff9f663eb |
35
module.nix
35
module.nix
|
@ -83,23 +83,39 @@ in
|
||||||
|
|
||||||
config = lib.mkMerge [
|
config = lib.mkMerge [
|
||||||
(lib.mkIf cfg.enable {
|
(lib.mkIf cfg.enable {
|
||||||
|
users = {
|
||||||
|
users.greg = {
|
||||||
|
isNormalUser = true;
|
||||||
|
group = "greg";
|
||||||
|
uid = 2000;
|
||||||
|
description = "loud gym bro";
|
||||||
|
};
|
||||||
|
groups.greg.gid = 2000;
|
||||||
|
};
|
||||||
|
|
||||||
systemd.user.services.greg-ng = {
|
systemd.user.services.greg-ng = {
|
||||||
description = "greg-ng, an mpv based media player";
|
description = "greg-ng, an mpv based media player";
|
||||||
wantedBy = [ "graphical-session.target" ];
|
wantedBy = [ "graphical-session.target" ];
|
||||||
partOf = [ "graphical-session.target" ];
|
partOf = [ "graphical-session.target" ];
|
||||||
environment.RUST_LOG = lib.mkIf cfg.enableDebug "greg_ng=trace,mpvipc=trace";
|
environment = {
|
||||||
|
RUST_LOG = lib.mkIf cfg.enableDebug "greg_ng=trace,mpvipc=trace";
|
||||||
|
};
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Type = "simple";
|
Type = "simple";
|
||||||
ExecStart = "${lib.getExe cfg.package} ${lib.cli.toGNUCommandLineShell { } cfg.settings}";
|
ExecStart = "${lib.getExe cfg.package} ${lib.cli.toGNUCommandLineShell { } cfg.settings}";
|
||||||
Restart = "always";
|
Restart = "always";
|
||||||
RestartSec = 3;
|
RestartSec = 3;
|
||||||
|
|
||||||
|
IPAddressDeny =
|
||||||
|
lib.optionals (lib.elem cfg.settings.host [ null "localhost" "127.0.0.1" ]) [ "any" ];
|
||||||
|
|
||||||
RestrictAddressFamilies = [ "AF_UNIX" "AF_INET" "AF_INET6" ];
|
RestrictAddressFamilies = [ "AF_UNIX" "AF_INET" "AF_INET6" ];
|
||||||
|
|
||||||
AmbientCapabilities = [ "" ];
|
AmbientCapabilities = [ "" ];
|
||||||
CapabilityBoundingSet = [ "" ];
|
CapabilityBoundingSet = [ "" ];
|
||||||
DeviceAllow = [ "" ];
|
DeviceAllow = [ "" ];
|
||||||
LockPersonality = true;
|
LockPersonality = true;
|
||||||
# Might work, but wouldn't bet on it with embedded lua in mpv
|
# Might work, but wouldn't bet on it with embedded scripting lang in mpv
|
||||||
MemoryDenyWriteExecute = false;
|
MemoryDenyWriteExecute = false;
|
||||||
NoNewPrivileges = true;
|
NoNewPrivileges = true;
|
||||||
# MPV and mesa tries to talk directly to the GPU.
|
# MPV and mesa tries to talk directly to the GPU.
|
||||||
|
@ -110,14 +126,13 @@ in
|
||||||
ProcSubset = "pid";
|
ProcSubset = "pid";
|
||||||
ProtectClock = true;
|
ProtectClock = true;
|
||||||
ProtectControlGroups = true;
|
ProtectControlGroups = true;
|
||||||
# MPV wants ~/.cache
|
ProtectHome = "tmpfs";
|
||||||
ProtectHome = false;
|
|
||||||
ProtectHostname = true;
|
ProtectHostname = true;
|
||||||
ProtectKernelLogs = true;
|
ProtectKernelLogs = true;
|
||||||
ProtectKernelModules = true;
|
ProtectKernelModules = true;
|
||||||
ProtectKernelTunables = true;
|
ProtectKernelTunables = true;
|
||||||
ProtectProc = "invisible";
|
ProtectProc = "invisible";
|
||||||
ProtectSystem = "full";
|
ProtectSystem = "strict";
|
||||||
RemoveIPC = true;
|
RemoveIPC = true;
|
||||||
UMask = "0077";
|
UMask = "0077";
|
||||||
RestrictNamespaces = true;
|
RestrictNamespaces = true;
|
||||||
|
@ -152,16 +167,6 @@ in
|
||||||
extraPortals = [ pkgs.xdg-desktop-portal-gtk ];
|
extraPortals = [ pkgs.xdg-desktop-portal-gtk ];
|
||||||
};
|
};
|
||||||
|
|
||||||
users = {
|
|
||||||
users.greg = {
|
|
||||||
isNormalUser = true;
|
|
||||||
group = "greg";
|
|
||||||
uid = 2000;
|
|
||||||
description = "loud gym bro";
|
|
||||||
};
|
|
||||||
groups.greg.gid = 2000;
|
|
||||||
};
|
|
||||||
|
|
||||||
services.greetd = {
|
services.greetd = {
|
||||||
enable = true;
|
enable = true;
|
||||||
settings = rec {
|
settings = rec {
|
||||||
|
|
|
@ -66,9 +66,7 @@ async fn main() -> anyhow::Result<()> {
|
||||||
})
|
})
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
if let Err(e) = show_grzegorz_image(mpv.clone()).await {
|
show_grzegorz_image(mpv.clone()).await?;
|
||||||
log::warn!("Could not show Grzegorz image: {}", e);
|
|
||||||
}
|
|
||||||
|
|
||||||
let addr = SocketAddr::new(resolve(&args.host).await?, args.port);
|
let addr = SocketAddr::new(resolve(&args.host).await?, args.port);
|
||||||
log::info!("Starting API on {}", addr);
|
log::info!("Starting API on {}", addr);
|
||||||
|
|
Loading…
Reference in New Issue