configure sway

This commit is contained in:
Astreaprtcl 2025-12-19 01:54:22 +01:00
parent 61ecbd9721
commit f9138672e8
17 changed files with 322 additions and 25 deletions

View file

@ -1,23 +1,14 @@
{
inputs = {
# This is pointing to an unstable release.
# If you prefer a stable release instead, you can this to the latest number shown here: https://nixos.org/download
# i.e. nixos-24.11
# Use `nix flake update` to update the flake to the latest revision of the chosen release channel.
haumea.url = "github:nix-community/haumea";
home-manager.url = "github:nix-community/home-manager";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
};
outputs = inputs@{ self, nixpkgs, home-manager, ... }: {
# NOTE: 'nixos' is the default hostname
nixosConfigurations = {
galen = nixpkgs.lib.nixosSystem {
modules = [
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
}
./systems/galen/configuration.nix
];
};

View file

@ -2,11 +2,15 @@
{
imports = [
./boot.nix
./default.nix
./git.nix
./greetd.nix
./home-manager.nix
./lix.nix
./nix.nix
./polkit.nix
./qemuGuest.nix
./security.nix
];
}

15
programs/boot.nix Normal file
View file

@ -0,0 +1,15 @@
{ pkgs, ... }:
{
boot = {
kernelPackages = pkgs.linuxPackages_latest;
loader = {
timeout = 3;
efi.canTouchEfiVariables = true;
limine = {
enable = true;
style.wallpapers = [];
};
};
};
}

View file

@ -1,5 +1,8 @@
{ ... }:
{ pkgs, ... }:
{
programs.git.enable = true;
environment.systemPackages = with pkgs; [
openssh
git
];
}

View file

@ -1,5 +1,8 @@
{ home-manager, ... }:
{
home-manager.backupFileExtension = "backup";
home-manager = {
backupFileExtension = "backup";
useUserPackages = true;
};
}

8
programs/nix.nix Normal file
View file

@ -0,0 +1,8 @@
{ ... }:
{
nix.settings.experimental-features = [
"nix-command"
"flakes"
];
}

17
programs/qemuGuest.nix Normal file
View file

@ -0,0 +1,17 @@
{ config, lib, ... }:
let
inherit (lib) mkEnableOption;
cfg = config.modules.vmGuest;
in
{
options.modules.vmGuest.enable = mkEnableOption "Enable VM Guest addons";
config = {
services = {
qemuGuest.enable = cfg.enable;
spice-vdagentd.enable = cfg.enable;
};
};
}

8
programs/security.nix Normal file
View file

@ -0,0 +1,8 @@
{ pkgs, ... }:
{
security = {
sudo.enable = false;
sudo-rs.enable = true;
};
}

View file

@ -12,11 +12,7 @@
];
users.mara.enable = true;
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
boot.kernelPackages = pkgs.linuxPackages_latest;
modules.vmGuest.enable = true;
networking.hostName = "galen";
networking.networkmanager.enable = true;

View file

@ -1,11 +1,10 @@
{ config, lib, pkgs, home-manager, ... }:
let
inherit (lib) mkEnableOption mkIf;
cfg = config.users.mara;
in
with lib;
{
options.users.mara.enable = mkEnableOption "Enable the user Mara";
@ -22,6 +21,7 @@ with lib;
username = "mara";
homeDirectory = "/home/mara";
};
custom.backgroundDir = config.home.homeDirectory + "/Pictures/Archive/Wallpaper/Landscape";
};
programs.fish.enable = true;

View file

@ -3,8 +3,11 @@
{
imports = [
./fish.nix
./fuzzel.nix
./helix.nix
./kitty.nix
./nix.nix
./sway.nix
./swww.nix
];
}

View file

