diff --git a/nix/configuration/hosts/odo/disk-config.nix b/nix/configuration/hosts/odo/disk-config.nix index 7df6f5e..07048d4 100644 --- a/nix/configuration/hosts/odo/disk-config.nix +++ b/nix/configuration/hosts/odo/disk-config.nix @@ -119,6 +119,27 @@ lib.mkIf (!config.me.buildingIso) { fileSystems."/state".neededForBoot = true; fileSystems."/home".neededForBoot = true; + fileSystems."/".options = [ + "noatime" + "norelatime" + ]; + fileSystems."/nix".options = [ + "noatime" + "norelatime" + ]; + fileSystems."/persist".options = [ + "noatime" + "norelatime" + ]; + fileSystems."/state".options = [ + "noatime" + "norelatime" + ]; + fileSystems."/home".options = [ + "noatime" + "norelatime" + ]; + # Only attempt to decrypt the main pool. Otherwise it attempts to decrypt pools that aren't even used. boot.zfs.requestEncryptionCredentials = [ "zroot/linux/nix" ]; } diff --git a/nix/configuration/roles/kanshi/default.nix b/nix/configuration/roles/kanshi/default.nix index 0ffecd2..5022fdd 100644 --- a/nix/configuration/roles/kanshi/default.nix +++ b/nix/configuration/roles/kanshi/default.nix @@ -5,6 +5,14 @@ ... }: +let + exec_kanshi = pkgs.writeTextFile { + name = "exec_kanshi.conf"; + text = '' + exec kanshi + ''; + }; +in { imports = [ ]; @@ -12,6 +20,10 @@ kanshi ]; + me.swayIncludes = [ + exec_kanshi + ]; + home-manager.users.talexander = { pkgs, ... }: { diff --git a/nix/configuration/roles/sway/default.nix b/nix/configuration/roles/sway/default.nix index ffe187c..183e6c3 100644 --- a/nix/configuration/roles/sway/default.nix +++ b/nix/configuration/roles/sway/default.nix @@ -34,19 +34,11 @@ let # Do not show a title bar on windows default_border pixel 2 + hide_edge_borders smart_no_gaps bindsym $mod+grave exec $term - include ${base-hotkeys} - include ${display-configs} - include ${window-management} - include ${movement} - include ${disable-focus-follows-mouse} - include ${background} - include ${touchpad_input} - include ${waybar} - include ${announce_sway_start} - include ${exec_kanshi} + ${lib.concatMapStringsSep "\n" (item: "include ${item}") config.me.swayIncludes} ''; }; base-hotkeys = pkgs.writeTextFile { @@ -232,27 +224,6 @@ let } ''; }; - waybar = pkgs.writeTextFile { - name = "waybar.conf"; - text = '' - # - # Status Bar: - # - # Read `man 5 sway-bar` for more information about this section. - bar { - position top - - font pango:Cascadia Mono, FontAwesome 10 - swaybar_command waybar - - colors { - statusline #ffffff - background #323232 - inactive_workspace #32323200 #32323200 #5c5c5c - } - } - ''; - }; announce_sway_start = pkgs.writeTextFile { name = "announce_sway_start.conf"; text = '' @@ -262,13 +233,6 @@ let ''; }; - exec_kanshi = pkgs.writeTextFile { - name = "exec_kanshi.conf"; - text = '' - exec kanshi - ''; - }; - start_screen_share = pkgs.writeShellScriptBin "start_screen_share" '' # Disable displaying notifications. This is useful for video conference screen sharing. set -euo pipefail @@ -295,108 +259,132 @@ in ../kanshi ]; - environment.systemPackages = with pkgs; [ - alacritty - pcmanfm - start_screen_share - stop_screen_share - ]; + options.me.swayIncludes = lib.mkOption { + type = lib.types.listOf lib.types.package; + default = [ ]; + example = lib.literalExpression '' + [ (pkgs.writeTextFile { + name = "launch-kanshi.conf"; + text = "exec kanshi"; + }) ]''; + description = "List of packages to import as sway configs."; + }; - # Probably would be cleaner to use environment.sessionVariables but programs.sway.extraSessionCommands is sway-specific. - programs.sway.extraSessionCommands = - if config.me.buildingIso then - '' - export WLR_RENDERER_ALLOW_SOFTWARE=1 - export NIXOS_OZONE_WL=1 # Wayland support for chromium and electron - export QT_QPA_PLATFORMTHEME=gtk3 # Use gtk theme in Qt applications - '' - else - '' - export WLR_RENDERER=vulkan - export NIXOS_OZONE_WL=1 # Wayland support for chromium and electron - export QT_QPA_PLATFORMTHEME=gtk3 # Use gtk theme in Qt applications - ''; + config = { + environment.systemPackages = with pkgs; [ + alacritty + pcmanfm + start_screen_share + stop_screen_share + ]; - programs.sway = { - enable = true; - wrapperFeatures.gtk = true; - extraOptions = + me.swayIncludes = [ + base-hotkeys + display-configs + window-management + movement + disable-focus-follows-mouse + background + touchpad_input + announce_sway_start + ]; + + # Probably would be cleaner to use environment.sessionVariables but programs.sway.extraSessionCommands is sway-specific. + programs.sway.extraSessionCommands = if config.me.buildingIso then - [ - "--debug" - "--config" - "${sway-config}" - "--unsupported-gpu" - ] + '' + export WLR_RENDERER_ALLOW_SOFTWARE=1 + export NIXOS_OZONE_WL=1 # Wayland support for chromium and electron + export QT_QPA_PLATFORMTHEME=gtk3 # Use gtk theme in Qt applications + '' else - [ - "--debug" - "--config" - "${sway-config}" - ]; - }; + '' + export WLR_RENDERER=vulkan + export NIXOS_OZONE_WL=1 # Wayland support for chromium and electron + export QT_QPA_PLATFORMTHEME=gtk3 # Use gtk theme in Qt applications + ''; - environment.persistence."/state" = lib.mkIf (!config.me.buildingIso) { - hideMounts = true; - users.talexander = { - files = [ - ".cache/wofi-drun" # Execution history for wofi to sort results - ]; - }; - }; - - xdg = { - portal = { + programs.sway = { enable = true; - extraPortals = with pkgs; [ - xdg-desktop-portal-wlr - xdg-desktop-portal-gtk - ]; - wlr = { + wrapperFeatures.gtk = true; + extraOptions = + if config.me.buildingIso then + [ + "--debug" + "--config" + "${sway-config}" + "--unsupported-gpu" + ] + else + [ + "--debug" + "--config" + "${sway-config}" + ]; + }; + + environment.persistence."/state" = lib.mkIf (!config.me.buildingIso) { + hideMounts = true; + users.talexander = { + files = [ + ".cache/wofi-drun" # Execution history for wofi to sort results + ]; + }; + }; + + xdg = { + portal = { enable = true; - settings = { - # uninteresting for this problem, for completeness only - screencast = { - # output_name = "eDP-1"; - max_fps = 30; - exec_before = "${start_screen_share}"; - exec_after = "${stop_screen_share}"; - chooser_type = "simple"; - chooser_cmd = "${pkgs.slurp}/bin/slurp -f %o -or"; + extraPortals = with pkgs; [ + xdg-desktop-portal-wlr + xdg-desktop-portal-gtk + ]; + wlr = { + enable = true; + settings = { + # uninteresting for this problem, for completeness only + screencast = { + # output_name = "eDP-1"; + max_fps = 30; + exec_before = "${start_screen_share}"; + exec_after = "${stop_screen_share}"; + chooser_type = "simple"; + chooser_cmd = "${pkgs.slurp}/bin/slurp -f %o -or"; + }; }; }; }; }; + + home-manager.users.talexander = + { pkgs, ... }: + { + home.file = { + # Configure default programs (for example, default browser) + ".config/mimeapps.list" = { + source = ./files/mimeapps.list; + }; + }; + home.file = { + ".config/gtk-3.0/settings.ini" = { + source = ./files/settings.ini; + }; + }; + home.file = { + ".icons/default" = { + source = "${pkgs.adwaita-icon-theme}/share/icons/Adwaita"; + }; + }; + }; + + # For mounting drives in pcmanfm + services.gvfs.enable = true; + + # Auto-launch sway + environment.loginShellInit = '' + # TODO: This shouldn't be shoe-horned into the sway config + doas iw dev wlan0 set power_save off + [[ "$(tty)" = "/dev/tty1" ]] && exec sway + ''; }; - - home-manager.users.talexander = - { pkgs, ... }: - { - home.file = { - # Configure default programs (for example, default browser) - ".config/mimeapps.list" = { - source = ./files/mimeapps.list; - }; - }; - home.file = { - ".config/gtk-3.0/settings.ini" = { - source = ./files/settings.ini; - }; - }; - home.file = { - ".icons/default" = { - source = "${pkgs.adwaita-icon-theme}/share/icons/Adwaita"; - }; - }; - }; - - # For mounting drives in pcmanfm - services.gvfs.enable = true; - - # Auto-launch sway - environment.loginShellInit = '' - # TODO: This shouldn't be shoe-horned into the sway config - doas iw dev wlan0 set power_save off - [[ "$(tty)" = "/dev/tty1" ]] && exec sway - ''; } diff --git a/nix/configuration/roles/waybar/default.nix b/nix/configuration/roles/waybar/default.nix index daf5881..d3e714a 100644 --- a/nix/configuration/roles/waybar/default.nix +++ b/nix/configuration/roles/waybar/default.nix @@ -5,6 +5,28 @@ ... }: let + waybar_sway_config = pkgs.writeTextFile { + name = "waybar.conf"; + text = '' + # + # Status Bar: + # + # Read `man 5 sway-bar` for more information about this section. + bar { + position top + + font pango:Cascadia Mono, FontAwesome 10 + swaybar_command waybar + + colors { + statusline #ffffff + background #323232 + inactive_workspace #32323200 #32323200 #5c5c5c + } + } + ''; + }; + waybar_available_memory = (pkgs.writeScriptBin "waybar_custom_available_memory" ( builtins.readFile ./files/waybar_scripts/waybar_available_memory_linux.bash @@ -72,6 +94,10 @@ in wlsunset # for night mode ]; + me.swayIncludes = [ + waybar_sway_config + ]; + services.upower.enable = true; # for battery home-manager.users.talexander =