2024-02-10 11:30:25 +00:00
|
|
|
{ pkgs
|
|
|
|
, lib
|
|
|
|
, config
|
|
|
|
, ...
|
|
|
|
}:
|
|
|
|
{
|
|
|
|
options.clan.services.waypipe = {
|
|
|
|
enable = lib.mkEnableOption "waypipe";
|
|
|
|
user = lib.mkOption {
|
|
|
|
type = lib.types.str;
|
|
|
|
default = "user";
|
|
|
|
description = "User the program is run under";
|
|
|
|
};
|
2024-02-13 15:02:23 +00:00
|
|
|
flags = lib.mkOption {
|
2024-02-10 11:30:25 +00:00
|
|
|
type = lib.types.listOf lib.types.str;
|
|
|
|
default = [
|
|
|
|
"--vsock"
|
|
|
|
"-s"
|
|
|
|
"3049"
|
|
|
|
"server"
|
|
|
|
];
|
2024-02-13 15:02:23 +00:00
|
|
|
description = "Flags that will be passed to waypipe";
|
2024-02-10 11:30:25 +00:00
|
|
|
};
|
2024-02-13 15:02:23 +00:00
|
|
|
command = lib.mkOption {
|
|
|
|
type = lib.types.listOf lib.types.str;
|
|
|
|
default = [ (lib.getExe pkgs.foot) ];
|
|
|
|
description = "Commands that waypipe should run";
|
2024-02-10 11:30:25 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
config = lib.mkIf config.clan.services.waypipe.enable {
|
|
|
|
# Waypipe needs pipewire
|
|
|
|
services.pipewire = {
|
|
|
|
enable = lib.mkDefault true;
|
|
|
|
alsa.enable = lib.mkDefault true;
|
|
|
|
alsa.support32Bit = lib.mkDefault true;
|
|
|
|
pulse.enable = lib.mkDefault true;
|
|
|
|
};
|
2024-02-10 12:22:16 +00:00
|
|
|
# General default settings
|
|
|
|
fonts.enableDefaultPackages = lib.mkDefault true;
|
|
|
|
hardware.opengl.enable = lib.mkDefault true;
|
2024-02-13 15:02:23 +00:00
|
|
|
# Assume it is run inside a clan context
|
2024-02-10 12:22:16 +00:00
|
|
|
clan.virtualisation.waypipe = lib.mkDefault true;
|
|
|
|
|
2024-02-10 11:30:25 +00:00
|
|
|
# User account
|
|
|
|
services.getty.autologinUser = lib.mkDefault config.clan.services.waypipe.user;
|
|
|
|
security.sudo.wheelNeedsPassword = false;
|
|
|
|
|
|
|
|
users.users.${config.clan.services.waypipe.user} = {
|
|
|
|
isNormalUser = true;
|
|
|
|
password = "";
|
|
|
|
extraGroups = [ "wheel" ];
|
|
|
|
shell = "/run/current-system/sw/bin/bash";
|
|
|
|
};
|
|
|
|
|
2024-02-13 15:42:29 +00:00
|
|
|
systemd.user.services.waypipe = {
|
2024-02-10 11:30:25 +00:00
|
|
|
serviceConfig.PassEnvironment = "DISPLAY";
|
2024-02-15 08:58:56 +00:00
|
|
|
serviceConfig.Environment = ''
|
|
|
|
XDG_SESSION_TYPE=wayland \
|
|
|
|
NIXOS_OZONE_WL=1 \
|
|
|
|
QT_QPA_PLATFORM=wayland \
|
|
|
|
SDL_VIDEODRIVER=wayland
|
|
|
|
'';
|
2024-02-10 11:30:25 +00:00
|
|
|
script = ''
|
|
|
|
${lib.getExe config.clanCore.clanPkgs.waypipe} \
|
2024-02-13 15:02:23 +00:00
|
|
|
${lib.escapeShellArgs config.clan.services.waypipe.flags} \
|
|
|
|
${lib.escapeShellArgs config.clan.services.waypipe.command}
|
2024-02-10 11:30:25 +00:00
|
|
|
'';
|
|
|
|
wantedBy = [ "default.target" ];
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|