@ -0,0 +1,35 @@
{ ... }:
{
programs.fuzzel = {
enable = true;
settings = {
main = {
icons-enabled = "no";
font = "Maple Mono NF:size=12";
dpi-aware = "no";
horizontal-pad = 8;
vertical-pad = 8;
inner-pad = 8;
width = 64;
};
colors = {
background = "23213688";
text = "e0def4ff";
prompt = "e0def4ff";
input = "e0def4ff";
match = "8f66c6ff";
selection = "eb6f92ff";
selection-text = "232136ff";
selection-match = "232136ff";
border = "8f66c6ff";
};
border = {
width = 2;
radius = 2;
};
};
};
}

View file

@ -1,4 +1,4 @@
{ pkgs, ... }:
{ lib, pkgs, ... }:
{
programs.helix = {
@ -20,7 +20,7 @@
{
name = "nix";
auto-format = true;
formatter.command = "${pkgs.nixfmt}/bin/nixfmt";
formatter.command = "${lib.getExe pkgs.nixfmt-rfc-style} -s";
}
];

View file

@ -10,6 +10,8 @@
size = 11;
};
shellIntegration.enableFishIntegration = true;
settings = {
confirm_os_window_close = 0;
enable_audio_bell = false;

View file

@ -0,0 +1,8 @@
{ ... }:
{
programs.nix-index = {
enable = true;
enableFishIntegration = true;
};
}

View file

@ -1,12 +1,179 @@
{ ... }:
{ config, lib, pkgs, ... }:
let
inherit (lib) concatMapStringsSep getExe getExe';
in
{
wayland.windowManager.sway = {
enable = true;
package = pkgs.swayfx;
wrapperFeatures.gtk = true;
checkConfig = false;
extraConfigEarly = ''
blur enable
blur_passes 2
blur_radius 4
shadows enable
shadow_blur_radius 16
layer_effects "waybar" blur enable
layer_effects "launcher" blur enable
layer_effects "notifications" blur enable
'';
config = rec {
modifier = "Mod4";
terminal = "kitty";
modifier = "Mod1";
input."*" = {
xkb_layout = "de,gb";
xkb_variant = ",colemak_dh";
xkb_numlock = "enabled";
};
output."BOE 0x0BCA Unknown".scale = "1.5";
seat = {
"*".hide_cursor = "when-typing enable";
seat0.fallback = "true";
seat1."\r" = concatMapStringsSep "\n " (s: " attach ${s}") [
"9390:4610:Rapoo_Rapoo_Gaming_Device"
"9390:4610:Rapoo_Rapoo_Gaming_Device_Keyboard"
];
};
keybindings =
let
mod = config.wayland.windowManager.sway.config.modifier;
in
{
# Computer Control
"${modifier}+Escape" = "exit";
"${modifier}+Shift+Escape" = "exec ${getExe' pkgs.coreutils "printf"} 'poweroff\\nreboot\\nhibernate\\n' | ${getExe pkgs.fuzzel} -d'";
# Focus
"${modifier}+Down" = "focus down";
"${modifier}+Left" = "focus left";
"${modifier}+Right" = "focus right";
"${modifier}+Up" = "focus up";
# Movement
"${modifier}+Shift+Down" = "move down";
"${modifier}+Shift+Left" = "move left";
"${modifier}+Shift+Right" = "move right";
"${modifier}+Shift+Up" = "move up";
# Toggle
"${modifier}+Shift+f" = "fullscreen toggle";
"${modifier}+Shift+space" = "floating toggle";
# Workspaces
"${modifier}+Ctrl+Left" = "workspace prev";
"${modifier}+Ctrl+Right" = "workspace next";
"${modifier}+Ctrl+Shift+Left" = "move window to workspace prev";
"${modifier}+Ctrl+Shift+Right" = "move window to workspace next";
"${modifier}+1" = "workspace number 1";
"${modifier}+Shift+1" = "move window to workspace number 1";
"${modifier}+2" = "workspace number 2";
"${modifier}+Shift+2" = "move window to workspace number 2";
"${modifier}+3" = "workspace number 3";
"${modifier}+Shift+3" = "move window to workspace number 3";
"${modifier}+4" = "workspace number 4";
"${modifier}+Shift+4" = "move window to workspace number 4";
"${modifier}+5" = "workspace number 5";
"${modifier}+Shift+5" = "move window to workspace number 5";
"${modifier}+6" = "workspace number 6";
"${modifier}+Shift+6" = "move window to workspace number 6";
"${modifier}+7" = "workspace number 7";
"${modifier}+Shift+7" = "move window to workspace number 7";
"${modifier}+8" = "workspace number 8";
"${modifier}+Shift+8" = "move window to workspace number 8";
"${modifier}+9" = "workspace number 9";
"${modifier}+Shift+9" = "move window to workspace number 9";
"${modifier}+0" = "workspace number 0";
"${modifier}+Shift+0" = "move window to workspace number 0";
# Sway Control
"${modifier}+Shift+q" = "kill";
"${modifier}+Shift+c" = "reload";
"${modifier}+Shift+r" = "restart";
# Shadow Dimension
"${modifier}+Shift+Tab" = "move scratchpad";
"${modifier}+Tab" = "scratchpad show";
# Programs
"${modifier}+a" = "exec ${getExe pkgs.nemo}";
"${modifier}+Return" = "exec ${getExe pkgs.kitty}";
# dmenu
"${modifier}+d" = "exec ${getExe pkgs.fuzzel}";
};
colors = {
background = "#856cf9";
focused = {
background = "#182030";
border = "#5c4a94";
childBorder = "#856cd9";
indicator = "#856cd9";
text = "#856cd9";
};
focusedInactive = {
background = "#5c4a94";
border = "#5c4a94";
childBorder = "#5c4a94";
indicator = "#5c4a94";
text = "#5c4a94";
};
unfocused = {
background = "#5c4a94";
border = "#5c4a94";
childBorder = "#5c4a94";
indicator = "#5c4a94";
text = "#5c4a94";
};
urgent = {
background = "#2f343a";
border = "#900000";
childBorder = "#ffffff";
indicator = "#900000";
text = "#900000";
};
placeholder = {
background = "#000000";
border = "#0c0c0c";
childBorder = "#ffffff";
indicator = "#000000";
text = "#0c0c0c";
};
};
gaps = {
inner = 5;
outer = 0;
};
floating = {
border = 2;
titlebar = false;
};
window = {
border = 2;
titlebar = false;
commands = [
{
criteria.app_id = ".*";
command = "inhibit_idle fullscreen";
}
{
criteria.app_id = "org\.keepassxc\.KeePassXC";
command = "floating enable";
}
{
criteria.app_id = "xfce-polkit";
command = "floating enable";
}
];
};
};
};
}

View file

@ -0,0 +1,37 @@
{ config, lib, pkgs, ... }:
let
inherit (lib) getExe getExe' mkOption types;
in
{
options.custom.backgroundDir = mkOption {
default = config.home.homeDirectory + "/Pictures/Backgrounds";
type = with types; uniq str;
};
config = {
services.swww.enable = true;
systemd.user = {
services.swww-randomize = {
Unit = {
Description = "randomly change the swww background image";
Requires = "swww.service";
};
Service = {
Type = "oneshot";
ExecStart = "${getExe pkgs.bash} -c '${getExe pkgs.findutils} ${config.custom.backgroundDir} -type f | ${getExe' pkgs.coreutils "shuf"} -n 1 | ${getExe' pkgs.findutils "xargs"} ${getExe pkgs.swww} img --transition-step 16'";
};
Install.WantedBy = [ "default.target" ];
};
timers.swww-randomize = {
Unit.Description = "randomly changes the swww background image";
Timer = {
Unit = "swww-random";
OnCalendar = "*-*-* *:00,30:00";
};
Install.WantedBy = [ "timers.target" ];
};
};
};
}