diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..d3115ec Binary files /dev/null and b/.DS_Store differ diff --git a/assets/.DS_Store b/assets/.DS_Store new file mode 100644 index 0000000..5008ddf Binary files /dev/null and b/assets/.DS_Store differ diff --git a/assets/RWT-Circular-Color-ForOnDark.svg b/assets/RWT-Circular-Color-ForOnDark.svg new file mode 100755 index 0000000..1eaa7f8 --- /dev/null +++ b/assets/RWT-Circular-Color-ForOnDark.svg @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/RWT_Logo-Dark.svg b/assets/RWT_Logo-Dark.svg deleted file mode 100644 index 0127ed4..0000000 --- a/assets/RWT_Logo-Dark.svg +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/assets/splash.png b/assets/splash.png deleted file mode 100644 index a042520..0000000 Binary files a/assets/splash.png and /dev/null differ diff --git a/configuration.nix b/configuration.nix index cb3628e..ff1fc75 100644 --- a/configuration.nix +++ b/configuration.nix @@ -1,4 +1,4 @@ -{ pkgs, radiantwave, upgradeFlakeRef, ... }: +{ pkgs, radiantwave, upgradeFlakeRef, radiantwavePlymouth, ... }: let radiantApp = radiantwave.packages.${pkgs.system}.default; @@ -18,10 +18,42 @@ in # This populates the EFI partition and tells the NUC how to start NixOS. boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; + # Boot straight into the splash screen without waiting on the bootloader menu. + boot.loader.timeout = 0; # Hardware-specific: NUC 14 needs these for the NVMe and Graphics boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" "i915" "drm" "drm_kms_helper" ]; - boot.kernelParams = [ "quiet" "splash" ]; + + # --- RadiantWave splash: Plymouth from boot until the app's first frame --- + boot.plymouth.enable = true; + boot.plymouth.theme = "radiantwave"; + boot.plymouth.themePackages = [ radiantwavePlymouth ]; + + # Silence the kernel/initrd output behind the splash. The module adds + # "splash" itself; we keep "quiet" plus show_status=false and loglevel 0. + boot.consoleLogLevel = 0; + boot.initrd.verbose = false; + boot.kernelParams = [ "quiet" "splash" "systemd.show_status=false" ]; + + # Hold the splash until the app is ready to take over the display, instead of + # quitting at multi-user.target (which would flash a black/console screen + # during the login shell's network wait). The kiosk login shell runs + # `sudo -n plymouth quit --wait` immediately before exec'ing cage. + systemd.services.plymouth-quit.wantedBy = pkgs.lib.mkForce [ ]; + systemd.services.plymouth-quit-wait.wantedBy = pkgs.lib.mkForce [ ]; + + # Allow the kiosk user to quit Plymouth (NOPASSWD, command-scoped). + security.sudo.extraRules = [ + { + users = [ "kiosk" ]; + commands = [ + { + command = "/run/current-system/sw/bin/plymouth"; + options = [ "NOPASSWD" ]; + } + ]; + } + ]; hardware.graphics.enable = true; @@ -29,6 +61,10 @@ in networking.networkmanager.enable = true; + nix.settings.access-tokens = { + "gitea.radiantwavetech.com" = "ff524968d31acc5c4da350d0884a87264d0e8881"; + }; + system.autoUpgrade = { enable = true; flake = upgradeFlakeRef; @@ -105,6 +141,9 @@ in # Pin system audio to 100% and unmute before launching RadiantWave ${pkgs.systemd}/bin/systemctl --user start radiantwave-audio-init.service || true + # Release the splash screen right before the compositor takes over the display + sudo -n plymouth quit --wait || true + exec dbus-run-session cage -- /run/current-system/sw/bin/radiantwave -d -s > /tmp/kiosk.log 2>&1 fi ''; diff --git a/flake.nix b/flake.nix index 0b7610b..b86a8c0 100644 --- a/flake.nix +++ b/flake.nix @@ -5,7 +5,7 @@ disko.inputs.nixpkgs.follows = "nixpkgs"; nixos-facter-modules.url = "github:numtide/nixos-facter-modules"; radiantwave.url = "git+https://gitea.radiantwavetech.com/RadiantWaveTech/radiantwave.git?ref=main"; - radiantwave-dev.url = "git+https://gitea.radiantwavetech.com/RadiantWaveTech/radiantwave.git?ref=dev"; + radiantwave-dev.url = "git+https://gitea.radiantwavetech.com/RadiantWaveTech/radiantwave-cpp.git?ref=dev"; nixos-raspberrypi.url = "github:nvmd/nixos-raspberrypi/main"; }; @@ -22,6 +22,35 @@ }@inputs: let system = "x86_64-linux"; + pkgs = nixpkgs.legacyPackages.${system}; + + # Plymouth theme: renders the RadiantWave SVG to a full-HD splash.png + # at build time (librsvg), so the theme is hermetic and resolution- + # independent. The .plymouth file's /usr paths are rewritten to $out + # (the NixOS module's initrd fixup rewrites store paths again). + radiantwavePlymouth = pkgs.stdenv.mkDerivation { + pname = "radiantwave-plymouth"; + version = "1.0.0"; + + nativeBuildInputs = [ pkgs.librsvg ]; + + src = ./assets/RWT-Circular-Color-ForOnDark.svg; + + buildPhase = '' + mkdir -p $out/share/plymouth/themes/radiantwave + rsvg-convert \ + --keep-aspect-ratio \ + --background-color=#111318 \ + --width=3840 \ + --height=2160 \ + --output=$out/share/plymouth/themes/radiantwave/splash.png \ + $src + sed 's,/usr/,'"$out"'/,g' ${./plymouth-theme/radiantwave.plymouth} \ + > $out/share/plymouth/themes/radiantwave/radiantwave.plymouth + cp ${./plymouth-theme/radiantwave.script} \ + $out/share/plymouth/themes/radiantwave/radiantwave.script + ''; + }; mkKioskSystem = { system, radiantwave, upgradeFlakeRef, extraModules ? [], diskModule, enableAutoUpgrade ? true, extraSpecialArgs ? {}}: nixpkgs.lib.nixosSystem { @@ -30,6 +59,7 @@ specialArgs = { inherit radiantwave; inherit upgradeFlakeRef; + inherit radiantwavePlymouth; } // extraSpecialArgs; modules = [ @@ -48,6 +78,7 @@ specialArgs = { inherit radiantwave upgradeFlakeRef; inherit nixos-raspberrypi; + inherit radiantwavePlymouth; }; modules = [ diff --git a/plymouth-theme/radiantwave.script b/plymouth-theme/radiantwave.script index e03716a..2760a44 100644 --- a/plymouth-theme/radiantwave.script +++ b/plymouth-theme/radiantwave.script @@ -1,6 +1,26 @@ wallpaper_image = Image("splash.png"); screen_width = Window.GetWidth(); screen_height = Window.GetHeight(); -resized_wallpaper_image = wallpaper_image.Scale(screen_width, screen_height); -wallpaper_sprite = Sprite(resized_wallpaper_image); + +# Scale the wallpaper to cover the whole screen, then center-crop the overflow. +# Works for both landscape (NUC) and portrait (rotated android) displays +# without distorting the artwork. +scale_x = screen_width / wallpaper_image.GetWidth(); +scale_y = screen_height / wallpaper_image.GetHeight(); + +if (scale_x > scale_y) { + scale = scale_x; +} else { + scale = scale_y; +} + +scaled_width = wallpaper_image.GetWidth() * scale; +scaled_height = wallpaper_image.GetHeight() * scale; +scaled_image = wallpaper_image.Scale(scaled_width, scaled_height); + +crop_x = (scaled_width - screen_width) / 2; +crop_y = (scaled_height - screen_height) / 2; +cropped_image = scaled_image.Crop(crop_x, crop_y, screen_width, screen_height); + +wallpaper_sprite = Sprite(cropped_image); wallpaper_sprite.SetZ(-100); diff --git a/rotated_display.nix b/rotated_display.nix index 332fc92..1693d7c 100644 --- a/rotated_display.nix +++ b/rotated_display.nix @@ -30,6 +30,9 @@ in # Pin system audio to 100% and unmute before launching RadiantWave ${pkgs.systemd}/bin/systemctl --user start radiantwave-audio-init.service || true + # Release the splash screen right before the compositor takes over the display + sudo -n plymouth quit --wait || true + exec dbus-run-session cage -- ${kioskscript} > /tmp/kiosk.log 2>&1 fi '';