restructure and further configure sway

This commit is contained in:
Astreaprtcl 2025-12-21 00:44:47 +01:00
parent f9138672e8
commit 8f5c2ff8f6
25 changed files with 476 additions and 256 deletions

10
all.nix
View file

@ -1,8 +1,8 @@
{ ... }:
{ lib, ... }:
{
imports = [
./users/all.nix
./programs/all.nix
];
imports = (
lib.fileset.toList (lib.fileset.fileFilter (f: f.name == "config.nix") ./users)
++ lib.fileset.toList (lib.fileset.fileFilter (f: f.hasExt "nix") ./programs)
);
}

View file

@ -4,15 +4,21 @@
home-manager.url = "github:nix-community/home-manager";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
};
outputs = inputs@{ self, nixpkgs, home-manager, ... }: {
nixosConfigurations = {
galen = nixpkgs.lib.nixosSystem {
modules = [
home-manager.nixosModules.home-manager
./systems/galen/configuration.nix
];
outputs =
inputs@{
self,
nixpkgs,
home-manager,
...
}:
{
nixosConfigurations = {
galen = nixpkgs.lib.nixosSystem {
modules = [
home-manager.nixosModules.home-manager
./systems/galen/configuration.nix
];
};
};
};
};
}

View file

@ -1,16 +0,0 @@
{ ... }:
{
imports = [
./boot.nix
./default.nix
./git.nix
./greetd.nix
./home-manager.nix
./lix.nix
./nix.nix
./polkit.nix
./qemuGuest.nix
./security.nix
];
}

View file

@ -8,7 +8,7 @@
efi.canTouchEfiVariables = true;
limine = {
enable = true;
style.wallpapers = [];
style.wallpapers = [ ];
};
};
};

View file

@ -3,8 +3,10 @@
{
programs.git = {
enable = true;
config = [{
init.defaultBranch = "main";
}];
config = [
{
init.defaultBranch = "main";
}
];
};
}

View file

