diff options
| -rw-r--r-- | hosts/by-name/apzu/hardware.nix | 6 | ||||
| -rw-r--r-- | inputs.nix | 3 | ||||
| -rw-r--r-- | modules/by-name/fo/foot/module.nix | 12 | ||||
| -rw-r--r-- | modules/by-name/fo/foot/theme.ini | 56 | ||||
| -rw-r--r-- | modules/by-name/i3/i3bar-river/module.nix | 32 | ||||
| -rw-r--r-- | modules/by-name/ly/ly/module.nix | 26 | ||||
| -rw-r--r-- | modules/by-name/ly/ly/setup.sh | 47 | ||||
| -rw-r--r-- | modules/by-name/ri/river/module.nix | 41 | ||||
| -rw-r--r-- | modules/by-name/sw/swaybg/images/abstract-nord.png (renamed from modules/common/abstract-nord.png) | bin | 140219 -> 140219 bytes | |||
| -rw-r--r-- | modules/by-name/sw/swaybg/images/abstract-nord.png.license (renamed from modules/common/abstract-nord.png.license) | 0 | ||||
| -rw-r--r-- | modules/by-name/sw/swaybg/module.nix | 35 | ||||
| -rw-r--r-- | modules/by-name/sw/swayidle/module.nix | 43 | ||||
| -rw-r--r-- | modules/common/default.nix | 6 | ||||
| -rw-r--r-- | modules/home.legacy/conf/default.nix | 1 | ||||
| -rw-r--r-- | modules/home.legacy/conf/swayidle/config | 5 | ||||
| -rw-r--r-- | modules/home.legacy/conf/swayidle/config.license | 9 | ||||
| -rw-r--r-- | modules/home.legacy/conf/swayidle/default.nix | 35 |
17 files changed, 258 insertions, 99 deletions
diff --git a/hosts/by-name/apzu/hardware.nix b/hosts/by-name/apzu/hardware.nix index 70b041e7..1d948151 100644 --- a/hosts/by-name/apzu/hardware.nix +++ b/hosts/by-name/apzu/hardware.nix @@ -33,6 +33,12 @@ boot = { kernelModules = ["kvm-intel" "rtw89"]; + kernelParams = [ + # Try to use the newer experimental xe driver + "i915.force_probe=!9a49" + "xe.force_probe=9a49" + ]; + initrd.availableKernelModules = ["xhci_pci" "vmd" "nvme" "usb_storage" "sd_mod" "rtsx_pci_sdmmc"]; }; } @@ -1,5 +1,6 @@ let nixpkgsVersion = "26.05"; + lanzabooteVersion = "v1.1.0"; in { "agenix" = { url = "github:ryantm/agenix/main"; @@ -17,7 +18,7 @@ in { url = "github:nix-community/impermanence/master"; }; "lanzaboote" = { - url = "github:nix-community/lanzaboote/master"; + url = "github:nix-community/lanzaboote/${lanzabooteVersion}"; }; "library" = { url = "git+https://git.foss-syndicate.org/vhack.eu/nix-library?ref=prime"; diff --git a/modules/by-name/fo/foot/module.nix b/modules/by-name/fo/foot/module.nix index 29d886d6..b698eee9 100644 --- a/modules/by-name/fo/foot/module.nix +++ b/modules/by-name/fo/foot/module.nix @@ -11,6 +11,7 @@ config, lib, libraries, + pkgs, ... }: let cfg = config.soispha.foot; @@ -20,6 +21,11 @@ in { }; config = lib.mkIf cfg.enable { + # TODO: Maybe we can use the xdg-autostart mechanism for this? <2026-06-23> + soispha.programs.river.init.autoStart = [ + ["${lib.getExe' pkgs.foot "footclient"}"] + ]; + home-manager.users.soispha = { programs.foot = { enable = true; @@ -36,7 +42,7 @@ in { launch = "git show \${match}"; }; "regex:paths" = { - regex = "([^ '\"`=:\\\\[\\\\(]*/)([^/: '\"`\\\\)\\\\]]*)"; + regex = "([^ '\"`=:\\\\[\\\\(]*/[^/: '\"`\\\\)\\\\]*)"; launch = "ll \${match}"; }; @@ -52,10 +58,6 @@ in { }; }; }; - - soispha.river.autostart = [ - "${lib.getExe' config.home-manager.users.soispha.programs.foot.package "footclient"}" - ]; }; }; } diff --git a/modules/by-name/fo/foot/theme.ini b/modules/by-name/fo/foot/theme.ini index f66cde40..f5f36039 100644 --- a/modules/by-name/fo/foot/theme.ini +++ b/modules/by-name/fo/foot/theme.ini @@ -1,24 +1,40 @@ -# From https://codeberg.org/dnkl/foot/src/commit/43d2d97386663ebd42563eb44b7fca8e9a7584ae/themes/visibone +# From https://github.com/mbadolato/iTerm2-Color-Schemes/blob/75bc70670c28b5dc97625af38deb3ae49f4363e6/foot/Carbonfox.ini +# Other themes I considered: +# - ayu-mirage +# - catppuccin-mocha +# - chiba-dark +# - iterm +# - kitty +# - modus-vivendi +# - modus-vivendi-tinted +# - molokai +# - tokyonight-storm +# - visibone +# - xterm +# - poimandres # -*- conf -*- # VisiBone [colors-dark] -cursor=010101 ffffff -foreground=ffffff -background=010101 -regular0=666666 -regular1=cc6666 -regular2=66cc99 -regular3=cc9966 -regular4=6699cc -regular5=cc6699 -regular6=66cccc -regular7=cccccc -bright0=999999 -bright1=ff9999 -bright2=99ffcc -bright3=ffcc99 -bright4=99ccff -bright5=ff99cc -bright6=99ffff -bright7=ffffff +cursor=161616 f2f4f8 +foreground=f2f4f8 +background=161616 +regular0=282828 +regular1=ee5396 +regular2=25be6a +regular3=08bdba +regular4=78a9ff +regular5=be95ff +regular6=33b1ff +regular7=dfdfe0 +bright0=484848 +bright1=f16da6 +bright2=46c880 +bright3=2dc7c4 +bright4=8cb6ff +bright5=c8a5ff +bright6=52bdff +bright7=e4e4e5 +selection-foreground=f2f4f8 +selection-background=2a2a2a + diff --git a/modules/by-name/i3/i3bar-river/module.nix b/modules/by-name/i3/i3bar-river/module.nix index 2b9150d3..982ec1e3 100644 --- a/modules/by-name/i3/i3bar-river/module.nix +++ b/modules/by-name/i3/i3bar-river/module.nix @@ -110,20 +110,28 @@ in { }; config = lib.mkIf cfg.enable { - home-manager.users.soispha = { - systemd.user.services."i3bar-river" = { - description = "Highly customizable Wayland bar for river"; - partOf = "graphical-session.target"; - after = "graphical-session.target"; - requisite = "graphical-session.target"; - serviceConfig = { - ExecStart = "${lib.getExe cfg.package}"; - ExecReload = "kill -SIGUSR2 $MAINPID"; - Restart = "on-failure"; - }; - wantedBy = "graphical-session.target"; + systemd.user.services."i3bar-river" = { + description = "Highly customizable Wayland bar for river"; + partOf = ["graphical-session.target"]; + after = ["graphical-session.target"]; + requisite = ["graphical-session.target"]; + + path = [ + pkgs.bash # `sh` is needed for starting the status command + + # TODO: This should be a wrapper of the status command <2026-06-23> + pkgs.btrfs-progs # `btrfs` is needed by the storage block in the status command + ]; + + serviceConfig = { + ExecStart = "${lib.getExe cfg.package}"; + ExecReload = "kill -SIGUSR2 $MAINPID"; + Restart = "on-failure"; }; + wantedBy = ["graphical-session.target"]; + }; + home-manager.users.soispha = { programs.i3bar-river = { enable = true; inherit (cfg) package; diff --git a/modules/by-name/ly/ly/module.nix b/modules/by-name/ly/ly/module.nix index dedabe81..e2d3b0ae 100644 --- a/modules/by-name/ly/ly/module.nix +++ b/modules/by-name/ly/ly/module.nix @@ -31,6 +31,7 @@ Terminal=true ''; + # TODO: This could use the `services.display-manager.sessionPackages` option <2026-06-23> customSessionsDir = pkgs.runCommand "custom-sessions" {} /* @@ -39,8 +40,22 @@ '' mkdir "$out"; cp "${riverDesktop}/share/applications/river.desktop" "$out" - cp "${shellDesktop}" "$out" + cp "${shellDesktop}" "$out/zsh.desktop" ''; + + setup = pkgs.writeShellApplication { + name = "setup"; + + bashOptions = []; + + runtimeInputs = [ + pkgs.findutils + pkgs.systemd + ]; + inheritPath = true; + + text = builtins.readFile ./setup.sh; + }; in { options.soispha.programs.ly = { enable = lib.mkEnableOption "ly"; @@ -84,6 +99,11 @@ in { dur_file_path = "${./blackhole-smooth-240x67.dur}"; full_color = true; + # NOTE: This does the same as the default nixos setup cmd, but we don't + # immidiately start the `graphical-session.target`. That is started by river's + # init. <2026-06-23> + setup_cmd = "${lib.getExe setup}"; + custom_sessions = "${customSessionsDir}"; # Clear the screen before starting up (otherwise error messages might linger on @@ -98,12 +118,12 @@ in { clock = "%c"; hibernate_cmd = "systemctl hibernate"; - inactivity_cmd = "systmectl suspend-then-hibernate"; + inactivity_cmd = "systemctl suspend-then-hibernate"; restart_cmd = "reboot"; shutdown_cmd = "shutdown $PLATFORM_SHUTDOWN_ARG now"; sleep_cmd = "systemctl suspend"; - inactivity_delay = 30; # unit is seconds + inactivity_delay = 120; # unit is seconds }; }; }; diff --git a/modules/by-name/ly/ly/setup.sh b/modules/by-name/ly/ly/setup.sh new file mode 100644 index 00000000..6e8bed2b --- /dev/null +++ b/modules/by-name/ly/ly/setup.sh @@ -0,0 +1,47 @@ +#! /usr/bin/env bash + +# Shared environment setup for graphical sessions. + +# shellcheck disable=1091 +. /etc/profile + +cd "$HOME" || { + echo 1>&2 "No HOME :(" + exit 1 +} + +if [ -z "$_DID_SYSTEMD_CAT" ]; then + export _DID_SYSTEMD_CAT=1 + exec systemd-cat -t xsession "$0" "$@" +fi + + +# Import environment variables into the systemd user environment. +/run/current-system/systemd/bin/systemctl --user import-environment DBUS_SESSION_BUS_ADDRESS DISPLAY XAUTHORITY XDG_SESSION_ID + +# Speed up application start by 50-150ms according to +# https://kdemonkey.blogspot.com/2008/04/magic-trick.html +compose_cache="${XCOMPOSECACHE:-$HOME/.compose-cache}" +mkdir -p "$compose_cache" +# To avoid accidentally deleting a wrongly set up XCOMPOSECACHE directory, +# defensively try to delete cache *files* only, following the file format specified in +# https://gitlab.freedesktop.org/xorg/lib/libx11/-/blob/master/modules/im/ximcp/imLcIm.c#L353-358 +# sprintf (*res, "%s/%c%d_%03x_%08x_%08x", dir, _XimGetMyEndian(), XIM_CACHE_VERSION, (unsigned int)sizeof (DefTree), hash, hash2); +find "$compose_cache" -maxdepth 1 -regextype posix-extended -regex '.*/[Bl][0-9]+_[0-9a-f]{3}_[0-9a-f]{8}_[0-9a-f]{8}' -delete +unset compose_cache + +# Work around KDE errors when a user first logs in and +# .local/share doesn't exist yet. +mkdir -p "${XDG_DATA_HOME:-$HOME/.local/share}" + +unset _DID_SYSTEMD_CAT + + +if test "$1"; then + # Run the supplied session command. + exec "$@" +else + # TODO: Do we need this? Should not the session always exist? + echo "error: unknown session $1" 1>&2 + exit 1 +fi diff --git a/modules/by-name/ri/river/module.nix b/modules/by-name/ri/river/module.nix index bc747c9d..7eb30014 100644 --- a/modules/by-name/ri/river/module.nix +++ b/modules/by-name/ri/river/module.nix @@ -166,7 +166,9 @@ in { }; autoStart = lib.mkOption { - type = lib.types.listOf lib.types.package; + type = + lib.types.listOf (lib.types.either lib.types.package (lib.types.listOf + lib.types.str)); description = "List of programs to be started at river start"; example = '' [ @@ -237,14 +239,49 @@ in { # ${text} ${other_stuff} ''; + + sessionVars = + (builtins.attrNames config.environment.sessionVariables) + ++ (builtins.attrNames config.home-manager.users.soispha.home.sessionVariables) + ++ [ + "WAYLAND_DISPLAY" + "DISPLAY" + "XDG_RUNTIME_DIR" + ]; + + part = acc: vars: let + firstTen = lib.lists.take 5 vars; + in + if firstTen == [] + then acc + else part (acc ++ [firstTen]) (lib.lists.removePrefix firstTen vars); + + partedSessionVars = part [] sessionVars; + + mkEnvSet = prefix: vars: let + stringVars = builtins.concatStringsSep " " vars; + in ''err_fail ${riverctl} spawn "${prefix} ${stringVars}"''; + + dbusEnvs = + builtins.map + (mkEnvSet "${lib.getExe' pkgs.dbus "dbus-update-activation-environment"} --verbose --systemd") + partedSessionVars; + systemdUserEnvs = + builtins.map + (mkEnvSet "systemctl --user --verbose import-environment") + partedSessionVars; in builtins.readFile ./init_base.sh + # bash mkHeading "Environment variables" '' - err_fail ${riverctl} spawn "${lib.getExe' pkgs.dbus "dbus-update-activation-environment"} --verbose --systemd SEATD_SOCK DISPLAY WAYLAND_DISPLAY DESKTOP_SESSION=river XDG_CURRENT_DESKTOP=river" export XDG_CURRENT_DESKTOP=river DESKTOP_SESSION=river; '' + + mkHeading "Informing dbus about changed env-vars" (builtins.concatStringsSep "\n" dbusEnvs) + + mkHeading "Informing systemd user about changed env-vars" (builtins.concatStringsSep "\n" systemdUserEnvs) + + mkHeading "Starting graphical-session-target" '' + err_fail systemctl --user start nixos-fake-graphical-session.target + '' + mkHeading "Key Mappings" keymappings + mkHeading "Rules" ruleSetup + mkHeading "General Settings" generalSettings diff --git a/modules/common/abstract-nord.png b/modules/by-name/sw/swaybg/images/abstract-nord.png Binary files differindex 5ef498bf..5ef498bf 100644 --- a/modules/common/abstract-nord.png +++ b/modules/by-name/sw/swaybg/images/abstract-nord.png diff --git a/modules/common/abstract-nord.png.license b/modules/by-name/sw/swaybg/images/abstract-nord.png.license index eae6a84c..eae6a84c 100644 --- a/modules/common/abstract-nord.png.license +++ b/modules/by-name/sw/swaybg/images/abstract-nord.png.license diff --git a/modules/by-name/sw/swaybg/module.nix b/modules/by-name/sw/swaybg/module.nix new file mode 100644 index 00000000..fa6a079a --- /dev/null +++ b/modules/by-name/sw/swaybg/module.nix @@ -0,0 +1,35 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. +{ + config, + lib, + pkgs, + libraries, + ... +}: let + cfg = config.soispha.programs.swaybg; +in { + options.soispha.programs.swaybg = { + enable = libraries.base.options.mkEnable "swaybg"; + }; + + config = lib.mkIf cfg.enable { + systemd.user.services."swaybg" = { + description = "Background display for river"; + partOf = ["graphical-session.target"]; + after = ["graphical-session.target"]; + requisite = ["graphical-session.target"]; + serviceConfig = { + ExecStart = "${lib.getExe pkgs.swaybg} --image ${./images/abstract-nord.png}"; + }; + wantedBy = ["graphical-session.target"]; + }; + }; +} diff --git a/modules/by-name/sw/swayidle/module.nix b/modules/by-name/sw/swayidle/module.nix new file mode 100644 index 00000000..a29b5952 --- /dev/null +++ b/modules/by-name/sw/swayidle/module.nix @@ -0,0 +1,43 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. +{ + config, + lib, + libraries, + ... +}: let + cfg = config.soispha.programs.swayidle; +in { + options.soispha.programs.swayidle = { + enable = libraries.base.options.mkEnable "swayidle"; + }; + + config = lib.mkIf cfg.enable { + home-manager.users.soispha = { + services.swayidle = { + enable = true; + events = { + "before-sleep" = "swaylock -f "; + }; + + timeouts = [ + { + timeout = 180; + command = "swaylock -fF"; + } + { + timeout = 360; + command = "systemctl suspend-then-hibernate"; + } + ]; + }; + }; + }; +} diff --git a/modules/common/default.nix b/modules/common/default.nix index 5392538a..e5172921 100644 --- a/modules/common/default.nix +++ b/modules/common/default.nix @@ -219,12 +219,6 @@ pointer-1133-49970-Logitech_Gaming_Mouse_G502 = [["pointer-accel" "0"] ["accel-profile" "none"]]; pointer-12951-6505-ZSA_Technology_Labs_Moonlander_Mark_I = [["pointer-accel" "0"] ["accel-profile" "none"]]; }; - backgroundStart = [ - # TODO(@bpeetz): Move these to systemd units/their own modules <2025-05-18> - - ["${lib.getExe pkgs.swaybg}" "--image" "${./abstract-nord.png}"] - pkgs.swayidle - ]; }; }; mpv.enable = true; diff --git a/modules/home.legacy/conf/default.nix b/modules/home.legacy/conf/default.nix index 89502a64..b50068ea 100644 --- a/modules/home.legacy/conf/default.nix +++ b/modules/home.legacy/conf/default.nix @@ -24,6 +24,5 @@ ./prusa_slicer ./python ./starship - ./swayidle ]; } diff --git a/modules/home.legacy/conf/swayidle/config b/modules/home.legacy/conf/swayidle/config deleted file mode 100644 index a48f670b..00000000 --- a/modules/home.legacy/conf/swayidle/config +++ /dev/null @@ -1,5 +0,0 @@ -timeout 180 'swaylock -fF' - -timeout 360 'systemctl suspend-then-hibernate' - -before-sleep 'swaylock -f' diff --git a/modules/home.legacy/conf/swayidle/config.license b/modules/home.legacy/conf/swayidle/config.license deleted file mode 100644 index eae6a84c..00000000 --- a/modules/home.legacy/conf/swayidle/config.license +++ /dev/null @@ -1,9 +0,0 @@ -nixos-config - My current NixOS configuration - -Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> -SPDX-License-Identifier: GPL-3.0-or-later - -This file is part of my nixos-config. - -You should have received a copy of the License along with this program. -If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. diff --git a/modules/home.legacy/conf/swayidle/default.nix b/modules/home.legacy/conf/swayidle/default.nix deleted file mode 100644 index 4483c8b9..00000000 --- a/modules/home.legacy/conf/swayidle/default.nix +++ /dev/null @@ -1,35 +0,0 @@ -# nixos-config - My current NixOS configuration -# -# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> -# SPDX-License-Identifier: GPL-3.0-or-later -# -# This file is part of my nixos-config. -# -# You should have received a copy of the License along with this program. -# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. -{...}: { - # TODO: This fails to hibernate when the hardware swap was not previously activated. <2025-04-04> - xdg.configFile."swayidle/config".source = ./config; - - # services.swayidle = { - # enable = true; - # events = [ - # { - # event = "before-sleep"; - # command = "${pkgs.swaylock}/bin/swaylock -f "; - # } - # ]; - # timeouts = [ - # { - # timeout = 180; - # command = "${pkgs.swaylock}/bin/swaylock -fFu "; - # } - # { - # timeout = 360; - # # TODO: systemctl is installed? - # command = "systemctl suspend-then-hibernate"; - # } - # ]; - # # systemdTarget = ""; # TODO: this might be usefull - # }; -} |
