1
0
forked from clan/clan-core
clan-core/clanModules/waypipe.nix

66 lines
1.9 KiB
Nix
Raw Normal View History

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";
};
systemd.user.services.waypipe-passthrough = {
serviceConfig.PassEnvironment = "DISPLAY";
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" ];
};
};
}