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 = [ imports = (
./users/all.nix lib.fileset.toList (lib.fileset.fileFilter (f: f.name == "config.nix") ./users)
./programs/all.nix ++ lib.fileset.toList (lib.fileset.fileFilter (f: f.hasExt "nix") ./programs)
]; );
} }

View file

@ -4,7 +4,14 @@
home-manager.url = "github:nix-community/home-manager"; home-manager.url = "github:nix-community/home-manager";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
}; };
outputs = inputs@{ self, nixpkgs, home-manager, ... }: { outputs =
inputs@{
self,
nixpkgs,
home-manager,
...
}:
{
nixosConfigurations = { nixosConfigurations = {
galen = nixpkgs.lib.nixosSystem { galen = nixpkgs.lib.nixosSystem {
modules = [ modules = [
@ -15,4 +22,3 @@
}; };
}; };
} }

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

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

View file

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

View file

@ -1,13 +1,16 @@
{ pkgs, ... }: { pkgs, ... }:
{ {
nixpkgs.overlays = [ (final: prev: { nixpkgs.overlays = [
(final: prev: {
inherit (prev.lixPackageSets.stable) inherit (prev.lixPackageSets.stable)
nixpkgs-review nixpkgs-review
nix-eval-jobs nix-eval-jobs
nix-fast-build nix-fast-build
colmena; colmena
}) ]; ;
})
];
nix.package = pkgs.lixPackageSets.stable.lix; 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 = {
optimise.automatic = true;
settings = {
auto-optimise-store = true;
experimental-features = [
"nix-command" "nix-command"
"flakes" "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 = { security = {
sudo.enable = false; sudo.enable = false;
sudo-rs.enable = true; 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 = { console = {
keyMap = "de"; keyMap = "de";
}; };
system.stateVersion = "25.11";
} }

View file

@ -1,31 +1,46 @@
# Do not modify this file! It was generated by nixos-generate-config # Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes # and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead. # to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }: {
config,
lib,
pkgs,
modulesPath,
...
}:
{ {
imports = imports = [
[ (modulesPath + "/profiles/qemu-guest.nix") (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.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ]; boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ]; boot.extraModulePackages = [ ];
fileSystems."/" = fileSystems."/" = {
{ device = "/dev/disk/by-uuid/637c5040-7824-4308-bb4b-32b486cb326d"; device = "/dev/disk/by-uuid/637c5040-7824-4308-bb4b-32b486cb326d";
fsType = "ext4"; fsType = "ext4";
}; };
fileSystems."/boot" = fileSystems."/boot" = {
{ device = "/dev/disk/by-uuid/1A25-9FA7"; device = "/dev/disk/by-uuid/1A25-9FA7";
fsType = "vfat"; fsType = "vfat";
options = [ "fmask=0077" "dmask=0077" ]; options = [
"fmask=0077"
"dmask=0077"
];
}; };
swapDevices = swapDevices = [
[ { device = "/dev/disk/by-uuid/b89cb4bb-b75e-4479-9023-cc338835bb74"; } { device = "/dev/disk/by-uuid/b89cb4bb-b75e-4479-9023-cc338835bb74"; }
]; ];
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; 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; programs.home-manager.enable = true;
nixpkgs.config.allowUnfree = true;
home = { home = {
stateVersion = osConfig.system.stateVersion; 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,27 +1,31 @@
{ config, lib, pkgs, home-manager, ... }: {
config,
lib,
pkgs,
home-manager,
...
}:
let let
inherit (lib) mkEnableOption mkIf;
cfg = config.users.mara; cfg = config.users.mara;
in in
{ {
options.users.mara.enable = mkEnableOption "Enable the user Mara"; options.users.mara.enable = lib.mkEnableOption "Enable the user Mara";
config = mkIf cfg.enable { config = lib.mkIf cfg.enable {
home-manager.users.mara = { config, pkgs, ... }: home-manager.users.mara =
{ config, pkgs, ... }:
{ {
imports = [ imports = (
../home-default.nix [ ../default.nix ] ++ lib.fileset.toList (lib.fileset.fileFilter (f: f.hasExt "nix") ./config)
./config/all.nix );
];
home = { home = {
username = "mara"; username = "mara";
homeDirectory = "/home/mara"; homeDirectory = "/home/mara";
}; };
custom.backgroundDir = config.home.homeDirectory + "/Pictures/Archive/Wallpaper/Landscape";
}; };
programs.fish.enable = true; 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

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

View file

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

View file

@ -1,10 +1,32 @@
{ config, lib, pkgs, ... }: {
config,
lib,
pkgs,
...
}:
let let
inherit (lib) concatMapStringsSep getExe getExe'; inherit (lib)
concatMapStringsSep
getExe
getExe'
mkOption
types
;
in in
{ {
options.custom.screenShotDir = mkOption {
default = config.home.homeDirectory + "/Pictures/Screenshots";
type = with types; uniq str;
description = "Folder for all screenshots";
};
config = {
services.swww-randomize = {
enable = true;
backgroundDir = config.home.homeDirectory + "/Pictures/Archive/Wallpaper/Landscape";
};
wayland.windowManager.sway = { wayland.windowManager.sway = {
enable = true; enable = true;
package = pkgs.swayfx; package = pkgs.swayfx;
@ -21,15 +43,27 @@ in
layer_effects "waybar" blur enable layer_effects "waybar" blur enable
layer_effects "launcher" blur enable layer_effects "launcher" blur enable
layer_effects "notifications" blur enable layer_effects "notifications" blur enable
bindgesture swipe:right workspace prev
bindgesture swipe:left workspace next
''; '';
config = rec { config = rec {
modifier = "Mod1"; modifier = "Mod1";
terminal = getExe pkgs.kitty;
menu = getExe pkgs.fuzzel;
input."*" = { input = {
"type:touchpad" = {
tap = "on";
};
"*" = {
accel_profile = "flat";
pointer_accel = "-0.1";
xkb_layout = "de,gb"; xkb_layout = "de,gb";
xkb_variant = ",colemak_dh"; xkb_variant = ",colemak_dh";
xkb_numlock = "enabled"; xkb_numlock = "enabled";
}; };
};
output."BOE 0x0BCA Unknown".scale = "1.5"; output."BOE 0x0BCA Unknown".scale = "1.5";
@ -42,14 +76,11 @@ in
]; ];
}; };
keybindings = keybindings = {
let
mod = config.wayland.windowManager.sway.config.modifier;
in
{
# Computer Control # Computer Control
"${modifier}+Escape" = "exit"; "${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 # Focus
"${modifier}+Down" = "focus down"; "${modifier}+Down" = "focus down";
@ -90,7 +121,6 @@ in
"${modifier}+0" = "workspace number 0"; "${modifier}+0" = "workspace number 0";
"${modifier}+Shift+0" = "move window to workspace number 0"; "${modifier}+Shift+0" = "move window to workspace number 0";
# Sway Control # Sway Control
"${modifier}+Shift+q" = "kill"; "${modifier}+Shift+q" = "kill";
"${modifier}+Shift+c" = "reload"; "${modifier}+Shift+c" = "reload";
@ -102,10 +132,43 @@ in
# Programs # Programs
"${modifier}+a" = "exec ${getExe pkgs.nemo}"; "${modifier}+a" = "exec ${getExe pkgs.nemo}";
"${modifier}+Return" = "exec ${getExe pkgs.kitty}"; "${modifier}+Return" = "exec ${terminal}";
# dmenu # 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 = { colors = {
@ -176,4 +239,5 @@ in
}; };
}; };
}; };
};
} }

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" ];
};
};
};
}