Introduce a variable for sway includes and disable relatime on the zfs legacy mounts.

This commit is contained in:
Tom Alexander 2025-01-12 15:32:24 -05:00
parent a817464b38
commit 5146a114eb
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
4 changed files with 177 additions and 130 deletions

View File

@ -119,6 +119,27 @@ lib.mkIf (!config.me.buildingIso) {
fileSystems."/state".neededForBoot = true; fileSystems."/state".neededForBoot = true;
fileSystems."/home".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. # Only attempt to decrypt the main pool. Otherwise it attempts to decrypt pools that aren't even used.
boot.zfs.requestEncryptionCredentials = [ "zroot/linux/nix" ]; boot.zfs.requestEncryptionCredentials = [ "zroot/linux/nix" ];
} }

View File

@ -5,6 +5,14 @@
... ...
}: }:
let
exec_kanshi = pkgs.writeTextFile {
name = "exec_kanshi.conf";
text = ''
exec kanshi
'';
};
in
{ {
imports = [ ]; imports = [ ];
@ -12,6 +20,10 @@
kanshi kanshi
]; ];
me.swayIncludes = [
exec_kanshi
];
home-manager.users.talexander = home-manager.users.talexander =
{ pkgs, ... }: { pkgs, ... }:
{ {

View File

@ -34,19 +34,11 @@ let
# Do not show a title bar on windows # Do not show a title bar on windows
default_border pixel 2 default_border pixel 2
hide_edge_borders smart_no_gaps
bindsym $mod+grave exec $term bindsym $mod+grave exec $term
include ${base-hotkeys} ${lib.concatMapStringsSep "\n" (item: "include ${item}") config.me.swayIncludes}
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}
''; '';
}; };
base-hotkeys = pkgs.writeTextFile { 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 { announce_sway_start = pkgs.writeTextFile {
name = "announce_sway_start.conf"; name = "announce_sway_start.conf";
text = '' 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" '' start_screen_share = pkgs.writeShellScriptBin "start_screen_share" ''
# Disable displaying notifications. This is useful for video conference screen sharing. # Disable displaying notifications. This is useful for video conference screen sharing.
set -euo pipefail set -euo pipefail
@ -295,108 +259,132 @@ in
../kanshi ../kanshi
]; ];
environment.systemPackages = with pkgs; [ options.me.swayIncludes = lib.mkOption {
alacritty type = lib.types.listOf lib.types.package;
pcmanfm default = [ ];
start_screen_share example = lib.literalExpression ''
stop_screen_share [ (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. config = {
programs.sway.extraSessionCommands = environment.systemPackages = with pkgs; [
if config.me.buildingIso then alacritty
'' pcmanfm
export WLR_RENDERER_ALLOW_SOFTWARE=1 start_screen_share
export NIXOS_OZONE_WL=1 # Wayland support for chromium and electron stop_screen_share
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
'';
programs.sway = { me.swayIncludes = [
enable = true; base-hotkeys
wrapperFeatures.gtk = true; display-configs
extraOptions = 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 if config.me.buildingIso then
[ ''
"--debug" export WLR_RENDERER_ALLOW_SOFTWARE=1
"--config" export NIXOS_OZONE_WL=1 # Wayland support for chromium and electron
"${sway-config}" export QT_QPA_PLATFORMTHEME=gtk3 # Use gtk theme in Qt applications
"--unsupported-gpu" ''
]
else else
[ ''
"--debug" export WLR_RENDERER=vulkan
"--config" export NIXOS_OZONE_WL=1 # Wayland support for chromium and electron
"${sway-config}" export QT_QPA_PLATFORMTHEME=gtk3 # Use gtk theme in Qt applications
]; '';
};
environment.persistence."/state" = lib.mkIf (!config.me.buildingIso) { programs.sway = {
hideMounts = true;
users.talexander = {
files = [
".cache/wofi-drun" # Execution history for wofi to sort results
];
};
};
xdg = {
portal = {
enable = true; enable = true;
extraPortals = with pkgs; [ wrapperFeatures.gtk = true;
xdg-desktop-portal-wlr extraOptions =
xdg-desktop-portal-gtk if config.me.buildingIso then
]; [
wlr = { "--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; enable = true;
settings = { extraPortals = with pkgs; [
# uninteresting for this problem, for completeness only xdg-desktop-portal-wlr
screencast = { xdg-desktop-portal-gtk
# output_name = "eDP-1"; ];
max_fps = 30; wlr = {
exec_before = "${start_screen_share}"; enable = true;
exec_after = "${stop_screen_share}"; settings = {
chooser_type = "simple"; # uninteresting for this problem, for completeness only
chooser_cmd = "${pkgs.slurp}/bin/slurp -f %o -or"; 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
'';
} }

View File

@ -5,6 +5,28 @@
... ...
}: }:
let 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 = waybar_available_memory =
(pkgs.writeScriptBin "waybar_custom_available_memory" ( (pkgs.writeScriptBin "waybar_custom_available_memory" (
builtins.readFile ./files/waybar_scripts/waybar_available_memory_linux.bash builtins.readFile ./files/waybar_scripts/waybar_available_memory_linux.bash
@ -72,6 +94,10 @@ in
wlsunset # for night mode wlsunset # for night mode
]; ];
me.swayIncludes = [
waybar_sway_config
];
services.upower.enable = true; # for battery services.upower.enable = true; # for battery
home-manager.users.talexander = home-manager.users.talexander =