@ -1,4 +1,4 @@
{ home-manager, ... }:
{ ... }:
{
home-manager = {

View file

@ -1,13 +1,16 @@
{ pkgs, ... }:
{
nixpkgs.overlays = [ (final: prev: {
inherit (prev.lixPackageSets.stable)
nixpkgs-review
nix-eval-jobs
nix-fast-build
colmena;
}) ];
nixpkgs.overlays = [
(final: prev: {
inherit (prev.lixPackageSets.stable)
nixpkgs-review
nix-eval-jobs
nix-fast-build
colmena
;
})
];
nix.package = pkgs.lixPackageSets.stable.lix;
}

28
programs/locale.nix Normal file
View file

@ -0,0 +1,28 @@
{ ... }:
{
time.timeZone = "Europe/Berlin";
i18n = {
defaultLocale = "en_IE.UTF-8";
supportedLocales = [
"C.UTF-8/UTF-8"
"en_GB.UTF-8/UTF-8"
"en_IE.UTF-8/UTF-8"
"en_US.UTF-8/UTF-8"
"de_DE.UTF-8/UTF-8"
];
extraLocaleSettings = {
LANGUAGE = "en_IE.UTF-8";
LC_ADDRESS = "de_DE.UTF-8";
LC_IDENTIFICATION = "de_DE.UTF-8";
LC_MEASUREMENT = "de_DE.UTF-8";
LC_MONETARY = "de_DE.UTF-8";
LC_NAME = "de_DE.UTF-8";
LC_NUMERIC = "de_DE.UTF-8";
LC_PAPER = "de_DE.UTF-8";
LC_TELEPHONE = "de_DE.UTF-8";
LC_TIME = "de_DE.UTF-8";
LANG = "en_IE.UTF-8";
};
};
}

View file

@ -1,8 +1,24 @@
{ ... }:
{
nix.settings.experimental-features = [
"nix-command"
"flakes"
];
nix = {
optimise.automatic = true;
settings = {
auto-optimise-store = true;
experimental-features = [
"nix-command"
"flakes"
];
};
};
programs = {
nix-index.enable = true;
command-not-found.enable = true;
nix-ld.enable = true;
nh = {
enable = true;
clean.enable = true;
flake = "/etc/nixos";
};
};
}

12
programs/programs.nix Normal file
View file

@ -0,0 +1,12 @@
{ pkgs, ... }:
{
programs = {
fish.enable = true;
};
environment.systemPackages = with pkgs; [
brightnessctl
nixfmt-rfc-style
nixfmt-tree
];
}

View file

@ -1,8 +1,9 @@
{ pkgs, ... }:
{ ... }:
{
security = {
sudo.enable = false;
sudo-rs.enable = true;
pam.services.swaylock = { };
};
}

5
programs/system.nix Normal file
View file

@ -0,0 +1,5 @@
{ ... }:
{
system.stateVersion = "25.11";
}

View file

@ -23,6 +23,4 @@
console = {
keyMap = "de";
};
system.stateVersion = "25.11";
}

View file

@ -1,32 +1,47 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
config,
lib,
pkgs,
modulesPath,
...
}:
{
imports =
[ (modulesPath + "/profiles/qemu-guest.nix")
];
imports = [
(modulesPath + "/profiles/qemu-guest.nix")
];
boot.initrd.availableKernelModules = [ "ahci" "xhci_pci" "virtio_pci" "sr_mod" "virtio_blk" ];
boot.initrd.availableKernelModules = [
"ahci"
"xhci_pci"
"virtio_pci"
"sr_mod"
"virtio_blk"
];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/637c5040-7824-4308-bb4b-32b486cb326d";
fsType = "ext4";
};
fileSystems."/" = {
device = "/dev/disk/by-uuid/637c5040-7824-4308-bb4b-32b486cb326d";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/1A25-9FA7";
fsType = "vfat";
options = [ "fmask=0077" "dmask=0077" ];
};
swapDevices =
[ { device = "/dev/disk/by-uuid/b89cb4bb-b75e-4479-9023-cc338835bb74"; }
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/1A25-9FA7";
fsType = "vfat";
options = [
"fmask=0077"
"dmask=0077"
];
};
swapDevices = [
{ device = "/dev/disk/by-uuid/b89cb4bb-b75e-4479-9023-cc338835bb74"; }
];
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
}

View file

@ -1,7 +0,0 @@
{ ... }:
{
imports = [
./mara/config.nix
];
}

View file

@ -1,8 +1,9 @@
{ osConfig, ... }:
{ osConfig, lib, ... }:
{
imports = lib.fileset.toList (lib.fileset.fileFilter (f: f.hasExt "nix") ./default);
programs.home-manager.enable = true;
nixpkgs.config.allowUnfree = true;
home = {
stateVersion = osConfig.system.stateVersion;

42
users/default/swww.nix Normal file
View file

@ -0,0 +1,42 @@
{
config,
lib,
pkgs,
...
}:
{
options.services.swww-randomize = {
enable = lib.mkEnableOption "enable the randomization swww service";
backgroundDir = lib.mkOption {
default = config.home.homeDirectory + "/Pictures/Backgrounds";
description = "directory with images to use for the background";
type = with lib.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 = "${lib.getExe pkgs.bash} -c '${lib.getExe pkgs.findutils} ${config.services.swww-randomize.backgroundDir} -type f | ${lib.getExe' pkgs.coreutils "shuf"} -n 1 | ${lib.getExe' pkgs.findutils "xargs"} ${lib.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-randomize";
OnCalendar = "*-*-* *:00,30:00";
};
Install.WantedBy = [ "timers.target" ];
};
};
};
}

View file

