diff options
Diffstat (limited to '')
333 files changed, 7003 insertions, 2674 deletions
diff --git a/modules/by-name/ad/adb/module.nix b/modules/by-name/ad/adb/module.nix index ec5d4be6..71bd3c9b 100644 --- a/modules/by-name/ad/adb/module.nix +++ b/modules/by-name/ad/adb/module.nix @@ -1,3 +1,12 @@ +# 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, diff --git a/modules/by-name/ag/age/module.nix b/modules/by-name/ag/age/module.nix new file mode 100644 index 00000000..9a498ab6 --- /dev/null +++ b/modules/by-name/ag/age/module.nix @@ -0,0 +1,25 @@ +{ + config, + lib, + modules, + pkgs, + ... +}: let + cfg = config.soispha.age; +in { + options.soispha.age = { + enable = lib.mkEnableOption "secret management with age"; + }; + + imports = [ + modules.agenix.nixosModules.default + ]; + + config = lib.mkIf cfg.enable { + age = { + # TODO(@bpeetz): Set once <https://github.com/ryantm/agenix/pull/317/files> is merged. <2025-05-16> + # enable = true; + ageBin = lib.getExe pkgs.rage; + }; + }; +} diff --git a/modules/by-name/at/atuin/atuin.zsh b/modules/by-name/at/atuin/atuin.zsh new file mode 100644 index 00000000..72dd7fa0 --- /dev/null +++ b/modules/by-name/at/atuin/atuin.zsh @@ -0,0 +1,137 @@ +#! /usr/bin/env zsh + +# 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 disable=SC2034,SC2153,SC2086,SC2155 + +# Above line is because shellcheck doesn't support zsh, per +# https://github.com/koalaman/shellcheck/wiki/SC1071, and the ignore: param in +# ludeeus/action-shellcheck only supports _directories_, not _files_. So +# instead, we manually add any error the shellcheck step finds in the file to +# the above line ... + +if ! [[ $options[zle] = on ]]; then + return 0 +fi + +# Source this in your ~/.zshrc +autoload -U add-zsh-hook + +zmodload zsh/datetime 2>/dev/null + +# If zsh-autosuggestions is installed, configure it to use Atuin's search. If +# you'd like to override this, then add your config after the $(atuin init zsh) +# in your .zshrc +_zsh_autosuggest_strategy_atuin() { + suggestion=$(ATUIN_QUERY="$1" atuin search --cmd-only --limit 1 --search-mode prefix) +} + +if [ -n "${ZSH_AUTOSUGGEST_STRATEGY:-}" ]; then + ZSH_AUTOSUGGEST_STRATEGY=("atuin" "${ZSH_AUTOSUGGEST_STRATEGY[@]}") +else + ZSH_AUTOSUGGEST_STRATEGY=("atuin") +fi + +export ATUIN_SESSION=$(atuin uuid) +ATUIN_HISTORY_ID="" + +_atuin_preexec() { + local id + id=$(atuin history start -- "$1") + export ATUIN_HISTORY_ID="$id" + __atuin_preexec_time=${EPOCHREALTIME-} +} + +_atuin_precmd() { + local EXIT="$?" __atuin_precmd_time=${EPOCHREALTIME-} + + [[ -z "${ATUIN_HISTORY_ID:-}" ]] && return + + local duration="" + if [[ -n $__atuin_preexec_time && -n $__atuin_precmd_time ]]; then + printf -v duration %.0f $(((__atuin_precmd_time - __atuin_preexec_time) * 1000000000)) + fi + + (ATUIN_LOG=error atuin history end --exit $EXIT ${duration:+--duration=$duration} -- $ATUIN_HISTORY_ID &) >/dev/null 2>&1 + export ATUIN_HISTORY_ID="" +} + +_atuin_search() { + emulate -L zsh + zle -I + + # swap stderr and stdout, so that the tui stuff works + # TODO: not this + local output + # shellcheck disable=SC2048 + output=$(ATUIN_SHELL_ZSH=t ATUIN_LOG=error ATUIN_QUERY=$BUFFER atuin search $* -i 3>&1 1>&2 2>&3) + + zle reset-prompt + + if [[ -n $output ]]; then + RBUFFER="" + LBUFFER=$output + + if [[ $LBUFFER == __atuin_accept__:* ]] + then + LBUFFER=${LBUFFER#__atuin_accept__:} + zle accept-line + fi + fi +} +_atuin_search_vicmd() { + _atuin_search --keymap-mode=vim-normal +} +_atuin_search_viins() { + _atuin_search --keymap-mode=vim-insert +} + +_atuin_up_search() { + # Only trigger if the buffer is a single line + if [[ ! $BUFFER == *$'\n'* ]]; then + _atuin_search --shell-up-key-binding "$@" + else + zle up-line + fi +} +_atuin_up_search_vicmd() { + _atuin_up_search --keymap-mode=vim-normal +} +_atuin_up_search_viins() { + _atuin_up_search --keymap-mode=vim-insert +} + +add-zsh-hook preexec _atuin_preexec +add-zsh-hook precmd _atuin_precmd + +zle -N atuin-search _atuin_search +zle -N atuin-search-vicmd _atuin_search_vicmd +zle -N atuin-search-viins _atuin_search_viins +zle -N atuin-up-search _atuin_up_search +zle -N atuin-up-search-vicmd _atuin_up_search_vicmd +zle -N atuin-up-search-viins _atuin_up_search_viins + +# These are compatibility widget names for "atuin <= 17.2.1" users. +zle -N _atuin_search_widget _atuin_search +zle -N _atuin_up_search_widget _atuin_up_search + +bindkey -M emacs '^r' atuin-search +bindkey -M viins '^r' atuin-search-viins +bindkey -M vicmd '/' atuin-search +bindkey -M emacs '^[[A' atuin-up-search +bindkey -M vicmd '^[[A' atuin-up-search-vicmd +bindkey -M viins '^[[A' atuin-up-search-viins +bindkey -M emacs '^[OA' atuin-up-search +bindkey -M vicmd '^[OA' atuin-up-search-vicmd +bindkey -M viins '^[OA' atuin-up-search-viins +bindkey -M vicmd 'k' atuin-up-search-vicmd + +# vim: ft=zsh diff --git a/modules/by-name/at/atuin/module.nix b/modules/by-name/at/atuin/module.nix index 604ee4ef..700f50fb 100644 --- a/modules/by-name/at/atuin/module.nix +++ b/modules/by-name/at/atuin/module.nix @@ -1,3 +1,12 @@ +# 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, @@ -8,28 +17,40 @@ in { options.soispha.programs.atuin = { enable = lib.mkEnableOption "atuin"; + + enableAge = lib.mkEnableOption "atuin with age keys"; }; config = lib.mkIf cfg.enable { - age.secrets.atuin_encryption_key = { + age.secrets.atuin_encryption_key = lib.mkIf cfg.enableAge { file = ./secrets/encryption_key.age; mode = "700"; owner = "soispha"; group = "users"; }; + soispha.programs.zsh.integrations.atuin = ./atuin.zsh; + home-manager.users.soispha = { programs.atuin = { enable = true; package = pkgs.atuin-dvorak; - enableZshIntegration = config.soispha.programs.zsh.enable; + + # We can do this on our own. + enableZshIntegration = false; settings = { - key_path = "${config.age.secrets.atuin_encryption_key.path}"; + 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") + ]; - # TODO: Setup a self-hosted sync server. <2024-10-18> - session_path = ""; - auto_sync = false; - sync_address = ""; + sync = lib.mkIf cfg.enableAge { + # The v2 sync API + records = true; + }; + auto_sync = lib.mkIf cfg.enableAge true; + sync_address = lib.mkIf cfg.enableAge "https://atuin-sync.vhack.eu"; # Use the rather reasonable syntax of `skim` to search. search_mode = "skim"; diff --git a/modules/by-name/at/atuin/secrets/encryption_key.age.license b/modules/by-name/at/atuin/secrets/encryption_key.age.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/modules/by-name/at/atuin/secrets/encryption_key.age.license @@ -0,0 +1,9 @@ +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/by-name/ba/backup/module.nix b/modules/by-name/ba/backup/module.nix index 92700bf2..d0805092 100644 --- a/modules/by-name/ba/backup/module.nix +++ b/modules/by-name/ba/backup/module.nix @@ -1,51 +1,207 @@ +# 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, - pkgs, config, + pkgs, ... }: let - backup-script = pkgs.writeShellScriptBin "backsnap" '' - set -xeu; - - ${pkgs.util-linux}/bin/mount --mkdir "/dev/disk/by-uuid/${cfg.backupDiskUuid}" "/run/media/${cfg.backupDiskUuid}"; - ${pkgs.snap-sync-forked}/bin/snap-sync-forked --UUID "${cfg.backupDiskUuid}" --noconfirm; - ${pkgs.util-linux}/bin/umount "/run/media/${cfg.backupDiskUuid}"; - ''; - cfg = config.soispha.services.backup; + + snapshotDir = "/srv/last_snapshot"; in { options.soispha.services.backup = { - enable = lib.mkEnableOption "backups with my forked snap-sync"; - backupDiskUuid = lib.mkOption { - type = lib.types.str; - example = lib.literalExpression "d1d20ae7-3d8a-44da-86da-677dbbb10c89"; - description = "The UUID of the backup disk"; + storagebox = { + enable = lib.mkEnableOption "remote backups"; + user = lib.mkOption { + type = lib.types.str; + description = "The storagebox-user to use"; + example = "u384702-sub2"; + }; + + sshKey = lib.mkOption { + type = lib.types.path; + description = "The age-encrypted ssh-key, passed to agenix"; + default = ./secrets/storagebox/ssh_key.age; + }; + + repositoryPassword = lib.mkOption { + type = lib.types.path; + description = "The age-encrypted restic password, passed to agenix"; + default = ./secrets/storagebox/repository_password.age; + }; + }; + + local = { + enable = lib.mkEnableOption "local backups"; + + repositoryPassword = lib.mkOption { + type = lib.types.path; + description = "The age-encrypted restic password, passed to agenix"; + default = ./secrets/local/repository_password.age; + }; + + backupMountPoint = lib.mkOption { + type = lib.types.path; + description = "The path where to expect the mounted backup disk"; + default = "/mnt/backup"; + }; }; }; - config = lib.mkIf cfg.enable { - systemd = { - services.backup = { - wantedBy = lib.mkForce []; - unitConfig = { - Description = "Backup the last snapshots of the persitent-storage subvolume."; - }; + config = { + age.secrets = { + resticStorageboxSshKey = lib.mkIf cfg.storagebox.enable { + file = cfg.storagebox.sshKey; + mode = "0700"; + owner = "root"; + group = "root"; + }; + resticStorageboxRepositoryPassword = lib.mkIf cfg.storagebox.enable { + file = cfg.storagebox.repositoryPassword; + mode = "0700"; + owner = "root"; + group = "root"; + }; + resticLocalRepositoryPassword = lib.mkIf cfg.local.enable { + file = cfg.local.repositoryPassword; + mode = "0700"; + owner = "root"; + group = "root"; + }; + }; + + soispha.programs.ssh = lib.mkIf cfg.storagebox.enable { + enable = true; + rootKnownHosts = { + "[u459143-sub1.your-storagebox.de]:23" = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIICf9svRenC/PLKIL9nk6K/pxQgoiFC41wTNvoIncOxs"; + }; + }; + + systemd.services = { + prepare-backup = { + requires = []; + after = []; + + description = "Prepare a backup by snapshotting the system."; + serviceConfig = { + ExecStart = lib.getExe (pkgs.writeShellApplication { + name = "prepareBackup"; + text = '' + set -x + + [ -d "${snapshotDir}" ] && btrfs subvolume delete "${snapshotDir}" + + # -r := Make the snapshot read-only + btrfs subvolume snapshot -r /srv "${snapshotDir}"; + ''; + + inheritPath = false; + runtimeInputs = [ + pkgs.btrfs-progs + ]; + }); + Type = "oneshot"; - ExecStart = "${backup-script}/bin/backsnap"; + + User = "root"; + Group = "root"; + + # TODO: Hardening <2025-05-04> }; }; - timers.backup = { - wantedBy = ["timers.target"]; - unitConfig = { - Description = "Backup 15min after boot and every 8 hours"; + restic-backups-storagebox = lib.mkIf cfg.storagebox.enable { + requires = ["prepare-backup.service"]; + after = ["prepare-backup.service"]; + }; + + restic-backups-local = lib.mkIf cfg.local.enable { + requires = ["prepare-backup.service"]; + after = ["prepare-backup.service"]; + + serviceConfig = { + ConditionPathIsDirectory = "${cfg.local.backupMountPoint}"; }; + }; + }; + + services.restic.backups = let + homeDir = "${snapshotDir}/home"; + + paths = [ + snapshotDir + ]; + exclude = [ + "${homeDir}/soispha/.cache" + ]; + extraBackupArgs = [ + "--verbose=2" + ]; + in { + local = lib.mkIf cfg.local.enable { + inhibitsSleep = true; + initialize = true; + + inherit paths exclude extraBackupArgs; + + passwordFile = config.age.secrets.resticLocalRepositoryPassword.path; + + repository = "${cfg.local.backupMountPoint}/restic-backup-data/"; + + # Start on demand. + timerConfig = null; + }; + + storagebox = lib.mkIf cfg.storagebox.enable { + inhibitsSleep = true; + initialize = true; + + inherit paths exclude extraBackupArgs; + + passwordFile = config.age.secrets.resticStorageboxRepositoryPassword.path; + extraOptions = [ + "rclone.program='ssh -p 23 ${cfg.storagebox.user}@${cfg.storagebox.user}.your-storagebox.de -i ${config.age.secrets.resticStorageboxSshKey.path} command_forced_on_remote'" + ]; + + # 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. + repository = "rclone: "; + timerConfig = { - OnBootSec = "15min"; - OnUnitActiveSec = "8h"; + Requires = "network-online.target"; + OnActiveSec = "30m"; + OnUnitInactiveSec = "2h"; + Persistent = true; }; }; + + # This is only for listing, pruning and such stuff. + storagebox-admin = lib.mkIf cfg.storagebox.enable { + inhibitsSleep = false; + initialize = false; + + passwordFile = config.age.secrets.resticStorageboxRepositoryPassword.path; + extraOptions = [ + "rclone.program='ssh -p 23 ${cfg.storagebox.user}@${cfg.storagebox.user}.your-storagebox.de command_forced_on_remote'" + ]; + + # 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. + repository = "rclone: "; + + timerConfig = null; + }; }; }; } diff --git a/modules/by-name/ba/backup/secrets/local/repository_password.age b/modules/by-name/ba/backup/secrets/local/repository_password.age new file mode 100644 index 00000000..b1508e49 --- /dev/null +++ b/modules/by-name/ba/backup/secrets/local/repository_password.age @@ -0,0 +1,20 @@ +-----BEGIN AGE ENCRYPTED FILE----- +YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBqVCtBZzNBWFlxQnhlb3c2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ceXUvrlL6iCID30zU= +-----END AGE ENCRYPTED FILE----- diff --git a/modules/by-name/ba/backup/secrets/storagebox/repository_password.age b/modules/by-name/ba/backup/secrets/storagebox/repository_password.age new file mode 100644 index 00000000..a2aa984a --- /dev/null +++ b/modules/by-name/ba/backup/secrets/storagebox/repository_password.age @@ -0,0 +1,14 @@ +-----BEGIN AGE ENCRYPTED FILE----- +YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBzbnJ5Z3NXRFRtdEdCNk1z +NG9Cb2FUTEZ2U2hTdUptWGpneHd2RGxGQlY0ClhqcHlMSUZlLzBPZko4a2hKdnE1 +Q1hnc3ErWlJiSk1HVXFLcSswQlV0WTAKLT4gc3NoLWVkMjU1MTkgelpFb25nIG5I +cFpMY21ZdU9TUHY5VksraG1xeFByQlM1WE1INEk0SWFJQzIvSXhZbXMKSWxiNlIr +NjZ6bEgySUJGdnpoZTY2MmxxajJMaUVTM3RkTmhpdkxaRnNCQQotPiBzc2gtZWQy +NTUxOSA3SGZGVXcgRGtLMHFORm9mUDUwZnBXM0djcFlxTExJbWVDeDJmbVVSRi9l +QTFmekpROApZY3Z0Zlc1SUdCcllKQ01ZNmdFQkI3UnViVGxzNTJNUkhqc2hOejY3 +MndrCi0+IG1Hbi1ncmVhc2UgUDJJdgpGUmVHa1NPWGtzUmZmMXM3eWkxVnJkek1h +MUxZeS9qMlArendXZ1ltdFgvMTBabTlPM2hzSjhuVXBQNktHKzc1ClF6bjZob09B +Ci0tLSB3dEZpbnpVR0pPdGpFVmNyM0JzUGl6eGcreXpkTG9xQUc5S09ndUthaEpR +CuHgXCIq/AUCuIQWepBRapAab6zczOwxEBpDv5R2kw2mw34UVRLuFs7hB1cHE79y +7Fc= +-----END AGE ENCRYPTED FILE----- diff --git a/modules/by-name/ba/backup/secrets/storagebox/ssh_key.age b/modules/by-name/ba/backup/secrets/storagebox/ssh_key.age new file mode 100644 index 00000000..a7f30c7c --- /dev/null +++ b/modules/by-name/ba/backup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PCNlzKT4vDF9BZeyCfoEj9dTXvxrNPEB6YYi16aQ8DhI8wxADl41 +ShrULlEmB8rfz7V+8TFmERKISBRSSH0p+XJi8e2DWh2dSco16rizmbFFNDdcYiGT +WWbXYCFNzj+kNFI/vEtt9dEWmfXlgg01khnyoOuRLedtoCDSuF+8z7YYy6oYt/2h +gmf4NHOUgyxK56c17JMQ3xT97d2odgqmwB+YZQ13IJCjt3M3pmSssD4sTgmA5alH +vtUlci6dZdO801h5vOesbAJplXCEyw== +-----END AGE ENCRYPTED FILE----- diff --git a/modules/by-name/bl/bluetooth/module.nix b/modules/by-name/bl/bluetooth/module.nix index 486f6e6f..7750e70d 100644 --- a/modules/by-name/bl/bluetooth/module.nix +++ b/modules/by-name/bl/bluetooth/module.nix @@ -1,3 +1,12 @@ +# 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, diff --git a/modules/by-name/bo/boot/boot_pictures/gnu.png.license b/modules/by-name/bo/boot/boot_pictures/gnu.png.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/modules/by-name/bo/boot/boot_pictures/gnu.png.license @@ -0,0 +1,9 @@ +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/by-name/bo/boot/boot_pictures/gnulin_emb_1.png.license b/modules/by-name/bo/boot/boot_pictures/gnulin_emb_1.png.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/modules/by-name/bo/boot/boot_pictures/gnulin_emb_1.png.license @@ -0,0 +1,9 @@ +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/by-name/bo/boot/boot_pictures/gnulin_emb_2.png.license b/modules/by-name/bo/boot/boot_pictures/gnulin_emb_2.png.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/modules/by-name/bo/boot/boot_pictures/gnulin_emb_2.png.license @@ -0,0 +1,9 @@ +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/by-name/bo/boot/iso_entry/archlive_iso.nix b/modules/by-name/bo/boot/iso_entry/archlive_iso.nix index d19a4a87..d0ae8457 100644 --- a/modules/by-name/bo/boot/iso_entry/archlive_iso.nix +++ b/modules/by-name/bo/boot/iso_entry/archlive_iso.nix @@ -1,3 +1,12 @@ +# 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;}; diff --git a/modules/by-name/bo/boot/iso_entry/signing_key.nix b/modules/by-name/bo/boot/iso_entry/signing_key.nix index 788447be..d9268d75 100644 --- a/modules/by-name/bo/boot/iso_entry/signing_key.nix +++ b/modules/by-name/bo/boot/iso_entry/signing_key.nix @@ -1,3 +1,12 @@ +# 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"; diff --git a/modules/by-name/bo/boot/module.nix b/modules/by-name/bo/boot/module.nix index 8b71ce65..404352ac 100644 --- a/modules/by-name/bo/boot/module.nix +++ b/modules/by-name/bo/boot/module.nix @@ -1,7 +1,17 @@ +# 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, + modules, ... }: let cfg = config.soispha.boot; @@ -12,6 +22,10 @@ in { # 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; diff --git a/modules/by-name/ca/cargo/module.nix b/modules/by-name/ca/cargo/module.nix new file mode 100644 index 00000000..980ebcba --- /dev/null +++ b/modules/by-name/ca/cargo/module.nix @@ -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>. +{ + config, + lib, + ... +}: let + cfg = config.soispha.programs.cargo; +in { + options.soispha.programs.cargo = { + enable = lib.mkEnableOption "cargo"; + }; + config = lib.mkIf cfg.enable { + home-manager.users.soispha = { + home.sessionVariables = { + CARGO_HOME = "${config.home-manager.users.soispha.xdg.dataHome}/cargo"; + }; + }; + }; +} diff --git a/modules/by-name/cl/cleanup/module.nix b/modules/by-name/cl/cleanup/module.nix index f8307b73..98c699eb 100644 --- a/modules/by-name/cl/cleanup/module.nix +++ b/modules/by-name/cl/cleanup/module.nix @@ -1,3 +1,12 @@ +# 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, diff --git a/modules/by-name/dc/dconf/module.nix b/modules/by-name/dc/dconf/module.nix index e4a1c7a9..ec055a6f 100644 --- a/modules/by-name/dc/dconf/module.nix +++ b/modules/by-name/dc/dconf/module.nix @@ -1,3 +1,12 @@ +# 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>. {...}: { # needed to make home-manager play nice with some apps. See: # https://nix-community.github.io/home-manager/index.xhtml#_why_do_i_get_an_error_message_about_literal_ca_desrt_dconf_literal_or_literal_dconf_service_literal diff --git a/modules/by-name/di/direnv/module.nix b/modules/by-name/di/direnv/module.nix new file mode 100644 index 00000000..7c81e671 --- /dev/null +++ b/modules/by-name/di/direnv/module.nix @@ -0,0 +1,30 @@ +# 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, + ... +}: let + cfg = config.soispha.programs.direnv; +in { + options.soispha.programs.direnv = { + enable = lib.mkEnableOption "direnv"; + }; + + config.home-manager.users.soispha.programs.direnv = lib.mkIf cfg.enable { + enable = true; + nix-direnv.enable = true; + config = { + warn_timeout = 0; + # strict_env = true; + # disable_stdin = true; + }; + }; +} diff --git a/modules/by-name/di/disks/fstrim.nix b/modules/by-name/di/disks/fstrim.nix index 6daeb65e..0fbb6c83 100644 --- a/modules/by-name/di/disks/fstrim.nix +++ b/modules/by-name/di/disks/fstrim.nix @@ -1,3 +1,12 @@ +# 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, lib, diff --git a/modules/by-name/di/disks/hibernate.nix b/modules/by-name/di/disks/hibernate.nix index a50e5b57..e983f9c7 100644 --- a/modules/by-name/di/disks/hibernate.nix +++ b/modules/by-name/di/disks/hibernate.nix @@ -1,3 +1,12 @@ +# 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}: { services = { hibernate-preparation = { diff --git a/modules/by-name/di/disks/module.nix b/modules/by-name/di/disks/module.nix index c0e5bcfd..d88fa3df 100644 --- a/modules/by-name/di/disks/module.nix +++ b/modules/by-name/di/disks/module.nix @@ -1,7 +1,17 @@ +# 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, + modules, ... }: let # FIXME: The iso redeploy requires a bigger efi partition <2024-05-12> @@ -37,6 +47,10 @@ in { }; }; + imports = [ + modules.disko.nixosModules.default + ]; + config = lib.mkIf cfg.enable { systemd = lib.recursiveUpdate (import ./hibernate.nix {inherit pkgs;}) (import ./fstrim.nix {inherit pkgs lib cfg;}); diff --git a/modules/by-name/do/documentation/module.nix b/modules/by-name/do/documentation/module.nix index 4616a991..e4e51409 100644 --- a/modules/by-name/do/documentation/module.nix +++ b/modules/by-name/do/documentation/module.nix @@ -1,3 +1,12 @@ +# 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, diff --git a/modules/home.legacy/conf/firefox/config/extensions/extensions.json b/modules/by-name/fi/firefox/extensions.json index 0c59b2f7..cc098acd 100644 --- a/modules/home.legacy/conf/firefox/config/extensions/extensions.json +++ b/modules/by-name/fi/firefox/extensions.json @@ -3,25 +3,25 @@ "addonId": "addon@darkreader.org", "default_area": "navbar", "pname": "darkreader", - "sha256": "sha256:02c67ce2b3cd96719b5e369b9207ef11ed6c3a79eccb454d1e6ec3e005004e72", - "url": "https://addons.mozilla.org/firefox/downloads/file/4405074/darkreader-4.9.99.xpi", - "version": "4.9.99" + "sha256": "sha256:23c94085063aa6b57fae40ca9111ab049fffca5476c29e9990db3aa1a3fe1f10", + "url": "https://addons.mozilla.org/firefox/downloads/file/4488139/darkreader-4.9.106.xpi", + "version": "4.9.106" }, "keepassxc-browser": { "addonId": "keepassxc-browser@keepassxc.org", "default_area": "navbar", "pname": "keepassxc-browser", - "sha256": "sha256:248f90ba6bffc82ef43b97c9e501b0889f70519703f27434e2d920b47f6ead45", - "url": "https://addons.mozilla.org/firefox/downloads/file/4395146/keepassxc_browser-1.9.5.xpi", - "version": "1.9.5" + "sha256": "sha256:7629ee8fe6a8bace5d0f12c3aef41803c2ab01407a22ad8803633992a6c4eda2", + "url": "https://addons.mozilla.org/firefox/downloads/file/4477789/keepassxc_browser-1.9.8.xpi", + "version": "1.9.8" }, "torproject-snowflake": { "addonId": "{b11bea1f-a888-4332-8d8a-cec2be7d24b9}", "default_area": "navbar", "pname": "torproject-snowflake", - "sha256": "sha256:4028bad3bef6610a985edda954d5c4f1487480a8f32f230d9edf88d97c8dd88e", - "url": "https://addons.mozilla.org/firefox/downloads/file/4379590/torproject_snowflake-0.9.2.xpi", - "version": "0.9.2" + "sha256": "sha256:615c0d570f41e721a91fc4f334377a61732171b65eb1a4429d78681e85bc8878", + "url": "https://addons.mozilla.org/firefox/downloads/file/4458115/torproject_snowflake-0.9.3.xpi", + "version": "0.9.3" }, "tridactyl-vim": { "addonId": "tridactyl.vim@cmcaine.co.uk", @@ -35,16 +35,16 @@ "addonId": "uBlock0@raymondhill.net", "default_area": "menupanel", "pname": "ublock-origin", - "sha256": "sha256:ee3a724a46ff32c17d1723077fecc6ede7fdab742154020b51fb6253ddcbba14", - "url": "https://addons.mozilla.org/firefox/downloads/file/4391011/ublock_origin-1.61.2.xpi", - "version": "1.61.2" + "sha256": "sha256:b9e1c868bd1ac1defcabf2e01776d1a90effba34b07fe6a21350d45f022e0e9f", + "url": "https://addons.mozilla.org/firefox/downloads/file/4492375/ublock_origin-1.64.0.xpi", + "version": "1.64.0" }, "vhack-libredirect": { "addonId": "vhack-libredirect@addons.vhack.eu", "default_area": "navbar", "pname": "vhack-libredirect", - "sha256": "sha256:2cb6befac6f414e0dd79a11db8905a0d988b98633b74afbe52ffe8006da841f5", - "url": "https://addons.mozilla.org/firefox/downloads/file/4351448/vhack_libredirect-2.9.1.xpi", - "version": "2.9.1" + "sha256": "sha256:08ccfd4b32ba15b357252208da7f383099ed5aefb9e92ffb5b9ae33f9146caf6", + "url": "https://addons.mozilla.org/firefox/downloads/file/4427811/vhack_libredirect-3.0.2.xpi", + "version": "3.0.2" } } diff --git a/modules/by-name/fi/firefox/extensions.json.license b/modules/by-name/fi/firefox/extensions.json.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/modules/by-name/fi/firefox/extensions.json.license @@ -0,0 +1,9 @@ +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/by-name/fi/firefox/module.nix b/modules/by-name/fi/firefox/module.nix new file mode 100644 index 00000000..b5c1ff9a --- /dev/null +++ b/modules/by-name/fi/firefox/module.nix @@ -0,0 +1,248 @@ +# 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, + pkgs, + modules, + ... +}: let + cfg = config.soispha.programs.firefox; + + mkAllowedExtension = extension: + lib.attrsets.nameValuePair extension.addonId { + installation_mode = "normal_installed"; + updates_disabled = true; + inherit (extension) default_area; + install_url = "file://${builtins.fetchurl { + inherit + (extension) + url + sha256 + ; + }}"; + }; + + allowedExtensions = + builtins.listToAttrs + (builtins.map mkAllowedExtension (builtins.attrValues + cfg.extensions)); + + mkBlockedExtension = id: + lib.attrsets.nameValuePair id { + install_mode = "blocked"; + }; + blockedExtensions = builtins.listToAttrs (builtins.map mkBlockedExtension [ + # these are the default search engines + "addons-search-detection@mozilla.com" + "amazon@search.mozilla.org" + "bing@search.mozilla.org" + "ddg@search.mozilla.org" + "google@search.mozilla.org" + "wikipedia@search.mozilla.org" + ]); + + mkProfile = import ./profile.nix {inherit config pkgs;}; +in { + options.soispha.programs.firefox = { + enable = lib.mkEnableOption "firefox"; + + profiles = lib.mkOption { + type = lib.types.attrsOf (lib.types.submodule { + options = { + id = lib.mkOption { + type = lib.types.int; + description = "The id of this profile."; + }; + name = lib.mkOption { + type = lib.types.str; + description = "The name of this profile"; + }; + }; + }); + description = "A list of profies to create besides the default `default` profile."; + default = {}; + apply = value: + lib.attrsets.mapAttrs' (name: value: lib.attrsets.nameValuePair name (mkProfile value)) + value; + }; + + extensions = lib.mkOption { + type = lib.types.attrsOf ( + lib.types.submodule { + options = { + addonId = lib.mkOption { + type = lib.types.str; + example = "addon@darkreader.org"; + description = "The addon id of this extension"; + }; + default_area = lib.mkOption { + type = lib.types.enum ["navbar" "menupanel"]; + example = "navbar"; + description = '' + Where to put this extension by default. + `navbar` means into the top-left bar as icon. + `menupanel` means hidden behind a “all extensions” button. + ''; + }; + pname = lib.mkOption { + type = lib.types.str; + example = "darkreader"; + description = "The package name of this extension"; + }; + sha256 = lib.mkOption { + type = lib.types.str; + example = "sha256:f565b2263a71626a0310380915b7aef90be8cc6fe16ea43ac1a0846efedc2e4c"; + description = "The fetchurl copatible hash of this extension"; + }; + url = lib.mkOption { + type = lib.types.str; + example = "https://addons.mozilla.org/firefox/downloads/file/4439735/darkreader-4.9.103.xpi"; + description = "The download url of this extension."; + }; + version = lib.mkOption { + type = lib.types.str; + example = "4.9.103"; + description = "The version of this extension"; + }; + }; + } + ); + + default = builtins.fromJSON (builtins.readFile ./extensions.json); + + description = '' + A list of the extensions that should be installed. + You can use a tool like `generate_extensions` to generate this config. + ''; + }; + }; + + config = lib.mkIf cfg.enable { + programs.firefox = { + enable = true; + preferencesStatus = "locked"; + + languagePacks = ["en-CA" "de" "sv-SE"]; + + nativeMessagingHosts.packages = [ + pkgs.tridactyl-native + pkgs.keepassxc + ]; + + # NOTE: See https://mozilla.github.io/policy-templates for documentation <2023-10-21> + policies = { + # NixOS manages this already + DisableAppUpdate = true; + + DisableFirefoxAccounts = true; + DisableFirefoxScreenshots = true; + + # KeepassXC does this for me + DisableMasterPasswordCreation = true; + + # I use a self-hosted services for that + DisablePocket = true; + + # I don't want to lose my data + DisableProfileRefresh = true; + + DisableDeveloperTools = false; + + DisplayBookmarksToolbar = "newtab"; + DisplayMenuBar = "default-off"; + + DNSOverHTTPS = { + Enabled = true; + Locked = false; + }; + # The concept of a "default browser" does not apply to my NixOS config + DontCheckDefaultBrowser = true; + + ExtensionSettings = + { + "*" = { + # Blocking the extension install here, also blocks the 'about:debugging' page + + # blocked_install_message = '' + # You can't install a extension manually, + # please specify it in your NixOS configuration + # ''; + installation_mode = "allowed"; + }; + } + // allowedExtensions + // blockedExtensions; + RequestedLocales = config.programs.firefox.languagePacks; + + ExtensionUpdate = false; + + HardwareAcceleration = true; + + # KeepassXC and such things + OfferToSaveLogins = false; + PasswordManagerEnabled = false; + + PDFjs = { + Enabled = true; + # Don't honor documents right to be un-copy-able + EnablePermissions = false; + }; + + SearchBar = "unified"; + }; + + # Beware, that we already set them per-profile in the home-manager config. + preferences = {}; + }; + + home-manager.users.soispha = { + imports = [ + modules.arkenfox-nixos.hmModules.arkenfox + ]; + + home.sessionVariables = { + # Improve touch input and make scrolling smother + MOZ_USE_XINPUT2 = "1"; + + # Tell Firefox to use Wayland + MOZ_ENABLE_WAYLAND = 1; + + # Tell GTK to use portals + GTK_USE_PORTAL = 1; + + BROWSER = "firefox"; + }; + + programs.firefox = { + enable = true; + arkenfox = { + enable = true; + version = "133.0"; + }; + + # We use the NixOS module to provide us a package. + # HACK: Extract the package from the system-path to get a version for + # arkenfox-nixos to compare to. <2025-04-02> + package = lib.lists.findSingle (x: builtins.hasAttr "pname" x && x.pname == "firefox") "none" "multiple" config.environment.systemPackages; + + profiles = + { + default = mkProfile { + isDefault = true; + id = 0; + name = "default"; + }; + } + // cfg.profiles; + }; + }; + }; +} diff --git a/modules/by-name/fi/firefox/profile.nix b/modules/by-name/fi/firefox/profile.nix new file mode 100644 index 00000000..d82bfafa --- /dev/null +++ b/modules/by-name/fi/firefox/profile.nix @@ -0,0 +1,189 @@ +# 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, +}: preConfig: ({ + userChrome = ./userChrome.css; + + bookmarks = { + force = true; + settings = []; + }; + + search = { + default = "brave-search"; + privateDefault = "brave-search"; + force = true; + engines = import ./search_engines {inherit pkgs;}; + + order = [ + # DEFAULT + "brave-search" + + # NIX + "nix-packages" + "nix-options" + "nixpkgs-issues" + "homemanager-options" + "nixos-wiki" + "nixpkgs-pull-request-tracker" + + # RUST + "rust-std" + "rust-tokio" + + # OTHER + "google-scholar" + "wikipedia" + "arch-wiki" + ]; + }; + + settings = { + "browser.download.dir" = "${config.home-manager.users.soispha.xdg.userDirs.download}"; + # "browser.download.useDownloadDir" = true; + # "browser.download.folderList" = 2; + + # QoL + "general.autoScroll" = false; + "browser.tabs.insertAfterCurrent" = true; + "browser.tabs.loadInBackground" = true; + "browser.ctrlTab.recentlyUsedOrder" = false; + "browser.search.widget.inNavBar" = true; + "findbar.highlightAll" = true; + + "devtools.toolbox.host" = "right"; + "devtools.toolsidebar-width.inspector" = 700; + + # Keep translations useful + "browser.translations.automaticallyPopup" = true; + "browser.translations.neverTranslateLanguages" = "de"; + + # Improve Tab UI + "browser.tabs.inTitlebar" = 1; + "browser.toolbars.bookmarks.visibility" = "never"; + "browser.places.importBookmarksHTML" = true; + + # Theme + "extensions.activeThemeID" = "firefox-alpenglow@mozilla.org"; + "extensions.extensions.activeThemeID" = "firefox-alpenglow@mozilla.org"; + + # disable updates (pretty pointless with nix) + "extensions.update.autoUpdateDefault" = false; + "extensions.update.enabled" = false; + "app.update.channel" = "default"; + "browser.shell.checkDefaultBrowser" = false; + + # Allow my custom css + "toolkit.legacyUserProfileCustomizations.stylesheets" = true; + }; + + arkenfox = { + enable = true; + "0000".enable = true; + "0100" = { + enable = true; + "0102"."browser.startup.page".value = 3; + "0103"."browser.startup.homepage".value = "file:///home/dt/home.html"; + "0104"."browser.newtabpage.enabled".value = true; + }; + "0200" = { + enable = true; + }; + "0300" = { + enable = true; + }; + "0400" = { + enable = false; + }; + "0600" = { + enable = true; + }; + "0700" = { + enable = true; + "0710"."network.trr.mode" = { + enable = true; + value = 3; + }; + }; + "0800" = { + enable = true; + }; + "0900" = { + enable = true; + }; + "1000" = { + enable = true; + "1001"."browser.cache.disk.enable".value = true; + "1003"."browser.sessionstore.privacy_level".value = 0; + }; + "1200" = { + enable = true; + "1241"."security.mixed_content.block_display_content".enable = true; + }; + "1600" = { + enable = true; + }; + "1700" = { + enable = true; + }; + "2000" = { + enable = true; + }; + "2400" = { + enable = true; + }; + "2600" = { + enable = true; + "2603" = { + "browser.download.start_downloads_in_tmp_dir".value = false; + "browser.helperApps.deleteTempFileOnExit".value = false; + }; + "2615"."permissions.default.shortcuts" = { + value = 2; + enable = true; + }; + }; + "2700" = { + enable = true; + }; + "2800" = { + enable = false; + "2810"."privacy.sanitize.sanitizeOnShutdown".value = false; + }; + "4000" = { + enable = true; + }; + "4500" = { + enable = true; + }; + "5000" = { + enable = true; + "5003"."signon.rememberSignons" = { + enable = true; + value = false; + }; + }; + "6000" = { + enable = true; + }; + "7000" = { + enable = true; + }; + "8000" = { + enable = true; + }; + "9000" = { + enable = true; + }; + }; + } + // preConfig) diff --git a/modules/home.legacy/conf/firefox/config/search/engines/default.nix b/modules/by-name/fi/firefox/search_engines/default.nix index a47c77df..f36be0a7 100644 --- a/modules/home.legacy/conf/firefox/config/search/engines/default.nix +++ b/modules/by-name/fi/firefox/search_engines/default.nix @@ -1,84 +1,113 @@ +# 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, ...}: { # DEFAULT - "Brave Search" = { + brave-search = { + name = "Brave Search"; urls = [{template = "https://search.brave.com/search?q={searchTerms}";}]; icon = ./logos/brave.svg; definedAliases = ["@bs"]; }; # NIX - "Nix Packages" = { + nix-packages = { + name = "Nix packages"; urls = [{template = "https://search.nixos.org/packages?type=packages&query={searchTerms}";}]; icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; definedAliases = ["@np"]; }; - "NixOS Options" = { + nix-functions = { + name = "Nix functions"; + urls = [{template = "https://noogle.dev/q?term={searchTerms}";}]; + icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; + definedAliases = ["@ng"]; + }; + + nixos-options = { + name = "NixOS options"; urls = [{template = "https://search.nixos.org/options?type=options&query={searchTerms}";}]; icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; definedAliases = ["@no"]; }; - "HomeManager Options" = { + homemanager-options = { + name = "Home-Manager options"; urls = [{template = "https://home-manager-options.extranix.com/?query={searchTerms}&release=master";}]; icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; definedAliases = ["@nh"]; }; - "Nixpkgs issues" = { + nixpkgs-issues = { + name = "Nixpkgs issues"; urls = [{template = "https://github.com/NixOS/nixpkgs/issues?q=is%3Aissue+is%3Aopen+{searchTerms}";}]; icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; definedAliases = ["@ni"]; }; - "Nixpkgs pull requests" = { + nixpkgs-pull-requests = { + name = "Nixpkgs pull requests"; urls = [{template = "https://github.com/NixOS/nixpkgs/pulls?q=is%3Apr+is%3Aopen+{searchTerms}";}]; icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; definedAliases = ["@nr"]; }; - "Nixpkgs pull requests tracker" = { + nixpkgs-pull-requests-tracker = { + name = "Nixpkgs pull requests tracker"; urls = [{template = "https://nixpk.gs/pr-tracker.html?pr={searchTerms}";}]; icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; definedAliases = ["@nt"]; }; - "NixOS Wiki" = { + nixos-wiki = { + name = "NixOS Wiki"; urls = [{template = "https://wiki.nixos.org/w/index.php?search={searchTerms}";}]; icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg"; definedAliases = ["@nw"]; }; # RUST - "Rust std" = { + rust-std = { + name = "Rust std"; urls = [{template = "https://doc.rust-lang.org/std/?search={searchTerms}";}]; icon = ./logos/rust_std.svg; definedAliases = ["@rs"]; }; - "Rust tokio" = { + rust-tokio = { + name = "Rust tokio"; urls = [{template = "https://docs.rs/tokio/latest/tokio/index.html?search={searchTerms}";}]; icon = ./logos/rust_tokio.png; definedAliases = ["@rt"]; }; # OTHER - "Google Scholar" = { + google-scholar = { + name = "Google Scholar"; urls = [{template = "https://scholar.google.com/scholar?hl=en&q={searchTerms}";}]; icon = ./logos/google_scholar.ico; definedAliases = ["@gs"]; }; - "Wikipedia" = { + wikipedia = { + name = "Wikipedia"; urls = [{template = "https://en.wikipedia.org/wiki/{searchTerms}";}]; icon = ./logos/wikipedia.svg; definedAliases = ["@wp"]; }; - "Arch Wiki" = { + arch-wiki = { + name = "Arch Wiki"; urls = [{template = "https://wiki.archlinux.org/index.php?search={searchTerms}";}]; icon = ./logos/arch_linux.svg; definedAliases = ["@aw"]; }; - "Wikipedia (en)".metaData.hidden = true; - "DuckDuckGo".metaData.hidden = true; - "Bing".metaData.hidden = true; - "Google".metaData.hidden = true; + "wikipedia".metaData.hidden = true; + "ddg".metaData.hidden = true; + "bing".metaData.hidden = true; + "google".metaData.hidden = true; "Amazon.de".metaData.hidden = true; - "eBay".metaData.hidden = true; + "ebay".metaData.hidden = true; } diff --git a/modules/home.legacy/conf/firefox/config/search/engines/logos/arch_linux.svg b/modules/by-name/fi/firefox/search_engines/logos/arch_linux.svg index 949b5c5f..949b5c5f 100644 --- a/modules/home.legacy/conf/firefox/config/search/engines/logos/arch_linux.svg +++ b/modules/by-name/fi/firefox/search_engines/logos/arch_linux.svg diff --git a/modules/by-name/fi/firefox/search_engines/logos/arch_linux.svg.license b/modules/by-name/fi/firefox/search_engines/logos/arch_linux.svg.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/modules/by-name/fi/firefox/search_engines/logos/arch_linux.svg.license @@ -0,0 +1,9 @@ +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/firefox/config/search/engines/logos/brave.svg b/modules/by-name/fi/firefox/search_engines/logos/brave.svg index 09dd2e42..09dd2e42 100644 --- a/modules/home.legacy/conf/firefox/config/search/engines/logos/brave.svg +++ b/modules/by-name/fi/firefox/search_engines/logos/brave.svg diff --git a/modules/by-name/fi/firefox/search_engines/logos/brave.svg.license b/modules/by-name/fi/firefox/search_engines/logos/brave.svg.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/modules/by-name/fi/firefox/search_engines/logos/brave.svg.license @@ -0,0 +1,9 @@ +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/firefox/config/search/engines/logos/google_scholar.ico b/modules/by-name/fi/firefox/search_engines/logos/google_scholar.ico index 85d0c664..85d0c664 100644 --- a/modules/home.legacy/conf/firefox/config/search/engines/logos/google_scholar.ico +++ b/modules/by-name/fi/firefox/search_engines/logos/google_scholar.ico Binary files differdiff --git a/modules/by-name/fi/firefox/search_engines/logos/google_scholar.ico.license b/modules/by-name/fi/firefox/search_engines/logos/google_scholar.ico.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/modules/by-name/fi/firefox/search_engines/logos/google_scholar.ico.license @@ -0,0 +1,9 @@ +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/firefox/config/search/engines/logos/rust_std.svg b/modules/by-name/fi/firefox/search_engines/logos/rust_std.svg index 0091b5a8..0091b5a8 100644 --- a/modules/home.legacy/conf/firefox/config/search/engines/logos/rust_std.svg +++ b/modules/by-name/fi/firefox/search_engines/logos/rust_std.svg diff --git a/modules/by-name/fi/firefox/search_engines/logos/rust_std.svg.license b/modules/by-name/fi/firefox/search_engines/logos/rust_std.svg.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/modules/by-name/fi/firefox/search_engines/logos/rust_std.svg.license @@ -0,0 +1,9 @@ +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/firefox/config/search/engines/logos/rust_tokio.png b/modules/by-name/fi/firefox/search_engines/logos/rust_tokio.png index f1de55ff..f1de55ff 100644 --- a/modules/home.legacy/conf/firefox/config/search/engines/logos/rust_tokio.png +++ b/modules/by-name/fi/firefox/search_engines/logos/rust_tokio.png Binary files differdiff --git a/modules/by-name/fi/firefox/search_engines/logos/rust_tokio.png.license b/modules/by-name/fi/firefox/search_engines/logos/rust_tokio.png.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/modules/by-name/fi/firefox/search_engines/logos/rust_tokio.png.license @@ -0,0 +1,9 @@ +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/firefox/config/search/engines/logos/wikipedia.svg b/modules/by-name/fi/firefox/search_engines/logos/wikipedia.svg index dc32f984..dc32f984 100644 --- a/modules/home.legacy/conf/firefox/config/search/engines/logos/wikipedia.svg +++ b/modules/by-name/fi/firefox/search_engines/logos/wikipedia.svg diff --git a/modules/by-name/fi/firefox/search_engines/logos/wikipedia.svg.license b/modules/by-name/fi/firefox/search_engines/logos/wikipedia.svg.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/modules/by-name/fi/firefox/search_engines/logos/wikipedia.svg.license @@ -0,0 +1,9 @@ +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/by-name/fi/firefox/update_extensions.sh b/modules/by-name/fi/firefox/update_extensions.sh new file mode 100755 index 00000000..588a7530 --- /dev/null +++ b/modules/by-name/fi/firefox/update_extensions.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env sh + +# 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>. + +# The `generate_extensions` binary is provided in the devshell. + +generate_extensions \ + darkreader:navbar \ + keepassxc-browser:navbar \ + vhack-libredirect:navbar \ + torproject-snowflake:navbar \ + tridactyl-vim:menupanel \ + ublock-origin:menupanel \ + >"$(dirname "$0")"/extensions.json diff --git a/modules/home.legacy/conf/firefox/config/chrome/userChrome.css b/modules/by-name/fi/firefox/userChrome.css index 0b3aff77..6e0d705d 100644 --- a/modules/home.legacy/conf/firefox/config/chrome/userChrome.css +++ b/modules/by-name/fi/firefox/userChrome.css @@ -1,3 +1,15 @@ +/* + * 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>. + */ + /* thickness of tab when you have too many open tabs */ .tabbrowser-tab:not([pinned="true"]) { min-width: 10px !important; diff --git a/modules/by-name/fo/fonts/emoji_font.xml b/modules/by-name/fo/fonts/emoji_font.xml index f3f6bb3e..8a922f61 100644 --- a/modules/by-name/fo/fonts/emoji_font.xml +++ b/modules/by-name/fo/fonts/emoji_font.xml @@ -1,4 +1,17 @@ <?xml version="1.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>. +--> + <!DOCTYPE fontconfig SYSTEM "fonts.dtd"> <fontconfig> <alias binding="weak"> diff --git a/modules/by-name/fo/fonts/module.nix b/modules/by-name/fo/fonts/module.nix index 057c3f36..f8752ae6 100644 --- a/modules/by-name/fo/fonts/module.nix +++ b/modules/by-name/fo/fonts/module.nix @@ -1,3 +1,12 @@ +# 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, diff --git a/modules/by-name/fw/fwupd/module.nix b/modules/by-name/fw/fwupd/module.nix index 5ad4f467..0c4a7bf3 100644 --- a/modules/by-name/fw/fwupd/module.nix +++ b/modules/by-name/fw/fwupd/module.nix @@ -1,3 +1,12 @@ +# 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, diff --git a/modules/by-name/gi/git/aliases.nix b/modules/by-name/gi/git/aliases.nix index 96456bea..bc30ea40 100644 --- a/modules/by-name/gi/git/aliases.nix +++ b/modules/by-name/gi/git/aliases.nix @@ -1,3 +1,12 @@ +# 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, defaultBranchName, diff --git a/modules/by-name/gi/git/git_ignore.git.license b/modules/by-name/gi/git/git_ignore.git.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/modules/by-name/gi/git/git_ignore.git.license @@ -0,0 +1,9 @@ +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/by-name/gi/git/git_template.git.license b/modules/by-name/gi/git/git_template.git.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/modules/by-name/gi/git/git_template.git.license @@ -0,0 +1,9 @@ +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/by-name/gi/git/module.nix b/modules/by-name/gi/git/module.nix index 8e413e8a..a70c38d7 100644 --- a/modules/by-name/gi/git/module.nix +++ b/modules/by-name/gi/git/module.nix @@ -1,3 +1,12 @@ +# 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, diff --git a/modules/home.legacy/conf/gpg/keys/key_1.asc b/modules/by-name/gp/gpg/keys/key_1.asc index 795f82af..f29184d8 100644 --- a/modules/home.legacy/conf/gpg/keys/key_1.asc +++ b/modules/by-name/gp/gpg/keys/key_1.asc @@ -1,3 +1,13 @@ +// 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>. + -----BEGIN PGP PUBLIC KEY BLOCK----- Comment: 8321 ED3A 8DB9 99A5 1F3B F80F F268 2914 EA42 DE26 Comment: Benedikt Peetz <benedikt.peetz@b-peetz.de> diff --git a/modules/home.legacy/conf/gpg/keys/key_2.asc b/modules/by-name/gp/gpg/keys/key_2.asc index 47188da7..7433a3f2 100644 --- a/modules/home.legacy/conf/gpg/keys/key_2.asc +++ b/modules/by-name/gp/gpg/keys/key_2.asc @@ -1,3 +1,13 @@ +// 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>. + -----BEGIN PGP PUBLIC KEY BLOCK----- Comment: 2FEA 7BDB 9171 70A7 B8E7 2001 DF18 78E6 D9C3 B27F Comment: Silas <sils@sils.li> diff --git a/modules/by-name/gp/gpg/module.nix b/modules/by-name/gp/gpg/module.nix new file mode 100644 index 00000000..89d7b356 --- /dev/null +++ b/modules/by-name/gp/gpg/module.nix @@ -0,0 +1,90 @@ +# 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: Migrate to squoia-sq <2025-04-25> +{ + config, + pkgs, + lib, + ... +}: let + cfg = config.soispha.programs.gpg; + homeConfig = config.home-manager.users.soispha; +in { + options.soispha.programs.gpg = { + enable = lib.mkEnableOption "gpg"; + }; + + config = lib.mkIf cfg.enable { + home-manager.users.soispha = { + programs.gpg = { + enable = true; + homedir = "${homeConfig.xdg.dataHome}/gnupg"; + mutableKeys = true; + mutableTrust = true; + + settings = { + default-key = "Benedikt Peetz <benedikt.peetz@b-peetz.de>"; + # TODO: add more + }; + + publicKeys = [ + { + source = ./keys/key_1.asc; + trust = "ultimate"; + } + { + source = ./keys/key_2.asc; + trust = "full"; + } + ]; + }; + services = { + gpg-agent = { + enable = true; + enableZshIntegration = true; + enableScDaemon = true; # smartcards and such things + + # Cache the key passwords + defaultCacheTtl = 60 * 50; + defaultCacheTtlSsh = 60 * 50; + maxCacheTtl = 60 * 50; + maxCacheTtlSsh = 60 * 50; + + pinentry = { + package = pkgs.pinentry-curses; + # package = pkgs.pinentry-tty; + }; + + enableSshSupport = true; + sshKeys = let + removeSpace = str: builtins.replaceStrings [" "] [""] str; + in [ + (removeSpace "8321 ED3A 8DB9 99A5 1F3B F80F F268 2914 EA42 DE26") + ]; + }; + }; + }; + + soispha.programs.zsh.integrations.gpg = '' + export GPG_TTY=$(tty) + + # Magic copied from the gpg-agent manual + unset SSH_AGENT_PID + if [ "''${gnupg_SSH_AUTH_SOCK_by:-0}" -ne $$ ]; then + export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)" + fi + + + # Ensure that get gpg agent is started (necessary because ssh does not start it + # automatically and has it's tty updated) + gpg-connect-agent /bye + ''; + }; +} diff --git a/modules/by-name/ha/hardware/module.nix b/modules/by-name/ha/hardware/module.nix index 850416b7..599f5d23 100644 --- a/modules/by-name/ha/hardware/module.nix +++ b/modules/by-name/ha/hardware/module.nix @@ -1,3 +1,12 @@ +# 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, diff --git a/modules/by-name/ho/home-manager/module.nix b/modules/by-name/ho/home-manager/module.nix index f5304170..d7eccbd6 100644 --- a/modules/by-name/ho/home-manager/module.nix +++ b/modules/by-name/ho/home-manager/module.nix @@ -1,22 +1,17 @@ +# 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, - pkgsStable, - nixpkgs_open_prs, - sysLib, - # extra information system, - # bins - # TODO: Integrate these <2024-05-22> - river_init_lesser, - shell_library, - qmk_firmware, - # external deps - user_js, - # modules - impermanence, - nix-index-database, - nixVim, + modules, ... }: let cfg = config.soispha.home-manager; @@ -25,6 +20,10 @@ in { enable = lib.mkEnableOption "home-manager with custom config."; }; + imports = [ + modules.home-manager.nixosModules.home-manager + ]; + # TODO: Find a way to throw this error below, when a user `enable`s a home-manager # module, but not this module. Without having to plaster all the `home-manager` modules # with `assert`s. <2024-10-18> @@ -33,24 +32,12 @@ in { home-manager = { useGlobalPkgs = true; useUserPackages = true; + + # TODO(@bpeetz): Remove this once the legacy -> by-name migration is done. <2025-05-16> users.soispha = import ../../../home.legacy; extraSpecialArgs = { inherit - nixpkgs_open_prs - pkgsStable - sysLib - # extra information system - # bins - river_init_lesser - shell_library - qmk_firmware - # external deps - user_js - # modules - impermanence - nixVim - nix-index-database ; }; }; diff --git a/modules/by-name/i3/i3bar-river/module.nix b/modules/by-name/i3/i3bar-river/module.nix new file mode 100644 index 00000000..b32ec6a5 --- /dev/null +++ b/modules/by-name/i3/i3bar-river/module.nix @@ -0,0 +1,197 @@ +{ + config, + lib, + pkgs, + ... +}: let + cfg = config.soispha.programs.i3bar-river; + + toColor = color: + if builtins.isString color + then lib.trivial.fromHexString color + else color; + + substractColor = color_a: color_b: let + saturatingSub = a: b: + if a < b + then 0 + else a - b; + in { + red = saturatingSub color_a.red color_b.red; + green = saturatingSub color_a.green color_b.green; + blue = saturatingSub color_a.blue color_b.blue; + alpha = saturatingSub color_a.alpha color_b.alpha; + inherit (color_a) __toString; + }; + + colorOption = red: green: blue: alpha: + lib.mkOption { + type = lib.types.submodule { + options = { + red = lib.mkOption { + type = lib.types.ints.between 0 255; + description = "The amount of red in this color"; + default = toColor red; + }; + green = lib.mkOption { + type = lib.types.ints.between 0 255; + description = "The amount of green in this color"; + default = toColor green; + }; + blue = lib.mkOption { + type = lib.types.ints.between 0 255; + description = "The amount of blue in this color"; + default = toColor blue; + }; + alpha = lib.mkOption { + type = lib.types.ints.between 0 255; + description = "The amount of alpha in this color"; + default = toColor alpha; + }; + + __toString = lib.mkOption { + internal = true; + + default = self: let + tH = num: let + converted = lib.trivial.toHexString num; + in + if builtins.stringLength converted == 1 + then "0${converted}" + else assert (builtins.stringLength converted) == 2; converted; + + output = "#${tH self.red}${tH self.green}${tH self.blue}${tH self.alpha}"; + in + output; + + description = "Convert this type to a string before use"; + }; + }; + }; + + default = { + red = toColor red; + green = toColor green; + blue = toColor blue; + alpha = toColor alpha; + }; + + description = "The specific color to use for this name."; + }; +in { + options.soispha.programs.i3bar-river = { + enable = lib.mkEnableOption "i3bar-river"; + + package = lib.mkPackageOption pkgs "i3bar-river-patched" {}; + + colors = { + none = colorOption 00 00 00 00; + + white = colorOption "ff" "ff" "ff" "ff"; + + blue = colorOption "99" "d1" "db" "ff"; + green = colorOption "a6" "e3" "a1" "dd"; + lavendar = colorOption "b4" "be" "fe" "dd"; + mauve = colorOption "cb" "a6" "f7" "dd"; + normal = colorOption "c6" "ce" "ef" "ff"; + peach = colorOption "fa" "b3" "87" "dd"; + sapphire = colorOption "74" "c7" "ec" "dd"; + teal = colorOption "94" "e2" "d5" "dd"; + + light_gray = colorOption "58" "5b" "70" "ff"; + gray = colorOption "45" "47" "5a" "ff"; + dark_gray = colorOption "30" "34" "46" "ff"; + bright_red = colorOption "e7" "82" "84" "ff"; + + vivid_burgundy = colorOption "9f" "1d" "35" "ff"; + + unfocused_offset = colorOption "33" "33" "33" "00"; + }; + }; + + config = lib.mkIf cfg.enable { + soispha.programs.river.init.backgroundStart = [cfg.package]; + + home-manager.users.soispha = { + programs.i3bar-river = { + enable = true; + inherit (cfg) package; + + settings = { + theme = { + palette = { + # Colors + background = toString cfg.colors.none; + color = toString cfg.colors.white; # Only used, if blocks do not specify one + separator = toString cfg.colors.vivid_burgundy; + + # Tag is set (but not focused or urgent) + tag_fg = toString cfg.colors.white; + tag_bg = toString cfg.colors.light_gray; + + tag_urgent_fg = toString cfg.colors.white; + tag_urgent_bg = toString cfg.colors.bright_red; + + tag_focused_fg = toString cfg.colors.white; + tag_focused_bg = toString cfg.colors.teal; + + tag_inactive_fg = toString cfg.colors.white; + tag_inactive_bg = toString cfg.colors.none; + + # Shop options + blend = true; # whether tags/blocks colors should blend with bar's background + hide_inactive_tags = false; + show_layout_name = false; + show_mode = true; + show_tags = true; + }; + + unfocused_palette = { + hide_inactive_tags = true; + + color = toString (substractColor cfg.colors.white cfg.colors.unfocused_offset); + separator = toString (substractColor cfg.colors.vivid_burgundy cfg.colors.unfocused_offset); + + tag_fg = toString (substractColor cfg.colors.white cfg.colors.unfocused_offset); + tag_bg = toString (substractColor cfg.colors.light_gray cfg.colors.unfocused_offset); + + tag_urgent_fg = toString (substractColor cfg.colors.white cfg.colors.unfocused_offset); + tag_urgent_bg = toString (substractColor cfg.colors.bright_red cfg.colors.unfocused_offset); + + tag_focused_fg = toString (substractColor cfg.colors.white cfg.colors.unfocused_offset); + tag_focused_bg = toString cfg.colors.vivid_burgundy; + + tag_inactive_fg = toString (substractColor cfg.colors.white cfg.colors.unfocused_offset); + tag_inactive_bg = toString (substractColor cfg.colors.none cfg.colors.unfocused_offset); + }; + }; + + # The font and various sizes + font = "SauceCodePro Nerd Font Mono:pixelsize=26"; + height = 24; + margin_top = 10; + margin_bottom = 0; + margin_left = 0; + margin_right = 0; + separator_width = 0; + tags_r = 10.0; + tags_padding = 10.0; + tags_margin = 5.0; + blocks_r = 6.0; + blocks_overlap = 0.0; + + # Misc + position = "top"; # either "top" or "bottom" + layer = "overlay"; # one of "top", "overlay", "bottom" or "background" + invert_touchpad_scrolling = true; + start_hidden = false; # whether the bar is initially in the 'hidden' state + + # WM-specific options + wm.river = { + max_tag = 9; # Show only the first nine tags + }; + }; + }; + }; + }; +} diff --git a/modules/by-name/i3/i3status-rust/module.nix b/modules/by-name/i3/i3status-rust/module.nix new file mode 100644 index 00000000..5bd911d8 --- /dev/null +++ b/modules/by-name/i3/i3status-rust/module.nix @@ -0,0 +1,152 @@ +{ + config, + lib, + pkgs, + ... +}: let + cfg = config.soispha.programs.i3status-rust; + + mkScript = name: deps: + lib.getExe (pkgs.writeShellApplication { + inherit name; + text = builtins.readFile ./scripts/${name}; + + inheritPath = false; + runtimeInputs = deps; + }); +in { + options.soispha.programs.i3status-rust = { + enable = lib.mkEnableOption "i3status-rust"; + + package = lib.mkPackageOption pkgs "i3status-rust-patched" {}; + }; + + config = lib.mkIf cfg.enable { + home-manager.users.soispha = { + programs.i3status-rust = { + enable = true; + inherit (cfg) package; + + bars.default = { + settings = { + icons = { + icons = "material-nf"; + + overrides = { + cpu = [ + "" # nf-md-memory + ]; + memory_mem = ""; # nf-fa-bars + }; + }; + + theme = { + theme = "slick"; + + overrides = { + separator = "native"; + alternating_tint_bg = "none"; + alternating_tint_fg = "none"; + }; + }; + }; + + blocks = [ + { + block = "time"; + format = " $timestamp.datetime(format:'%d/%m/%y (%a) %H:%M %:z') "; + interval = 60; + } + + { + # TODO(@bpeetz): Switch to “music” when mpd gets mpris support <2025-05-20> + block = "custom"; + interval = "once"; + persistent = true; + command = mkScript "mpd_song_name.sh" [pkgs.mpc pkgs.coreutils]; + hide_when_empty = true; + shell = "${lib.getExe pkgs.dash}"; + format = " $text.str(max_width:60,rot_interval:0.5) "; + } + + { + block = "sound"; + driver = "pulseaudio"; + headphones_indicator = true; + } + + # System info + { + block = "cpu"; + } + { + block = "memory"; + format = " $icon $mem_used_percents {($swap_used_percents.eng(range:1..)) | }"; + } + { + block = "amd_gpu"; + format = " $icon $utilization (^icon_memory_mem $vram_used_percents) "; + } + + { + block = "net"; + format = " ^icon_net_down $speed_down.eng(prefix:Ki) ^icon_net_up $speed_up.eng(prefix:Ki) "; + } + { + block = "privacy"; + driver = [ + {name = "v4l";} + {name = "pipewire";} + ]; + } + + { + block = "disk_space"; + path = "/srv"; + info_type = "used"; + format = " $icon $used.eng(prefix:Gi) ($percentage) "; + backend = "btrfs"; + + # warn if 80 % is used, alert after 90 % used. + warning = 80; + alert = 90; + } + { + block = "backlight"; + missing_format = ""; + } + { + block = "battery"; + missing_format = ""; + } + + # { + # block = "calendar"; + # + # source = { + # calendars = ["user/calendar"]; + # auth = { + # type = "unauthenticated"; + # }; + # }; + # } + # { + # block = "focused_window"; + # driver = "wlr_toplevel_management"; + # } + # { + # block = "maildir"; + # display_type = "new"; + # inboxes = ["~/.local/share/maildir/soispha/*"]; + # interval = 60; + # threshold_critical = 10; + # threshold_warning = 1; + # } + ]; + }; + }; + + programs.i3bar-river.settings.command = "${lib.getExe cfg.package} config-default.toml"; + }; + }; +} diff --git a/modules/by-name/i3/i3status-rust/scripts/mpd_song_name.sh b/modules/by-name/i3/i3status-rust/scripts/mpd_song_name.sh new file mode 100755 index 00000000..28921520 --- /dev/null +++ b/modules/by-name/i3/i3status-rust/scripts/mpd_song_name.sh @@ -0,0 +1,32 @@ +#!/usr/bin/env dash + +# 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>. + +while true; do + state="$(mpc status '%state%')" + + if [ "$state" = "playing" ]; then + song="$(mpc --format '[[%artist% - ]%title%]|[%file%]' current)" + progress="$(mpc status "%currenttime%/%totaltime%")" + + echo "$song :: $progress" + else + # The song has stopped, we are done displaying it. + echo "" + + # Wait for a new song. (Or in this case for a new event.) + mpc idle + fi + + sleep 1 +done + +# vim: ft=sh diff --git a/modules/by-name/im/impermanence/module.nix b/modules/by-name/im/impermanence/module.nix index 9c289346..4ce86b25 100644 --- a/modules/by-name/im/impermanence/module.nix +++ b/modules/by-name/im/impermanence/module.nix @@ -1,6 +1,16 @@ +# 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, + modules, ... }: let cfg = config.soispha.impermanence; @@ -23,6 +33,10 @@ in { }; }; + imports = [ + modules.impermanence.nixosModules.impermanence + ]; + config = lib.mkIf cfg.enable { environment.persistence = { "/srv" = { @@ -39,11 +53,10 @@ in { ".local/state/wireplumber" ".config/Signal" - ".config/Element" ".config/iamb/profiles" ".cache" - ".mozilla" + ".mozilla/firefox" "media" "repos" diff --git a/modules/by-name/im/imv/module.nix b/modules/by-name/im/imv/module.nix index 0a324e01..fdf95982 100644 --- a/modules/by-name/im/imv/module.nix +++ b/modules/by-name/im/imv/module.nix @@ -1,3 +1,12 @@ +# 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, diff --git a/modules/by-name/is/issue_file/module.nix b/modules/by-name/is/issue_file/module.nix index d8b6faa8..f9a7b58a 100644 --- a/modules/by-name/is/issue_file/module.nix +++ b/modules/by-name/is/issue_file/module.nix @@ -1,3 +1,12 @@ +# 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, self, diff --git a/modules/by-name/la/laptop/module.nix b/modules/by-name/la/laptop/module.nix index f70230ad..dd8935b9 100644 --- a/modules/by-name/la/laptop/module.nix +++ b/modules/by-name/la/laptop/module.nix @@ -1,3 +1,12 @@ +# 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, diff --git a/modules/by-name/le/less/command.less.license b/modules/by-name/le/less/command.less.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/modules/by-name/le/less/command.less.license @@ -0,0 +1,9 @@ +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/by-name/le/less/env.less.license b/modules/by-name/le/less/env.less.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/modules/by-name/le/less/env.less.license @@ -0,0 +1,9 @@ +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/by-name/le/less/line-edit.less.license b/modules/by-name/le/less/line-edit.less.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/modules/by-name/le/less/line-edit.less.license @@ -0,0 +1,9 @@ +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/by-name/le/less/module.nix b/modules/by-name/le/less/module.nix index f2475b73..0dd45a90 100644 --- a/modules/by-name/le/less/module.nix +++ b/modules/by-name/le/less/module.nix @@ -1,3 +1,12 @@ +# 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, diff --git a/modules/by-name/lf/lf/colors b/modules/by-name/lf/lf/colors index 1c2853ec..17201e64 100644 --- a/modules/by-name/lf/lf/colors +++ b/modules/by-name/lf/lf/colors @@ -60,11 +60,6 @@ fi 00 # FILE # links to hide ~/.mozilla 01;08;30 ~/.ssh 01;08;30 -~/.zshenv 01;08;30 - -~/.steampid 01;08;30 -~/.steam 01;08;30 -~/.steampath 01;08;30 # archives or compressed (dircolors defaults) *.tar 01;31 diff --git a/modules/by-name/lf/lf/colors.license b/modules/by-name/lf/lf/colors.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/modules/by-name/lf/lf/colors.license @@ -0,0 +1,9 @@ +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/by-name/lf/lf/commands/base.sh b/modules/by-name/lf/lf/commands/base.sh new file mode 100755 index 00000000..99852c3e --- /dev/null +++ b/modules/by-name/lf/lf/commands/base.sh @@ -0,0 +1,88 @@ +#!/usr/bin/env sh + +# 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 disable=SC2269 +id="$id" + +# Prompt the user for input. +# This will just _print_ the prompt, you still need to `read -r` the user's answer. +# +# # Type +# prompt :: String +# +# # Arguments +# $1 +# : The prompt to print for the user. +prompt() { + printf "=> %s" "$1" +} + +# Reads its Stdin into a temporary file and returns the path of the temporary file. +# This is only really useful, if you want to pipe something into an while read loop that +# should modify global variables. Piping directly into it will not work, because the shell +# would just run it in a subshell, so you need this workaround. +# +# # Type +# tmp :: <stdin> -> Path +# +# # Arguments +# +# # Examples +# while read -r file; do +# set -- "$@" "$file" +# done < "$(echo "$fx" | tmp)" +tmp() { + __base_tmp_temporary_file="$(mktemp --tmpdir="$__base_tmp_temporary_directory")" + cat >"$__base_tmp_temporary_file" + echo "$__base_tmp_temporary_file" +} +__base_tmp_temporary_directory="$(mktemp --directory)" +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] +# +# # Arguments +# $1..$@ +# : The arguments composing the command to run. +lf_cmd() { + arguments="" + for arg in "$@"; do + if [ -z "$arguments" ]; then + arguments="'$arg'" + else + arguments="$arguments '$arg'" + fi + done + + lf -remote "send $id $arguments" +} + +# Print an error message and exit with error code 1. +# The error message will be printed to lf. +# +# # Type +# die :: String +# +# # Arguments +# $1 +# : The error message +die() { + lf_cmd echo "Error: $1" + exit 1 +} + +# vim: ft=sh diff --git a/modules/by-name/lf/lf/commands/default.nix b/modules/by-name/lf/lf/commands/default.nix index b3c9acab..f953834b 100644 --- a/modules/by-name/lf/lf/commands/default.nix +++ b/modules/by-name/lf/lf/commands/default.nix @@ -1,231 +1,155 @@ -{ - pkgs, - sysLib, - shell_library, - system, - ... -}: let +# 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, ...}: let functionCall = { name, dependencies, - replacementStrings, - ... + keepPath ? false, }: - sysLib.writeShellScript { + pkgs.writeShellApplication { inherit name; - src = ./scripts/${name}.sh; - keepPath = true; - dependencies = dependencies ++ (builtins.attrValues {inherit (pkgs) dash coreutils;}); - inherit replacementStrings; + text = builtins.readFile ./base.sh + builtins.readFile ./scripts/${name}.sh; + runtimeInputs = [pkgs.lf pkgs.mktemp pkgs.coreutils] ++ dependencies; + inheritPath = keepPath; } + "/bin/${name}"; - shell = { - name, - dependencies, - replacementStrings ? null, - ... - }: '' + # closes the lf tui + shell = args: '' ''${{ - ${functionCall {inherit name dependencies replacementStrings;}} + ${functionCall args} }} - ''; # closes the lf tui - pipe = { - name, - dependencies, - replacementStrings ? null, - ... - }: '' + ''; + # runs the command in the ui/term bar + pipe = args: '' %{{ - ${functionCall {inherit name dependencies replacementStrings;}} + ${functionCall args} }} - ''; # runs the command in the ui/term bar - async = { - name, - dependencies, - replacementStrings ? null, - ... - }: '' + ''; + # runs the command in the background + async = args: '' &{{ - ${functionCall {inherit name dependencies replacementStrings;}} + ${functionCall args} }} - ''; # runs the command in the background - wait = { - name, - dependencies, - replacementStrings ? null, - ... - }: '' + ''; + # adds a prompt after the command has run + wait = args: '' !{{ - ${functionCall {inherit name dependencies replacementStrings;}} + ${functionCall args} }} - ''; # adds a prompt after the command has run + ''; in { - archive = shell { - name = "archive"; - dependencies = builtins.attrValues { - inherit - (pkgs) - fzf - gnutar - xz - p7zip - zip - ; - }; - }; - broot_jump = shell { - name = "broot_jump"; - dependencies = builtins.attrValues { - inherit (pkgs) broot; - }; + archive_compress = shell { + name = "archive_compress"; + dependencies = with pkgs; [ + fzf + gnutar + xz + p7zip + zip + ]; + }; + archive_decompress = pipe { + name = "archive_decompress"; + dependencies = with pkgs; [ + gnutar + unzip + p7zip + ]; + }; + + cd_project_root = async { + name = "cd_project_root"; + dependencies = [pkgs.git]; }; + chmod = pipe { name = "chmod"; dependencies = []; }; - clear_trash = shell { - name = "clear_trash"; - dependencies = builtins.attrValues { - inherit - (pkgs) - fzf - trashy - ; - }; - }; - dl_file = pipe { - name = "dl_file"; - dependencies = builtins.attrValues { - inherit - (pkgs) - xdragon - curl - ; - }; - }; + dragon = pipe { name = "dragon"; - dependencies = builtins.attrValues { - inherit - (pkgs) - xdragon - ; - }; + dependencies = [pkgs.dragon-drop]; }; dragon_individual = pipe { name = "dragon_individual"; - dependencies = builtins.attrValues { - inherit - (pkgs) - xdragon - ; - }; + dependencies = [pkgs.dragon-drop]; }; dragon_stay = pipe { name = "dragon_stay"; - dependencies = builtins.attrValues { - inherit - (pkgs) - xdragon - ; - }; + dependencies = [pkgs.dragon-drop]; }; + execute = shell { name = "execute"; dependencies = []; + keepPath = true; }; follow_link = pipe { name = "follow_link"; - dependencies = with pkgs; [lf]; - }; - fzf_jump = shell { - name = "fzf_jump"; - dependencies = builtins.attrValues { - inherit (pkgs) fzf lf gnused; - }; + dependencies = []; }; - mk_dir = pipe { - name = "mk_dir"; + + mk_directory = pipe { + name = "mk_directory"; dependencies = []; }; mk_file = shell { name = "mk_file"; dependencies = []; }; - mk_file_and_edit = shell { - name = "mk_file_and_edit"; + mk_link = pipe { + name = "mk_link"; dependencies = []; }; - mk_ln = pipe { - name = "mk_ln"; + mk_script = shell { + name = "mk_script"; dependencies = []; + keepPath = true; }; - mk_scr_default = shell { - name = "mk_scr_default"; - dependencies = builtins.attrValues {}; - replacementStrings = { - SHELL_LIBRARY_TEMPLATE = "${shell_library.rawTemplate."${system}"}"; - }; - }; - mk_scr_temp = shell { - name = "mk_scr_temp"; - dependencies = builtins.attrValues {}; - replacementStrings = { - SHELL_LIBRARY_TEMPLATE = "${shell_library.rawTemplate."${system}"}"; - TO_BE_SHELL_LIBRARY_PATH = "%SHELL_LIBRARY_PATH"; # replacement is not recursive - }; - }; - view_file = async { - name = "view_file"; - dependencies = builtins.attrValues {inherit (pkgs) file;}; - }; - go_project_base_directory = async { - name = "go_project_root"; - dependencies = []; - }; - restore_trash = shell { - name = "restore_trash"; - dependencies = builtins.attrValues { - inherit - (pkgs) - fzf - trashy - ; - }; - }; + set_clipboard_path = async { name = "set_clipboard_path"; dependencies = [pkgs.wl-clipboard]; }; - set_wall_paper = pipe { - name = "set_wall_paper"; - dependencies = []; + set_wallpaper = pipe { + name = "set_wallpaper"; + dependencies = with pkgs; [ + river # for `riverctl` + swaybg + procps + ]; }; + stripspace = pipe { name = "stripspace"; - dependencies = []; + dependencies = [pkgs.gnused]; }; + trash = pipe { name = "trash"; - dependencies = builtins.attrValues { - inherit - (pkgs) - trashy - trash-cli - findutils - ; - }; - }; - unarchive = pipe { - name = "unarchive"; - dependencies = builtins.attrValues { - inherit - (pkgs) - gnutar - unzip - p7zip - ; - }; + dependencies = [pkgs.trash-cli]; + }; + trash_clear = shell { + name = "trash_clear"; + dependencies = with pkgs; [conceal fzf gawk trashy gnused]; + }; + trash_restore = shell { + name = "trash_restore"; + dependencies = with pkgs; [conceal fzf gawk trashy gnused]; + }; + + view_file = async { + name = "view_file"; + dependencies = with pkgs; [file]; + keepPath = true; }; } diff --git a/modules/by-name/lf/lf/commands/run.sh b/modules/by-name/lf/lf/commands/run.sh new file mode 100755 index 00000000..06106aed --- /dev/null +++ b/modules/by-name/lf/lf/commands/run.sh @@ -0,0 +1,40 @@ +#!/usr/bin/env sh + +# 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>. + +# Run one of the commands for debugging purposes. + +[ "$#" -gt 1 ] || { + echo "Usage: $0 <script_name> <input_files>.." + exit 2 +} + +script_name="./scripts/$1" +shift 1 + +fx="" +for arg in "$@"; do + if [ -z "$fx" ]; then + fx="$arg" + else + fx="$(printf "%s\n%s" "$fx" "$arg")" + fi +done + +export f="$1" +set -- + +# shellcheck source=/dev/null +. ./base.sh +# shellcheck source=/dev/null +. "$script_name" + +# vim: ft=sh diff --git a/modules/by-name/lf/lf/commands/scripts/archive.sh b/modules/by-name/lf/lf/commands/scripts/archive.sh deleted file mode 100755 index 25f40534..00000000 --- a/modules/by-name/lf/lf/commands/scripts/archive.sh +++ /dev/null @@ -1,77 +0,0 @@ -#! /usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH - -# Option '-f' disables pathname expansion which can be useful when $f, $fs, and -# $fx variables contain names with '*' or '?' characters. However, this option -# is used selectively within individual commands as it can be limiting at -# times. -set -f - -# shellcheck disable=SC2269 -f="$f" -# shellcheck disable=SC2269 -fx="$fx" -# shellcheck disable=SC2269 -fs="$fs" - -archivers="$(tmp echo gzip xz 7z zip)" -archiver="$(awk '{for (i=1; i<=NF; i++) print $i}' "$archivers" | fzf)" - -case "$archiver" in -"gzip") - ext=tar.gz - ;; -"xz") - ext=tar.xz - ;; -"7z") - ext=7z - ;; -"zip") - ext=zip - ;; -esac - -prompt "Archive name: " -name="" -while [ -z "$name" ] || [ -e "$name" ]; do - read -r name_base - name="$name_base.$ext" - if [ -e "$name" ]; then - prompt "Archive already exists, overwrite [y|N]: " - read -r ans - - if [ "$ans" = "y" ]; then - break - else - prompt "Archive name: " - fi - fi -done - -root="$(if [ "$(pwd)" = "/" ]; then pwd; else echo "$(pwd)/"; fi)" - -# fx contains all selected file name separated by a newline -while read -r raw_file; do - file="$(echo "$raw_file" | sed "s|$root||")" - set -- "$@" "$file" -done <"$(tmp echo "$fx")" - -case "$archiver" in -"gzip") - tar --create --gzip -file="$name" "$@" - ;; -"xz") - tar --create --file="$name" "$@" - xz --compress -9 --extreme --threads=0 "$name" - ;; -"7z") - 7z a "$name" "$@" - ;; -"zip") - zip --symlinks -9 -r "$name" "$@" - ;; -esac -# vim: ft=sh diff --git a/modules/by-name/lf/lf/commands/scripts/archive_compress.sh b/modules/by-name/lf/lf/commands/scripts/archive_compress.sh new file mode 100755 index 00000000..b42688bf --- /dev/null +++ b/modules/by-name/lf/lf/commands/scripts/archive_compress.sh @@ -0,0 +1,73 @@ +# 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" + +archiver="$(printf "%s\n" gzip xz 7z zip | fzf)" + +case "$archiver" in +"gzip") + ext=tar.gz + ;; +"xz") + ext=tar.xz + ;; +"7z") + ext=7z + ;; +"zip") + ext=zip + ;; +esac + +prompt "Archive name: " +name="" +while [ -z "$name" ] || [ -e "$name" ]; do + read -r name_base + name="$name_base.$ext" + if [ -e "$name" ]; then + prompt "Archive already exists, overwrite [y|N]: " + read -r ans + + if [ "$ans" = "y" ]; then + break + else + prompt "New Archive name: " + fi + fi +done + +# fx contains all selected file name separated by a newline +while read -r file; do + set -- "$@" "$(realpath --relative-to="$(pwd)" "$file")" +done <"$(echo "$fx" | tmp)" + +case "$archiver" in +"gzip") + tar --create --gzip --file="$name" "$@" + ;; +"xz") + tar --create "$@" | xz --compress -9 --format=xz --extreme --threads=0 --stdout >"$name" + ;; +"7z") + 7z a "$name" "$@" + ;; +"zip") + zip --symlinks -9 --recurse-paths "$name" "$@" + ;; +esac +# vim: ft=sh diff --git a/modules/by-name/lf/lf/commands/scripts/archive_decompress.sh b/modules/by-name/lf/lf/commands/scripts/archive_decompress.sh new file mode 100755 index 00000000..11d634b1 --- /dev/null +++ b/modules/by-name/lf/lf/commands/scripts/archive_decompress.sh @@ -0,0 +1,33 @@ +# 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" + +echo "$fx" | while read -r file; do + case "$file" in + *.tar.bz | *.tar.bz2 | *.tbz | *.tbz2) tar --extract --bzip2 --verbose --file="$file" ;; + *.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" ;; + *.7z) 7z x "$file" ;; + *) die "'$file' is not a supported file for unarchiving." ;; + esac +done +# vim: ft=sh diff --git a/modules/by-name/lf/lf/commands/scripts/broot_jump.sh b/modules/by-name/lf/lf/commands/scripts/broot_jump.sh deleted file mode 100755 index 8f40ba01..00000000 --- a/modules/by-name/lf/lf/commands/scripts/broot_jump.sh +++ /dev/null @@ -1,25 +0,0 @@ -#! /usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH - -# shellcheck disable=SC2269 -f="$f" -# shellcheck disable=SC2269 -fx="$fx" -# shellcheck disable=SC2269 -fs="$fs" -# shellcheck disable=SC2269 -id="$id" - -tmp=$(mktmp) -res="$(broot --outcmd "$tmp" && sed 's/cd //' "$tmp")" - -if [ -f "$res" ]; then - cmd="select" -elif [ -d "$res" ]; then - cmd="cd" -fi - -lf -remote "send '$id' '$cmd' '$res'" -# vim: ft=sh diff --git a/modules/by-name/lf/lf/commands/scripts/cd_project_root.sh b/modules/by-name/lf/lf/commands/scripts/cd_project_root.sh new file mode 100755 index 00000000..c2de61e6 --- /dev/null +++ b/modules/by-name/lf/lf/commands/scripts/cd_project_root.sh @@ -0,0 +1,29 @@ +# 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="$(git rev-parse --show-toplevel)" +if [ "$root" ]; then + lf_cmd cd "$root" || die "Bug: Failed to cd to project root at '$root'" +else + die "Unable to locate base dir" +fi + +# vim: ft=sh diff --git a/modules/by-name/lf/lf/commands/scripts/chmod.sh b/modules/by-name/lf/lf/commands/scripts/chmod.sh index 9859127b..757f3c9c 100755 --- a/modules/by-name/lf/lf/commands/scripts/chmod.sh +++ b/modules/by-name/lf/lf/commands/scripts/chmod.sh @@ -1,7 +1,14 @@ -#! /usr/bin/env dash +# 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 source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH +# shellcheck shell=sh # shellcheck disable=SC2269 f="$f" @@ -12,13 +19,12 @@ fs="$fs" # shellcheck disable=SC2269 id="$id" -readp "Mode bits: " bits -# shellcheck disable=SC2269 -bits="$bits" +prompt "Mode bits: " +read -r bits -while read -r file; do +echo "$fx" | while read -r file; do chmod "$bits" "$file" -done <"$(tmp echo "$fx")" +done -lf -remote 'send reload' +lf_cmd reload # vim: ft=sh diff --git a/modules/by-name/lf/lf/commands/scripts/clear_trash.sh b/modules/by-name/lf/lf/commands/scripts/clear_trash.sh deleted file mode 100755 index 9052bb5f..00000000 --- a/modules/by-name/lf/lf/commands/scripts/clear_trash.sh +++ /dev/null @@ -1,8 +0,0 @@ -#! /usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH - -# could also use --force, for instand removal -trash list | fzf --multi | awk '{print $NF}' | xargs trash empty --match=exact -# vim: ft=sh diff --git a/modules/by-name/lf/lf/commands/scripts/cow_cp.sh b/modules/by-name/lf/lf/commands/scripts/cow_cp.sh index 98675b9e..dbe00654 100755 --- a/modules/by-name/lf/lf/commands/scripts/cow_cp.sh +++ b/modules/by-name/lf/lf/commands/scripts/cow_cp.sh @@ -1,5 +1,15 @@ #!/usr/bin/env bash +# 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 source=/dev/null SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH diff --git a/modules/by-name/lf/lf/commands/scripts/dl_file.sh b/modules/by-name/lf/lf/commands/scripts/dl_file.sh deleted file mode 100755 index c7e3d8b2..00000000 --- a/modules/by-name/lf/lf/commands/scripts/dl_file.sh +++ /dev/null @@ -1,43 +0,0 @@ -#! /usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH - -# shellcheck disable=SC2269 -f="$f" -# shellcheck disable=SC2269 -fx="$fx" -# shellcheck disable=SC2269 -fs="$fs" -# shellcheck disable=SC2269 -id="$id" - -# Provides the ability to download a file by dropping it into a window - -url="$(dragon -t -x)" - -if [ -n "$url" ]; then - prompt "File Name: " - name="" - while [ -z "$name" ] || [ -e "$name" ]; do - read -r name - if [ -e "$name" ]; then - prompt "File already exists, overwrite [y|N]: " - read -r ans - - if [ "$ans" = "y" ]; then - break - else - prompt "File Name: " - fi - fi - done - - # Download the file with curl - if [ -n "$name" ]; then - curl -o "$name" "$url" || die "curl failed" - fi -else - die "URL is null!" -fi -# vim: ft=sh diff --git a/modules/by-name/lf/lf/commands/scripts/dragon.sh b/modules/by-name/lf/lf/commands/scripts/dragon.sh index cf3c3176..a4a52c72 100755 --- a/modules/by-name/lf/lf/commands/scripts/dragon.sh +++ b/modules/by-name/lf/lf/commands/scripts/dragon.sh @@ -1,7 +1,14 @@ -#! /usr/bin/env dash +# 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 source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH +# shellcheck shell=sh # shellcheck disable=SC2269 f="$f" @@ -14,7 +21,7 @@ id="$id" while read -r file; do set -- "$@" "$file" -done <"$(tmp echo "$fx")" +done <"$(echo "$fx" | tmp)" -dragon -a -x "$@" +dragon-drop --all --and-exit "$@" # vim: ft=sh diff --git a/modules/by-name/lf/lf/commands/scripts/dragon_individual.sh b/modules/by-name/lf/lf/commands/scripts/dragon_individual.sh index 2465cdfa..370e9753 100755 --- a/modules/by-name/lf/lf/commands/scripts/dragon_individual.sh +++ b/modules/by-name/lf/lf/commands/scripts/dragon_individual.sh @@ -1,7 +1,14 @@ -#! /usr/bin/env dash +# 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 source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH +# shellcheck shell=sh # shellcheck disable=SC2269 f="$f" @@ -14,7 +21,7 @@ id="$id" while read -r file; do set -- "$@" "$file" -done <"$(tmp echo "$fx")" +done <"$(echo "$fx" | tmp)" -dragon "$@" +dragon-drop "$@" # vim: ft=sh diff --git a/modules/by-name/lf/lf/commands/scripts/dragon_stay.sh b/modules/by-name/lf/lf/commands/scripts/dragon_stay.sh index 066b4c75..86a19370 100755 --- a/modules/by-name/lf/lf/commands/scripts/dragon_stay.sh +++ b/modules/by-name/lf/lf/commands/scripts/dragon_stay.sh @@ -1,7 +1,14 @@ -#! /usr/bin/env dash +# 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 source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH +# shellcheck shell=sh # shellcheck disable=SC2269 f="$f" @@ -14,7 +21,7 @@ id="$id" while read -r file; do set -- "$@" "$file" -done <"$(tmp echo "$fx")" +done <"$(echo "$fx" | tmp)" -dragon -a "$@" +dragon-drop --all "$@" # vim: ft=sh diff --git a/modules/by-name/lf/lf/commands/scripts/execute.sh b/modules/by-name/lf/lf/commands/scripts/execute.sh index aa97fd7f..ce62dfa0 100755 --- a/modules/by-name/lf/lf/commands/scripts/execute.sh +++ b/modules/by-name/lf/lf/commands/scripts/execute.sh @@ -1,7 +1,14 @@ -#!/usr/bin/env dash +# 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 source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH +# shellcheck shell=sh # shellcheck disable=SC2269 f="$f" diff --git a/modules/by-name/lf/lf/commands/scripts/follow_link.sh b/modules/by-name/lf/lf/commands/scripts/follow_link.sh index 80413990..71fa6825 100755 --- a/modules/by-name/lf/lf/commands/scripts/follow_link.sh +++ b/modules/by-name/lf/lf/commands/scripts/follow_link.sh @@ -1,7 +1,14 @@ -#!/usr/bin/env dash +# 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 source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH +# shellcheck shell=sh # shellcheck disable=SC2269 f="$f" @@ -14,6 +21,12 @@ id="$id" dir="$(realpath "$f")" -lf -remote "send $id cd \"$dir\"" +if [ -f "$dir" ]; then + cmd="select" +elif [ -d "$dir" ]; then + cmd="cd" +fi + +lf_cmd "$cmd" "$dir" # vim: ft=sh diff --git a/modules/by-name/lf/lf/commands/scripts/fzf_jump.sh b/modules/by-name/lf/lf/commands/scripts/fzf_jump.sh deleted file mode 100755 index ad1633fb..00000000 --- a/modules/by-name/lf/lf/commands/scripts/fzf_jump.sh +++ /dev/null @@ -1,24 +0,0 @@ -#! /usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH - -res="$(fd . --maxdepth 3 | fzf --header='Jump to location')" - -# shellcheck disable=SC2269 -f="$f" -# shellcheck disable=SC2269 -fx="$fx" -# shellcheck disable=SC2269 -fs="$fs" -# shellcheck disable=SC2269 -id="$id" - -if [ -f "$res" ]; then - cmd="select" -elif [ -d "$res" ]; then - cmd="cd" -fi - -lf -remote "send $id $cmd \"$res\"" -# vim: ft=sh diff --git a/modules/by-name/lf/lf/commands/scripts/go_project_root.sh b/modules/by-name/lf/lf/commands/scripts/go_project_root.sh deleted file mode 100755 index 5f7746d3..00000000 --- a/modules/by-name/lf/lf/commands/scripts/go_project_root.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH - -# shellcheck disable=SC2269 -f="$f" -# shellcheck disable=SC2269 -fx="$fx" -# shellcheck disable=SC2269 -fs="$fs" -# shellcheck disable=SC2269 -id="$id" - -flake_base_dir="$(search_flake_base_dir)" -if [ "$flake_base_dir" ]; then - lf -remote "send $id cd $flake_base_dir" || die "Bug: No base dir ($flake_base_dir)" -else - die "Unable to locate base dir" -fi - -# vim: ft=sh diff --git a/modules/by-name/lf/lf/commands/scripts/mk_dir.sh b/modules/by-name/lf/lf/commands/scripts/mk_directory.sh index 150f7eed..f3bd6d29 100755 --- a/modules/by-name/lf/lf/commands/scripts/mk_dir.sh +++ b/modules/by-name/lf/lf/commands/scripts/mk_directory.sh @@ -1,7 +1,14 @@ -#! /usr/bin/env dash +# 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 source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH +# shellcheck shell=sh # shellcheck disable=SC2269 f="$f" @@ -23,7 +30,7 @@ while [ -z "$name" ] || [ -e "$name" ]; do if [ "$ans" = "y" ]; then break else - prompt "Directory Name: " + prompt "New Directory Name: " fi fi done diff --git a/modules/by-name/lf/lf/commands/scripts/mk_file.sh b/modules/by-name/lf/lf/commands/scripts/mk_file.sh index 41d5cf1a..78271aaa 100755 --- a/modules/by-name/lf/lf/commands/scripts/mk_file.sh +++ b/modules/by-name/lf/lf/commands/scripts/mk_file.sh @@ -1,7 +1,14 @@ -#! /usr/bin/env dash +# 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 source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH +# shellcheck shell=sh # shellcheck disable=SC2269 f="$f" @@ -23,7 +30,7 @@ while [ -z "$name" ] || [ -e "$name" ]; do if [ "$ans" = "y" ]; then break else - prompt "File name: " + prompt "New File name: " fi fi done diff --git a/modules/by-name/lf/lf/commands/scripts/mk_file_and_edit.sh b/modules/by-name/lf/lf/commands/scripts/mk_file_and_edit.sh deleted file mode 100755 index 19fc51db..00000000 --- a/modules/by-name/lf/lf/commands/scripts/mk_file_and_edit.sh +++ /dev/null @@ -1,33 +0,0 @@ -#! /usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH - -# shellcheck disable=SC2269 -f="$f" -# shellcheck disable=SC2269 -fx="$fx" -# shellcheck disable=SC2269 -fs="$fs" -# shellcheck disable=SC2269 -id="$id" - -prompt "File name: " -name="" -while [ -z "$name" ] || [ -e "$name" ]; do - read -r name - if [ -e "$name" ]; then - prompt "File already exists, overwrite [y|N]: " - read -r ans - - if [ "$ans" = "y" ]; then - break - else - prompt "File name: " - fi - fi -done - -touch "$name" -"$EDITOR" "$name" -# vim: ft=sh diff --git a/modules/by-name/lf/lf/commands/scripts/mk_ln.sh b/modules/by-name/lf/lf/commands/scripts/mk_link.sh index 7fab8e22..35f49c38 100755 --- a/modules/by-name/lf/lf/commands/scripts/mk_ln.sh +++ b/modules/by-name/lf/lf/commands/scripts/mk_link.sh @@ -1,7 +1,14 @@ -#! /usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH +# 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" @@ -14,20 +21,19 @@ id="$id" while IFS= read -r i; do set -- "$@" "$i" -done <"$HOME"/.local/share/lf/files +done <"$HOME/.local/share/lf/files" mode="$1" shift if [ "$#" -eq 0 ]; then - msg "no files to link" + lf_cmd echo "No files to link." exit 0 fi case "$mode" in copy) - while [ "$#" -gt 0 ]; do - file="$1" + for file in "$@"; do ans="$(basename "$file")" while [ -e "$ans" ]; do @@ -36,10 +42,10 @@ copy) done ln --symbolic --relative "$file" "$(pwd)/$ans" - shift done ;; esac -rm ~/.local/share/lf/files +rm "$HOME/.local/share/lf/files" # lf -remote "send clear" + # vim: ft=sh diff --git a/modules/by-name/lf/lf/commands/scripts/mk_scr_default.sh b/modules/by-name/lf/lf/commands/scripts/mk_scr_default.sh deleted file mode 100755 index 47d05080..00000000 --- a/modules/by-name/lf/lf/commands/scripts/mk_scr_default.sh +++ /dev/null @@ -1,38 +0,0 @@ -#! /usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH - -# shellcheck disable=SC2269 -f="$f" -# shellcheck disable=SC2269 -fx="$fx" -# shellcheck disable=SC2269 -fs="$fs" -# shellcheck disable=SC2269 -id="$id" - -prompt "Script name: " -name="" -while [ -z "$name" ] || [ -e "$name" ]; do - read -r name_base - name="$name_base.sh" - if [ -e "$name" ]; then - prompt "Script already exists, overwrite [y|N]: " - read -r ans - - if [ "$ans" = "y" ]; then - break - else - prompt "Script Name: " - fi - fi -done - -script="$(pwd)"/"$name" - -cat "%SHELL_LIBRARY_TEMPLATE" >"$script" -chmod +x "$script" -"$VISUAL" "$script" - -# vim: ft=sh diff --git a/modules/by-name/lf/lf/commands/scripts/mk_scr_temp.sh b/modules/by-name/lf/lf/commands/scripts/mk_script.sh index 512b5d0b..a708825d 100755 --- a/modules/by-name/lf/lf/commands/scripts/mk_scr_temp.sh +++ b/modules/by-name/lf/lf/commands/scripts/mk_script.sh @@ -1,7 +1,14 @@ -#! /usr/bin/env dash +# 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 source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH +# shellcheck shell=sh # shellcheck disable=SC2269 f="$f" @@ -23,15 +30,21 @@ while [ -z "$name" ] || [ -e "$name" ]; do if [ "$ans" = "y" ]; then break else - prompt "Script Name: " + prompt "New Script Name: " fi fi done -script="$(pwd)"/"$name" +script="$(pwd)/$name" + +cat <<SCRIPT >"$script" +#! /usr/bin/env sh + + + +# vim: ft=sh +SCRIPT -sed 's|%TO_BE_SHELL_LIBRARY_PATH|%SHELL_LIBRARY_PATH|' "%SHELL_LIBRARY_TEMPLATE" >"$script" -sed -i 's|dash|sh|' "$script" chmod +x "$script" "$VISUAL" "$script" diff --git a/modules/by-name/lf/lf/commands/scripts/restore_trash.sh b/modules/by-name/lf/lf/commands/scripts/restore_trash.sh deleted file mode 100755 index b4ef492f..00000000 --- a/modules/by-name/lf/lf/commands/scripts/restore_trash.sh +++ /dev/null @@ -1,16 +0,0 @@ -#! /usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH - -# shellcheck disable=SC2269 -f="$f" -# shellcheck disable=SC2269 -fx="$fx" -# shellcheck disable=SC2269 -fs="$fs" -# shellcheck disable=SC2269 -id="$id" - -trash list | fzf --multi | awk '{print $NF}' | xargs trash restore --match=exact -# vim: ft=sh diff --git a/modules/by-name/lf/lf/commands/scripts/set_clipboard_path.sh b/modules/by-name/lf/lf/commands/scripts/set_clipboard_path.sh index ff5f3c01..f4cb5115 100755 --- a/modules/by-name/lf/lf/commands/scripts/set_clipboard_path.sh +++ b/modules/by-name/lf/lf/commands/scripts/set_clipboard_path.sh @@ -1,7 +1,14 @@ -#! /usr/bin/env dash +# 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 source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH +# shellcheck shell=sh # shellcheck disable=SC2269 f="$f" @@ -17,10 +24,10 @@ if [ -n "$fx" ]; then elif [ -n "$f" ]; then echo "$f" | wl-copy --trim-newline else - lf -remote "send $id echo 'No file selected.'" + lf_cmd echo "No file selected." exit 1 fi -lf -remote "send $id echo 'Path copied'" +lf_cmd echo "Path copied to clipboard." # vim: ft=sh diff --git a/modules/by-name/lf/lf/commands/scripts/set_wall_paper.sh b/modules/by-name/lf/lf/commands/scripts/set_wall_paper.sh deleted file mode 100755 index 2e607d33..00000000 --- a/modules/by-name/lf/lf/commands/scripts/set_wall_paper.sh +++ /dev/null @@ -1,19 +0,0 @@ -#! /usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH - -# shellcheck disable=SC2269 -f="$f" -# shellcheck disable=SC2269 -fx="$fx" -# shellcheck disable=SC2269 -fs="$fs" -# shellcheck disable=SC2269 -id="$id" - -die "No yet implemented" # TODO: do what the 'die' says -#sed -i "s,export AWMWALLPAPER='.*',export AWMWALLPAPER='${f}'," ${ZDOTDIR}/.zshenv -#nohub swaybg -i "$f" -#feh --bg-max --no-fehbg "$f" -# vim: ft=sh diff --git a/modules/by-name/lf/lf/commands/scripts/set_wallpaper.sh b/modules/by-name/lf/lf/commands/scripts/set_wallpaper.sh new file mode 100755 index 00000000..6311031e --- /dev/null +++ b/modules/by-name/lf/lf/commands/scripts/set_wallpaper.sh @@ -0,0 +1,29 @@ +# 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" + +# Kill all previous instances +pkill swaybg + +# We cannot control the available commands for river. +# Thus we ensure that it can correctly start `swaybg` +swaybg="$(command -v swaybg)" +riverctl spawn "$swaybg --image \"$f\"" && lf_cmd echo "Temporary background image set." +# vim: ft=sh diff --git a/modules/by-name/lf/lf/commands/scripts/stripspace.sh b/modules/by-name/lf/lf/commands/scripts/stripspace.sh index 33b1cbcf..9253b6de 100755 --- a/modules/by-name/lf/lf/commands/scripts/stripspace.sh +++ b/modules/by-name/lf/lf/commands/scripts/stripspace.sh @@ -1,7 +1,14 @@ -#! /usr/bin/env dash +# 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 source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH +# shellcheck shell=sh # shellcheck disable=SC2269 f="$f" @@ -12,29 +19,14 @@ fs="$fs" # shellcheck disable=SC2269 id="$id" -files=$(mktmp) -echo "$fx" >"$files" +echo "$fx" | while read -r file; do + dirty_name=$(basename "$file") + clean_name=$(echo "$dirty_name" | sed 's/[[:blank:]]\+/_/g' | sed 's/\(.*\)/\L\1/') -awk_source=$(mktmp) -cat <<OFT >"$awk_source" -BEGIN {FS=" "} -{for (i=1; i != NF + 1; i++) - if (i == NF) { - parts[i]=tolower(\$i); - } else { - parts[i]=tolower(\$i"_"); - } -} -END {for (i in parts) printf parts[i]} -OFT + [ -e "$clean_name" ] && die "file '$clean_name' already exists!" + mv "$dirty_name" "$clean_name" || die "Move failed" -while read -r file; do - dirty_name=$(mktmp) - basename "$file" >"$dirty_name" - clean_name=$(awk -f "$awk_source" "$dirty_name") - - [ -e "$clean_name" ] && die "file \"$clean_name\" already exists!" - mv "$(cat "$dirty_name")" "$clean_name" || die "Move failed" - lf -remote 'send reload' -done <"$files" + lf_cmd reload + lf_cmd select "$clean_name" +done # vim: ft=sh diff --git a/modules/by-name/lf/lf/commands/scripts/trash.sh b/modules/by-name/lf/lf/commands/scripts/trash.sh index f4878c49..68b36774 100755 --- a/modules/by-name/lf/lf/commands/scripts/trash.sh +++ b/modules/by-name/lf/lf/commands/scripts/trash.sh @@ -1,7 +1,14 @@ -#! /usr/bin/env dash +# 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 source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH +# shellcheck shell=sh # shellcheck disable=SC2269 f="$f" @@ -12,26 +19,9 @@ fs="$fs" # shellcheck disable=SC2269 id="$id" -trash_output=$(mktmp) -expected_error_output=$(mktmp) - while read -r file; do set -- "$@" "$file" -done <"$(tmp echo "$fx")" - -# TODO: why are we using trashy at all, when trash-cli can do everything? -# -# try trashy first, through nix because both trashy and trash-cli provide a trash command, which conflicts -nix run nixpkgs#trashy -- put "$@" 2>"$trash_output" - -# FIXME: Find a way, that does not depend on parsing an error message <2023-08-29> -cat <<EOF >"$expected_error_output" -[1;31merror:[0m Error during a \`trash\` operation: Unknown { description: "Path: '\"/.Trash-1000\"'. Message: Permission denied (os error 13)" } -EOF +done <"$(echo "$fx" | tmp)" -if [ "$(cat "$expected_error_output")" = "$(cat "$trash_output")" ]; then - warning "Deleting with trash-cli to the /.Trash folder" - # this file could not be trashed because it is on the tempfs volume, trash-cli can do this this - trash-put "$@" -fi +trash-put -- "$@" # vim: ft=sh diff --git a/modules/by-name/lf/lf/commands/scripts/trash_clear.sh b/modules/by-name/lf/lf/commands/scripts/trash_clear.sh new file mode 100755 index 00000000..597995f9 --- /dev/null +++ b/modules/by-name/lf/lf/commands/scripts/trash_clear.sh @@ -0,0 +1,19 @@ +# 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 + +while IFS="$(printf '\n')" read -r file; do + set -- "$@" "$(pwd)/$file" +done <"$(conceal list | fzf --multi --ansi | awk '{$1="";$2=""; print $0}' | sed 's/^\s*//' | tmp)" + +[ "$#" -ne 0 ] && trash empty --match=exact "$@" + +# vim: ft=sh diff --git a/modules/by-name/lf/lf/commands/scripts/trash_restore.sh b/modules/by-name/lf/lf/commands/scripts/trash_restore.sh new file mode 100755 index 00000000..7b078c26 --- /dev/null +++ b/modules/by-name/lf/lf/commands/scripts/trash_restore.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" + +while IFS="$(printf '\n')" read -r file; do + set -- "$@" "$(pwd)/$file" +done <"$(conceal list | fzf --multi --ansi | awk '{$1="";$2=""; print $0}' | sed 's/^\s*//' | tmp)" + +[ "$#" -ne 0 ] && trash restore --match=exact "$@" +# vim: ft=sh diff --git a/modules/by-name/lf/lf/commands/scripts/unarchive.sh b/modules/by-name/lf/lf/commands/scripts/unarchive.sh deleted file mode 100755 index d4835f6b..00000000 --- a/modules/by-name/lf/lf/commands/scripts/unarchive.sh +++ /dev/null @@ -1,36 +0,0 @@ -#! /usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH - -# shellcheck disable=SC2269 -f="$f" -# shellcheck disable=SC2269 -fx="$fx" -# shellcheck disable=SC2269 -fs="$fs" -# shellcheck disable=SC2269 -id="$id" - -# extract the current file with the right command -# (xkcd link: https://xkcd.com/1168/) -set -f - -unarchive() { - case "$1" in - *.tar.bz | *.tar.bz2 | *.tbz | *.tbz2) tar xjvf "$1" ;; - *.tar.gz | *.tgz) tar xzvf "$1" ;; - *.tar.xz | *.txz) tar xJvf "$1" ;; - *.zip) unzip "$1" ;; - *.rar) - die "rar is a unfree format!" - ;; - *.7z) 7z x "$1" ;; - *) die "Unsupported format" ;; - esac -} - -while read -r file; do - unarchive "$file" -done <"$fx" -# vim: ft=sh diff --git a/modules/by-name/lf/lf/commands/scripts/view_file.sh b/modules/by-name/lf/lf/commands/scripts/view_file.sh index 6258d755..48cdd85e 100755 --- a/modules/by-name/lf/lf/commands/scripts/view_file.sh +++ b/modules/by-name/lf/lf/commands/scripts/view_file.sh @@ -1,7 +1,14 @@ -#!/usr/bin/env dash +# 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 source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH +# shellcheck shell=sh # shellcheck disable=SC2269 f="$f" @@ -12,7 +19,7 @@ fs="$fs" mime_type="$(file --mime-type --brief --dereference "$f")" case "$mime_type" in -application/pdf) +application/pdf | application/epub*) "$READER" "$f" ;; image/*) diff --git a/modules/by-name/lf/lf/ctpv/default.nix b/modules/by-name/lf/lf/ctpv/default.nix index 3748eca4..6f9988b9 100644 --- a/modules/by-name/lf/lf/ctpv/default.nix +++ b/modules/by-name/lf/lf/ctpv/default.nix @@ -1,5 +1,13 @@ +# 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>. { - sysLib, lib, config, pkgs, @@ -8,15 +16,15 @@ functionCall = { name, dependencies, - replacementStrings, scriptPath, - ... + environment, }: - sysLib.writeShellScript { + pkgs.writeShellApplication { inherit name; - src = scriptPath; - keepPath = false; - inherit replacementStrings dependencies; + text = builtins.readFile ./helpers.sh + builtins.readFile scriptPath; + inheritPath = false; + runtimeInputs = dependencies; + runtimeEnv = environment; } + "/bin/${name}"; @@ -24,8 +32,8 @@ matches, priority, dependencies, - replacementStrings, previewer, + environment, }: let mkMimePath = val: let split = lib.strings.splitString "/" val; @@ -49,7 +57,7 @@ inherit name dependencies - replacementStrings + environment ; scriptPath = previewer; }; @@ -93,6 +101,12 @@ }; }; + environment = lib.mkOption { + type = lib.types.attrsOf lib.types.str; + default = {}; + description = "Environment variables to set for the script"; + }; + previewer = lib.mkOption { type = lib.types.pathInStore; description = "The path to the preview script or binary"; @@ -104,13 +118,6 @@ default = 0; description = "The priority to use this previewer."; }; - replacementStrings = lib.mkOption { - type = lib.types.attrsOf (lib.types.either lib.types.str lib.types.pathInStore); - default = { - HELPERS = ./helpers.sh; - }; - description = "Arbitrary strings to replace in the shell script."; - }; dependencies = lib.mkOption { type = lib.types.listOf lib.types.package; default = []; @@ -153,17 +160,6 @@ in { package = lib.mkPackageOption pkgs "ctpv-64-types" {}; - # TODO: This is necessary, as the `./prev` dir is imported separately and as such - # cannot access the `./helpers.sh` file in it's parent directory. - # This separate import should ideally be removed. <2024-12-15> - helpers = lib.mkOption { - default = ./helpers.sh; - type = lib.types.pathInStore; - - internal = true; - readOnly = true; - }; - previewers = lib.mkOption { description = '' The previewers to add to the config file. diff --git a/modules/by-name/lf/lf/ctpv/helpers.sh b/modules/by-name/lf/lf/ctpv/helpers.sh index 6dc7fee6..71524082 100644 --- a/modules/by-name/lf/lf/ctpv/helpers.sh +++ b/modules/by-name/lf/lf/ctpv/helpers.sh @@ -1,5 +1,15 @@ #! /usr/bin/env dash +# 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 disable=SC2269 cache_f="$cache_f" # shellcheck disable=SC2269 @@ -59,7 +69,7 @@ preview_xxd() { # This has been derived mathematically. octet_columns=$(((2 * w - 22) / 7)) - if [ -n "$CTPV_LESS_PREVIEWER" ]; then + if [ "${CTPV_LESS_PREVIEWER:-unset}" != "-unset" ]; then __base_xxd_preview "$1" else __base_xxd_preview "$1" -len "$((h * octet_columns))" diff --git a/modules/by-name/lf/lf/ctpv/prev/any.sh b/modules/by-name/lf/lf/ctpv/prev/any.sh index 38dfd538..01c31e2b 100644 --- a/modules/by-name/lf/lf/ctpv/prev/any.sh +++ b/modules/by-name/lf/lf/ctpv/prev/any.sh @@ -1,16 +1,23 @@ #! /usr/bin/env dash -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH +# 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 disable=SC2269 f="$f" # shellcheck disable=SC2269 w="$w" # shellcheck disable=SC2269 -e="$e" +e="${e:-[missing extension]}" # shellcheck disable=SC2269 -m="$m" +m="${m:-[missing mime type]}" # shellcheck disable=SC2269 h="$h" @@ -19,8 +26,6 @@ extension="$e" # shellcheck disable=SC2269 mime="$m" -. %HELPERS - is_not_printable() { grep --text --quiet '[^[:print:]]' "$1" } @@ -33,8 +38,8 @@ case "$mime" in *) echo "(ctpv did not recognize this file, with extension: '$extension' and mime: '$mime')" - directory_storage="%STORAGE_DIRECTORY/$mime" - mkdir --parents "$(dirname "%STORAGE_DIRECTORY/$mime")" + directory_storage="$STORAGE_DIRECTORY/$mime" + mkdir --parents "$(dirname "$STORAGE_DIRECTORY/$mime")" printf "%s -- %s\n" "$f" "$extension" >>"$directory_storage" ;; diff --git a/modules/by-name/lf/lf/ctpv/prev/application/archive/atool.sh b/modules/by-name/lf/lf/ctpv/prev/application/archive/atool.sh index 5f4baac7..2bf8a89f 100644 --- a/modules/by-name/lf/lf/ctpv/prev/application/archive/atool.sh +++ b/modules/by-name/lf/lf/ctpv/prev/application/archive/atool.sh @@ -1,11 +1,16 @@ #! /usr/bin/env dash -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH +# 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 disable=SC2269 f="$f" -. %HELPERS - atool --list -- "$f" 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 9370bf14..aee5c732 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 @@ -1,3 +1,12 @@ +# 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, ...}: { soispha.programs.lf.ctpv.previewers = { atool = { @@ -64,7 +73,7 @@ pkgs.atool # archive tools - pkgs.archiver # for arc + # pkgs.archiver # for arc # Unmaintained and insecure # pkgs.arj # NOTE: Fails to build since: 2024-12-28 pkgs.cpio pkgs.dpkg diff --git a/modules/by-name/lf/lf/ctpv/prev/application/dll/default.nix b/modules/by-name/lf/lf/ctpv/prev/application/dll/default.nix index 00c7e389..121f419d 100644 --- a/modules/by-name/lf/lf/ctpv/prev/application/dll/default.nix +++ b/modules/by-name/lf/lf/ctpv/prev/application/dll/default.nix @@ -1,3 +1,12 @@ +# 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, ...}: { soispha.programs.lf.ctpv.previewers = { dll = { diff --git a/modules/by-name/lf/lf/ctpv/prev/application/dll/dll.sh b/modules/by-name/lf/lf/ctpv/prev/application/dll/dll.sh index 678506eb..6ec68d55 100644 --- a/modules/by-name/lf/lf/ctpv/prev/application/dll/dll.sh +++ b/modules/by-name/lf/lf/ctpv/prev/application/dll/dll.sh @@ -1,19 +1,24 @@ #! /usr/bin/env dash -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH +# 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 disable=SC2269 f="$f" # shellcheck disable=SC2269 w="$w" # shellcheck disable=SC2269 -e="$e" +e="${e:-[missing extension]}" # shellcheck disable=SC2269 -m="$m" +m="${m:-[missing mime type]}" # shellcheck disable=SC2269 h="$h" -. %HELPERS - preview_xxd "$f" 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 40510a78..d28503e2 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 @@ -1,3 +1,12 @@ +# 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, ...}: { soispha.programs.lf.ctpv.previewers = { epub = { @@ -5,11 +14,11 @@ matches.mime = ["application/epub+zip"]; matches.extension = ["epub"]; priority = 1; - dependencies = with pkgs; [ - bk - epub-thumbnailer - chafa - gnused + dependencies = [ + pkgs.bk + pkgs.epub-thumbnailer + pkgs.chafa + pkgs.gnused ]; }; }; diff --git a/modules/by-name/lf/lf/ctpv/prev/application/epub/epub.sh b/modules/by-name/lf/lf/ctpv/prev/application/epub/epub.sh index 703e7dad..87c33dff 100644 --- a/modules/by-name/lf/lf/ctpv/prev/application/epub/epub.sh +++ b/modules/by-name/lf/lf/ctpv/prev/application/epub/epub.sh @@ -1,23 +1,28 @@ #! /usr/bin/env dash -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH +# 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 disable=SC2269 f="$f" # shellcheck disable=SC2269 w="$w" # shellcheck disable=SC2269 -e="$e" +e="${e:-[missing extension]}" # shellcheck disable=SC2269 -m="$m" +m="${m:-[missing mime type]}" # shellcheck disable=SC2269 h="$h" # shellcheck disable=SC2269 cache_f="$cache_f" -. %HELPERS - epub() { epub-thumbnailer "$f" "$cache_f" 20000 } 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 d3061ea8..e30aab3e 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 @@ -1,3 +1,12 @@ +# 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, ...}: { soispha.programs.lf.ctpv.previewers = { pdf = { @@ -8,6 +17,7 @@ pkgs.poppler_utils # for `pdftoppm` pkgs.chafa pkgs.gnused + pkgs.coreutils ]; }; }; diff --git a/modules/by-name/lf/lf/ctpv/prev/application/pdf/pdf.sh b/modules/by-name/lf/lf/ctpv/prev/application/pdf/pdf.sh index 2f807b1a..2c2e5ff9 100644 --- a/modules/by-name/lf/lf/ctpv/prev/application/pdf/pdf.sh +++ b/modules/by-name/lf/lf/ctpv/prev/application/pdf/pdf.sh @@ -1,15 +1,20 @@ #! /usr/bin/env dash -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH +# 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 disable=SC2269 f="$f" # shellcheck disable=SC2269 cache_f="$cache_f" -. %HELPERS - pdf() { pdftoppm -f 1 -l 1 \ -scale-to-x 1920 \ diff --git a/modules/by-name/lf/lf/ctpv/prev/application/pgp/default.nix b/modules/by-name/lf/lf/ctpv/prev/application/pgp/default.nix index 32f42783..c9001176 100644 --- a/modules/by-name/lf/lf/ctpv/prev/application/pgp/default.nix +++ b/modules/by-name/lf/lf/ctpv/prev/application/pgp/default.nix @@ -1,3 +1,12 @@ +# 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, ...}: { soispha.programs.lf.ctpv.previewers = { pgp = { diff --git a/modules/by-name/lf/lf/ctpv/prev/application/pgp/pgp.sh b/modules/by-name/lf/lf/ctpv/prev/application/pgp/pgp.sh index a4eefd96..cfe359ea 100644 --- a/modules/by-name/lf/lf/ctpv/prev/application/pgp/pgp.sh +++ b/modules/by-name/lf/lf/ctpv/prev/application/pgp/pgp.sh @@ -1,13 +1,18 @@ #! /usr/bin/env dash -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH +# 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 disable=SC2269 f="$f" # shellcheck disable=SC2269 w="$w" -. %HELPERS - hide_script_env sq inspect --certifications -- "$f" diff --git a/modules/by-name/lf/lf/ctpv/prev/application/sqlite/default.nix b/modules/by-name/lf/lf/ctpv/prev/application/sqlite/default.nix index 54b8c29e..ab200dd9 100644 --- a/modules/by-name/lf/lf/ctpv/prev/application/sqlite/default.nix +++ b/modules/by-name/lf/lf/ctpv/prev/application/sqlite/default.nix @@ -1,3 +1,12 @@ +# 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, ...}: { soispha.programs.lf.ctpv.previewers = { sqlite = { diff --git a/modules/by-name/lf/lf/ctpv/prev/application/sqlite/sqlite.sh b/modules/by-name/lf/lf/ctpv/prev/application/sqlite/sqlite.sh index 07e77a93..2d3a45fe 100644 --- a/modules/by-name/lf/lf/ctpv/prev/application/sqlite/sqlite.sh +++ b/modules/by-name/lf/lf/ctpv/prev/application/sqlite/sqlite.sh @@ -1,15 +1,20 @@ #! /usr/bin/env dash -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH +# 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 disable=SC2269 f="$f" # shellcheck disable=SC2269 w="$w" -. %HELPERS - echo "SQLite database. Schema:" echo diff --git a/modules/by-name/lf/lf/ctpv/prev/application/x-bittorrent/default.nix b/modules/by-name/lf/lf/ctpv/prev/application/x-bittorrent/default.nix index 504623a0..dfd6911b 100644 --- a/modules/by-name/lf/lf/ctpv/prev/application/x-bittorrent/default.nix +++ b/modules/by-name/lf/lf/ctpv/prev/application/x-bittorrent/default.nix @@ -1,3 +1,12 @@ +# 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, ...}: { soispha.programs.lf.ctpv.previewers = { torrent = { diff --git a/modules/by-name/lf/lf/ctpv/prev/application/x-bittorrent/torrent.sh b/modules/by-name/lf/lf/ctpv/prev/application/x-bittorrent/torrent.sh index 16cfcbcd..38838d2e 100644 --- a/modules/by-name/lf/lf/ctpv/prev/application/x-bittorrent/torrent.sh +++ b/modules/by-name/lf/lf/ctpv/prev/application/x-bittorrent/torrent.sh @@ -1,13 +1,18 @@ #! /usr/bin/env dash -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH +# 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 disable=SC2269 f="$f" # shellcheck disable=SC2269 cache_f="$cache_f" -. %HELPERS - transmission-show -- "$f" diff --git a/modules/by-name/lf/lf/ctpv/prev/application/x-pem-file/default.nix b/modules/by-name/lf/lf/ctpv/prev/application/x-pem-file/default.nix new file mode 100644 index 00000000..fb82aa8a --- /dev/null +++ b/modules/by-name/lf/lf/ctpv/prev/application/x-pem-file/default.nix @@ -0,0 +1,20 @@ +# 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, ...}: { + soispha.programs.lf.ctpv.previewers = { + pem = { + previewer = ./pem.sh; + matches.mime = ["application/x-pem-file"]; + dependencies = [ + pkgs.openssl + ]; + }; + }; +} diff --git a/modules/by-name/lf/lf/ctpv/prev/application/x-pem-file/pem.sh b/modules/by-name/lf/lf/ctpv/prev/application/x-pem-file/pem.sh new file mode 100644 index 00000000..2948e25a --- /dev/null +++ b/modules/by-name/lf/lf/ctpv/prev/application/x-pem-file/pem.sh @@ -0,0 +1,18 @@ +#! /usr/bin/env dash + +# 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 disable=SC2269 +f="$f" +# shellcheck disable=SC2269 +cache_f="$cache_f" + +openssl x509 -in "$f" -text -noout diff --git a/modules/by-name/lf/lf/ctpv/prev/audio/audio.sh b/modules/by-name/lf/lf/ctpv/prev/audio/audio.sh index c5abc646..324a2170 100644 --- a/modules/by-name/lf/lf/ctpv/prev/audio/audio.sh +++ b/modules/by-name/lf/lf/ctpv/prev/audio/audio.sh @@ -1,15 +1,20 @@ #! /usr/bin/env dash -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH +# 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 disable=SC2269 f="$f" # shellcheck disable=SC2269 cache_f="$cache_f" -. %HELPERS - audio() { ffmpegthumbnailer -i "$f" -s 0 -q 5 -t 10 -o "$cache_f" 2>/dev/null } 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 0c60e9d5..7ae5d7fd 100644 --- a/modules/by-name/lf/lf/ctpv/prev/audio/default.nix +++ b/modules/by-name/lf/lf/ctpv/prev/audio/default.nix @@ -1,3 +1,12 @@ +# 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, ...}: { soispha.programs.lf.ctpv.previewers = { audio = { @@ -9,6 +18,7 @@ pkgs.chafa pkgs.gnused + pkgs.coreutils ]; }; }; diff --git a/modules/by-name/lf/lf/ctpv/prev/default.nix b/modules/by-name/lf/lf/ctpv/prev/default.nix index b59430f8..d7e420d0 100644 --- a/modules/by-name/lf/lf/ctpv/prev/default.nix +++ b/modules/by-name/lf/lf/ctpv/prev/default.nix @@ -1,3 +1,12 @@ +# 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, config, @@ -10,18 +19,15 @@ in { previewer = ./any.sh; priority = -1; matches.mime = ["*/*"]; - replacementStrings = { - # FIXME: This declaration replaces the default (although it should be merged with - # the default value.) There must be a way, so that repeating the default values is - # not needed. <2024-12-15> - HELPERS = cfg.ctpv.helpers; - + environment = { STORAGE_DIRECTORY = "${cfg.ctpv.xdgDataHome}/ctpv/missing_previews"; }; dependencies = [ pkgs.tinyxxd # For xxd pkgs.bat + pkgs.gnugrep + 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 306e7892..76a284f4 100644 --- a/modules/by-name/lf/lf/ctpv/prev/font/default.nix +++ b/modules/by-name/lf/lf/ctpv/prev/font/default.nix @@ -1,3 +1,12 @@ +# 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, ...}: { soispha.programs.lf.ctpv.previewers = { font = { @@ -13,6 +22,7 @@ pkgs.fontforge # for `fontimage` pkgs.chafa pkgs.gnused + pkgs.coreutils ]; }; }; diff --git a/modules/by-name/lf/lf/ctpv/prev/font/font.sh b/modules/by-name/lf/lf/ctpv/prev/font/font.sh index 4065557e..49e12ec7 100644 --- a/modules/by-name/lf/lf/ctpv/prev/font/font.sh +++ b/modules/by-name/lf/lf/ctpv/prev/font/font.sh @@ -1,15 +1,20 @@ #! /usr/bin/env dash -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH +# 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 disable=SC2269 f="$f" # shellcheck disable=SC2269 cache_f="$cache_f" -. %HELPERS - font() { fontimage -o "$cache_f.png" "$f" 2>/dev/null && mv -- "$cache_f.png" "$cache_f" 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 87fba00c..79037d5a 100644 --- a/modules/by-name/lf/lf/ctpv/prev/image/default.nix +++ b/modules/by-name/lf/lf/ctpv/prev/image/default.nix @@ -1,3 +1,12 @@ +# 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, ...}: { soispha.programs.lf.ctpv.previewers = { image = { diff --git a/modules/by-name/lf/lf/ctpv/prev/image/image.sh b/modules/by-name/lf/lf/ctpv/prev/image/image.sh index b5b97668..d021cbf6 100644 --- a/modules/by-name/lf/lf/ctpv/prev/image/image.sh +++ b/modules/by-name/lf/lf/ctpv/prev/image/image.sh @@ -1,11 +1,16 @@ #! /usr/bin/env dash -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH +# 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 disable=SC2269 f="$f" -. %HELPERS - send_image "$f" 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 90915c84..25bd6f77 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 @@ -1,3 +1,12 @@ +# 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, ...}: { soispha.programs.lf.ctpv.previewers = { svg = { diff --git a/modules/by-name/lf/lf/ctpv/prev/image/svg+xml/svg.sh b/modules/by-name/lf/lf/ctpv/prev/image/svg+xml/svg.sh index 04a06f56..b16e4fc5 100644 --- a/modules/by-name/lf/lf/ctpv/prev/image/svg+xml/svg.sh +++ b/modules/by-name/lf/lf/ctpv/prev/image/svg+xml/svg.sh @@ -1,15 +1,20 @@ #! /usr/bin/env dash -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH +# 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 disable=SC2269 f="$f" # shellcheck disable=SC2269 cache_f="$cache_f" -. %HELPERS - svg() { magick "$f" "jpg:$cache_f" } diff --git a/modules/by-name/lf/lf/ctpv/prev/image/x-xcf/default.nix b/modules/by-name/lf/lf/ctpv/prev/image/x-xcf/default.nix index a3394ef4..5af6c501 100644 --- a/modules/by-name/lf/lf/ctpv/prev/image/x-xcf/default.nix +++ b/modules/by-name/lf/lf/ctpv/prev/image/x-xcf/default.nix @@ -1,3 +1,12 @@ +# 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, ...}: { soispha.programs.lf.ctpv.previewers = { xcf = { diff --git a/modules/by-name/lf/lf/ctpv/prev/image/x-xcf/xcf.sh b/modules/by-name/lf/lf/ctpv/prev/image/x-xcf/xcf.sh index 1603e337..4ad4b34b 100644 --- a/modules/by-name/lf/lf/ctpv/prev/image/x-xcf/xcf.sh +++ b/modules/by-name/lf/lf/ctpv/prev/image/x-xcf/xcf.sh @@ -1,15 +1,20 @@ #! /usr/bin/env dash -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH +# 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 disable=SC2269 f="$f" # shellcheck disable=SC2269 cache_f="$cache_f" -. %HELPERS - xcf() { # TODO: Add this (currently it fails, as gimp lacks the `python-fu` evaluator) <2024-11-25> true diff --git a/modules/by-name/lf/lf/ctpv/prev/inode/default.nix b/modules/by-name/lf/lf/ctpv/prev/inode/default.nix index eaade0f1..fe5ee3e1 100644 --- a/modules/by-name/lf/lf/ctpv/prev/inode/default.nix +++ b/modules/by-name/lf/lf/ctpv/prev/inode/default.nix @@ -1,3 +1,12 @@ +# 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, ...}: { soispha.programs.lf.ctpv.previewers = { ls = { diff --git a/modules/by-name/lf/lf/ctpv/prev/inode/ls.sh b/modules/by-name/lf/lf/ctpv/prev/inode/ls.sh index f73bd1c2..73e036eb 100644 --- a/modules/by-name/lf/lf/ctpv/prev/inode/ls.sh +++ b/modules/by-name/lf/lf/ctpv/prev/inode/ls.sh @@ -1,7 +1,14 @@ #! /usr/bin/env dash -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH +# 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 disable=SC2269 f="$f" @@ -10,6 +17,4 @@ cache_d="$cache_d" # shellcheck disable=SC2269 cache_f="$cache_f" -. %HELPERS - ls --color --group-directories-first -- "$f" diff --git a/modules/by-name/lf/lf/ctpv/prev/inode/symlink.sh b/modules/by-name/lf/lf/ctpv/prev/inode/symlink.sh index b30957d0..2629f62a 100644 --- a/modules/by-name/lf/lf/ctpv/prev/inode/symlink.sh +++ b/modules/by-name/lf/lf/ctpv/prev/inode/symlink.sh @@ -1,13 +1,18 @@ #! /usr/bin/env dash -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH +# 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 disable=SC2269 f="$f" -. %HELPERS - # # do nothing because in src/ctpv.c some kind of a "preview" # is already printed diff --git a/modules/by-name/lf/lf/ctpv/prev/libreoffice.sh b/modules/by-name/lf/lf/ctpv/prev/libreoffice.sh index ec57da0b..ade1038e 100644 --- a/modules/by-name/lf/lf/ctpv/prev/libreoffice.sh +++ b/modules/by-name/lf/lf/ctpv/prev/libreoffice.sh @@ -1,7 +1,14 @@ #! /usr/bin/env dash -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH +# 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 disable=SC2269 f="$f" @@ -10,8 +17,6 @@ cache_d="$cache_d" # shellcheck disable=SC2269 cache_f="$cache_f" -. %HELPERS - doc() { # File produced by libreoffice jpg="$(printf '%s\n' "$f" | sed 's|^.*/||; s|\..*$||')" diff --git a/modules/by-name/lf/lf/ctpv/prev/remove_default_previews.nix b/modules/by-name/lf/lf/ctpv/prev/remove_default_previews.nix index 1407386b..6614fa8d 100644 --- a/modules/by-name/lf/lf/ctpv/prev/remove_default_previews.nix +++ b/modules/by-name/lf/lf/ctpv/prev/remove_default_previews.nix @@ -1,3 +1,12 @@ +# 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>. {...}: { soispha.programs.lf.ctpv.extraConfigPre = '' remove any diff --git a/modules/by-name/lf/lf/ctpv/prev/text/bat.sh b/modules/by-name/lf/lf/ctpv/prev/text/bat.sh index be952aea..b20e9cea 100644 --- a/modules/by-name/lf/lf/ctpv/prev/text/bat.sh +++ b/modules/by-name/lf/lf/ctpv/prev/text/bat.sh @@ -1,13 +1,18 @@ #! /usr/bin/env dash -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH +# 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 disable=SC2269 f="$f" # shellcheck disable=SC2269 w="$w" -. %HELPERS - preview_bat "$f" diff --git a/modules/by-name/lf/lf/ctpv/prev/text/default.nix b/modules/by-name/lf/lf/ctpv/prev/text/default.nix index 14e74a4d..edb6e09d 100644 --- a/modules/by-name/lf/lf/ctpv/prev/text/default.nix +++ b/modules/by-name/lf/lf/ctpv/prev/text/default.nix @@ -1,3 +1,12 @@ +# 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, ...}: { soispha.programs.lf.ctpv.previewers = { glow = { diff --git a/modules/by-name/lf/lf/ctpv/prev/text/diff/default.nix b/modules/by-name/lf/lf/ctpv/prev/text/diff/default.nix index e0fa15bb..f21acd5e 100644 --- a/modules/by-name/lf/lf/ctpv/prev/text/diff/default.nix +++ b/modules/by-name/lf/lf/ctpv/prev/text/diff/default.nix @@ -1,3 +1,12 @@ +# 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, ...}: { soispha.programs.lf.ctpv.previewers = { delta = { diff --git a/modules/by-name/lf/lf/ctpv/prev/text/diff/delta.sh b/modules/by-name/lf/lf/ctpv/prev/text/diff/delta.sh index 6a4e9a4e..d30565df 100644 --- a/modules/by-name/lf/lf/ctpv/prev/text/diff/delta.sh +++ b/modules/by-name/lf/lf/ctpv/prev/text/diff/delta.sh @@ -1,11 +1,16 @@ #! /usr/bin/env dash -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH +# 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 disable=SC2269 f="$f" -. %HELPERS - delta <"$f" diff --git a/modules/by-name/lf/lf/ctpv/prev/text/glow.sh b/modules/by-name/lf/lf/ctpv/prev/text/glow.sh index 301fe675..2e8d9f58 100644 --- a/modules/by-name/lf/lf/ctpv/prev/text/glow.sh +++ b/modules/by-name/lf/lf/ctpv/prev/text/glow.sh @@ -1,15 +1,20 @@ #! /usr/bin/env dash -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH +# 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 disable=SC2269 f="$f" # shellcheck disable=SC2269 w="$w" -. %HELPERS - # Specify the style, to force `glow` to output colors. # tracking issue: https://github.com/charmbracelet/glow/issues/654 # We can't use `hide_script_env` because of some bespoke reason. (It just forces glow to diff --git a/modules/by-name/lf/lf/ctpv/prev/text/html/default.nix b/modules/by-name/lf/lf/ctpv/prev/text/html/default.nix deleted file mode 100644 index 2a7a9a9f..00000000 --- a/modules/by-name/lf/lf/ctpv/prev/text/html/default.nix +++ /dev/null @@ -1,13 +0,0 @@ -{pkgs, ...}: { - # TODO: I might want to use lynx/w3m instead <2024-11-24> - soispha.programs.lf.ctpv.previewers = { - elinks = { - previewer = ./elinks.sh; - priority = 1; - matches.mime = ["text/html"]; - dependencies = [ - pkgs.elinks - ]; - }; - }; -} diff --git a/modules/by-name/lf/lf/ctpv/prev/text/html/elinks.sh b/modules/by-name/lf/lf/ctpv/prev/text/html/elinks.sh deleted file mode 100644 index ca0de22e..00000000 --- a/modules/by-name/lf/lf/ctpv/prev/text/html/elinks.sh +++ /dev/null @@ -1,18 +0,0 @@ -#! /usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH - -# shellcheck disable=SC2269 -f="$f" -# shellcheck disable=SC2269 -w="$w" - -. %HELPERS - -elinks \ - -dump 1 -dump-width "$w" \ - -no-references -no-numbering <"$f" - -# lynx -dump -nonumbers -nolist -width="$w" -- "$f" -# w3m -dump "$f" diff --git a/modules/by-name/lf/lf/ctpv/prev/text/json/default.nix b/modules/by-name/lf/lf/ctpv/prev/text/json/default.nix index 7e2ef090..9538c365 100644 --- a/modules/by-name/lf/lf/ctpv/prev/text/json/default.nix +++ b/modules/by-name/lf/lf/ctpv/prev/text/json/default.nix @@ -1,3 +1,12 @@ +# 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, ...}: { soispha.programs.lf.ctpv.previewers = { jq = { diff --git a/modules/by-name/lf/lf/ctpv/prev/text/json/jq.sh b/modules/by-name/lf/lf/ctpv/prev/text/json/jq.sh index bf807d1d..fa7c47b6 100644 --- a/modules/by-name/lf/lf/ctpv/prev/text/json/jq.sh +++ b/modules/by-name/lf/lf/ctpv/prev/text/json/jq.sh @@ -1,11 +1,16 @@ #! /usr/bin/env dash -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH +# 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 disable=SC2269 f="$f" -. %HELPERS - jq --color-output . <"$f" 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 f38f61c7..d500fbd9 100644 --- a/modules/by-name/lf/lf/ctpv/prev/video/default.nix +++ b/modules/by-name/lf/lf/ctpv/prev/video/default.nix @@ -1,3 +1,12 @@ +# 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, ...}: { soispha.programs.lf.ctpv.previewers = { video = { diff --git a/modules/by-name/lf/lf/ctpv/prev/video/video.sh b/modules/by-name/lf/lf/ctpv/prev/video/video.sh index e42e3612..dac75205 100644 --- a/modules/by-name/lf/lf/ctpv/prev/video/video.sh +++ b/modules/by-name/lf/lf/ctpv/prev/video/video.sh @@ -1,15 +1,20 @@ #! /usr/bin/env dash -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH +# 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 disable=SC2269 f="$f" # shellcheck disable=SC2269 cache_f="$cache_f" -. %HELPERS - video() { ffmpegthumbnailer -i "$f" -o "$cache_f" -s 0 -t 50% 2>/dev/null } diff --git a/modules/by-name/lf/lf/icons.license b/modules/by-name/lf/lf/icons.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/modules/by-name/lf/lf/icons.license @@ -0,0 +1,9 @@ +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/by-name/lf/lf/keybindings/default.nix b/modules/by-name/lf/lf/keybindings/default.nix index f624719f..d4c2a6a3 100644 --- a/modules/by-name/lf/lf/keybindings/default.nix +++ b/modules/by-name/lf/lf/keybindings/default.nix @@ -1,3 +1,12 @@ +# 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>. { uid, downloadDir, @@ -36,21 +45,18 @@ cp = "set_clipboard_path"; # Archive Mappings - au = "unarchive"; - aa = "archive"; + au = "archive_decompress"; + aa = "archive_compress"; # Trash Mappings dd = "trash"; - jc = "clear_trash"; - jr = "restore_trash"; + jc = "trash_clear"; + jr = "trash_restore"; # Dragon Mapping dr = "dragon"; - ds = "dragon-stay"; - di = "dragon-individual"; - #dm = "mvdragon"; - #dc = "cpdragon"; - dl = "dlfile"; + ds = "dragon_stay"; + di = "dragon_individual"; cs = "stripspace"; @@ -68,17 +74,15 @@ y = "copy"; "<enter>" = "open"; - mk = "mk_ln"; + mk = "mk_link"; mf = "mk_file"; - me = "mk_file_and_edit"; - md = "mk_dir"; - ms = "mk_scr_default"; - mt = "mk_scr_temp"; + md = "mk_directory"; + ms = "mk_script"; ch = "chmod"; - bg = "set_wall_paper"; + bg = "set_wallpaper"; r = ":rename; cmd-end"; - H = "go_project_base_directory"; + H = "cd_project_root"; R = "reload"; C = "clear"; U = "unselect"; diff --git a/modules/by-name/lf/lf/module.nix b/modules/by-name/lf/lf/module.nix index 6dc8e919..ea9970ef 100644 --- a/modules/by-name/lf/lf/module.nix +++ b/modules/by-name/lf/lf/module.nix @@ -1,3 +1,12 @@ +# 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, config, @@ -10,6 +19,8 @@ commands = import ./commands {inherit pkgs sysLib shell_library system;}; keybindings = import ./keybindings {inherit (cfg.keymaps) uid downloadDir;}; + packages = import ./wrappers {inherit pkgs;}; + cfg = config.soispha.programs.lf; in { imports = [ @@ -49,6 +60,11 @@ in { "lf/colors".source = ./colors; }; + programs.zsh.shellAliases = { + ll = ". ${lib.getExe packages.ll}"; + lm = ". ${lib.getExe packages.lm}"; + }; + programs.lf = { enable = true; @@ -75,7 +91,7 @@ in { icons = true; ifs = "\\n"; # internal field separator for shell commands #info = "size"; # show the size of a directory - shell = "sh"; + shell = "${lib.getExe pkgs.dash}"; shellopts = "-eu"; # e: exit on error; u: error for unset variables }; extraConfig = '' diff --git a/modules/by-name/lf/lf/wrappers/default.nix b/modules/by-name/lf/lf/wrappers/default.nix new file mode 100644 index 00000000..7257a66e --- /dev/null +++ b/modules/by-name/lf/lf/wrappers/default.nix @@ -0,0 +1,4 @@ +{pkgs}: { + ll = pkgs.callPackage ./ll {}; + lm = pkgs.callPackage ./lm {}; +} diff --git a/modules/by-name/lf/lf/wrappers/ll/default.nix b/modules/by-name/lf/lf/wrappers/ll/default.nix new file mode 100644 index 00000000..6e4ee336 --- /dev/null +++ b/modules/by-name/lf/lf/wrappers/ll/default.nix @@ -0,0 +1,18 @@ +# 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>. +{writeShellApplication}: +writeShellApplication { + name = "ll"; + text = builtins.readFile ./ll.sh; + + # This is sourced in the shell + inheritPath = true; + bashOptions = []; +} diff --git a/modules/by-name/lf/lf/wrappers/ll/ll.sh b/modules/by-name/lf/lf/wrappers/ll/ll.sh new file mode 100755 index 00000000..e012cffa --- /dev/null +++ b/modules/by-name/lf/lf/wrappers/ll/ll.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env dash + +# 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>. + +last_directory="$(mktemp)" +cleanup() { + rm "$last_directory" +} +trap cleanup EXIT + +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!" +fi + +# vim: ft=sh diff --git a/modules/by-name/lf/lf/wrappers/lm/default.nix b/modules/by-name/lf/lf/wrappers/lm/default.nix new file mode 100644 index 00000000..42bdc687 --- /dev/null +++ b/modules/by-name/lf/lf/wrappers/lm/default.nix @@ -0,0 +1,18 @@ +# 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>. +{writeShellApplication}: +writeShellApplication { + name = "lm"; + text = builtins.readFile ./lm.sh; + + # This is sourced in the shell + inheritPath = true; + bashOptions = []; +} diff --git a/modules/by-name/lf/lf/wrappers/lm/lm.sh b/modules/by-name/lf/lf/wrappers/lm/lm.sh new file mode 100755 index 00000000..71213721 --- /dev/null +++ b/modules/by-name/lf/lf/wrappers/lm/lm.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env dash + +# 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>. + +die() { + echo "ERROR: $1" + exit 1 +} + +msg() { + echo "$1" +} + +if [ -f "$XDG_RUNTIME_DIR/ll/last_directory" ]; then + last_dir="$(cat "$XDG_RUNTIME_DIR/ll/last_directory")" + cd "$last_dir" || die "$last_dir does not exist!" +else + msg "No last directory saved (try using ll instead)." +fi +# vim: ft=sh diff --git a/modules/by-name/li/libvirtd/module.nix b/modules/by-name/li/libvirtd/module.nix index 5c519550..ba1cc2e1 100644 --- a/modules/by-name/li/libvirtd/module.nix +++ b/modules/by-name/li/libvirtd/module.nix @@ -1,4 +1,15 @@ -{pkgs, ...}: { +# 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>. +{...}: { + # FIXME(@bpeetz): Do something with this module. <2025-04-04> + # virtualisation = { # spiceUSBRedirection.enable = true; # TODO: this allows usb access to any user, which shouldn't be that bad # cores = 8; diff --git a/modules/by-name/lo/locale/keymaps/dvorak_modified.xkb.license b/modules/by-name/lo/locale/keymaps/dvorak_modified.xkb.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/modules/by-name/lo/locale/keymaps/dvorak_modified.xkb.license @@ -0,0 +1,9 @@ +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/by-name/lo/locale/keymaps/us_modified.xkb b/modules/by-name/lo/locale/keymaps/us_modified.xkb deleted file mode 100644 index 6299a5e9..00000000 --- a/modules/by-name/lo/locale/keymaps/us_modified.xkb +++ /dev/null @@ -1,9 +0,0 @@ -partial alphanumeric_keys -xkb_symbols "us-modified" { - name[Group1]= "US English with caps lock key as compose key"; - - - include "us(basic)" - include "compose(caps)" -}; -// vim: ft=xkb diff --git a/modules/by-name/lo/locale/module.nix b/modules/by-name/lo/locale/module.nix index 10569216..17096731 100644 --- a/modules/by-name/lo/locale/module.nix +++ b/modules/by-name/lo/locale/module.nix @@ -1,3 +1,12 @@ +# 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, @@ -42,11 +51,6 @@ in { }; services.xserver.xkb.extraLayouts = { - "us-modified" = { - description = "standard us with caps as compose key."; - languages = ["eng" "swe" "deu"]; - symbolsFile = ./keymaps/us_modified.xkb; - }; "dvorak-modified" = { description = "standard dvorak english with german and swedish extra chars."; languages = ["eng" "swe" "deu"]; diff --git a/modules/by-name/ma/mako/module.nix b/modules/by-name/ma/mako/module.nix new file mode 100644 index 00000000..1630d2d0 --- /dev/null +++ b/modules/by-name/ma/mako/module.nix @@ -0,0 +1,81 @@ +# 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, + ... +}: let + cfg = config.soispha.services.mako; + + iconPath = "${pkgs.gruvbox-dark-icons-gtk.overrideAttrs (prev: final: { + # Remove unused dependencies + propagatedBuildInputs = []; + })}/share/icons/oomox-gruvbox-dark"; +in { + options.soispha.services.mako = { + enable = lib.mkEnableOption "mako"; + }; + + config = lib.mkIf cfg.enable { + home-manager.users.soispha = { + services.mako = { + enable = true; + + # See mako(5) + settings = { + max-history = 5; + sort = "-time"; + + background-color = "#2e3440"; + border-color = "#88c0d0"; + border-radius = 25; + border-size = 2; + default-timeout = 5000; + font = "Source Code Pro 10"; + group-by = "body"; + height = 500; + icon-path = iconPath; + icons = true; + ignore-timeout = false; + layer = "overlay"; + markup = true; + max-icon-size = 64; + width = 500; + + "urgency=low" = { + border-color = "#cccccc"; + }; + + "urgency=normal" = { + border-color = "#d08770"; + }; + + "urgency=high" = { + border-size = 3; + border-color = "#bf616a"; + default-timeout = 0; + }; + + "urgency=critical" = { + border-size = 4; + border-color = "#bf616a"; + default-timeout = 0; + }; + + "category=mpd" = { + default-timeout = 2000; + group-by = "category"; + }; + }; + }; + }; + }; +} diff --git a/modules/by-name/mp/mpd/module.nix b/modules/by-name/mp/mpd/module.nix index 6f045f9f..b7c7ab5a 100644 --- a/modules/by-name/mp/mpd/module.nix +++ b/modules/by-name/mp/mpd/module.nix @@ -1,3 +1,12 @@ +# 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, diff --git a/modules/by-name/mp/mpd/mpc.nix b/modules/by-name/mp/mpd/mpc.nix index 031465fe..cd4a4ec0 100644 --- a/modules/by-name/mp/mpd/mpc.nix +++ b/modules/by-name/mp/mpd/mpc.nix @@ -1,3 +1,12 @@ +# 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, @@ -5,7 +14,6 @@ ... }: let cfg = config.soispha.services.mpd.mpc; - parentCfg = config.soispha.services.mpd; in { options.soispha.services.mpd.mpc = { enable = lib.mkEnableOption "mpc with extensions"; @@ -29,9 +37,7 @@ in { beets = cfg.beetsPkg; }) # Displays the lyrics of the currently playing song - (pkgs.mpp-lyrics.override { - mpd_music_dir = parentCfg.directories.music; - }) + pkgs.mpp-lyrics ]; }; } diff --git a/modules/by-name/mp/mpd/mpdconf.example.license b/modules/by-name/mp/mpd/mpdconf.example.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/modules/by-name/mp/mpd/mpdconf.example.license @@ -0,0 +1,9 @@ +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/by-name/mp/mpv/module.nix b/modules/by-name/mp/mpv/module.nix new file mode 100644 index 00000000..7c8435d5 --- /dev/null +++ b/modules/by-name/mp/mpv/module.nix @@ -0,0 +1,54 @@ +# 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, + ... +}: let + cfg = config.soispha.programs.mpv; +in { + options.soispha.programs.mpv = { + enable = lib.mkEnableOption "mpv"; + }; + + config.home-manager.users.soispha = lib.mkIf cfg.enable { + programs.mpv = { + enable = true; + + bindings = { + q = "quit 0"; + "Ctrl+c" = "quit 1"; + "Shift+q" = "quit-watch-later 1"; + }; + config = { + osd-bar = true; + + border = false; + }; + scriptOpts = { + osc = { + scalewindowed = 0.8; + hidetimeout = 300; + }; + thumbfast = { + hwdec = true; + network = false; + spawn_first = false; + max_height = 250; + max_width = 250; + }; + }; + scripts = with pkgs.mpvScripts; [ + thumbfast + ]; + }; + }; +} diff --git a/modules/by-name/ne/networking/module.nix b/modules/by-name/ne/networking/module.nix index 8448e9b3..6f8633e8 100644 --- a/modules/by-name/ne/networking/module.nix +++ b/modules/by-name/ne/networking/module.nix @@ -1,3 +1,12 @@ +# 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, diff --git a/modules/by-name/zs/zsh/config/command_not_found/command_not_found.sh b/modules/by-name/ni/nix-index/command_not_found.sh index fb21b676..f650cf7b 100644 --- a/modules/by-name/zs/zsh/config/command_not_found/command_not_found.sh +++ b/modules/by-name/ni/nix-index/command_not_found.sh @@ -1,5 +1,15 @@ #!/usr/bin/env dash +# 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>. + # This was taken from the # `${pkgs.nix-index}/etc/profile.d/command-not-found.sh` file on 2024-02-28 @@ -48,7 +58,7 @@ EOF The program '$cmd' is currently not installed. It is provided by several packages. You can run it once with: EOF - awk --assign=toplevel="$toplevel" 'BEGIN{counter=0} {printf("%3s)", counter); printf(" nix shell %s#%s\n", toplevel, $1); counter+=1}' "$(ptmp "$attrs")" + echo "$attrs" | awk --assign=toplevel="$toplevel" 'BEGIN{counter=0} {printf("%3s)", counter); printf(" nix shell %s#%s\n", toplevel, $1); counter+=1}' ;; esac diff --git a/modules/by-name/ni/nix-index/module.nix b/modules/by-name/ni/nix-index/module.nix new file mode 100644 index 00000000..06acfc8a --- /dev/null +++ b/modules/by-name/ni/nix-index/module.nix @@ -0,0 +1,44 @@ +# 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, + modules, + ... +}: let + cfg = config.soispha.programs.nix-index; +in { + options.soispha.programs.nix-index = { + enable = lib.mkEnableOption "nix-index"; + }; + + config = lib.mkIf cfg.enable { + soispha.programs.zsh.integrations.nix-index = ./command_not_found.sh; + home-manager.users.soispha = { + imports = [ + modules.nix-index-database.hmModules.nix-index + ]; + + programs.nix-index = { + enable = true; + symlinkToCacheHome = true; + + # Handled by myself (and the script is overridden) + enableBashIntegration = false; + enableZshIntegration = false; + enableFishIntegration = false; + }; + + programs.nix-index-database = { + comma.enable = false; + }; + }; + }; +} diff --git a/modules/by-name/ni/nix/module.nix b/modules/by-name/ni/nix/module.nix index 767ab076..2b91f59b 100644 --- a/modules/by-name/ni/nix/module.nix +++ b/modules/by-name/ni/nix/module.nix @@ -1,22 +1,32 @@ +# 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, # flakes - nixpkgs_as_input, - templates, self, system, + externalDependencies, ... }: { + # TODO(@bpeetz): Modularize <2025-02-08> + nix = { - package = pkgs.lix; + package = pkgs.lixPackageSets.latest.lix; # Disable nix channels (this is a remnant of old days) channel.enable = false; registry = { - nixpkgs.flake = nixpkgs_as_input; + nixpkgs.flake = self.inputs.nixpkgs; n.flake = - nixpkgs_as_input + self.inputs.nixpkgs // { # Otherwise nixpkgs's config and overlays are not available: @@ -25,7 +35,7 @@ legacyPackages."${system}" = pkgs; }; - t.flake = templates; + t.flake = externalDependencies.templates; my_flake.flake = self; m.flake = self; @@ -52,7 +62,7 @@ fallback = true; # Build from source, if binary can't be substituted - keep-failed = true; # keep failed tmp build dirs + 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 diff --git a/modules/by-name/ni/nixos-shell/module.nix b/modules/by-name/ni/nixos-shell/module.nix new file mode 100644 index 00000000..219f080d --- /dev/null +++ b/modules/by-name/ni/nixos-shell/module.nix @@ -0,0 +1,128 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Jörg Thalheim and contributors +# SPDX-License-Identifier: MIT +# +# 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, + pkgs, + self, + ... +}: let + cfg = config.soispha.nixos-shell; +in { + options.soispha.nixos-shell = { + enable = lib.mkEnableOption "nixos-shell"; + + user_name = lib.mkOption { + type = lib.types.str; + default = "soispha"; + description = "The user to auto-login into the vm."; + }; + + configuration = { + specialArgs = lib.mkOption { + type = lib.types.attrsOf lib.types.anything; + default = {}; + description = '' + The arguments to pass to the `specialArgs` attribute set. + ''; + }; + value = lib.mkOption { + type = lib.types.deferredModule; + default = {}; + description = '' + Additional NixOS configuration to load into the VM's config. + ''; + }; + }; + + mounts = lib.mkOption { + type = lib.types.attrsOf (lib.types.submodule ({config, ...}: { + options = { + target = lib.mkOption { + type = lib.types.path; + description = "Target on the guest."; + }; + + cache_mode = lib.mkOption { + type = lib.types.enum ["none" "loose" "fscache" "mmap"]; + default = "loose"; # bad idea? Well, at least it is fast!1!! + description = "9p caching policy"; + }; + + readOnly = + (lib.mkEnableOption "mount this disk in read-only mode") + // { + default = true; + }; + + tag = lib.mkOption { + type = lib.types.str; + internal = true; + }; + }; + + config.tag = lib.mkDefault ( + builtins.substring 0 31 ( # tags must be shorter than 32 bytes + "a" + + # tags must not begin with a digit + builtins.hashString "md5" config._module.args.name + ) + ); + })); + default = {}; + description = '' + Extra paths to make available in the vm. + These will be mounted ro to their `target.` + ''; + }; + }; + + config = let + vmSystem = self.inputs.nixpkgs.lib.nixosSystem { + inherit (cfg.configuration) specialArgs; + + modules = [ + { + # TODO(@bpeetz): This should be bumped each release. <2025-05-17> + system.stateVersion = "25.05"; + } + + cfg.configuration.value + + (import ./shell_setup.nix {inherit cfg;}) + ]; + }; + + nixos-shell = pkgs.writeShellApplication { + name = "nixos-shell"; + text = builtins.readFile ./nixos-shell.sh; + + # We need to keep the PATH, as we otherwise can't pass it along. + inheritPath = true; + + runtimeInputs = [ + vmSystem.config.system.build.vm + pkgs.mktemp + pkgs.coreutils + pkgs.moreutils # for sponge + ]; + runtimeEnv = { + HOST_NAME = vmSystem.config.system.name; + }; + }; + in + lib.mkIf cfg.enable { + environment.systemPackages = [ + nixos-shell + ]; + + system.build.nixos-shell = vmSystem.config.system.build.vm; + }; +} diff --git a/modules/by-name/ni/nixos-shell/nixos-shell.sh b/modules/by-name/ni/nixos-shell/nixos-shell.sh new file mode 100755 index 00000000..390e60b1 --- /dev/null +++ b/modules/by-name/ni/nixos-shell/nixos-shell.sh @@ -0,0 +1,60 @@ +#!/usr/bin/env dash + +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Jörg Thalheim and contributors +# SPDX-License-Identifier: MIT +# +# 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>. + +SHARED_DIR="$(mktemp --directory)" +cleanup() { + rm --recursive "$SHARED_DIR" +} +trap cleanup EXIT +export SHARED_DIR + +TMPDIR="$SHARED_DIR" +export TMPDIR + +cat <<EOF >"$SHARED_DIR/.env_variables" +{ + "pwd": "$PWD", + "term": "$TERM", + "path": "$PATH" +} +EOF + +mk_tag() { + additional_path="$1" + + # tags must be shorter than 32 bytes + # and must not begin with a digit. + { + printf "a" + echo "$additional_path" | sha256sum | head -c 30 + } +} + +for raw_additional_path in "$@"; do + additional_path="$(realpath "$raw_additional_path")" + tag="$(mk_tag "$additional_path")" + + if [ "$(jq --arg mount "$tag" '.mount.[$mount]' "$SHARED_DIR/.env_variables")" != "null" ]; then + echo "Path '$additional_path' alread added." + shift 1 + continue + fi + + jq --arg mount "$tag" --arg target "$additional_path" \ + '. + {mount: {$mount: $target}}' "$SHARED_DIR/.env_variables" | sponge "$SHARED_DIR/.env_variables" + + set -- "$@" -virtfs "local,path=$additional_path,security_model=none,readonly=on,mount_tag=$tag" + shift 1 +done + +# Do not exec here, as we don't want to lose our cleanup hooks. +"run-$HOST_NAME-vm" "$@" diff --git a/modules/by-name/ni/nixos-shell/shell_setup.nix b/modules/by-name/ni/nixos-shell/shell_setup.nix new file mode 100644 index 00000000..75af0678 --- /dev/null +++ b/modules/by-name/ni/nixos-shell/shell_setup.nix @@ -0,0 +1,191 @@ +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Jörg Thalheim and contributors +# SPDX-License-Identifier: MIT +# +# 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>. +# This file contains the code that is used to setup the VM shell. +{cfg}: { + lib, + config, + pkgs, + modulesPath, + ... +}: let + mkVMDefault = lib.mkOverride 970; + + env_file = "/tmp/shared/.env_variables"; +in { + imports = [ + (modulesPath + "/profiles/qemu-guest.nix") + (modulesPath + "/virtualisation/qemu-vm.nix") + ]; + + config = { + assertions = [ + { + assertion = builtins.elem cfg.user_name (lib.mapAttrsToList (name: value: name) config.users.users); + message = '' + Your user ${cfg.user_name} is not a recorded user in `config.users.users`. + Auto-login will not work. + ''; + } + ]; + + # Lock root login. + users.users.root.hashedPassword = ""; + + # Remove unneeded clutter. + system.switch.enable = false; + + virtualisation = { + # See https://wiki.qemu.org/Documentation/9psetup#Performance_Considerations. + # It is effectively a balance between ram and IO speed. + msize = let + kib = x: x * 1024; + in + mkVMDefault (kib 512); + + graphics = mkVMDefault false; + memorySize = mkVMDefault 1700; # in MB + cores = mkVMDefault 16; + + # Do not persist this VM. + diskImage = mkVMDefault null; + + fileSystems = + lib.mapAttrs' + (_: mount: { + name = mount.target; + + value = { + device = mount.tag; + fsType = "9p"; + options = + [ + "trans=virtio" + "version=9p2000.L" + "cache=${mount.cache_mode}" + "msize=${toString config.virtualisation.msize}" + ] + ++ lib.optionals mount.readOnly ["ro"]; + }; + }) + cfg.mounts; + + qemu = { + consoles = lib.mkIf (!config.virtualisation.graphics) ["tty0" "hvc0"]; + + options = let + mkMount = options: "-virtfs " + (builtins.concatStringsSep "," options); + in + lib.optionals (!config.virtualisation.graphics) [ + "-serial null" + "-device virtio-serial" + "-chardev stdio,mux=on,id=char0,signal=off" + "-mon chardev=char0,mode=readline" + "-device virtconsole,chardev=char0,nr=0" + ] + ++ (lib.mapAttrsToList + (hostPath: mount: + mkMount [ + "local" + "path=${builtins.toString hostPath}" + "security_model=none" + "readonly=on" + "mount_tag=${mount.tag}" + ]) + cfg.mounts); + }; + }; + + services = { + getty.helpLine = '' + If you are connect via serial console: + Type Ctrl-a c to switch to the qemu console + and `quit` to stop the VM. + ''; + + getty.autologinUser = cfg.user_name; + }; + + system.activationScripts = { + mountAdditionalPaths = + # bash + '' + PATH="${pkgs.jq}/bin:${pkgs.util-linux}/bin:$PATH" + export PATH + + max_index="$(jq '.mount | keys | length' --raw-output ${env_file})" + index=0 + + mount --mkdir --type=tmpfs none "/.rw" --options=rw,relatime,mode=0755 + while [ "$index" -lt "$max_index" ]; do + what="$(jq --argjson index "$index" '.mount | keys | map(.)[$index]' --raw-output ${env_file})" + where="$(jq --argjson index "$index" '.mount | map(.)[$index]' --raw-output ${env_file})" + + mkdir "/.rw/$what" + mount --mkdir "$what" "/.ro/$what" \ + --type=9p \ + --options=ro,trans=virtio,version=9p2000.L,msize=${toString config.virtualisation.msize},x-systemd.requires=modprobe@9pnet_virtio.service + + mkdir "/.rw/work-$what" + mount --mkdir --type=overlay overlay \ + --options=rw,relatime,lowerdir="/.ro/$what",upperdir="/.rw/$what",workdir="/.rw/work-$what",uuid=on \ + "/.ov/$what" + + index="$((index + 1))" + done + ''; + }; + + systemd.services.mountAdditionalPaths = { + after = ["local-fs.target"]; + wantedBy = ["multi-user.target"]; + path = [pkgs.jq]; + script = + # bash + '' + max_index="$(jq '.mount | keys | length' --raw-output ${env_file})" + index=0 + + while [ "$index" -lt "$max_index" ]; do + what="$(jq --argjson index "$index" '.mount | keys | map(.)[$index]' --raw-output ${env_file})" + where="$(jq --argjson index "$index" '.mount | map(.)[$index]' --raw-output ${env_file})" + + systemd-mount --type none "/.ov/$what" "$where" --options=bind + + # HACK(@bpeetz): Nearly all of the paths are in $HOME anyways. So simply avoid + # the permission issue. + # Ideally, we would pass the original owners along with the mount. <2025-05-17> + chown --recursive soispha:users "/home/soispha" + + index="$((index + 1))" + done + ''; + }; + + environment = { + systemPackages = [ + pkgs.jq + ]; + + sessionVariables = { + IN_NIXOS_SHELL = "true"; + }; + + loginShellInit = + # bash + '' + cd "$(jq '.pwd' --raw-output ${env_file})" + export TERM="$(jq '.term' --raw-output ${env_file})" + export PATH="$(jq '.path' --raw-output ${env_file}):$PATH" + ''; + }; + + networking.firewall.enable = mkVMDefault true; + }; +} diff --git a/modules/by-name/ni/nixpkgs/config.nix b/modules/by-name/ni/nixpkgs/config.nix index 1a24444d..ea8f3c45 100644 --- a/modules/by-name/ni/nixpkgs/config.nix +++ b/modules/by-name/ni/nixpkgs/config.nix @@ -1,10 +1,19 @@ +# 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>. { cfg, - myPkgs, lib, + packageSets, ... }: let - myPkgsOverlay = self: super: myPkgs; + myPkgsOverlay = self: super: packageSets.soispha; in { nixpkgs = { hostPlatform = cfg.systemName; @@ -22,6 +31,12 @@ in { allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ "pypemicro" # required by pynitrokey + + # TODO(@bpeetz): Allow moving them to their respective module. <2025-04-25> + "steam" + "steam-unwrapped" + "steam-original" + "steam-run" ]; }; }; diff --git a/modules/by-name/ni/nixpkgs/module.nix b/modules/by-name/ni/nixpkgs/module.nix index eda3ac89..fcde9505 100644 --- a/modules/by-name/ni/nixpkgs/module.nix +++ b/modules/by-name/ni/nixpkgs/module.nix @@ -1,8 +1,18 @@ +# 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, + packageSets, ... -} @ args: let +}: let cfg = config.soispha.nixpkgs; in { options.soispha.nixpkgs = { @@ -13,5 +23,35 @@ in { type = lib.types.str; }; }; - config = lib.mkIf cfg.enable (import ./config.nix (args // {inherit cfg;})); + config = let + myPkgsOverlay = self: super: packageSets.soispha; + in + lib.mkIf cfg.enable + { + nixpkgs = { + hostPlatform = cfg.systemName; + + overlays = [ + myPkgsOverlay + ]; + + config = { + # TODO: this fails because of the root tempsize, which should be increased + # contentAddressedByDefault = true; + + hostSystem = cfg.systemName; + + allowUnfreePredicate = pkg: + builtins.elem (lib.getName pkg) [ + "pypemicro" # required by pynitrokey + + # TODO(@bpeetz): Allow moving them to their respective module. <2025-04-25> + "steam" + "steam-unwrapped" + "steam-original" + "steam-run" + ]; + }; + }; + }; } diff --git a/modules/by-name/nv/nvim/autocmds/default.nix b/modules/by-name/nv/nvim/autocmds/default.nix index 54fd6831..706f1bbd 100644 --- a/modules/by-name/nv/nvim/autocmds/default.nix +++ b/modules/by-name/nv/nvim/autocmds/default.nix @@ -1,3 +1,12 @@ +# 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, diff --git a/modules/by-name/nv/nvim/clipboard/default.nix b/modules/by-name/nv/nvim/clipboard/default.nix index 4cc3bd8a..f6348e44 100644 --- a/modules/by-name/nv/nvim/clipboard/default.nix +++ b/modules/by-name/nv/nvim/clipboard/default.nix @@ -1,3 +1,12 @@ +# 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, diff --git a/modules/by-name/nv/nvim/mappings/default.nix b/modules/by-name/nv/nvim/mappings/default.nix index 4b6344c2..4997f66c 100644 --- a/modules/by-name/nv/nvim/mappings/default.nix +++ b/modules/by-name/nv/nvim/mappings/default.nix @@ -1,3 +1,12 @@ +# 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, @@ -18,34 +27,6 @@ in { action = "<cmd>noh<CR><Esc>"; options.desc = "Disable the search highlighting and send Escape"; } - { - key = "hh"; - mode = ["i"]; - action.__raw = '' - function() - local cmp = require('cmp'); - local luasnip = require('luasnip'); - - if cmp.visible() then - cmp.select_next_item() - elseif luasnip.expand_or_locally_jumpable() then - luasnip.expand_or_jump() - end - end - ''; - options.desc = "completion trigger/ forward in completen menu"; - } - { - key = "uu"; - mode = ["i"]; - action.__raw = '' - function() - local cmp = require('cmp'); - cmp.confirm() - end - ''; - options.desc = "confirm the selected item"; - } { key = "<C-Tab>"; diff --git a/modules/by-name/nv/nvim/module.nix b/modules/by-name/nv/nvim/module.nix index 69e417bb..819646d6 100644 --- a/modules/by-name/nv/nvim/module.nix +++ b/modules/by-name/nv/nvim/module.nix @@ -1,7 +1,17 @@ +# 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, lib, config, + modules, ... }: let cfg = config.soispha.programs.nvim; @@ -24,6 +34,10 @@ in { config = lib.mkIf cfg.enable { home-manager.users.soispha = { + imports = [ + modules.nixvim.homeManagerModules.nixvim + ]; + home.sessionVariables = { EDITOR = "nvim"; VISUAL = "nvim"; @@ -32,6 +46,9 @@ in { programs.nixvim = { enable = true; + # Use my global nixpkgs set, instead of constructing a separate one. + nixpkgs.useGlobalPackages = true; + # source: https://www.patorjk.com/software/taag/#p=display&f=ANSI%20Shadow&t=Neovim extraConfigLuaPre = lib.mkBefore '' --------------------------------------------------------------------------- diff --git a/modules/by-name/nv/nvim/options/default.nix b/modules/by-name/nv/nvim/options/default.nix index be475b13..301f0ac0 100644 --- a/modules/by-name/nv/nvim/options/default.nix +++ b/modules/by-name/nv/nvim/options/default.nix @@ -1,3 +1,12 @@ +# 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, @@ -23,7 +32,6 @@ in { confirm = true; # confirm to save changes before closing modified buffer colorcolumn = "+1"; # show a +1 before the 'textwidth' - completeopt = ["menuone" "noselect"]; # have a better completion experience # https://www.compart.com/en/unicode/U+XXXX (unicode character code) fillchars = { diff --git a/modules/by-name/nv/nvim/plgs/colorscheme/default.nix b/modules/by-name/nv/nvim/plgs/colorscheme/default.nix index ebc26826..f8cd5892 100644 --- a/modules/by-name/nv/nvim/plgs/colorscheme/default.nix +++ b/modules/by-name/nv/nvim/plgs/colorscheme/default.nix @@ -1,3 +1,12 @@ +# 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, config, diff --git a/modules/by-name/nv/nvim/plgs/colorscheme/lua/mk_todos_readable.lua b/modules/by-name/nv/nvim/plgs/colorscheme/lua/mk_todos_readable.lua index d02171b5..44c76084 100644 --- a/modules/by-name/nv/nvim/plgs/colorscheme/lua/mk_todos_readable.lua +++ b/modules/by-name/nv/nvim/plgs/colorscheme/lua/mk_todos_readable.lua @@ -1,3 +1,13 @@ +-- 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>. + local opts = { bg = "NONE", bold = true } ---@param hl_group string: The name of the hl group diff --git a/modules/by-name/nv/nvim/plgs/colorscheme/lua/nightfox.lua b/modules/by-name/nv/nvim/plgs/colorscheme/lua/nightfox.lua index 4c502153..38f6f0a1 100644 --- a/modules/by-name/nv/nvim/plgs/colorscheme/lua/nightfox.lua +++ b/modules/by-name/nv/nvim/plgs/colorscheme/lua/nightfox.lua @@ -1,3 +1,13 @@ +-- 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>. + require("nightfox").setup({ options = { -- Compiled file's destination location diff --git a/modules/by-name/nv/nvim/plgs/comment-nvim/default.nix b/modules/by-name/nv/nvim/plgs/comment-nvim/default.nix index bd70c5c2..b404843e 100644 --- a/modules/by-name/nv/nvim/plgs/comment-nvim/default.nix +++ b/modules/by-name/nv/nvim/plgs/comment-nvim/default.nix @@ -1,3 +1,12 @@ +# 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, diff --git a/modules/by-name/nv/nvim/plgs/debugprint/default.nix b/modules/by-name/nv/nvim/plgs/debugprint/default.nix index 4a3af1c5..79e557bd 100644 --- a/modules/by-name/nv/nvim/plgs/debugprint/default.nix +++ b/modules/by-name/nv/nvim/plgs/debugprint/default.nix @@ -1,3 +1,12 @@ +# 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, lib, diff --git a/modules/by-name/nv/nvim/plgs/debugprint/lua/debugprint.lua b/modules/by-name/nv/nvim/plgs/debugprint/lua/debugprint.lua index da7e1735..b934d619 100644 --- a/modules/by-name/nv/nvim/plgs/debugprint/lua/debugprint.lua +++ b/modules/by-name/nv/nvim/plgs/debugprint/lua/debugprint.lua @@ -1,3 +1,13 @@ +-- 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>. + require("debugprint").setup({ create_keymaps = false, }) diff --git a/modules/by-name/nv/nvim/plgs/default.nix b/modules/by-name/nv/nvim/plgs/default.nix index 991bc315..aaebb3b1 100644 --- a/modules/by-name/nv/nvim/plgs/default.nix +++ b/modules/by-name/nv/nvim/plgs/default.nix @@ -1,3 +1,12 @@ +# 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>. {...}: { imports = [ diff --git a/modules/by-name/nv/nvim/plgs/femaco/default.nix b/modules/by-name/nv/nvim/plgs/femaco/default.nix index adf0ba63..a30bb59f 100644 --- a/modules/by-name/nv/nvim/plgs/femaco/default.nix +++ b/modules/by-name/nv/nvim/plgs/femaco/default.nix @@ -1,3 +1,12 @@ +# 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, lib, 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 c113e4c7..1371a825 100644 --- a/modules/by-name/nv/nvim/plgs/femaco/lua/femaco.lua +++ b/modules/by-name/nv/nvim/plgs/femaco/lua/femaco.lua @@ -1,3 +1,13 @@ +-- 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>. + local clip_val = require("femaco.utils").clip_val require("femaco").setup({ -- should prepare a new buffer and return the winid diff --git a/modules/by-name/nv/nvim/plgs/flatten-nvim/default.nix b/modules/by-name/nv/nvim/plgs/flatten-nvim/default.nix index c1ace4ac..8d61d859 100644 --- a/modules/by-name/nv/nvim/plgs/flatten-nvim/default.nix +++ b/modules/by-name/nv/nvim/plgs/flatten-nvim/default.nix @@ -1,3 +1,12 @@ +# 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, lib, @@ -6,7 +15,8 @@ }: let cfg = config.soispha.programs.nvim; in { - home-manager.users.soispha.programs.nixvim = lib.mkIf cfg.enable { + # TODO: Get this plugin working again <2025-01-29> + home-manager.users.soispha.programs.nixvim = lib.mkIf false { # TODO: package flatten-nvim though a module extraConfigLuaPre = '' diff --git a/modules/by-name/nv/nvim/plgs/flatten-nvim/lua/flatten-nvim.lua b/modules/by-name/nv/nvim/plgs/flatten-nvim/lua/flatten-nvim.lua index 2cdbcdde..0c86cd27 100644 --- a/modules/by-name/nv/nvim/plgs/flatten-nvim/lua/flatten-nvim.lua +++ b/modules/by-name/nv/nvim/plgs/flatten-nvim/lua/flatten-nvim.lua @@ -1,3 +1,13 @@ +-- 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>. + ---Types: -- -- Passed to callbacks that handle opening files diff --git a/modules/by-name/nv/nvim/plgs/goto-preview/default.nix b/modules/by-name/nv/nvim/plgs/goto-preview/default.nix index 5c56fe8c..93761dfd 100644 --- a/modules/by-name/nv/nvim/plgs/goto-preview/default.nix +++ b/modules/by-name/nv/nvim/plgs/goto-preview/default.nix @@ -1,3 +1,12 @@ +# 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, lib, diff --git a/modules/by-name/nv/nvim/plgs/goto-preview/lua/goto-preview.lua b/modules/by-name/nv/nvim/plgs/goto-preview/lua/goto-preview.lua index 9687a5a0..ad285033 100644 --- a/modules/by-name/nv/nvim/plgs/goto-preview/lua/goto-preview.lua +++ b/modules/by-name/nv/nvim/plgs/goto-preview/lua/goto-preview.lua @@ -1,3 +1,13 @@ +-- 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>. + require("goto-preview").setup({ width = 120, -- Width of the floating window height = 15, -- Height of the floating window diff --git a/modules/by-name/nv/nvim/plgs/harpoon/default.nix b/modules/by-name/nv/nvim/plgs/harpoon/default.nix index 05a40d9f..c85c7c80 100644 --- a/modules/by-name/nv/nvim/plgs/harpoon/default.nix +++ b/modules/by-name/nv/nvim/plgs/harpoon/default.nix @@ -1,100 +1,53 @@ +# 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, - config, lib, + config, ... }: let - numbers = ["0" "1" "2" "3" "4" "5" "6" "7" "8" "9"]; - mkNumberedCommand = { - command_template, - prefix, - number, - desc_template, - }: { - key = "${prefix}${number}"; - action.__raw = '' - function() - ${command_template number} - end - ''; - options.desc = "${desc_template number}"; - }; - mkGotoTerminalCommand = number: let - desc_template = number: "Goto terminal number ${number}"; - command_template = number: ''require("harpoon.term").gotoTerminal(${number})''; - prefix = "gt"; - in - mkNumberedCommand {inherit desc_template command_template prefix number;}; - mkGotoFileCommand = number: let - desc_template = number: "Goto Buffer number ${number}"; - command_template = number: ''require("harpoon.ui").nav_file(${number})''; - prefix = "gf"; - in - mkNumberedCommand {inherit desc_template command_template prefix number;}; - - gotoTerminalMappings = builtins.map mkGotoTerminalCommand numbers; - gotoFileMappings = builtins.map mkGotoFileCommand numbers; cfg = config.soispha.programs.nvim; in { home-manager.users.soispha.programs.nixvim = lib.mkIf cfg.enable { - plugins.harpoon = { - enable = true; - package = pkgs.vimPlugins.harpoon; - enableTelescope = true; - # menu.width = "vim.api.nvim_win_get_width(0) - 4"; # TODO: integrate that - keymaps = { - tmuxGotoTerminal = null; # TODO: - }; - }; + plugins.harpoon.enable = true; + keymaps = - [ - { - key = "-"; - action.__raw = '' + lib.mapAttrsToList + (key: action: { + mode = "n"; + inherit key; + action.__raw = builtins.elemAt action 0; + options.silent = true; + options.desc = builtins.elemAt action 1; + }) + { + # add current file + "<leader><leader>" = [ + # lua + '' function() - require("harpoon.ui").nav_next() - end - ''; - options.desc = "go to the next marked file"; - } - { - key = "_"; - action.__raw = '' - function() - require("harpoon.ui").nav_prev() - end - ''; - options.desc = "go to the previous marked file"; - } - { - key = "<leader><leader>"; - action.__raw = '' - function() - require("harpoon.mark").add_file() - end - ''; - options.desc = "add a mark to the open file in harpoon."; - } - { - key = "gqc"; - action.__raw = '' - function() - require("harpoon.cmd-ui").toggle_quick_menu() + require("harpoon"):list():add() end - ''; - options.desc = "toggle the harpoon command quick menu to see all commands."; - } - { - key = "<leader>q"; - action.__raw = '' + '' + "Add a mark to the open file in harpoon." + ]; + + # open menu + "<leader>q" = [ + # lua + '' function() - require("harpoon.ui").toggle_quick_menu() + require("harpoon").ui:toggle_quick_menu(require("harpoon"):list()) end - ''; - options.desc = "toggle the harpoon normal quick menu to see all marks."; - } - ] - ++ gotoFileMappings - ++ gotoTerminalMappings; + '' + "Toggle the harpoon normal quick menu to see all marks." + ]; + }; }; } diff --git a/modules/by-name/nv/nvim/plgs/leap/default.nix b/modules/by-name/nv/nvim/plgs/leap/default.nix index 57e78879..e5c42d2f 100644 --- a/modules/by-name/nv/nvim/plgs/leap/default.nix +++ b/modules/by-name/nv/nvim/plgs/leap/default.nix @@ -1,3 +1,12 @@ +# 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, diff --git a/modules/by-name/nv/nvim/plgs/lf-nvim/default.nix b/modules/by-name/nv/nvim/plgs/lf-nvim/default.nix index 5e2836b0..3a1c6bf9 100644 --- a/modules/by-name/nv/nvim/plgs/lf-nvim/default.nix +++ b/modules/by-name/nv/nvim/plgs/lf-nvim/default.nix @@ -1,3 +1,12 @@ +# 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, lib, @@ -6,16 +15,14 @@ }: let cfg = config.soispha.programs.nvim; in { + # TODO: package lf-nvim though a module + # TODO: change the nvim path, when I change the path with lf home-manager.users.soispha.programs.nixvim = lib.mkIf cfg.enable { - # TODO: package lf-nvim though a module - # FIXME: change the nvim path, when I change the path with lf extraConfigLuaPost = '' ${lib.strings.fileContents ./lua/lf-nvim.lua} ''; extraPlugins = [ - pkgs.vimExtraPlugins.lf-nvim - - pkgs.vimPlugins.toggleterm-nvim # required by lf-nvim + pkgs.vimPlugins.lf-nvim ]; }; } diff --git a/modules/by-name/nv/nvim/plgs/lf-nvim/lua/lf-nvim.lua b/modules/by-name/nv/nvim/plgs/lf-nvim/lua/lf-nvim.lua index 1eadf375..8c40ab50 100644 --- a/modules/by-name/nv/nvim/plgs/lf-nvim/lua/lf-nvim.lua +++ b/modules/by-name/nv/nvim/plgs/lf-nvim/lua/lf-nvim.lua @@ -1,3 +1,13 @@ +-- 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>. + local fn = vim.fn -- Defaults diff --git a/modules/by-name/nv/nvim/plgs/lsp-progress-nvim/default.nix b/modules/by-name/nv/nvim/plgs/lsp-progress-nvim/default.nix index 1a2fb6eb..85458310 100644 --- a/modules/by-name/nv/nvim/plgs/lsp-progress-nvim/default.nix +++ b/modules/by-name/nv/nvim/plgs/lsp-progress-nvim/default.nix @@ -1,3 +1,12 @@ +# 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, diff --git a/modules/by-name/nv/nvim/plgs/lsp-progress-nvim/lua/lsp-progress-nvim.lua b/modules/by-name/nv/nvim/plgs/lsp-progress-nvim/lua/lsp-progress-nvim.lua index 5a2cff26..2886d821 100644 --- a/modules/by-name/nv/nvim/plgs/lsp-progress-nvim/lua/lsp-progress-nvim.lua +++ b/modules/by-name/nv/nvim/plgs/lsp-progress-nvim/lua/lsp-progress-nvim.lua @@ -1,3 +1,13 @@ +-- 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>. + --- @type table<string, any> require("lsp-progress").setup({ -- Spinning icons. diff --git a/modules/by-name/nv/nvim/plgs/lsp/default.nix b/modules/by-name/nv/nvim/plgs/lsp/default.nix index d97f2f0a..27a6f909 100644 --- a/modules/by-name/nv/nvim/plgs/lsp/default.nix +++ b/modules/by-name/nv/nvim/plgs/lsp/default.nix @@ -1,3 +1,12 @@ +# 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, diff --git a/modules/by-name/nv/nvim/plgs/lsp/keymaps/default.nix b/modules/by-name/nv/nvim/plgs/lsp/keymaps/default.nix index 903e8c17..7cc9f6d5 100644 --- a/modules/by-name/nv/nvim/plgs/lsp/keymaps/default.nix +++ b/modules/by-name/nv/nvim/plgs/lsp/keymaps/default.nix @@ -1,3 +1,12 @@ +# 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, diff --git a/modules/by-name/nv/nvim/plgs/lsp/servers/default.nix b/modules/by-name/nv/nvim/plgs/lsp/servers/default.nix index 605046d4..8ff130fe 100644 --- a/modules/by-name/nv/nvim/plgs/lsp/servers/default.nix +++ b/modules/by-name/nv/nvim/plgs/lsp/servers/default.nix @@ -1,3 +1,12 @@ +# 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>. {...}: { imports = [ # ./servers/pylyzer.nix diff --git a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/bashls.nix b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/bashls.nix index 5a37e133..8d2b0d03 100644 --- a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/bashls.nix +++ b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/bashls.nix @@ -1,3 +1,12 @@ +# 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, diff --git a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/ccls.nix b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/ccls.nix index 9f3195fa..eed7f349 100644 --- a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/ccls.nix +++ b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/ccls.nix @@ -1,3 +1,12 @@ +# 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, diff --git a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/ltex.nix b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/ltex.nix index 03b7d4c1..e55cf377 100644 --- a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/ltex.nix +++ b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/ltex.nix @@ -1,3 +1,12 @@ +# 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, diff --git a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/lua-ls.nix b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/lua-ls.nix index 39e4b989..9350cd37 100644 --- a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/lua-ls.nix +++ b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/lua-ls.nix @@ -1,3 +1,12 @@ +# 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, diff --git a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/nil-ls.nix b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/nil-ls.nix index 94ca99ce..3b7e2523 100644 --- a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/nil-ls.nix +++ b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/nil-ls.nix @@ -1,3 +1,12 @@ +# 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, diff --git a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/openscad.nix b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/openscad.nix index 94f7b067..fba1113f 100644 --- a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/openscad.nix +++ b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/openscad.nix @@ -1,3 +1,12 @@ +# 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, diff --git a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/pylyzer.nix b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/pylyzer.nix index 3ac66102..47e8de7a 100644 --- a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/pylyzer.nix +++ b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/pylyzer.nix @@ -1,3 +1,12 @@ +# 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, diff --git a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/quick-lint-js.nix b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/quick-lint-js.nix index 48a3a71c..82d3b5a9 100644 --- a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/quick-lint-js.nix +++ b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/quick-lint-js.nix @@ -1,3 +1,12 @@ +# 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, diff --git a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/ruff-lsp.nix b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/ruff-lsp.nix index 57cb8366..4f9834ee 100644 --- a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/ruff-lsp.nix +++ b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/ruff-lsp.nix @@ -1,3 +1,12 @@ +# 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, config, diff --git a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/rust-analyzer.nix b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/rust-analyzer.nix index 093f5250..fd344c50 100644 --- a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/rust-analyzer.nix +++ b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/rust-analyzer.nix @@ -1,3 +1,12 @@ +# 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, diff --git a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/texlab.nix b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/texlab.nix index 1fe3c764..5f001177 100644 --- a/modules/by-name/nv/nvim/plgs/lsp/servers/servers/texlab.nix +++ b/modules/by-name/nv/nvim/plgs/lsp/servers/servers/texlab.nix @@ -1,3 +1,12 @@ +# 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, diff --git a/modules/by-name/nv/nvim/plgs/lspkind/default.nix b/modules/by-name/nv/nvim/plgs/lspkind/default.nix index 078d607d..6e966ad1 100644 --- a/modules/by-name/nv/nvim/plgs/lspkind/default.nix +++ b/modules/by-name/nv/nvim/plgs/lspkind/default.nix @@ -1,3 +1,12 @@ +# 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, diff --git a/modules/by-name/nv/nvim/plgs/ltex_extra/default.nix b/modules/by-name/nv/nvim/plgs/ltex_extra/default.nix index c37a7591..a01d5653 100644 --- a/modules/by-name/nv/nvim/plgs/ltex_extra/default.nix +++ b/modules/by-name/nv/nvim/plgs/ltex_extra/default.nix @@ -1,3 +1,12 @@ +# 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, config, diff --git a/modules/by-name/nv/nvim/plgs/ltex_extra/lua/ltex_extra.lua b/modules/by-name/nv/nvim/plgs/ltex_extra/lua/ltex_extra.lua index d532428a..883b22c4 100644 --- a/modules/by-name/nv/nvim/plgs/ltex_extra/lua/ltex_extra.lua +++ b/modules/by-name/nv/nvim/plgs/ltex_extra/lua/ltex_extra.lua @@ -1,3 +1,13 @@ +-- 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>. + require("ltex_extra").setup({ -- table <string> : languages for witch dictionaries will be loaded, e.g. { "es-AR", "en-US" } -- https://valentjn.github.io/ltex/supported-languages.html#natural-languages diff --git a/modules/by-name/nv/nvim/plgs/lualine/default.nix b/modules/by-name/nv/nvim/plgs/lualine/default.nix index 2f3bb552..7a69519b 100644 --- a/modules/by-name/nv/nvim/plgs/lualine/default.nix +++ b/modules/by-name/nv/nvim/plgs/lualine/default.nix @@ -1,3 +1,12 @@ +# 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, diff --git a/modules/by-name/nv/nvim/plgs/luasnip/default.nix b/modules/by-name/nv/nvim/plgs/luasnip/default.nix index f67c9899..222b5070 100644 --- a/modules/by-name/nv/nvim/plgs/luasnip/default.nix +++ b/modules/by-name/nv/nvim/plgs/luasnip/default.nix @@ -1,3 +1,12 @@ +# 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, @@ -7,14 +16,81 @@ cfg = config.soispha.programs.nvim; in { home-manager.users.soispha.programs.nixvim = lib.mkIf cfg.enable { + keymaps = [ + { + key = "<C-K>"; + mode = ["i"]; + action.__raw = '' + function() + require('luasnip').expand() + end + ''; + options = { + # silent = true; + desc = "Expand the snippet"; + }; + } + { + key = "<C-L>"; + mode = ["i" "s"]; + action.__raw = '' + function() + require('luasnip').jump(1) + end + ''; + options = { + # silent = true; + desc = "Jump forward in snippet insert nodes"; + }; + } + { + key = "<C-J>"; + mode = ["i" "s"]; + action.__raw = '' + function() + require('luasnip').jump(-1) + end + ''; + options = { + # silent = true; + desc = "Jump backwards in snippet insert nodes"; + }; + } + { + key = "<C-E>"; + mode = ["i" "s"]; + action.__raw = '' + function() + if require('luasnip').choice_active() then + require('luasnip').change_choice(1) + end + end + ''; + options = { + # silent = true; + desc = "Cycle through the snippets choice nodes"; + }; + } + ]; plugins.luasnip = { enable = true; + + settings = { + # Enable auto triggered snippets. + enable_autosnippets = true; + + # Use Tab to trigger visual selection. + store_selection_keys = "<Tab>"; + }; + + fromLua = [ + { + paths = ./snippets; + lazyLoad = true; + } + ]; }; - extraConfigLuaPost = '' - ${lib.strings.fileContents ./lua/luasnip.lua}; - require("luasnip.loaders.from_lua").load({paths = "${./lua/snippets}"}); - require("luasnip.loaders.from_lua").lazy_load({paths = "${./lua/snippets}"}); - ''; + extraPlugins = [ # needed for the todo-comments snippets pkgs.vimPlugins.comment-nvim diff --git a/modules/by-name/nv/nvim/plgs/luasnip/lua/luasnip.lua b/modules/by-name/nv/nvim/plgs/luasnip/lua/luasnip.lua deleted file mode 100644 index a05fa57f..00000000 --- a/modules/by-name/nv/nvim/plgs/luasnip/lua/luasnip.lua +++ /dev/null @@ -1,7 +0,0 @@ -require("luasnip").config.set_config({ - -- Enable auto triggered snippets - enable_autosnippets = true, - - -- Use Tab (or some other key if you prefer) to trigger visual selection - store_selection_keys = "<Tab>", -}) diff --git a/modules/by-name/nv/nvim/plgs/luasnip/lua/snippets/all.lua b/modules/by-name/nv/nvim/plgs/luasnip/lua/snippets/all.lua deleted file mode 100644 index 2b923f20..00000000 --- a/modules/by-name/nv/nvim/plgs/luasnip/lua/snippets/all.lua +++ /dev/null @@ -1,211 +0,0 @@ -local ls = require("luasnip") --- auto_pairs {{{ -local get_visual = function(args, parent) - if #parent.snippet.env.SELECT_RAW > 0 then - return sn(nil, i(1, parent.snippet.env.SELECT_RAW)) - else - return sn(nil, i(1, "")) - end -end -local function char_count_same(c1, c2) - local line = vim.api.nvim_get_current_line() - -- '%'-escape chars to force explicit match (gsub accepts patterns). - -- second return value is number of substitutions. - local _, ct1 = string.gsub(line, "%" .. c1, "") - local _, ct2 = string.gsub(line, "%" .. c2, "") - return ct1 == ct2 -end - -local function even_count(c, ...) - local line = vim.api.nvim_get_current_line() - local _, ct = string.gsub(line, c, "") - return ct % 2 == 0 -end - --- This makes creation of pair-type snippets easier. -local function pair(pair_begin, pair_end, file_types, condition_function) - -- FIXME(@Soispha): This only works if file_types == nil, otherwise the snippet does not expand. - -- It would be nice, if it would support both an empty array (`{}`) and nil <2023-08-27> - -- file_types = file_types or {}; - - return s( - { trig = pair_begin, wordTrig = false, snippetType = "autosnippet" }, - { t({ pair_begin }), d(1, get_visual), t({ pair_end }) }, - { - condition = function() - local filetype_check = true - 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, - } - ) -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), -} - -ls.add_snippets("all", auto_pairs, { type = "snippets", key = "auto_pairs" }) --- }}} - --- todo_comments {{{ -local calculate_comment_string = require("Comment.ft").calculate -local utils = require("Comment.utils") - -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 - local result = handle:read("*a") - handle:close() - -- stripped = string.gsub(str, '%s+', '') - return string.gsub(result, "\n", "") -end - -local name_to_handle = function(name) - -- from: https://stackoverflow.com/a/7615129 - local split = function(inputstr, sep) - local t = {} - for str in string.gmatch(inputstr, "([^" .. sep .. "]+)") do - table.insert(t, str) - end - return t - end - - local parts = split(name, "%s") - - local output_name = "" - if #parts > 2 then - for _, val in ipairs(parts) do - output_name = string.format("%s%s", output_name, val:sub(1, 1)) - end - elseif #parts == 2 then - output_name = string.format("%s%s", parts[1]:sub(1, 1), parts[2]) - elseif #parts == 1 then - output_name = parts[1] - else - -- parts is 0 - output_name = "<NoName>" - end - return string.format("@%s", output_name:lower()) -end - -_G.luasnip = {} -_G.luasnip.vars = { - username = function() return name_to_handle(read_git_config("user.name")) end, - email = function() return read_git_config("user.email") end, -} - ---- Get the comment string {beg,end} table ----@param ctype integer 1 for `line`-comment and 2 for `block`-comment ----@return table comment_strings {begcstring, endcstring} -local get_cstring = function(ctype) - -- 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 = ctype, range = utils.get_region() }) or vim.bo.commentstring - -- 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 { left, right } -end - ---- Options for marks to be used in a TODO comment ----@return table,table: The first table contains a node for the date, the second for the signature -local marks = { - signature = function() return t("(" .. _G.luasnip.vars:username() .. ")"), t("") end, - date_signature = function() return t("<" .. os.date("%Y-%m-%d") .. ">"), t("(" .. _G.luasnip.vars:username() .. ")") end, - date = function() return t("<" .. os.date("%Y-%m-%d") .. ">"), t("") end, - empty = function() return t(""), t("") end, -} - ----@param alias string ----@param opts table ----@param mark_function function: This function should return two nodes ----@return table: Returns the comment node -local todo_snippet_nodes = function(alias, opts, mark_function) - local date_node, signature_node = mark_function() - -- format them into the actual snippet - local comment_node = fmta("<> <><>: <> <> <>", { - f(function() - return get_cstring(opts.ctype)[1] -- get <comment-string[1]> - end), - t(alias), -- [name-of-comment] - signature_node, - i(0), -- {comment-text} - date_node, - f(function() - return get_cstring(opts.ctype)[2] -- get <comment-string[2]> - end), - }) - return comment_node -end - ---- Generate a TODO comment snippet with an automatic description and docstring ----@param context table merged with the generated context table `trig` must be specified ----@param alias string of aliases for the todo comment (ex.: {FIX, ISSUE, FIXIT, BUG}) ----@param opts table merged with the snippet opts table ----@param mark_function function: The function used to get the marks -local todo_snippet = function(context, alias, opts, mark_function) - opts = opts or {} - context = context or {} - if not context.trig then - return error("context doesn't include a `trig` key which is mandatory", 2) -- all we need from the context is the trigger - end - opts.ctype = opts.ctype or 1 -- comment type can be passed in the `opts` table, but if it is not, we have to ensure, it is defined - local alias_string = alias -- `choice_node` documentation - context.name = context.name or (alias_string .. " comment") -- generate the `name` of the snippet if not defined - context.dscr = context.dscr or (alias_string .. " comment with a signature-mark") -- generate the `dscr` if not defined - context.docstring = context.docstring or (" {1:" .. alias_string .. "}: {3} <{2:mark}>{0} ") -- generate the `docstring` if not defined - local comment_node = todo_snippet_nodes(alias, opts, mark_function) - return s(context, comment_node, opts) -- the final todo-snippet constructed from our parameters -end - ----@param context table: The luasnip context ----@param opts table: The luasnip opts table, needs to have a ctype set ----@param aliases string: All aliases for a name ----@param marks table: Possible marks to account in snipped generation ----@return table: All possible snippets build from the marks -local process_marks = function(context, aliases, opts, marks) - local output = {} - for mark_name, mark_function in pairs(marks) do - local contex_trig_local = context.trig - context.trig = context.trig .. "-" .. mark_name - output[#output + 1] = todo_snippet(context, aliases, opts, mark_function) - context.trig = contex_trig_local - end - return output -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 } }, - - -- 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 } }, -} - -local todo_comment_snippets = {} -for _, v in ipairs(todo_snippet_specs) do - local snippets = process_marks(v[1], v[2][1], v[3], marks) - for _, value in pairs(snippets) do - table.insert(todo_comment_snippets, value) - end -end - -ls.add_snippets("all", todo_comment_snippets, { type = "snippets", key = "todo_comments" }) - --- }}} diff --git a/modules/by-name/nv/nvim/plgs/luasnip/lua/snippets/html/html.lua b/modules/by-name/nv/nvim/plgs/luasnip/lua/snippets/html/html.lua deleted file mode 100644 index 568c97ec..00000000 --- a/modules/by-name/nv/nvim/plgs/luasnip/lua/snippets/html/html.lua +++ /dev/null @@ -1,102 +0,0 @@ -local get_visual = function(args, parent) - if #parent.snippet.env.SELECT_RAW > 0 then - return sn(nil, i(1, parent.snippet.env.SELECT_RAW)) - else - return sn(nil, i(1)) - end -end - -local line_begin = require("luasnip.extras.expand_conditions").line_begin - -return { - -- HEADER - s( - { - trig = "h([123456])", - regTrig = true, - wordTrig = false, - snippetType = "autosnippet", - }, - fmt( - [[ - <h{}>{}</h{}> - ]], - { - f(function(_, snip) return snip.captures[1] end), - d(1, get_visual), - f(function(_, snip) return snip.captures[1] end), - } - ), - { condition = line_begin } - ), -- PARAGRAPH - s( - { trig = "pp", snippetType = "autosnippet" }, - fmt( - [[ - <p>{}</p> - ]], - { d(1, get_visual) } - ), - { condition = line_begin } - ), -- UNORDERED LIST - s( - { trig = "itt", snippetType = "autosnippet" }, - fmt( - [[ - <ul> - <li>{}</li>{} - </ul> - ]], - { i(1), i(0) } - ), - { condition = line_begin } - ), -- LIST ITEM - s( - { trig = "ii", snippetType = "autosnippet" }, - fmt( - [[ - <li>{}</li> - ]], - { d(1, get_visual) } - ), - { condition = line_begin } - ), - -- DOCUMENT TEMPLATE - s( - { trig = "base" }, - fmt( - [[ - <!doctype HTML> - <html lang="en"> - <head> - <meta charset="UTF-8"> - <title>{}</title> - </head> - <body> - {} - </body> - </html> - ]], - { i(1, "FooBar"), i(0) } - ), - { condition = line_begin } - ), -- ANCHOR TAG - s( - { - trig = "([^%l])aa", - regTrig = true, - wordTrig = false, - snippetType = "autosnippet", - }, - fmt( - [[ - {}<a href="{}">{}</a> - ]], - { - f(function(_, snip) return snip.captures[1] end), - i(1), - d(2, get_visual), - } - ) - ), -} diff --git a/modules/by-name/nv/nvim/plgs/luasnip/lua/snippets/tex/delimiter.lua b/modules/by-name/nv/nvim/plgs/luasnip/lua/snippets/tex/delimiter.lua deleted file mode 100644 index ef453973..00000000 --- a/modules/by-name/nv/nvim/plgs/luasnip/lua/snippets/tex/delimiter.lua +++ /dev/null @@ -1,28 +0,0 @@ -local get_visual = function(args, parent) - if #parent.snippet.env.SELECT_RAW > 0 then - return sn(nil, i(1, parent.snippet.env.SELECT_RAW)) - else - return sn(nil, i(1, "")) - end -end - -local translation_table = { ["("] = ")", ["{"] = "}", ["["] = "]" } - --- Return snippet tables -return { - -- LEFT/RIGHT ALL BRACES - s( - { - trig = "([^%a])l([%(%[%{])", - regTrig = true, - wordTrig = false, - snippetType = "autosnippet", - }, - fmta("<>\\left<><>\\right<>", { - f(function(_, snip) return snip.captures[1] end), - f(function(_, snip) return snip.captures[2] end), - d(1, get_visual), - f(function(_, snip) return translation_table[snip.captures[2]] end), - }) - ), -} diff --git a/modules/by-name/nv/nvim/plgs/luasnip/lua/snippets/tex/greek.lua b/modules/by-name/nv/nvim/plgs/luasnip/lua/snippets/tex/greek.lua deleted file mode 100644 index ebf4f9d7..00000000 --- a/modules/by-name/nv/nvim/plgs/luasnip/lua/snippets/tex/greek.lua +++ /dev/null @@ -1,37 +0,0 @@ --- Return snippet tables -return { - s({ trig = ";a", snippetType = "autosnippet" }, { t("\\alpha") }), - s({ trig = ";b", snippetType = "autosnippet" }, { t("\\beta") }), - s({ trig = ";g", snippetType = "autosnippet" }, { t("\\gamma") }), - s({ trig = ";G", snippetType = "autosnippet" }, { t("\\Gamma") }), - s({ trig = ";d", snippetType = "autosnippet" }, { t("\\delta") }), - s({ trig = ";D", snippetType = "autosnippet" }, { t("\\Delta") }), - s({ trig = ";e", snippetType = "autosnippet" }, { t("\\epsilon") }), - s({ trig = ";ve", snippetType = "autosnippet" }, { t("\\varepsilon") }), - s({ trig = ";z", snippetType = "autosnippet" }, { t("\\zeta") }), - s({ trig = ";h", snippetType = "autosnippet" }, { t("\\eta") }), - s({ trig = ";o", snippetType = "autosnippet" }, { t("\\theta") }), - s({ trig = ";vo", snippetType = "autosnippet" }, { t("\\vartheta") }), - s({ trig = ";O", snippetType = "autosnippet" }, { t("\\Theta") }), - s({ trig = ";k", snippetType = "autosnippet" }, { t("\\kappa") }), - s({ trig = ";l", snippetType = "autosnippet" }, { t("\\lambda") }), - s({ trig = ";L", snippetType = "autosnippet" }, { t("\\Lambda") }), - s({ trig = ";m", snippetType = "autosnippet" }, { t("\\mu") }), - s({ trig = ";n", snippetType = "autosnippet" }, { t("\\nu") }), - s({ trig = ";x", snippetType = "autosnippet" }, { t("\\xi") }), - s({ trig = ";X", snippetType = "autosnippet" }, { t("\\Xi") }), - s({ trig = ";i", snippetType = "autosnippet" }, { t("\\pi") }), - s({ trig = ";I", snippetType = "autosnippet" }, { t("\\Pi") }), - s({ trig = ";r", snippetType = "autosnippet" }, { t("\\rho") }), - s({ trig = ";s", snippetType = "autosnippet" }, { t("\\sigma") }), - s({ trig = ";S", snippetType = "autosnippet" }, { t("\\Sigma") }), - s({ trig = ";t", snippetType = "autosnippet" }, { t("\\tau") }), - s({ trig = ";f", snippetType = "autosnippet" }, { t("\\phi") }), - s({ trig = ";vf", snippetType = "autosnippet" }, { t("\\varphi") }), - s({ trig = ";F", snippetType = "autosnippet" }, { t("\\Phi") }), - s({ trig = ";c", snippetType = "autosnippet" }, { t("\\chi") }), - s({ trig = ";p", snippetType = "autosnippet" }, { t("\\psi") }), - s({ trig = ";P", snippetType = "autosnippet" }, { t("\\Psi") }), - s({ trig = ";w", snippetType = "autosnippet" }, { t("\\omega") }), - s({ trig = ";W", snippetType = "autosnippet" }, { t("\\Omega") }), -} diff --git a/modules/by-name/nv/nvim/plgs/luasnip/snippets/all.lua b/modules/by-name/nv/nvim/plgs/luasnip/snippets/all.lua new file mode 100644 index 00000000..371f5539 --- /dev/null +++ b/modules/by-name/nv/nvim/plgs/luasnip/snippets/all.lua @@ -0,0 +1,338 @@ +-- 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>. + +local ls = require("luasnip") +local fmt = require("luasnip.extras.fmt").fmt + +--- Get the comment string {begin,end} table +--- +---@param comment_type integer 1 for `line`-comment and 2 for `block`-comment +---@return table comment_strings {["begin"]=begin_comment_string, ["end"]=end_comment_string} +local get_comment_string = function(comment_type) + local calculate_comment_string = require("Comment.ft").calculate + 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(); }) + + if cstring == nil then + -- TODO: Use `vim.bo.commentstring` <2025-05-02> + + -- Use some useful default values. + 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; } +end + +--- Wraps a table of snippet nodes in two comment function nodes. +--- +---@param comment_type integer 1 for `line`-comment and 2 for `block`-comment +---@param nodes table The nodes that should be wrapped +---@return table wrapped_nodes The now wrapped `nodes` table. +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)) + + + 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)) + + return output +end + +-- auto_pairs {{{ +local get_visual = function(_, parent) + if #parent.snippet.env.SELECT_RAW > 0 then + return ls.snippet_node(nil, ls.insert_node(1, parent.snippet.env.SELECT_RAW)) + else + return ls.snippet_node(nil, ls.insert_node(1, "")) + end +end + +local function char_count_same(c1, c2) + local line = vim.api.nvim_get_current_line() + -- '%'-escape chars to force explicit match (gsub accepts patterns). + -- second return value is number of substitutions. + local _, ct1 = string.gsub(line, "%" .. c1, "") + local _, ct2 = string.gsub(line, "%" .. c2, "") + return ct1 == ct2 +end + +local function even_count(c, ...) + local line = vim.api.nvim_get_current_line() + local _, ct = string.gsub(line, c, "") + return ct % 2 == 0 +end + +-- This makes creation of pair-type snippets easier. +local function pair(pair_begin, pair_end, file_types, condition_function) + -- FIXME(@Soispha): This only works if file_types == nil, otherwise the snippet does not expand. + -- 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 + + 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; + } + ) +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); +} + +ls.add_snippets("all", auto_pairs, { type = "snippets"; key = "auto_pairs"; }) +-- }}} + +-- todo_comments {{{ +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 + + local result = handle:read("*a") + handle:close() + + -- stripped = string.gsub(str, '%s+', '') + return string.gsub(result, "\n", "") +end + +--- Create a @handle from a full name. +--- +--- Example: +--- “Benedikt Peetz” -> “@bpeetz” +local handle_from_name = function(name) + -- from: https://stackoverflow.com/a/7615129 + local split = function(inputstr, sep) + local t = {} + for str in string.gmatch(inputstr, "([^" .. sep .. "]+)") do + table.insert(t, str) + end + return t + end + + -- Split on spaces + local parts = split(name, "%s") + + local output_name = "" + + if #parts > 2 then + -- Only use the first chars. + -- + -- Example: + -- “Richard Matthew Stallman” -> “rms” + for _, val in ipairs(parts) do + output_name = string.format("%s%s", output_name, val:sub(1, 1)) + end + elseif #parts == 2 then + output_name = string.format("%s%s", parts[1]:sub(1, 1), parts[2]) + elseif #parts == 1 then + output_name = parts[1] + elseif #parts == 0 then + output_name = "<NoName>" + end + + return string.format("@%s", output_name:lower()) +end + +--- Generate a comment snippet +--- +---@param trig string The trigger +---@param name string name for the comment (ex.: {FIX, ISSUE, FIXIT, BUG}) +---@param comment_type integer The comment type. +---@param mark_function function: The function used to get the marks +local todo_snippet = function(trig, name, comment_type, mark_function) + assert(trig, "context doesn't include a `trig` key which is mandatory") + assert(comment_type == 1 or comment_type == 2) + + local context = {} + context.name = name .. " comment" + context.trig = trig + + 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; + })) + + return ls.snippet(context, nodes, { ctype = comment_type; }) +end + +---@param trigger string: The luasnip trigger +---@param comment_type integer: The luasnip comment type +---@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 marks = { + 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; + + 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; + } + + local output = {} + for mark_name, mark_function in pairs(marks) do + local trig = trigger .. "-" .. mark_name + + output[#output + 1] = todo_snippet(trig, name, comment_type, mark_function) + end + + return output +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; }; }; + + -- 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; }; }; +} + +local todo_comment_snippets = {} +for _, v in ipairs(todo_snippet_specs) do + local snippets = process_marks(v[1].trig, v[2][1], v[3].ctype) + for _, value in pairs(snippets) do + table.insert(todo_comment_snippets, value) + end +end + +ls.add_snippets("all", todo_comment_snippets, { type = "snippets"; key = "todo_comments"; }) +-- }}} + +-- spdx snippets {{{ +local generate_spdx_snippet = function(comment_type, spdx_license_expr, trigger) + assert(trigger, "context doesn't include a `trig` key which is mandatory") + assert(comment_type == 1 or comment_type == 2) + + local context = {} + context.name = trigger .. " spdx snippet expr" + context.trig = trigger + + + local nodes = { + 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-License-Identifier: {} {}", wrap_snippet_in_comments(comment_type, { + ls.text_node(spdx_license_expr); + })); + + { ls.insert_node(4, "content"); }; + + fmt("{} SPDX-SnippetEnd {}", wrap_snippet_in_comments(comment_type, {})); + + { ls.insert_node(0); }; + } + + local newline_nodes = {} + for _, sub_nodes in ipairs(nodes) do + for _, node in ipairs(sub_nodes) do + table.insert(newline_nodes, node) + end + + -- luasnip requires newlines to be encoded like this: + table.insert(newline_nodes, ls.text_node({ ""; ""; })) + end + + 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"; }; +} + +local spdx_snippets = {} +for _, value in ipairs(spdx) do + local snippet = generate_spdx_snippet(1, value.license, value.trigger) + table.insert(spdx_snippets, snippet) + + snippet = generate_spdx_snippet(2, value.license, value.trigger .. "-block") + table.insert(spdx_snippets, snippet) +end + +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 new file mode 100644 index 00000000..bcd128f7 --- /dev/null +++ b/modules/by-name/nv/nvim/plgs/luasnip/snippets/tex/delimiter.lua @@ -0,0 +1,41 @@ +-- 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>. + +local ls = require("luasnip") +local fmt = require("luasnip.extras.fmt").fmt + +local get_visual = function(_, parent) + if #parent.snippet.env.SELECT_RAW > 0 then + return ls.snippet_node(nil, ls.insert_node(1, parent.snippet.env.SELECT_RAW)) + else + return ls.snippet_node(nil, ls.insert_node(1, "")) + end +end + +local translation_table = { ["("] = ")"; ["{"] = "}"; ["["] = "]"; } + +-- Return snippet tables +return { + -- LEFT/RIGHT ALL BRACES + ls.snippet( + { + 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); + }) + ); +} 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 new file mode 100644 index 00000000..21aa7414 --- /dev/null +++ b/modules/by-name/nv/nvim/plgs/luasnip/snippets/tex/greek.lua @@ -0,0 +1,49 @@ +-- 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>. + +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"); }); +} diff --git a/modules/by-name/nv/nvim/plgs/neorg/default.nix b/modules/by-name/nv/nvim/plgs/neorg/default.nix index 03afb16c..ea451d3a 100644 --- a/modules/by-name/nv/nvim/plgs/neorg/default.nix +++ b/modules/by-name/nv/nvim/plgs/neorg/default.nix @@ -1,3 +1,12 @@ +# 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, @@ -44,11 +53,7 @@ in { __empty = null; }; "core.dirman".config = { - workspaces = { - general = "~/repos/notes/general"; - journal = "~/repos/notes/journal"; - projects = "~/repos/notes/projects"; - }; + workspaces = { }; }; "core.export".config = { __empty = null; diff --git a/modules/by-name/nv/nvim/plgs/neorg/key_mappings.lua b/modules/by-name/nv/nvim/plgs/neorg/key_mappings.lua index e2ebb653..5391bf0b 100644 --- a/modules/by-name/nv/nvim/plgs/neorg/key_mappings.lua +++ b/modules/by-name/nv/nvim/plgs/neorg/key_mappings.lua @@ -1,3 +1,13 @@ +-- 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>. + -- Override some of my default key mappings to better integrate into neorg. -- They still to the same conceptual thing. 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 8d61dbd7..315f3fc7 100644 --- a/modules/by-name/nv/nvim/plgs/nvim-cmp/default.nix +++ b/modules/by-name/nv/nvim/plgs/nvim-cmp/default.nix @@ -1,3 +1,12 @@ +# 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, @@ -5,49 +14,82 @@ }: let cfg = config.soispha.programs.nvim; in { - home-manager.users.soispha.programs.nixvim.plugins.cmp = lib.mkIf cfg.enable { - /* - TODO: integrate this: - ```lua - enabled = { - function() - -- disable completion in comments - local context = require 'cmp.config.context' - -- keep command mode completion enabled when cursor is in a comment - -- te - if vim.api.nvim_get_mode().mode == 'c' then - return true - else - return not context.in_treesitter_capture("comment") - and not context.in_syntax_group("Comment") + home-manager.users.soispha.programs.nixvim = lib.mkIf cfg.enable { + opts.completeopt = [ + "menu" # Show completions in a menu + "menuone" # Also open menu, when only one completion exists + "noselect" # Do not pre select one of the completions + ]; + + keymaps = [ + { + key = "hh"; + mode = ["i"]; + action.__raw = '' + function() + require('cmp').select_next_item() end - end - }, - ``` - */ - enable = true; - autoEnableSources = true; - settings = { - mapping = { - # TODO: add support for desc and which key here - "<C-d>" = "cmp.mapping.scroll_docs(-4)"; # desc = "Scroll up by four lines" - "<C-f>" = "cmp.mapping.scroll_docs(4)"; # desc = "Scroll down by four lines" - "HH" = "cmp.mapping.complete()"; # desc = "Confirm snipped" - }; + ''; + options.desc = "go forward in completion menu"; + } + { + key = "uu"; + mode = ["i"]; + action.__raw = '' + function() + require('cmp').confirm() + end + ''; + options.desc = "confirm the selected item"; + } + + { + key = "<C-d>"; + mode = ["i"]; + action.__raw = '' + function() + require('cmp').mapping.scroll_docs(-4) + end + ''; + options.desc = "Scroll up by four lines"; + } + { + key = "<C-f>"; + mode = ["i"]; + action.__raw = '' + function() + require('cmp').mapping.scroll_docs(4) + end + ''; + options.desc = "Scroll down by four lines"; + } + ]; + + plugins.cmp = { + enable = true; + autoEnableSources = true; - snippet.expand = "function(args) require('luasnip').lsp_expand(args.body) end"; + settings = { + mapping = {}; - sources = [ - {name = "nvim_lsp";} - {name = "luasnip";} - {name = "path";} - {name = "git";} # TODO: I might want to add config to allow all issues/prs <2023-10-16> - # {name = "convertionalcommits";} # TODO: Useless without commitlint [https://commitlint.js.org/] <2023-10-16> - # {name = "rg";} # TODO: This might really RIP-grep my system <2023-10-16> - # {name = "buffer";} - # {name = "digraphs";} - {name = "calc";} - ]; + snippet.expand.__raw = '' + function(args) + require('luasnip').lsp_expand(args.body) + end + ''; + + sources = [ + {name = "nvim_lsp";} + {name = "luasnip";} + {name = "path";} + {name = "git";} # TODO: I might want to add config to allow all issues/prs <2023-10-16> + # {name = "convertionalcommits";} # TODO: Useless without commitlint [https://commitlint.js.org/] <2023-10-16> + # {name = "rg";} # TODO: This might really RIP-grep my system <2023-10-16> + # {name = "buffer";} + # {name = "digraphs";} + {name = "calc";} + ]; + }; }; }; } diff --git a/modules/by-name/nv/nvim/plgs/nvim-lint/default.nix b/modules/by-name/nv/nvim/plgs/nvim-lint/default.nix index ee057a9b..90e81832 100644 --- a/modules/by-name/nv/nvim/plgs/nvim-lint/default.nix +++ b/modules/by-name/nv/nvim/plgs/nvim-lint/default.nix @@ -1,3 +1,12 @@ +# 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, config, diff --git a/modules/by-name/nv/nvim/plgs/nvim-lint/lua/nvim-lint.lua b/modules/by-name/nv/nvim/plgs/nvim-lint/lua/nvim-lint.lua index 770c3bb5..5b5fd4b8 100644 --- a/modules/by-name/nv/nvim/plgs/nvim-lint/lua/nvim-lint.lua +++ b/modules/by-name/nv/nvim/plgs/nvim-lint/lua/nvim-lint.lua @@ -1,3 +1,13 @@ +-- 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>. + require("lint").linters_by_ft = { -- text markdown = {}, diff --git a/modules/by-name/nv/nvim/plgs/raw_plugins/default.nix b/modules/by-name/nv/nvim/plgs/raw_plugins/default.nix index e5d401a0..c981ee08 100644 --- a/modules/by-name/nv/nvim/plgs/raw_plugins/default.nix +++ b/modules/by-name/nv/nvim/plgs/raw_plugins/default.nix @@ -1,3 +1,12 @@ +# 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, diff --git a/modules/by-name/nv/nvim/plgs/telescope/default.nix b/modules/by-name/nv/nvim/plgs/telescope/default.nix index 193ee1ac..b2c66edc 100644 --- a/modules/by-name/nv/nvim/plgs/telescope/default.nix +++ b/modules/by-name/nv/nvim/plgs/telescope/default.nix @@ -1,3 +1,12 @@ +# 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, diff --git a/modules/by-name/nv/nvim/plgs/telescope/defaults/default.nix b/modules/by-name/nv/nvim/plgs/telescope/defaults/default.nix index 11d04304..7cfe9698 100644 --- a/modules/by-name/nv/nvim/plgs/telescope/defaults/default.nix +++ b/modules/by-name/nv/nvim/plgs/telescope/defaults/default.nix @@ -1,3 +1,12 @@ +# 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, diff --git a/modules/by-name/nv/nvim/plgs/telescope/extensions/bibtex/default.nix b/modules/by-name/nv/nvim/plgs/telescope/extensions/bibtex/default.nix index 818aa18e..693db974 100644 --- a/modules/by-name/nv/nvim/plgs/telescope/extensions/bibtex/default.nix +++ b/modules/by-name/nv/nvim/plgs/telescope/extensions/bibtex/default.nix @@ -1,32 +1,36 @@ -{ - pkgs, - config, - lib, - ... -}: let +# 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, ...}: let cfg = config.soispha.programs.nvim; in { - home-manager.users.soispha.programs.nixvim = lib.mkIf cfg.enable { - extraPlugins = [ - pkgs.vimExtraPlugins.telescope-bibtex-nvim - ]; - - # Only activate this in tex files. - # TODO: Why? <2024-11-23> - extraFiles = { - "ftplugin/tex.lua".text = '' - ${lib.strings.fileContents ./tex.lua} - ''; - }; - - keymaps = [ - { - key = "<space>ib"; - # This is registered in the ftplugin file, so we set this to null here - action = "<Nop>"; - mode = "n"; - options.desc = "[i]nsert a [b]atex citation"; - } - ]; - }; + # TODO: Re-enable this, once the plugin is merged into nixpkgs <2025-03-29> + # home-manager.users.soispha.programs.nixvim = lib.mkIf cfg.enable { + # extraPlugins = [ + # pkgs.vimExtraPlugins.telescope-bibtex-nvim + # ]; + # + # # Only activate this in tex files. + # extraFiles = { + # "ftplugin/tex.lua".text = '' + # ${lib.strings.fileContents ./tex.lua} + # ''; + # }; + # + # keymaps = [ + # { + # key = "<space>ib"; + # # This is registered in the ftplugin file, so we set this to null here + # action = "<Nop>"; + # mode = "n"; + # options.desc = "[i]nsert a [b]atex citation"; + # } + # ]; + # }; } diff --git a/modules/by-name/nv/nvim/plgs/telescope/extensions/bibtex/tex.lua b/modules/by-name/nv/nvim/plgs/telescope/extensions/bibtex/tex.lua index 4107a7c5..fbe7c993 100644 --- a/modules/by-name/nv/nvim/plgs/telescope/extensions/bibtex/tex.lua +++ b/modules/by-name/nv/nvim/plgs/telescope/extensions/bibtex/tex.lua @@ -1,3 +1,13 @@ +-- 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>. + -- local used = false; -- vim.keymap.set('n', '<leader>t', function() -- used = not used; diff --git a/modules/by-name/nv/nvim/plgs/telescope/extensions/default.nix b/modules/by-name/nv/nvim/plgs/telescope/extensions/default.nix index 0b1e033a..0b0ed0f6 100644 --- a/modules/by-name/nv/nvim/plgs/telescope/extensions/default.nix +++ b/modules/by-name/nv/nvim/plgs/telescope/extensions/default.nix @@ -1,3 +1,12 @@ +# 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>. {...}: { imports = [ ./bibtex diff --git a/modules/by-name/nv/nvim/plgs/telescope/extensions/frecency/default.nix b/modules/by-name/nv/nvim/plgs/telescope/extensions/frecency/default.nix index f4e3d116..3d5eae99 100644 --- a/modules/by-name/nv/nvim/plgs/telescope/extensions/frecency/default.nix +++ b/modules/by-name/nv/nvim/plgs/telescope/extensions/frecency/default.nix @@ -1,3 +1,12 @@ +# 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, diff --git a/modules/by-name/nv/nvim/plgs/telescope/extensions/fzy-native/default.nix b/modules/by-name/nv/nvim/plgs/telescope/extensions/fzy-native/default.nix index 4194e688..7a2fc164 100644 --- a/modules/by-name/nv/nvim/plgs/telescope/extensions/fzy-native/default.nix +++ b/modules/by-name/nv/nvim/plgs/telescope/extensions/fzy-native/default.nix @@ -1,3 +1,12 @@ +# 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, diff --git a/modules/by-name/nv/nvim/plgs/telescope/extensions/rooter/default.nix b/modules/by-name/nv/nvim/plgs/telescope/extensions/rooter/default.nix index 6153b063..4d91e988 100644 --- a/modules/by-name/nv/nvim/plgs/telescope/extensions/rooter/default.nix +++ b/modules/by-name/nv/nvim/plgs/telescope/extensions/rooter/default.nix @@ -1,3 +1,12 @@ +# 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, diff --git a/modules/by-name/nv/nvim/plgs/telescope/extensions/rooter/lua/rooter.lua b/modules/by-name/nv/nvim/plgs/telescope/extensions/rooter/lua/rooter.lua index 48a8588d..b6542429 100644 --- a/modules/by-name/nv/nvim/plgs/telescope/extensions/rooter/lua/rooter.lua +++ b/modules/by-name/nv/nvim/plgs/telescope/extensions/rooter/lua/rooter.lua @@ -1,3 +1,13 @@ +-- 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>. + -- Taken from: https://github.com/desdic/telescope-rooter.nvim/blob/69423216c75a5f1f1477bbf8faf6b0dc8af04099/lua/telescope/_extensions/rooter.lua local has_telescope, telescope = pcall(require, "telescope") if not has_telescope then diff --git a/modules/by-name/nv/nvim/plgs/telescope/extensions/symbols/default.nix b/modules/by-name/nv/nvim/plgs/telescope/extensions/symbols/default.nix index adbb466a..1f82523d 100644 --- a/modules/by-name/nv/nvim/plgs/telescope/extensions/symbols/default.nix +++ b/modules/by-name/nv/nvim/plgs/telescope/extensions/symbols/default.nix @@ -1,3 +1,12 @@ +# 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, config, diff --git a/modules/by-name/nv/nvim/plgs/telescope/keymaps/default.nix b/modules/by-name/nv/nvim/plgs/telescope/keymaps/default.nix index a474f097..d5cc55f5 100644 --- a/modules/by-name/nv/nvim/plgs/telescope/keymaps/default.nix +++ b/modules/by-name/nv/nvim/plgs/telescope/keymaps/default.nix @@ -1,3 +1,12 @@ +# 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, diff --git a/modules/by-name/nv/nvim/plgs/todo-comments/default.nix b/modules/by-name/nv/nvim/plgs/todo-comments/default.nix index ddbe367d..cd1a7dbf 100644 --- a/modules/by-name/nv/nvim/plgs/todo-comments/default.nix +++ b/modules/by-name/nv/nvim/plgs/todo-comments/default.nix @@ -1,3 +1,12 @@ +# 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, diff --git a/modules/by-name/nv/nvim/plgs/treesitter/default.nix b/modules/by-name/nv/nvim/plgs/treesitter/default.nix index 02088d0a..c8b48cd1 100644 --- a/modules/by-name/nv/nvim/plgs/treesitter/default.nix +++ b/modules/by-name/nv/nvim/plgs/treesitter/default.nix @@ -1,3 +1,12 @@ +# 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, @@ -6,15 +15,17 @@ }: let cfg = config.soispha.programs.nvim; in { - home-manager.users.soispha. programs.nixvim = lib.mkIf cfg.enable { + home-manager.users.soispha.programs.nixvim = lib.mkIf cfg.enable { + # NOTE: These are required to build grammars, but I already use the nix grammars <2024-07-13> + dependencies = { + tree-sitter.enable = false; + nodejs.enable = false; + gcc.enable = false; + }; + plugins.treesitter = { enable = true; - # NOTE: These are required to build grammars, but I already use the nix grammars <2024-07-13> - gccPackage = null; - nodejsPackage = null; - treesitterPackage = null; - # inject nixvim specific highlighting (eg in extraConfigLua). nixvimInjections = true; diff --git a/modules/by-name/nv/nvim/plgs/vim-tex/default.nix b/modules/by-name/nv/nvim/plgs/vim-tex/default.nix index 680f169a..739b69d9 100644 --- a/modules/by-name/nv/nvim/plgs/vim-tex/default.nix +++ b/modules/by-name/nv/nvim/plgs/vim-tex/default.nix @@ -1,3 +1,12 @@ +# 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, diff --git a/modules/by-name/nv/nvim/plgs/which-key/default.nix b/modules/by-name/nv/nvim/plgs/which-key/default.nix index 20004bb1..e5bca546 100644 --- a/modules/by-name/nv/nvim/plgs/which-key/default.nix +++ b/modules/by-name/nv/nvim/plgs/which-key/default.nix @@ -1,3 +1,12 @@ +# 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, diff --git a/modules/by-name/ol/ollama/module.nix b/modules/by-name/ol/ollama/module.nix index bd0baaa6..f819c035 100644 --- a/modules/by-name/ol/ollama/module.nix +++ b/modules/by-name/ol/ollama/module.nix @@ -1,3 +1,12 @@ +# 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, @@ -28,6 +37,16 @@ in { services.ollama = { enable = true; acceleration = false; + + # TODO: This could work for GPU acceleration. <2024-12-20> + # acceleration = "rocm"; + # host = "127.0.0.1"; + # port = 11434; + # environmentVariables = { + # HCC_AMDGPU_TARGET = "gfx1032"; # used to be necessary, but doesn't seem to anymore + # }; + # + # rocmOverrideGfx = "10.3.2"; }; }; } diff --git a/modules/by-name/op/openssh/module.nix b/modules/by-name/op/openssh/module.nix index b733dbe7..97cf7fd7 100644 --- a/modules/by-name/op/openssh/module.nix +++ b/modules/by-name/op/openssh/module.nix @@ -1,3 +1,12 @@ +# 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>. {...}: { services.openssh = { enable = true; diff --git a/modules/by-name/pi/printing/module.nix b/modules/by-name/pi/printing/module.nix index 85d15b16..cfcd2154 100644 --- a/modules/by-name/pi/printing/module.nix +++ b/modules/by-name/pi/printing/module.nix @@ -1,3 +1,12 @@ +# 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, diff --git a/modules/by-name/po/polkit/module.nix b/modules/by-name/po/polkit/module.nix index fb13505b..c6d1c750 100644 --- a/modules/by-name/po/polkit/module.nix +++ b/modules/by-name/po/polkit/module.nix @@ -1,3 +1,12 @@ +# 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, diff --git a/modules/by-name/po/postgresql/module.nix b/modules/by-name/po/postgresql/module.nix index 62233e96..5cdf6c77 100644 --- a/modules/by-name/po/postgresql/module.nix +++ b/modules/by-name/po/postgresql/module.nix @@ -1,3 +1,12 @@ +# 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, diff --git a/modules/by-name/po/power/module.nix b/modules/by-name/po/power/module.nix index 13013879..3489853c 100644 --- a/modules/by-name/po/power/module.nix +++ b/modules/by-name/po/power/module.nix @@ -1,3 +1,12 @@ +# 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, diff --git a/modules/by-name/ri/river/init_base.sh b/modules/by-name/ri/river/init_base.sh new file mode 100755 index 00000000..b68d147b --- /dev/null +++ b/modules/by-name/ri/river/init_base.sh @@ -0,0 +1,32 @@ +#!/usr/bin/env sh + +# 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>. + +# NOTE: Keep this in sync with the file from `river-start` <2025-02-03> +RIVER_LOG_FILE="$HOME/.cache/river/log" + +err_fail() { + if ! "$@"; then + output="" + for arg in "$@"; do + if [ -z "$output" ]; then + output="'$arg'" + else + output="$output '$arg'" + fi + done + printf "%s failed!\n" "$output" >>"$RIVER_LOG_FILE" + fi +} +exec 1>>"$RIVER_LOG_FILE" +exec 2>>"$RIVER_LOG_FILE" + +# Start of the generated stuff. diff --git a/modules/by-name/ri/river/module.nix b/modules/by-name/ri/river/module.nix index a059da4d..38d4bdef 100644 --- a/modules/by-name/ri/river/module.nix +++ b/modules/by-name/ri/river/module.nix @@ -1,21 +1,227 @@ +# 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, - qmk_firmware, system, + pkgs, + externalBinaries, ... }: let cfg = config.soispha.programs.river; + esa = lib.strings.escapeShellArg; + riverctl = lib.getExe' pkgs.river "riverctl"; + + mkOutputFlags = output: flags: let + expandedFlags = builtins.concatStringsSep " " (lib.attrsets.mapAttrsToList (flag: value: "--${esa flag} ${esa value}") flags); + in '' + err_fail ${lib.getExe pkgs.wlr-randr} --output ${esa output} ${expandedFlags} + ''; + screenSetupCode = builtins.concatStringsSep "" (lib.attrsets.mapAttrsToList mkOutputFlags cfg.init.screenSetupCode); + + mkLrProgram = input: let + program = builtins.concatStringsSep " " ( + if lib.isDerivation input + then [(lib.getExe input)] + else builtins.map esa input + ); + in "err_fail ${program} &"; + longRunningPrograms = builtins.concatStringsSep "\n" (builtins.map mkLrProgram cfg.init.backgroundStart); + + keymapFormat = pkgs.formats.json {}; + + keymappings = '' + err_fail ${riverctl} keyboard-layout ${esa cfg.init.mappings.layout} + err_fail ${lib.getExe pkgs.river-mk-keymap} ${keymapFormat.generate "keys.json" cfg.init.mappings.keymap} + ''; + + mkRule = { + app-id, + title, + action, + }: '' + err_fail ${riverctl} rule-add -app-id ${esa app-id} -title ${esa title} ${esa action} + ''; + ruleSetup = builtins.concatStringsSep "" (builtins.map mkRule cfg.init.rules); + + mkSetting = name: maybe_values: let + rawValues = + if builtins.isString maybe_values + then [maybe_values] + else maybe_values; + values = builtins.concatStringsSep " " (builtins.map esa rawValues); + in '' + err_fail ${riverctl} ${esa name} ${values} + ''; + generalSettings = + builtins.concatStringsSep "" (lib.attrsets.mapAttrsToList mkSetting + cfg.init.generalSettings); + + mkInput = name: arguments: + builtins.concatStringsSep "" (builtins.map (argumentLine: mkSetting "input" ([name] ++ argumentLine)) arguments); + inputs = + builtins.concatStringsSep "" (lib.attrsets.mapAttrsToList mkInput cfg.init.inputs); in { options.soispha.programs.river = { enable = lib.mkEnableOption "river"; + unicodeInput = { enable = lib.mkEnableOption "udev rules for rawhid based unicode input"; }; + + init = { + mappings = { + layout = lib.mkOption { + type = lib.types.str; + description = "The keymap to use"; + default = "dvorak-modified"; + }; + + keymap = lib.mkOption { + type = lib.types.submodule { + freeformType = keymapFormat.type; + + options = {}; + }; + default = {}; + + description = '' + Configuration for river-mk-keymap via `keys.json`. + ''; + }; + }; + + rules = lib.mkOption { + type = lib.types.listOf (lib.types.attrsOf lib.types.str); + default = []; + + example = '' + [ + { + app-id = "*"; + title = "floating please"; + action = "float"; + } + { + app-id = "*"; + title = "*"; + action = "ssd"; + } + ] + ''; + + description = '' + Configuration for river's rules. + ''; + }; + + generalSettings = lib.mkOption { + type = lib.types.attrsOf (lib.types.either (lib.types.listOf lib.types.str) lib.types.str); + description = "Simple key value settings."; + default = {}; + example = '' + { + background-color = "0x002b36"; + set-repeat = ["50" "300"]; + hide-cursor = ["when-typing" "enabled"]; + } + ''; + }; + + inputs = lib.mkOption { + type = lib.types.attrsOf (lib.types.listOf (lib.types.listOf lib.types.str)); + description = "Options to set per input device"; + default = {}; + example = '' + { + 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 = 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"; + example = '' + [ + pkgs.gammastep + ] + ''; + }; + + screenSetupCode = lib.mkOption { + type = lib.types.attrsOf (lib.types.attrsOf lib.types.str); + default = {}; + description = '' + `wlr-randr` flags to set up outputs. The attribute names are the `--output` keys + and the attrs are flag value pairs to setup. + ''; + example = '' + { + "Virtual-1" = {mode = "1920x1080";}; + "DP-2" = {pos = "2560,0";}; + "DP-1" = {scale = "1.5"; pos = "0,0";}; + } + ''; + }; + }; }; config = lib.mkIf cfg.enable { - # TODO: Migrate the complete river module <2024-12-30> - services.udev.packages = lib.mkIf cfg.unicodeInput.enable [qmk_firmware.packages.${system}.qmk_unicode_type]; + services.udev.packages = lib.mkIf cfg.unicodeInput.enable [externalBinaries.qmk_firmware.packages.${system}.qmk_unicode_type]; + + home-manager.users.soispha = { + home.sessionVariables = { + WM = "river"; + XDG_CURRENT_DESKTOP = "river"; + DESKTOP_SESSION = "river"; + + # Export Wayland env Vars {{{ + QT_QPA_PLATFORM = "wayland"; + QT_QPA_PLATFORMTHEME = "qt5ct"; # needs qt5ct + CLUTTER_BACKEND = "wayland"; + SDL_VIDEODRIVER = "wayland"; # might brake some things + # }}} + }; + + home.packages = [ + (pkgs.callPackage ./river-start/package.nix {}) + ]; + + xdg.configFile."river/init" = { + executable = true; + text = let + mkHeading = text: other_stuff: '' + # ${text} + ${other_stuff} + ''; + 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 "Key Mappings" keymappings + + mkHeading "Rules" ruleSetup + + mkHeading "General Settings" generalSettings + + mkHeading "Input Section" inputs + + mkHeading "Screen setup code" screenSetupCode + + mkHeading "Background services" longRunningPrograms + + mkHeading "Layout Setup" '' + err_fail ${riverctl} default-layout rivertile + ${lib.getExe' pkgs.river "rivertile"} -main-ratio 0.5 -view-padding 1 -outer-padding 0 + ''; + }; + }; }; } diff --git a/modules/by-name/ri/river/river-start/package.nix b/modules/by-name/ri/river/river-start/package.nix new file mode 100644 index 00000000..10957cc0 --- /dev/null +++ b/modules/by-name/ri/river/river-start/package.nix @@ -0,0 +1,23 @@ +# 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>. +{ + writeShellApplication, + river, +}: +writeShellApplication { + name = "river-start"; + text = builtins.readFile ./river-start.sh; + runtimeInputs = [ + river + ]; + meta = { + mainProgram = "river-start"; + }; +} diff --git a/modules/by-name/ri/river/river-start/river-start.sh b/modules/by-name/ri/river/river-start/river-start.sh new file mode 100755 index 00000000..b4c5b0a6 --- /dev/null +++ b/modules/by-name/ri/river/river-start/river-start.sh @@ -0,0 +1,20 @@ +#! /usr/bin/env sh + +# 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>. + +# NOTE: Keep this in sync with the file from `base_init.sh` <2025-02-03> +RIVER_LOG_FILE="$HOME/.cache/river/log" + +[ -d "$(dirname "$RIVER_LOG_FILE")" ] || mkdir --parents "$(dirname "$RIVER_LOG_FILE")" + +exec river -log-level info >"$RIVER_LOG_FILE" 2>&1 + +# vim: ft=sh diff --git a/modules/by-name/sc/scanning/module.nix b/modules/by-name/sc/scanning/module.nix index dda507fa..30e99bd1 100644 --- a/modules/by-name/sc/scanning/module.nix +++ b/modules/by-name/sc/scanning/module.nix @@ -1,3 +1,12 @@ +# 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, diff --git a/modules/by-name/se/serverphone/certificates/ca.crt.license b/modules/by-name/se/serverphone/certificates/ca.crt.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/modules/by-name/se/serverphone/certificates/ca.crt.license @@ -0,0 +1,9 @@ +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/by-name/se/serverphone/certificates/server.crt.license b/modules/by-name/se/serverphone/certificates/server.crt.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/modules/by-name/se/serverphone/certificates/server.crt.license @@ -0,0 +1,9 @@ +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/by-name/se/serverphone/module.currently_ignored.nix b/modules/by-name/se/serverphone/module.currently_ignored.nix index aaa818c2..f7280bed 100644 --- a/modules/by-name/se/serverphone/module.currently_ignored.nix +++ b/modules/by-name/se/serverphone/module.currently_ignored.nix @@ -1,13 +1,33 @@ +# 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, serverphone, system, lib, + modules, ... -}: { +}: let + cfg = config.soispha.serverphone; +in { # FIXME: Reactive this module, when serverphone is working again <2024-05-11> - config = lib.mkIf config.soispha.secrets.enable { + options.soispha.serverphone = { + enable = lib.mkEnableOption "serverphone"; + }; + + imports = [ + modules.serverphone.nixosModules.default + ]; + + config = lib.mkIf cfg.enable { age.secrets = { serverphoneCa = { file = ./private_keys/ca.key; diff --git a/modules/by-name/se/serverphone/private_keys/ca.key.license b/modules/by-name/se/serverphone/private_keys/ca.key.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/modules/by-name/se/serverphone/private_keys/ca.key.license @@ -0,0 +1,9 @@ +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/by-name/se/serverphone/private_keys/server.key.license b/modules/by-name/se/serverphone/private_keys/server.key.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/modules/by-name/se/serverphone/private_keys/server.key.license @@ -0,0 +1,9 @@ +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/by-name/sn/snapper/module.nix b/modules/by-name/sn/snapper/module.nix index bf8201a4..c232a177 100644 --- a/modules/by-name/sn/snapper/module.nix +++ b/modules/by-name/sn/snapper/module.nix @@ -1,3 +1,12 @@ +# 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, diff --git a/modules/by-name/so/sound/module.nix b/modules/by-name/so/sound/module.nix index f3120a67..622cc01d 100644 --- a/modules/by-name/so/sound/module.nix +++ b/modules/by-name/so/sound/module.nix @@ -1,3 +1,12 @@ +# 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, @@ -10,7 +19,7 @@ in { }; config = lib.mkIf cfg.enable { - hardware.pulseaudio.enable = false; + services.pulseaudio.enable = false; security.rtkit.enable = true; services.pipewire = { diff --git a/modules/by-name/ss/ssh/module.nix b/modules/by-name/ss/ssh/module.nix new file mode 100644 index 00000000..91cc4aeb --- /dev/null +++ b/modules/by-name/ss/ssh/module.nix @@ -0,0 +1,55 @@ +# 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, + ... +}: let + cfg = config.soispha.programs.ssh; +in { + options.soispha.programs.ssh = { + enable = lib.mkEnableOption "ssh config"; + rootKnownHosts = lib.mkOption { + type = lib.types.attrsOf lib.types.str; + description = '' + An attrset of keys (the domain) and values (the host key.) + These are only applied to the root user. + ''; + default = {}; + apply = value: + builtins.concatStringsSep "\n" + (lib.attrsets.mapAttrsToList (hostName: hostKey: "${hostName} ${hostKey}") value); + }; + }; + + config = lib.mkIf cfg.enable { + home-manager.users = { + root.programs.ssh = { + enable = true; + compression = true; + hashKnownHosts = false; + serverAliveInterval = 240; + userKnownHostsFile = builtins.toString (pkgs.writeTextFile { + name = "root-known-hosts"; + text = cfg.rootKnownHosts; + }); + }; + + soispha.programs.ssh = { + enable = true; + compression = true; + hashKnownHosts = false; + serverAliveInterval = 240; + userKnownHostsFile = "${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 49149cd7..a02b2e4b 100644 --- a/modules/by-name/st/steam/module.nix +++ b/modules/by-name/st/steam/module.nix @@ -1,23 +1,42 @@ +# 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, pkgs, ... }: let - cfg = config.soispha.services.steam; + cfg = config.soispha.programs.steam; in { - options.soispha.services.steam = { + options.soispha.programs.steam = { enable = lib.mkEnableOption "Steam"; }; config = lib.mkIf cfg.enable { + nixpkgs.config.allowUnfreePredicate = pkg: + builtins.elem (lib.getName pkg) [ + # NOTE: These are not really applied. Look at + # <modules/by-name/ni/nixpkgs/config.nix> instead. <2025-04-25> + "steam" + "steam-unwrapped" + "steam-original" + "steam-run" + ]; + programs.steam = { enable = true; }; environment.systemPackages = [ # TODO: Why is this package needed? <2024-05-16> - pkgs.wineWowPackages.waylandFull + # pkgs.wineWowPackages.waylandFull ]; }; } diff --git a/modules/home.legacy/conf/swaylock/GTDcanonical.png b/modules/by-name/sw/swaylock/images/GTDcanonical.png index ef41d79d..ef41d79d 100644 --- a/modules/home.legacy/conf/swaylock/GTDcanonical.png +++ b/modules/by-name/sw/swaylock/images/GTDcanonical.png Binary files differdiff --git a/modules/by-name/sw/swaylock/images/GTDcanonical.png.license b/modules/by-name/sw/swaylock/images/GTDcanonical.png.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/modules/by-name/sw/swaylock/images/GTDcanonical.png.license @@ -0,0 +1,9 @@ +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/swaylock/commands.jpg b/modules/by-name/sw/swaylock/images/commands.jpg index 54016503..54016503 100644 --- a/modules/home.legacy/conf/swaylock/commands.jpg +++ b/modules/by-name/sw/swaylock/images/commands.jpg Binary files differdiff --git a/modules/by-name/sw/swaylock/images/commands.jpg.license b/modules/by-name/sw/swaylock/images/commands.jpg.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/modules/by-name/sw/swaylock/images/commands.jpg.license @@ -0,0 +1,9 @@ +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/by-name/sw/swaylock/images/duwon-lee-tempano-port.jpg b/modules/by-name/sw/swaylock/images/duwon-lee-tempano-port.jpg new file mode 100644 index 00000000..d72f32d1 --- /dev/null +++ b/modules/by-name/sw/swaylock/images/duwon-lee-tempano-port.jpg Binary files differdiff --git a/modules/by-name/sw/swaylock/images/duwon-lee-tempano-port.jpg.license b/modules/by-name/sw/swaylock/images/duwon-lee-tempano-port.jpg.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/modules/by-name/sw/swaylock/images/duwon-lee-tempano-port.jpg.license @@ -0,0 +1,9 @@ +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/swaylock/gnu.png b/modules/by-name/sw/swaylock/images/gnu.png index d07dee3e..d07dee3e 100644 --- a/modules/home.legacy/conf/swaylock/gnu.png +++ b/modules/by-name/sw/swaylock/images/gnu.png Binary files differdiff --git a/modules/by-name/sw/swaylock/images/gnu.png.license b/modules/by-name/sw/swaylock/images/gnu.png.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/modules/by-name/sw/swaylock/images/gnu.png.license @@ -0,0 +1,9 @@ +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/by-name/sw/swaylock/module.nix b/modules/by-name/sw/swaylock/module.nix index 6cbcef28..ab18f41b 100644 --- a/modules/by-name/sw/swaylock/module.nix +++ b/modules/by-name/sw/swaylock/module.nix @@ -1,4 +1,34 @@ -{...}: { - # otherwise swaylock can't access the user password. - security.pam.services.swaylock = {}; +# 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, + ... +}: let + cfg = config.soispha.programs.swaylock; +in { + options.soispha.programs.swaylock = { + enable = lib.mkEnableOption "swaylock"; + }; + + config = lib.mkIf cfg.enable { + # otherwise swaylock can't access the user password. + security.pam.services.swaylock = {}; + + home-manager.users.soispha.programs.swaylock = { + enable = true; + settings = { + image = "${./images/duwon-lee-tempano-port.jpg}"; + scaling = "stretch"; + color = "000000"; + }; + }; + }; } diff --git a/modules/by-name/sy/system_diff/module.nix b/modules/by-name/sy/system_diff/module.nix index 052ffae2..cc2ec75c 100644 --- a/modules/by-name/sy/system_diff/module.nix +++ b/modules/by-name/sy/system_diff/module.nix @@ -1,3 +1,12 @@ +# 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, diff --git a/modules/by-name/ta/taskwarrior/module.nix b/modules/by-name/ta/taskwarrior/module.nix index 0a942820..bb881768 100644 --- a/modules/by-name/ta/taskwarrior/module.nix +++ b/modules/by-name/ta/taskwarrior/module.nix @@ -1,44 +1,173 @@ +# 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, + pkgs, ... }: let cfg = config.soispha.programs.taskwarrior; + + hooksDir = + pkgs.runCommandNoCCLocal "mk-taskwarrior-hooks" {} + ('' + mkdir "$out" + '' + + (builtins.concatStringsSep "\n" + (lib.attrsets.mapAttrsToList + (name: value: '' + ln --symbolic "${lib.getExe value.executable}" "$out/${value.mode}_${name}" + '') + cfg.hooks))); + + mkHook = mode: deps: path: { + inherit mode; + + executable = pkgs.writeShellApplication { + name = "add-hook-${builtins.baseNameOf path}"; + runtimeInputs = [pkgs.taskwarrior3 pkgs.coreutils pkgs.gnugrep] ++ deps; + inheritPath = false; + text = + # bash + '' + die() { + echo "$@">&2 + exit 1 + } + + enable_hook_dbg() { + # TODO: We should probably be smarter with the debug detection <2025-04-04> + if echo "$2" | grep --quiet 'rc.debug.hooks='; then + set -x + mkdir --parents "$HOME/.cache/task" + exec >>"$HOME/.cache/task/hook.log.$1" + exec 2>>"$HOME/.cache/task/hook.log.$1" + fi + } + + addedCall() { + ${builtins.readFile path} + } + + ${ + if mode == "on-modify" + then "read -r old_task" + else "old_task=NULL" + } + read -r new_task + # We don't change the task, thus immediately return the JSON + echo "$new_task" + + enable_hook_dbg "$@" + addedCall "$new_task" "$old_task" + + exit 0 + ''; + }; + }; in { options.soispha.programs.taskwarrior = { - enable = lib.mkEnableOption "taskwarrior-secrets"; + enable = lib.mkEnableOption "taskwarrior"; + + enableAge = lib.mkEnableOption "taskwarrior with age keys"; + + includeFiles = lib.mkOption { + type = lib.types.attrsOf lib.types.path; + description = "Extra files to include in the taskwarrior config"; + default = {}; + apply = value: + builtins.concatStringsSep "\n" + (builtins.map (path: "include ${path}") + (builtins.attrValues value)); + }; + + hooks = lib.mkOption { + description = "Map hook names to their values"; + type = lib.types.attrsOf (lib.types.submodule { + options = { + mode = lib.mkOption { + type = lib.types.enum ["on-add" "on-modify"]; + description = "The type of the hook"; + }; + executable = lib.mkOption { + type = lib.types.package; + description = "The executable to call."; + }; + }; + }); + }; }; - # HACK: Migrating the whole `taskwarrior` setup is right now unrealistic, as the module is - # tightly coupled with the `firefox` module, and `neorg` script. - # But to work around the fact that setting the `age` secrets in the legacy module is - # impossible, this module was created as work-around until the `taskwarrior` module can - # be fully migrated. <2024-10-18> - config = lib.mkIf cfg.enable { - age.secrets = { - taskserverPrivate = { - file = ./secrets/private.key; - mode = "700"; - owner = "soispha"; - group = "users"; - }; - taskserverPublic = { - file = ./secrets/public.cert; - mode = "700"; - owner = "soispha"; - group = "users"; - }; - taskserverCA = { - file = ./secrets/ca.cert; - mode = "700"; - owner = "soispha"; - group = "users"; + config = { + lib.taskwarrior = { + inherit mkHook; + }; + + age.secrets.taskwarrior_sync_server_encryption_key = lib.mkIf (cfg.enable && cfg.enableAge) { + file = ./secrets/sync_server_encryption_key.age; + mode = "700"; + owner = "soispha"; + group = "users"; + }; + + soispha.programs.taskwarrior.includeFiles.syncServerSecret = lib.mkIf (cfg.enable && cfg.enableAge) config.age.secrets.taskwarrior_sync_server_encryption_key.path; + + home-manager.users.soispha = lib.mkIf cfg.enable { + services.taskwarrior-sync = lib.mkIf cfg.enableAge { + enable = true; + package = pkgs.taskwarrior3; }; - taskserverCredentials = { - file = ./secrets/credentials; - mode = "700"; - owner = "soispha"; - group = "users"; + + programs.taskwarrior = { + enable = true; + colorTheme = ./nord.theme; + package = pkgs.taskwarrior3; + extraConfig = cfg.includeFiles; + + config = { + complete.all.tags = true; + list.all = { + projects = true; + tags = true; + }; + + news.version = "3.4.1"; + + regex = true; + weekstart = "Monday"; + + uda = { + total_active_time = { + type = "duration"; + label = "Total active time"; + }; + }; + + sync.server = lib.mkIf cfg.enableAge { + client_id = "a3619d43-031f-4f85-848f-5512804f9a1d"; + url = "https://taskchampion.vhack.eu"; + }; + + alias = { + mod = "modify"; + }; + color = true; + + hooks.location = "${hooksDir}"; + + urgency.uda.priority = { + H.coefficient = 6.0; + M.coefficient = 0; + L.coefficient = -1.8; + }; + }; }; }; }; diff --git a/modules/home.legacy/conf/taskwarrior/nord.theme b/modules/by-name/ta/taskwarrior/nord.theme index 2897418f..2897418f 100644 --- a/modules/home.legacy/conf/taskwarrior/nord.theme +++ b/modules/by-name/ta/taskwarrior/nord.theme diff --git a/modules/by-name/ta/taskwarrior/nord.theme.license b/modules/by-name/ta/taskwarrior/nord.theme.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/modules/by-name/ta/taskwarrior/nord.theme.license @@ -0,0 +1,9 @@ +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/by-name/ta/taskwarrior/secrets/ca.cert b/modules/by-name/ta/taskwarrior/secrets/ca.cert deleted file mode 100644 index 81528a2a..00000000 --- a/modules/by-name/ta/taskwarrior/secrets/ca.cert +++ /dev/null @@ -1,161 +0,0 @@ ------BEGIN AGE ENCRYPTED FILE----- -YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSB4dVVkOWlYNjJQSFZYbExM -bENvUTFzbmdPQ0ljR2V1TlJXYUZFVnNMS3owCjNmaE5pNnZ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eesuvE -nFdSiJugyGDh/7mz4BOG7NOm05oGUJJxAnSzV3B1z4sfyZg8rOVa9Ox5kuF4sQxi -WR6l+xgEXndzhYKTaRRa5WMOhh6J5ENKZPQY05h1WKdupufzpm/zrzZidt6c9iJ2 -vmmjT+T/ZHF9x8uN6LaV/jBTo7js1HTmqvxpDxwI5OAdkZNAYb8s/5EoJ04Wz05t -+9iGsxfiRQH1Z1F2fhbH56nrHdgaL15EgQilLqs38FTOvQ0egRwjF7/yVPRGAzSa -kiBbDWlpxqN+Qu5SDY1Er+P7wURHkgflq6uOlfG5DGTKKPKD9wzP9uVregRlFiY6 -UXKo/7yrYcanmmHtlqCRHVWeXhz19UItPzE9ERXT+GqXjlGlSphAk+OBdrb+/6ND -6IPmfRcUxznHtSQQkOcZWznXGc3w7ext+dZ2EBzJYsaj609z5HCisBIbtDS+OmfG -jk+8bKjrFiXBZcARn/MBTycN334vvNiXgq1k5hDwE8mx6/vryADpbBNr+QE3Su3z -+qF0kDR5FDjzPXk3zh5Oj4nrxWAcgVEWl1vcCvULUC88blyyU4IiffygkZyolCqj ------END AGE ENCRYPTED FILE----- diff --git a/modules/by-name/ta/taskwarrior/secrets/credentials b/modules/by-name/ta/taskwarrior/secrets/credentials deleted file mode 100644 index f3aaf502..00000000 --- a/modules/by-name/ta/taskwarrior/secrets/credentials +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN AGE ENCRYPTED FILE----- -YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBqdGQ3a0pWb3lvZXFWbTFQ -UG1JbGREZW9SS3ZuWXJhbTdvTTBqZUdhN0Q0CjF1cnJFM1d2ZFNyRW44Rzlvamlz -VWQycXhmWnB4L1hiSE5qbFozWFlGMU0KLT4gc3NoLWVkMjU1MTkgelpFb25nIEFk -bVQ3U3BsU1FkeWxBY0sySTV2UkxocXJpVXMyd1FrMXA3YUR0NWtTR1kKeUtHODVy -aXE3aXh4WkFmYTJtdlZyZ1A1QlhYZGZuTUYxYVVlblRUV1BqOAotPiBzc2gtZWQy -NTUxOSA3SGZGVXcgdGR4cFMya3p6TEx5cnhYcWNXR2FlVEk3UTBEcHQ3Y3RmK0lY -YlpwRXJGcwpwZUVqODB3SUZUdTlQVW4yaWlZaTE0RE9OT1dLanZlSGV6cnlJRElQ -UjBBCi0+ICFALWdyZWFzZSB0MFU2IDZoIEJPWUZIP1sKN1l2dzdWN1JDbEhEeXBq -THV0cWJIV1RLalVsVVp3RCtwbk5NS2pnd3kxS1RhNTNaa3pqWXZFVm9FM2N2cFp5 -TQpYR2MKLS0tIEhLQWdwL0VoT1ZGNU5UUWs0SVVqK0ZQTndkTURPb0VtNEtJN3or -S0Q0K1UKRfhyrcVb0EbsKj9gL5kqaIpfrsWd2cizrVQ67y9ZOwWilWgk/gkoXadf -q7QeYjnWsHeIVtSZIaHSa8+9pvKAwiYW+B6DjRi7EXkCYz8zGeanMuoKA4by5Q9x -VMKJlWk7c0WIzSuviw== ------END AGE ENCRYPTED FILE----- diff --git a/modules/by-name/ta/taskwarrior/secrets/private.key b/modules/by-name/ta/taskwarrior/secrets/private.key deleted file mode 100644 index 64f925fb..00000000 --- a/modules/by-name/ta/taskwarrior/secrets/private.key +++ /dev/null @@ -1,449 +0,0 @@ ------BEGIN AGE ENCRYPTED FILE----- -YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBncVlhL2RhS3JNaWFIKzl5 -VFV2Y3dZRkE2SlFvV25wd2NRU0NVN1Z0T2pBCmpRM2FJSUpPMGpQRE5EZHR5NElu -UlBLcE9EWVBRSHA4eTRTNHpDaDdIOHMKLT4gc3NoLWVkMjU1MTkgelpFb25nIGlC -cGR2aytobjcxV0xJMUc4d1VseUN2K3NoMEx4UnIzRGZvOTZoNHJVaGMKYWV3TVAw -RWJzN3NnOHo3QnZSL3JvbTFxWG9zQmtISzRIMDJXVXg4U1kvZwotPiBzc2gtZWQy -NTUxOSA3SGZGVXcgV0E4b05Kc3FwRXdFT3Y4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h1U1DVEA7N6z2Yd+SUHygo4EOP1SHDaNbxuXXUdzN3HVc4KSvDFjofmTRIKU -rb+ht8MutJq0fuu6+hzxQGVx755Re1UhpO5J0rCdzZA6Mxl/Tl/RU5H1rslD+YbC -K07MRdYQnDpeDnnWZwFUENEXfZinARfqd4b8WrLvxy2BuyhKXjocARvPP/8zk2yz -fmRjmcs8xvEZ79/DaoYvQOL+YsFKpFim1qSsIwMYf9L0Zgre99O301djmUiBBHe2 -qtOzvdAxDIMihgn6oNKZUMszCM7PVxHbPhLfjPTUffkQ4PE5XusiYdWGdGk7tkyv -D2MW+rjT8wQ75CeG9iwnZ1VyEibbTpELiCTOfDzjuD5H7XfPCHWBr0ZklJ16mPBL -rC/GXhaUb8bhdYi8RJsu3y/0/A8KG5cq7rT0hnChyki4EpT7rns8uKs0BFUEspXO -nrbUiLna89rlMeTOudMojUtkR4nLxcT/0UxOPHfkYsigXR7VlTmkaYs3Ch5dHLKI -xP23qmEtRW0vWvlwuhAQIB0X7t5bZKLnoA2tcqsr+0CzRbn05UYrVCucsbb5D7qU -QJOBAKfvQuKQ2NjOKTwN0b/aUxGhr/bi51+XFMJZibyAsJUlU+LVMH05Wir5L3rp -yOWtti7HK4iBlbgs8KZ1z0YjvD0VmQCkyuluVajUj90bPWKpq/+4xp8Cf2q02xNn -OUWfs5lSnARu12QinxSYDJtPN/0x6lcGixlIX/3ZdTRg4f1REKlRj35paiSruhKf -Mfoar9/TM+perLNXW3/cOII8+LiNVz8y+Vc= ------END AGE ENCRYPTED FILE----- diff --git a/modules/by-name/ta/taskwarrior/secrets/public.cert b/modules/by-name/ta/taskwarrior/secrets/public.cert deleted file mode 100644 index d20ef291..00000000 --- a/modules/by-name/ta/taskwarrior/secrets/public.cert +++ /dev/null @@ -1,83 +0,0 @@ ------BEGIN AGE ENCRYPTED FILE----- -YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBkQVJNM1RDMEp0NkM1dzlF -UE42amNBaERmanAyUDN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WP+8eQc93+inwB/yQVBCmrzQRMb4XUO4kMlw/9+bdaOSzlQ -qrVTJOTwFXenETNNpbHLdzJtu6r1BxG82goKn3hn/qSEViAbkWe/bvfvNIm8Lt4/ -PV3drkHcSXwPl6fn2fLDdYAD0iD3gL0Rb8G8ahkCBr1i85HOwISMyZ0WqtlBrcWZ -mJxcG2QxqBy/8DA1MyP5f6LQ8JQ+pMq0QQ74h4zHAb+MnJYP4kM2u8zAm0EexmfP -ckISP+DSmoL2wFApzVHH29QAbPmi3zj0rD11b+jjvEKRi3iNIq5qA2D2jiIE2w7w -1TiJ4Zhu7qRfhbFtQoLYZPdhXtB7cSabCLmvM0YYVovvl0FgzBjOemtxrnh8QGs1 -N2SbJQehgFnehmUopBbcQ99RUpuj/qB/3XYoGY1KR9ZqQkiHpf6rSVJZJq8TOfY9 -fc+OhAUrAXUV9SrU5eHU92R20jqlsIxocDlwlhhVgxiFwf1hHPtRmhPN3UoJ6lus -SeYGWQurXOtPcIr8ZcMqXuc6RdR9t3rkquLkXTCaXOeOrkEsUGyDM64bEXiYBGiA -iUEd5RIJhRnpkQAYnvDgQc54ObBG6BS+Izo/CnqTsa5d7gITK8p8knZGfTd07iSE -bIQ5b2PViUEptiwkAEqV4/OlVAcNKUJ0Q+rXHJKYjWDUkaRYzwcI44NoU94b3hDW -3BVCaxwDWiMJJOTifbzYFlhccTKwtVXZR34N0FdszJXZ2T4V3jMJ+FHblQyjd2JM -PEu9OvKK4IdhEi02VOxy1hArQqpthcCeMWYgD7iWPcqTFo+1ArovrQFxfcaGNWLi -dw== ------END AGE ENCRYPTED FILE----- diff --git a/modules/by-name/ta/taskwarrior/secrets/sync_server_encryption_key.age b/modules/by-name/ta/taskwarrior/secrets/sync_server_encryption_key.age new file mode 100644 index 00000000..1e1a252e --- /dev/null +++ b/modules/by-name/ta/taskwarrior/secrets/sync_server_encryption_key.age @@ -0,0 +1,41 @@ +-----BEGIN AGE ENCRYPTED FILE----- +YWdlLWVuY3J5cHRpb24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fqTEama/PGbjxC0kVQ9TayPB7ymIjjJquBYKTW74S/exvpYbZz8vN1B +xcwyd7TeMdRYI2nfuI82Q13WoLdLUEW1O5VXPxTm+5pnYbvxfipR4S45+U3tbaaE +YNy26DiZEKUXdyL5Jd+LlArXJXSLd5lzJXs+h8YeogxjtJ7PMmUqmtUDj6PCDrsF +54T5sTGjO2w7QSanwsXgALRgBQpvPTniFpFBllSH44Nj9B2LybmbWIyph67FeIeM +p+YedymnlewwiM2nGcjY/Zs/abdrQwnnKsgkWRGRAHHxhV0pamXfdoZJZEHzebWU +u5iGa9slaCAJxuLs5DQ940e8VFESEwM+e0AECwRmCf+1YazXemiJ+w== +-----END AGE ENCRYPTED FILE----- diff --git a/modules/by-name/ti/timewarrior/module.nix b/modules/by-name/ti/timewarrior/module.nix new file mode 100644 index 00000000..90a541d8 --- /dev/null +++ b/modules/by-name/ti/timewarrior/module.nix @@ -0,0 +1,97 @@ +# 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, + ... +}: let + cfg = config.soispha.programs.timewarrior; + + track_timewarrior = pkgs.stdenv.mkDerivation { + name = "track-timewarrior"; + nativeBuildInputs = [ + pkgs.makeWrapper + ]; + buildInputs = [ + pkgs.timewarrior + pkgs.taskwarrior3 + pkgs.python3 + ]; + dontUnpack = true; + installPhase = '' + install -Dm755 ${./taskwarrior_hooks/on-modify.track-timewarrior.py} $out/bin/track-timewarrior + wrapProgram $out/bin/track-timewarrior \ + --set PATH ${lib.makeBinPath [pkgs.taskwarrior3 pkgs.timewarrior]} + ''; + + meta.mainProgram = "track-timewarrior"; + }; + track_total_active_time = pkgs.stdenv.mkDerivation { + name = "track-total-active-time"; + nativeBuildInputs = [ + pkgs.makeWrapper + ]; + buildInputs = [ + pkgs.taskwarrior3 + pkgs.python3 + ]; + dontUnpack = true; + installPhase = '' + install -Dm755 ${./taskwarrior_hooks/on-modify.track-total-active-time.py} $out/bin/track-total-active-time + wrapProgram $out/bin/track-total-active-time \ + --set PATH ${lib.makeBinPath [pkgs.taskwarrior3]} + ''; + + meta.mainProgram = "track-total-active-time"; + }; +in { + options.soispha.programs.timewarrior = { + enable = lib.mkEnableOption "timewarrior"; + }; + config = lib.mkIf cfg.enable { + soispha.programs.taskwarrior = { + hooks = { + track-timewarrior = { + mode = "on-modify"; + executable = track_timewarrior; + }; + track-total-active-time = { + mode = "on-modify"; + executable = track_total_active_time; + }; + }; + }; + + home-manager.users.soispha = { + home.packages = [ + pkgs.timewarrior + ]; + + xdg.configFile."timewarrior/timewarrior.cfg".text = '' + # source: https://github.com/arcticicestudio/igloo + #+----+ + #+ UI + + #+----+ + import ${./nord.theme} + color = true + + #+---------+ + #+ Reports + + #+---------+ + define reports: + day: + lines = 10 + month = true + week = true + ''; + }; + }; +} diff --git a/modules/home.legacy/conf/timewarrior/nord.theme b/modules/by-name/ti/timewarrior/nord.theme index da3c387a..da3c387a 100644 --- a/modules/home.legacy/conf/timewarrior/nord.theme +++ b/modules/by-name/ti/timewarrior/nord.theme diff --git a/modules/by-name/ti/timewarrior/nord.theme.license b/modules/by-name/ti/timewarrior/nord.theme.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/modules/by-name/ti/timewarrior/nord.theme.license @@ -0,0 +1,9 @@ +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/by-name/ti/timewarrior/taskwarrior_hooks/on-modify.track-timewarrior.py b/modules/by-name/ti/timewarrior/taskwarrior_hooks/on-modify.track-timewarrior.py new file mode 100755 index 00000000..3b42b3f2 --- /dev/null +++ b/modules/by-name/ti/timewarrior/taskwarrior_hooks/on-modify.track-timewarrior.py @@ -0,0 +1,109 @@ +#!/usr/bin/env python3 + +# nixos-config - My current NixOS configuration +# +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# Copyright 2016 - 2021, 2023, Gothenburg Bit Factory +# 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>. + +import json +import subprocess +import sys + +# Hook should extract all the following for use as Timewarrior tags: +# UUID +# Project +# Tags +# Description +# UDAs + +try: + input_stream = sys.stdin.buffer +except AttributeError: + input_stream = sys.stdin + + +MAX_ACTIVE = 1 + + +def extract_tags_from(json_obj) -> [str]: + # Extract attributes for use as tags. + tags = [json_obj["description"]] + + if "project" in json_obj: + tags.append(json_obj["project"]) + + if "tags" in json_obj: + if type(json_obj["tags"]) is str: + # Usage of tasklib (e.g. in taskpirate) converts the tag list into a string + # If this is the case, convert it back into a list first + # See https://github.com/tbabej/taskpirate/issues/11 + tags.extend(json_obj["tags"].split(",")) + else: + tags.extend(json_obj["tags"]) + + return tags + + +def extract_annotation_from(json_obj): + if "annotations" not in json_obj: + return "''" + + return json_obj["annotations"][0]["description"] + + +def main(old, new): + start_or_stop = "" + + # Started task. + if "start" in new and "start" not in old: + # Prevent this task from starting if "task +ACTIVE count" is greater than "MAX_ACTIVE". + p = subprocess.Popen( + ["task", "+ACTIVE", "status:pending", "count", "rc.verbose:off"], + stdout=subprocess.PIPE, + ) + out, err = p.communicate() + count = int(out.rstrip()) + if count >= MAX_ACTIVE: + print( + f"Only {MAX_ACTIVE} task(s) can be active at a time.", + ) + sys.exit(1) + else: + start_or_stop = "start" + + # Stopped task. + elif ("start" not in new or "end" in new) and "start" in old: + start_or_stop = "stop" + + if start_or_stop: + tags = extract_tags_from(new) + + subprocess.call(["timew", start_or_stop] + tags + [":yes"]) + + # Modifications to task other than start/stop + elif "start" in new and "start" in old: + old_tags = extract_tags_from(old) + new_tags = extract_tags_from(new) + + if old_tags != new_tags: + subprocess.call(["timew", "untag", "@1"] + old_tags + [":yes"]) + subprocess.call(["timew", "tag", "@1"] + new_tags + [":yes"]) + + old_annotation = extract_annotation_from(old) + new_annotation = extract_annotation_from(new) + + if old_annotation != new_annotation: + subprocess.call(["timew", "annotate", "@1", new_annotation]) + + +if __name__ == "__main__": + old = json.loads(input_stream.readline().decode("utf-8", errors="replace")) + new = json.loads(input_stream.readline().decode("utf-8", errors="replace")) + print(json.dumps(new)) + main(old, new) diff --git a/modules/home.legacy/conf/taskwarrior/hooks/scripts/on-modify_track-total-active-time.py b/modules/by-name/ti/timewarrior/taskwarrior_hooks/on-modify.track-total-active-time.py index d5b380d0..303a5c57 100755 --- a/modules/home.legacy/conf/taskwarrior/hooks/scripts/on-modify_track-total-active-time.py +++ b/modules/by-name/ti/timewarrior/taskwarrior_hooks/on-modify.track-total-active-time.py @@ -1,8 +1,17 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- +# nixos-config - My current NixOS configuration +# # Copyright (C) 2016-present Arctic Ice Studio <development@arcticicestudio.com> # Copyright (C) 2016-present Sven Greb <development@svengreb.de> +# 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>. # Project: igloo # Repository: https://github.com/arcticicestudio/igloo @@ -20,37 +29,24 @@ By default, this plugin allows to have one task active at a time. This can be ch ``1``. Note: - This hook requires Python 3 and the `taskw`_ package to be installed which provides the python bindings for Taskwarrior! - Also note that this hook is only compatible with Taskwarrior version greater or equal to 2.4! + Note that this hook is only compatible with Taskwarrior version greater or equal to 2.4! This hook is a fork from `kostajh/taskwarrior-time-tracking-hook`_ -.. _taskw: - https://pypi.python.org/pypi/taskw .. _kostajh/taskwarrior-time-tracking-hook: https://github.com/kostajh/taskwarrior-time-tracking-hook """ import datetime import json -import re import sys import subprocess -from taskw import TaskWarrior from typing import TypeVar TIME_FORMAT = "%Y%m%dT%H%M%SZ" UDA_KEY = "total_active_time" -w = TaskWarrior(config_filename=sys.argv[4].replace("rc:", "")) -config = w.load_config(config_filename=sys.argv[4].replace("rc:", "")) -if "max_active_tasks" in config: - MAX_ACTIVE = int(config["max_active_tasks"]) -else: - MAX_ACTIVE = 1 - -"""Compiled regular expression for the duration as ISO-8601 formatted string.""" -ISO8601DURATION = re.compile("P((\d*)Y)?((\d*)M)?((\d*)D)?T((\d*)H)?((\d*)M)?((\d*)S)?") +MAX_ACTIVE = 1 """The duration type either as integer (in seconds), as ISO-8601 formatted string ("PT1H10M31S") or the seconds suffixed with "seconds".""" DurationType = TypeVar("DurationType", str, int) @@ -63,31 +59,7 @@ def duration_str_to_time_delta(duration_str: DurationType) -> datetime.timedelta :return: The duration as timedelta object """ if duration_str.startswith("P"): - match = ISO8601DURATION.match(duration_str) - if match: - year = match.group(2) - month = match.group(4) - day = match.group(6) - hour = match.group(8) - minute = match.group(10) - second = match.group(12) - value = 0 - if second: - value += int(second) - if minute: - value += int(minute) * 60 - if hour: - value += int(hour) * 3600 - if day: - value += int(day) * 3600 * 24 - if month: - # Assume a month is 30 days for now. - value += int(month) * 3600 * 24 * 30 - if year: - # Assume a year is 365 days for now. - value += int(year) * 3600 * 24 * 365 - else: - value = int(duration_str) + value = datetime.fromisoformat(duration_str) elif duration_str.endswith("seconds"): value = int(duration_str.rstrip("seconds")) else: diff --git a/modules/by-name/ts/tskm/module.nix b/modules/by-name/ts/tskm/module.nix new file mode 100644 index 00000000..9bf2b389 --- /dev/null +++ b/modules/by-name/ts/tskm/module.nix @@ -0,0 +1,136 @@ +# 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, + pkgs, + ... +}: let + cfg = config.soispha.programs.tskm; + + allProjectNames = lib.lists.flatten (lib.attrsets.mapAttrsToList mkProject cfg.projects); + + projectList = builtins.concatStringsSep "\n" allProjectNames; + mkProject = name: value: let + subprojects = lib.attrsets.mapAttrsToList (newName: mkProject "${name}.${newName}") value.subprojects; + in + [name] ++ subprojects; + + firefoxProfiles = builtins.listToAttrs (lib.imap0 (index: name: + lib.attrsets.nameValuePair name { + inherit name; + # Add one here, so that we can have the default profile at id 0. + id = index + 1; + }) + allProjectNames); + + contexts = + builtins.concatStringsSep "\n" + (lib.lists.flatten + (lib.attrsets.mapAttrsToList mkContext cfg.projects)); + mkContext = name: value: let + subprojects = + lib.attrsets.mapAttrsToList + (newName: newValue: let + finalValue = + if newValue.prefix == "" + then newValue // {inherit (value) prefix;} + else newValue; + in + mkContext "${name}.${newName}" finalValue) + value.subprojects; + contextName = builtins.replaceStrings ["."] ["_"] name; + in + [ + '' + context.${contextName}.rc.neorg_path=${value.prefix}/index.norg + context.${contextName}.read=project:${name} + context.${contextName}.write=project:${name} + '' + ] + ++ subprojects; + + contextsFile = + pkgs.writeText "contexts-file" contexts; + + projectType = lib.types.submodule { + options = { + name = lib.mkOption { + type = lib.types.str; + example = "timesinks"; + description = "The name of this project"; + }; + + prefix = lib.mkOption { + type = lib.types.str; + default = ""; + example = "programming/zig"; + description = '' + A prefix to append to the project neorg path. + This can be used to group similar project's neorg directories together. ' + ''; + }; + + subprojects = lib.mkOption { + type = lib.types.attrsOf projectType; + description = '' + A list of subprojects. + These can also contain subprojects. + ''; + default = {}; + }; + }; + }; +in { + options.soispha.programs.tskm = { + enable = lib.mkEnableOption "tskm"; + + projects = lib.mkOption { + type = lib.types.attrsOf projectType; + }; + }; + + config = lib.mkIf cfg.enable { + soispha.programs = { + firefox.profiles = firefoxProfiles; + taskwarrior = { + includeFiles = { + tskm-contexts = contextsFile; + }; + hooks = { + enforce-projects = + config.lib.taskwarrior.mkHook "on-add" [ + pkgs.jq + pkgs.gnugrep + pkgs.tskm + ] + ./taskwarrior_hooks/enforce-projects.sh; + }; + }; + }; + + home-manager.users.soispha = { + home.sessionVariables = { + # TODO: Remove this hard-coded path with a reference. <2025-04-04> + "TSKM_PROJECT_FILE" = "/home/soispha/repos/nix/own/config/modules/common/projects.json"; + }; + + programs.nixvim = { + plugins.neorg.settings.load."core.dirman".config.workspaces = { + tskm = "~/.local/share/tskm/notes"; + }; + }; + + xdg.configFile."tskm/projects.list" = { + text = projectList; + }; + }; + }; +} diff --git a/modules/by-name/ts/tskm/taskwarrior_hooks/enforce-projects.sh b/modules/by-name/ts/tskm/taskwarrior_hooks/enforce-projects.sh new file mode 100755 index 00000000..c3e377c0 --- /dev/null +++ b/modules/by-name/ts/tskm/taskwarrior_hooks/enforce-projects.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env sh + +# 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>. + +new_task="$1" + +project="$(echo "$new_task" | jq '.project' --raw-output)" +[ "$project" = "null" ] && die "No project supplied!" + +if ! tskm projects list | grep -q "^$project$"; then + die "The project '$project' is not (yet) registered, registered projects: $(tskm projects list | tr '\n' ',')" +fi + +# vim: ft=sh diff --git a/modules/by-name/un/unison/module.nix b/modules/by-name/un/unison/module.nix index 9de27c0f..8d156b00 100644 --- a/modules/by-name/un/unison/module.nix +++ b/modules/by-name/un/unison/module.nix @@ -1,13 +1,21 @@ +# 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, pkgs, - sysLib, ... }: let cfg = config.soispha.services.unison; - script = import ./shellScript.nix {inherit sysLib lib pkgs cfg;}; + script = import ./shellScript.nix {inherit lib pkgs cfg;}; in { options.soispha.services.unison = let homePath = lib.types.strMatching "^~.*"; diff --git a/modules/by-name/un/unison/shellScript.nix b/modules/by-name/un/unison/shellScript.nix index 4618ae8e..df373805 100644 --- a/modules/by-name/un/unison/shellScript.nix +++ b/modules/by-name/un/unison/shellScript.nix @@ -1,5 +1,13 @@ +# 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>. { - sysLib, lib, pkgs, cfg, @@ -60,7 +68,7 @@ lib.strings.concatStringsSep " " [ "unison" "${serialiseArgs cfg.unisonOptions}" - "$EXTRA_OPTIONS" + "\"$@\"" "${getIgnored cfg.pathsToIgnore path}" "${esa path}" (esa "ssh://${cfg.foreign.userName}@${cfg.foreign.address}/${path}") @@ -68,24 +76,18 @@ script = lib.strings.concatStringsSep "\n" (builtins.map mkScriptLine cfg.pathsToSync); in - sysLib.writeShellScript { + pkgs.writeShellApplication { name = "unison-sync"; - src = builtins.toFile "unison-backup" ('' - #!/usr/bin/env dash + text = script; - # shellcheck source=/dev/null - SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH - - export UNISON=${esa cfg.dataDir}; - - EXTRA_OPTIONS="$UNISON_EXTRA_OPTIONS $*" - '' - + script); + runtimeEnv = { + UNISON = cfg.dataDir; + }; - dependencies = with pkgs; [ - unison - openssh # needed to connect to the other server - less # needed to show diffs - diffutils # needed to compute diffs + runtimeInputs = [ + pkgs.unison + pkgs.openssh # needed to connect to the other server + pkgs.less # needed to show diffs + pkgs.diffutils # needed to compute diffs ]; } diff --git a/modules/by-name/us/users/module.nix b/modules/by-name/us/users/module.nix index a44df7e8..555e61f9 100644 --- a/modules/by-name/us/users/module.nix +++ b/modules/by-name/us/users/module.nix @@ -1,3 +1,12 @@ +# 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, @@ -8,6 +17,7 @@ in { options.soispha.users = { enable = lib.mkEnableOption "user set-up for soispha"; + hashedPassword = lib.mkOption { type = lib.types.str; example = lib.literalExpression "$y$jFT$ONrCqZIJKB7engmfA4orD/$0GO58/wV5wrYWj0cyONhyujZPjFmbT0XKtx2AvXLG0B"; @@ -31,19 +41,42 @@ in { users = { mutableUsers = false; - users.soispha = { - isNormalUser = true; - home = "/home/soispha"; - createHome = true; - shell = pkgs.zsh; - initialHashedPassword = cfg.hashedPassword; - extraGroups = cfg.groups ++ lib.optional cfg.enableDeprecatedPlugdev "plugdev"; - - uid = 1000; - openssh.authorizedKeys.keys = [ - # TODO: This should be parameterized. <2024-05-16> - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIME4ZVa+IoZf6T3U08JG93i6QIAJ4amm7mkBzO14JSkz" - ]; + users = { + soispha = { + isNormalUser = true; + home = "/home/soispha"; + createHome = true; + shell = pkgs.zsh; + initialHashedPassword = cfg.hashedPassword; + extraGroups = cfg.groups ++ lib.optional cfg.enableDeprecatedPlugdev "plugdev"; + + uid = 1000; + openssh.authorizedKeys.keys = [ + # TODO: This should be parameterized. <2024-05-16> + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIME4ZVa+IoZf6T3U08JG93i6QIAJ4amm7mkBzO14JSkz" + ]; + }; + + root = { + hashedPassword = lib.mkForce null; # to lock root + openssh.authorizedKeys.keys = lib.mkForce []; + }; + }; + }; + + home-manager.users = { + soispha.home = { + username = "soispha"; + homeDirectory = config.users.users.soispha.home; + stateVersion = "23.05"; + enableNixpkgsReleaseCheck = true; + }; + + root.home = { + username = "root"; + homeDirectory = config.users.users.root.home; + stateVersion = "23.05"; + enableNixpkgsReleaseCheck = true; }; }; }; diff --git a/modules/by-name/ve/version/module.nix b/modules/by-name/ve/version/module.nix index 77cada14..fc03b107 100644 --- a/modules/by-name/ve/version/module.nix +++ b/modules/by-name/ve/version/module.nix @@ -1,3 +1,12 @@ +# 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, diff --git a/modules/by-name/wa/water-reminder/module.nix b/modules/by-name/wa/water-reminder/module.nix new file mode 100644 index 00000000..76e5aafa --- /dev/null +++ b/modules/by-name/wa/water-reminder/module.nix @@ -0,0 +1,66 @@ +# 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, + ... +}: let + cfg = config.soispha.services.water-reminder; +in { + options.soispha.services.water-reminder = { + enable = lib.mkEnableOption "periodic reminder for water intake"; + + frequency = lib.mkOption { + type = lib.types.str; + default = "*-*-* *:00/30:00"; # Every 30 minutes + description = '' + How often to remind. This value is passed to the systemd + timer configuration as the `OnCalendar` option. See + {manpage}`systemd.time(7)` for more information about the format. + ''; + }; + }; + + config = lib.mkIf cfg.enable { + home-manager.users.soispha = { + systemd.user.services.water-reminder = { + Unit = {Description = "Water reminder";}; + Service = { + CPUSchedulingPolicy = "idle"; + IOSchedulingClass = "idle"; + ExecStart = lib.getExe ( + pkgs.writeShellApplication { + name = "water-reminder"; + + inheritPath = false; + runtimeInputs = [pkgs.libnotify]; + + text = + # bash + '' + notify-send 'Seek fluid intake' 'Water intake required' --wait --expire-time=0 --urgency=critical + ''; + } + ); + }; + }; + + systemd.user.timers.water-reminder = { + Unit = {Description = "periodic reminder for water intake";}; + Timer = { + Unit = "water-reminder.service"; + OnCalendar = cfg.frequency; + }; + Install = {WantedBy = ["timers.target"];}; + }; + }; + }; +} diff --git a/modules/by-name/wa/waydroid/module.nix b/modules/by-name/wa/waydroid/module.nix index 58bce7d1..a55ccf90 100644 --- a/modules/by-name/wa/waydroid/module.nix +++ b/modules/by-name/wa/waydroid/module.nix @@ -1,3 +1,12 @@ +# 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, diff --git a/modules/by-name/xd/xdg/module.nix b/modules/by-name/xd/xdg/module.nix index 5140a832..94c5a975 100644 --- a/modules/by-name/xd/xdg/module.nix +++ b/modules/by-name/xd/xdg/module.nix @@ -1,58 +1,128 @@ +# 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, - nixpkgs_open_prs, - sysLib, - system, + lib, + config, ... }: let - pkgs_tfc = nixpkgs_open_prs.nixpkgs-tfc.legacyPackages."${system}"; + lf-wrapper = pkgs.writeShellApplication { + name = "lf-wrapper"; + + runtimeInputs = [pkgs.lf pkgs.alacritty]; + inheritPath = true; + + text = builtins.readFile ./scripts/lf-wrapper.sh; + }; + + url-handler = pkgs.writeShellApplication { + name = "url-handler"; + + runtimeInputs = [pkgs.rofi pkgs.libnotify pkgs.zathura pkgs.tskm]; + inheritPath = false; + + text = builtins.readFile ./scripts/url-handler.sh; + }; + + tfcConfigFile = (pkgs.formats.ini {}).generate "xdg-desktop-portal-termfilechooser.ini" { + filechooser = { + default_dir = "/tmp"; + cmd = "${lib.getExe lf-wrapper}"; + }; + }; + + cfg = config.soispha.xdg; in { - services.dbus.enable = true; - xdg = { - portal = { - enable = true; - termfilechooser = { - enable = true; - logLevel = "TRACE"; - package = pkgs_tfc.xdg-desktop-portal-termfilechooser; - settings = { - filechooser = { - default_dir = "/tmp"; - cmd = "${sysLib.writeShellScript { - src = ./scripts/lf_wrapper.sh; - name = "lf_wrapper"; - keepPath = true; - dependencies = with pkgs; [ - lf - alacritty - bash - ]; - }}/bin/lf_wrapper"; + options.soispha.xdg = { + enable = lib.mkEnableOption "xdg"; + }; + + config = lib.mkIf cfg.enable { + home-manager.users.soispha = { + xdg = { + configFile."xdg-desktop-portal-termfilechooser/config".source = tfcConfigFile; + + desktopEntries = { + url-handler = { + name = "url-handler"; + genericName = "Web Browser"; + exec = "${lib.getExe url-handler} %u"; + terminal = false; + categories = [ + "Application" + "Network" + "WebBrowser" + ]; + mimeType = [ + "text/html" + "text/xml" + "x-scheme-handler/http" + "x-scheme-handler/https" + "x-scheme-handler/about" + "x-scheme-handler/unknown" + ]; }; }; }; - wlr = { + }; + + services.dbus.enable = true; + + xdg = { + mime = { enable = true; + defaultApplications = { + "application/pdf" = ["url-handler.desktop"]; + "application/x-pdf" = ["url-handler.desktop"]; + + "text/html" = ["url-handler.desktop"]; + "text/xml" = ["url-handler.desktop"]; + "x-scheme-handler/http" = ["url-handler.desktop"]; + "x-scheme-handler/https" = ["url-handler.desktop"]; + "x-scheme-handler/about" = ["url-handler.desktop"]; + "x-scheme-handler/unknown" = ["url-handler.desktop"]; + }; }; - config = { - common = { - # NOTE: The next entry is supposedly needed for gtk based apps <2023-08-31> - default = ["wlr" "gtk"]; - "org.freedesktop.impl.portal.FileChooser" = ["termfilechooser"]; + + portal = { + enable = true; + wlr = { + enable = true; }; + config = { + common = { + # NOTE: The next entry is supposedly needed for gtk based apps <2023-08-31> + default = ["wlr" "gtk"]; + "org.freedesktop.impl.portal.FileChooser" = ["termfilechooser"]; + }; - # TODO: Also activate, when on another wlr-based compositor <2023-11-25> - river = { - default = ["wlr" "gtk"]; - "org.freedesktop.impl.portal.FileChooser" = ["termfilechooser"]; + # TODO: Also activate, when on another wlr-based compositor <2023-11-25> + river = { + default = ["wlr" "gtk"]; + "org.freedesktop.impl.portal.FileChooser" = ["termfilechooser"]; + }; }; + + extraPortals = [ + pkgs.xdg-desktop-portal-gtk + pkgs.xdg-desktop-portal-wlr + pkgs.xdg-desktop-portal-termfilechooser + ]; }; - extraPortals = [ - pkgs.xdg-desktop-portal-gtk - pkgs.xdg-desktop-portal-wlr - pkgs_tfc.xdg-desktop-portal-termfilechooser + }; + + systemd.user.services.xdg-desktop-portal-termfilechooser = { + serviceConfig.ExecStart = [ + "" + "${pkgs.xdg-desktop-portal-termfilechooser}/libexec/xdg-desktop-portal-termfilechooser --loglevel=TRACE" ]; }; }; - # TODO: mime = {}; } diff --git a/modules/by-name/xd/xdg/scripts/lf-wrapper.sh b/modules/by-name/xd/xdg/scripts/lf-wrapper.sh new file mode 100755 index 00000000..6a5c5295 --- /dev/null +++ b/modules/by-name/xd/xdg/scripts/lf-wrapper.sh @@ -0,0 +1,50 @@ +#!/usr/bin/env sh + +# 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>. + +# This wrapper script is invoked by xdg-desktop-portal-termfilechooser. +# +# For more information about input/output arguments read `xdg-desktop-portal-termfilechooser(5)` + +set -ex + +multiple="$1" +directory="$2" +save="$3" +path="$4" +out="$5" + +# echo > /tmp/stdout +# echo > /tmp/stderr +# +# exec 1>> /tmp/stdout +# exec 2>> /tmp/stderr + +if [ "$save" = "1" ]; then + # save a file + set -- -selection-path="$out" -command='set promptfmt "Select the file to write to %S \033[32;1m%u@%h\033[0m:\033[34;1m%d\033[0m\033[1m%f\033[0m"' "$path" +elif [ "$directory" = "1" ]; then + # upload files from a directory + set -- -last-dir-path="$out" -command='set dironly' -command='set promptfmt "Select directory (quit in dir to select it) %S \033[32;1m%u@%h\033[0m:\033[34;1m%d\033[0m\033[1m%f\033[0m"' "$path" +elif [ "$multiple" = "1" ]; then + # upload multiple files + set -- -selection-path="$out" -command='set promptfmt "Select file(s) (open file to select it; <Space> to select multiple) %S \033[32;1m%u@%h\033[0m:\033[34;1m%d\033[0m\033[1m%f\033[0m"' "$path" +else + # upload only 1 file + set -- -selection-path="$out" -command='set promptfmt "Select file (open file to select it) %S \033[32;1m%u@%h\033[0m:\033[34;1m%d\033[0m\033[1m%f\033[0m"' "$path" +fi + +alacritty --title 'floating please' -e lf "$@" + +# Delete the left recommended file, if we did not actually save anything. +if [ "$save" = "1" ] && ! [ -s "$out" ]; then + rm "$path" +fi diff --git a/modules/by-name/xd/xdg/scripts/lf_wrapper.sh b/modules/by-name/xd/xdg/scripts/lf_wrapper.sh deleted file mode 100755 index 16603fe4..00000000 --- a/modules/by-name/xd/xdg/scripts/lf_wrapper.sh +++ /dev/null @@ -1,79 +0,0 @@ -#!/usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH - -# This wrapper script is invoked by xdg-desktop-portal-termfilechooser. -# -# Inputs: -# 1. "1" if multiple files can be chosen, "0" otherwise. -# 2. "1" if a directory should be chosen, "0" otherwise. -# 3. "0" if opening files was requested, "1" if writing to a file was -# requested. For example, when uploading files in Firefox, this will be "0". -# When saving a web page in Firefox, this will be "1". -# 4. If writing to a file, this is recommended path provided by the caller. For -# example, when saving a web page in Firefox, this will be the recommended -# path Firefox provided, such as "~/Downloads/webpage_title.html". -# Note that if the path already exists, we keep appending "_" to it until we -# get a path that does not exist. -# 5. The output path, to which results should be written. -# -# Output: -# The script should print the selected paths to the output path (argument #5), -# one path per line. -# If nothing is printed, then the operation is assumed to have been canceled. - -multiple="$1" -directory="$2" -save="$3" -recommended_path="$4" -out="$5" - -# echo > /tmp/stdout -# echo > /tmp/stderr -# -# exec 1>> /tmp/stdout -# exec 2>> /tmp/stderr - -cmd="$(command -v lf)" -termcmd="${TERMINAL:-$(command -v alacritty)}" - -if [ "$save" = "1" ]; then - set -- -selection-path="$out" -command='set promptfmt "Select the file to write to %S \033[32;1m%u@%h\033[0m:\033[34;1m%d\033[0m\033[1m%f\033[0m"' "$recommended_path" - cat <<EOF >"$recommended_path" -xdg-desktop-portal-termfilechooser saving files tutorial - -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!!! === WARNING! === !!! -!!! The contents of *whatever* file you open last in !!! -!!! lf will be *overwritten*! !!! -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - -Instructions: -1) Move this file wherever you want. -2) Rename the file if needed. -3) Confirm your selection by opening the file, for - example by pressing <Enter>. - -Notes: -1) This file is provided for your convenience. You - could delete it and choose another file to overwrite - that, for example. -2) If you quit lf without opening a file, this file - will be removed and the save operation aborted. -EOF - -elif [ "$directory" = "1" ]; then - set -- -selection-path="$out" -command='set dironly' -command='set promptfmt "Select directory (quit in dir to select it) %S \033[32;1m%u@%h\033[0m:\033[34;1m%d\033[0m\033[1m%f\033[0m"' -elif [ "$multiple" = "1" ]; then - set -- -selection-path="$out" -command='set promptfmt "Select file(s) (open file to select it; <Space> to select multiple) %S \033[32;1m%u@%h\033[0m:\033[34;1m%d\033[0m\033[1m%f\033[0m"' -else - set -- -selection-path="$out" -command='set promptfmt "Select file (open file to select it) %S \033[32;1m%u@%h\033[0m:\033[34;1m%d\033[0m\033[1m%f\033[0m"' -fi - -"$termcmd" --title 'floating please' -e "$cmd" "$@" - -if [ "$save" = "1" ] && [ ! -s "$out" ]; then - rm "$recommended_path" -fi -# vim: ft=sh diff --git a/modules/by-name/xd/xdg/scripts/ranger_wrapper.sh b/modules/by-name/xd/xdg/scripts/ranger_wrapper.sh deleted file mode 100755 index e148bf19..00000000 --- a/modules/by-name/xd/xdg/scripts/ranger_wrapper.sh +++ /dev/null @@ -1,68 +0,0 @@ -#!/usr/bin/env dash - -# shellcheck source=/dev/null -SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH -# This wrapper script is invoked by xdg-desktop-portal-termfilechooser. -# -# Inputs: -# 1. "1" if multiple files can be chosen, "0" otherwise. -# 2. "1" if a directory should be chosen, "0" otherwise. -# 3. "0" if opening files was requested, "1" if writing to a file was -# requested. For example, when uploading files in Firefox, this will be "0". -# When saving a web page in Firefox, this will be "1". -# 4. If writing to a file, this is recommended path provided by the caller. For -# example, when saving a web page in Firefox, this will be the recommended -# path Firefox provided, such as "~/Downloads/webpage_title.html". -# Note that if the path already exists, we keep appending "_" to it until we -# get a path that does not exist. -# 5. The output path, to which results should be written. -# -# Output: -# The script should print the selected paths to the output path (argument #5), -# one path per line. -# If nothing is printed, then the operation is assumed to have been canceled. - -multiple="$1" -directory="$2" -save="$3" -path="$4" -out="$5" - -cmd="$(command -v ranger)" -termcmd="${TERMCMD:-$(command -v kitty)}" - -if [ "$save" = "1" ]; then - set -- --choosefile="$out" --cmd='echo Select save path (see tutorial in preview pane; try pressing zv or zp if no preview)' "$path" - printf '%s' 'xdg-desktop-portal-termfilechooser saving files tutorial - -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!!! === WARNING! === !!! -!!! The contents of *whatever* file you open last in !!! -!!! ranger will be *overwritten*! !!! -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - -Instructions: -1) Move this file wherever you want. -2) Rename the file if needed. -3) Confirm your selection by opening the file, for - example by pressing <Enter>. - -Notes: -1) This file is provided for your convenience. You - could delete it and choose another file to overwrite - that, for example. -2) If you quit ranger without opening a file, this file - will be removed and the save operation aborted. -' >"$path" -elif [ "$directory" = "1" ]; then - set -- --choosedir="$out" --show-only-dirs --cmd="echo Select directory (quit in dir to select it)" -elif [ "$multiple" = "1" ]; then - set -- --choosefiles="$out" --cmd="echo Select file(s) (open file to select it; <Space> to select multiple)" -else - set -- --choosefile="$out" --cmd="echo Select file (open file to select it)" -fi - -"$termcmd" -- "$cmd" "$@" -if [ "$save" = "1" ] && [ ! -s "$out" ]; then - rm "$path" -fi diff --git a/modules/by-name/xd/xdg/scripts/url-handler.sh b/modules/by-name/xd/xdg/scripts/url-handler.sh new file mode 100755 index 00000000..b3563349 --- /dev/null +++ b/modules/by-name/xd/xdg/scripts/url-handler.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env sh + +# 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>. + +project="$({ + tskm projects list + printf "%s\n" nvim zathura +} | rofi -sep "$(printf "\n")" -dmenu)" + +if [ "$project" = "nvim" ]; then + "$TERMINAL" -e nvim "$1" +elif [ "$project" = "zathura" ]; then + zathura "$1" +elif [ "$project" ]; then + tskm open project "$project" "$1" +else + notify-send "(URL HANDLER) No project selected" + exit 1 +fi + +# vim: ft=sh diff --git a/modules/by-name/ya/yambar/config/config.yml b/modules/by-name/ya/yambar/config/config.yml index 442135aa..14da18fd 100644 --- a/modules/by-name/ya/yambar/config/config.yml +++ b/modules/by-name/ya/yambar/config/config.yml @@ -1,3 +1,13 @@ +# 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 file for yambar # Note that this may be version-dependent, this file is written for v1.8.0 diff --git a/modules/by-name/ya/yambar/module.nix b/modules/by-name/ya/yambar/module.nix index 2d0f1e97..40edf978 100644 --- a/modules/by-name/ya/yambar/module.nix +++ b/modules/by-name/ya/yambar/module.nix @@ -1,6 +1,14 @@ +# 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, - sysLib, pkgs, lib, ... @@ -12,12 +20,11 @@ dependencies, ... }: - sysLib.writeShellScript { + lib.getExe (pkgs.writeShellApplication { inherit name; - src = ./scripts/${name}.sh; - dependencies = dependencies ++ (builtins.attrValues {inherit (pkgs) dash;}); - } - + "/bin/${name}"; + text = builtins.readFile ./scripts/${name}.sh; + runtimeInputs = dependencies ++ (builtins.attrValues {inherit (pkgs) dash;}); + }); mkWrapper = bin: cmd: pkgs.writeShellScript cmd '' diff --git a/modules/by-name/ya/yambar/scripts/disk.sh b/modules/by-name/ya/yambar/scripts/disk.sh index a5547a74..4efe1384 100755 --- a/modules/by-name/ya/yambar/scripts/disk.sh +++ b/modules/by-name/ya/yambar/scripts/disk.sh @@ -1,5 +1,15 @@ #! /usr/bin/env dash +# 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 source=/dev/null SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH diff --git a/modules/by-name/ya/yambar/scripts/mpd_song_name.sh b/modules/by-name/ya/yambar/scripts/mpd_song_name.sh index 7d294781..5c288d1a 100755 --- a/modules/by-name/ya/yambar/scripts/mpd_song_name.sh +++ b/modules/by-name/ya/yambar/scripts/mpd_song_name.sh @@ -1,5 +1,15 @@ #!/usr/bin/env dash +# 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 source=/dev/null SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH diff --git a/modules/by-name/ya/yambar/scripts/network.sh b/modules/by-name/ya/yambar/scripts/network.sh index adfc93df..d642e6c7 100755 --- a/modules/by-name/ya/yambar/scripts/network.sh +++ b/modules/by-name/ya/yambar/scripts/network.sh @@ -1,5 +1,15 @@ #! /usr/bin/env dash +# 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 source=/dev/null SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH diff --git a/modules/by-name/ya/yambar/scripts/sound-volume.sh b/modules/by-name/ya/yambar/scripts/sound-volume.sh index 8a98daf7..9d9f7be8 100755 --- a/modules/by-name/ya/yambar/scripts/sound-volume.sh +++ b/modules/by-name/ya/yambar/scripts/sound-volume.sh @@ -1,5 +1,15 @@ #! /usr/bin/env dash +# 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 source=/dev/null SHELL_LIBRARY_VERSION="2.1.2" . %SHELL_LIBRARY_PATH diff --git a/modules/by-name/ya/yambar/settings/default.nix b/modules/by-name/ya/yambar/settings/default.nix index 52c3d1f7..ebe17261 100644 --- a/modules/by-name/ya/yambar/settings/default.nix +++ b/modules/by-name/ya/yambar/settings/default.nix @@ -1,3 +1,12 @@ +# 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 should not do something depending on whether the host is a laptop or not. It # should instead match on monitor-width or scale factor. <2024-11-29> { diff --git a/modules/by-name/yt/yt/config.toml b/modules/by-name/yt/yt/config.toml index 981481d9..aecb74ba 100644 --- a/modules/by-name/yt/yt/config.toml +++ b/modules/by-name/yt/yt/config.toml @@ -1,2 +1,12 @@ +# 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>. + [download] max_cache_size = "5 GiB" diff --git a/modules/by-name/yt/yt/input.conf b/modules/by-name/yt/yt/input.conf index 10e453a1..68dad824 100644 --- a/modules/by-name/yt/yt/input.conf +++ b/modules/by-name/yt/yt/input.conf @@ -7,8 +7,8 @@ D script-message yt-description-local WHEEL_LEFT playlist-prev WHEEL_RIGHT playlist-next -q script-message yt-mark-done-and-go-next -Q script-message yt-mark-watch-later +q script-message yt-mark-watched +Q script-message yt-mark-picked r script-message yt-check-new-videos P quit diff --git a/modules/by-name/yt/yt/input.conf.license b/modules/by-name/yt/yt/input.conf.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/modules/by-name/yt/yt/input.conf.license @@ -0,0 +1,9 @@ +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/by-name/yt/yt/module.nix b/modules/by-name/yt/yt/module.nix index b93feeb5..4e7e90fe 100644 --- a/modules/by-name/yt/yt/module.nix +++ b/modules/by-name/yt/yt/module.nix @@ -1,3 +1,12 @@ +# 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, diff --git a/modules/by-name/yt/yt/mpv.conf b/modules/by-name/yt/yt/mpv.conf index b6d2501f..52a40823 100644 --- a/modules/by-name/yt/yt/mpv.conf +++ b/modules/by-name/yt/yt/mpv.conf @@ -1,2 +1 @@ -speed=2.7 volume=75 diff --git a/modules/by-name/yt/yt/mpv.conf.license b/modules/by-name/yt/yt/mpv.conf.license new file mode 100644 index 00000000..eae6a84c --- /dev/null +++ b/modules/by-name/yt/yt/mpv.conf.license @@ -0,0 +1,9 @@ +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/by-name/za/zathura/module.nix b/modules/by-name/za/zathura/module.nix index 1c55be54..a332e313 100644 --- a/modules/by-name/za/zathura/module.nix +++ b/modules/by-name/za/zathura/module.nix @@ -1,3 +1,12 @@ +# 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, diff --git a/modules/by-name/zs/zsh/config/command_not_found/command_not_found_insult.sh b/modules/by-name/zs/zsh/config/command_not_found/command_not_found_insult.sh index 5126845a..a5d71939 100644 --- a/modules/by-name/zs/zsh/config/command_not_found/command_not_found_insult.sh +++ b/modules/by-name/zs/zsh/config/command_not_found/command_not_found_insult.sh @@ -1,4 +1,15 @@ #! /usr/bin/env bash + +# 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>. + print_message() { local messages diff --git a/modules/by-name/zs/zsh/config/custom_cursor.zsh b/modules/by-name/zs/zsh/config/custom_cursor.zsh index 071bb5fe..aa137173 100644 --- a/modules/by-name/zs/zsh/config/custom_cursor.zsh +++ b/modules/by-name/zs/zsh/config/custom_cursor.zsh @@ -1,5 +1,15 @@ #!/usr/bin/env zsh +# 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>. + autoload -U add-zsh-hook autoload -U add-zle-hook-widget diff --git a/modules/by-name/zs/zsh/config/edit_command_line.zsh b/modules/by-name/zs/zsh/config/edit_command_line.zsh index 1d51a4e8..e14da5c6 100644 --- a/modules/by-name/zs/zsh/config/edit_command_line.zsh +++ b/modules/by-name/zs/zsh/config/edit_command_line.zsh @@ -1,5 +1,15 @@ #! /usr/bin/env zsh +# 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>. + autoload -Uz edit-command-line wrapped_edit-command-line() { diff --git a/modules/by-name/zs/zsh/config/keymaps/.safe.zsh b/modules/by-name/zs/zsh/config/keymaps/.safe.zsh index ee3bfa32..b37d22f2 100644 --- a/modules/by-name/zs/zsh/config/keymaps/.safe.zsh +++ b/modules/by-name/zs/zsh/config/keymaps/.safe.zsh @@ -1,3 +1,13 @@ +# 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>. + bindkey -M .safe "^J" .accept-line bindkey -M .safe "^M" .accept-line bindkey -R -M .safe "^@"-"^I" .self-insert diff --git a/modules/by-name/zs/zsh/config/keymaps/command.zsh b/modules/by-name/zs/zsh/config/keymaps/command.zsh index 81ae6dda..e195ed4c 100644 --- a/modules/by-name/zs/zsh/config/keymaps/command.zsh +++ b/modules/by-name/zs/zsh/config/keymaps/command.zsh @@ -1,3 +1,13 @@ +# 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>. + # Keymap used in the vicmd `execute-named-cmd` mode bindkey -N command diff --git a/modules/by-name/zs/zsh/config/keymaps/emacs.zsh b/modules/by-name/zs/zsh/config/keymaps/emacs.zsh index b789faf5..1cbf77e9 100644 --- a/modules/by-name/zs/zsh/config/keymaps/emacs.zsh +++ b/modules/by-name/zs/zsh/config/keymaps/emacs.zsh @@ -1,3 +1,13 @@ +# 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>. + bindkey -N emacs bindkey -M emacs "^[A" accept-and-hold diff --git a/modules/by-name/zs/zsh/config/keymaps/isearch.zsh b/modules/by-name/zs/zsh/config/keymaps/isearch.zsh index db80bae8..d5e68f1b 100644 --- a/modules/by-name/zs/zsh/config/keymaps/isearch.zsh +++ b/modules/by-name/zs/zsh/config/keymaps/isearch.zsh @@ -1,2 +1,12 @@ +# 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>. + # Nothing? bindkey -N isearch diff --git a/modules/by-name/zs/zsh/config/keymaps/vicmd.zsh b/modules/by-name/zs/zsh/config/keymaps/vicmd.zsh index ceb4f348..acf3746d 100644 --- a/modules/by-name/zs/zsh/config/keymaps/vicmd.zsh +++ b/modules/by-name/zs/zsh/config/keymaps/vicmd.zsh @@ -1,3 +1,13 @@ +# 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>. + bindkey -N vicmd # Bind in string to out string diff --git a/modules/by-name/zs/zsh/config/keymaps/viins.zsh b/modules/by-name/zs/zsh/config/keymaps/viins.zsh index d215d190..3353956c 100644 --- a/modules/by-name/zs/zsh/config/keymaps/viins.zsh +++ b/modules/by-name/zs/zsh/config/keymaps/viins.zsh @@ -1,3 +1,13 @@ +# 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>. + bindkey -N viins # Completion Debugging diff --git a/modules/by-name/zs/zsh/config/keymaps/viopp.zsh b/modules/by-name/zs/zsh/config/keymaps/viopp.zsh index 8b291d00..3dd900f8 100644 --- a/modules/by-name/zs/zsh/config/keymaps/viopp.zsh +++ b/modules/by-name/zs/zsh/config/keymaps/viopp.zsh @@ -1,3 +1,13 @@ +# 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>. + bindkey -N viopp bindkey -M viopp "t" down-line diff --git a/modules/by-name/zs/zsh/config/keymaps/visual.zsh b/modules/by-name/zs/zsh/config/keymaps/visual.zsh index c09cd578..73191d94 100644 --- a/modules/by-name/zs/zsh/config/keymaps/visual.zsh +++ b/modules/by-name/zs/zsh/config/keymaps/visual.zsh @@ -1,3 +1,13 @@ +# 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>. + bindkey -N visual bindkey -M visual "^[" deactivate-region diff --git a/modules/by-name/zs/zsh/config/keymaps_end.zsh b/modules/by-name/zs/zsh/config/keymaps_end.zsh index 2e973de4..2ce403a5 100644 --- a/modules/by-name/zs/zsh/config/keymaps_end.zsh +++ b/modules/by-name/zs/zsh/config/keymaps_end.zsh @@ -1,2 +1,12 @@ +# 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>. + # Use the vi imitation keymap as default bindkey -A viins main diff --git a/modules/by-name/zs/zsh/config/keymaps_start.zsh b/modules/by-name/zs/zsh/config/keymaps_start.zsh index 2504e799..dfae8dcc 100644 --- a/modules/by-name/zs/zsh/config/keymaps_start.zsh +++ b/modules/by-name/zs/zsh/config/keymaps_start.zsh @@ -1,3 +1,13 @@ +# 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>. + # Delete all default keymaps (with the exception of .safe) bindkey -D command emacs isearch main vicmd viins viopp visual diff --git a/modules/by-name/zs/zsh/config/zsh-init.zsh b/modules/by-name/zs/zsh/config/zsh-init.zsh index aac344dc..740fc44b 100644 --- a/modules/by-name/zs/zsh/config/zsh-init.zsh +++ b/modules/by-name/zs/zsh/config/zsh-init.zsh @@ -1,5 +1,15 @@ #!/usr/bin/env zsh +# 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>. + # Display current tasks [ -z "$NVIM" ] && task next diff --git a/modules/by-name/zs/zsh/module.nix b/modules/by-name/zs/zsh/module.nix index 833da126..bf7e2a71 100644 --- a/modules/by-name/zs/zsh/module.nix +++ b/modules/by-name/zs/zsh/module.nix @@ -1,111 +1,143 @@ +# 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, - shell_library, system, + pkgs, ... }: let cfg = config.soispha.programs.zsh; - homeConfig = config.home-manager.users.soispha; + + zDotDir = ".config/zsh"; sourceFile = path: "source ${path}\n"; + + extraFiles = builtins.concatStringsSep "\n" ( + builtins.map (value: + if builtins.isPath value + then (sourceFile value) + else value) ( + builtins.attrValues cfg.integrations + ) + ); in { options.soispha.programs.zsh = { enable = lib.mkEnableOption "zsh"; - }; - - config.home-manager.users.soispha = lib.mkIf cfg.enable { - home.sessionPath = []; - - programs.zsh = { - enable = true; - enableCompletion = true; - autosuggestion = { - enable = true; - strategy = []; - }; - syntaxHighlighting.enable = true; - autocd = true; + integrations = lib.mkOption { + type = lib.types.attrsOf (lib.types.either lib.types.path lib.types.str); + example = '' + { + atuin = ./integrations/atuin.zsh; + } + ''; + default = {}; + }; + }; - # Must be relative to the users home directory (for whatever reason) - # Thus no `${homeConfig.xdg.configHome}` - dotDir = ".config/zsh"; + config = lib.mkIf cfg.enable { + environment.variables = { + ZDOTDIR = "${config.home-manager.users.soispha.home.homeDirectory}/${zDotDir}"; + }; - # TODO: Remove the whole history and replace it completely with `atuin` <2024-10-21> - history = { - path = "/dev/null"; - # save = 0; # number of lines to save - # size = 0; # number of lines to keep - # share = false; # share between sessions - }; + home-manager.users.soispha = { + home.sessionPath = lib.mkForce []; - loginExtra = - # bash - '' - setopt AUTO_CD - setopt AUTO_PUSHD - setopt CHASE_DOTS - - setopt ALWAYS_TO_END - - setopt EXTENDED_HISTORY - setopt HIST_ALLOW_CLOBBER - setopt HIST_VERIFY - setopt HIST_FCNTL_LOCK - setopt APPEND_HISTORY - - setopt DVORAK - setopt CORRECT - - setopt PROMPT_SUBST - setopt TRANSIENT_RPROMPT # maybe? - - setopt COMBINING_CHARS - setopt VI - ''; - - initExtraFirst = - sourceFile ./config/zsh-init.zsh - + '' - SHELL_LIBRARY_VERSION="2.1.2" source ${shell_library.rawLib.${system}} - ''; - - initExtra = let - start = lib.modules.mkBefore ( - # NOTE: This must be before the insult, as we otherwise override the previous handler <2024-02-28> - sourceFile ./config/command_not_found/command_not_found.sh - + sourceFile ./config/command_not_found/command_not_found_insult.sh - + sourceFile ./config/custom_cursor.zsh - + sourceFile ./config/edit_command_line.zsh - + sourceFile ./plugins/zsh-history-substring-search.zsh - ); - end = lib.modules.mkAfter ( - sourceFile ./config/keymaps_start.zsh - + sourceFile ./config/keymaps/command.zsh - + sourceFile ./config/keymaps/emacs.zsh - + sourceFile ./config/keymaps/isearch.zsh - + sourceFile ./config/keymaps/vicmd.zsh - + sourceFile ./config/keymaps/viins.zsh - + sourceFile ./config/keymaps/viopp.zsh - + sourceFile ./config/keymaps/visual.zsh - + sourceFile ./config/keymaps_end.zsh - ); - in - lib.modules.mkMerge - [ - start - end - ]; - - localVariables = { - HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND = "bg=cyan,fg=white"; - HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND = "fg=red,underline,standout,bold"; - }; + # This just includes a `source ~/.config/zsh/.zshenv`, because home-manger by-default + # can't access the root `/etc/zshenv`. We can and thus, we can remove this file. + home.file.".zshenv".enable = false; - shellAliases = { - ll = ". ll"; - lm = ". lm"; + programs.zsh = { + enable = true; + enableCompletion = true; + autosuggestion = { + enable = true; + strategy = []; + }; + syntaxHighlighting.enable = true; + + autocd = true; + + # Must be relative to the users home directory (for whatever reason) + # Thus no `${homeConfig.xdg.configHome}` + dotDir = zDotDir; + + # TODO: Remove the whole history and replace it completely with `atuin` <2024-10-21> + history = { + path = "/dev/null"; + # save = 0; # number of lines to save + # size = 0; # number of lines to keep + # share = false; # share between sessions + }; + + loginExtra = + # bash + '' + setopt AUTO_CD + setopt AUTO_PUSHD + setopt CHASE_DOTS + + setopt ALWAYS_TO_END + + setopt EXTENDED_HISTORY + setopt HIST_ALLOW_CLOBBER + setopt HIST_VERIFY + setopt HIST_FCNTL_LOCK + setopt APPEND_HISTORY + + setopt DVORAK + setopt CORRECT + + setopt PROMPT_SUBST + setopt TRANSIENT_RPROMPT # maybe? + + setopt COMBINING_CHARS + setopt VI + ''; + + initContent = let + start = lib.modules.mkBefore ( + sourceFile ./config/zsh-init.zsh + + sourceFile ./config/custom_cursor.zsh + + sourceFile ./config/edit_command_line.zsh + + sourceFile ./plugins/zsh-history-substring-search.zsh + ); + end = lib.modules.mkAfter ( + # NOTE(@bpeetz): Put this here, so that command handler in `extraFiles` + # are not overriding this. <2025-05-16> + sourceFile ./config/command_not_found/command_not_found_insult.sh + + sourceFile ./config/keymaps_start.zsh + + sourceFile ./config/keymaps/command.zsh + + sourceFile ./config/keymaps/emacs.zsh + + sourceFile ./config/keymaps/isearch.zsh + + sourceFile ./config/keymaps/vicmd.zsh + + sourceFile ./config/keymaps/viins.zsh + + sourceFile ./config/keymaps/viopp.zsh + + sourceFile ./config/keymaps/visual.zsh + + sourceFile ./config/keymaps_end.zsh + ); + in + lib.modules.mkMerge + [ + start + + extraFiles + + end + ]; + + localVariables = { + HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_FOUND = "bg=cyan,fg=white"; + HISTORY_SUBSTRING_SEARCH_HIGHLIGHT_NOT_FOUND = "fg=red,underline,standout,bold"; + }; }; }; }; diff --git a/modules/by-name/zs/zsh/plugins/zsh-history-substring-search.zsh b/modules/by-name/zs/zsh/plugins/zsh-history-substring-search.zsh index 4314b784..cc2b6e98 100644 --- a/modules/by-name/zs/zsh/plugins/zsh-history-substring-search.zsh +++ b/modules/by-name/zs/zsh/plugins/zsh-history-substring-search.zsh @@ -1,46 +1,25 @@ #!/usr/bin/env zsh -############################################################################## -# Original Source before 2024 modifications: -# https://github.com/zsh-users/zsh-history-substring-search/blob/87ce96b1862928d84b1afe7c173316614b30e301/zsh-history-substring-search.zsh + +# nixos-config - My current NixOS configuration # # Copyright (c) 2009 Peter Stephenson # Copyright (c) 2011 Guido van Steen -# Copyright (c) 2011 Suraj N. Kurapati # Copyright (c) 2011 Sorin Ionescu +# Copyright (c) 2011 Suraj N. Kurapati # Copyright (c) 2011 Vincent Guerci # Copyright (c) 2016 Geza Lore # Copyright (c) 2017 Bengt Brodersen -# Copyright (c) 2024 Benedikt Peetz -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are met: +# Copyright (c) 2024 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# Copyright (C) 2025 Benedikt Peetz <benedikt.peetz@b-peetz.de> +# SPDX-License-Identifier: GPL-3.0-or-later # -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. +# This file is part of my nixos-config. # -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following -# disclaimer in the documentation and/or other materials provided -# with the distribution. -# -# * Neither the name of the FIZSH nor the names of its contributors -# may be used to endorse or promote products derived from this -# software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE -# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -############################################################################## +# 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>. + +# Original Source before 2024 modifications: +# https://github.com/zsh-users/zsh-history-substring-search/blob/87ce96b1862928d84b1afe7c173316614b30e301/zsh-history-substring-search.zsh #----------------------------------------------------------------------------- # declare global configuration variables |