diff --git a/config/hosts/goliath.nix b/config/hosts/goliath.nix index 33466486..af932ba6 100644 --- a/config/hosts/goliath.nix +++ b/config/hosts/goliath.nix @@ -4,12 +4,13 @@ profiles.hardware.razer profiles.hardware.bamboo profiles.gui + profiles.i3 profiles.vfio profiles.network profiles.cross.aarch64 profiles.cross.armv6l profiles.cross.armv7l - users.kat.guiFull + users.kat.guiX11Full users.kat.services.weechat services.nginx services.katsplash @@ -190,6 +191,18 @@ SUBSYSTEM=="block", ACTION=="add", ATTRS{model}=="HFS256G32TNF-N3A", ATTRS{wwid}=="t10.ATA HFS256G32TNF-N3A0A MJ8BN15091150BM1Z ", OWNER="kat" ''; + services.xserver= { + xrandrHeads = [ + { + output = "HDMI-A-0"; + primary = true; + } + ]; + deviceSection = '' + BusID "PCI:37:0:0" + ''; + }; + networking = { hostId = "617050fc"; useDHCP = false; diff --git a/config/profiles/i3/profile.nix b/config/profiles/i3/profile.nix new file mode 100644 index 00000000..d69a22b1 --- /dev/null +++ b/config/profiles/i3/profile.nix @@ -0,0 +1,14 @@ +{ config, pkgs, ... }: { + services.xserver = { + enable = true; + autorun = false; + exportConfiguration = true; + displayManager.startx.enable = true; + }; + + environment.systemPackages = with pkgs; [ + xorg.xinit + xsel + scrot + ]; +} diff --git a/config/profiles/vfio/profile.nix b/config/profiles/vfio/profile.nix index 6e6eae1b..2215b86a 100644 --- a/config/profiles/vfio/profile.nix +++ b/config/profiles/vfio/profile.nix @@ -1,6 +1,62 @@ { config, pkgs, lib, ... }: with lib; let + screenstubConfig = let + jsonConfig = builtins.toJSON { + exit_events = [ "show_host" ]; + hotkeys = [ + { + events = [ + { toggle_grab = { x = { mouse = false; }; }; } + { + toggle_grab = { + evdev = { + devices = [ + "/dev/input/by-id/usb-Razer_Razer_Naga_Trinity_00000000001A-event-mouse" + ]; + evdev_ignore = [ "button" ]; + exclusive = false; + xcore_ignore = [ "absolute" ]; + }; + }; + } + "unstick_host" + ]; + modifiers = [ "LeftMeta" ]; + triggers = [ "Esc" ]; + } + { + events = [ "toggle_show" ]; + modifiers = [ "LeftMeta" ]; + on_release = false; + triggers = [ "T" ]; + } + ]; + key_remap = { + LeftMeta = "Reserved"; + RightAlt = "LeftMeta"; + }; + qemu = { + absolute_driver = { virtio = { bus = "pci.21"; }; }; + ga_socket = "/tmp/vfio-qga"; + keyboard_driver = { virtio = { bus = "pci.23"; }; }; + qmp_socket = "/tmp/vfio-qmp"; + relative_driver = { virtio = { bus = "pci.22"; }; }; + routing = "virtio-host"; + }; + screens = [{ + ddc = { + guest = [ "ddc" ]; + host = [ "ddc" ]; + }; + guest_source = { name = "HDMI-1"; }; + host_source = { name = "HDMI-2"; }; + monitor = { + manufacturer = "BNQ"; + model = "BenQ GW2270"; + }; + }]; + }; in pkgs.writeText "screenstub.json" jsonConfig; win10-screenstub = pkgs.writeShellScriptBin "win10-screenstub" '' - ${pkgs.screenstub-kat}/bin/screenstub -c "${./screenstub.yml}" x + ${pkgs.screenstub}/bin/screenstub -c "${screenstubConfig}" x ''; win10-diskmapper = pkgs.writeShellScriptBin "win10-diskmapper" '' sudo ${pkgs.disk-mapper}/bin/disk-mapper /dev/disk/by-id/ata-ST2000DM008-2FR102_WK301C3H-part2 diff --git a/config/profiles/vfio/screenstub.yml b/config/profiles/vfio/screenstub.yml index d12b7575..cd61c8db 100644 --- a/config/profiles/vfio/screenstub.yml +++ b/config/profiles/vfio/screenstub.yml @@ -14,7 +14,6 @@ screens: #guest: [] # disable input switching #host: [] # disable input switching guest: # configure how to switch to the guest - #- guest_wait # wait until guest agent responds, otherwise might get stranded on other input - ddc # (default) Use ddc-rs #exec: ["ddcutil", "-g", "BNQ", "setvcp", "0x60", "{}"] #- exec: [ddccontrol, -r, "0x60", -w, "{}", /dev/i2c-5] @@ -33,9 +32,15 @@ qemu: #driver: ps2 # use PS/2 in the guest for all input devices (absolute mouse mode unsupported) #driver: usb # use USB keyboard/mouse/tablet in the guest #driver: virtio # Recommended but vioinput drivers must be installed in guest - #keyboard_driver: ps2 # (default) can also be set separately per input type, this should rarely be necessary - #relative_driver: usb # (default) - #absolute_driver: usb # (default) + keyboard_driver: + virtio: + bus: pci.23 + relative_driver: + virtio: + bus: pci.22 + absolute_driver: + virtio: + bus: pci.21 #driver: virtio #relative_driver: virtio qmp_socket: /tmp/vfio-qmp # path to QMP socket diff --git a/config/users/kat/default.nix b/config/users/kat/default.nix index 1c7921a3..31c386a8 100644 --- a/config/users/kat/default.nix +++ b/config/users/kat/default.nix @@ -17,6 +17,15 @@ dirImports // { ]; }; server = { }; + guiX11Full = { + imports = with dirImports; [ + gui + i3 + dev + media + personal + ]; + }; guiFull = { imports = with dirImports; [ gui diff --git a/config/users/kat/gui/packages.nix b/config/users/kat/gui/packages.nix index 3213daa5..21131ab2 100644 --- a/config/users/kat/gui/packages.nix +++ b/config/users/kat/gui/packages.nix @@ -5,7 +5,6 @@ _1password btop bitwarden - element-wayland obsidian discord exiftool @@ -25,5 +24,6 @@ yubikey-manager jmtpfs cryptsetup - ]; + ] ++ lib.optional config.wayland.windowManager.sway.enable element-wayland + ++ lib.optional config.xsession.windowManager.i3.enable element-desktop; } diff --git a/config/users/kat/i3/i3.nix b/config/users/kat/i3/i3.nix new file mode 100644 index 00000000..59c61c4d --- /dev/null +++ b/config/users/kat/i3/i3.nix @@ -0,0 +1,584 @@ +{ config, base16, pkgs, lib, ... }: with lib; + +{ + services.i3gopher = { enable = true; }; + + kw.theme.swaylock = false; + + services.polybar = { + enable = true; + script = let + xrandr = filter: "${pkgs.xorg.xrandr}/bin/xrandr -q | ${pkgs.gnugrep}/bin/grep -F ' ${filter}' | ${pkgs.coreutils}/bin/cut -d' ' -f1"; + in mkIf config.xsession.enable '' + primary=$(${xrandr "connected primary"}) + for display in $(${xrandr "connected"}); do + export POLYBAR_MONITOR=$display + export POLYBAR_MONITOR_PRIMARY=$([[ $primary = $display ]] && echo true || echo false) + export POLYBAR_TRAY_POSITION=$([[ $primary = $display ]] && echo right || echo none) + polybar arc & + done + ''; + package = pkgs.polybarFull; + config = { + "bar/base" = { + modules-left = mkIf config.xsession.windowManager.i3.enable ( + mkBefore [ "i3" ] + ); + modules-center = mkMerge [ + (mkIf (config.home.nixos.hardware.pulseaudio.enable or false || config.home.nixos.services.pipewire.enable or false) (mkBefore [ "pulseaudio" "mic" ])) + (mkIf config.services.playerctld.enable [ "sep" "mpris" ]) + (mkIf (config.programs.ncmpcpp.enable && !config.services.playerctld.enable) [ "sep" "mpd" ]) + ]; + modules-right = mkMerge [ + [ "net-enp34s0" ] + (mkOrder 1240 [ "sep" ]) + (mkOrder 1250 [ "cpu" "temp" "ram" ]) + (mkOrder 1490 [ "sep" ]) + (mkAfter [ "utc" "date" ]) + ]; + }; + }; + settings = let + colours = base16.map.hash.argb; + warn-colour = colours.constant; # or deleted + in with colours; { + "bar/arc" = { + "inherit" = "bar/base"; + monitor = { + text = mkIf config.xsession.enable "\${env:POLYBAR_MONITOR:}"; + }; + height = 20; + enable-ipc = true; + tray = { + maxsize = 12; + position = "\${env:POLYBAR_TRAY_POSITION:right}"; + }; + dpi = { + x = 0; + y = 0; + }; + scroll = { + up = "#i3.prev"; + down = "#i3.next"; + }; + font = [ + "${config.kw.theme.font.name}:size=9" + "Font Awesome 5 Free Solid:size=9" + "Font Awesome 5 Free Brands:size=9" + ]; + padding = { + right = 1; + }; + separator = { + text = " "; + foreground = foreground_status; + }; + background = background_status; + foreground = foreground_alt; + border = { + bottom = { + size = 1; + color = background_light; + }; + }; + module-margin = 0; + #click-right = ""; menu of some sort? + }; + "module/i3" = mkIf config.xsession.windowManager.i3.enable { + type = "internal/i3"; + pin-workspaces = true; + strip-wsnumbers = true; + wrapping-scroll = false; + enable-scroll = false; # handled by bar instead + label = { + mode = { + padding = 2; + foreground = constant; + background = background_selection; + }; + focused = { + text = "%name%"; + padding = 1; + foreground = background_alt; + background = regex; + }; + unfocused = { + text = "%name%"; + padding = 1; + foreground = foreground_alt; + background = background_light; + }; + /*visible = { + text = "%name%"; + padding = 1; + foreground = foreground; + #background = background; + }; + urgent = { + text = "%name%"; + padding = 1; + foreground = foreground_status; + background = link; + };*/ + }; + }; + "module/sep" = { + type = "custom/text"; + content = { + text = "|"; + foreground = comment; + }; + }; + "module/ram" = { + type = "internal/memory"; + interval = 4; + label = "%gb_used% %percentage_used%% ~ %gb_free%"; + warn-percentage = 90; + format.warn.foreground = warn-colour; + }; + "module/cpu" = { + type = "internal/cpu"; + label = "🖥️ %percentage%%"; # 🧮 + interval = 2; + warn-percentage = 90; + format.warn.foreground = warn-colour; + }; + "module/mpd" = let + ncmpcpp = config.programs.ncmpcpp; + in mkIf ncmpcpp.enable { + type = "internal/mpd"; + + host = mkIf (ncmpcpp.mpdHost != null) ncmpcpp.mpdHost; + password = mkIf (ncmpcpp.mpdPassword != null) ncmpcpp.mpdPassword; + port = mkIf (ncmpcpp.mpdPort != null) ncmpcpp.mpdPort; + + interval = 1; + label-song = "♪ %artist% - %title%"; + format = { + online = " "; + playing = "\${self.format-online}"; + }; + }; + "module/net-enp34s0" = { + type = "internal/network"; + interface = "enp34s0"; + }; + "module/pulseaudio" = { + type = "internal/pulseaudio"; + use-ui-max = false; + interval = 5; + format.volume = " "; + ramp.volume = [ "🔈" "🔉" "🔊" ]; + label = { + muted = { + text = "🔇 muted"; + foreground = warn-colour; + }; + }; + }; + "module/date" = { + type = "internal/date"; + label = "%date%, %time%"; + format = "