diff options
Diffstat (limited to '')
69 files changed, 1148 insertions, 746 deletions
diff --git a/modules/by-name/at/atuin/module.nix b/modules/by-name/at/atuin/module.nix index 6cf8a396..caabdf40 100644 --- a/modules/by-name/at/atuin/module.nix +++ b/modules/by-name/at/atuin/module.nix @@ -10,7 +10,8 @@ { config, lib, - pkgs, + externalBinaries, + system, ... }: let cfg = config.soispha.programs.atuin; @@ -22,11 +23,19 @@ in { }; config = lib.mkIf cfg.enable { - age.secrets.atuin_encryption_key = lib.mkIf cfg.enableAge { - file = ./secrets/encryption_key.age; - mode = "700"; - owner = "soispha"; - group = "users"; + age.secrets = { + atuin_encryption_key = lib.mkIf cfg.enableAge { + file = ./secrets/encryption_key.age; + mode = "700"; + owner = "soispha"; + group = "users"; + }; + atuin_user_id = lib.mkIf cfg.enableAge { + file = ./secrets/user_id.age; + mode = "700"; + owner = "soispha"; + group = "users"; + }; }; soispha.programs.zsh.integrations.atuin = ./atuin.zsh; @@ -35,24 +44,21 @@ in { programs.atuin = { enable = true; + package = externalBinaries.turtle.packages.${system}.default; + daemon.enable = true; # We can do this on our own. enableZshIntegration = false; settings = { - key_path = lib.mkMerge [ - (lib.mkIf cfg.enableAge "${config.age.secrets.atuin_encryption_key.path}") - (lib.mkIf (!cfg.enableAge) - "${config.home-manager.users.soispha.xdg.dataHome}/atuin/atuin_secret_key.key") - ]; - sync = lib.mkIf cfg.enableAge { - # The v2 sync API - records = true; + encryption_key_path = "${config.age.secrets.atuin_encryption_key.path}"; + user_id_path = "${config.age.secrets.atuin_user_id.path}"; + + auto = true; + address = "https://atuin-sync.vhack.eu"; }; - auto_sync = lib.mkIf cfg.enableAge true; - sync_address = lib.mkIf cfg.enableAge "https://atuin-sync.vhack.eu"; logs = { enabled = true; @@ -79,9 +85,6 @@ in { vim_normal = "blink-block"; }; - # Who wants software, that automatically calls home?! - update_check = false; - stats = { # This overrides the default value. ignored_commands = []; @@ -93,10 +96,6 @@ in { "n" = "select-previous"; "s" = "cursor-right"; }; - - # I currently don't want a sync deamon or a dotfiles manager running. - dotfiles.enable = false; - ai.enabled = false; }; }; }; diff --git a/modules/by-name/at/atuin/secrets/encryption_key.age b/modules/by-name/at/atuin/secrets/encryption_key.age index 4c2bb7b4..a69db402 100644 --- a/modules/by-name/at/atuin/secrets/encryption_key.age +++ b/modules/by-name/at/atuin/secrets/encryption_key.age @@ -1,15 +1,16 @@ -----BEGIN AGE ENCRYPTED FILE----- -YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBqT1Y2RU9hQmkxWEoveitY -dDEzQU85QkVXOCsxS3JFb0xKMngrT08xMGswCkJzcm9GanVUbytKcmI1U1lzWVM0 -eGV5OUcwU2M4UGlzZ3ZpQUJtYUJxcTQKLT4gc3NoLWVkMjU1MTkgelpFb25nIElC -OExoMzVpV0U3czZ2aUp3a0ZDcUlTQnFhallxOTdhTE1YdnFrWVdPRzQKQmN6L1Z4 -S0ZWeWNSREFhMExMa0FOdWhnUTI5bXptVnU5SDFQZkk1R00vdwotPiBzc2gtZWQy -NTUxOSA3SGZGVXcgbm1LZ1VwRDdjRFh0SCtTT1I2ZDFsSmhsZzVBcHMxSXhWQlNM -cFVpU2kwRQpEUStYQVJiWSt1THA5ZEJlL2NnQ2NwZTlWWEVtYkpjb09RckxkaWdP -djFvCi0+ICktZ3JlYXNlIGsgZnRHZHhEIDxVLQo4SkZtRm8vTEJnYVRnZXAwK3Yv -eUQ0TGdYRVpOTmozSE52MlFqeG1HalVWb1JmZ2k5ZVJFNVpBUGdyMnlVZwotLS0g -UjI2WVhtU0lITzVMSU1Nc2RKcnJXZVUreWxnZXoxZnBRL0xpUmd3dDhtNArERqzQ -//hB8CunQlwCCYnISj6FaQphnWz8E3sIyi3FqH2ww9MQ4RzbVqLOOKgg4wVWRC8Y -RmFWPl1SfJoA8DIPoTEgqQZseB+PT7CYHo4LEwrpkcQ5cndOI2JbO+HzZdk9H+tM -GbsggKI= +YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSB1NkNRQUdYekxZaEF3WTdC +ZDBndHBMZUVPM2dObDcvazBjaXlQT3QrUmtVCkc1TUhMd1h1YWxtaXNncGZSODg0 +QWtUTDhybFltaDBVWTE3VVBoeUtubzQKLT4gc3NoLWVkMjU1MTkgelpFb25nIHEy +VGRMeUZDSUlGRmE0NzlnWSsvY3VHVmRxR1NpNGRmS1ZRWG9TcFdaQmsKcjhKb1VG +V2tNZkdXTXhSb25ETUplYlZWaHU0Y0grYUtjSVVHVzhmMzV5TQotPiBzc2gtZWQy +NTUxOSA3SGZGVXcgTTBhcUJISVVRVU1hNk5VZkNTNUZHUzY1TSs4a2ZNYytIdVVG +TG5mRjhBawpRVG50Wkl2S2NKdUxTeVhiOTJ0RG00NCswQ01jV1lYbVpYNC90N3V1 +WXZRCi0+IDEoIS1ncmVhc2UgSUZzazpsRCBCbi0gWQpxMUJtNk13ZHptVjladTAz +U2IxRjIyK0wvY3k1T3JiQ1ZFNlMvU0t3TWNyN09SVVlWc2FIQU9lZDZ0azIwT29z +CjRFREVXdGozNVhKWlE5L3NxTGdDZFVvL2NDYlpRTWtrd1J0cFZwcm9OVW1Vb1pz +SnptUWdvZ3E4VThHOXZRCi0tLSBUeW0zYnNVZkRYWDJoTTV0V2QveWpIY0p0UmxP +UXlSNHNPbllBYitjTWpVCgUpBZTJYd2sFY9GvDwJMKt0WVrDZVE2PF5jAww8Ml/w +rEycAm/dmIiMV5mfKOdU0aHNMl6RM/7PLHSa4G+wIRRrKQkoNcu8cqOziBRWgSOn +JKxVFCdwlEgAo+J+qtRHkwitjOJ0ce6OOg== -----END AGE ENCRYPTED FILE----- diff --git a/modules/by-name/at/atuin/secrets/user_id.age b/modules/by-name/at/atuin/secrets/user_id.age new file mode 100644 index 00000000..6ac3bcd6 --- /dev/null +++ b/modules/by-name/at/atuin/secrets/user_id.age @@ -0,0 +1,14 @@ +-----BEGIN AGE ENCRYPTED FILE----- +YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSB0T3hFUm1NZU1RU2IxNWsx +ZFh2ckVsTnNBZVVqMm9HaGFOTmtKMlh3M2xzClJ1N0RsbFJYYWhnYktpYnFaYWNY +c2VGRzZoMW1GOENsV3FoTEJ1OWVDQ00KLT4gc3NoLWVkMjU1MTkgelpFb25nIDlY +MnRoMFB4dTUyS0pIenVjelRxRERXZ2ptVURZWGttZWR5R25NMWYzekUKaVRDKzJj +cCtRY0F6VVFGUlIyeGhLSThXMVFvNEl2Y0tMdHpSOEI4cjVtTQotPiBzc2gtZWQy +NTUxOSA3SGZGVXcgbjNpdGZZa1NxbEw3YkV4UmxTb0dtSlFPM1htK1QzWXBaRGdv +ZUdTYkoxSQpMcHZCMnNPR0QySkovQ0I1THVPK3Z5RlFCbGJ5Zk5teDBKbUFvY1p4 +T3lzCi0+IGtrVXxkQlItZ3JlYXNlIDBRO3cKWnk5M2MyTUExRDBYd25RdkxRQWla +bnpTU1J0T1NMbVZldGpCbVZOTFZuV29ZRll0UDJwdHo0YWoKLS0tIFI5RG9WSDZu +am9RYnFONE9wZ3pVaG1tVnBLNTZqK3d4NFhhT1F1bWlORzAKz44Fafb+Ck5aMxJF +5/pNNcYE3IRUqjKTWjmSO+fBFVPnlfIIc6gKFhO4Nm05QIxqzSW08PbBhVYFH65u +ivRjFHUg+Gp3 +-----END AGE ENCRYPTED FILE----- diff --git a/modules/by-name/au/ausweisapp/module.nix b/modules/by-name/au/ausweisapp/module.nix new file mode 100644 index 00000000..3a89db9d --- /dev/null +++ b/modules/by-name/au/ausweisapp/module.nix @@ -0,0 +1,18 @@ +{ + config, + lib, + libraries, + ... +}: let + cfg = config.soispha.programs.ausweisapp; +in { + options.soispha.programs.ausweisapp = { + enable = libraries.base.options.mkEnable "AusweisApp"; + }; + + config = lib.mkIf cfg.enable { + soispha.impermanence.userDirectories = [ + ".config/AusweisApp" + ]; + }; +} diff --git a/modules/by-name/ba/backup/module.nix b/modules/by-name/ba/backup/module.nix index 7a788764..dd0dfac7 100644 --- a/modules/by-name/ba/backup/module.nix +++ b/modules/by-name/ba/backup/module.nix @@ -186,7 +186,7 @@ in { # This setting is normally passed to rclone, but we force # the command on the remote. - # As such, the value does not matter and must only be parseable by restic. + # As such, the value does not matter and must only be parse-able by restic. repository = "rclone: "; timerConfig = { @@ -209,7 +209,7 @@ in { # This setting is normally passed to rclone, but we force # the command on the remote. - # As such, the value does not matter and must only be parseable by restic. + # As such, the value does not matter and must only be parse-able by restic. repository = "rclone: "; timerConfig = null; diff --git a/modules/by-name/bo/boot/iso_entry/archlive_iso.nix b/modules/by-name/bo/boot/iso_entry/archlive_iso.nix deleted file mode 100644 index d0ae8457..00000000 --- a/modules/by-name/bo/boot/iso_entry/archlive_iso.nix +++ /dev/null @@ -1,86 +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>. -{pkgs ? (builtins.getFlake "nixpkgs").legacyPackages."x86_64-linux"}: let - signing_key = import ./signing_key.nix {inherit pkgs;}; - - checked_iso = pkgs.stdenv.mkDerivation { - pname = "archlinux-iso"; - version = "2024.05.01"; - - srcs = [ - (pkgs.fetchurl { - url = "https://archlinux.org/iso/2024.05.01/archlinux-2024.05.01-x86_64.iso.sig"; - hash = "sha256-QOGYng6a7zA5EJKGotDccJ7fD2MmPPXQEdVr1kjJvi4="; - }) - (pkgs.fetchurl { - url = "https://mirror.informatik.tu-freiberg.de/arch/iso/latest/archlinux-2024.05.01-x86_64.iso"; - hash = "sha256-G0oE74pzUIUqEwcO5JhEKwh6YHoYhAtN19mYZ+tfakw="; - }) - (pkgs.fetchurl { - url = "https://archlinux.org/iso/2024.05.01/b2sums.txt"; - hash = "sha256-HSMS13hHXFKKQsCA8spa7XtirHCBTmePwhOsStVPbHw="; - }) - ]; - - dontUnpack = true; - - nativeBuildInputs = with pkgs; [ - sequoia-sq - ]; - - buildPhase = - /* - bash - */ - '' - cp -r "${signing_key}" ./release-key.pgp - for src in $srcs; do - cp -r "$src" "$(stripHash "$src")" - done - - sed '2d;3d;4d' b2sums.txt > b2sums_clean.txt - - # As per the directions from: https://archlinux.org/download/ - - # blake hash check - b2sum -c ./b2sums_clean.txt - - # pgp signature check - sq verify --signer-file release-key.pgp --detached archlinux-2024.05.01-x86_64.iso.sig archlinux-2024.05.01-x86_64.iso - ''; - - installPhase = '' - cp archlinux-2024.05.01-x86_64.iso "$out"; - ''; - }; -in - pkgs.stdenv.mkDerivation { - name = "live_iso_boot_entry"; - - src = checked_iso; - - dontUnpack = true; - - nativeBuildInputs = with pkgs; [ - libarchive # for bsdtar - ]; - - buildPhase = '' - mkdir iso - bsdtar -xf "$src" -C iso - ''; - - installPhase = '' - install -D ./iso/arch/boot/x86_64/initramfs-linux.img "$out/live/initramfs-linux.img" - install -D ./iso/arch/boot/x86_64/vmlinuz-linux "$out/live/vmlinuz-linux" - - install -D "$src" "$out/archlinux.iso" - ''; - } diff --git a/modules/by-name/bo/boot/iso_entry/signing_key.nix b/modules/by-name/bo/boot/iso_entry/signing_key.nix deleted file mode 100644 index d9268d75..00000000 --- a/modules/by-name/bo/boot/iso_entry/signing_key.nix +++ /dev/null @@ -1,27 +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>. -{pkgs ? (builtins.getFlake "nixpkgs").legacyPackages."x86_64-linux"}: -pkgs.stdenv.mkDerivation { - name = "archlinux_signing_keys"; - - outputHash = "sha256-evGWzkxMaZw3rlixKsyWCS/ZvNuZ+OfXQb6sgiHz9XY="; - outputHashAlgo = "sha256"; - NIX_SSL_CERT_FILE = "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt"; - - nativeBuildInputs = with pkgs; [ - sequoia-sq - ]; - - dontUnpack = true; - - buildPhase = '' - sq --verbose --no-cert-store --no-key-store network wkd fetch pierre@archlinux.org --output "$out" - ''; -} diff --git a/modules/by-name/bo/boot/module.nix b/modules/by-name/bo/boot/module.nix index 4b95aedf..8c8b2af1 100644 --- a/modules/by-name/bo/boot/module.nix +++ b/modules/by-name/bo/boot/module.nix @@ -12,139 +12,214 @@ lib, pkgs, modules, + modulesPath, + system, + specialArgs, ... }: let cfg = config.soispha.boot; + + tails = let + tailsPrefix = "/EFI/tails"; + in { + root = "${tailsPrefix}/tails.iso"; + initrd = "${tailsPrefix}/initrd.img"; + vmlinuz = "${tailsPrefix}/vmlinuz-linux"; + }; + + iso = pkgs.tails-iso; + + # From: + # - The extracted ISO's boot dir + # - Reverse engineered from: + # - `<tails iso squashfs>/usr/share/initramfs-tools/init` + # - `<tails iso squashfs>/usr/lib/live/boot/` + iso_options = + ## General options? + [ + "initrd=${tails.initrd}" + # "noprompt" + # "timezone=Etc/UTC" + # "config" + # "noautologin" + # "slab_nomerge" + # "slub_debug=FZ" + # "mce=0" + # "vsyscall=none" + # "init_on_free=1" + # "mds=full,nosmt" + # "page_alloc.shuffle=1" + # "randomize_kstack_offset=on" + # "efi_pstore.pstore_disable=1" + # "erst_disable" + # "spec_store_bypass_disable=on" + # "systemd.condition_needs_update=no" + ] + ## Systemd log options + ++ [ + # "systemd.log_level=debug" + # "systemd.log_target=console" + # "console=tty1" + # "systemd.journald.forward_to_console=1" + # "systemd.unit=rescue.target" + ] + ## Options for the first `init` script + ++ [ + # Use the `*-live` scripts + "boot=live" + + # "splash" + "plymouth.enable=0" + + # "quiet" + # "debug" + ] + ## Options for the `*-live` `init` scripts + ++ [ + "module=Tails" + + # TODO: RO-makes the fromiso not work <2026-06-08> + # "live-boot.read-only=/dev/nvme0*" + + # Don't store things persistently + "nopersistence" + + "fromiso=/dev/nvme0n1p1/${tails.root}" + ]; in { options.soispha.boot = { enable = lib.mkEnableOption "Bootloader configuration"; - # TODO: Add this option <2024-05-16> - # enableIsoEntry = lib.mkEnableOption "an tails iso boot entry"; + enableIsoEntry = lib.mkEnableOption "an tails iso boot entry"; }; imports = [ modules.lanzaboote.nixosModules.lanzaboote ]; - config = lib.mkIf cfg.enable ( - # let - # cfg = config.boot.loader.systemd-boot; - # inherit (config.boot.loader) efi; - # - # esa = n: lib.strings.escapeShellArg n; - # - # bootMountPoint = - # if cfg.xbootldrMountPoint != null - # then cfg.xbootldrMountPoint - # else efi.efiSysMountPoint; - # - # nixosDir = "/EFI/nixos"; - # - # # FIXME: This system has two big problems: - # # 1. It does not updated files, which still have the same name - # # 2. It forgets about files, which were 'deleted' in this configuration (these just - # # stay on disk forever) <2024-05-11> - # copyExtraFiles = '' - # echo "[systemd-boot] copying files to ${bootMountPoint}" - # empty_file=$(mktemp boot_empty_file_XXX) - # - # ${lib.concatStrings (lib.mapAttrsToList (n: v: - # /* - # bash - # */ - # '' - # if ! [ -e ${esa "${bootMountPoint}/${n}"} ]; then - # install -Dp "${v}" ${esa "${bootMountPoint}/${n}"} - # install -D "$empty_file" ${esa "${bootMountPoint}/${nixosDir}/.extra-files/${n}"} - # fi - # '') - # cfg.extraFiles)} - # - # ${lib.concatStrings (lib.mapAttrsToList (n: v: - # /* - # bash - # */ - # '' - # # if ! [ -e ${esa "${bootMountPoint}/loader/entries/${n}"} ]; then - # install -Dp "${pkgs.writeText n v}" ${esa "${bootMountPoint}/loader/entries/${n}"} - # install -D "$empty_file" ${esa "${bootMountPoint}/${nixosDir}/.extra-files/loader/entries/${n}"} - # # fi - # '') - # cfg.extraEntries)} - # ''; - # in - { - # FIXME: Reactviate this whole iso thing when a disko redeploy is done. - # (and switch to tails instead of arch) <2024-05-12> - # - # system.activationScripts = { - # copyExtraFilesForBoot = copyExtraFiles; - # }; + config = lib.mkIf cfg.enable { + # This should only be necessary for `lanzaboote`, but that is the current default in + # this module. + soispha.impermanence.directories = [ + "/var/lib/sbctl" + ]; + + boot = { + initrd = { + kernelModules = ["nvme" "btrfs"]; + }; + + kernelPackages = pkgs.linuxPackages_latest; - # This should only be necessary for `lanzaboote`, but that is the current default in - # this module. - soispha.impermanence.directories = [ - "/var/lib/sbctl" - ]; + lanzaboote = { + enable = true; + pkiBundle = "/var/lib/sbctl"; - boot = { - initrd = { - kernelModules = ["nvme" "btrfs"]; + settings = { + # Disable editing the kernel command line (which could allow someone to become root) + editor = false; + default = "@saved"; }; + }; - kernelPackages = pkgs.linuxPackages_latest; + loader = { + external = lib.mkIf cfg.enableIsoEntry { + installHook = lib.mkForce (let + lanzabooteCfg = config.boot.lanzaboote; - lanzaboote = { - enable = true; - pkiBundle = "/var/lib/sbctl"; + lanzabooteInstallHook = import "${modulesPath}/../lib/eval-config.nix" { + inherit system specialArgs; + modules = [ + modules.lanzaboote.nixosModules.lanzaboote - settings = { - # Disable editing the kernel command line (which could allow someone to become root) - editor = false; - default = "@saved"; - }; + { + # Copy the relevant config into the eval-module context. + boot = { + inherit (config.boot) kernelPackages; + + lanzaboote = { + inherit (lanzabooteCfg) enable pkiBundle; + settings = { + inherit (lanzabooteCfg.settings) editor default; + }; + }; + + loader = { + inherit (config.boot.loader) timeout efi systemd-boot; + }; + }; + systemd.package = config.systemd.package; + } + ]; + }; + + install = pkgs.writeShellScript "wrapped-install-tails-iso-marker" '' + echo "[Wrapped bootloader install] Copying tails iso..." + ${copyExtraFiles} + + echo "[Wrapped bootloader install] Running original lanzaboote install..." + ${lanzabooteInstallHook.config.boot.loader.external.installHook} + ''; + + copyExtraFiles = let + systemdCfg = config.boot.loader.systemd-boot; + nixosDir = "EFI/nixos"; + + bootMountPoint = config.boot.loader.efi.efiSysMountPoint; + install = lib.getExe' pkgs.coreutils "install"; + + inherit (lib) mapAttrsToList; + inherit (lib.strings) escapeShellArg concatStrings; + in + pkgs.writeShellScript "copy-extra-files" '' + ${concatStrings ( + mapAttrsToList (n: v: '' + ${install} -Dp "${v}" "${bootMountPoint}/"${escapeShellArg n} + ${install} -D /dev/null "${bootMountPoint}/${nixosDir}/.extra-files/"${escapeShellArg n} + '') + systemdCfg.extraFiles + )} + + ${lib.getExe pkgs.sbctl} sign "${bootMountPoint}/${tails.vmlinuz}" + + ${concatStrings ( + mapAttrsToList (n: v: '' + ${install} -Dp "${pkgs.writeText n v}" "${bootMountPoint}/loader/entries/"${escapeShellArg n} + ${install} -D /dev/null "${bootMountPoint}/${nixosDir}/.extra-files/loader/entries/"${escapeShellArg n} + '') + systemdCfg.extraEntries + )} + ''; + in + install); }; - loader = { - systemd-boot = { - # Lanzaboote currently replaces the systemd-boot module. - # This setting is usually set to true in configuration.nix - # generated at installation time. So we force it to false - # for now. - enable = false; + systemd-boot = lib.mkIf cfg.enableIsoEntry { + # Lanzaboote currently replaces the systemd-boot module. + enable = false; - # extraEntries = { - # "live.conf" = '' - # title Archlinux Live ISO - # linux /live/vmlinuz-linux - # initrd /live/initramfs-linux.img - # options img_dev=${config.soispha.disks.disk} img_loop=/archlinux.iso copytoram - # ''; - # }; - # - # extraFiles = let - # iso = import ./archlive_iso.nix {inherit pkgs;}; - # in { - # "archlinux.iso" = "${iso}/archlinux.iso"; - # "live/initramfs-linux.img" = "${iso}/live/initramfs-linux.img"; - # "live/vmlinuz-linux" = "${iso}/live/vmlinuz-linux"; - # }; + extraEntries = { + "live.conf" = '' + title Tails ${iso.passthru.version} Live ISO + linux ${tails.vmlinuz} + initrd ${tails.initrd} + options ${builtins.concatStringsSep " " iso_options} + ''; }; - grub = { - enable = false; - # theme = pkgs.nixos-grub2-theme; - splashImage = ./boot_pictures/gnu.png; - efiSupport = true; - device = "nodev"; # only for efi + extraFiles = { + # TODO: Check that the ISO we use for booting is _actually_ still the one we + # copied there (someone might exchange it in between) <2026-06-09> + "${tails.root}" = "${iso}/tails.iso"; + "${tails.vmlinuz}" = "${iso}/live/vmlinuz-linux"; + "${tails.initrd}" = "${iso}/live/initrd.img"; }; + }; - efi = { - canTouchEfiVariables = true; - efiSysMountPoint = "/boot"; - }; + efi = { + canTouchEfiVariables = true; + efiSysMountPoint = "/boot"; }; }; - } - ); + }; + }; } diff --git a/modules/by-name/ca/cargo/module.nix b/modules/by-name/ca/cargo/module.nix index d36a11e5..6a0675d3 100644 --- a/modules/by-name/ca/cargo/module.nix +++ b/modules/by-name/ca/cargo/module.nix @@ -27,8 +27,7 @@ in { cargoHome = "${config.home-manager.users.soispha.xdg.dataHome}/cargo"; settings = { - # {cargo-cache-home} means $CARGO_HOME - build.build-dir = "{cargo-cache-home}/shared-target/"; + build.build-dir = "${config.home-manager.users.soispha.xdg.cacheHome}/cargo/shared-target/"; }; }; }; diff --git a/modules/by-name/cl/cleanup/module.nix b/modules/by-name/cl/cleanup/module.nix index 98c699eb..9b42b337 100644 --- a/modules/by-name/cl/cleanup/module.nix +++ b/modules/by-name/cl/cleanup/module.nix @@ -21,6 +21,9 @@ in { config = lib.mkIf cfg.enable { programs.nano.enable = false; + + services.speechd.enable = false; + environment = { defaultPackages = lib.mkForce []; }; diff --git a/modules/by-name/di/direnv/module.nix b/modules/by-name/di/direnv/module.nix index 7c81e671..363f5cea 100644 --- a/modules/by-name/di/direnv/module.nix +++ b/modules/by-name/di/direnv/module.nix @@ -10,6 +10,7 @@ { config, lib, + pkgs, ... }: let cfg = config.soispha.programs.direnv; @@ -20,7 +21,12 @@ in { config.home-manager.users.soispha.programs.direnv = lib.mkIf cfg.enable { enable = true; - nix-direnv.enable = true; + + nix-direnv = { + enable = true; + package = pkgs.nix-direnv.override {nix = config.nix.package;}; + }; + config = { warn_timeout = 0; # strict_env = true; diff --git a/modules/by-name/di/disks/module.nix b/modules/by-name/di/disks/module.nix index 3e9d4614..ed5c939a 100644 --- a/modules/by-name/di/disks/module.nix +++ b/modules/by-name/di/disks/module.nix @@ -14,10 +14,9 @@ modules, ... }: let - # FIXME: The iso redeploy requires a bigger efi partition <2024-05-12> cfg = config.soispha.disks; defaultMountOptions = [ - "compress=zstd:3" # This saves disk space, at a performance cost + "compress-force=zstd:15" # This saves disk space, at a performance cost "noatime" # should have some performance upsides, and I don't use it anyways "lazytime" # make time changes in memory ]; @@ -34,15 +33,10 @@ in { ssd = lib.mkEnableOption "ssd specific improvements, like trim"; swap = { - uuid = lib.mkOption { + ram_size = lib.mkOption { type = lib.types.str; - example = lib.literalExpression "d1d20ae7-3d8a-44da-86da-677dbbb10c89"; - description = "The uuid of the swapfile"; - }; - resumeOffset = lib.mkOption { - type = lib.types.str; - example = lib.literalExpression "134324224"; - description = "The resume offset of the swapfile"; + example = lib.literalExpression "16G"; + description = "The size of the ram (translates to the swapfile size)"; }; }; }; @@ -54,6 +48,12 @@ in { config = lib.mkIf cfg.enable { systemd = lib.recursiveUpdate (import ./hibernate.nix {inherit pkgs;}) (import ./fstrim.nix {inherit pkgs lib cfg;}); + services.btrfs.autoScrub = { + enable = true; + fileSystems = ["/srv" "/nix"]; + interval = "monthly"; + }; + disko.devices = { disk = { main = { @@ -61,21 +61,44 @@ in { content = { type = "gpt"; partitions = { + ESP = { + # 2GiB plus 512MiB for tails ISO and normal boot stuff + size = "2600M"; + + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + mountOptions = ["umask=0077"]; + }; + }; + + nix = { + size = "30G"; + content = { + type = "luks"; + name = "nixos-store"; + extraOpenArgs = ["--allow-discards"]; + content = { + type = "btrfs"; + extraArgs = ["-f" "--label nixos-store"]; # Override existing partitions + mountpoint = "/nix"; + mountOptions = defaultMountOptions; + }; + }; + }; + root = { size = "100%"; - name = "root"; content = { type = "luks"; - name = "nixos"; + name = "nixos-root"; extraOpenArgs = ["--allow-discards"]; content = { type = "btrfs"; - extraArgs = ["-f" "--label nixos"]; # Override existing partitions + extraArgs = ["-f" "--label nixos-root"]; # Override existing partitions subvolumes = { - "nix" = { - mountpoint = "/nix"; - mountOptions = defaultMountOptions; - }; "persistent-storage" = { mountpoint = "/srv"; mountOptions = defaultMountOptions; @@ -90,21 +113,17 @@ in { "noatime" # should have some performance upsides, and I don't use it anyways "lazytime" # make time changes in memory ]; + swap = { + swapfile = { + priority = -1; # lower than zramSwap, just in case + size = cfg.swap.ram_size; + }; + }; }; }; }; }; }; - boot = { - type = "EF00"; - size = "512M"; - name = "boot"; - content = { - type = "filesystem"; - format = "vfat"; - mountpoint = "/boot"; - }; - }; }; }; }; @@ -130,6 +149,9 @@ in { }; }; fileSystems = { + "/nix" = { + neededForBoot = true; + }; "/srv" = { neededForBoot = true; }; @@ -137,23 +159,14 @@ in { neededForBoot = true; }; }; - swapDevices = [ - #{ - # device = "/swap/swapfile"; - # priority = 1; # lower than zramSwap, just in case - # # size = 2048; # TODO: can nixos create a btrfs swapfile correctly? - #} - ]; zramSwap = { enable = true; priority = 10; # needs to be higher than hardware-swap }; boot = { kernelParams = [ - "resume_offset=${cfg.swap.resumeOffset}" "zswap.enabled=0" # zswap and zram are not really compatible ]; - resumeDevice = "/dev/disk/by-uuid/${cfg.swap.uuid}"; }; }; } diff --git a/modules/by-name/fo/foot/module.nix b/modules/by-name/fo/foot/module.nix new file mode 100644 index 00000000..74273b49 --- /dev/null +++ b/modules/by-name/fo/foot/module.nix @@ -0,0 +1,71 @@ +# 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, + pkgs, + ... +}: let + cfg = config.soispha.foot; +in { + options.soispha.foot = { + enable = libraries.base.options.mkEnable "foot terminal"; + }; + + 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 = { + systemd.user.services.foot = { + # Don't restart the foot server (otherwise all my open foot terminals would exit + # too) + Unit.X-SwitchMethod = "keep-old"; + + # TODO: This should probably be added <2026-07-02> + # OOMScoreAdjust=-100; + }; + + programs.foot = { + enable = true; + server.enable = true; + settings = { + main = { + include = "${./theme.ini}"; + font = "SauceCodePro Nerd Font Mono:size=12"; + letter-spacing = "-0.25"; + }; + "regex:hashes" = { + regex = "([a-fA-F0-9]{7,128})"; + launch = "git show \${match}"; + }; + "regex:paths" = { + regex = "([^ '\"`=:\\\\[\\\\(]*/[^/: '\"`\\\\)\\\\]*)"; + launch = "ll \${match}"; + }; + + key-bindings = { + regex-launch = [ + "[hashes] Control+h" + "[paths] Control+t" + ]; + regex-copy = [ + "[hashes] Control+Shift+h" + "[paths] Control+Shift+t" + ]; + }; + }; + }; + }; + }; +} diff --git a/modules/by-name/fo/foot/theme.ini b/modules/by-name/fo/foot/theme.ini new file mode 100644 index 00000000..f5f36039 --- /dev/null +++ b/modules/by-name/fo/foot/theme.ini @@ -0,0 +1,40 @@ +# 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=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/gi/git/module.nix b/modules/by-name/gi/git/module.nix index 64a64904..28e61ecb 100644 --- a/modules/by-name/gi/git/module.nix +++ b/modules/by-name/gi/git/module.nix @@ -9,6 +9,7 @@ # If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { lib, + pkgs, config, ... }: let @@ -43,6 +44,14 @@ in { }; }; + # Add my custom git-scripts + home.packages = [ + pkgs.git-edit-index # Allows you to edit the indexed version of a file + pkgs.git-cm # A wrapper that re-adds the last commit's subject + pkgs.git-cgit # Allows fast cgit settings setup + pkgs.stamp # Add a license header to a file + ]; + programs.git = { enable = true; diff --git a/modules/by-name/i3/i3bar-river/module.nix b/modules/by-name/i3/i3bar-river/module.nix index 8a2203aa..982ec1e3 100644 --- a/modules/by-name/i3/i3bar-river/module.nix +++ b/modules/by-name/i3/i3bar-river/module.nix @@ -110,7 +110,26 @@ in { }; config = lib.mkIf cfg.enable { - soispha.programs.river.init.backgroundStart = [cfg.package]; + 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 = { diff --git a/modules/by-name/im/impermanence/module.nix b/modules/by-name/im/impermanence/module.nix index 78ad570f..43943363 100644 --- a/modules/by-name/im/impermanence/module.nix +++ b/modules/by-name/im/impermanence/module.nix @@ -59,22 +59,24 @@ in { inherit (cfg) directories; users.soispha = { - directories = [ - # TODO: These should all be moved to their respective modules <2024-12-08> - ".local/share" + directories = + [ + # TODO: These should all be moved to their respective modules <2024-12-08> + ".local/share" - ".local/state/nvim" - ".local/state/mpv" - ".local/state/wireplumber" + ".local/state/nvim" + ".local/state/mpv" + ".local/state/wireplumber" - ".config/Signal" + ".config/Signal" - ".cache" + ".cache" - "media" - "repos" - "documents" - ] ++ cfg.userDirectories; + "media" + "repos" + "documents" + ] + ++ cfg.userDirectories; }; files = [ diff --git a/modules/by-name/lf/lf/commands/base.sh b/modules/by-name/lf/lf/commands/base.sh index 7003d76c..e0b6216c 100755 --- a/modules/by-name/lf/lf/commands/base.sh +++ b/modules/by-name/lf/lf/commands/base.sh @@ -1,4 +1,4 @@ -#!/usr/bin/env sh +#!/usr/bin/env bash # nixos-config - My current NixOS configuration # @@ -41,7 +41,7 @@ prompt() { # set -- "$@" "$file" # done < "$(echo "$fx" | tmp)" tmp() { - __base_tmp_temporary_file="$(mktemp -t --tmpdir="$__base_tmp_temporary_directory" lf_commands_tmp_fun_XXXXXXXX )" + __base_tmp_temporary_file="$(mktemp -t --tmpdir="$__base_tmp_temporary_directory" lf_commands_tmp_fun_XXXXXXXX)" cat >"$__base_tmp_temporary_file" echo "$__base_tmp_temporary_file" } @@ -50,7 +50,6 @@ trap 'rm --recursive "$__base_tmp_temporary_directory"' EXIT # Run a lf command on the current lf client # All arguments will run in like they were typed directly into lf. -# # TODO(@bpeetz): Escape the single quotes in the input arguments. <2025-02-02> # # # Type # lf_cmd :: [String] @@ -61,6 +60,11 @@ trap 'rm --recursive "$__base_tmp_temporary_directory"' EXIT lf_cmd() { arguments="" for arg in "$@"; do + # We _can_ use the fancy bash syntax, but it's really hard to correctly quote the + # single quote in bash, and I don't really feel like it's worth it. + # shellcheck disable=SC2001 + arg="$(echo "$arg" | sed "s/'/\\\'/g")" + if [ -z "$arguments" ]; then arguments="'$arg'" else diff --git a/modules/by-name/lf/lf/commands/default.nix b/modules/by-name/lf/lf/commands/default.nix index 7fea7357..42dc548e 100644 --- a/modules/by-name/lf/lf/commands/default.nix +++ b/modules/by-name/lf/lf/commands/default.nix @@ -16,7 +16,14 @@ pkgs.writeShellApplication { inherit name; text = builtins.readFile ./base.sh + builtins.readFile ./scripts/${name}.sh; - runtimeInputs = [pkgs.lf pkgs.mktemp pkgs.coreutils] ++ dependencies; + runtimeInputs = + [ + pkgs.lf + pkgs.mktemp + pkgs.coreutils + pkgs.gnused + ] + ++ dependencies; inheritPath = keepPath; } + "/bin/${name}"; @@ -61,7 +68,7 @@ in { name = "archive_decompress"; dependencies = [ pkgs.gnutar - pkgs.unzip + pkgs.openjdk_headless pkgs.p7zip pkgs.xz pkgs.gzip @@ -72,6 +79,12 @@ in { name = "cd_project_root"; dependencies = [pkgs.git]; }; + cd_lf_make_map = shell { + name = "cd_lf_make_map"; + dependencies = [ + pkgs.lf-make-map + ]; + }; chmod = pipe { name = "chmod"; diff --git a/modules/by-name/lf/lf/commands/scripts/archive_decompress.sh b/modules/by-name/lf/lf/commands/scripts/archive_decompress.sh index 6cae62a2..10eb0bc5 100755 --- a/modules/by-name/lf/lf/commands/scripts/archive_decompress.sh +++ b/modules/by-name/lf/lf/commands/scripts/archive_decompress.sh @@ -25,7 +25,7 @@ echo "$fx" | while read -r file; do *.tar.gz | *.tgz) tar --extract --gzip --verbose --file="$file" ;; *.tar.xz | *.txz) tar --extract --xz --verbose --file="$file" ;; *.tar*) tar --extract --verbose --file="$file" ;; - *.zip) unzip "$file" ;; + *.zip) jar --verbose --extract --file "$file" ;; *.7z) 7z x "$file" ;; *) die "'$file' is not a supported file for unarchiving." ;; esac diff --git a/modules/by-name/lf/lf/commands/scripts/cd_lf_make_map.sh b/modules/by-name/lf/lf/commands/scripts/cd_lf_make_map.sh new file mode 100755 index 00000000..00befd3f --- /dev/null +++ b/modules/by-name/lf/lf/commands/scripts/cd_lf_make_map.sh @@ -0,0 +1,27 @@ +# 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>. + +# shellcheck shell=sh + +# shellcheck disable=SC2269 +f="$f" +# shellcheck disable=SC2269 +fx="$fx" +# shellcheck disable=SC2269 +fs="$fs" +# shellcheck disable=SC2269 +id="$id" + +root="$(lf-make-map --depth 4 interactive ~/media ~/repos ~/documents ~/.config ~/.local)" +if [ "$root" ]; then + lf_cmd cd "$root" || die "Bug: Failed to cd to selected path at '$root'" +fi + +# vim: ft=sh diff --git a/modules/by-name/lf/lf/ctpv/helpers.sh b/modules/by-name/lf/lf/ctpv/helpers.sh index 71524082..d0bba315 100644 --- a/modules/by-name/lf/lf/ctpv/helpers.sh +++ b/modules/by-name/lf/lf/ctpv/helpers.sh @@ -31,6 +31,7 @@ chafa_run() { # TODO: Animation support would be nice, but it would need to be supported in chafa by # allowing us to make a call to ctpvclear after each image is displayed. <2024-11-25> chafa --size "${w}x${h}" --animate=off "$1" | sed 's/#/\n#/g' + exiftool "$1" } send_image() { diff --git a/modules/by-name/lf/lf/ctpv/prev/application/archive/default.nix b/modules/by-name/lf/lf/ctpv/prev/application/archive/default.nix index d64c9572..a5fc2c50 100644 --- a/modules/by-name/lf/lf/ctpv/prev/application/archive/default.nix +++ b/modules/by-name/lf/lf/ctpv/prev/application/archive/default.nix @@ -94,6 +94,10 @@ pkgs.xz pkgs.zip + pkgs.cabextract + + pkgs.coreutils + # Unfree stuff # pkgs.lha # pkgs.rar diff --git a/modules/by-name/lf/lf/ctpv/prev/application/epub/default.nix b/modules/by-name/lf/lf/ctpv/prev/application/epub/default.nix index d28503e2..43e683a9 100644 --- a/modules/by-name/lf/lf/ctpv/prev/application/epub/default.nix +++ b/modules/by-name/lf/lf/ctpv/prev/application/epub/default.nix @@ -18,6 +18,7 @@ pkgs.bk pkgs.epub-thumbnailer pkgs.chafa + pkgs.exiftool pkgs.gnused ]; }; diff --git a/modules/by-name/lf/lf/ctpv/prev/application/pdf/default.nix b/modules/by-name/lf/lf/ctpv/prev/application/pdf/default.nix index bc8abf8f..cb96d7a9 100644 --- a/modules/by-name/lf/lf/ctpv/prev/application/pdf/default.nix +++ b/modules/by-name/lf/lf/ctpv/prev/application/pdf/default.nix @@ -16,6 +16,7 @@ dependencies = [ pkgs.poppler-utils # for `pdftoppm` pkgs.chafa + pkgs.exiftool pkgs.gnused pkgs.coreutils ]; diff --git a/modules/by-name/lf/lf/ctpv/prev/audio/default.nix b/modules/by-name/lf/lf/ctpv/prev/audio/default.nix index 7ae5d7fd..b9d4ff0d 100644 --- a/modules/by-name/lf/lf/ctpv/prev/audio/default.nix +++ b/modules/by-name/lf/lf/ctpv/prev/audio/default.nix @@ -14,9 +14,10 @@ matches.mime = ["audio/*"]; dependencies = [ pkgs.ffmpegthumbnailer - pkgs.ffmpeg + pkgs.ffmpeg-headless pkgs.chafa + pkgs.exiftool pkgs.gnused pkgs.coreutils ]; diff --git a/modules/by-name/lf/lf/ctpv/prev/font/default.nix b/modules/by-name/lf/lf/ctpv/prev/font/default.nix index 0f94603b..e2ce2cc2 100644 --- a/modules/by-name/lf/lf/ctpv/prev/font/default.nix +++ b/modules/by-name/lf/lf/ctpv/prev/font/default.nix @@ -22,6 +22,7 @@ dependencies = [ pkgs.fontforge # for `fontimage` pkgs.chafa + pkgs.exiftool pkgs.gnused pkgs.coreutils ]; diff --git a/modules/by-name/lf/lf/ctpv/prev/image/default.nix b/modules/by-name/lf/lf/ctpv/prev/image/default.nix index 79037d5a..765c7c83 100644 --- a/modules/by-name/lf/lf/ctpv/prev/image/default.nix +++ b/modules/by-name/lf/lf/ctpv/prev/image/default.nix @@ -14,6 +14,7 @@ matches.mime = ["image/*"]; dependencies = [ pkgs.chafa + pkgs.exiftool pkgs.gnused ]; }; diff --git a/modules/by-name/lf/lf/ctpv/prev/image/svg+xml/default.nix b/modules/by-name/lf/lf/ctpv/prev/image/svg+xml/default.nix index 25bd6f77..12e65337 100644 --- a/modules/by-name/lf/lf/ctpv/prev/image/svg+xml/default.nix +++ b/modules/by-name/lf/lf/ctpv/prev/image/svg+xml/default.nix @@ -16,6 +16,7 @@ dependencies = [ pkgs.imagemagick pkgs.chafa + pkgs.exiftool pkgs.gnused ]; }; diff --git a/modules/by-name/lf/lf/ctpv/prev/video/default.nix b/modules/by-name/lf/lf/ctpv/prev/video/default.nix index d500fbd9..dc51dbdf 100644 --- a/modules/by-name/lf/lf/ctpv/prev/video/default.nix +++ b/modules/by-name/lf/lf/ctpv/prev/video/default.nix @@ -15,6 +15,7 @@ dependencies = [ pkgs.ffmpegthumbnailer pkgs.chafa + pkgs.exiftool pkgs.gnused ]; }; diff --git a/modules/by-name/lf/lf/keybindings/default.nix b/modules/by-name/lf/lf/keybindings/default.nix index fbc33f6f..d7f8eb95 100644 --- a/modules/by-name/lf/lf/keybindings/default.nix +++ b/modules/by-name/lf/lf/keybindings/default.nix @@ -15,50 +15,69 @@ "'\"'" = null; ";" = null; "\"'\"" = null; - c = null; - d = null; - e = null; - j = null; - k = null; - m = null; - f = null; # Sorting - kn = ":set sortby natural; set info"; - ks = ":set sortby size; set info size"; - kt = ":set sortby time; set info time"; - ka = ":set sortby atime; set info atime"; - kc = ":set sortby ctime; set info ctime"; - ke = ":set sortby ext; set info"; + # k = null; + k = { + n = ":set sortby natural; set info"; + s = ":set sortby size; set info size"; + t = ":set sortby time; set info time"; + a = ":set sortby atime; set info atime"; + c = ":set sortby ctime; set info ctime"; + e = ":set sortby ext; set info"; + }; # Searching l = "search-next"; L = "search-prev"; - # File Openers - ee = "\$\$EDITOR \"$f\""; - es = "\$ nvim -S \"$f\""; + # File edit + # e = null; + e = { + e = "\$\$EDITOR \"$f\""; + s = "\$ nvim -S \"$f\""; + }; + u = "view_file"; - cc = "\$sudo -e \"$f\""; - fe = "execute"; - fl = "follow_link"; - cp = "set_clipboard_path"; + + # f = null; + f = { + e = "execute"; + l = "follow_link"; + }; + + # c = null; + c = { + p = "set_clipboard_path"; + s = "stripspace"; + h = "chmod"; + }; # Archive Mappings - au = "archive_decompress"; - aa = "archive_compress"; + a = { + u = "archive_decompress"; + a = "archive_compress"; + }; - # Trash Mappings - dd = "trash"; - jc = "trash_clear"; - jr = "trash_restore"; + D = { + D = "delete"; + }; + # d = null; + d = { + # Trash Mappings + d = "trash"; - # Dragon Mapping - dr = "dragon"; - ds = "dragon_stay"; - di = "dragon_individual"; + # Dragon Mapping + r = "dragon"; + s = "dragon_stay"; + i = "dragon_individual"; + }; - cs = "stripspace"; + # j = null; + j = { + c = "trash_clear"; + r = "trash_restore"; + }; # Vim keys h = "updir"; @@ -68,36 +87,36 @@ # Basic Functions "." = "set hidden!"; - DD = "delete"; p = "paste"; x = "cut"; y = "copy"; "<enter>" = "open"; - mk = "mk_link"; - mf = "mk_file"; - md = "mk_directory"; - ms = "mk_script"; + # m = null; + m = { + k = "mk_link"; + f = "mk_file"; + d = "mk_directory"; + s = "mk_script"; + }; + + b = { + g = "set_wallpaper"; + }; - ch = "chmod"; - bg = "set_wallpaper"; r = ":rename; cmd-end"; - H = "cd_project_root"; R = "reload"; C = "clear"; U = "unselect"; - # Movement - gjr = "cd ~/.local/share/Trash/files"; - gus = "cd /run/user/${builtins.toString uid}"; - - gc = "cd ~/.config"; - gl = "cd ~/.local"; - gE = "cd /etc"; - gD = "cd ${downloadDir}"; - - "gU." = "cd /usr"; - gUs = " cd /usr/share"; + # (walking) Movement + w = { + u = "cd /run/user/${builtins.toString uid}"; + e = "cd /etc"; + d = "cd ${downloadDir}"; + t = "cd /tmp"; + h = "cd_project_root"; + }; - gt = "cd /tmp"; + g = "cd_lf_make_map"; } diff --git a/modules/by-name/lf/lf/module.nix b/modules/by-name/lf/lf/module.nix index 8dfd0c52..0a0e193f 100644 --- a/modules/by-name/lf/lf/module.nix +++ b/modules/by-name/lf/lf/module.nix @@ -17,7 +17,19 @@ ... }: let commands = import ./commands {inherit pkgs sysLib shell_library system;}; - keybindings = import ./keybindings {inherit (cfg.keymaps) uid downloadDir;}; + keybindings_raw = import ./keybindings {inherit (cfg.keymaps) uid downloadDir;}; + + process = prefix: attrs: + lib.mapAttrsToList (name: value: + if (builtins.isAttrs value) + then + (process name value) + ++ [(lib.nameValuePair name null)] + else if prefix == null + then (lib.nameValuePair name value) + else (lib.nameValuePair (prefix + name) value)) + attrs; + keybindings = builtins.listToAttrs (lib.lists.flatten (process null keybindings_raw)); packages = import ./wrappers {inherit pkgs;}; @@ -85,7 +97,6 @@ in { drawbox = true; - # errorfmt = "\\033[1;91m==> ERROR:\\033[0m\\033[1;93m%s\\033[0m"; errorfmt = "\\033[1;91m%s\\033[0m"; hidden = true; # show hidden files icons = true; @@ -94,22 +105,6 @@ in { shell = "${lib.getExe pkgs.dash}"; shellopts = "-eu"; # e: exit on error; u: error for unset variables }; - extraConfig = '' - # Dynamically generate the cd mappings. - # This code dependends on the fact, that the lf server was started previously - # and keep running through `autoquit = false`. - # (Otherwise, the remote command is silently dropped: https://github.com/gokcehan/lf/issues/495) - &{{ - tmp="$(mktemp -t lf_make_map_dynamic_mapping_source_XXXXX)" - ${lib.getExe pkgs.lf-make-map} --depth 4 generate ~/media ~/repos ~/documents >"$tmp" - - lf -remote "send $id source $tmp" - sleep 1 - lf -remote "send $id source $tmp" - - rm "$tmp" - }} - ''; }; }; }; diff --git a/modules/by-name/lf/lf/wrappers/ll/ll.sh b/modules/by-name/lf/lf/wrappers/ll/ll.sh index ce29fd97..9bb314c6 100755 --- a/modules/by-name/lf/lf/wrappers/ll/ll.sh +++ b/modules/by-name/lf/lf/wrappers/ll/ll.sh @@ -10,20 +10,14 @@ # 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>. -last_directory="$(mktemp -t ll_last_directory_XXXXXXX)" -cleanup() { - rm "$last_directory" -} -trap cleanup EXIT +[ -d "$XDG_RUNTIME_DIR/ll" ] || mkdir "$XDG_RUNTIME_DIR/ll" +last_directory="$XDG_RUNTIME_DIR/ll/last_directory" command lf -last-dir-path="$last_directory" "$@" dir="$(cat "$last_directory")" -if cd "$dir"; then - [ -d "$XDG_RUNTIME_DIR/ll" ] || mkdir "$XDG_RUNTIME_DIR/ll" - echo "$dir" >"$XDG_RUNTIME_DIR/ll/last_directory" -else - die "$dir does not exist!" +if ! cd "$dir"; then + die "ll: Failed to cd to '$dir'. Does it exist?" fi # vim: ft=sh diff --git a/modules/by-name/lo/locale/module.nix b/modules/by-name/lo/locale/module.nix index 3c9c646c..0aa812ec 100644 --- a/modules/by-name/lo/locale/module.nix +++ b/modules/by-name/lo/locale/module.nix @@ -43,6 +43,9 @@ in { LC_TIME = "sv_SE.UTF-8"; LC_COLLATE = "C.UTF-8"; }; + extraLocales = [ + "fr_FR.UTF-8/UTF-8" + ]; }; # Layout diff --git a/modules/by-name/lu/lutris/module.nix b/modules/by-name/lu/lutris/module.nix new file mode 100644 index 00000000..f0b92a0b --- /dev/null +++ b/modules/by-name/lu/lutris/module.nix @@ -0,0 +1,39 @@ +# 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>. +{ + lib, + config, + libraries, + pkgs, + ... +}: let + cfg = config.soispha.programs.lutris; +in { + options.soispha.programs.lutris = { + enable = libraries.base.options.mkEnable "Lutris"; + }; + + config = lib.mkIf cfg.enable { + soispha.impermanence.userDirectories = [ + ".config/lutris" + ]; + + home-manager.users.soispha = { + programs.lutris = { + enable = true; + steamPackage = lib.mkIf config.programs.steam.enable config.programs.steam.package; + defaultWinePackage = pkgs.proton-ge-bin; + protonPackages = [pkgs.proton-ge-bin]; + + # winePackages = [pkgs.wineWow64Packages.full]; + }; + }; + }; +} 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/mp/mpd/module.nix b/modules/by-name/mp/mpd/module.nix index 37c648c6..474d81c4 100644 --- a/modules/by-name/mp/mpd/module.nix +++ b/modules/by-name/mp/mpd/module.nix @@ -62,6 +62,11 @@ in { services.mpd = { enable = true; + + package = pkgs.mpd.override { + ffmpeg = pkgs.ffmpeg-headless; + }; + network = { listenAddress = socketPath; }; diff --git a/modules/by-name/mp/mpd/mpc.nix b/modules/by-name/mp/mpd/mpc.nix index cd4a4ec0..5fbeddc5 100644 --- a/modules/by-name/mp/mpd/mpc.nix +++ b/modules/by-name/mp/mpd/mpc.nix @@ -14,10 +14,28 @@ ... }: let cfg = config.soispha.services.mpd.mpc; + + mpp = pkgs.mpp.override { + # Removes the currently playing song from the disk and storage + mpp-beetrm = pkgs.mpp-beetrm.override { + beets = cfg.beetsPkg; + }; + + # Works like normal `mpc searchadd` but uses the `beets` query syntax + mpp-searchadd = pkgs.mpp-searchadd.override { + beets = cfg.beetsPkg; + }; + }; in { options.soispha.services.mpd.mpc = { enable = lib.mkEnableOption "mpc with extensions"; + mppPackage = lib.mkOption { + type = lib.types.package; + description = "The package to use, when calling `mpp`"; + default = mpp; + }; + beetsPkg = lib.mkOption { type = lib.types.package; description = "The package to use, when calling `beet`"; @@ -26,18 +44,8 @@ in { config = lib.mkIf cfg.enable { home-manager.users.soispha.home.packages = [ - pkgs.mpp # Wrapper around `mpc` that allows the usage of `mpc-{beetsrm,lyrics,searchadd}` (below) without the `-` - - # Removes the currently playing song from the disk and storage - (pkgs.mpp-beetrm.override { - beets = cfg.beetsPkg; - }) - # Works like normal `mpc searchadd` but uses the `beets` query syntax - (pkgs.mpp-searchadd.override { - beets = cfg.beetsPkg; - }) - # Displays the lyrics of the currently playing song - pkgs.mpp-lyrics + # Wrapper around `mpc` that allows the usage of `mpc-{beetsrm,lyrics,searchadd}` + cfg.mppPackage ]; }; } diff --git a/modules/by-name/mp/mpv/module.nix b/modules/by-name/mp/mpv/module.nix index 4416b295..0610dcd8 100644 --- a/modules/by-name/mp/mpv/module.nix +++ b/modules/by-name/mp/mpv/module.nix @@ -23,11 +23,18 @@ in { programs.mpv = { enable = true; + package = pkgs.mpv.override { + mpv-unwrapped = pkgs.mpv-unwrapped.override { + ffmpeg = pkgs.ffmpeg-headless; + }; + }; + bindings = { q = "quit 0"; "Ctrl+c" = "quit 1"; "Shift+q" = "quit-watch-later 1"; }; + config = { osd-bar = true; @@ -46,9 +53,6 @@ in { max_width = 250; }; }; - scripts = [ - pkgs.mpvScripts.thumbfast - ]; }; }; } diff --git a/modules/by-name/ni/nix/module.nix b/modules/by-name/ni/nix/module.nix index ed4462f4..65b6ed5c 100644 --- a/modules/by-name/ni/nix/module.nix +++ b/modules/by-name/ni/nix/module.nix @@ -9,63 +9,71 @@ # If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. { pkgs, + libraries, + config, + lib, # flakes sources, self, system, externalDependencies, ... -}: -let +}: let nixpkgs = sources.loadFlake "nixpkgs"; + + cfg = config.soispha.nix; in { - # TODO(@bpeetz): Modularize <2025-02-08> + options.soispha.nix = { + enable = libraries.base.options.mkEnable "nix"; + }; - nix = { - package = pkgs.lixPackageSets.latest.lix; + config = lib.mkIf cfg.enable { + nix = { + package = pkgs.lixPackageSets.latest.lix; - # Disable nix channels (this is a remnant of old days) - channel.enable = false; + # Disable nix channels (this is a remnant of old days) + channel.enable = false; - registry = { - nixpkgs.flake = nixpkgs; - n.flake = - nixpkgs - // { - # Otherwise nixpkgs's config and overlays are not available: + registry = { + nixpkgs.flake = nixpkgs; + n.flake = + nixpkgs + // { + # Otherwise nixpkgs's config and overlays are not available: - # Both attrs exists, so we just override both and hope - outputs.legacyPackages."${system}" = pkgs; - legacyPackages."${system}" = pkgs; - }; + # Both attrs exists, so we just override both and hope + outputs.legacyPackages."${system}" = pkgs; + legacyPackages."${system}" = pkgs; + }; - t.flake = externalDependencies.templates; + t.flake = externalDependencies.templates; - my_flake.flake = self; - m.flake = self; - }; + my_flake.flake = self; + m.flake = self; + }; - gc = { - automatic = true; - dates = "weekly"; - options = "--delete-older-than 7d"; - }; + gc = { + automatic = true; + dates = "weekly"; + options = "--delete-older-than 7d"; + }; - settings = { - auto-optimise-store = true; - experimental-features = [ - "nix-command" - "flakes" - ]; + settings = { + auto-optimise-store = true; + experimental-features = [ + "nix-command" + "flakes" + ]; - use-xdg-base-directories = true; + use-xdg-base-directories = true; - fallback = true; # Build from source, if binary can't be substituted + fallback = true; # Build from source, if binary can't be substituted - keep-failed = false; # keep failed tmp build dirs - pure-eval = true; # restrict file system and network access to hash + keep-failed = false; # keep failed tmp build dirs + pure-eval = true; # restrict file system and network access to hash - sandbox-fallback = false; # Don't disable the sandbox, if the kernel doesn't support it + sandbox-fallback = false; # Don't disable the sandbox, if the kernel doesn't support it + }; }; }; } diff --git a/modules/by-name/ni/nixpkgs/module.nix b/modules/by-name/ni/nixpkgs/module.nix index 84d8e074..1ded8444 100644 --- a/modules/by-name/ni/nixpkgs/module.nix +++ b/modules/by-name/ni/nixpkgs/module.nix @@ -22,7 +22,13 @@ in { example = "x86_64-linux"; type = lib.types.str; }; + unfreePackageNames = lib.mkOption { + description = "Names of unfree packages to allow"; + example = "[ steam steam-unwrapped ]"; + type = lib.types.listOf lib.types.str; + }; }; + config = let myPkgsOverlay = self: super: packageSets.soispha; in @@ -39,11 +45,7 @@ in { hostSystem = cfg.systemName; allowUnfreePredicate = pkg: - builtins.elem (lib.getName pkg) [ - # the plugin is lacking an license and is thus unfree, effectively - # its okay though (TODO: investigate <2026-05-11>)? - "cmp-calc" - ]; + builtins.elem (lib.getName pkg) cfg.unfreePackageNames; }; }; }; diff --git a/modules/by-name/nv/nvim/plgs/femaco/lua/femaco.lua b/modules/by-name/nv/nvim/plgs/femaco/lua/femaco.lua index 50a6cb23..4dc9ce97 100644 --- a/modules/by-name/nv/nvim/plgs/femaco/lua/femaco.lua +++ b/modules/by-name/nv/nvim/plgs/femaco/lua/femaco.lua @@ -8,7 +8,6 @@ -- 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>. - local clip_val = require("femaco.utils").clip_val require("femaco").setup({ @@ -19,7 +18,7 @@ require("femaco").setup({ prepare_buffer = function(opts) local buf = vim.api.nvim_create_buf(false, false) return vim.api.nvim_open_win(buf, true, opts) - end; + end, -- should return options passed to nvim_open_win -- @param code_block: data about the code-block with the keys @@ -28,42 +27,34 @@ require("femaco").setup({ -- * lang float_opts = function(code_block) return { - relative = "cursor"; - width = clip_val(5, 120, vim.api.nvim_win_get_width(0) - 10); -- TODO how to offset sign column etc? - height = clip_val(5, #code_block.lines, vim.api.nvim_win_get_height(0) - 6); - anchor = "NW"; - row = 0; - col = 0; - style = "minimal"; - border = "rounded"; - zindex = 1; + relative = "cursor", + width = clip_val(5, 120, vim.api.nvim_win_get_width(0) - 10), -- TODO how to offset sign column etc? + height = clip_val(5, #code_block.lines, vim.api.nvim_win_get_height(0) - 6), + anchor = "NW", + row = 0, + col = 0, + style = "minimal", + border = "rounded", + zindex = 1, } - end; + end, -- return filetype to use for a given lang -- lang can be nil - ft_from_lang = function(lang) - return lang - end; + ft_from_lang = function(lang) return lang end, -- what to do after opening the float - post_open_float = function(winnr) - vim.wo.signcolumn = "no" - end; + post_open_float = function(winnr) vim.wo.signcolumn = "no" end, -- create the path to a temporary file - create_tmp_filepath = function(filetype) - return os.tmpname() - end; + create_tmp_filepath = function(filetype) return os.tmpname() end, -- if a newline should always be used, useful for multiline injections -- which separators needs to be on separate lines such as markdown, neorg etc -- @param base_filetype: The filetype which FeMaco is called from, not the -- filetype of the injected language (this is the current buffer so you can -- get it from vim.bo.filetyp). - ensure_newline = function(base_filetype) - return base_filetype == "nix" - end; + ensure_newline = function(base_filetype) return base_filetype == "nix" end, -- Return true if the indentation should be normalized. Useful when the -- injected language inherits indentation from the construction scope (e.g. an @@ -73,7 +64,5 @@ require("femaco").setup({ -- @param base_filetype: The filetype which FeMaco is called from, not the -- filetype of the injected language (this is the current buffer, so you can -- get it from vim.bo.filetype). - normalize_indent = function(base_filetype) - return base_filetype == "nix" - end; + normalize_indent = function(base_filetype) return base_filetype == "nix" end, }) diff --git a/modules/by-name/nv/nvim/plgs/luasnip/snippets/all.lua b/modules/by-name/nv/nvim/plgs/luasnip/snippets/all.lua index 371f5539..8c30063e 100644 --- a/modules/by-name/nv/nvim/plgs/luasnip/snippets/all.lua +++ b/modules/by-name/nv/nvim/plgs/luasnip/snippets/all.lua @@ -20,21 +20,20 @@ local get_comment_string = function(comment_type) local utils = require("Comment.utils") -- use the `Comments.nvim` API to fetch the comment string for the region (eq. '--%s' or '--[[%s]]' for `lua`) - local cstring = - calculate_comment_string({ ctype = comment_type; range = utils.get_region(); }) + local cstring = calculate_comment_string({ ctype = comment_type, range = utils.get_region() }) if cstring == nil then -- TODO: Use `vim.bo.commentstring` <2025-05-02> -- Use some useful default values. - return { ["begin"] = "#"; ["end"] = ""; } + return { ["begin"] = "#", ["end"] = "" } end -- as we want only the strings themselves and not strings ready for using `format` we want to split the left and right side local left, right = utils.unwrap_cstr(cstring) -- create a `{left, right}` table for it - return { ["begin"] = left; ["end"] = right; } + return { ["begin"] = left, ["end"] = right } end --- Wraps a table of snippet nodes in two comment function nodes. @@ -45,18 +44,13 @@ end local wrap_snippet_in_comments = function(comment_type, nodes) local output = {} - table.insert(output, ls.function_node(function() - return get_comment_string(comment_type)["begin"] - end)) - + table.insert(output, ls.function_node(function() return get_comment_string(comment_type)["begin"] end)) for _, v in ipairs(nodes) do table.insert(output, v) end - table.insert(output, ls.function_node(function() - return get_comment_string(comment_type)["end"] - end)) + table.insert(output, ls.function_node(function() return get_comment_string(comment_type)["end"] end)) return output end @@ -91,42 +85,36 @@ local function pair(pair_begin, pair_end, file_types, condition_function) -- It would be nice, if it would support both an empty array (`{}`) and nil <2023-08-27> -- file_types = file_types or {}; - return ls.snippet( - { - trig = pair_begin; - wordTrig = false; - snippetType = "autosnippet"; - }, - { - ls.text_node({ pair_begin; }); - ls.dynamic_node(1, get_visual); - ls.text_node({ pair_end; }); - }, - { - condition = function() - local filetype_check = true + return ls.snippet({ + trig = pair_begin, + wordTrig = false, + snippetType = "autosnippet", + }, { + ls.text_node({ pair_begin }), + ls.dynamic_node(1, get_visual), + ls.text_node({ pair_end }), + }, { + condition = function() + local filetype_check = true - if file_types ~= nil then - filetype_check = file_types[vim.bo.filetype] or false - end + if file_types ~= nil then filetype_check = file_types[vim.bo.filetype] or false end - return (not condition_function(pair_begin, pair_end)) and filetype_check - end; - } - ) + return (not condition_function(pair_begin, pair_end)) and filetype_check + end, + }) end local auto_pairs = { - pair("(", ")", nil, char_count_same); - pair("{", "}", nil, char_count_same); - pair("[", "]", nil, char_count_same); - pair("<", ">", { ["rust"] = true; ["tex"] = true; }, char_count_same); - pair("'", "'", nil, even_count); - pair("\"", "\"", nil, even_count); - pair("`", "`", nil, even_count); + pair("(", ")", nil, char_count_same), + pair("{", "}", nil, char_count_same), + pair("[", "]", nil, char_count_same), + pair("<", ">", { ["rust"] = true, ["tex"] = true }, char_count_same), + pair("'", "'", nil, even_count), + pair("\"", "\"", nil, even_count), + pair("`", "`", nil, even_count), } -ls.add_snippets("all", auto_pairs, { type = "snippets"; key = "auto_pairs"; }) +ls.add_snippets("all", auto_pairs, { type = "snippets", key = "auto_pairs" }) -- }}} -- todo_comments {{{ @@ -134,9 +122,7 @@ local read_git_config = function(config_value) local command = string.format("git config \"%s\"", config_value) local handle = io.popen(command) - if handle == nil then - return error(string.format("Failed to call `%s`.", command)) - end + if handle == nil then return error(string.format("Failed to call `%s`.", command)) end local result = handle:read("*a") handle:close() @@ -199,14 +185,17 @@ local todo_snippet = function(trig, name, comment_type, mark_function) local date_node, signature_node = mark_function() - local nodes = fmt("{} {}{}: {} {} {}", wrap_snippet_in_comments(comment_type, { - ls.text_node(name); - signature_node; - ls.insert_node(1, "content"); - date_node; - })) + local nodes = fmt( + "{} {}{}: {} {} {}", + wrap_snippet_in_comments(comment_type, { + ls.text_node(name), + signature_node, + ls.insert_node(1, "content"), + date_node, + }) + ) - return ls.snippet(context, nodes, { ctype = comment_type; }) + return ls.snippet(context, nodes, { ctype = comment_type }) end ---@param trigger string: The luasnip trigger @@ -214,26 +203,18 @@ end ---@param name string: All aliases for a name ---@return table: All possible snippets build from the marks local process_marks = function(trigger, name, comment_type) - local username = function() - return handle_from_name(read_git_config("user.name")) - end + local username = function() return handle_from_name(read_git_config("user.name")) end local marks = { - signature = function() - return ls.text_node("(" .. username() .. ")"), ls.text_node("") - end; + signature = function() return ls.text_node("(" .. username() .. ")"), ls.text_node("") end, date_signature = function() return ls.text_node("<" .. os.date("%Y-%m-%d") .. ">"), ls.text_node("(" .. username() .. ")") - end; + end, - date = function() - return ls.text_node("<" .. os.date("%Y-%m-%d") .. ">"), ls.text_node("") - end; + date = function() return ls.text_node("<" .. os.date("%Y-%m-%d") .. ">"), ls.text_node("") end, - empty = function() - return ls.text_node(""), ls.text_node("") - end; + empty = function() return ls.text_node(""), ls.text_node("") end, } local output = {} @@ -247,20 +228,20 @@ local process_marks = function(trigger, name, comment_type) end local todo_snippet_specs = { - { { trig = "todo"; }; { "TODO"; }; { ctype = 1; }; }; - { { trig = "fix"; }; { "FIXME"; "ISSUE"; }; { ctype = 1; }; }; - { { trig = "hack"; }; { "HACK"; }; { ctype = 1; }; }; - { { trig = "warn"; }; { "WARNING"; }; { ctype = 1; }; }; - { { trig = "perf"; }; { "PERFORMANCE"; "OPTIMIZE"; }; { ctype = 1; }; }; - { { trig = "note"; }; { "NOTE"; "INFO"; }; { ctype = 1; }; }; + { { trig = "todo" }, { "TODO" }, { ctype = 1 } }, + { { trig = "fix" }, { "FIXME", "ISSUE" }, { ctype = 1 } }, + { { trig = "hack" }, { "HACK" }, { ctype = 1 } }, + { { trig = "warn" }, { "WARNING" }, { ctype = 1 } }, + { { trig = "perf" }, { "PERFORMANCE", "OPTIMIZE" }, { ctype = 1 } }, + { { trig = "note" }, { "NOTE", "INFO" }, { ctype = 1 } }, -- NOTE: Block commented todo-comments - { { trig = "todob"; }; { "TODO"; }; { ctype = 2; }; }; - { { trig = "fixb"; }; { "FIXME"; "ISSUE"; }; { ctype = 2; }; }; - { { trig = "hackb"; }; { "HACK"; }; { ctype = 2; }; }; - { { trig = "warnb"; }; { "WARNING"; }; { ctype = 2; }; }; - { { trig = "perfb"; }; { "PERF"; "PERFORMANCE"; "OPTIM"; "OPTIMIZE"; }; { ctype = 2; }; }; - { { trig = "noteb"; }; { "NOTE"; "INFO"; }; { ctype = 2; }; }; + { { trig = "todob" }, { "TODO" }, { ctype = 2 } }, + { { trig = "fixb" }, { "FIXME", "ISSUE" }, { ctype = 2 } }, + { { trig = "hackb" }, { "HACK" }, { ctype = 2 } }, + { { trig = "warnb" }, { "WARNING" }, { ctype = 2 } }, + { { trig = "perfb" }, { "PERF", "PERFORMANCE", "OPTIM", "OPTIMIZE" }, { ctype = 2 } }, + { { trig = "noteb" }, { "NOTE", "INFO" }, { ctype = 2 } }, } local todo_comment_snippets = {} @@ -271,7 +252,7 @@ for _, v in ipairs(todo_snippet_specs) do end end -ls.add_snippets("all", todo_comment_snippets, { type = "snippets"; key = "todo_comments"; }) +ls.add_snippets("all", todo_comment_snippets, { type = "snippets", key = "todo_comments" }) -- }}} -- spdx snippets {{{ @@ -283,27 +264,30 @@ local generate_spdx_snippet = function(comment_type, spdx_license_expr, trigger) context.name = trigger .. " spdx snippet expr" context.trig = trigger - local nodes = { - fmt("{} SPDX-SnippetBegin {}", wrap_snippet_in_comments(comment_type, {})); + fmt("{} SPDX-SnippetBegin {}", wrap_snippet_in_comments(comment_type, {})), - fmt("{} SPDX-SnippetCopyrightText: {} {} <{}> {}", - wrap_snippet_in_comments(comment_type, { - ls.insert_node(1, "year"); - ls.insert_node(2, "author"); - ls.insert_node(3, "email"); - }) - ); + fmt( + "{} SPDX-SnippetCopyrightText: {} {} <{}> {}", + wrap_snippet_in_comments(comment_type, { + ls.insert_node(1, "year"), + ls.insert_node(2, "author"), + ls.insert_node(3, "email"), + }) + ), - fmt("{} SPDX-License-Identifier: {} {}", wrap_snippet_in_comments(comment_type, { - ls.text_node(spdx_license_expr); - })); + fmt( + "{} SPDX-License-Identifier: {} {}", + wrap_snippet_in_comments(comment_type, { + ls.text_node(spdx_license_expr), + }) + ), - { ls.insert_node(4, "content"); }; + { ls.insert_node(4, "content") }, - fmt("{} SPDX-SnippetEnd {}", wrap_snippet_in_comments(comment_type, {})); + fmt("{} SPDX-SnippetEnd {}", wrap_snippet_in_comments(comment_type, {})), - { ls.insert_node(0); }; + { ls.insert_node(0) }, } local newline_nodes = {} @@ -313,16 +297,16 @@ local generate_spdx_snippet = function(comment_type, spdx_license_expr, trigger) end -- luasnip requires newlines to be encoded like this: - table.insert(newline_nodes, ls.text_node({ ""; ""; })) + table.insert(newline_nodes, ls.text_node({ "", "" })) end - return ls.snippet(context, newline_nodes, { ctype = comment_type; }) + return ls.snippet(context, newline_nodes, { ctype = comment_type }) end local spdx = { - { trigger = "spdx-AGPL3+"; license = "AGPL-3.0-or-later"; }; - { trigger = "spdx-GPL3+"; license = "GPL-3.0-or-later"; }; - { trigger = "spdx-MIT"; license = "MIT"; }; + { trigger = "spdx-AGPL3+", license = "AGPL-3.0-or-later" }, + { trigger = "spdx-GPL3+", license = "GPL-3.0-or-later" }, + { trigger = "spdx-MIT", license = "MIT" }, } local spdx_snippets = {} @@ -334,5 +318,5 @@ for _, value in ipairs(spdx) do table.insert(spdx_snippets, snippet) end -ls.add_snippets("all", spdx_snippets, { type = "snippets"; key = "spdx_snippets"; }) +ls.add_snippets("all", spdx_snippets, { type = "snippets", key = "spdx_snippets" }) -- }}} diff --git a/modules/by-name/nv/nvim/plgs/luasnip/snippets/tex/delimiter.lua b/modules/by-name/nv/nvim/plgs/luasnip/snippets/tex/delimiter.lua index bcd128f7..02d285b7 100644 --- a/modules/by-name/nv/nvim/plgs/luasnip/snippets/tex/delimiter.lua +++ b/modules/by-name/nv/nvim/plgs/luasnip/snippets/tex/delimiter.lua @@ -19,23 +19,23 @@ local get_visual = function(_, parent) end end -local translation_table = { ["("] = ")"; ["{"] = "}"; ["["] = "]"; } +local translation_table = { ["("] = ")", ["{"] = "}", ["["] = "]" } -- Return snippet tables return { -- LEFT/RIGHT ALL BRACES ls.snippet( { - trig = "([^%a])l([%(%[%{])"; - regTrig = true; - wordTrig = false; - snippetType = "autosnippet"; + trig = "([^%a])l([%(%[%{])", + regTrig = true, + wordTrig = false, + snippetType = "autosnippet", }, fmt("{}\\left{}{}\\right{}", { - ls.function_node(function(_, snip) return snip.captures[1] end); - ls.function_node(function(_, snip) return snip.captures[2] end); - ls.dynamic_node(1, get_visual); - ls.function_node(function(_, snip) return translation_table[snip.captures[2]] end); + ls.function_node(function(_, snip) return snip.captures[1] end), + ls.function_node(function(_, snip) return snip.captures[2] end), + ls.dynamic_node(1, get_visual), + ls.function_node(function(_, snip) return translation_table[snip.captures[2]] end), }) - ); + ), } diff --git a/modules/by-name/nv/nvim/plgs/luasnip/snippets/tex/greek.lua b/modules/by-name/nv/nvim/plgs/luasnip/snippets/tex/greek.lua index 21aa7414..a98f6e8c 100644 --- a/modules/by-name/nv/nvim/plgs/luasnip/snippets/tex/greek.lua +++ b/modules/by-name/nv/nvim/plgs/luasnip/snippets/tex/greek.lua @@ -12,38 +12,38 @@ local ls = require("luasnip") -- Return snippet tables return { - ls.snippet({ trig = ";a"; snippetType = "autosnippet"; }, { ls.text_node("\\alpha"); }); - ls.snippet({ trig = ";b"; snippetType = "autosnippet"; }, { ls.text_node("\\beta"); }); - ls.snippet({ trig = ";g"; snippetType = "autosnippet"; }, { ls.text_node("\\gamma"); }); - ls.snippet({ trig = ";G"; snippetType = "autosnippet"; }, { ls.text_node("\\Gamma"); }); - ls.snippet({ trig = ";d"; snippetType = "autosnippet"; }, { ls.text_node("\\delta"); }); - ls.snippet({ trig = ";D"; snippetType = "autosnippet"; }, { ls.text_node("\\Delta"); }); - ls.snippet({ trig = ";e"; snippetType = "autosnippet"; }, { ls.text_node("\\epsilon"); }); - ls.snippet({ trig = ";ve"; snippetType = "autosnippet"; }, { ls.text_node("\\varepsilon"); }); - ls.snippet({ trig = ";z"; snippetType = "autosnippet"; }, { ls.text_node("\\zeta"); }); - ls.snippet({ trig = ";h"; snippetType = "autosnippet"; }, { ls.text_node("\\eta"); }); - ls.snippet({ trig = ";o"; snippetType = "autosnippet"; }, { ls.text_node("\\theta"); }); - ls.snippet({ trig = ";vo"; snippetType = "autosnippet"; }, { ls.text_node("\\vartheta"); }); - ls.snippet({ trig = ";O"; snippetType = "autosnippet"; }, { ls.text_node("\\Theta"); }); - ls.snippet({ trig = ";k"; snippetType = "autosnippet"; }, { ls.text_node("\\kappa"); }); - ls.snippet({ trig = ";l"; snippetType = "autosnippet"; }, { ls.text_node("\\lambda"); }); - ls.snippet({ trig = ";L"; snippetType = "autosnippet"; }, { ls.text_node("\\Lambda"); }); - ls.snippet({ trig = ";m"; snippetType = "autosnippet"; }, { ls.text_node("\\mu"); }); - ls.snippet({ trig = ";n"; snippetType = "autosnippet"; }, { ls.text_node("\\nu"); }); - ls.snippet({ trig = ";x"; snippetType = "autosnippet"; }, { ls.text_node("\\xi"); }); - ls.snippet({ trig = ";X"; snippetType = "autosnippet"; }, { ls.text_node("\\Xi"); }); - ls.snippet({ trig = ";i"; snippetType = "autosnippet"; }, { ls.text_node("\\pi"); }); - ls.snippet({ trig = ";I"; snippetType = "autosnippet"; }, { ls.text_node("\\Pi"); }); - ls.snippet({ trig = ";r"; snippetType = "autosnippet"; }, { ls.text_node("\\rho"); }); - ls.snippet({ trig = ";s"; snippetType = "autosnippet"; }, { ls.text_node("\\sigma"); }); - ls.snippet({ trig = ";S"; snippetType = "autosnippet"; }, { ls.text_node("\\Sigma"); }); - ls.snippet({ trig = ";t"; snippetType = "autosnippet"; }, { ls.text_node("\\tau"); }); - ls.snippet({ trig = ";f"; snippetType = "autosnippet"; }, { ls.text_node("\\phi"); }); - ls.snippet({ trig = ";vf"; snippetType = "autosnippet"; }, { ls.text_node("\\varphi"); }); - ls.snippet({ trig = ";F"; snippetType = "autosnippet"; }, { ls.text_node("\\Phi"); }); - ls.snippet({ trig = ";c"; snippetType = "autosnippet"; }, { ls.text_node("\\chi"); }); - ls.snippet({ trig = ";p"; snippetType = "autosnippet"; }, { ls.text_node("\\psi"); }); - ls.snippet({ trig = ";P"; snippetType = "autosnippet"; }, { ls.text_node("\\Psi"); }); - ls.snippet({ trig = ";w"; snippetType = "autosnippet"; }, { ls.text_node("\\omega"); }); - ls.snippet({ trig = ";W"; snippetType = "autosnippet"; }, { ls.text_node("\\Omega"); }); + ls.snippet({ trig = ";a", snippetType = "autosnippet" }, { ls.text_node("\\alpha") }), + ls.snippet({ trig = ";b", snippetType = "autosnippet" }, { ls.text_node("\\beta") }), + ls.snippet({ trig = ";g", snippetType = "autosnippet" }, { ls.text_node("\\gamma") }), + ls.snippet({ trig = ";G", snippetType = "autosnippet" }, { ls.text_node("\\Gamma") }), + ls.snippet({ trig = ";d", snippetType = "autosnippet" }, { ls.text_node("\\delta") }), + ls.snippet({ trig = ";D", snippetType = "autosnippet" }, { ls.text_node("\\Delta") }), + ls.snippet({ trig = ";e", snippetType = "autosnippet" }, { ls.text_node("\\epsilon") }), + ls.snippet({ trig = ";ve", snippetType = "autosnippet" }, { ls.text_node("\\varepsilon") }), + ls.snippet({ trig = ";z", snippetType = "autosnippet" }, { ls.text_node("\\zeta") }), + ls.snippet({ trig = ";h", snippetType = "autosnippet" }, { ls.text_node("\\eta") }), + ls.snippet({ trig = ";o", snippetType = "autosnippet" }, { ls.text_node("\\theta") }), + ls.snippet({ trig = ";vo", snippetType = "autosnippet" }, { ls.text_node("\\vartheta") }), + ls.snippet({ trig = ";O", snippetType = "autosnippet" }, { ls.text_node("\\Theta") }), + ls.snippet({ trig = ";k", snippetType = "autosnippet" }, { ls.text_node("\\kappa") }), + ls.snippet({ trig = ";l", snippetType = "autosnippet" }, { ls.text_node("\\lambda") }), + ls.snippet({ trig = ";L", snippetType = "autosnippet" }, { ls.text_node("\\Lambda") }), + ls.snippet({ trig = ";m", snippetType = "autosnippet" }, { ls.text_node("\\mu") }), + ls.snippet({ trig = ";n", snippetType = "autosnippet" }, { ls.text_node("\\nu") }), + ls.snippet({ trig = ";x", snippetType = "autosnippet" }, { ls.text_node("\\xi") }), + ls.snippet({ trig = ";X", snippetType = "autosnippet" }, { ls.text_node("\\Xi") }), + ls.snippet({ trig = ";i", snippetType = "autosnippet" }, { ls.text_node("\\pi") }), + ls.snippet({ trig = ";I", snippetType = "autosnippet" }, { ls.text_node("\\Pi") }), + ls.snippet({ trig = ";r", snippetType = "autosnippet" }, { ls.text_node("\\rho") }), + ls.snippet({ trig = ";s", snippetType = "autosnippet" }, { ls.text_node("\\sigma") }), + ls.snippet({ trig = ";S", snippetType = "autosnippet" }, { ls.text_node("\\Sigma") }), + ls.snippet({ trig = ";t", snippetType = "autosnippet" }, { ls.text_node("\\tau") }), + ls.snippet({ trig = ";f", snippetType = "autosnippet" }, { ls.text_node("\\phi") }), + ls.snippet({ trig = ";vf", snippetType = "autosnippet" }, { ls.text_node("\\varphi") }), + ls.snippet({ trig = ";F", snippetType = "autosnippet" }, { ls.text_node("\\Phi") }), + ls.snippet({ trig = ";c", snippetType = "autosnippet" }, { ls.text_node("\\chi") }), + ls.snippet({ trig = ";p", snippetType = "autosnippet" }, { ls.text_node("\\psi") }), + ls.snippet({ trig = ";P", snippetType = "autosnippet" }, { ls.text_node("\\Psi") }), + ls.snippet({ trig = ";w", snippetType = "autosnippet" }, { ls.text_node("\\omega") }), + ls.snippet({ trig = ";W", snippetType = "autosnippet" }, { ls.text_node("\\Omega") }), } diff --git a/modules/by-name/nv/nvim/plgs/neorg/default.nix b/modules/by-name/nv/nvim/plgs/neorg/default.nix index 5ed87f0e..b69f5a58 100644 --- a/modules/by-name/nv/nvim/plgs/neorg/default.nix +++ b/modules/by-name/nv/nvim/plgs/neorg/default.nix @@ -55,7 +55,7 @@ in { __empty = null; }; "core.dirman".config = { - workspaces = { }; + workspaces = {}; }; "core.export".config = { __empty = null; diff --git a/modules/by-name/nv/nvim/plgs/nvim-cmp/default.nix b/modules/by-name/nv/nvim/plgs/nvim-cmp/default.nix index 315f3fc7..48883bd3 100644 --- a/modules/by-name/nv/nvim/plgs/nvim-cmp/default.nix +++ b/modules/by-name/nv/nvim/plgs/nvim-cmp/default.nix @@ -14,6 +14,12 @@ }: let cfg = config.soispha.programs.nvim; in { + soispha.nixpkgs.unfreePackageNames = [ + # the plugin is lacking an license and is thus unfree, effectively + # its okay though (TODO: investigate <2026-05-11>)? + "cmp-calc" + ]; + home-manager.users.soispha.programs.nixvim = lib.mkIf cfg.enable { opts.completeopt = [ "menu" # Show completions in a menu diff --git a/modules/by-name/qu/qutebrowser/include/redirects.py b/modules/by-name/qu/qutebrowser/include/redirects.py index 63a44ecf..2588b9e0 100644 --- a/modules/by-name/qu/qutebrowser/include/redirects.py +++ b/modules/by-name/qu/qutebrowser/include/redirects.py @@ -34,7 +34,7 @@ def farside_redir(target: str, url: QUrl) -> bool: # Any return value other than a literal 'False' means we redirect REDIRECT_MAP: typing.Dict[str, typing.Callable[..., typing.Optional[bool]]] = { - "reddit.com": operator.methodcaller("setHost", "redlib.vhack.eu"), + "reddit.com": partial(farside_redir, "redlib"), # Source: https://libredirect.github.io/ "medium.com": partial(farside_redir, "scribe"), "stackoverflow.com": partial(farside_redir, "anonymousoverflow"), diff --git a/modules/by-name/qu/qutebrowser/settings/default.nix b/modules/by-name/qu/qutebrowser/settings/default.nix index 282c5816..b0259c22 100644 --- a/modules/by-name/qu/qutebrowser/settings/default.nix +++ b/modules/by-name/qu/qutebrowser/settings/default.nix @@ -502,11 +502,11 @@ in { "@du" = duckduckgo; # NIX - "@np" = "https://search.nixos.org/packages?type=packages&query={}"; # Nix packages + "@np" = "https://search.nixos.org/packages?channel=unstable&type=packages&query={}"; # Nix packages "@ng" = "https://noogle.dev/q?term={}"; # Nix functions - "@no" = "https://search.nixos.org/options?type=options&query={}"; # NixOS options + "@no" = "https://search.nixos.org/options?channel=unstable&type=options&query={}"; # NixOS options "@nh" = "https://home-manager-options.extranix.com/?query={}&release=master"; # Home-Manager options "@ni" = "https://github.com/NixOS/nixpkgs/issues?q=is%3Aissue+is%3Aopen+{}"; # Nixpkgs issues diff --git a/modules/by-name/ri/river/keymap.nix b/modules/by-name/ri/river/keymap.nix index 9bcbf387..1d4b8c3e 100644 --- a/modules/by-name/ri/river/keymap.nix +++ b/modules/by-name/ri/river/keymap.nix @@ -37,16 +37,17 @@ }; cfg = config.soispha.programs.river; + inherit (config.soispha.services.mpd.mpc) mppPackage; in { soispha.programs.river.init.mappings.keymap = lib.mkIf cfg.enable (lib.fixedPoints.fix (self: { "<LEFT_SUPER>" = { # Spawn standard programs "r" = { - "a" = mkSpawn pkgs.alacritty "" {}; + "a" = mkSpawn' pkgs.foot "footclient" "" {}; "b" = mkSpawn pkgs.tskm "open select" {once = true;}; "k" = mkSpawn pkgs.keepassxc "" {once = true;}; - "s" = mkSpawn pkgs.signal-desktop "" {once = true;}; + # "s" = mkSpawn pkgs.signal-desktop "" {once = true;}; "p" = mkSpawn pkgs.screenshot_persistent "" {once = true;}; "i" = mkSpawn pkgs.anki "" {once = true;}; }; @@ -76,9 +77,9 @@ in { "u" = mkSpawn' pkgs.wireplumber "wpctl" "set-volume @DEFAULT_SINK@ 5%+" {}; "d" = mkSpawn' pkgs.wireplumber "wpctl" "set-volume @DEFAULT_SINK@ 5%-" {}; "m" = mkSpawn' pkgs.wireplumber "wpctl" "set-mute @DEFAULT_SINK@ toggle" {}; - "n" = mkSpawn pkgs.mpp "next" {}; - "p" = mkSpawn pkgs.mpp "prev" {}; - "t" = mkSpawn pkgs.mpp "toggle" {}; + "n" = mkSpawn mppPackage "next" {}; + "p" = mkSpawn mppPackage "prev" {}; + "t" = mkSpawn mppPackage "toggle" {}; "g" = mkSpawn' pkgs.mpdpopm "mpdpopm" "rating inc" {once = true;}; "b" = mkSpawn' pkgs.mpdpopm "mpdpopm" "rating decr" {once = true;}; }; diff --git a/modules/by-name/ri/river/module.nix b/modules/by-name/ri/river/module.nix index bafaf0a3..7eb30014 100644 --- a/modules/by-name/ri/river/module.nix +++ b/modules/by-name/ri/river/module.nix @@ -35,7 +35,9 @@ else builtins.map esa input ); in "err_fail ${program} &"; - longRunningPrograms = builtins.concatStringsSep "\n" (builtins.map mkLrProgram cfg.init.backgroundStart); + longRunningPrograms = + builtins.concatStringsSep "\n" (builtins.map mkLrProgram + cfg.init.autoStart); keymapFormat = pkgs.formats.json {}; keymapGenerate = name: value: @@ -163,12 +165,14 @@ in { ''; }; - backgroundStart = lib.mkOption { - type = lib.types.listOf (lib.types.either lib.types.package (lib.types.listOf lib.types.str)); - description = "List of programs to start in the background"; + autoStart = lib.mkOption { + 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 = '' [ - pkgs.gammastep + ''${lib.getExe pkgs.foot} ] ''; }; @@ -235,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/by-name/ss/ssh/module.nix b/modules/by-name/ss/ssh/module.nix index f7218e36..87c50728 100644 --- a/modules/by-name/ss/ssh/module.nix +++ b/modules/by-name/ss/ssh/module.nix @@ -15,16 +15,16 @@ }: let cfg = config.soispha.programs.ssh; - mkDefaultMatchBlock = userKnownHostsFile: { - addKeysToAgent = "no"; - compression = true; - controlMaster = "no"; - controlPersist = "no"; - forwardAgent = false; - hashKnownHosts = false; - serverAliveCountMax = 3; - serverAliveInterval = 240; - inherit userKnownHostsFile; + mkDefaultMatchBlock = UserKnownHostsFile: { + AddKeysToAgent = "no"; + Compression = true; + ControlMaster = "no"; + ControlPersist = "no"; + ForwardAgent = false; + HashKnownHosts = false; + ServerAliveCountMax = 3; + ServerAliveInterval = 240; + inherit UserKnownHostsFile; }; in { options.soispha.programs.ssh = { @@ -48,19 +48,23 @@ in { enable = true; enableDefaultConfig = false; - matchBlocks."*" = mkDefaultMatchBlock ( - builtins.toString (pkgs.writeTextFile { - name = "root-known-hosts"; - text = cfg.rootKnownHosts; - }) - ); + settings = { + "Host *" = mkDefaultMatchBlock ( + builtins.toString (pkgs.writeTextFile { + name = "root-known-hosts"; + text = cfg.rootKnownHosts; + }) + ); + }; }; soispha.programs.ssh = { enable = true; enableDefaultConfig = false; - matchBlocks."*" = mkDefaultMatchBlock "${config.home-manager.users.soispha.xdg.dataHome}/ssh/known_hosts"; + settings = { + "Host *" = mkDefaultMatchBlock "${config.home-manager.users.soispha.xdg.dataHome}/ssh/known_hosts"; + }; }; }; }; diff --git a/modules/by-name/st/steam/module.nix b/modules/by-name/st/steam/module.nix index 87cdc709..aaa36fd3 100644 --- a/modules/by-name/st/steam/module.nix +++ b/modules/by-name/st/steam/module.nix @@ -19,15 +19,12 @@ in { }; config = lib.mkIf cfg.enable { - nixpkgs.config.allowUnfreePredicate = pkg: - builtins.elem (lib.getName pkg) [ - # NOTE: These are not really applied. Needs to be at - # <modules/by-name/ni/nixpkgs/config.nix> for some reason. <2025-04-25> - "steam" - "steam-unwrapped" - "steam-original" - "steam-run" - ]; + soispha.nixpkgs.unfreePackageNames = [ + "steam" + "steam-unwrapped" + "steam-original" + "steam-run" + ]; programs.steam = { enable = true; 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..9bda534f --- /dev/null +++ b/modules/by-name/sw/swayidle/module.nix @@ -0,0 +1,45 @@ +# 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, + pkgs, + lib, + libraries, + ... +}: let + cfg = config.soispha.programs.swayidle; + swaylock = lib.getExe pkgs.swaylock; +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/by-name/xd/xdg/module.nix b/modules/by-name/xd/xdg/module.nix index 108e0179..9430d82f 100644 --- a/modules/by-name/xd/xdg/module.nix +++ b/modules/by-name/xd/xdg/module.nix @@ -41,15 +41,15 @@ }; cfg = config.soispha.xdg; + + inherit (config.home-manager.users.soispha.home) homeDirectory; in { options.soispha.xdg = { enable = lib.mkEnableOption "xdg"; }; config = lib.mkIf cfg.enable { - home-manager.users.soispha.xdg = let - inherit (config.home-manager.users.soispha.home) homeDirectory; - in { + home-manager.users.soispha.xdg = { enable = true; configFile."xdg-desktop-portal-termfilechooser/config".source = tfcConfigFile; @@ -75,6 +75,7 @@ in { music = "${homeDirectory}/media/music"; pictures = "${homeDirectory}/media/pictures"; videos = "${homeDirectory}/media/videos"; + projects = "${homeDirectory}/repos"; templates = null; publicShare = null; diff --git a/modules/by-name/yt/yt/module.nix b/modules/by-name/yt/yt/module.nix index 81bacf44..f001c030 100644 --- a/modules/by-name/yt/yt/module.nix +++ b/modules/by-name/yt/yt/module.nix @@ -113,6 +113,10 @@ in { config = { home-manager.users.soispha = lib.mkIf cfg.enable { + home.packages = [ + pkgs.yt + ]; + xdg.configFile = { "yt/mpv.conf".text = renderOptions mpvConf; "yt/mpv.input.conf".text = renderBindings mpvInputConfig; diff --git a/modules/common/default.nix b/modules/common/default.nix index 40c08378..e5172921 100644 --- a/modules/common/default.nix +++ b/modules/common/default.nix @@ -105,12 +105,18 @@ # Already synchronized by mbsync "~/.local/share/maildir" + + # "Unknown filetype" (and there is no real reason to (try to) synchronize sockets) + "~/.local/share/gnupg/S.gpg-agent" + "~/.local/share/gnupg/S.gpg-agent.browser" + "~/.local/share/gnupg/S.gpg-agent.extra" + "~/.local/share/gnupg/S.gpg-agent.ssh" + "~/.local/share/gnupg/S.scdaemon" + # Should not be synchronized "~/.local/share/unison" # These are just to big to be synchronized (# TODO: Work around that <2024-08-31> ) - "~/media/music/beets.old" - "~/media/music/deerix" "~/.local/share/Steam" ] ++ homeManagerSymlinks; @@ -213,17 +219,10 @@ 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 - pkgs.alacritty - ]; }; }; mpv.enable = true; - steam.enable = false; + steam.enable = true; ssh.enable = true; swaylock.enable = true; timewarrior.enable = true; diff --git a/modules/home.legacy/conf/beets/default.nix b/modules/home.legacy/conf/beets/default.nix index 0879b1a5..43d6bff9 100644 --- a/modules/home.legacy/conf/beets/default.nix +++ b/modules/home.legacy/conf/beets/default.nix @@ -14,7 +14,6 @@ ... }: let plugins = import ./plugins.nix {}; - # TODO: Enable xtractor again <2025-03-29> # package = pkgs.beets.override { # pluginOverrides = { @@ -23,7 +22,6 @@ # propagatedBuildInputs = [pkgs.beetsExtraPlugins.xtractor]; # }; # }; - package = pkgs.beets; in { imports = [ ./plugins @@ -31,7 +29,14 @@ in { programs.beets = { enable = true; - inherit package; + package = pkgs.python3.pkgs.toPythonApplication (pkgs.python3.pkgs.beets.override + { + ffmpeg = pkgs.ffmpeg-headless; + keyfinder-cli = pkgs.keyfinder-cli.override { + ffmpeg = + pkgs.ffmpeg-headless; + }; + }); settings = { library = "${config.xdg.dataHome}/beets/library.db"; diff --git a/modules/home.legacy/conf/beets/plugins/mbsubmit/default.nix b/modules/home.legacy/conf/beets/plugins/mbsubmit/default.nix deleted file mode 100644 index e69de29b..00000000 --- a/modules/home.legacy/conf/beets/plugins/mbsubmit/default.nix +++ /dev/null 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/gtk/default.nix b/modules/home.legacy/conf/gtk/default.nix index c1a94f73..e624765b 100644 --- a/modules/home.legacy/conf/gtk/default.nix +++ b/modules/home.legacy/conf/gtk/default.nix @@ -15,6 +15,7 @@ gtk = { enable = true; theme = { + # NOTE: The `nordic` package pulls the whole plasma shell, to copy some stuff from a plasma theme :/ <2026-05-29> package = pkgs.nordic; name = "Nordic"; }; 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 - # }; -} diff --git a/modules/home.legacy/pkgs/default.nix b/modules/home.legacy/pkgs/default.nix index 18ef3d98..ddc633c1 100644 --- a/modules/home.legacy/pkgs/default.nix +++ b/modules/home.legacy/pkgs/default.nix @@ -22,10 +22,6 @@ with pkgs; let }; TuiCli = { - Pdfs = [ - con2pdf # Scanner implementation - ]; - Misc = [ killall # kill a application by name bc # Smart calculator @@ -52,12 +48,6 @@ with pkgs; let ]; }; - Media = { - YouTube = [ - yt # A command line YouTube client - ]; - }; - Hardware = { Storage = [ # TODO: smartmontools # Control and monitor S.M.A.R.T. enabled ATA and SCSI Hard Drives @@ -94,10 +84,6 @@ with pkgs; let Programming = { GeneralTools = [ - stamp # Add a license header to a file - git # the fast distributed version control system - git-edit-index # Allows you to edit the indexed version of a file - git-cm # A wrapper that re-adds the last commit's subject glow # Command-line markdown renderer ]; }; |
