Update asset locations and permissions

This commit is contained in:
NeilClack
2026-03-25 19:56:41 -05:00
parent 465928915c
commit c1c077dc69
2 changed files with 94 additions and 32 deletions
+8 -2
View File
@@ -69,11 +69,17 @@
]; ];
postInstall = '' postInstall = ''
cp -r share $out/share # Create the destination
mkdir -p $out/share/rhemawave
# Copy everything from your local share/rhemawave/* into the store
cp -r share/rhemawave/* $out/share/rhemawave/
# Add the fetched audio file specifically
mkdir -p $out/share/rhemawave/audio mkdir -p $out/share/rhemawave/audio
cp ${audioFile} $out/share/rhemawave/audio/audio.wav cp ${audioFile} $out/share/rhemawave/audio/audio.wav
''; '';
meta = with pkgs.lib; { meta = with pkgs.lib; {
description = "RhemaWave kiosk application"; description = "RhemaWave kiosk application";
license = licenses.unfree; license = licenses.unfree;
+86 -30
View File
@@ -15,22 +15,12 @@ in
description = "The RhemaWave package to use."; description = "The RhemaWave package to use.";
}; };
# There should not be a "kioskUser" defined in the program
# That should be defined by the system, so everything kioskUser related
# has been commented out.
user = lib.mkOption { user = lib.mkOption {
type = lib.types.str; type = lib.types.str;
default = "kiosk"; default = "kiosk";
description = "User account that runs the kiosk session."; description = "User account that runs the kiosk session.";
}; };
# extraGroups = lib.mkOption {
# type = lib.types.listOf lib.types.str;
# default = [];
# description = "Additional groups for the kiosk user.";
# };
autoVolume = lib.mkOption { autoVolume = lib.mkOption {
type = lib.types.bool; type = lib.types.bool;
default = true; default = true;
@@ -39,24 +29,87 @@ in
}; };
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
# # --- Kiosk user ---
# users.users.${cfg.kioskUser} = {
# isNormalUser = true;
# group = cfg.kioskUser;
# extraGroups = [ "audio" "video" "input" "networkmanager" ] ++ cfg.extraGroups;
# };
# users.groups.${cfg.kioskUser} = {};
# --- Display: agetty + cage --- # --- 1. Environment & Desktop setup ---
environment.sessionVariables = {
SDL_VIDEODRIVER = "wayland";
QT_QPA_PLATFORM = "wayland";
GDK_BACKEND = "wayland";
CLUTTER_BACKEND = "wayland";
_JAVA_AWT_WM_NONREPARENTING = "1";
};
# --- Environment --- # --- 2. Asset Management & Runtime Dirs ---
environment.variables.SDL_VIDEODRIVER = "wayland"; systemd.tmpfiles.rules = [
# User Runtime Directory for Wayland
"d /run/user/1000 0700 ${cfg.user} kiosk -"
# --- Networking --- # Asset directory for the kiosk user
"d /home/${cfg.user}/.local/share/rhemawave 0700 ${cfg.user} kiosk -"
# Symlinks for assets
"L+ /home/${cfg.user}/.local/share/rhemawave/shaders - - - ${cfg.package}/share/rhemawave/shaders"
"L+ /home/${cfg.user}/.local/share/rhemawave/fonts - - - ${cfg.package}/share/rhemawave/fonts"
"L+ /home/${cfg.user}/.local/share/rhemawave/tos - - - ${cfg.package}/share/rhemawave/tos"
"L+ /home/${cfg.user}/.local/share/rhemawave/audio - - - ${cfg.package}/share/rhemawave/audio"
"L+ /home/${cfg.user}/.local/share/rhemawave/proclamations - - - ${cfg.package}/share/rhemawave/proclamations"
];
# --- 3. The Kiosk Service ---
systemd.services."getty@tty1".enable = false;
systemd.services.rhemawave-kiosk = {
description = "RhemaWave Kiosk Cage Session";
after = [ "network.target" "systemd-user-sessions.service" "seatd.service" ];
wants = [ "seatd.service" ];
conflicts = [ "getty@tty1.service" ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
Type = "simple";
StandardInput = "tty";
StandardOutput = "journal";
StandardError = "journal";
TTYPath = "/dev/tty1";
UtmpIdentifier = "tty1";
TTYReset = "yes";
TTYVHangup = "yes";
TTYVTDisallocate = "yes";
ExecStart = pkgs.writeShellScript "launch-rhemawave" ''
# Take over the physical terminal
${pkgs.util-linux}/bin/chvt 1 || true
# Detect GPU
if [ -e /dev/dri/card1 ]; then
export WLR_DRM_DEVICES=/dev/dri/card1
else
export WLR_DRM_DEVICES=/dev/dri/card0
fi
export XDG_RUNTIME_DIR="/run/user/1000"
export LIBSEAT_BACKEND=seatd
export WLR_LIBINPUT_NO_DEVICES=1
# Audio Volume Setup
${lib.optionalString cfg.autoVolume ''
${pkgs.wireplumber}/bin/wpctl set-volume @DEFAULT_AUDIO_SINK@ 1.0 2>/dev/null || true
''}
# Launch Cage with XWayland disabled
exec ${pkgs.util-linux}/bin/runuser -u ${cfg.user} -- \
${pkgs.cage}/bin/cage -d -s -- ${cfg.package}/bin/rhemawave
'';
Restart = "always";
RestartSec = "3s";
};
};
# --- 4. System Services & Hardware ---
networking.networkmanager.enable = true; networking.networkmanager.enable = true;
services.seatd.enable = true;
# --- Audio: PipeWire + WirePlumber ---
services.pipewire = { services.pipewire = {
enable = true; enable = true;
alsa.enable = true; alsa.enable = true;
@@ -64,20 +117,23 @@ in
wireplumber.enable = true; wireplumber.enable = true;
}; };
# --- Polkit rules --- services.udev.extraRules = ''
SUBSYSTEM=="drm", KERNEL=="card[0-9]*", GROUP="video", MODE="0660"
SUBSYSTEM=="input", KERNEL=="event[0-9]*", GROUP="input", MODE="0660"
'';
# --- 5. Polkit rules ---
security.polkit.extraConfig = '' security.polkit.extraConfig = ''
polkit.addRule(function(action, subject) { polkit.addRule(function(action, subject) {
// Allow restarting getty@tty1
if (action.id == "org.freedesktop.systemd1.manage-units") { if (action.id == "org.freedesktop.systemd1.manage-units") {
var unit = action.lookup("unit"); var unit = action.lookup("unit");
if (unit == "getty@tty1.service") { if (unit == "rhemawave-update.service" || unit == "rhemawave-kiosk.service") {
return polkit.Result.YES; return polkit.Result.YES;
} }
} }
}); });
''; '';
# --- Make the package available system-wide --- environment.systemPackages = [ cfg.package pkgs.cage ];
environment.systemPackages = [ cfg.package ];
}; };
} }