diff options
Diffstat (limited to '')
33 files changed, 679 insertions, 560 deletions
diff --git a/modules/by-name/at/atuin/module.nix b/modules/by-name/at/atuin/module.nix index 6cf8a396..78a4332c 100644 --- a/modules/by-name/at/atuin/module.nix +++ b/modules/by-name/at/atuin/module.nix @@ -10,7 +10,6 @@ { config, lib, - pkgs, ... }: let cfg = config.soispha.programs.atuin; 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..6a0c0cf7 100644 --- a/modules/by-name/bo/boot/module.nix +++ b/modules/by-name/bo/boot/module.nix @@ -12,139 +12,148 @@ lib, pkgs, modules, + modulesPath, + system, + specialArgs, ... }: let cfg = config.soispha.boot; + + tailsPrefix = "EFI/tails"; 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"]; + }; - # This should only be necessary for `lanzaboote`, but that is the current default in - # this module. - soispha.impermanence.directories = [ - "/var/lib/sbctl" - ]; + kernelPackages = pkgs.linuxPackages_latest; - boot = { - initrd = { - kernelModules = ["nvme" "btrfs"]; + lanzaboote = { + enable = true; + pkiBundle = "/var/lib/sbctl"; + + 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}/${tailsPrefix}/vmlinuz-linux" + + ${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 Live ISO + linux /${tailsPrefix}/vmlinuz-linux + initrd /${tailsPrefix}/initramfs-linux.img + options root=/${tailsPrefix}/tails.iso + ''; }; - grub = { - enable = false; - # theme = pkgs.nixos-grub2-theme; - splashImage = ./boot_pictures/gnu.png; - efiSupport = true; - device = "nodev"; # only for efi + extraFiles = let + iso = import ./tails_iso.nix {inherit pkgs;}; + in { + "/${tailsPrefix}/tails.iso" = "${iso}/tails.iso"; + "/${tailsPrefix}/vmlinuz-linux" = "${iso}/live/vmlinuz-linux"; + "/${tailsPrefix}/initramfs-linux.img" = "${iso}/live/initramfs-linux.img"; }; + }; - efi = { - canTouchEfiVariables = true; - efiSysMountPoint = "/boot"; - }; + efi = { + canTouchEfiVariables = true; + efiSysMountPoint = "/boot"; }; }; - } - ); + }; + }; } diff --git a/modules/by-name/bo/boot/tails_iso.nix b/modules/by-name/bo/boot/tails_iso.nix new file mode 100644 index 00000000..ec2b740b --- /dev/null +++ b/modules/by-name/bo/boot/tails_iso.nix @@ -0,0 +1,78 @@ +# 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 + checked_iso = pkgs.stdenv.mkDerivation (finalAttrs: { + pname = "tails-iso"; + version = "amd64-7.8"; + + srcs = [ + (pkgs.fetchurl { + url = "https://tails.net/torrents/files/tails-${finalAttrs.version}.iso.sig"; + hash = "sha256-58vDQdXQYYqeVUHzupmDPtVVpSrxtT25+gwHe2OfvkA="; + }) + (pkgs.fetchurl { + url = "https://download.tails.net/tails/stable/tails-${finalAttrs.version}/tails-${finalAttrs.version}.iso"; + hash = "sha256-ewLHQ+3iI3aHgvKdBgysQ9QAudQ7AM83WP+VdYFmxt0="; + }) + (pkgs.fetchurl { + url = "https://tails.net/tails-signing.key"; + hash = "sha256-OwdqyM7o7K6F5Km0U1RU3hzsnaT+Yw0sjQk/thMeq1k="; + }) + ]; + + dontUnpack = true; + + nativeBuildInputs = [ + pkgs.sequoia-sq + ]; + + buildPhase = + /* + bash + */ + '' + for src in $srcs; do + cp --recursive "$src" "$(stripHash "$src")" + done + + sq verify \ + --signer-file=tails-signing.key \ + --signature-file=tails-${finalAttrs.version}.iso.sig \ + tails-${finalAttrs.version}.iso + ''; + + installPhase = '' + cp tails-${finalAttrs.version}.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/live/initrd.img "$out/live/initramfs-linux.img" + install -D ./iso/live/vmlinuz "$out/live/vmlinuz-linux" + + install -D "$src" "$out/tails.iso" + ''; + } 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..d818aac0 --- /dev/null +++ b/modules/by-name/fo/foot/module.nix @@ -0,0 +1,82 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later +# +# This file is part of my nixos-config. +# +# You should have received a copy of the License along with this program. +# If not, see <https://www.gnu.org/licenses/gpl-3.0.txt>. +{ + config, + lib, + libraries, + ... +}: let + cfg = config.soispha.foot; +in { + options.soispha.foot = { + enable = libraries.base.options.mkEnable "foot terminal"; + }; + + config = lib.mkIf cfg.enable { + home-manager.users.soispha = { + programs.foot = { + enable = true; + server.enable = true; + settings = { + main = { + font = "SauceCodePro Nerd Font Mono:size=12"; + horizontal-letter-offset = -1; + vertical-letter-offset = -1; + }; + # environment = { + # COLORTERM = "truecolor"; + # }; + "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" + ]; + }; + }; + }; + + systemd.user.services = let + footCfg = config.home-manager.users.soispha.programs.foot; + inherit (footCfg.server) systemdTarget; + in { + foot-initial-term = { + Unit = { + Description = "Fast, lightweight and minimalistic Wayland terminal emulator."; + Documentation = "man:foot(1)"; + PartOf = [systemdTarget]; + After = [systemdTarget]; + ConditionEnvironment = "WAYLAND_DISPLAY"; + }; + + Service = { + ExecStart = "${lib.getExe' footCfg.package "footclient"}"; + }; + + Install = { + WantedBy = [systemdTarget]; + }; + }; + }; + }; + }; +} 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 0c2f391a..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" } @@ -60,6 +60,9 @@ 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 diff --git a/modules/by-name/lf/lf/commands/default.nix b/modules/by-name/lf/lf/commands/default.nix index b6baf1df..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.openjdk + 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/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/prev/application/archive/default.nix b/modules/by-name/lf/lf/ctpv/prev/application/archive/default.nix index d64c9572..dc34d5de 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,8 @@ pkgs.xz pkgs.zip + pkgs.coreutils + # Unfree stuff # pkgs.lha # pkgs.rar 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 08a2f9d6..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,7 +14,7 @@ matches.mime = ["audio/*"]; dependencies = [ pkgs.ffmpegthumbnailer - pkgs.ffmpeg + pkgs.ffmpeg-headless pkgs.chafa pkgs.exiftool diff --git a/modules/by-name/lf/lf/keybindings/default.nix b/modules/by-name/lf/lf/keybindings/default.nix index fbc33f6f..5d8ad78f 100644 --- a/modules/by-name/lf/lf/keybindings/default.nix +++ b/modules/by-name/lf/lf/keybindings/default.nix @@ -82,22 +82,16 @@ 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}"; + Gu = "cd /run/user/${builtins.toString uid}"; + Ge = "cd /etc"; + Gd = "cd ${downloadDir}"; + Gt = "cd /tmp"; + Gh = "cd_project_root"; - gc = "cd ~/.config"; - gl = "cd ~/.local"; - gE = "cd /etc"; - gD = "cd ${downloadDir}"; - - "gU." = "cd /usr"; - gUs = " cd /usr/share"; - - 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..daa236e6 100644 --- a/modules/by-name/lf/lf/module.nix +++ b/modules/by-name/lf/lf/module.nix @@ -85,7 +85,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 +93,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/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/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/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/ri/river/keymap.nix b/modules/by-name/ri/river/keymap.nix index 9bcbf387..eacfd75b 100644 --- a/modules/by-name/ri/river/keymap.nix +++ b/modules/by-name/ri/river/keymap.nix @@ -37,6 +37,7 @@ }; 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: { @@ -46,7 +47,7 @@ in { "a" = mkSpawn pkgs.alacritty "" {}; "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/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"; + }; }; }; }; |