@ -1,28 +1,32 @@
{ config, lib, pkgs, home-manager, ... }:
{
config,
lib,
pkgs,
home-manager,
...
}:
let
inherit (lib) mkEnableOption mkIf;
cfg = config.users.mara;
in
{
options.users.mara.enable = mkEnableOption "Enable the user Mara";
options.users.mara.enable = lib.mkEnableOption "Enable the user Mara";
config = mkIf cfg.enable {
home-manager.users.mara = { config, pkgs, ... }:
config = lib.mkIf cfg.enable {
home-manager.users.mara =
{ config, pkgs, ... }:
{
imports = [
../home-default.nix
./config/all.nix
];
{
imports = (
[ ../default.nix ] ++ lib.fileset.toList (lib.fileset.fileFilter (f: f.hasExt "nix") ./config)
);
home = {
username = "mara";
homeDirectory = "/home/mara";
home = {
username = "mara";
homeDirectory = "/home/mara";
};
};
custom.backgroundDir = config.home.homeDirectory + "/Pictures/Archive/Wallpaper/Landscape";
};
programs.fish.enable = true;

View file

@ -1,13 +0,0 @@
{ ... }:
{
imports = [
./fish.nix
./fuzzel.nix
./helix.nix
./kitty.nix
./nix.nix
./sway.nix
./swww.nix
];
}

View file

@ -14,10 +14,10 @@
'';
fish_right_prompt.body = ''
set stat $status
set -g __fish_git_prompt_showupstream verbose
set -g __fish_git_prompt_showcolorhints 1
printf '%s %s' (fish_vcs_prompt) [(set_color red)$stat(set_color normal)]
set stat $status
set -g __fish_git_prompt_showupstream verbose
set -g __fish_git_prompt_showcolorhints 1
printf '%s %s' (fish_vcs_prompt) [(set_color red)$stat(set_color normal)]
'';
};
};

View file

@ -1,4 +1,4 @@
{ ... }:
{ pkgs, ... }:
{
programs.kitty = {
@ -8,6 +8,7 @@
font = {
name = "Maple Mono NF";
size = 11;
package = pkgs.maple-mono.NF;
};
shellIntegration.enableFishIntegration = true;

View file

@ -1,8 +1,11 @@
{ ... }:
{ pkgs, ... }:
{
programs.nix-index = {
enable = true;
enableFishIntegration = true;
programs = {
nix-index = {
enable = true;
enableFishIntegration = true;
};
nix-search-tv.enable = true;
};
}

View file

@ -1,55 +1,86 @@
{ config, lib, pkgs, ... }:
{
config,
lib,
pkgs,
...
}:
let
inherit (lib) concatMapStringsSep getExe getExe';
inherit (lib)
concatMapStringsSep
getExe
getExe'
mkOption
types
;
in
{
wayland.windowManager.sway = {
enable = true;
package = pkgs.swayfx;
wrapperFeatures.gtk = true;
checkConfig = false;
extraConfigEarly = ''
blur enable
blur_passes 2
blur_radius 4
options.custom.screenShotDir = mkOption {
default = config.home.homeDirectory + "/Pictures/Screenshots";
type = with types; uniq str;
description = "Folder for all screenshots";
};
shadows enable
shadow_blur_radius 16
config = {
services.swww-randomize = {
enable = true;
backgroundDir = config.home.homeDirectory + "/Pictures/Archive/Wallpaper/Landscape";
};
wayland.windowManager.sway = {
enable = true;
package = pkgs.swayfx;
wrapperFeatures.gtk = true;
checkConfig = false;
extraConfigEarly = ''
blur enable
blur_passes 2
blur_radius 4
layer_effects "waybar" blur enable
layer_effects "launcher" blur enable
layer_effects "notifications" blur enable
'';
config = rec {
modifier = "Mod1";
shadows enable
shadow_blur_radius 16
input."*" = {
xkb_layout = "de,gb";
xkb_variant = ",colemak_dh";
xkb_numlock = "enabled";
};
layer_effects "waybar" blur enable
layer_effects "launcher" blur enable
layer_effects "notifications" blur enable
output."BOE 0x0BCA Unknown".scale = "1.5";
bindgesture swipe:right workspace prev
bindgesture swipe:left workspace next
'';
config = rec {
modifier = "Mod1";
terminal = getExe pkgs.kitty;
menu = getExe pkgs.fuzzel;
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"
];
};
input = {
"type:touchpad" = {
tap = "on";
};
"*" = {
accel_profile = "flat";
pointer_accel = "-0.1";
xkb_layout = "de,gb";
xkb_variant = ",colemak_dh";
xkb_numlock = "enabled";
};
};
keybindings =
let
mod = config.wayland.windowManager.sway.config.modifier;
in
{
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 = {
# Computer Control
"${modifier}+Escape" = "exit";
"${modifier}+Shift+Escape" = "exec ${getExe' pkgs.coreutils "printf"} 'poweroff\\nreboot\\nhibernate\\n' | ${getExe pkgs.fuzzel} -d'";
"${modifier}+Shift+Escape" =
"exec ${getExe' pkgs.coreutils "printf"} 'poweroff\\nreboot\\nhibernate\\n' | ${menu} -d | ${getExe' pkgs.findutils "xargs"} ${getExe' pkgs.systemd "systemctl"}";
# Focus
"${modifier}+Down" = "focus down";
@ -90,7 +121,6 @@ in
"${modifier}+0" = "workspace number 0";
"${modifier}+Shift+0" = "move window to workspace number 0";
# Sway Control
"${modifier}+Shift+q" = "kill";
"${modifier}+Shift+c" = "reload";
@ -102,77 +132,111 @@ in
# Programs
"${modifier}+a" = "exec ${getExe pkgs.nemo}";
"${modifier}+Return" = "exec ${getExe pkgs.kitty}";
"${modifier}+Return" = "exec ${terminal}";
# dmenu
"${modifier}+d" = "exec ${getExe pkgs.fuzzel}";
"${modifier}+d" = "exec ${menu}";
"${modifier}+s" =
"exec ${getExe pkgs.bash} -c \"${terminal} ssh $(grep -P '^Host (?!\\*)' ${config.home.homeDirectory}/.ssh/config | ${getExe' pkgs.coreutils "cut"} -d ' ' -f2 | ${menu} -d)\"";
"${modifier}+e" =
"exec ${getExe pkgs.bash} -c \"${getExe pkgs.uni} emoji all -f '%(emoji h) %(cldr_full h Q:[:])' | ${getExe pkgs.gnused} '/^$/d' | ${menu} -d | ${getExe' pkgs.coreutils "cut"} -d ' ' -f1 | ${getExe' pkgs.coreutils "tr"} -d '\\n' | ${getExe' pkgs.wl-clipboard-rs "wl-copy"}\"";
# Wallpaper
"${modifier}+b" = "exec ${getExe' pkgs.systemd "systemctl"} --user start swww-randomize";
# Notifications
"${modifier}+n" = "exec ${getExe' pkgs.dunst "dunstctl"} history-pop";
# Screenshot
"${modifier}+Shift+s" =
"exec ${getExe pkgs.bash} -c \"${getExe' pkgs.coreutils "mkdir"} -p ${config.custom.screenShotDir}; ${getExe pkgs.wayfreeze} --hide-cursor --after-freeze-cmd '${getExe pkgs.sway-contrib.grimshot} savecopy area ${config.custom.screenShotDir}/$(${getExe' pkgs.coreutils "date"} -Iseconds).png; ${getExe pkgs.killall} wayfreeze'\"";
# Screenlock
"${modifier}+l" = "exec --no-startup-id ${getExe pkgs.swaylock}";
# Audio
"--locked XF86AudioLowerVolume" =
"exec ${getExe pkgs.pulsemixer} --change-volume -5 --max-volume 100";
"--locked XF86AudioRaiseVolume" =
"exec ${getExe pkgs.pulsemixer} --change-volume +5 --max-volume 100";
"--locked XF86AudioNext" = "exec ${getExe pkgs.playerctl} next";
"--locked XF86AudioPrev" = "exec ${getExe pkgs.playerctl} previous";
"--locked XF86AudioPause" = "exec ${getExe pkgs.playerctl} play-pause";
"--locked XF86AudioPlay" = "exec ${getExe pkgs.playerctl} play-pause";
"--locked XF86AudioMute" = "exec ${getExe pkgs.pulsemixer} --toggle-mute";
"--locked XF86AudioMicMute" =
"exec ${getExe pkgs.pulsemixer} --toggle-mute --id $(${getExe pkgs.pulsemixer} --list-sources | grep -Po 'source-\\d{2}(?=.*Default$)')";
# Brightness
"--locked XF86MonBrightnessDown" = "exec ${getExe pkgs.brightnessctl} set 5%-";
"--locked XF86MonBrightnessUp" = "exec ${getExe pkgs.brightnessctl} set 5%+";
};
colors = {
background = "#856cf9";
focused = {
background = "#182030";
border = "#5c4a94";
childBorder = "#856cd9";
indicator = "#856cd9";
text = "#856cd9";
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";
};
};
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;
};
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";
}
];
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,92 @@
{
config,
lib,
pkgs,
...
}:
let
inherit (lib) getExe;
in
{
programs.swaylock = {
enable = true;
package = pkgs.swaylock-effects;
settings = {
# Background
color = "#232136";
image = config.services.swww-randomize.backgroundDir + "/Alena_Aenami-Clouds.jpg";
# Swaylock-effects
screenshot = true;
effect-blur = "5x5";
fade-in = "1";
clock = true;
indicator = true;
datestr = "";
# Layout text colors
layout-bg-color = "#00000000";
layout-border-color = "#00000000";
layout-text-color = "#e0def4";
# Text color
text-color = "#3e8fb0";
text-clear-color = "#9ccdf8";
text-caps-lock-color = "#f6c177";
text-ver-color = "#c4a7e7";
text-wrong-color = "#eb6f92";
# Highlight segments
bs-hl-color = "#23213666";
key-hl-color = "#3e8fb0";
caps-lock-bs-hl-color = "#23213666";
caps-lock-key-hl-color = "#f6c177";
# Inside of the indicator
inside-color = "#22222add";
inside-clear-color = "#22222add";
inside-caps-lock-color = "#22222add";
inside-ver-color = "#22222add";
inside-wrong-color = "#22222add";
# Line between inside and ring
line-color = "#3e8fb011";
line-clear-color = "#9ccfd811";
line-caps-lock-color = "#f6c17711";
line-ver-color = "#c4a7e711";
line-wrong-color = "#eb6f9211";
# Indicator ring
ring-color = "#3e8fb0aa";
ring-clear-color = "#9ccfd8aa";
ring-caps-lock-color = "#f6c177aa";
ring-ver-color = "#c4a7e7aa";
ring-wrong-color = "#eb6f92aa";
# Indicator
font = "Maple Mono NF";
indicator-radius = 80;
indicator-thickness = 8;
};
};
services.swayidle = {
enable = true;
timeouts = [
{
timeout = 300;
command = "${getExe pkgs.brightnessctl} -s s $(($(${getExe pkgs.brightnessctl} g) / 2))";
resumeCommand = "${getExe pkgs.brightnessctl} -r";
}
{
timeout = 360;
command = "${getExe pkgs.swaylock-effects} -f";
}
];
events = {
before-sleep = "${getExe pkgs.swaylock-effects} -f";
lock = "${getExe pkgs.swaylock-effects} -f";
};
};
}

View file

@ -1,37 +0,0 @@
{ 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" ];
};
};
};
}