From 90b8566652a229b7a495758979c5db88a91da21b Mon Sep 17 00:00:00 2001 From: Samuel Leathers Date: Tue, 22 Oct 2024 12:03:02 -0400 Subject: [PATCH] update USB image * has issues with GPU/chrome --- deployment/kiosk-boot.nix | 142 ++++++++++++---------- deployment/sway/config | 242 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 323 insertions(+), 61 deletions(-) create mode 100644 deployment/sway/config diff --git a/deployment/kiosk-boot.nix b/deployment/kiosk-boot.nix index 447dbbb..24cab26 100644 --- a/deployment/kiosk-boot.nix +++ b/deployment/kiosk-boot.nix @@ -3,13 +3,20 @@ modulesPath, pkgs, self, + config, system, ... }: let # change to false when running in qemu - prodImage = true; + prodImage = false; + inherit (self) nixosModules; in { - imports = [(modulesPath + "/installer/cd-dvd/installation-cd-graphical-gnome.nix")]; + imports = [ + (modulesPath + "/installer/cd-dvd/installation-cd-minimal.nix") + nixosModules.hydra-node + nixosModules.hydra-control-plane + + ]; boot = { initrd.availableKernelModules = [ @@ -35,14 +42,50 @@ in { # To address build time warn swraid.enable = lib.mkForce false; }; + console.keyMap = "us"; + console.packages = with pkgs; [ terminus_font ]; + console.font = "ter-i32b"; + i18n = { + defaultLocale = "en_US.UTF-8"; + }; + fonts.fontDir.enable = true; + fonts.enableGhostscriptFonts = true; + fonts.packages = with pkgs; [ + # Used by starship for fonts + (nerdfonts.override { fonts = [ "FiraCode" ]; }) + corefonts + fira # monospaced + fira-code + powerline-fonts + inconsolata + liberation_ttf + dejavu_fonts + bakoma_ttf + gentium + ubuntu_font_family + terminus_font + unifont # some international languages + ]; + nixpkgs.config.pulseaudio = true; + hardware = { + pulseaudio.enable = true; + }; + sound.enable = true; documentation.info.enable = false; environment = { + etc = { + "sway/config".source = ./sway/config; + }; + loginShellInit = '' + [[ "$(tty)" == /dev/tty1 ]] && sway --config /etc/sway/config + ''; systemPackages = with self.packages.${system}; [ hydra-node hydra-tui + hydra-tui-wrapper hydra-control-plane hydra-offline-wrapper hydra-doom-wrapper @@ -60,15 +103,15 @@ in { usbutils util-linux google-chrome + pavucontrol + vim + tmux + wezterm + sway ]); }; - # Used by starship for fonts - fonts.packages = with pkgs; [ - (nerdfonts.override {fonts = ["FiraCode"];}) - ]; - # Disable squashfs for testing only # Set the flake.nix `imageParameters.prodImage = true;` when ready to build the distribution image to use image compression isoImage.squashfsCompression = lib.mkIf (!prodImage) ((lib.warn "Generating a testing only ISO with compression disabled") null); @@ -92,70 +135,47 @@ in { enableCompletion = true; }; - fzf = { - fuzzyCompletion = true; - keybindings = true; - }; - - starship = { - enable = true; - settings = { - git_commit = { - tag_disabled = false; - only_detached = false; - }; - git_metrics = { - disabled = false; - }; - memory_usage = { - disabled = false; - format = "via $symbol[\${ram_pct}]($style) "; - threshold = -1; - }; - shlvl = { - disabled = false; - symbol = "↕"; - threshold = -1; - }; - status = { - disabled = false; - map_symbol = true; - pipestatus = true; - }; - time = { - disabled = false; - format = "[\\[ $time \\]]($style) "; - }; - }; - }; - dconf.enable = true; gnupg.agent.enable = true; + sway = { + enable = true; + extraPackages = with pkgs; [ + swaylock + swayidle + xwayland + waybar + mako + kanshi + ]; + }; + waybar.enable = true; }; networking.hosts = lib.mkForce { - "127.0.0.1" = [ "localhost" "doom-remote.local" "doom-offline.local" ]; - "::1" = [ "localhost" "doom-remote.local" "doom-offline.local" ]; + "127.0.0.1" = [ "localhost" "offline.doom.local" ]; + "::1" = [ "localhost" "offline.doom.local" ]; }; services = { - #cage = { - # enable = true; - # program = "${pkgs.google-chrome}/bin/google-chrome-stable --app=http://doom-remote.local"; - # #program = "${pkgs.google-chrome}/bin/google-chrome-stable"; - # user = "nixos"; - #}; + hydra-node = { + enable = true; + }; + hydra-control-plane = { + enable = true; + reserved = true; + }; + getty.autologinUser = "nixos"; nginx = { enable = true; virtualHosts = { - "doom-remote.local" = { - root = self.packages.${system}.hydra-doom-static-remote; - extraConfig = '' - disable_symlinks off; - try_files $uri $uri /index.html; - ''; - }; - "doom-offline.local" = { - root = self.packages.${system}.hydra-doom-static; + "offline.doom.local" = { + root = self.packages.${system}.hydra-doom-static.overrideAttrs (finalAttrs: prevAttrs: { + passthru = prevAttrs.passthru // { + serverUrl = "http://offline.doom.local:8000"; + useMouse = "1"; + # uncomment below if you have a cabinet key for POO distribution + #cabinetKey = import ../deployment/cabinet-key.nix; + }; + }); extraConfig = '' disable_symlinks off; try_files $uri $uri /index.html; diff --git a/deployment/sway/config b/deployment/sway/config new file mode 100644 index 0000000..28b5818 --- /dev/null +++ b/deployment/sway/config @@ -0,0 +1,242 @@ +# Copy this to ~/.config/sway/config and edit it to your liking. +# +# Read `man 5 sway` for a complete reference. + +### Variables +# +# Logo key. Use Mod1 for Alt. +set $mod Mod4 + +# Home row direction keys, like vim +set $left h +set $down j +set $up k +set $right l + +# Your preferred terminal emulator +set $term wezterm + +# Your preferred application launcher +# Note: it's recommended that you pass the final command to sway +set $menu dmenu_path | dmenu | xargs swaymsg exec + +# Font for window titles. Will also be used by the bar unless a different font +# is used in the bar {} block below. +font pango:Source Code Pro for Powerline Bold 9 + +### Output configuration +#output eDP-1 scale 2.3 + +# Position of screens + +# This will lock your screen after 300 seconds of inactivity, then turn off +# your displays after another 300 seconds, and turn your screens back on when +# resumed. It will also lock your screen before your computer goes to sleep. +#exec swayidle \ +# timeout 600 'swaylock -c 000000' \ +# timeout 1800 'swaymsg "output * dpms off"' \ +# resume 'swaymsg "output * dpms on"' \ +# before-sleep 'swaylock -c 000000' + +exec swayidle -w \ + timeout 600 'swaylock -f -c 000000' \ + timeout 1800 'swaymsg "output * dpms off"' \ + resume 'swaymsg "output * dpms on"' \ + before-sleep 'swaylock -f -c 000000' \ + lock 'swaylock -f -c 000000' +bindsym --release $mod+Shift+s exec loginctl lock-session + +### Input configuration +# +# Example configuration: +# + input "2:7:SynPS/2_Synaptics_TouchPad" { + dwt enabled + tap enabled + natural_scroll enabled + middle_emulation enabled + } +# +# You can get the names of your inputs by running: swaymsg -t get_inputs +# Read `man 5 sway-input` for more information about this section. + +### Key bindings +# +# Basics: +# + # start a terminal + bindsym $mod+Return exec $term + + # kill focused window + bindsym $mod+Shift+q kill + + # start your launcher + bindsym $mod+d exec $menu + + # Drag floating windows by holding down $mod and left mouse button. + # Resize them with right mouse button + $mod. + # Despite the name, also works for non-floating windows. + # Change normal to inverse to use left mouse button for resizing and right + # mouse button for dragging. + floating_modifier $mod normal + + # reload the configuration file + bindsym $mod+Shift+c reload + + # exit sway (logs you out of your Wayland session) + bindsym $mod+Shift+e exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'swaymsg exit' + +# +# Moving around: +# + # Move your focus around + bindsym $mod+$left focus left + bindsym $mod+$down focus down + bindsym $mod+$up focus up + bindsym $mod+$right focus right + # or use $mod+[up|down|left|right] + bindsym $mod+Left focus left + bindsym $mod+Down focus down + bindsym $mod+Up focus up + bindsym $mod+Right focus right + + # _move_ the focused window with the same, but add Shift + bindsym $mod+Shift+$left move left + bindsym $mod+Shift+$down move down + bindsym $mod+Shift+$up move up + bindsym $mod+Shift+$right move right + # ditto, with arrow keys + bindsym $mod+Shift+Left move left + bindsym $mod+Shift+Down move down + bindsym $mod+Shift+Up move up + bindsym $mod+Shift+Right move right +# +# Workspaces: +# + # switch to workspace + bindsym $mod+1 workspace 1 + bindsym $mod+2 workspace 2 + bindsym $mod+3 workspace 3 + bindsym $mod+4 workspace 4 + bindsym $mod+5 workspace 5 + bindsym $mod+6 workspace 6 + bindsym $mod+7 workspace 7 + bindsym $mod+8 workspace 8 + bindsym $mod+9 workspace 9 + bindsym $mod+0 workspace 10 + # move focused container to workspace + bindsym $mod+Shift+1 move container to workspace 1 + bindsym $mod+Shift+2 move container to workspace 2 + bindsym $mod+Shift+3 move container to workspace 3 + bindsym $mod+Shift+4 move container to workspace 4 + bindsym $mod+Shift+5 move container to workspace 5 + bindsym $mod+Shift+6 move container to workspace 6 + bindsym $mod+Shift+7 move container to workspace 7 + bindsym $mod+Shift+8 move container to workspace 8 + bindsym $mod+Shift+9 move container to workspace 9 + bindsym $mod+Shift+0 move container to workspace 10 + # Note: workspaces can have any name you want, not just numbers. + # We just use 1-10 as the default. +# +# Layout stuff: + + # You can "split" the current object of your focus with + # $mod+b or $mod+v, for horizontal and vertical splits + # respectively. + bindsym $mod+b splith + bindsym $mod+bar split h + bindsym $mod+v splitv + bindsym $mod+apostrophe split v + + # Switch the current container between different layout styles + bindsym $mod+s layout stacking + bindsym $mod+w layout tabbed + bindsym $mod+e layout toggle split + + # Make the current focus fullscreen + bindsym $mod+f fullscreen + + # Toggle the current focus between tiling and floating mode + bindsym $mod+Shift+space floating toggle + + # Swap focus between the tiling area and the floating area + bindsym $mod+space focus mode_toggle + + # move focus to the parent container + bindsym $mod+a focus parent + +# +# Scratchpad: +# + # Sway has a "scratchpad", which is a bag of holding for windows. + # You can send windows there and get them back later. + + # Move the currently focused window to the scratchpad + bindsym $mod+Shift+minus move scratchpad + + # Show the next scratchpad window or hide the focused scratchpad window. + # If there are multiple scratchpad windows, this command cycles through them. + bindsym $mod+minus scratchpad show +# +# Resizing containers: +# +mode "resize" { + # left will shrink the containers width + # right will grow the containers width + # up will shrink the containers height + # down will grow the containers height + bindsym $left resize shrink width 10px + bindsym $down resize grow height 10px + bindsym $up resize shrink height 10px + bindsym $right resize grow width 10px + + # ditto, with arrow keys + bindsym Left resize shrink width 10px + bindsym Down resize grow height 10px + bindsym Up resize shrink height 10px + bindsym Right resize grow width 10px + + # return to default mode + bindsym Return mode "default" + bindsym Escape mode "default" +} +bindsym $mod+r mode "resize" + +# +# Status Bar: +# +# Read `man 5 sway-bar` for more information about this section. +#bar { +# position bottom +# +# # When the status_command prints a new line to stdout, swaybar updates. +# # The default just shows the current date and time. +# status_command /run/current-system/sw/bin/i3status -c ~/.config/sway/bar-config +# +# colors { +# statusline #ffffff +# background #323232 +# inactive_workspace #32323200 #32323200 #5c5c5c +# } +#} + +# gaps +gaps inner 4 +gaps outer 4 +smart_gaps on +default_border pixel 1 +hide_edge_borders both + +# Pulse Audio controls +# run pactl list sinks +bindsym XF86AudioRaiseVolume exec --no-startup-id /run/current-system/sw/bin/pactl set-sink-volume 0 +5% #increase sound volume +bindsym XF86AudioLowerVolume exec --no-startup-id /run/current-system/sw/bin/pactl set-sink-volume 0 -5% #decrease sound volume +bindsym XF86AudioMute exec --no-startup-id /run/current-system/sw/bin/pactl set-sink-mute 0 toggle # mute sound + +# Sreen brightness controls +bindsym XF86MonBrightnessUp exec /run/current-system/sw/bin/light -A 10 +bindsym XF86MonBrightnessDown exec /run/current-system/sw/bin/light -U 10 + + +exec_always waybar +exec_always google-chrome-stable http://offline.doom.local --disable-gpu