hosts/youko: sway

This commit is contained in:
Nikodem Rabuliński 2025-01-16 13:44:22 +01:00
parent aaa0b853f7
commit 2dc36618af
Signed by: nrabulinski
SSH key fingerprint: SHA256:eJRdE3KzMWWk9zrksGEv8+v6F+VqUVR++z2SSPyiL0I
2 changed files with 147 additions and 0 deletions

View file

@ -5,6 +5,7 @@
imports = [
./disks.nix
./hardware.nix
./sway.nix
];
nixpkgs.hostPlatform = "x86_64-linux";
@ -18,5 +19,14 @@
age.secrets.niko-pass.file = ../../secrets/youko-niko-pass.age;
users.users.${username}.hashedPasswordFile = config.age.secrets.niko-pass.path;
settei.user.config = {
settei.desktop.enable = true;
};
services.udisks2.enable = true;
settei.incus.enable = true;
virtualisation.podman.enable = true;
hardware.keyboard.qmk.enable = true;
};
}

137
hosts/youko/sway.nix Normal file
View file

@ -0,0 +1,137 @@
{
config,
lib,
pkgs,
...
}:
{
services.greetd = {
enable = true;
vt = 2;
settings.default_session =
let
swayWrapper = pkgs.writeShellScript "sway-wrapper" ''
export XCURSOR_THEME=volantes_cursors
exec ${lib.getExe config.programs.sway.package}
'';
in
{
command = "${lib.getExe pkgs.greetd.tuigreet} --time --cmd ${swayWrapper}";
user = "niko";
};
};
programs.sway = {
enable = true;
wrapperFeatures.base = true;
wrapperFeatures.gtk = true;
};
security.pam.services.swaylock = { };
xdg.portal.config.common.default = "*";
settei.user.config =
{ config, ... }:
{
home.pointerCursor = {
name = "volantes_cursors";
package = pkgs.volantes-cursors;
};
home.packages = with pkgs; [
(writeShellApplication {
name = "lock";
text = ''
swaymsg output '*' power off
swaylock -c 000000
swaymsg output '*' power on
'';
})
(writeShellApplication {
name = "screenshot";
runtimeInputs = [
slurp
grim
wl-clipboard
];
text = ''
grim -g "$(slurp)" - | \
wl-copy -t image/png
'';
})
# Bitwarden stuff, move to separate module or properly package?
# Maybe use some other input method?
(rofi-rbw.override { waylandSupport = true; })
rbw
pinentry-rofi
];
wayland.windowManager.sway =
let
mod = config.wayland.windowManager.sway.config.modifier;
in
{
enable = true;
package = null;
config.workspaceAutoBackAndForth = true;
config.terminal = "wezterm";
config.modifier = "Mod4";
config.fonts.names = [ "IosevkaTerm Nerd Font" ];
config.keybindings = lib.mkOptionDefault {
"${mod}+b" = "exec rofi-rbw --selector rofi";
"${mod}+d" = "exec rofi -show drun";
"${mod}+Shift+s" = "exec screenshot";
};
config.keycodebindings = {
"${mod}+Shift+60" = "exec lock";
};
config.window.commands =
let
alwaysFloating = [
{ window_role = "pop-up"; }
{ window_role = "bubble"; }
{ window_role = "dialog"; }
{ window_type = "dialog"; }
{ window_role = "task_dialog"; }
{ window_type = "menu"; }
{ app_id = "floating"; }
{ app_id = "floating_update"; }
{ class = "(?i)pinentry"; }
{ title = "Administrator privileges required"; }
{ title = "About Mozilla Firefox"; }
{ window_role = "About"; }
{
app_id = "firefox";
title = "Library";
}
];
in
map (criteria: {
inherit criteria;
command = "floating enable";
}) alwaysFloating;
config.input = {
"type:pointer" = {
accel_profile = "flat";
pointer_accel = "0.2";
};
"type:keyboard" = {
xkb_layout = "pl";
};
};
config.seat."*" = {
xcursor_theme = "volantes_cursors 24";
};
config.startup = [
{
command = "${lib.getExe' pkgs.glib "gsettings"} set org.gnome.desktop.interface cursor-theme 'volantes_cursors'";
always = true;
}
];
};
programs.rofi = {
enable = true;
package = pkgs.rofi-wayland;
};
};
}