From d57b2c27f9f6d6dd277334f6cda218cd47e4742c Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Sat, 9 Mar 2024 00:00:07 -0800 Subject: [PATCH 01/78] updating website --- flake.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/flake.lock b/flake.lock index 4294dda..1cb954a 100644 --- a/flake.lock +++ b/flake.lock @@ -487,11 +487,11 @@ ] }, "locked": { - "lastModified": 1709870438, - "narHash": "sha256-vhkb5g7bM/y1j3mb42lV5KIGNGTy1xMm5h6UkQvJReY=", + "lastModified": 1709935213, + "narHash": "sha256-EJRb0U0yfSW8Y8SoaZZdfLu5cb/oLO93VD1lkWvvx8s=", "ref": "main", - "rev": "4384fc4dc19822cbfd5ead1fcdb77cac8d238cff", - "revCount": 1376, + "rev": "0b15712b3e23509d2b1317d51f19c3e791acc938", + "revCount": 1377, "type": "git", "url": "ssh://gitea@git.sealight.xyz/aynish/kitaab" }, -- 2.51.2 From b9fa71a9d34cf79da5f9a25141e4198f9d3fca04 Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Fri, 15 Mar 2024 23:25:49 -0700 Subject: [PATCH 02/78] i can't remember what caused this... --- .direnv/bin/nix-direnv-reload | 8 + ...5d5b61aa8a61b7d9d765e1daf971a9a578f1cfa.rc | 1863 +++++++++++++++++ .envrc | 2 + dns/test_nullhex.sh | 0 flake.lock | 6 +- flake.nix | 3 +- home/core/default.nix | 1 - home/gui/default.nix | 1 + home/profiles/cli/default.nix | 17 +- home/profiles/desktop/Xresources | 0 home/profiles/desktop/polybar/run.sh | 0 home/profiles/email/default.nix | 2 +- home/profiles/firefox/default.nix | 2 +- home/profiles/nvim/default.nix | 6 +- home/profiles/task/bin/set-backlog.sh | 0 home/profiles/task/bin/set-focus.sh | 0 home/profiles/task/default.nix | 2 +- home/profiles/task/taskrc | 5 + hosts/box/default.nix | 9 +- hosts/curve/default.nix | 8 +- hosts/curve/hardware-configuration.nix | 28 +- hosts/development/mirlo/docker-compose.nix | 337 +++ hosts/helix/default.nix | 7 +- hosts/profiles/core/default.nix | 2 +- hosts/profiles/desktop/default.nix | 7 +- hosts/profiles/freshrss/default.nix | 15 +- hosts/profiles/gitea/default.nix | 15 +- hosts/profiles/microbin/default.nix | 4 +- hosts/profiles/music/default.nix | 4 +- .../postgres_upgrade_script/default.nix | 7 +- hosts/profiles/sync/music/get-music.sh | 0 hosts/profiles/ulogger-server/default.nix | 2 +- hosts/profiles/wallabag/default.nix | 5 +- install-encrypted.sh | 0 install-yubikey.sh | 2 +- modules/nixos/default.nix | 2 +- modules/nixos/wallabag.nix | 36 +- mount-crypted.sh | 18 +- pkgs/default.nix | 2 + pkgs/koboutils.nix | 2 +- pkgs/mautrix-slack.nix | 29 + pkgs/tic-80.nix | 4 +- pkgs/wallabag-data.patch | 26 + pkgs/wallabag.nix | 57 + 44 files changed, 2448 insertions(+), 98 deletions(-) create mode 100644 .direnv/bin/nix-direnv-reload create mode 100644 .direnv/flake-profile-a5d5b61aa8a61b7d9d765e1daf971a9a578f1cfa.rc create mode 100644 .envrc mode change 100755 => 100644 dns/test_nullhex.sh mode change 100644 => 100755 home/profiles/desktop/Xresources mode change 100644 => 100755 home/profiles/desktop/polybar/run.sh mode change 100644 => 100755 home/profiles/task/bin/set-backlog.sh mode change 100644 => 100755 home/profiles/task/bin/set-focus.sh create mode 100644 hosts/development/mirlo/docker-compose.nix mode change 100755 => 100644 hosts/profiles/sync/music/get-music.sh mode change 100755 => 100644 install-encrypted.sh mode change 100755 => 100644 install-yubikey.sh mode change 100644 => 100755 mount-crypted.sh create mode 100644 pkgs/mautrix-slack.nix create mode 100644 pkgs/wallabag-data.patch create mode 100644 pkgs/wallabag.nix diff --git a/.direnv/bin/nix-direnv-reload b/.direnv/bin/nix-direnv-reload new file mode 100644 index 0000000..186ac96 --- /dev/null +++ b/.direnv/bin/nix-direnv-reload @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +dir="$(realpath $(dirname ${BASH_SOURCE[0]})/../..)" +_nix_direnv_force_reload=1 direnv exec "$dir" true +direnv reload +# direnv reload updates the mtime of .envrc. Also update the timestamp of the +# profile_rc file to keep track that we actually are up to date. +touch $dir/.direnv/{nix,flake}-profile-*.rc + diff --git a/.direnv/flake-profile-a5d5b61aa8a61b7d9d765e1daf971a9a578f1cfa.rc b/.direnv/flake-profile-a5d5b61aa8a61b7d9d765e1daf971a9a578f1cfa.rc new file mode 100644 index 0000000..02887e5 --- /dev/null +++ b/.direnv/flake-profile-a5d5b61aa8a61b7d9d765e1daf971a9a578f1cfa.rc @@ -0,0 +1,1863 @@ +unset shellHook +PATH=${PATH:-} +nix_saved_PATH="$PATH" +XDG_DATA_DIRS=${XDG_DATA_DIRS:-} +nix_saved_XDG_DATA_DIRS="$XDG_DATA_DIRS" +AR='ar' +export AR +AS='as' +export AS +BASH='/nix/store/7dpxg7ki7g8ynkdwcqf493p2x8divb4i-bash-5.2-p15/bin/bash' +CC='gcc' +export CC +CONFIG_SHELL='/nix/store/7dpxg7ki7g8ynkdwcqf493p2x8divb4i-bash-5.2-p15/bin/bash' +export CONFIG_SHELL +CXX='g++' +export CXX +HOSTTYPE='x86_64' +HOST_PATH='/nix/store/m38gwq0w8w7qyjn9s00balyp7cv3m5p9-coreutils-9.3/bin:/nix/store/01znf87kiw5xx1dj0f7djrnrbg84ij28-findutils-4.9.0/bin:/nix/store/vq4vmndw555m7ld2bi6pq8kr348qvb6a-diffutils-3.10/bin:/nix/store/rwa7qyds01qzxvq7zq3kgnkrzzpw4s66-gnused-4.9/bin:/nix/store/n062zcsmfl9gfp6vfkcg0asb8jjwmy5i-gnugrep-3.11/bin:/nix/store/4v7m4yx07b3anmbznfhihjc8xiizyna9-gawk-5.2.2/bin:/nix/store/mi3pm67ps7c7k11aqki9182ygzg8j503-gnutar-1.35/bin:/nix/store/5c0ancqnpi0cf1h49mv13w68a950s9z0-gzip-1.13/bin:/nix/store/q5cv7r1sh3s4niyq7vm6h1j74394naxs-bzip2-1.0.8-bin/bin:/nix/store/bh7sbl99ygfvw9w96936nrhw46jmcmqq-gnumake-4.4.1/bin:/nix/store/7dpxg7ki7g8ynkdwcqf493p2x8divb4i-bash-5.2-p15/bin:/nix/store/mbh9gx43gsc5av019vsdkazbyiic3f0f-patch-2.7.6/bin:/nix/store/3q6fnwcm677l1q60vkhcf9m1gxhv83jm-xz-5.4.4-bin/bin:/nix/store/a5s2dmba16pw8l52f496gw0b7nli7mbn-file-5.45/bin' +export HOST_PATH +IFS=' +' +IN_NIX_SHELL='impure' +export IN_NIX_SHELL +LD='ld' +export LD +LINENO='76' +MACHTYPE='x86_64-pc-linux-gnu' +NIX_BINTOOLS='/nix/store/qcg3rpl1l103zb1xfsw40wm9j5hzrp7y-binutils-wrapper-2.40' +export NIX_BINTOOLS +NIX_BINTOOLS_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu='1' +export NIX_BINTOOLS_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu +NIX_BUILD_CORES='4' +export NIX_BUILD_CORES +NIX_CC='/nix/store/vylmp73qymnv4siaqn1kl2hghj07hrj8-gcc-wrapper-12.3.0' +export NIX_CC +NIX_CC_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu='1' +export NIX_CC_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu +NIX_CFLAGS_COMPILE=' -frandom-seed=q6hnwi6rdy -isystem /nix/store/hsv5438lvzq106llix5xi0f7cdvqk95q-nix-2.18.1-dev/include -isystem /nix/store/gdz3j02p6mfzmxs9zsssszwpppigb70g-boehm-gc-8.2.2-dev/include -isystem /nix/store/d7jspi1ws93ya34zriyrdxz5v5z6lijj-nlohmann_json-3.11.2/include -isystem /nix/store/hsv5438lvzq106llix5xi0f7cdvqk95q-nix-2.18.1-dev/include -isystem /nix/store/gdz3j02p6mfzmxs9zsssszwpppigb70g-boehm-gc-8.2.2-dev/include -isystem /nix/store/d7jspi1ws93ya34zriyrdxz5v5z6lijj-nlohmann_json-3.11.2/include' +export NIX_CFLAGS_COMPILE +NIX_CONFIG='experimental-features = nix-command flakes' +export NIX_CONFIG +NIX_ENFORCE_NO_NATIVE='1' +export NIX_ENFORCE_NO_NATIVE +NIX_HARDENING_ENABLE='fortify fortify3 stackprotector pic strictoverflow format relro bindnow' +export NIX_HARDENING_ENABLE +NIX_LDFLAGS='-rpath /home/anish/usr/helm/outputs/out/lib -L/nix/store/gfmmah5rc4vl8mhli495lh5savq842p0-boehm-gc-8.2.2/lib -L/nix/store/j7nl2pj606d8ld5818hw3z3fbz00sdc5-nix-2.18.1/lib -L/nix/store/gfmmah5rc4vl8mhli495lh5savq842p0-boehm-gc-8.2.2/lib -L/nix/store/j7nl2pj606d8ld5818hw3z3fbz00sdc5-nix-2.18.1/lib' +export NIX_LDFLAGS +NIX_NO_SELF_RPATH='1' +NIX_STORE='/nix/store' +export NIX_STORE +NM='nm' +export NM +OBJCOPY='objcopy' +export OBJCOPY +OBJDUMP='objdump' +export OBJDUMP +OLDPWD='' +export OLDPWD +OPTERR='1' +OSTYPE='linux-gnu' +PATH='/nix/store/j7nl2pj606d8ld5818hw3z3fbz00sdc5-nix-2.18.1/bin:/nix/store/p3s38kgwd16d2dimspckp5f1rri43mnq-home-manager-unstable-2023-12-31/bin:/nix/store/pz4jng8kb4iv9x67r730las2mdkv8s8q-git-2.42.0/bin:/nix/store/p8p72q6anyf0whaf9i75jynzk2z4ml36-agenix-0.13.0/bin:/nix/store/lfx4in7iqbbx5b6b85cndw268ria5512-deploy-rs-unstable-2023-12-20/bin:/nix/store/8nwmr2kmkrl1mnggka7fjibcglk68rc0-dnscontrol-4.6.0/bin:/nix/store/h3ayxf5dk1gdf3s5716fh1ys815qxxag-patchelf-0.15.0/bin:/nix/store/vylmp73qymnv4siaqn1kl2hghj07hrj8-gcc-wrapper-12.3.0/bin:/nix/store/f94yr35af3xdiscbj6cp6kafvmn55gv9-gcc-12.3.0/bin:/nix/store/vksrk76p5cfbjxb0n95vdkxy7fl2cbcm-glibc-2.38-27-bin/bin:/nix/store/m38gwq0w8w7qyjn9s00balyp7cv3m5p9-coreutils-9.3/bin:/nix/store/qcg3rpl1l103zb1xfsw40wm9j5hzrp7y-binutils-wrapper-2.40/bin:/nix/store/idiaraknw071d20nlqp49s18gbvw4wa0-binutils-2.40/bin:/nix/store/m38gwq0w8w7qyjn9s00balyp7cv3m5p9-coreutils-9.3/bin:/nix/store/01znf87kiw5xx1dj0f7djrnrbg84ij28-findutils-4.9.0/bin:/nix/store/vq4vmndw555m7ld2bi6pq8kr348qvb6a-diffutils-3.10/bin:/nix/store/rwa7qyds01qzxvq7zq3kgnkrzzpw4s66-gnused-4.9/bin:/nix/store/n062zcsmfl9gfp6vfkcg0asb8jjwmy5i-gnugrep-3.11/bin:/nix/store/4v7m4yx07b3anmbznfhihjc8xiizyna9-gawk-5.2.2/bin:/nix/store/mi3pm67ps7c7k11aqki9182ygzg8j503-gnutar-1.35/bin:/nix/store/5c0ancqnpi0cf1h49mv13w68a950s9z0-gzip-1.13/bin:/nix/store/q5cv7r1sh3s4niyq7vm6h1j74394naxs-bzip2-1.0.8-bin/bin:/nix/store/bh7sbl99ygfvw9w96936nrhw46jmcmqq-gnumake-4.4.1/bin:/nix/store/7dpxg7ki7g8ynkdwcqf493p2x8divb4i-bash-5.2-p15/bin:/nix/store/mbh9gx43gsc5av019vsdkazbyiic3f0f-patch-2.7.6/bin:/nix/store/3q6fnwcm677l1q60vkhcf9m1gxhv83jm-xz-5.4.4-bin/bin:/nix/store/a5s2dmba16pw8l52f496gw0b7nli7mbn-file-5.45/bin' +export PATH +PS4='+ ' +RANLIB='ranlib' +export RANLIB +READELF='readelf' +export READELF +SIZE='size' +export SIZE +SOURCE_DATE_EPOCH='315532800' +export SOURCE_DATE_EPOCH +STRINGS='strings' +export STRINGS +STRIP='strip' +export STRIP +XDG_DATA_DIRS='/nix/store/gfmmah5rc4vl8mhli495lh5savq842p0-boehm-gc-8.2.2/share:/nix/store/d7jspi1ws93ya34zriyrdxz5v5z6lijj-nlohmann_json-3.11.2/share:/nix/store/j7nl2pj606d8ld5818hw3z3fbz00sdc5-nix-2.18.1/share:/nix/store/p3s38kgwd16d2dimspckp5f1rri43mnq-home-manager-unstable-2023-12-31/share:/nix/store/pz4jng8kb4iv9x67r730las2mdkv8s8q-git-2.42.0/share:/nix/store/h3ayxf5dk1gdf3s5716fh1ys815qxxag-patchelf-0.15.0/share' +export XDG_DATA_DIRS +__structuredAttrs='' +export __structuredAttrs +buildInputs='' +export buildInputs +buildPhase='{ echo "------------------------------------------------------------"; + echo " WARNING: the existence of this path is not guaranteed."; + echo " It is an internal implementation detail for pkgs.mkShell."; + echo "------------------------------------------------------------"; + echo; + # Record all build inputs as runtime dependencies + export; +} >> "$out" +' +export buildPhase +builder='/nix/store/7dpxg7ki7g8ynkdwcqf493p2x8divb4i-bash-5.2-p15/bin/bash' +export builder +cmakeFlags='' +export cmakeFlags +configureFlags='' +export configureFlags +defaultBuildInputs='' +defaultNativeBuildInputs='/nix/store/h3ayxf5dk1gdf3s5716fh1ys815qxxag-patchelf-0.15.0 /nix/store/v5qyd49a256y44pz75qnsp9741mg336k-update-autotools-gnu-config-scripts-hook /nix/store/h9lc1dpi14z7is86ffhl3ld569138595-audit-tmpdir.sh /nix/store/m54bmrhj6fqz8nds5zcj97w9s9bckc9v-compress-man-pages.sh /nix/store/wgrbkkaldkrlrni33ccvm3b6vbxzb656-make-symlinks-relative.sh /nix/store/5yzw0vhkyszf2d179m0qfkgxmp5wjjx4-move-docs.sh /nix/store/fyaryjvghbkpfnsyw97hb3lyb37s1pd6-move-lib64.sh /nix/store/kd4xwxjpjxi71jkm6ka0np72if9rm3y0-move-sbin.sh /nix/store/pag6l61paj1dc9sv15l7bm5c17xn5kyk-move-systemd-user-units.sh /nix/store/jivxp510zxakaaic7qkrb7v1dd2rdbw9-multiple-outputs.sh /nix/store/wzdsbnv2ba3nj91aql8jjdddfmkkdh7h-patch-shebangs.sh /nix/store/cickvswrvann041nqxb0rxilc46svw1n-prune-libtool-files.sh /nix/store/xyff06pkhki3qy1ls77w10s0v79c9il0-reproducible-builds.sh /nix/store/ngg1cv31c8c7bcm2n8ww4g06nq7s4zhm-set-source-date-epoch-to-latest.sh /nix/store/wmknncrif06fqxa16hpdldhixk95nds0-strip.sh /nix/store/vylmp73qymnv4siaqn1kl2hghj07hrj8-gcc-wrapper-12.3.0' +depsBuildBuild='' +export depsBuildBuild +depsBuildBuildPropagated='' +export depsBuildBuildPropagated +depsBuildTarget='' +export depsBuildTarget +depsBuildTargetPropagated='' +export depsBuildTargetPropagated +depsHostHost='' +export depsHostHost +depsHostHostPropagated='' +export depsHostHostPropagated +depsTargetTarget='' +export depsTargetTarget +depsTargetTargetPropagated='' +export depsTargetTargetPropagated +doCheck='' +export doCheck +doInstallCheck='' +export doInstallCheck +dontAddDisableDepTrack='1' +export dontAddDisableDepTrack +declare -a envBuildBuildHooks=() +declare -a envBuildHostHooks=() +declare -a envBuildTargetHooks=() +declare -a envHostHostHooks=('ccWrapper_addCVars' 'bintoolsWrapper_addLDVars' ) +declare -a envHostTargetHooks=('ccWrapper_addCVars' 'bintoolsWrapper_addLDVars' ) +declare -a envTargetTargetHooks=() +declare -a fixupOutputHooks=('if [ -z "${dontPatchELF-}" ]; then patchELF "$prefix"; fi' 'if [[ -z "${noAuditTmpdir-}" && -e "$prefix" ]]; then auditTmpdir "$prefix"; fi' 'if [ -z "${dontGzipMan-}" ]; then compressManPages "$prefix"; fi' '_moveLib64' '_moveSbin' '_moveSystemdUserUnits' 'patchShebangsAuto' '_pruneLibtoolFiles' '_doStrip' ) +guess='4' +initialPath='/nix/store/m38gwq0w8w7qyjn9s00balyp7cv3m5p9-coreutils-9.3 /nix/store/01znf87kiw5xx1dj0f7djrnrbg84ij28-findutils-4.9.0 /nix/store/vq4vmndw555m7ld2bi6pq8kr348qvb6a-diffutils-3.10 /nix/store/rwa7qyds01qzxvq7zq3kgnkrzzpw4s66-gnused-4.9 /nix/store/n062zcsmfl9gfp6vfkcg0asb8jjwmy5i-gnugrep-3.11 /nix/store/4v7m4yx07b3anmbznfhihjc8xiizyna9-gawk-5.2.2 /nix/store/mi3pm67ps7c7k11aqki9182ygzg8j503-gnutar-1.35 /nix/store/5c0ancqnpi0cf1h49mv13w68a950s9z0-gzip-1.13 /nix/store/q5cv7r1sh3s4niyq7vm6h1j74394naxs-bzip2-1.0.8-bin /nix/store/bh7sbl99ygfvw9w96936nrhw46jmcmqq-gnumake-4.4.1 /nix/store/7dpxg7ki7g8ynkdwcqf493p2x8divb4i-bash-5.2-p15 /nix/store/mbh9gx43gsc5av019vsdkazbyiic3f0f-patch-2.7.6 /nix/store/3q6fnwcm677l1q60vkhcf9m1gxhv83jm-xz-5.4.4-bin /nix/store/a5s2dmba16pw8l52f496gw0b7nli7mbn-file-5.45' +mesonFlags='' +export mesonFlags +name='nix-shell-env' +export name +nativeBuildInputs='/nix/store/hsv5438lvzq106llix5xi0f7cdvqk95q-nix-2.18.1-dev /nix/store/p3s38kgwd16d2dimspckp5f1rri43mnq-home-manager-unstable-2023-12-31 /nix/store/pz4jng8kb4iv9x67r730las2mdkv8s8q-git-2.42.0 /nix/store/p8p72q6anyf0whaf9i75jynzk2z4ml36-agenix-0.13.0 /nix/store/lfx4in7iqbbx5b6b85cndw268ria5512-deploy-rs-unstable-2023-12-20 /nix/store/8nwmr2kmkrl1mnggka7fjibcglk68rc0-dnscontrol-4.6.0' +export nativeBuildInputs +out='/home/anish/usr/helm/outputs/out' +export out +outputBin='out' +outputDev='out' +outputDevdoc='REMOVE' +outputDevman='out' +outputDoc='out' +outputInclude='out' +outputInfo='out' +outputLib='out' +outputMan='out' +outputs='out' +export outputs +patches='' +export patches +phases='buildPhase' +export phases +pkg='/nix/store/vylmp73qymnv4siaqn1kl2hghj07hrj8-gcc-wrapper-12.3.0' +declare -a pkgsBuildBuild=() +declare -a pkgsBuildHost=('/nix/store/hsv5438lvzq106llix5xi0f7cdvqk95q-nix-2.18.1-dev' '/nix/store/gdz3j02p6mfzmxs9zsssszwpppigb70g-boehm-gc-8.2.2-dev' '/nix/store/gfmmah5rc4vl8mhli495lh5savq842p0-boehm-gc-8.2.2' '/nix/store/d7jspi1ws93ya34zriyrdxz5v5z6lijj-nlohmann_json-3.11.2' '/nix/store/j7nl2pj606d8ld5818hw3z3fbz00sdc5-nix-2.18.1' '/nix/store/p3s38kgwd16d2dimspckp5f1rri43mnq-home-manager-unstable-2023-12-31' '/nix/store/pz4jng8kb4iv9x67r730las2mdkv8s8q-git-2.42.0' '/nix/store/p8p72q6anyf0whaf9i75jynzk2z4ml36-agenix-0.13.0' '/nix/store/lfx4in7iqbbx5b6b85cndw268ria5512-deploy-rs-unstable-2023-12-20' '/nix/store/8nwmr2kmkrl1mnggka7fjibcglk68rc0-dnscontrol-4.6.0' '/nix/store/h3ayxf5dk1gdf3s5716fh1ys815qxxag-patchelf-0.15.0' '/nix/store/v5qyd49a256y44pz75qnsp9741mg336k-update-autotools-gnu-config-scripts-hook' '/nix/store/h9lc1dpi14z7is86ffhl3ld569138595-audit-tmpdir.sh' '/nix/store/m54bmrhj6fqz8nds5zcj97w9s9bckc9v-compress-man-pages.sh' '/nix/store/wgrbkkaldkrlrni33ccvm3b6vbxzb656-make-symlinks-relative.sh' '/nix/store/5yzw0vhkyszf2d179m0qfkgxmp5wjjx4-move-docs.sh' '/nix/store/fyaryjvghbkpfnsyw97hb3lyb37s1pd6-move-lib64.sh' '/nix/store/kd4xwxjpjxi71jkm6ka0np72if9rm3y0-move-sbin.sh' '/nix/store/pag6l61paj1dc9sv15l7bm5c17xn5kyk-move-systemd-user-units.sh' '/nix/store/jivxp510zxakaaic7qkrb7v1dd2rdbw9-multiple-outputs.sh' '/nix/store/wzdsbnv2ba3nj91aql8jjdddfmkkdh7h-patch-shebangs.sh' '/nix/store/cickvswrvann041nqxb0rxilc46svw1n-prune-libtool-files.sh' '/nix/store/xyff06pkhki3qy1ls77w10s0v79c9il0-reproducible-builds.sh' '/nix/store/ngg1cv31c8c7bcm2n8ww4g06nq7s4zhm-set-source-date-epoch-to-latest.sh' '/nix/store/wmknncrif06fqxa16hpdldhixk95nds0-strip.sh' '/nix/store/vylmp73qymnv4siaqn1kl2hghj07hrj8-gcc-wrapper-12.3.0' '/nix/store/qcg3rpl1l103zb1xfsw40wm9j5hzrp7y-binutils-wrapper-2.40' ) +declare -a pkgsBuildTarget=() +declare -a pkgsHostHost=() +declare -a pkgsHostTarget=() +declare -a pkgsTargetTarget=() +declare -a postFixupHooks=('_makeSymlinksRelativeInAllOutputs' '_multioutPropagateDev' ) +declare -a postUnpackHooks=('_updateSourceDateEpochFromSourceRoot' ) +declare -a preConfigureHooks=('_multioutConfig' ) +preConfigurePhases=' updateAutotoolsGnuConfigScriptsPhase' +declare -a preFixupHooks=('_moveToShare' '_multioutDocs' '_multioutDevs' ) +preferLocalBuild='1' +export preferLocalBuild +prefix='/home/anish/usr/helm/outputs/out' +declare -a propagatedBuildDepFiles=('propagated-build-build-deps' 'propagated-native-build-inputs' 'propagated-build-target-deps' ) +propagatedBuildInputs='' +export propagatedBuildInputs +declare -a propagatedHostDepFiles=('propagated-host-host-deps' 'propagated-build-inputs' ) +propagatedNativeBuildInputs='' +export propagatedNativeBuildInputs +declare -a propagatedTargetDepFiles=('propagated-target-target-deps' ) +shell='/nix/store/7dpxg7ki7g8ynkdwcqf493p2x8divb4i-bash-5.2-p15/bin/bash' +export shell +shellHook='' +export shellHook +stdenv='/nix/store/kv5wkk7xgc8paw9azshzlmxraffqcg0i-stdenv-linux' +export stdenv +strictDeps='' +export strictDeps +system='x86_64-linux' +export system +declare -a unpackCmdHooks=('_defaultUnpack' ) +_accumFlagsArray () +{ + + local name; + if [ -n "$__structuredAttrs" ]; then + for name in "$@"; + do + local -n nameref="$name"; + flagsArray+=(${nameref+"${nameref[@]}"}); + done; + else + for name in "$@"; + do + local -n nameref="$name"; + case "$name" in + *Array) + flagsArray+=(${nameref+"${nameref[@]}"}) + ;; + *) + flagsArray+=(${nameref-}) + ;; + esac; + done; + fi +} +_activatePkgs () +{ + + local hostOffset targetOffset; + local pkg; + for hostOffset in "${allPlatOffsets[@]}"; + do + local pkgsVar="${pkgAccumVarVars[hostOffset + 1]}"; + for targetOffset in "${allPlatOffsets[@]}"; + do + (( hostOffset <= targetOffset )) || continue; + local pkgsRef="${pkgsVar}[$targetOffset - $hostOffset]"; + local pkgsSlice="${!pkgsRef}[@]"; + for pkg in ${!pkgsSlice+"${!pkgsSlice}"}; + do + activatePackage "$pkg" "$hostOffset" "$targetOffset"; + done; + done; + done +} +_addRpathPrefix () +{ + + if [ "${NIX_NO_SELF_RPATH:-0}" != 1 ]; then + export NIX_LDFLAGS="-rpath $1/lib ${NIX_LDFLAGS-}"; + fi +} +_addToEnv () +{ + + local depHostOffset depTargetOffset; + local pkg; + for depHostOffset in "${allPlatOffsets[@]}"; + do + local hookVar="${pkgHookVarVars[depHostOffset + 1]}"; + local pkgsVar="${pkgAccumVarVars[depHostOffset + 1]}"; + for depTargetOffset in "${allPlatOffsets[@]}"; + do + (( depHostOffset <= depTargetOffset )) || continue; + local hookRef="${hookVar}[$depTargetOffset - $depHostOffset]"; + if [[ -z "${strictDeps-}" ]]; then + local visitedPkgs=""; + for pkg in "${pkgsBuildBuild[@]}" "${pkgsBuildHost[@]}" "${pkgsBuildTarget[@]}" "${pkgsHostHost[@]}" "${pkgsHostTarget[@]}" "${pkgsTargetTarget[@]}"; + do + if [[ "$visitedPkgs" = *"$pkg"* ]]; then + continue; + fi; + runHook "${!hookRef}" "$pkg"; + visitedPkgs+=" $pkg"; + done; + else + local pkgsRef="${pkgsVar}[$depTargetOffset - $depHostOffset]"; + local pkgsSlice="${!pkgsRef}[@]"; + for pkg in ${!pkgsSlice+"${!pkgsSlice}"}; + do + runHook "${!hookRef}" "$pkg"; + done; + fi; + done; + done +} +_allFlags () +{ + + export system pname name version; + for varName in $(awk 'BEGIN { for (v in ENVIRON) if (v ~ /^[a-z][a-zA-Z0-9_]*$/) print v }'); + do + if (( "${NIX_DEBUG:-0}" >= 1 )); then + printf "@%s@ -> %q\n" "${varName}" "${!varName}" 1>&2; + fi; + args+=("--subst-var" "$varName"); + done +} +_assignFirst () +{ + + local varName="$1"; + local _var; + local REMOVE=REMOVE; + shift; + for _var in "$@"; + do + if [ -n "${!_var-}" ]; then + eval "${varName}"="${_var}"; + return; + fi; + done; + echo; + echo "error: _assignFirst: could not find a non-empty variable whose name to assign to ${varName}."; + echo " The following variables were all unset or empty:"; + echo " $*"; + if [ -z "${out:-}" ]; then + echo ' If you do not want an "out" output in your derivation, make sure to define'; + echo ' the other specific required outputs. This can be achieved by picking one'; + echo " of the above as an output."; + echo ' You do not have to remove "out" if you want to have a different default'; + echo ' output, because the first output is taken as a default.'; + echo; + fi; + return 1 +} +_callImplicitHook () +{ + + local def="$1"; + local hookName="$2"; + if declare -F "$hookName" > /dev/null; then + "$hookName"; + else + if type -p "$hookName" > /dev/null; then + source "$hookName"; + else + if [ -n "${!hookName:-}" ]; then + eval "${!hookName}"; + else + return "$def"; + fi; + fi; + fi +} +_defaultUnpack () +{ + + local fn="$1"; + local destination; + if [ -d "$fn" ]; then + destination="$(stripHash "$fn")"; + if [ -e "$destination" ]; then + echo "Cannot copy $fn to $destination: destination already exists!"; + echo "Did you specify two \"srcs\" with the same \"name\"?"; + return 1; + fi; + cp -pr --reflink=auto -- "$fn" "$destination"; + else + case "$fn" in + *.tar.xz | *.tar.lzma | *.txz) + xz -d < "$fn" | tar xf - --warning=no-timestamp + ;; + *.tar | *.tar.* | *.tgz | *.tbz2 | *.tbz) + tar xf "$fn" --warning=no-timestamp + ;; + *) + return 1 + ;; + esac; + fi +} +_doStrip () +{ + + local -ra flags=(dontStripHost dontStripTarget); + local -ra debugDirs=(stripDebugList stripDebugListTarget); + local -ra allDirs=(stripAllList stripAllListTarget); + local -ra stripCmds=(STRIP STRIP_FOR_TARGET); + local -ra ranlibCmds=(RANLIB RANLIB_FOR_TARGET); + stripDebugList=${stripDebugList[*]:-lib lib32 lib64 libexec bin sbin}; + stripDebugListTarget=${stripDebugListTarget[*]:-}; + stripAllList=${stripAllList[*]:-}; + stripAllListTarget=${stripAllListTarget[*]:-}; + local i; + for i in ${!stripCmds[@]}; + do + local -n flag="${flags[$i]}"; + local -n debugDirList="${debugDirs[$i]}"; + local -n allDirList="${allDirs[$i]}"; + local -n stripCmd="${stripCmds[$i]}"; + local -n ranlibCmd="${ranlibCmds[$i]}"; + if [[ -n "${dontStrip-}" || -n "${flag-}" ]] || ! type -f "${stripCmd-}" 2> /dev/null 1>&2; then + continue; + fi; + stripDirs "$stripCmd" "$ranlibCmd" "$debugDirList" "${stripDebugFlags[*]:--S -p}"; + stripDirs "$stripCmd" "$ranlibCmd" "$allDirList" "${stripAllFlags[*]:--s -p}"; + done +} +_eval () +{ + + if declare -F "$1" > /dev/null 2>&1; then + "$@"; + else + eval "$1"; + fi +} +_makeSymlinksRelative () +{ + + local symlinkTarget; + if [ "${dontRewriteSymlinks-}" ] || [ ! -e "$prefix" ]; then + return; + fi; + while IFS= read -r -d '' f; do + symlinkTarget=$(readlink "$f"); + if [[ "$symlinkTarget"/ != "$prefix"/* ]]; then + continue; + fi; + if [ ! -e "$symlinkTarget" ]; then + echo "the symlink $f is broken, it points to $symlinkTarget (which is missing)"; + fi; + echo "rewriting symlink $f to be relative to $prefix"; + ln -snrf "$symlinkTarget" "$f"; + done < <(find $prefix -type l -print0) +} +_makeSymlinksRelativeInAllOutputs () +{ + + local output; + for output in $(getAllOutputNames); + do + prefix="${!output}" _makeSymlinksRelative; + done +} +_moveLib64 () +{ + + if [ "${dontMoveLib64-}" = 1 ]; then + return; + fi; + if [ ! -e "$prefix/lib64" -o -L "$prefix/lib64" ]; then + return; + fi; + echo "moving $prefix/lib64/* to $prefix/lib"; + mkdir -p $prefix/lib; + shopt -s dotglob; + for i in $prefix/lib64/*; + do + mv --no-clobber "$i" $prefix/lib; + done; + shopt -u dotglob; + rmdir $prefix/lib64; + ln -s lib $prefix/lib64 +} +_moveSbin () +{ + + if [ "${dontMoveSbin-}" = 1 ]; then + return; + fi; + if [ ! -e "$prefix/sbin" -o -L "$prefix/sbin" ]; then + return; + fi; + echo "moving $prefix/sbin/* to $prefix/bin"; + mkdir -p $prefix/bin; + shopt -s dotglob; + for i in $prefix/sbin/*; + do + mv "$i" $prefix/bin; + done; + shopt -u dotglob; + rmdir $prefix/sbin; + ln -s bin $prefix/sbin +} +_moveSystemdUserUnits () +{ + + if [ "${dontMoveSystemdUserUnits:-0}" = 1 ]; then + return; + fi; + if [ ! -e "${prefix:?}/lib/systemd/user" ]; then + return; + fi; + local source="$prefix/lib/systemd/user"; + local target="$prefix/share/systemd/user"; + echo "moving $source/* to $target"; + mkdir -p "$target"; + ( shopt -s dotglob; + for i in "$source"/*; + do + mv "$i" "$target"; + done ); + rmdir "$source"; + ln -s "$target" "$source" +} +_moveToShare () +{ + + if [ -n "$__structuredAttrs" ]; then + if [ -z "${forceShare-}" ]; then + forceShare=(man doc info); + fi; + else + forceShare=(${forceShare:-man doc info}); + fi; + if [[ -z "$out" ]]; then + return; + fi; + for d in "${forceShare[@]}"; + do + if [ -d "$out/$d" ]; then + if [ -d "$out/share/$d" ]; then + echo "both $d/ and share/$d/ exist!"; + else + echo "moving $out/$d to $out/share/$d"; + mkdir -p $out/share; + mv $out/$d $out/share/; + fi; + fi; + done +} +_multioutConfig () +{ + + if [ "$(getAllOutputNames)" = "out" ] || [ -z "${setOutputFlags-1}" ]; then + return; + fi; + if [ -z "${shareDocName:-}" ]; then + local confScript="${configureScript:-}"; + if [ -z "$confScript" ] && [ -x ./configure ]; then + confScript=./configure; + fi; + if [ -f "$confScript" ]; then + local shareDocName="$(sed -n "s/^PACKAGE_TARNAME='\(.*\)'$/\1/p" < "$confScript")"; + fi; + if [ -z "$shareDocName" ] || echo "$shareDocName" | grep -q '[^a-zA-Z0-9_-]'; then + shareDocName="$(echo "$name" | sed 's/-[^a-zA-Z].*//')"; + fi; + fi; + prependToVar configureFlags --bindir="${!outputBin}"/bin --sbindir="${!outputBin}"/sbin --includedir="${!outputInclude}"/include --oldincludedir="${!outputInclude}"/include --mandir="${!outputMan}"/share/man --infodir="${!outputInfo}"/share/info --docdir="${!outputDoc}"/share/doc/"${shareDocName}" --libdir="${!outputLib}"/lib --libexecdir="${!outputLib}"/libexec --localedir="${!outputLib}"/share/locale; + prependToVar installFlags pkgconfigdir="${!outputDev}"/lib/pkgconfig m4datadir="${!outputDev}"/share/aclocal aclocaldir="${!outputDev}"/share/aclocal +} +_multioutDevs () +{ + + if [ "$(getAllOutputNames)" = "out" ] || [ -z "${moveToDev-1}" ]; then + return; + fi; + moveToOutput include "${!outputInclude}"; + moveToOutput lib/pkgconfig "${!outputDev}"; + moveToOutput share/pkgconfig "${!outputDev}"; + moveToOutput lib/cmake "${!outputDev}"; + moveToOutput share/aclocal "${!outputDev}"; + for f in "${!outputDev}"/{lib,share}/pkgconfig/*.pc; + do + echo "Patching '$f' includedir to output ${!outputInclude}"; + sed -i "/^includedir=/s,=\${prefix},=${!outputInclude}," "$f"; + done +} +_multioutDocs () +{ + + local REMOVE=REMOVE; + moveToOutput share/info "${!outputInfo}"; + moveToOutput share/doc "${!outputDoc}"; + moveToOutput share/gtk-doc "${!outputDevdoc}"; + moveToOutput share/devhelp/books "${!outputDevdoc}"; + moveToOutput share/man "${!outputMan}"; + moveToOutput share/man/man3 "${!outputDevman}" +} +_multioutPropagateDev () +{ + + if [ "$(getAllOutputNames)" = "out" ]; then + return; + fi; + local outputFirst; + for outputFirst in $(getAllOutputNames); + do + break; + done; + local propagaterOutput="$outputDev"; + if [ -z "$propagaterOutput" ]; then + propagaterOutput="$outputFirst"; + fi; + if [ -z "${propagatedBuildOutputs+1}" ]; then + local po_dirty="$outputBin $outputInclude $outputLib"; + set +o pipefail; + propagatedBuildOutputs=`echo "$po_dirty" | tr -s ' ' '\n' | grep -v -F "$propagaterOutput" | sort -u | tr '\n' ' ' `; + set -o pipefail; + fi; + if [ -z "$propagatedBuildOutputs" ]; then + return; + fi; + mkdir -p "${!propagaterOutput}"/nix-support; + for output in $propagatedBuildOutputs; + do + echo -n " ${!output}" >> "${!propagaterOutput}"/nix-support/propagated-build-inputs; + done +} +_overrideFirst () +{ + + if [ -z "${!1-}" ]; then + _assignFirst "$@"; + fi +} +_pruneLibtoolFiles () +{ + + if [ "${dontPruneLibtoolFiles-}" ] || [ ! -e "$prefix" ]; then + return; + fi; + find "$prefix" -type f -name '*.la' -exec grep -q '^# Generated by .*libtool' {} \; -exec grep -q "^old_library=''" {} \; -exec sed -i {} -e "/^dependency_libs='[^']/ c dependency_libs='' #pruned" \; +} +_updateSourceDateEpochFromSourceRoot () +{ + + if [ -n "$sourceRoot" ]; then + updateSourceDateEpoch "$sourceRoot"; + fi +} +activatePackage () +{ + + local pkg="$1"; + local -r hostOffset="$2"; + local -r targetOffset="$3"; + (( hostOffset <= targetOffset )) || exit 1; + if [ -f "$pkg" ]; then + source "$pkg"; + fi; + if [[ -z "${strictDeps-}" || "$hostOffset" -le -1 ]]; then + addToSearchPath _PATH "$pkg/bin"; + fi; + if (( hostOffset <= -1 )); then + addToSearchPath _XDG_DATA_DIRS "$pkg/share"; + fi; + if [[ "$hostOffset" -eq 0 && -d "$pkg/bin" ]]; then + addToSearchPath _HOST_PATH "$pkg/bin"; + fi; + if [[ -f "$pkg/nix-support/setup-hook" ]]; then + source "$pkg/nix-support/setup-hook"; + fi +} +addEnvHooks () +{ + + local depHostOffset="$1"; + shift; + local pkgHookVarsSlice="${pkgHookVarVars[$depHostOffset + 1]}[@]"; + local pkgHookVar; + for pkgHookVar in "${!pkgHookVarsSlice}"; + do + eval "${pkgHookVar}s"'+=("$@")'; + done +} +addToSearchPath () +{ + + addToSearchPathWithCustomDelimiter ":" "$@" +} +addToSearchPathWithCustomDelimiter () +{ + + local delimiter="$1"; + local varName="$2"; + local dir="$3"; + if [[ -d "$dir" && "${!varName:+${delimiter}${!varName}${delimiter}}" != *"${delimiter}${dir}${delimiter}"* ]]; then + export "${varName}=${!varName:+${!varName}${delimiter}}${dir}"; + fi +} +appendToVar () +{ + + local -n nameref="$1"; + local useArray type; + if [ -n "$__structuredAttrs" ]; then + useArray=true; + else + useArray=false; + fi; + if declare -p "$1" 2> /dev/null | grep -q '^'; then + type="$(declare -p "$1")"; + if [[ "$type" =~ "declare -A" ]]; then + echo "appendToVar(): ERROR: trying to use appendToVar on an associative array, use variable+=([\"X\"]=\"Y\") instead." 1>&2; + return 1; + else + if [[ "$type" =~ "declare -a" ]]; then + useArray=true; + else + useArray=false; + fi; + fi; + fi; + shift; + if $useArray; then + nameref=(${nameref+"${nameref[@]}"} "$@"); + else + nameref="${nameref-} $*"; + fi +} +auditTmpdir () +{ + + local dir="$1"; + [ -e "$dir" ] || return 0; + echo "checking for references to $TMPDIR/ in $dir..."; + local i; + find "$dir" -type f -print0 | while IFS= read -r -d '' i; do + if [[ "$i" =~ .build-id ]]; then + continue; + fi; + if isELF "$i"; then + if { + printf :; + patchelf --print-rpath "$i" + } | grep -q -F ":$TMPDIR/"; then + echo "RPATH of binary $i contains a forbidden reference to $TMPDIR/"; + exit 1; + fi; + fi; + if isScript "$i"; then + if [ -e "$(dirname "$i")/.$(basename "$i")-wrapped" ]; then + if grep -q -F "$TMPDIR/" "$i"; then + echo "wrapper script $i contains a forbidden reference to $TMPDIR/"; + exit 1; + fi; + fi; + fi; + done +} +bintoolsWrapper_addLDVars () +{ + + local role_post; + getHostRoleEnvHook; + if [[ -d "$1/lib64" && ! -L "$1/lib64" ]]; then + export NIX_LDFLAGS${role_post}+=" -L$1/lib64"; + fi; + if [[ -d "$1/lib" ]]; then + local -a glob=($1/lib/lib*); + if [ "${#glob[*]}" -gt 0 ]; then + export NIX_LDFLAGS${role_post}+=" -L$1/lib"; + fi; + fi +} +buildPhase () +{ + + runHook preBuild; + if [[ -z "${makeFlags-}" && -z "${makefile:-}" && ! ( -e Makefile || -e makefile || -e GNUmakefile ) ]]; then + echo "no Makefile or custom buildPhase, doing nothing"; + else + foundMakefile=1; + local flagsArray=(${enableParallelBuilding:+-j${NIX_BUILD_CORES}} SHELL=$SHELL); + _accumFlagsArray makeFlags makeFlagsArray buildFlags buildFlagsArray; + echoCmd 'build flags' "${flagsArray[@]}"; + make ${makefile:+-f $makefile} "${flagsArray[@]}"; + unset flagsArray; + fi; + runHook postBuild +} +ccWrapper_addCVars () +{ + + local role_post; + getHostRoleEnvHook; + if [ -d "$1/include" ]; then + export NIX_CFLAGS_COMPILE${role_post}+=" -isystem $1/include"; + fi; + if [ -d "$1/Library/Frameworks" ]; then + export NIX_CFLAGS_COMPILE${role_post}+=" -iframework $1/Library/Frameworks"; + fi +} +checkPhase () +{ + + runHook preCheck; + if [[ -z "${foundMakefile:-}" ]]; then + echo "no Makefile or custom checkPhase, doing nothing"; + runHook postCheck; + return; + fi; + if [[ -z "${checkTarget:-}" ]]; then + if make -n ${makefile:+-f $makefile} check > /dev/null 2>&1; then + checkTarget=check; + else + if make -n ${makefile:+-f $makefile} test > /dev/null 2>&1; then + checkTarget=test; + fi; + fi; + fi; + if [[ -z "${checkTarget:-}" ]]; then + echo "no check/test target in ${makefile:-Makefile}, doing nothing"; + else + local flagsArray=(${enableParallelChecking:+-j${NIX_BUILD_CORES}} SHELL=$SHELL); + _accumFlagsArray makeFlags makeFlagsArray; + if [ -n "$__structuredAttrs" ]; then + flagsArray+=("${checkFlags[@]:-VERBOSE=y}"); + else + flagsArray+=(${checkFlags:-VERBOSE=y}); + fi; + _accumFlagsArray checkFlagsArray; + flagsArray+=(${checkTarget}); + echoCmd 'check flags' "${flagsArray[@]}"; + make ${makefile:+-f $makefile} "${flagsArray[@]}"; + unset flagsArray; + fi; + runHook postCheck +} +compressManPages () +{ + + local dir="$1"; + if [ -L "$dir"/share ] || [ -L "$dir"/share/man ] || [ ! -d "$dir/share/man" ]; then + return; + fi; + echo "gzipping man pages under $dir/share/man/"; + find "$dir"/share/man/ -type f -a '!' -regex '.*\.\(bz2\|gz\|xz\)$' -print0 | while IFS= read -r -d '' f; do + if gzip -c -n "$f" > "$f".gz; then + rm "$f"; + else + rm "$f".gz; + fi; + done; + find "$dir"/share/man/ -type l -a '!' -regex '.*\.\(bz2\|gz\|xz\)$' -print0 | sort -z | while IFS= read -r -d '' f; do + local target; + target="$(readlink -f "$f")"; + if [ -f "$target".gz ]; then + ln -sf "$target".gz "$f".gz && rm "$f"; + fi; + done +} +configurePhase () +{ + + runHook preConfigure; + : "${configureScript=}"; + if [[ -z "$configureScript" && -x ./configure ]]; then + configureScript=./configure; + fi; + if [ -z "${dontFixLibtool:-}" ]; then + export lt_cv_deplibs_check_method="${lt_cv_deplibs_check_method-pass_all}"; + local i; + find . -iname "ltmain.sh" -print0 | while IFS='' read -r -d '' i; do + echo "fixing libtool script $i"; + fixLibtool "$i"; + done; + CONFIGURE_MTIME_REFERENCE=$(mktemp configure.mtime.reference.XXXXXX); + find . -executable -type f -name configure -exec grep -l 'GNU Libtool is free software; you can redistribute it and/or modify' {} \; -exec touch -r {} "$CONFIGURE_MTIME_REFERENCE" \; -exec sed -i s_/usr/bin/file_file_g {} \; -exec touch -r "$CONFIGURE_MTIME_REFERENCE" {} \;; + rm -f "$CONFIGURE_MTIME_REFERENCE"; + fi; + if [[ -z "${dontAddPrefix:-}" && -n "$prefix" ]]; then + prependToVar configureFlags "${prefixKey:---prefix=}$prefix"; + fi; + if [[ -f "$configureScript" ]]; then + if [ -z "${dontAddDisableDepTrack:-}" ]; then + if grep -q dependency-tracking "$configureScript"; then + prependToVar configureFlags --disable-dependency-tracking; + fi; + fi; + if [ -z "${dontDisableStatic:-}" ]; then + if grep -q enable-static "$configureScript"; then + prependToVar configureFlags --disable-static; + fi; + fi; + fi; + if [ -n "$configureScript" ]; then + local -a flagsArray; + _accumFlagsArray configureFlags configureFlagsArray; + echoCmd 'configure flags' "${flagsArray[@]}"; + $configureScript "${flagsArray[@]}"; + unset flagsArray; + else + echo "no configure script, doing nothing"; + fi; + runHook postConfigure +} +consumeEntire () +{ + + if IFS='' read -r -d '' "$1"; then + echo "consumeEntire(): ERROR: Input null bytes, won't process" 1>&2; + return 1; + fi +} +distPhase () +{ + + runHook preDist; + local flagsArray=(); + _accumFlagsArray distFlags distFlagsArray; + flagsArray+=(${distTarget:-dist}); + echo 'dist flags: %q' "${flagsArray[@]}"; + make ${makefile:+-f $makefile} "${flagsArray[@]}"; + if [ "${dontCopyDist:-0}" != 1 ]; then + mkdir -p "$out/tarballs"; + cp -pvd ${tarballs[*]:-*.tar.gz} "$out/tarballs"; + fi; + runHook postDist +} +dumpVars () +{ + + if [ "${noDumpEnvVars:-0}" != 1 ]; then + export 2> /dev/null >| "$NIX_BUILD_TOP/env-vars" || true; + fi +} +echoCmd () +{ + + printf "%s:" "$1"; + shift; + printf ' %q' "$@"; + echo +} +exitHandler () +{ + + exitCode="$?"; + set +e; + if [ -n "${showBuildStats:-}" ]; then + read -r -d '' -a buildTimes < <(times); + echo "build times:"; + echo "user time for the shell ${buildTimes[0]}"; + echo "system time for the shell ${buildTimes[1]}"; + echo "user time for all child processes ${buildTimes[2]}"; + echo "system time for all child processes ${buildTimes[3]}"; + fi; + if (( "$exitCode" != 0 )); then + runHook failureHook; + if [ -n "${succeedOnFailure:-}" ]; then + echo "build failed with exit code $exitCode (ignored)"; + mkdir -p "$out/nix-support"; + printf "%s" "$exitCode" > "$out/nix-support/failed"; + exit 0; + fi; + else + runHook exitHook; + fi; + return "$exitCode" +} +findInputs () +{ + + local -r pkg="$1"; + local -r hostOffset="$2"; + local -r targetOffset="$3"; + (( hostOffset <= targetOffset )) || exit 1; + local varVar="${pkgAccumVarVars[hostOffset + 1]}"; + local varRef="$varVar[$((targetOffset - hostOffset))]"; + local var="${!varRef}"; + unset -v varVar varRef; + local varSlice="$var[*]"; + case "${!varSlice-}" in + *" $pkg "*) + return 0 + ;; + esac; + unset -v varSlice; + eval "$var"'+=("$pkg")'; + if ! [ -e "$pkg" ]; then + echo "build input $pkg does not exist" 1>&2; + exit 1; + fi; + function mapOffset () + { + local -r inputOffset="$1"; + local -n outputOffset="$2"; + if (( inputOffset <= 0 )); then + outputOffset=$((inputOffset + hostOffset)); + else + outputOffset=$((inputOffset - 1 + targetOffset)); + fi + }; + local relHostOffset; + for relHostOffset in "${allPlatOffsets[@]}"; + do + local files="${propagatedDepFilesVars[relHostOffset + 1]}"; + local hostOffsetNext; + mapOffset "$relHostOffset" hostOffsetNext; + (( -1 <= hostOffsetNext && hostOffsetNext <= 1 )) || continue; + local relTargetOffset; + for relTargetOffset in "${allPlatOffsets[@]}"; + do + (( "$relHostOffset" <= "$relTargetOffset" )) || continue; + local fileRef="${files}[$relTargetOffset - $relHostOffset]"; + local file="${!fileRef}"; + unset -v fileRef; + local targetOffsetNext; + mapOffset "$relTargetOffset" targetOffsetNext; + (( -1 <= hostOffsetNext && hostOffsetNext <= 1 )) || continue; + [[ -f "$pkg/nix-support/$file" ]] || continue; + local pkgNext; + read -r -d '' pkgNext < "$pkg/nix-support/$file" || true; + for pkgNext in $pkgNext; + do + findInputs "$pkgNext" "$hostOffsetNext" "$targetOffsetNext"; + done; + done; + done +} +fixLibtool () +{ + + local search_path; + for flag in $NIX_LDFLAGS; + do + case $flag in + -L*) + search_path+=" ${flag#-L}" + ;; + esac; + done; + sed -i "$1" -e "s^eval \(sys_lib_search_path=\).*^\1'${search_path:-}'^" -e 's^eval sys_lib_.+search_path=.*^^' +} +fixupPhase () +{ + + local output; + for output in $(getAllOutputNames); + do + if [ -e "${!output}" ]; then + chmod -R u+w "${!output}"; + fi; + done; + runHook preFixup; + local output; + for output in $(getAllOutputNames); + do + prefix="${!output}" runHook fixupOutput; + done; + recordPropagatedDependencies; + if [ -n "${setupHook:-}" ]; then + mkdir -p "${!outputDev}/nix-support"; + substituteAll "$setupHook" "${!outputDev}/nix-support/setup-hook"; + fi; + if [ -n "${setupHooks:-}" ]; then + mkdir -p "${!outputDev}/nix-support"; + local hook; + for hook in ${setupHooks[@]}; + do + local content; + consumeEntire content < "$hook"; + substituteAllStream content "file '$hook'" >> "${!outputDev}/nix-support/setup-hook"; + unset -v content; + done; + unset -v hook; + fi; + if [ -n "${propagatedUserEnvPkgs:-}" ]; then + mkdir -p "${!outputBin}/nix-support"; + printWords $propagatedUserEnvPkgs > "${!outputBin}/nix-support/propagated-user-env-packages"; + fi; + runHook postFixup +} +genericBuild () +{ + + export GZIP_NO_TIMESTAMPS=1; + if [ -f "${buildCommandPath:-}" ]; then + source "$buildCommandPath"; + return; + fi; + if [ -n "${buildCommand:-}" ]; then + eval "$buildCommand"; + return; + fi; + if [ -z "${phases[*]:-}" ]; then + phases="${prePhases[*]:-} unpackPhase patchPhase ${preConfigurePhases[*]:-} configurePhase ${preBuildPhases[*]:-} buildPhase checkPhase ${preInstallPhases[*]:-} installPhase ${preFixupPhases[*]:-} fixupPhase installCheckPhase ${preDistPhases[*]:-} distPhase ${postPhases[*]:-}"; + fi; + for curPhase in ${phases[*]}; + do + runPhase "$curPhase"; + done +} +getAllOutputNames () +{ + + if [ -n "$__structuredAttrs" ]; then + echo "${!outputs[*]}"; + else + echo "$outputs"; + fi +} +getHostRole () +{ + + getRole "$hostOffset" +} +getHostRoleEnvHook () +{ + + getRole "$depHostOffset" +} +getRole () +{ + + case $1 in + -1) + role_post='_FOR_BUILD' + ;; + 0) + role_post='' + ;; + 1) + role_post='_FOR_TARGET' + ;; + *) + echo "binutils-wrapper-2.40: used as improper sort of dependency" 1>&2; + return 1 + ;; + esac +} +getTargetRole () +{ + + getRole "$targetOffset" +} +getTargetRoleEnvHook () +{ + + getRole "$depTargetOffset" +} +getTargetRoleWrapper () +{ + + case $targetOffset in + -1) + export NIX_BINTOOLS_WRAPPER_TARGET_BUILD_x86_64_unknown_linux_gnu=1 + ;; + 0) + export NIX_BINTOOLS_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu=1 + ;; + 1) + export NIX_BINTOOLS_WRAPPER_TARGET_TARGET_x86_64_unknown_linux_gnu=1 + ;; + *) + echo "binutils-wrapper-2.40: used as improper sort of dependency" 1>&2; + return 1 + ;; + esac +} +installCheckPhase () +{ + + runHook preInstallCheck; + if [[ -z "${foundMakefile:-}" ]]; then + echo "no Makefile or custom installCheckPhase, doing nothing"; + else + if [[ -z "${installCheckTarget:-}" ]] && ! make -n ${makefile:+-f $makefile} "${installCheckTarget:-installcheck}" > /dev/null 2>&1; then + echo "no installcheck target in ${makefile:-Makefile}, doing nothing"; + else + local flagsArray=(${enableParallelChecking:+-j${NIX_BUILD_CORES}} SHELL=$SHELL); + _accumFlagsArray makeFlags makeFlagsArray installCheckFlags installCheckFlagsArray; + flagsArray+=(${installCheckTarget:-installcheck}); + echoCmd 'installcheck flags' "${flagsArray[@]}"; + make ${makefile:+-f $makefile} "${flagsArray[@]}"; + unset flagsArray; + fi; + fi; + runHook postInstallCheck +} +installPhase () +{ + + runHook preInstall; + if [[ -z "${makeFlags-}" && -z "${makefile:-}" && ! ( -e Makefile || -e makefile || -e GNUmakefile ) ]]; then + echo "no Makefile or custom installPhase, doing nothing"; + runHook postInstall; + return; + else + foundMakefile=1; + fi; + if [ -n "$prefix" ]; then + mkdir -p "$prefix"; + fi; + local flagsArray=(${enableParallelInstalling:+-j${NIX_BUILD_CORES}} SHELL=$SHELL); + _accumFlagsArray makeFlags makeFlagsArray installFlags installFlagsArray; + if [ -n "$__structuredAttrs" ]; then + flagsArray+=("${installTargets[@]:-install}"); + else + flagsArray+=(${installTargets:-install}); + fi; + echoCmd 'install flags' "${flagsArray[@]}"; + make ${makefile:+-f $makefile} "${flagsArray[@]}"; + unset flagsArray; + runHook postInstall +} +isELF () +{ + + local fn="$1"; + local fd; + local magic; + exec {fd}< "$fn"; + read -r -n 4 -u "$fd" magic; + exec {fd}>&-; + if [ "$magic" = 'ELF' ]; then + return 0; + else + return 1; + fi +} +isMachO () +{ + + local fn="$1"; + local fd; + local magic; + exec {fd}< "$fn"; + read -r -n 4 -u "$fd" magic; + exec {fd}>&-; + if [[ "$magic" = $(echo -ne "\xfe\xed\xfa\xcf") || "$magic" = $(echo -ne "\xcf\xfa\xed\xfe") ]]; then + return 0; + else + if [[ "$magic" = $(echo -ne "\xfe\xed\xfa\xce") || "$magic" = $(echo -ne "\xce\xfa\xed\xfe") ]]; then + return 0; + else + if [[ "$magic" = $(echo -ne "\xca\xfe\xba\xbe") || "$magic" = $(echo -ne "\xbe\xba\xfe\xca") ]]; then + return 0; + else + return 1; + fi; + fi; + fi +} +isScript () +{ + + local fn="$1"; + local fd; + local magic; + exec {fd}< "$fn"; + read -r -n 2 -u "$fd" magic; + exec {fd}>&-; + if [[ "$magic" =~ \#! ]]; then + return 0; + else + return 1; + fi +} +mapOffset () +{ + + local -r inputOffset="$1"; + local -n outputOffset="$2"; + if (( inputOffset <= 0 )); then + outputOffset=$((inputOffset + hostOffset)); + else + outputOffset=$((inputOffset - 1 + targetOffset)); + fi +} +moveToOutput () +{ + + local patt="$1"; + local dstOut="$2"; + local output; + for output in $(getAllOutputNames); + do + if [ "${!output}" = "$dstOut" ]; then + continue; + fi; + local srcPath; + for srcPath in "${!output}"/$patt; + do + if [ ! -e "$srcPath" ] && [ ! -L "$srcPath" ]; then + continue; + fi; + if [ "$dstOut" = REMOVE ]; then + echo "Removing $srcPath"; + rm -r "$srcPath"; + else + local dstPath="$dstOut${srcPath#${!output}}"; + echo "Moving $srcPath to $dstPath"; + if [ -d "$dstPath" ] && [ -d "$srcPath" ]; then + rmdir "$srcPath" --ignore-fail-on-non-empty; + if [ -d "$srcPath" ]; then + mv -t "$dstPath" "$srcPath"/*; + rmdir "$srcPath"; + fi; + else + mkdir -p "$(readlink -m "$dstPath/..")"; + mv "$srcPath" "$dstPath"; + fi; + fi; + local srcParent="$(readlink -m "$srcPath/..")"; + if [ -n "$(find "$srcParent" -maxdepth 0 -type d -empty 2> /dev/null)" ]; then + echo "Removing empty $srcParent/ and (possibly) its parents"; + rmdir -p --ignore-fail-on-non-empty "$srcParent" 2> /dev/null || true; + fi; + done; + done +} +patchELF () +{ + + local dir="$1"; + [ -e "$dir" ] || return 0; + echo "shrinking RPATHs of ELF executables and libraries in $dir"; + local i; + while IFS= read -r -d '' i; do + if [[ "$i" =~ .build-id ]]; then + continue; + fi; + if ! isELF "$i"; then + continue; + fi; + echo "shrinking $i"; + patchelf --shrink-rpath "$i" || true; + done < <(find "$dir" -type f -print0) +} +patchPhase () +{ + + runHook prePatch; + local -a patchesArray; + if [ -n "$__structuredAttrs" ]; then + patchesArray=(${patches:+"${patches[@]}"}); + else + patchesArray=(${patches:-}); + fi; + for i in "${patchesArray[@]}"; + do + echo "applying patch $i"; + local uncompress=cat; + case "$i" in + *.gz) + uncompress="gzip -d" + ;; + *.bz2) + uncompress="bzip2 -d" + ;; + *.xz) + uncompress="xz -d" + ;; + *.lzma) + uncompress="lzma -d" + ;; + esac; + local -a flagsArray; + if [ -n "$__structuredAttrs" ]; then + flagsArray=("${patchFlags[@]:--p1}"); + else + flagsArray=(${patchFlags:--p1}); + fi; + $uncompress < "$i" 2>&1 | patch "${flagsArray[@]}"; + done; + runHook postPatch +} +patchShebangs () +{ + + local pathName; + local update; + while [[ $# -gt 0 ]]; do + case "$1" in + --host) + pathName=HOST_PATH; + shift + ;; + --build) + pathName=PATH; + shift + ;; + --update) + update=true; + shift + ;; + --) + shift; + break + ;; + -* | --*) + echo "Unknown option $1 supplied to patchShebangs" 1>&2; + return 1 + ;; + *) + break + ;; + esac; + done; + echo "patching script interpreter paths in $@"; + local f; + local oldPath; + local newPath; + local arg0; + local args; + local oldInterpreterLine; + local newInterpreterLine; + if [[ $# -eq 0 ]]; then + echo "No arguments supplied to patchShebangs" 1>&2; + return 0; + fi; + local f; + while IFS= read -r -d '' f; do + isScript "$f" || continue; + read -r oldInterpreterLine < "$f"; + read -r oldPath arg0 args <<< "${oldInterpreterLine:2}"; + if [[ -z "${pathName:-}" ]]; then + if [[ -n $strictDeps && $f == "$NIX_STORE"* ]]; then + pathName=HOST_PATH; + else + pathName=PATH; + fi; + fi; + if [[ "$oldPath" == *"/bin/env" ]]; then + if [[ $arg0 == "-S" ]]; then + arg0=${args%% *}; + args=${args#* }; + newPath="$(PATH="${!pathName}" command -v "env" || true)"; + args="-S $(PATH="${!pathName}" command -v "$arg0" || true) $args"; + else + if [[ $arg0 == "-"* || $arg0 == *"="* ]]; then + echo "$f: unsupported interpreter directive \"$oldInterpreterLine\" (set dontPatchShebangs=1 and handle shebang patching yourself)" 1>&2; + exit 1; + else + newPath="$(PATH="${!pathName}" command -v "$arg0" || true)"; + fi; + fi; + else + if [[ -z $oldPath ]]; then + oldPath="/bin/sh"; + fi; + newPath="$(PATH="${!pathName}" command -v "$(basename "$oldPath")" || true)"; + args="$arg0 $args"; + fi; + newInterpreterLine="$newPath $args"; + newInterpreterLine=${newInterpreterLine%${newInterpreterLine##*[![:space:]]}}; + if [[ -n "$oldPath" && ( "$update" == true || "${oldPath:0:${#NIX_STORE}}" != "$NIX_STORE" ) ]]; then + if [[ -n "$newPath" && "$newPath" != "$oldPath" ]]; then + echo "$f: interpreter directive changed from \"$oldInterpreterLine\" to \"$newInterpreterLine\""; + escapedInterpreterLine=${newInterpreterLine//\\/\\\\}; + timestamp=$(stat --printf "%y" "$f"); + sed -i -e "1 s|.*|#\!$escapedInterpreterLine|" "$f"; + touch --date "$timestamp" "$f"; + fi; + fi; + done < <(find "$@" -type f -perm -0100 -print0) +} +patchShebangsAuto () +{ + + if [[ -z "${dontPatchShebangs-}" && -e "$prefix" ]]; then + if [[ "$output" != out && "$output" = "$outputDev" ]]; then + patchShebangs --build "$prefix"; + else + patchShebangs --host "$prefix"; + fi; + fi +} +prependToVar () +{ + + local -n nameref="$1"; + local useArray type; + if [ -n "$__structuredAttrs" ]; then + useArray=true; + else + useArray=false; + fi; + if declare -p "$1" 2> /dev/null | grep -q '^'; then + type="$(declare -p "$1")"; + if [[ "$type" =~ "declare -A" ]]; then + echo "prependToVar(): ERROR: trying to use prependToVar on an associative array." 1>&2; + return 1; + else + if [[ "$type" =~ "declare -a" ]]; then + useArray=true; + else + useArray=false; + fi; + fi; + fi; + shift; + if $useArray; then + nameref=("$@" ${nameref+"${nameref[@]}"}); + else + nameref="$* ${nameref-}"; + fi +} +printLines () +{ + + (( "$#" > 0 )) || return 0; + printf '%s\n' "$@" +} +printWords () +{ + + (( "$#" > 0 )) || return 0; + printf '%s ' "$@" +} +recordPropagatedDependencies () +{ + + declare -ra flatVars=(depsBuildBuildPropagated propagatedNativeBuildInputs depsBuildTargetPropagated depsHostHostPropagated propagatedBuildInputs depsTargetTargetPropagated); + declare -ra flatFiles=("${propagatedBuildDepFiles[@]}" "${propagatedHostDepFiles[@]}" "${propagatedTargetDepFiles[@]}"); + local propagatedInputsIndex; + for propagatedInputsIndex in "${!flatVars[@]}"; + do + local propagatedInputsSlice="${flatVars[$propagatedInputsIndex]}[@]"; + local propagatedInputsFile="${flatFiles[$propagatedInputsIndex]}"; + [[ -n "${!propagatedInputsSlice}" ]] || continue; + mkdir -p "${!outputDev}/nix-support"; + printWords ${!propagatedInputsSlice} > "${!outputDev}/nix-support/$propagatedInputsFile"; + done +} +runHook () +{ + + local hookName="$1"; + shift; + local hooksSlice="${hookName%Hook}Hooks[@]"; + local hook; + for hook in "_callImplicitHook 0 $hookName" ${!hooksSlice+"${!hooksSlice}"}; + do + _eval "$hook" "$@"; + done; + return 0 +} +runOneHook () +{ + + local hookName="$1"; + shift; + local hooksSlice="${hookName%Hook}Hooks[@]"; + local hook ret=1; + for hook in "_callImplicitHook 1 $hookName" ${!hooksSlice+"${!hooksSlice}"}; + do + if _eval "$hook" "$@"; then + ret=0; + break; + fi; + done; + return "$ret" +} +runPhase () +{ + + local curPhase="$*"; + if [[ "$curPhase" = unpackPhase && -n "${dontUnpack:-}" ]]; then + return; + fi; + if [[ "$curPhase" = patchPhase && -n "${dontPatch:-}" ]]; then + return; + fi; + if [[ "$curPhase" = configurePhase && -n "${dontConfigure:-}" ]]; then + return; + fi; + if [[ "$curPhase" = buildPhase && -n "${dontBuild:-}" ]]; then + return; + fi; + if [[ "$curPhase" = checkPhase && -z "${doCheck:-}" ]]; then + return; + fi; + if [[ "$curPhase" = installPhase && -n "${dontInstall:-}" ]]; then + return; + fi; + if [[ "$curPhase" = fixupPhase && -n "${dontFixup:-}" ]]; then + return; + fi; + if [[ "$curPhase" = installCheckPhase && -z "${doInstallCheck:-}" ]]; then + return; + fi; + if [[ "$curPhase" = distPhase && -z "${doDist:-}" ]]; then + return; + fi; + if [[ -n $NIX_LOG_FD ]]; then + echo "@nix { \"action\": \"setPhase\", \"phase\": \"$curPhase\" }" >&"$NIX_LOG_FD"; + fi; + showPhaseHeader "$curPhase"; + dumpVars; + local startTime=$(date +"%s"); + eval "${!curPhase:-$curPhase}"; + local endTime=$(date +"%s"); + showPhaseFooter "$curPhase" "$startTime" "$endTime"; + if [ "$curPhase" = unpackPhase ]; then + [ -n "${sourceRoot:-}" ] && chmod +x "${sourceRoot}"; + cd "${sourceRoot:-.}"; + fi +} +showPhaseFooter () +{ + + local phase="$1"; + local startTime="$2"; + local endTime="$3"; + local delta=$(( endTime - startTime )); + (( delta < 30 )) && return; + local H=$((delta/3600)); + local M=$((delta%3600/60)); + local S=$((delta%60)); + echo -n "$phase completed in "; + (( H > 0 )) && echo -n "$H hours "; + (( M > 0 )) && echo -n "$M minutes "; + echo "$S seconds" +} +showPhaseHeader () +{ + + local phase="$1"; + echo "Running phase: $phase" +} +stripDirs () +{ + + local cmd="$1"; + local ranlibCmd="$2"; + local paths="$3"; + local stripFlags="$4"; + local excludeFlags=(); + local pathsNew=; + [ -z "$cmd" ] && echo "stripDirs: Strip command is empty" 1>&2 && exit 1; + [ -z "$ranlibCmd" ] && echo "stripDirs: Ranlib command is empty" 1>&2 && exit 1; + local pattern; + if [ -n "${stripExclude:-}" ]; then + for pattern in "${stripExclude[@]}"; + do + excludeFlags+=(-a '!' '(' -name "$pattern" -o -wholename "$prefix/$pattern" ')'); + done; + fi; + local p; + for p in ${paths}; + do + if [ -e "$prefix/$p" ]; then + pathsNew="${pathsNew} $prefix/$p"; + fi; + done; + paths=${pathsNew}; + if [ -n "${paths}" ]; then + echo "stripping (with command $cmd and flags $stripFlags) in $paths"; + local striperr; + striperr="$(mktemp --tmpdir="$TMPDIR" 'striperr.XXXXXX')"; + find $paths -type f "${excludeFlags[@]}" -a '!' -path "$prefix/lib/debug/*" -print0 | xargs -r -0 -n1 -- realpath -z | sort -u -z | xargs -r -0 -n1 -P "$NIX_BUILD_CORES" -- $cmd $stripFlags 2> "$striperr" || exit_code=$?; + [[ "$exit_code" = 123 || -z "$exit_code" ]] || ( cat "$striperr" 1>&2 && exit 1 ); + rm "$striperr"; + find $paths -name '*.a' -type f -exec $ranlibCmd '{}' \; 2> /dev/null; + fi +} +stripHash () +{ + + local strippedName casematchOpt=0; + strippedName="$(basename -- "$1")"; + shopt -q nocasematch && casematchOpt=1; + shopt -u nocasematch; + if [[ "$strippedName" =~ ^[a-z0-9]{32}- ]]; then + echo "${strippedName:33}"; + else + echo "$strippedName"; + fi; + if (( casematchOpt )); then + shopt -s nocasematch; + fi +} +substitute () +{ + + local input="$1"; + local output="$2"; + shift 2; + if [ ! -f "$input" ]; then + echo "substitute(): ERROR: file '$input' does not exist" 1>&2; + return 1; + fi; + local content; + consumeEntire content < "$input"; + if [ -e "$output" ]; then + chmod +w "$output"; + fi; + substituteStream content "file '$input'" "$@" > "$output" +} +substituteAll () +{ + + local input="$1"; + local output="$2"; + local -a args=(); + _allFlags; + substitute "$input" "$output" "${args[@]}" +} +substituteAllInPlace () +{ + + local fileName="$1"; + shift; + substituteAll "$fileName" "$fileName" "$@" +} +substituteAllStream () +{ + + local -a args=(); + _allFlags; + substituteStream "$1" "$2" "${args[@]}" +} +substituteInPlace () +{ + + local -a fileNames=(); + for arg in "$@"; + do + if [[ "$arg" = "--"* ]]; then + break; + fi; + fileNames+=("$arg"); + shift; + done; + for file in "${fileNames[@]}"; + do + substitute "$file" "$file" "$@"; + done +} +substituteStream () +{ + + local var=$1; + local description=$2; + shift 2; + while (( "$#" )); do + case "$1" in + --replace) + pattern="$2"; + replacement="$3"; + shift 3; + local savedvar; + savedvar="${!var}"; + eval "$var"'=${'"$var"'//"$pattern"/"$replacement"}'; + if [ "$pattern" != "$replacement" ]; then + if [ "${!var}" == "$savedvar" ]; then + echo "substituteStream(): WARNING: pattern '$pattern' doesn't match anything in $description" 1>&2; + fi; + fi + ;; + --subst-var) + local varName="$2"; + shift 2; + if ! [[ "$varName" =~ ^[a-zA-Z_][a-zA-Z0-9_]*$ ]]; then + echo "substituteStream(): ERROR: substitution variables must be valid Bash names, \"$varName\" isn't." 1>&2; + return 1; + fi; + if [ -z ${!varName+x} ]; then + echo "substituteStream(): ERROR: variable \$$varName is unset" 1>&2; + return 1; + fi; + pattern="@$varName@"; + replacement="${!varName}"; + eval "$var"'=${'"$var"'//"$pattern"/"$replacement"}' + ;; + --subst-var-by) + pattern="@$2@"; + replacement="$3"; + eval "$var"'=${'"$var"'//"$pattern"/"$replacement"}'; + shift 3 + ;; + *) + echo "substituteStream(): ERROR: Invalid command line argument: $1" 1>&2; + return 1 + ;; + esac; + done; + printf "%s" "${!var}" +} +unpackFile () +{ + + curSrc="$1"; + echo "unpacking source archive $curSrc"; + if ! runOneHook unpackCmd "$curSrc"; then + echo "do not know how to unpack source archive $curSrc"; + exit 1; + fi +} +unpackPhase () +{ + + runHook preUnpack; + if [ -z "${srcs:-}" ]; then + if [ -z "${src:-}" ]; then + echo 'variable $src or $srcs should point to the source'; + exit 1; + fi; + srcs="$src"; + fi; + local -a srcsArray; + if [ -n "$__structuredAttrs" ]; then + srcsArray=("${srcs[@]}"); + else + srcsArray=($srcs); + fi; + local dirsBefore=""; + for i in *; + do + if [ -d "$i" ]; then + dirsBefore="$dirsBefore $i "; + fi; + done; + for i in "${srcsArray[@]}"; + do + unpackFile "$i"; + done; + : "${sourceRoot=}"; + if [ -n "${setSourceRoot:-}" ]; then + runOneHook setSourceRoot; + else + if [ -z "$sourceRoot" ]; then + for i in *; + do + if [ -d "$i" ]; then + case $dirsBefore in + *\ $i\ *) + + ;; + *) + if [ -n "$sourceRoot" ]; then + echo "unpacker produced multiple directories"; + exit 1; + fi; + sourceRoot="$i" + ;; + esac; + fi; + done; + fi; + fi; + if [ -z "$sourceRoot" ]; then + echo "unpacker appears to have produced no directories"; + exit 1; + fi; + echo "source root is $sourceRoot"; + if [ "${dontMakeSourcesWritable:-0}" != 1 ]; then + chmod -R u+w -- "$sourceRoot"; + fi; + runHook postUnpack +} +updateAutotoolsGnuConfigScriptsPhase () +{ + + if [ -n "${dontUpdateAutotoolsGnuConfigScripts-}" ]; then + return; + fi; + for script in config.sub config.guess; + do + for f in $(find . -type f -name "$script"); + do + echo "Updating Autotools / GNU config script to a newer upstream version: $f"; + cp -f "/nix/store/7lk76vdawbx478qq9lvi3mgf73rvcyhd-gnu-config-2023-09-19/$script" "$f"; + done; + done +} +updateSourceDateEpoch () +{ + + local path="$1"; + local -a res=($(find "$path" -type f -not -newer "$NIX_BUILD_TOP/.." -printf '%T@ %p\0' | sort -n --zero-terminated | tail -n1 --zero-terminated | head -c -1)); + local time="${res[0]//\.[0-9]*/}"; + local newestFile="${res[1]}"; + if [ "${time:-0}" -gt "$SOURCE_DATE_EPOCH" ]; then + echo "setting SOURCE_DATE_EPOCH to timestamp $time of file $newestFile"; + export SOURCE_DATE_EPOCH="$time"; + local now="$(date +%s)"; + if [ "$time" -gt $((now - 60)) ]; then + echo "warning: file $newestFile may be generated; SOURCE_DATE_EPOCH may be non-deterministic"; + fi; + fi +} +PATH="$PATH${nix_saved_PATH:+:$nix_saved_PATH}" +XDG_DATA_DIRS="$XDG_DATA_DIRS${nix_saved_XDG_DATA_DIRS:+:$nix_saved_XDG_DATA_DIRS}" +export NIX_BUILD_TOP="$(mktemp -d -t nix-shell.XXXXXX)" +export TMP="$NIX_BUILD_TOP" +export TMPDIR="$NIX_BUILD_TOP" +export TEMP="$NIX_BUILD_TOP" +export TEMPDIR="$NIX_BUILD_TOP" +eval "$shellHook" diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..7dfaa23 --- /dev/null +++ b/.envrc @@ -0,0 +1,2 @@ +export HE_PASSWORD=SuperDuper +use flake diff --git a/dns/test_nullhex.sh b/dns/test_nullhex.sh old mode 100755 new mode 100644 diff --git a/flake.lock b/flake.lock index ab1eb6f..aa9ba90 100644 --- a/flake.lock +++ b/flake.lock @@ -451,11 +451,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1704874635, - "narHash": "sha256-YWuCrtsty5vVZvu+7BchAxmcYzTMfolSPP5io8+WYCg=", + "lastModified": 1710420202, + "narHash": "sha256-MvFKESbq4rUWuaf2RKPNYENaSZEw/jaCLo2gU6oREcM=", "owner": "nixos", "repo": "nixpkgs", - "rev": "3dc440faeee9e889fe2d1b4d25ad0f430d449356", + "rev": "878ef7d9721bee9f81f8a80819f9211ad1f993da", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index caac031..06cd127 100644 --- a/flake.nix +++ b/flake.nix @@ -1,5 +1,5 @@ { - description = "Your new nix config"; + description = "Sealight NixOS Config"; inputs = { # Nixpkgs @@ -271,6 +271,7 @@ hostname = "mossnet.lan"; autoRollback = false; magicRollback = false; + remoteBuild = true; profiles.system = { user = "root"; path = deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations.box; diff --git a/home/core/default.nix b/home/core/default.nix index 1071c8e..08abf68 100644 --- a/home/core/default.nix +++ b/home/core/default.nix @@ -1,7 +1,6 @@ { self, pkgs, ... }: { imports = [ - ../profiles/nvim ../profiles/cli ../profiles/direnv ../profiles/git diff --git a/home/gui/default.nix b/home/gui/default.nix index 152b168..bc975be 100644 --- a/home/gui/default.nix +++ b/home/gui/default.nix @@ -2,6 +2,7 @@ { imports = [ ../core + ../profiles/nvim ../profiles/firefox ../profiles/desktop ../profiles/email diff --git a/home/profiles/cli/default.nix b/home/profiles/cli/default.nix index 3eb0bdf..6c1fcd1 100644 --- a/home/profiles/cli/default.nix +++ b/home/profiles/cli/default.nix @@ -26,10 +26,12 @@ iftop wget curl - exa + eza bat fd ncdu + du-dust + # dia-cli duf trash-cli nix-index @@ -216,9 +218,9 @@ gen-secret = "< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c\${1:-32};echo;"; # modern cli tools - ls = "exa --icons"; - l = "exa -l --icons"; - la = "exa -la --icons"; + ls = "eza --icons"; + l = "esa -l --icons"; + la = "eza -la --icons"; tree = "ls --tree --icons"; cat = "bat"; unzip = "aunpack"; @@ -229,14 +231,17 @@ make-secret = "< /dev/urandom \\tr -dc _A-Za-z0-9 | head -c \${1:-32};echo;"; # task warrior - # TODO: make blocked a context? t = "task -BLOCKED -idea -backlog"; + tw = "t rc.context:work"; + # TODO find a reasonable way to manage this from a non-nix managed file in ~/.task/context or something + # we can do something like task rc.context:$(cat ~/.task/context) to read context + # and write a little script make-context = cat $@ > ~/.task/context or something tt = "taskwarrior-tui -r list"; ti = "task +idea"; tb = "task +backlog list"; ttb = "taskwarrior-tui -r backlog"; tr = "task newest limit:page"; - tw = "task +wait"; + twait = "task +wait"; ta = "task add"; tai = "task add +idea"; tn = "task-note"; diff --git a/home/profiles/desktop/Xresources b/home/profiles/desktop/Xresources old mode 100644 new mode 100755 diff --git a/home/profiles/desktop/polybar/run.sh b/home/profiles/desktop/polybar/run.sh old mode 100644 new mode 100755 diff --git a/home/profiles/email/default.nix b/home/profiles/email/default.nix index 4d145ea..a32fc69 100644 --- a/home/profiles/email/default.nix +++ b/home/profiles/email/default.nix @@ -175,7 +175,7 @@ bind editor ^T complete # Press A to archive - macro index,pager A "N=/Archive" "mark message as Archived" + macro index,pager A "=/Archive" "mark message as Archived" # Press C to add contact to Khard address book macro index,pager C \ "khard add-email" \ diff --git a/home/profiles/firefox/default.nix b/home/profiles/firefox/default.nix index fd3dbb4..73facd7 100644 --- a/home/profiles/firefox/default.nix +++ b/home/profiles/firefox/default.nix @@ -21,7 +21,7 @@ extensions = with pkgs.nur.repos.rycee.firefox-addons; [ # Find extensions: https://github.com/nix-community/nur-combined/blob/master/repos/rycee/pkgs/firefox-addons/generated-firefox-addons.nix ublock-origin - wallabagger + # wallabagger # tree-style-tab tridactyl promnesia diff --git a/home/profiles/nvim/default.nix b/home/profiles/nvim/default.nix index ed44f78..79bee58 100644 --- a/home/profiles/nvim/default.nix +++ b/home/profiles/nvim/default.nix @@ -148,9 +148,9 @@ in # kitaab zettel kz = "cd ~/kitaab/vimwiki; vim -c :VimwikiIndex -c :ZettelNew; cd $OLDPWD"; # kitaab recents - kr = "cd /home/anish/kitaab/vimwiki; exa --sort=modified --reverse | fzf --preview 'bat --style=numbers --color=always --terminal-width -1 ./{}';cd $OLDPWD"; + kr = "cd /home/anish/kitaab/vimwiki; eza --sort=modified --reverse | fzf --preview 'bat --style=numbers --color=always --terminal-width -1 ./{}';cd $OLDPWD"; # kitaab get by tagged - kt = "cd /home/anish/kitaab/vimwiki; exa *_index.wiki | fzf --preview 'bat --style=numbers --color=always --terminal-width -1 ./{}';cd $OLDPWD"; + kt = "cd /home/anish/kitaab/vimwiki; eza *_index.wiki | fzf --preview 'bat --style=numbers --color=always --terminal-width -1 ./{}';cd $OLDPWD"; # List files that have no links in them ku = "cd /home/anish/kitaab/;vim ./vimwiki/$(python3 poonam/main.py report --titles=false | tail -n +4 | fzf --preview 'bat --style=numbers --color=always --terminal-width -1 ./vimwiki/{}');cd $OLDPWD"; }; @@ -804,7 +804,7 @@ in } } -- You gotta run :SCNvimGenerateAssets for this first - require("luasnip").add_snippets("supercollider", require("scnvim/utils").get_snippets()) + -- require("luasnip").add_snippets("supercollider", require("scnvim/utils").get_snippets()) -- zen mode require('zen-mode').setup{ diff --git a/home/profiles/task/bin/set-backlog.sh b/home/profiles/task/bin/set-backlog.sh old mode 100644 new mode 100755 diff --git a/home/profiles/task/bin/set-focus.sh b/home/profiles/task/bin/set-focus.sh old mode 100644 new mode 100755 diff --git a/home/profiles/task/default.nix b/home/profiles/task/default.nix index 0862f9e..f308278 100644 --- a/home/profiles/task/default.nix +++ b/home/profiles/task/default.nix @@ -9,7 +9,7 @@ # this way, we get a copy of the file, and we make sure it's writable ".taskrc".source = ./taskrc; ".taskrc".executable = true; - ".taskrc".onChange = "cp ~/.taskrc ~/.taskrc2;rm ~/.taskrc;mv ~/.taskrc2 ~/.taskrc;chmod +w ~/.taskrc"; + # ".taskrc".onChange = "cp ~/.taskrc ~/.taskrc2;rm ~/.taskrc;mv ~/.taskrc2 ~/.taskrc;chmod +w ~/.taskrc"; ".task/keys/ca.cert".source = ./ca.cert; ".task/keys/public.cert".source = ./public.cert; diff --git a/home/profiles/task/taskrc b/home/profiles/task/taskrc index 9a8ebbc..a6002ed 100644 --- a/home/profiles/task/taskrc +++ b/home/profiles/task/taskrc @@ -82,6 +82,11 @@ report.every.filter=(status:pending limit:0) report.every.labels=ID,Active,Deps,P,Project,Tag,Recur,S,Due,Until,Description report.every.columns=id,start.age,depends,priority,project,tags,recur,scheduled.countdown,due.relative,until.remaining,description +report.poms.filter=(status:pending -idea -backlog -BLOCKED) +report.poms.labels=UUID,ID,Project,Tag,Description +report.poms.columns=uuid,id,project,tags,description +report.poms.sort=start+,urgency+ + # Urgency urgency.user.project.wait.coefficient=-10.0 urgency.user.project.craft.coefficient=1.9 diff --git a/hosts/box/default.nix b/hosts/box/default.nix index bb593b7..dff159c 100644 --- a/hosts/box/default.nix +++ b/hosts/box/default.nix @@ -7,12 +7,12 @@ ../profiles/taskd ../profiles/shaarli ../profiles/dns - ../profiles/monitoring + # ../profiles/monitoring ../profiles/nfs ../profiles/gonic - ../profiles/headphones + ../profiles/headphones ../profiles/radicale - ../profiles/seafile + ../profiles/seafile ../profiles/syncthing ../profiles/dhyan ../profiles/calibre @@ -22,9 +22,10 @@ ../profiles/grasp # ../profiles/archivebox # ../profiles/woodpecker-agent - ../profiles/jellyfin + # ../profiles/jellyfin ../profiles/ulogger-server ../profiles/photoprism + #../profiles/postgres_upgrade_script ]; # Backups diff --git a/hosts/curve/default.nix b/hosts/curve/default.nix index 67a9dee..31d539a 100644 --- a/hosts/curve/default.nix +++ b/hosts/curve/default.nix @@ -20,6 +20,12 @@ # import profiling tools programs.systemtap.enable = true; + virtualisation.docker.enable = true; + virtualisation.docker.storageDriver = "btrfs"; + environment.systemPackages = with pkgs; [ + docker-compose + ]; + # Speed up boot by removing dependency on network systemd = { targets.network-online.wantedBy = pkgs.lib.mkForce [ ]; # Normally ["multi-user.target"] @@ -87,7 +93,7 @@ #virtualisation.docker.enable = true; boot.blacklistedKernelModules = [ "qcserial" ]; # Used for packer Capsul - users.users.anish.extraGroups = [ "adbusers" "wheel" "plugdev" "libvertd" ]; + users.users.anish.extraGroups = [ "adbusers" "wheel" "plugdev" "libvertd" "docker" ]; virtualisation.libvirtd.enable = true; hardware.keyboard.zsa.enable = true; services.udev.extraRules = '' diff --git a/hosts/curve/hardware-configuration.nix b/hosts/curve/hardware-configuration.nix index 99988a6..f984e5d 100644 --- a/hosts/curve/hardware-configuration.nix +++ b/hosts/curve/hardware-configuration.nix @@ -5,37 +5,34 @@ { imports = - [ - (modulesPath + "/installer/scan/not-detected.nix") + [ (modulesPath + "/installer/scan/not-detected.nix") ]; - boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" "rtsx_pci_sdmmc" ]; + boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ]; boot.initrd.kernelModules = [ "dm-snapshot" ]; boot.kernelModules = [ "kvm-intel" ]; boot.extraModulePackages = [ ]; - fileSystems."/boot" = - { - device = "/dev/disk/by-uuid/2C41-3DAA"; - fsType = "vfat"; - }; - fileSystems."/" = - { - device = "/dev/disk/by-uuid/a4ae2855-10b9-49f3-adb0-acd82b74eeb9"; + { device = "/dev/disk/by-uuid/e1268753-4f18-4e6f-8edb-d4724ad8eb4a"; fsType = "btrfs"; options = [ "subvol=root" ]; }; fileSystems."/home" = - { - device = "/dev/disk/by-uuid/a4ae2855-10b9-49f3-adb0-acd82b74eeb9"; + { device = "/dev/disk/by-uuid/e1268753-4f18-4e6f-8edb-d4724ad8eb4a"; fsType = "btrfs"; options = [ "subvol=home" ]; }; + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/8244-A184"; + fsType = "vfat"; + }; + swapDevices = - [{ device = "/dev/disk/by-uuid/23658926-6ffa-42dc-8915-a6479c385e0b"; }]; + [ { device = "/dev/disk/by-uuid/e220fea6-cf3b-4687-bfe1-9cf6d3ba57f7"; } + ]; # Enables DHCP on each ethernet and wireless interface. In case of scripted networking # (the default) this is the recommended approach. When using systemd-networkd it's @@ -46,6 +43,5 @@ # networking.interfaces.wlp3s0.useDHCP = lib.mkDefault true; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; - # hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; } diff --git a/hosts/development/mirlo/docker-compose.nix b/hosts/development/mirlo/docker-compose.nix new file mode 100644 index 0000000..a4ec900 --- /dev/null +++ b/hosts/development/mirlo/docker-compose.nix @@ -0,0 +1,337 @@ +# Auto-generated using compose2nix v0.1.6. +{ pkgs, lib, ... }: + +{ + # Runtime + virtualisation.podman = { + enable = true; + autoPrune.enable = true; + dockerCompat = true; + defaultNetwork.settings = { + # Required for container networking to be able to use names. + dns_enabled = true; + }; + }; + virtualisation.oci-containers.backend = "podman"; + + # Containers + virtualisation.oci-containers.containers."blackbird-api" = { + image = ""; + environment = { + API_DOMAIN = "http://localhost:3000"; + DATABASE_URL = "postgresql://nomads:nomads@pgsql:5432/nomads?schema=public"; + JWT_SECRET = "test1234"; + MEDIA_LOCATION = "./data/media/"; + MEDIA_LOCATION_DOWNLOAD_CACHE = "/data/media/downloadCache"; + MEDIA_LOCATION_INCOMING = "/data/media/incoming"; + MINIO_HOST = "minio"; + MINIO_PORT = "9000"; + MINIO_ROOT_PASSWORD = "password"; + MINIO_ROOT_USER = "blackbird"; + NODE_ENV = "development"; + PORT = "3000"; + POSTGRES_LOCAL_MACHINE_PORT = "5434"; + POSTGRES_PASSWORD = "nomads"; + POSTGRES_USER = "nomads"; + REACT_APP_API_DOMAIN = "http://localhost:3000"; + REDIS_HOST = "redis"; + REDIS_PASSWORD = "password"; + REDIS_PORT = "6379"; + REFRESH_TOKEN_SECRET = "test1234"; + STATIC_MEDIA_HOST = "http://localhost:3000"; + STRIPE_KEY = ""; + }; + volumes = [ + "/home/anish/.ssh:/root/.ssh:rw" + "/home/anish/usr/mirlo:/var/www/api:rw" + "/home/anish/usr/mirlo/data/media/downloadCache:/data/media/downloadCache:rw" + "/home/anish/usr/mirlo/data/media/incoming:/data/media/incoming:rw" + ]; + ports = [ + "3000:3000/tcp" + ]; + cmd = [ "/bin/sh" "-c" "yarn && yarn migrate:deploy && yarn dev:api" ]; + dependsOn = [ + "blackbird-minio" + "blackbird-pgsql" + "blackbird-redis" + ]; + log-driver = "journald"; + extraOptions = [ + "--network-alias=api" + "--network=mirlo-api-network" + "--network=mirlo-redis-network" + ]; + }; + systemd.services."podman-blackbird-api" = { + serviceConfig = { + Restart = lib.mkOverride 500 "always"; + }; + after = [ + "podman-network-mirlo-api-network.service" + "podman-network-mirlo-redis-network.service" + ]; + requires = [ + "podman-network-mirlo-api-network.service" + "podman-network-mirlo-redis-network.service" + ]; + partOf = [ + "podman-compose-mirlo-root.target" + ]; + unitConfig.UpheldBy = [ + "podman-blackbird-minio.service" + "podman-blackbird-pgsql.service" + "podman-blackbird-redis.service" + ]; + wantedBy = [ + "podman-compose-mirlo-root.target" + ]; + }; + virtualisation.oci-containers.containers."blackbird-background" = { + image = ""; + environment = { + API_DOMAIN = "http://localhost:3000"; + DATABASE_URL = "postgresql://nomads:nomads@pgsql:5432/nomads?schema=public"; + JWT_SECRET = "test1234"; + MEDIA_LOCATION = "./data/media/"; + MEDIA_LOCATION_DOWNLOAD_CACHE = "/data/media/downloadCache"; + MEDIA_LOCATION_INCOMING = "/data/media/incoming"; + MINIO_HOST = "minio"; + MINIO_PORT = "9000"; + MINIO_ROOT_PASSWORD = "password"; + MINIO_ROOT_USER = "blackbird"; + NODE_ENV = "development"; + PORT = "3000"; + POSTGRES_LOCAL_MACHINE_PORT = "5434"; + POSTGRES_PASSWORD = "nomads"; + POSTGRES_USER = "nomads"; + REACT_APP_API_DOMAIN = "http://localhost:3000"; + REDIS_HOST = "redis"; + REDIS_PASSWORD = "password"; + REDIS_PORT = "6379"; + REFRESH_TOKEN_SECRET = "test1234"; + STATIC_MEDIA_HOST = "http://localhost:3000"; + STRIPE_KEY = ""; + }; + volumes = [ + "/home/anish/.ssh:/root/.ssh:rw" + "/home/anish/usr/mirlo:/var/www/api:rw" + "/home/anish/usr/mirlo/data/media/processing:/data/media/processing:rw" + ]; + dependsOn = [ + "blackbird-api" + "blackbird-minio" + "blackbird-pgsql" + "blackbird-redis" + ]; + log-driver = "journald"; + extraOptions = [ + "--network-alias=background" + "--network=mirlo-api-network" + "--network=mirlo-redis-network" + ]; + }; + systemd.services."podman-blackbird-background" = { + serviceConfig = { + Restart = lib.mkOverride 500 "always"; + }; + after = [ + "podman-network-mirlo-api-network.service" + "podman-network-mirlo-redis-network.service" + ]; + requires = [ + "podman-network-mirlo-api-network.service" + "podman-network-mirlo-redis-network.service" + ]; + partOf = [ + "podman-compose-mirlo-root.target" + ]; + unitConfig.UpheldBy = [ + "podman-blackbird-api.service" + "podman-blackbird-minio.service" + "podman-blackbird-pgsql.service" + "podman-blackbird-redis.service" + ]; + wantedBy = [ + "podman-compose-mirlo-root.target" + ]; + }; + virtualisation.oci-containers.containers."blackbird-minio" = { + image = "minio/minio"; + environment = { + API_DOMAIN = "http://localhost:3000"; + DATABASE_URL = "postgresql://nomads:nomads@pgsql:5432/nomads?schema=public"; + JWT_SECRET = "test1234"; + MEDIA_LOCATION = "./data/media/"; + MEDIA_LOCATION_DOWNLOAD_CACHE = "/data/media/downloadCache"; + MEDIA_LOCATION_INCOMING = "/data/media/incoming"; + MINIO_HOST = "minio"; + MINIO_PORT = "9000"; + MINIO_ROOT_PASSWORD = "password"; + MINIO_ROOT_USER = "blackbird"; + PORT = "3000"; + POSTGRES_LOCAL_MACHINE_PORT = "5434"; + POSTGRES_PASSWORD = "nomads"; + POSTGRES_USER = "nomads"; + REACT_APP_API_DOMAIN = "http://localhost:3000"; + REDIS_HOST = "redis"; + REDIS_PASSWORD = "password"; + REDIS_PORT = "6379"; + REFRESH_TOKEN_SECRET = "test1234"; + STATIC_MEDIA_HOST = "http://localhost:3000"; + STRIPE_KEY = ""; + }; + volumes = [ + "/home/anish/usr/mirlo/data/minio_storage:/data:rw" + ]; + ports = [ + "9000:9000/tcp" + "9001:9001/tcp" + ]; + cmd = [ "server" "--console-address" ":9001" "/data" ]; + log-driver = "journald"; + extraOptions = [ + "--network-alias=minio" + "--network=mirlo-api-network:alias=minio" + ]; + }; + systemd.services."podman-blackbird-minio" = { + serviceConfig = { + Restart = lib.mkOverride 500 "no"; + }; + after = [ + "podman-network-mirlo-api-network.service" + ]; + requires = [ + "podman-network-mirlo-api-network.service" + ]; + partOf = [ + "podman-compose-mirlo-root.target" + ]; + wantedBy = [ + "podman-compose-mirlo-root.target" + ]; + }; + virtualisation.oci-containers.containers."blackbird-pgsql" = { + image = "postgres:14-alpine"; + environment = { + API_DOMAIN = "http://localhost:3000"; + DATABASE_URL = "postgresql://nomads:nomads@pgsql:5432/nomads?schema=public"; + JWT_SECRET = "test1234"; + MEDIA_LOCATION = "./data/media/"; + MEDIA_LOCATION_DOWNLOAD_CACHE = "/data/media/downloadCache"; + MEDIA_LOCATION_INCOMING = "/data/media/incoming"; + MINIO_HOST = "minio"; + MINIO_PORT = "9000"; + MINIO_ROOT_PASSWORD = "password"; + MINIO_ROOT_USER = "blackbird"; + PORT = "3000"; + POSTGRES_LOCAL_MACHINE_PORT = "5434"; + POSTGRES_PASSWORD = "nomads"; + POSTGRES_USER = "nomads"; + REACT_APP_API_DOMAIN = "http://localhost:3000"; + REDIS_HOST = "redis"; + REDIS_PASSWORD = "password"; + REDIS_PORT = "6379"; + REFRESH_TOKEN_SECRET = "test1234"; + STATIC_MEDIA_HOST = "http://localhost:3000"; + STRIPE_KEY = ""; + }; + volumes = [ + "/home/anish/usr/mirlo/data/pgsql:/var/lib/postgresql/data:rw" + "/home/anish/usr/mirlo/data/pgsql_backups:/backups:rw" + ]; + ports = [ + "5432:5432/tcp" + ]; + log-driver = "journald"; + extraOptions = [ + "--network-alias=pgsql" + "--network=mirlo-api-network:alias=pgsql" + ]; + }; + systemd.services."podman-blackbird-pgsql" = { + serviceConfig = { + Restart = lib.mkOverride 500 "no"; + }; + after = [ + "podman-network-mirlo-api-network.service" + ]; + requires = [ + "podman-network-mirlo-api-network.service" + ]; + partOf = [ + "podman-compose-mirlo-root.target" + ]; + wantedBy = [ + "podman-compose-mirlo-root.target" + ]; + }; + virtualisation.oci-containers.containers."blackbird-redis" = { + image = "redis"; + ports = [ + "6379:6379/tcp" + ]; + cmd = [ "redis-server" "--appendonly" "yes" "--requirepass " ]; + log-driver = "journald"; + extraOptions = [ + "--network-alias=redis" + "--network=mirlo-redis-network" + ]; + }; + systemd.services."podman-blackbird-redis" = { + serviceConfig = { + Restart = lib.mkOverride 500 "always"; + }; + after = [ + "podman-network-mirlo-redis-network.service" + ]; + requires = [ + "podman-network-mirlo-redis-network.service" + ]; + partOf = [ + "podman-compose-mirlo-root.target" + ]; + wantedBy = [ + "podman-compose-mirlo-root.target" + ]; + }; + + # Networks + systemd.services."podman-network-mirlo-api-network" = { + path = [ pkgs.podman ]; + serviceConfig = { + Type = "oneshot"; + RemainAfterExit = true; + ExecStop = "${pkgs.podman}/bin/podman network rm -f mirlo-api-network"; + }; + script = '' + podman network inspect mirlo-api-network || podman network create mirlo-api-network --opt isolate=true + ''; + partOf = [ "podman-compose-mirlo-root.target" ]; + wantedBy = [ "podman-compose-mirlo-root.target" ]; + }; + systemd.services."podman-network-mirlo-redis-network" = { + path = [ pkgs.podman ]; + serviceConfig = { + Type = "oneshot"; + RemainAfterExit = true; + ExecStop = "${pkgs.podman}/bin/podman network rm -f mirlo-redis-network"; + }; + script = '' + podman network inspect mirlo-redis-network || podman network create mirlo-redis-network --opt isolate=true + ''; + partOf = [ "podman-compose-mirlo-root.target" ]; + wantedBy = [ "podman-compose-mirlo-root.target" ]; + }; + + # Root service + # When started, this will automatically create all resources and start + # the containers. When stopped, this will teardown all resources. + systemd.targets."podman-compose-mirlo-root" = { + unitConfig = { + Description = "Root target generated by compose2nix."; + }; + wantedBy = [ "multi-user.target" ]; + }; +} diff --git a/hosts/helix/default.nix b/hosts/helix/default.nix index 62275d0..9ffeefa 100644 --- a/hosts/helix/default.nix +++ b/hosts/helix/default.nix @@ -11,6 +11,7 @@ # ../profiles/mount-mossnet ../profiles/freshrss ../profiles/microbin + # ../profiles/postgres_upgrade_script ]; # Capsul specific @@ -27,11 +28,11 @@ privateKeyFile = "/run/agenix/helix-wg"; }; - services.postgresql.package = pkgs.postgresql_11; + services.postgresql.package = pkgs.postgresql_15; services.postgresqlBackup = { # TODO needs working wireguard to box enable = false; - databases = [ "gitea" "freshrss" "woodpecker" ]; + databases = [ "gitea" "freshrss" ]; # "woodpecker" location = "/mnt/two/postgres"; }; @@ -41,7 +42,7 @@ paths = [ "/var/lib/gitea" "/var/lib/freshrss" - "/var/lib/woodpecker" + # "/var/lib/woodpecker" "/var/lib/microbin" ]; diff --git a/hosts/profiles/core/default.nix b/hosts/profiles/core/default.nix index 3c65441..b231c53 100644 --- a/hosts/profiles/core/default.nix +++ b/hosts/profiles/core/default.nix @@ -32,7 +32,7 @@ in }; environment.systemPackages = with pkgs; [ - pinentry_gnome + pinentry-gnome cached-nix-shell ]; diff --git a/hosts/profiles/desktop/default.nix b/hosts/profiles/desktop/default.nix index 156c82c..9dfc06d 100644 --- a/hosts/profiles/desktop/default.nix +++ b/hosts/profiles/desktop/default.nix @@ -99,7 +99,7 @@ in papirus-icon-theme calendar-cli wyrd - tic-80 + # tic-80 ytfzf yt-dlp ]; @@ -123,9 +123,12 @@ in }; xserver = { enable = true; - xkb.layout = "us,dvorak"; + # TODO should be xkb.layout + layout = "us"; + # xkb.variant = "dvorak"; desktopManager.wallpaper.mode = "fill"; displayManager = { + # startx.enable = true; defaultSession = "none+bspwm"; sessionCommands = '' ${pkgs.xorg.xrdb}/bin/xrdb -merge <` with the psqlSchema here # The schema can be found by running: - # nix-instantiate '' --eval -A postgresql_14.psqlSchema - export NEWDATA="/var/lib/postgresql/" + # nix eval --raw nixpkgs#postgresql_15.psqlSchema + export NEWDATA="/var/lib/postgresql/15" # TODO specify the postgresql package you'd like to upgrade to - export NEWBIN="${pkgs.postgresql_14}/bin" + export NEWBIN="${pkgs.postgresql_15}/bin" export OLDDATA="${config.services.postgresql.dataDir}" export OLDBIN="${config.services.postgresql.package}/bin" diff --git a/hosts/profiles/sync/music/get-music.sh b/hosts/profiles/sync/music/get-music.sh old mode 100755 new mode 100644 diff --git a/hosts/profiles/ulogger-server/default.nix b/hosts/profiles/ulogger-server/default.nix index 6fbaee8..d7d8f27 100644 --- a/hosts/profiles/ulogger-server/default.nix +++ b/hosts/profiles/ulogger-server/default.nix @@ -6,7 +6,7 @@ ensureDatabases = [ "ulogger" ]; ensureUsers = [{ name = "ulogger"; - nsureDBOwnership = true; + ensureDBOwnership = true; }]; }; diff --git a/hosts/profiles/wallabag/default.nix b/hosts/profiles/wallabag/default.nix index 4d582e9..e2b3523 100644 --- a/hosts/profiles/wallabag/default.nix +++ b/hosts/profiles/wallabag/default.nix @@ -25,7 +25,8 @@ services.wallabag = { enable = true; hostName = "read.mossnet.lan"; - package = pkgs.wallabag; + package = pkgs.my-wallabag; + dataDir = "/var/lib/wallabag"; conf = '' # This file is a "template" of what your parameters.yml file should look like parameters: @@ -42,7 +43,7 @@ # with PostgreSQL and SQLite, you must set "utf8" database_charset: utf8 - domain_name: http://read.mossnet.lan/ + domain_name: http://read.mossnet.lan server_name: "mossnet wallabag instance" mailer_dsn: null:// diff --git a/install-encrypted.sh b/install-encrypted.sh old mode 100755 new mode 100644 diff --git a/install-yubikey.sh b/install-yubikey.sh old mode 100755 new mode 100644 index 81b5447..e2098cb --- a/install-yubikey.sh +++ b/install-yubikey.sh @@ -19,7 +19,7 @@ cc -O3 -I$(nix-build "" --no-build-output -A openssl.dev)/include -L$(n # Yubikey Setup SLOT=2 -ykpersonalize -"$SLOT" -ochal-resp -ochal-hmac +# ykpersonalize -"$SLOT" -ochal-resp -ochal-hmac SALT_LENGTH=16 salt="$(dd if=/dev/random bs=1 count=$SALT_LENGTH 2>/dev/null | rbtohex)" k_user=PASSWORDCHANGEMEPLAEASES diff --git a/modules/nixos/default.nix b/modules/nixos/default.nix index 1a358e1..d4efdc5 100644 --- a/modules/nixos/default.nix +++ b/modules/nixos/default.nix @@ -9,5 +9,5 @@ wireguard = import ./wireguard.nix; backup = import ./backup.nix; ulogger-server = import ./ulogger.nix; - # microbin = import ./microbin.nix; includide in 23.11 + # microbin = import ./microbin.nix; # includide in 23.11 } diff --git a/modules/nixos/wallabag.nix b/modules/nixos/wallabag.nix index bb02e4f..14bfe26 100644 --- a/modules/nixos/wallabag.nix +++ b/modules/nixos/wallabag.nix @@ -26,7 +26,7 @@ let console = pkgs.writeShellScriptBin "wallabag-console" '' export WALLABAG_DATA="${cfg.dataDir}" cd "${cfg.dataDir}" - ${pkgs.php}/bin/php ${pkgs.wallabag}/bin/console --env=prod $@ + ${pkgs.php}/bin/php ${cfg.package}/bin/console --env=prod $@ ''; in @@ -166,11 +166,11 @@ in forceSSL = false; root = "${cfg.package}/web"; - extraConfig = '' - add_header X-Frame-Options SAMEORIGIN; - add_header X-Content-Type-Options nosniff; - add_header X-XSS-Protection "1; mode=block"; - ''; + # extraConfig = '' + # add_header X-Frame-Options SAMEORIGIN; + # add_header X-Content-Type-Options nosniff; + # add_header X-XSS-Protection "1; mode=block"; + # ''; locations."/" = { tryFiles = "$uri /app.php$is_args$args"; @@ -179,25 +179,19 @@ in locations."/assets".root = "${cfg.dataDir}/web"; locations."~ ^/app\\.php(/|$)" = { - fastcgiParams = { - SCRIPT_FILENAME = "$realpath_root$fastcgi_script_name"; - DOCUMENT_ROOT = "$realpath_root"; - }; + # fastcgiParams = { + # SCRIPT_FILENAME = "$realpath_root$fastcgi_script_name"; + # DOCUMENT_ROOT = "$realpath_root"; + # }; extraConfig = '' fastcgi_pass unix:${config.services.phpfpm.pools."${poolName}".socket}; - include ${config.services.nginx.package}/conf/fastcgi_params; - include ${config.services.nginx.package}/conf/fastcgi.conf; + fastcgi_split_path_info ^(.+\.php)(/.*)$; + include ${pkgs.nginx}/conf/fastcgi_params; + fastcgi_param SCRIPT_FILENAME ${cfg.package}/web/$fastcgi_script_name; + fastcgi_param DOCUMENT_ROOT ${cfg.package}/web; + fastcgi_read_timeout 120; internal; ''; - # extraConfig = '' - # fastcgi_pass unix:${config.services.phpfpm.pools."${poolName}".socket}; - # fastcgi_split_path_info ^(.+\.php)(/.*)$; - # include ${pkgs.nginx}/conf/fastcgi_params; - # fastcgi_param SCRIPT_FILENAME ${cfg.package}/web/$fastcgi_script_name; - # fastcgi_param DOCUMENT_ROOT ${cfg.package}/web; - # fastcgi_read_timeout 120; - # internal; - # ''; }; locations."~ /(?!app)\\.php$" = { diff --git a/mount-crypted.sh b/mount-crypted.sh old mode 100644 new mode 100755 index 67f35d6..0bd630a --- a/mount-crypted.sh +++ b/mount-crypted.sh @@ -1,9 +1,21 @@ #!/usr/bin/env bash + +# nix-shell https://github.com/sgillespie/nixos-yubikey-luks/archive/master.tar.gz + +rbtohex() { + ( od -An -vtx1 | tr -d ' \n' ) +} + +hextorb() { + ( tr '[:lower:]' '[:upper:]' | sed -e 's/\([0-9A-F]\{2\}\)/\\\\\\x\1/gI'| xargs printf ) +} + key_length=512 -iterations="$(head -n 2 /boot/crypted-storage/default)" -salt="$(head -n 1 /boot/crypted-storage/default)" +iterations=1000000 +salt="$(head -n 1 /mnt/crypt-storage/default)" chal="$(echo -n $salt | openssl dgst -binary -sha512 | rbtohex)" resp="$(ykchalresp -2 -x $chal 2>/dev/null)" -user_key="$(read -s)" +user_key= +read -r user_key luks_key="$(echo -n $user_key | pbkdf2-sha512 $(($key_length / 8)) $iterations $resp | rbtohex)" echo -n $luks_key | hextorb | sudo cryptsetup luksOpen /dev/sda2 crypted --key-file=- diff --git a/pkgs/default.nix b/pkgs/default.nix index 2f1f348..0d35317 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -8,4 +8,6 @@ kobopatch = pkgs.callPackage ./kobopatch.nix { }; my-mautrix-discord = pkgs.callPackage ./mautrix-discord.nix { }; # Handled by matrix-appservices input ulogger-server = pkgs.callPackage ./ulogger.nix { }; + my-wallabag = pkgs.callPackage ./wallabag.nix { }; + mautrix-slack = pkgs.callPackage ./mautrix-slack.nix { }; } diff --git a/pkgs/koboutils.nix b/pkgs/koboutils.nix index f11013d..8d7f672 100644 --- a/pkgs/koboutils.nix +++ b/pkgs/koboutils.nix @@ -4,7 +4,7 @@ buildGoModule rec { name = "koboutils"; version = "git_2020-04-08"; - vendorSha256 = "1hqvizvbc29yib6awmvlklxkq7j8c0d32gxsipdiwhkh79xbd6wq"; + vendorha256 = "1hqvizvbc29yib6awmvlklxkq7j8c0d32gxsipdiwhkh79xbd6wq"; deleteVendor = true; src = fetchFromGitHub { diff --git a/pkgs/mautrix-slack.nix b/pkgs/mautrix-slack.nix new file mode 100644 index 0000000..f193dd9 --- /dev/null +++ b/pkgs/mautrix-slack.nix @@ -0,0 +1,29 @@ +{ lib, buildGoModule, fetchFromGitHub, olm }: + +buildGoModule rec { + pname = "mautrix-discord"; + version = "unstable-2022-11-04"; + + src = fetchFromGitHub { + owner = "mautrix"; + repo = "slack"; + rev = "4530ff397d08d93b673cd71da4c2a75d969ca0df"; + hash = ""; + }; + + buildInputs = [ olm ]; + + vendorHash = "sha256-yday2mSnPwuhXWkCG4XY7qoBl3DXHcSvzBoZbjgYz/c="; + + ldflags = [ "-s" "-w" ]; # https://github.com/NixOS/nixpkgs/issues/177698 + + doCheck = false; # No tests available + + meta = with lib; { + homepage = "https://go.mau.fi/mautrix-slack"; + description = "Matrix to Slack hybrid puppeting/relaybot bridge"; + license = licenses.agpl3Plus; + maintainers = with maintainers; [ ]; + }; +} + diff --git a/pkgs/tic-80.nix b/pkgs/tic-80.nix index 4d9904f..bb8141c 100644 --- a/pkgs/tic-80.nix +++ b/pkgs/tic-80.nix @@ -10,7 +10,7 @@ pkgs.stdenv.mkDerivation rec { }; buildInputs = with pkgs; [ gcc - pkgconfig + pkg-config autoconf automake libtool @@ -27,7 +27,7 @@ pkgs.stdenv.mkDerivation rec { gtk3-x11 cmake cmakeCurses - elementary-cmake-modules + # elementary-cmake-modules extra-cmake-modules libglvnd mesa_glu diff --git a/pkgs/wallabag-data.patch b/pkgs/wallabag-data.patch new file mode 100644 index 0000000..4276af5 --- /dev/null +++ b/pkgs/wallabag-data.patch @@ -0,0 +1,26 @@ +diff --git a/app/AppKernel.php b/app/AppKernel.php +index 61b734e06..d25d1aaa3 100644 +--- a/app/AppKernel.php ++++ b/app/AppKernel.php +@@ -62,14 +62,19 @@ class AppKernel extends Kernel + return $bundles; + } + ++ public function getProjectDir() ++ { ++ return getenv('WALLABAG_DATA') ?: dirname(__DIR__); ++ } ++ + public function getCacheDir() + { +- return dirname(__DIR__) . '/var/cache/' . $this->getEnvironment(); ++ return $this->getProjectDir() . '/var/cache/' . $this->getEnvironment(); + } + + public function getLogDir() + { +- return dirname(__DIR__) . '/var/logs'; ++ return $this->getProjectDir() . '/var/logs'; + } + + public function registerContainerConfiguration(LoaderInterface $loader) diff --git a/pkgs/wallabag.nix b/pkgs/wallabag.nix new file mode 100644 index 0000000..7922920 --- /dev/null +++ b/pkgs/wallabag.nix @@ -0,0 +1,57 @@ +{ lib +, stdenv +, fetchurl +}: + +# Point the environment variable $WALLABAG_DATA to a data directory +# that contains the folder `app` which must be a clone of +# wallabag's configuration files with your customized `parameters.yml`. +# In practice you need to copy `${pkgs.wallabag}/app` and the +# customizzed `parameters.yml` to $WALLABAG_DATA. +# These need to be updated every package upgrade. +# +# After a package upgrade, empty the `var/cache` folder or unexpected +# error will occur. + +let + pname = "wallabag"; + version = "2.6.8"; +in +stdenv.mkDerivation { + inherit pname version; + + # Release tarball includes vendored files + src = fetchurl { + url = "https://github.com/wallabag/wallabag/releases/download/${version}/wallabag-${version}.tar.gz"; + hash = "sha256-pmQXafqpd5rTwBIYG9NnwIIPta6Ek7iYaPaHvz1s550="; + }; + + patches = [ + ./wallabag-data.patch # exposes $WALLABAG_DATA + ]; + + dontBuild = true; + + installPhase = '' + runHook preInstall + + mkdir $out + cp -R * $out/ + + runHook postInstall + ''; + + meta = with lib; { + description = "wallabag is a self hostable application for saving web pages"; + longDescription = '' + wallabag is a self-hostable PHP application allowing you to not + miss any content anymore. Click, save and read it when you can. + It extracts content so that you can read it when you have time. + ''; + license = licenses.mit; + homepage = "http://wallabag.org"; + changelog = "https://github.com/wallabag/wallabag/releases/tag/${version}"; + maintainers = with maintainers; [ schneefux ]; + platforms = platforms.all; + }; +} -- 2.51.2 From c0ff69d9f80500b271cecf6a2a07315618da8aa5 Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Sat, 16 Mar 2024 00:31:57 -0700 Subject: [PATCH 03/78] rnix-lsp deprecated --- home/profiles/nvim/default.nix | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/home/profiles/nvim/default.nix b/home/profiles/nvim/default.nix index 79bee58..9400cdb 100644 --- a/home/profiles/nvim/default.nix +++ b/home/profiles/nvim/default.nix @@ -635,7 +635,7 @@ in } } - local servers = { 'clojure_lsp', 'terraform_lsp', 'zls', 'pyright', 'rust_analyzer', 'tsserver', 'lua_ls'} + local servers = { 'clojure_lsp', 'terraform_lsp', 'zls', 'pyright', 'rust_analyzer', 'tsserver', 'lua_ls', 'nil_ls'} for _, lsp in ipairs(servers) do lspconfig[lsp].setup { on_attach = function(client, bufnr) @@ -645,13 +645,7 @@ in capabilities = capabilities, } end - -- rnix doesn't support gps - lspconfig['rnix'].setup { - on_attach = function(client, bufnr) - format.on_attach(client) - end, - capabilities = capabilities, - } + -- fennel-ls doesn't support gps lspconfig['fennel-ls'].setup { on_attach = function(client, bufnr) @@ -865,7 +859,7 @@ in nodejs clojure-lsp clojure - rnix-lsp + nil terraform-lsp rust-analyzer clj-kondo -- 2.51.2 From a37a72e81f99d5819af55310795504843be80872 Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Sat, 16 Mar 2024 00:56:57 -0700 Subject: [PATCH 04/78] box: get gonic working again (needed headphones user) --- hosts/box/default.nix | 4 ++-- hosts/profiles/gonic/default.nix | 8 ++++++++ hosts/profiles/headphones/default.nix | 1 + 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/hosts/box/default.nix b/hosts/box/default.nix index dff159c..c677617 100644 --- a/hosts/box/default.nix +++ b/hosts/box/default.nix @@ -10,9 +10,9 @@ # ../profiles/monitoring ../profiles/nfs ../profiles/gonic - ../profiles/headphones + # ../profiles/headphones # TODO broken on 23.11, see: https://github.com/rembo10/headphones/issues/3320 ../profiles/radicale - ../profiles/seafile + # ../profiles/seafile # waiting for https://github.com/NixOS/nixpkgs/pull/249523 to be merged ../profiles/syncthing ../profiles/dhyan ../profiles/calibre diff --git a/hosts/profiles/gonic/default.nix b/hosts/profiles/gonic/default.nix index 06dec60..df8cabb 100644 --- a/hosts/profiles/gonic/default.nix +++ b/hosts/profiles/gonic/default.nix @@ -9,4 +9,12 @@ mossnet.gonic.user = "headphones"; mossnet.gonic.group = "audio"; networking.firewall.allowedTCPPorts = [ 4747 ]; + + users.users.gonic = { + uid = config.ids.uids.headphones; + # isSystemUser = true; + group = "audio"; + home = "/var/lib/headphones"; + createHome = true; + }; } diff --git a/hosts/profiles/headphones/default.nix b/hosts/profiles/headphones/default.nix index 7af396d..8f23bf3 100644 --- a/hosts/profiles/headphones/default.nix +++ b/hosts/profiles/headphones/default.nix @@ -4,6 +4,7 @@ enable = true; host = "0.0.0.0"; port = 8181; + package = "${pkgs.unstable.headphones}"; user = "headphones"; group = "audio"; dataDir = "/data/music"; -- 2.51.2 From 0dc5e1ee48bc238a1e36f334a592ba84c8ae0800 Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Sun, 17 Mar 2024 00:00:13 -0700 Subject: [PATCH 05/78] updating website --- flake.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/flake.lock b/flake.lock index c7f94d1..b0d92f4 100644 --- a/flake.lock +++ b/flake.lock @@ -487,11 +487,11 @@ ] }, "locked": { - "lastModified": 1709935213, - "narHash": "sha256-EJRb0U0yfSW8Y8SoaZZdfLu5cb/oLO93VD1lkWvvx8s=", + "lastModified": 1710655249, + "narHash": "sha256-gLpruYu9rtj+qCXnbsuGsHYSe/8Ow3CnVWL5lNKuLmE=", "ref": "main", - "rev": "0b15712b3e23509d2b1317d51f19c3e791acc938", - "revCount": 1377, + "rev": "cc378237d5bcf555c40e6c6f418290d013b23673", + "revCount": 1379, "type": "git", "url": "ssh://gitea@git.sealight.xyz/aynish/kitaab" }, -- 2.51.2 From 3869c6e6953e2f011c6f3b61276029fbd9517eb7 Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Mon, 18 Mar 2024 00:00:13 -0700 Subject: [PATCH 06/78] updating website --- flake.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/flake.lock b/flake.lock index b0d92f4..0c8209a 100644 --- a/flake.lock +++ b/flake.lock @@ -487,11 +487,11 @@ ] }, "locked": { - "lastModified": 1710655249, - "narHash": "sha256-gLpruYu9rtj+qCXnbsuGsHYSe/8Ow3CnVWL5lNKuLmE=", + "lastModified": 1710662449, + "narHash": "sha256-xuPAMOUru8eXig2Z32VxgURkdvHCMEBlLhIoKc+vneU=", "ref": "main", - "rev": "cc378237d5bcf555c40e6c6f418290d013b23673", - "revCount": 1379, + "rev": "f5621c7954428457184067960e5d9b5988451ed6", + "revCount": 1381, "type": "git", "url": "ssh://gitea@git.sealight.xyz/aynish/kitaab" }, -- 2.51.2 From 3d7dd18d6fddfe053e4e52e063fb02ffcdc4b97c Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Wed, 20 Mar 2024 00:00:12 -0700 Subject: [PATCH 07/78] updating website --- flake.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/flake.lock b/flake.lock index 0c8209a..1217d95 100644 --- a/flake.lock +++ b/flake.lock @@ -487,11 +487,11 @@ ] }, "locked": { - "lastModified": 1710662449, - "narHash": "sha256-xuPAMOUru8eXig2Z32VxgURkdvHCMEBlLhIoKc+vneU=", + "lastModified": 1710914433, + "narHash": "sha256-IxZow4XihBIJ4P16Ltilq0gr0BsR5RJ0rn+29VRJsGI=", "ref": "main", - "rev": "f5621c7954428457184067960e5d9b5988451ed6", - "revCount": 1381, + "rev": "8fb9f2a6d09bbb1fc6bce93c2f435aca00a09df5", + "revCount": 1384, "type": "git", "url": "ssh://gitea@git.sealight.xyz/aynish/kitaab" }, -- 2.51.2 From 66020d2921a184ce5ee10fe3f9c1116d85e401bb Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Thu, 21 Mar 2024 00:00:11 -0700 Subject: [PATCH 08/78] updating website --- flake.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/flake.lock b/flake.lock index 1217d95..9324c28 100644 --- a/flake.lock +++ b/flake.lock @@ -487,11 +487,11 @@ ] }, "locked": { - "lastModified": 1710914433, - "narHash": "sha256-IxZow4XihBIJ4P16Ltilq0gr0BsR5RJ0rn+29VRJsGI=", + "lastModified": 1710997233, + "narHash": "sha256-C17+1EKI5xa+iDQ/gjkbX00CCv/fhHg89A6pD53j7cQ=", "ref": "main", - "rev": "8fb9f2a6d09bbb1fc6bce93c2f435aca00a09df5", - "revCount": 1384, + "rev": "8ed1d95b1ab93ec981a4cea719ddad2dbf432537", + "revCount": 1385, "type": "git", "url": "ssh://gitea@git.sealight.xyz/aynish/kitaab" }, -- 2.51.2 From 7d8015774f05a8a76658918b1b560922ecde608d Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Fri, 22 Mar 2024 00:00:10 -0700 Subject: [PATCH 09/78] updating website --- flake.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/flake.lock b/flake.lock index 9324c28..a261ac6 100644 --- a/flake.lock +++ b/flake.lock @@ -487,11 +487,11 @@ ] }, "locked": { - "lastModified": 1710997233, - "narHash": "sha256-C17+1EKI5xa+iDQ/gjkbX00CCv/fhHg89A6pD53j7cQ=", + "lastModified": 1711076433, + "narHash": "sha256-v9Hs/ja6dyYf1cSoaY2Im6pgx6CPQKKka/rIvpj5f58=", "ref": "main", - "rev": "8ed1d95b1ab93ec981a4cea719ddad2dbf432537", - "revCount": 1385, + "rev": "16b5cead41eac246ce2806d8db3e7d17ee0a00a7", + "revCount": 1386, "type": "git", "url": "ssh://gitea@git.sealight.xyz/aynish/kitaab" }, -- 2.51.2 From 9971be030383cb59fdc3efdbf9b677f074625c8d Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Sun, 24 Mar 2024 00:00:10 -0700 Subject: [PATCH 10/78] updating website --- flake.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/flake.lock b/flake.lock index a261ac6..004e071 100644 --- a/flake.lock +++ b/flake.lock @@ -487,11 +487,11 @@ ] }, "locked": { - "lastModified": 1711076433, - "narHash": "sha256-v9Hs/ja6dyYf1cSoaY2Im6pgx6CPQKKka/rIvpj5f58=", + "lastModified": 1711220433, + "narHash": "sha256-A9WG/HiI8AfBS7fRD5RTEYJjnQArgCkkaJb2zRExClo=", "ref": "main", - "rev": "16b5cead41eac246ce2806d8db3e7d17ee0a00a7", - "revCount": 1386, + "rev": "88d281b593e68f86c8c3033c836ba57c5582afdd", + "revCount": 1388, "type": "git", "url": "ssh://gitea@git.sealight.xyz/aynish/kitaab" }, -- 2.51.2 From 5a71e1534b1030a0ef85fcf9de821a374c640d60 Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Thu, 28 Mar 2024 00:00:08 -0700 Subject: [PATCH 11/78] updating website --- flake.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/flake.lock b/flake.lock index 004e071..45159b6 100644 --- a/flake.lock +++ b/flake.lock @@ -487,11 +487,11 @@ ] }, "locked": { - "lastModified": 1711220433, - "narHash": "sha256-A9WG/HiI8AfBS7fRD5RTEYJjnQArgCkkaJb2zRExClo=", + "lastModified": 1711486833, + "narHash": "sha256-9jSmFJxOcLGaIRuUMRynnbw0+DiZfiY8x52aewa2tBU=", "ref": "main", - "rev": "88d281b593e68f86c8c3033c836ba57c5582afdd", - "revCount": 1388, + "rev": "df26110b64766d17cfbe416303b73477c2cb7d7a", + "revCount": 1389, "type": "git", "url": "ssh://gitea@git.sealight.xyz/aynish/kitaab" }, -- 2.51.2 From 0844b4792ff127f8bd1399d0080ebfa1372ba9ab Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Fri, 29 Mar 2024 00:00:08 -0700 Subject: [PATCH 12/78] updating website --- flake.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/flake.lock b/flake.lock index 45159b6..9c58075 100644 --- a/flake.lock +++ b/flake.lock @@ -487,11 +487,11 @@ ] }, "locked": { - "lastModified": 1711486833, - "narHash": "sha256-9jSmFJxOcLGaIRuUMRynnbw0+DiZfiY8x52aewa2tBU=", + "lastModified": 1711659633, + "narHash": "sha256-94xqit0c08FEItcXUREfhWVcinJv4b0RpUttwenYc38=", "ref": "main", - "rev": "df26110b64766d17cfbe416303b73477c2cb7d7a", - "revCount": 1389, + "rev": "02f7945c38dd57cc31040bdbd8b49c2a1901669d", + "revCount": 1390, "type": "git", "url": "ssh://gitea@git.sealight.xyz/aynish/kitaab" }, -- 2.51.2 From 7193bcfd63ec91ba126d93d67b6c488551273bd7 Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Sun, 31 Mar 2024 00:00:13 -0700 Subject: [PATCH 13/78] updating website --- flake.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/flake.lock b/flake.lock index 9c58075..4a4030d 100644 --- a/flake.lock +++ b/flake.lock @@ -487,11 +487,11 @@ ] }, "locked": { - "lastModified": 1711659633, - "narHash": "sha256-94xqit0c08FEItcXUREfhWVcinJv4b0RpUttwenYc38=", + "lastModified": 1711846833, + "narHash": "sha256-RG3QGXALQ1mtYVf3DlTCvaUM90teST/61eJ0WDEH+ak=", "ref": "main", - "rev": "02f7945c38dd57cc31040bdbd8b49c2a1901669d", - "revCount": 1390, + "rev": "b9e74fb7b5a9f4ac655d0872e1125e0f9e247888", + "revCount": 1394, "type": "git", "url": "ssh://gitea@git.sealight.xyz/aynish/kitaab" }, -- 2.51.2 From 010bbcd4698573dfd2299a232d128b6934890827 Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Wed, 3 Apr 2024 00:00:11 -0700 Subject: [PATCH 14/78] updating website --- flake.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/flake.lock b/flake.lock index 4a4030d..f4c338d 100644 --- a/flake.lock +++ b/flake.lock @@ -487,11 +487,11 @@ ] }, "locked": { - "lastModified": 1711846833, - "narHash": "sha256-RG3QGXALQ1mtYVf3DlTCvaUM90teST/61eJ0WDEH+ak=", + "lastModified": 1712124033, + "narHash": "sha256-/MGu+C1Vj+s32vyl4VuP9oFv1mb+S0PIYfNQ1hGkcZY=", "ref": "main", - "rev": "b9e74fb7b5a9f4ac655d0872e1125e0f9e247888", - "revCount": 1394, + "rev": "4c7f795f17df1524c7a7e0023d17a42b0f3ba48a", + "revCount": 1396, "type": "git", "url": "ssh://gitea@git.sealight.xyz/aynish/kitaab" }, -- 2.51.2 From fb330f5d0425a2a8027869ce6d04e3b8bdb3eb5e Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Fri, 5 Apr 2024 00:00:11 -0700 Subject: [PATCH 15/78] updating website --- flake.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/flake.lock b/flake.lock index f4c338d..f8613ae 100644 --- a/flake.lock +++ b/flake.lock @@ -487,11 +487,11 @@ ] }, "locked": { - "lastModified": 1712124033, - "narHash": "sha256-/MGu+C1Vj+s32vyl4VuP9oFv1mb+S0PIYfNQ1hGkcZY=", + "lastModified": 1712296833, + "narHash": "sha256-IoBdT3RcdAC9Ui78Bo9X9aSMcb6qdKepAl+JElLdP9w=", "ref": "main", - "rev": "4c7f795f17df1524c7a7e0023d17a42b0f3ba48a", - "revCount": 1396, + "rev": "172615a1e77967cca3e852fec2717b7a73536cc3", + "revCount": 1397, "type": "git", "url": "ssh://gitea@git.sealight.xyz/aynish/kitaab" }, -- 2.51.2 From f9cecaa969004ad2756eacc62909b85cdda00401 Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Sat, 6 Apr 2024 00:00:10 -0700 Subject: [PATCH 16/78] updating website --- flake.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/flake.lock b/flake.lock index f8613ae..c460e7f 100644 --- a/flake.lock +++ b/flake.lock @@ -487,11 +487,11 @@ ] }, "locked": { - "lastModified": 1712296833, - "narHash": "sha256-IoBdT3RcdAC9Ui78Bo9X9aSMcb6qdKepAl+JElLdP9w=", + "lastModified": 1712383233, + "narHash": "sha256-nUhkMzBsUiynOvj/LlAFnXUG4CXGSD14gNDG2Mbf1lM=", "ref": "main", - "rev": "172615a1e77967cca3e852fec2717b7a73536cc3", - "revCount": 1397, + "rev": "202a5c5832f0cea81ae1abfce2e378d534dd1d99", + "revCount": 1398, "type": "git", "url": "ssh://gitea@git.sealight.xyz/aynish/kitaab" }, -- 2.51.2 From cd97312394ad19eabb5e7b4c8fe067ba0e8c12d9 Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Sun, 7 Apr 2024 00:00:10 -0700 Subject: [PATCH 17/78] updating website --- flake.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/flake.lock b/flake.lock index c460e7f..d1ce0ac 100644 --- a/flake.lock +++ b/flake.lock @@ -487,11 +487,11 @@ ] }, "locked": { - "lastModified": 1712383233, - "narHash": "sha256-nUhkMzBsUiynOvj/LlAFnXUG4CXGSD14gNDG2Mbf1lM=", + "lastModified": 1712440833, + "narHash": "sha256-mhlb3KjkfRPiuBdTbIlzdzBcttaFM53Ct2Op8nsucY0=", "ref": "main", - "rev": "202a5c5832f0cea81ae1abfce2e378d534dd1d99", - "revCount": 1398, + "rev": "71a418c0218f87ccf38c7615f28b9e7dc0a8ec2f", + "revCount": 1401, "type": "git", "url": "ssh://gitea@git.sealight.xyz/aynish/kitaab" }, -- 2.51.2 From 42a152a9e5621e55304bd685adb869c76046e856 Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Mon, 8 Apr 2024 00:00:10 -0700 Subject: [PATCH 18/78] updating website --- flake.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/flake.lock b/flake.lock index d1ce0ac..eebaac2 100644 --- a/flake.lock +++ b/flake.lock @@ -487,11 +487,11 @@ ] }, "locked": { - "lastModified": 1712440833, - "narHash": "sha256-mhlb3KjkfRPiuBdTbIlzdzBcttaFM53Ct2Op8nsucY0=", + "lastModified": 1712556034, + "narHash": "sha256-UdOt5xhHBHg0GrDd/L8l+CopF/b8Es1W3tEMECq2XSE=", "ref": "main", - "rev": "71a418c0218f87ccf38c7615f28b9e7dc0a8ec2f", - "revCount": 1401, + "rev": "a971cb2ebc6eca06b9dc0445007f9777da136937", + "revCount": 1402, "type": "git", "url": "ssh://gitea@git.sealight.xyz/aynish/kitaab" }, -- 2.51.2 From 690889d3c11ecd2d8624bcb7f2830bd9b71a0a88 Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Tue, 9 Apr 2024 00:00:08 -0700 Subject: [PATCH 19/78] updating website --- flake.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/flake.lock b/flake.lock index eebaac2..345d699 100644 --- a/flake.lock +++ b/flake.lock @@ -487,11 +487,11 @@ ] }, "locked": { - "lastModified": 1712556034, - "narHash": "sha256-UdOt5xhHBHg0GrDd/L8l+CopF/b8Es1W3tEMECq2XSE=", + "lastModified": 1712631633, + "narHash": "sha256-drYLOvPY9qPpgKE4BKiWrVGmi5Vj8S1qI8J2cX4FGxQ=", "ref": "main", - "rev": "a971cb2ebc6eca06b9dc0445007f9777da136937", - "revCount": 1402, + "rev": "81f7c547026f1b2ca8634c5277edaacc9fc32dcc", + "revCount": 1403, "type": "git", "url": "ssh://gitea@git.sealight.xyz/aynish/kitaab" }, -- 2.51.2 From b0bca103db41cb20024d044974e76708d7dfbed3 Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Fri, 12 Apr 2024 00:00:10 -0700 Subject: [PATCH 20/78] updating website --- flake.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/flake.lock b/flake.lock index 345d699..b770aad 100644 --- a/flake.lock +++ b/flake.lock @@ -487,11 +487,11 @@ ] }, "locked": { - "lastModified": 1712631633, - "narHash": "sha256-drYLOvPY9qPpgKE4BKiWrVGmi5Vj8S1qI8J2cX4FGxQ=", + "lastModified": 1712815233, + "narHash": "sha256-LIYU/nU4Rx+UztChk01ts6TWPPy+1efmSZ4GPwU2x/E=", "ref": "main", - "rev": "81f7c547026f1b2ca8634c5277edaacc9fc32dcc", - "revCount": 1403, + "rev": "6eb8b8489d10bf181a19109fd4b74ac365c18622", + "revCount": 1405, "type": "git", "url": "ssh://gitea@git.sealight.xyz/aynish/kitaab" }, -- 2.51.2 From 46b8aab58b3e6b576496b5f4882ad94412938653 Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Tue, 16 Apr 2024 00:00:14 -0700 Subject: [PATCH 21/78] updating website --- flake.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/flake.lock b/flake.lock index b770aad..6f8c337 100644 --- a/flake.lock +++ b/flake.lock @@ -487,11 +487,11 @@ ] }, "locked": { - "lastModified": 1712815233, - "narHash": "sha256-LIYU/nU4Rx+UztChk01ts6TWPPy+1efmSZ4GPwU2x/E=", + "lastModified": 1712988033, + "narHash": "sha256-iuPR50NBQzR6OU0GzlZDeiZV8cSnSzkR4PSORfdisWA=", "ref": "main", - "rev": "6eb8b8489d10bf181a19109fd4b74ac365c18622", - "revCount": 1405, + "rev": "29bfd98b14f2d2cceba6407a5988424e3c267c2b", + "revCount": 1407, "type": "git", "url": "ssh://gitea@git.sealight.xyz/aynish/kitaab" }, -- 2.51.2 From 1883020f838e622e43895e93e37fa9fcee8ac6e3 Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Sun, 28 Apr 2024 00:00:09 -0700 Subject: [PATCH 22/78] updating website --- flake.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/flake.lock b/flake.lock index 6f8c337..2a31361 100644 --- a/flake.lock +++ b/flake.lock @@ -487,11 +487,11 @@ ] }, "locked": { - "lastModified": 1712988033, - "narHash": "sha256-iuPR50NBQzR6OU0GzlZDeiZV8cSnSzkR4PSORfdisWA=", + "lastModified": 1714183253, + "narHash": "sha256-zHz2sSOgbsikI3YTbGdlP9r3LCwp5wVKwJOlCVBZOrU=", "ref": "main", - "rev": "29bfd98b14f2d2cceba6407a5988424e3c267c2b", - "revCount": 1407, + "rev": "539dfce2a214140f97f3a05a47bd736991e39e3e", + "revCount": 1409, "type": "git", "url": "ssh://gitea@git.sealight.xyz/aynish/kitaab" }, -- 2.51.2 From 92648e1b0924a1a2e3c673a0faed0aa9edd7eab4 Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Wed, 1 May 2024 00:00:13 -0700 Subject: [PATCH 23/78] updating website --- flake.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/flake.lock b/flake.lock index 2a31361..0d854f0 100644 --- a/flake.lock +++ b/flake.lock @@ -487,11 +487,11 @@ ] }, "locked": { - "lastModified": 1714183253, - "narHash": "sha256-zHz2sSOgbsikI3YTbGdlP9r3LCwp5wVKwJOlCVBZOrU=", + "lastModified": 1714410053, + "narHash": "sha256-CzWPYsacY7ZJVT2dVVsMDheauO3ItY5SuCzqeybxctM=", "ref": "main", - "rev": "539dfce2a214140f97f3a05a47bd736991e39e3e", - "revCount": 1409, + "rev": "b37749378dda23d816b1600af527aabf36224dad", + "revCount": 1410, "type": "git", "url": "ssh://gitea@git.sealight.xyz/aynish/kitaab" }, -- 2.51.2 From f89f7d290ae5ae78a405ce6244f5387a3ef2e461 Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Wed, 8 May 2024 00:00:09 -0700 Subject: [PATCH 24/78] updating website --- flake.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/flake.lock b/flake.lock index 0d854f0..d13b01f 100644 --- a/flake.lock +++ b/flake.lock @@ -487,11 +487,11 @@ ] }, "locked": { - "lastModified": 1714410053, - "narHash": "sha256-CzWPYsacY7ZJVT2dVVsMDheauO3ItY5SuCzqeybxctM=", + "lastModified": 1714975253, + "narHash": "sha256-+rvTZSC1KSBwGVQziSIBHQe4Cd8XH+XUgPv14mnqby8=", "ref": "main", - "rev": "b37749378dda23d816b1600af527aabf36224dad", - "revCount": 1410, + "rev": "13dd654fd7a061d9b5764c4cb339c829bb4896b9", + "revCount": 1419, "type": "git", "url": "ssh://gitea@git.sealight.xyz/aynish/kitaab" }, -- 2.51.2 From 51d41e19d03ae7c2a50987e8a2304d2ffca80e9b Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Fri, 17 May 2024 00:00:09 -0700 Subject: [PATCH 25/78] updating website --- flake.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/flake.lock b/flake.lock index d13b01f..d73d845 100644 --- a/flake.lock +++ b/flake.lock @@ -487,11 +487,11 @@ ] }, "locked": { - "lastModified": 1714975253, - "narHash": "sha256-+rvTZSC1KSBwGVQziSIBHQe4Cd8XH+XUgPv14mnqby8=", + "lastModified": 1715745634, + "narHash": "sha256-EOzHQuA+7pheBQlHZ/M7UL7lZNBATYBNqS53wDLoFB4=", "ref": "main", - "rev": "13dd654fd7a061d9b5764c4cb339c829bb4896b9", - "revCount": 1419, + "rev": "1dc420092f8dda38d9befa9e5366d870cfc27ba4", + "revCount": 1420, "type": "git", "url": "ssh://gitea@git.sealight.xyz/aynish/kitaab" }, -- 2.51.2 From 091b653c9a1284017018ce41ef536ac349e1626c Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Tue, 21 May 2024 20:39:19 -0700 Subject: [PATCH 26/78] feat: ghost --- hosts/profiles/ghost/default.nix | 18 ++++ modules/nixos/ghost.nix | 148 +++++++++++++++++++++++++++++++ pkgs/ghost/builder.sh | 9 ++ pkgs/ghost/default.nix | 11 +++ 4 files changed, 186 insertions(+) create mode 100644 hosts/profiles/ghost/default.nix create mode 100644 modules/nixos/ghost.nix create mode 100644 pkgs/ghost/builder.sh create mode 100644 pkgs/ghost/default.nix diff --git a/hosts/profiles/ghost/default.nix b/hosts/profiles/ghost/default.nix new file mode 100644 index 0000000..6ea900c --- /dev/null +++ b/hosts/profiles/ghost/default.nix @@ -0,0 +1,18 @@ +{pkgs, ... }: +{ + services.nginx = { + enable = true; + recommendedGzipSettings = true; + recommendedOptimisation = true; + recommendedProxySettings = true; + recommendedTlsSettings = true; + }; + + # Enables MySQL + services.mysql = { + enable = true; + package = pkgs.mariadb; + }; + + services."write.sealight.xyz".enable = true; +} diff --git a/modules/nixos/ghost.nix b/modules/nixos/ghost.nix new file mode 100644 index 0000000..f4fed91 --- /dev/null +++ b/modules/nixos/ghost.nix @@ -0,0 +1,148 @@ +{ options, lib, config, pkgs, ... }: +let + # domain for the Ghost blog + serverName = "write.sealight.xyz"; + # port on which the Ghost service runs + port = 1357; + # user used to run the Ghost service + userName = builtins.replaceStrings [ "." ] [ "_" ] serverName; + # MySQL database used by Ghost + dbName = userName; + # MySQL user used by Ghost + dbUser = userName; + # directory used to save the blog content + dataDir = "/var/lib/${userName}"; + # Ghost package we created in the section above + ghost = import ./ghost { inherit pkgs; }; + # script that sets up the Ghost content directory + setupScript = pkgs.writeScript "${serverName}-setup.sh" '' + #! ${pkgs.stdenv.shell} -e + chmod g+s "${dataDir}" + [[ ! -d "${dataDir}/content" ]] && cp -r "${ghost}/content" "${dataDir}/content" + chown -R "${userName}":"${userName}" "${dataDir}/content" + chmod -R +w "${dataDir}/content" + ln -f -s "/etc/${serverName}.json" "${dataDir}/config.production.json" + [[ -d "${dataDir}/current" ]] && rm "${dataDir}/current" + ln -f -s "${ghost}/current" "${dataDir}/current" + [[ -d "${dataDir}/content/themes/casper" ]] && rm "${dataDir}/content/themes/casper" + ln -f -s "${ghost}/current/content/themes/casper" "${dataDir}/content/themes/casper" + ''; + + databaseService = "mysql.service"; + + serviceConfig = config.services."${serverName}"; + options = { enable = lib.mkEnableOption "${serverName} service"; }; +in { + options.services.${serverName} = options; + config = lib.mkIf serviceConfig.enable { + # Creates the user and group + users.users.${userName} = { + isSystemUser = true; + group = userName; + createHome = true; + home = dataDir; + }; + users.groups.${userName} = { }; + + # Creates the Ghost config + environment.etc."${serverName}.json".text = '' + { + "url": "https://${serverName}", + "server": { + "port": ${port}, + "host": "0.0.0.0" + }, + "database": { + "client": "mysql", + "connection": { + "host": "localhost", + "user": "${dbUser}", + "database": "${dbName}", + "password": "", + "socketPath": "/run/mysqld/mysqld.sock" + } + }, + "mail": { + "transport": "sendmail" + }, + "logging": { + "transports": ["stdout"] + }, + "paths": { + "contentPath": "${dataDir}/content" + } + } + ''; + + # Sets up the Systemd service + systemd.services."${serverName}" = { + enable = true; + description = "${serverName} ghost blog"; + restartIfChanged = true; + restartTriggers = + [ ghost config.environment.etc."${serverName}.json".source ]; + requires = [ databaseService ]; + after = [ databaseService ]; + path = [ pkgs.nodejs pkgs.vips ]; + wantedBy = [ "multi-user.target" ]; + serviceConfig = { + User = userName; + Group = userName; + WorkingDirectory = dataDir; + # Executes the setup script before start + ExecStartPre = setupScript; + # Runs Ghost with node + ExecStart = "${pkgs.nodejs}/bin/node current/index.js"; + # Sandboxes the Systemd service + AmbientCapabilities = [ ]; + CapabilityBoundingSet = [ ]; + KeyringMode = "private"; + LockPersonality = true; + NoNewPrivileges = true; + PrivateDevices = true; + PrivateMounts = true; + PrivateTmp = true; + ProtectClock = true; + ProtectControlGroups = true; + ProtectHome = true; + ProtectHostname = true; + ProtectKernelLogs = true; + ProtectKernelModules = true; + ProtectKernelTunables = true; + ProtectSystem = "full"; + RemoveIPC = true; + RestrictAddressFamilies = [ ]; + RestrictNamespaces = true; + RestrictRealtime = true; + }; + environment = { NODE_ENV = "production"; }; + }; + + # Sets up the blog virtual host on NGINX + services.nginx.virtualHosts.${serverName} = { + # Sets up Lets Encrypt SSL certificates for the blog + forceSSL = true; + enableACME = true; + locations."/" = { proxyPass = "http://127.0.0.1:${toString port}"; }; + extraConfig = '' + charset UTF-8; + + add_header Strict-Transport-Security "max-age=2592000; includeSubDomains" always; + add_header Referrer-Policy "strict-origin-when-cross-origin"; + add_header X-Frame-Options "SAMEORIGIN"; + add_header X-XSS-Protection "1; mode=block"; + add_header X-Content-Type-Options nosniff; + ''; + }; + + # Sets up MySQL database and user for Ghost + services.mysql = { + ensureDatabases = [ dbName ]; + ensureUsers = [{ + name = dbUser; + ensurePermissions = { "${dbName}.*" = "ALL PRIVILEGES"; }; + }]; + }; + }; +} + diff --git a/pkgs/ghost/builder.sh b/pkgs/ghost/builder.sh new file mode 100644 index 0000000..e30d101 --- /dev/null +++ b/pkgs/ghost/builder.sh @@ -0,0 +1,9 @@ +source "$stdenv"/setup + +export HOME=$(mktemp -d) +npm install --loglevel=info --logs-max=0 "ghost-cli@$ghostCliVersion" + +mkdir --parents "$out"/ +node_modules/ghost-cli/bin/ghost install "$version" --db=sqlite3 \ + --no-enable --no-prompt --no-stack --no-setup --no-start --dir "$out" + diff --git a/pkgs/ghost/default.nix b/pkgs/ghost/default.nix new file mode 100644 index 0000000..52ac793 --- /dev/null +++ b/pkgs/ghost/default.nix @@ -0,0 +1,11 @@ +{ pkgs }: + +let + pname = "ghost"; + version = "5.8.0"; +in pkgs.stdenv.mkDerivation { + inherit pname version; + buildInputs = with pkgs; [ nodejs yarn vips ]; + ghostCliVersion = "1.21.1"; + builder = ./builder.sh; +} -- 2.51.2 From ab98af5e83ed29de552bd7ead31483716ba262da Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Tue, 21 May 2024 20:49:24 -0700 Subject: [PATCH 27/78] update flake lock --- flake.lock | 332 ++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 316 insertions(+), 16 deletions(-) diff --git a/flake.lock b/flake.lock index c7f94d1..12759ee 100644 --- a/flake.lock +++ b/flake.lock @@ -143,6 +143,29 @@ "type": "github" } }, + "dream2nix": { + "inputs": { + "nixpkgs": [ + "ngipkgs", + "nixpkgs" + ], + "purescript-overlay": "purescript-overlay", + "pyproject-nix": "pyproject-nix" + }, + "locked": { + "lastModified": 1714329124, + "narHash": "sha256-WD0cmUjWc691xABl6Oc8MH7tdCdE9s34GjFgwZWEqLM=", + "owner": "nix-community", + "repo": "dream2nix", + "rev": "9e457e1fbdc5f3224cf6875b42205a71313a722d", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "dream2nix", + "type": "github" + } + }, "eww": { "inputs": { "flake-compat": "flake-compat_2", @@ -200,6 +223,22 @@ } }, "flake-compat_3": { + "flake": false, + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-compat_4": { "flake": false, "locked": { "lastModified": 1641205782, @@ -265,14 +304,17 @@ }, "flake-utils_4": { "inputs": { - "systems": "systems_3" + "systems": [ + "ngipkgs", + "systems" + ] }, "locked": { - "lastModified": 1681202837, - "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", "owner": "numtide", "repo": "flake-utils", - "rev": "cfacdce06f30d2b68473a46042957675eebb3401", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", "type": "github" }, "original": { @@ -281,6 +323,46 @@ "type": "github" } }, + "flake-utils_5": { + "inputs": { + "systems": "systems_4" + }, + "locked": { + "lastModified": 1705309234, + "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "ngipkgs", + "pre-commit-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, "grasp": { "inputs": { "flake-utils": "flake-utils_2", @@ -381,12 +463,38 @@ "type": "github" } }, + "ngipkgs": { + "inputs": { + "dream2nix": "dream2nix", + "flake-utils": "flake-utils_4", + "nixpkgs": "nixpkgs", + "nixpkgs-stable": "nixpkgs-stable", + "pre-commit-hooks": "pre-commit-hooks", + "rust-overlay": "rust-overlay", + "sops-nix": "sops-nix", + "systems": "systems_3" + }, + "locked": { + "lastModified": 1715912428, + "narHash": "sha256-LjCcGL7hTCu84mJwB9X1oS0tQ/IdBDpd8NvVJxSRrI0=", + "owner": "Chickensoupwithrice", + "repo": "ngipkgs", + "rev": "86b3c17c35f1d23e3c82245ce79ceed262dcba9f", + "type": "github" + }, + "original": { + "owner": "Chickensoupwithrice", + "ref": "aynish/atomic-server-module", + "repo": "ngipkgs", + "type": "github" + } + }, "nix-matrix-appservices": { "inputs": { "devshell": "devshell", - "flake-compat": "flake-compat_3", + "flake-compat": "flake-compat_4", "nixlib": "nixlib", - "nixpkgs": "nixpkgs" + "nixpkgs": "nixpkgs_2" }, "locked": { "lastModified": 1683490239, @@ -434,6 +542,38 @@ } }, "nixpkgs": { + "locked": { + "lastModified": 1714245158, + "narHash": "sha256-9P2M0+tf1TE7Z5PwDVwhheuD2mFf6/phPr0Jvl7cxcc=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "2b1f64b358f2cab62617f26b3870fd0ee375d848", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1714272655, + "narHash": "sha256-3/ghIWCve93ngkx5eNPdHIKJP/pMzSr5Wc4rNKE1wOc=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "12430e43bd9b81a6b4e79e64f87c624ade701eaf", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-23.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { "locked": { "lastModified": 1662099760, "narHash": "sha256-MdZLCTJPeHi/9fg6R9fiunyDwP3XHJqDd51zWWz9px0=", @@ -449,7 +589,7 @@ "type": "github" } }, - "nixpkgs_2": { + "nixpkgs_3": { "locked": { "lastModified": 1710420202, "narHash": "sha256-MvFKESbq4rUWuaf2RKPNYENaSZEw/jaCLo2gU6oREcM=", @@ -501,6 +641,77 @@ "url": "ssh://gitea@git.sealight.xyz/aynish/kitaab" } }, + "pre-commit-hooks": { + "inputs": { + "flake-compat": "flake-compat_3", + "flake-utils": [ + "ngipkgs", + "flake-utils" + ], + "gitignore": "gitignore", + "nixpkgs": [ + "ngipkgs", + "nixpkgs" + ], + "nixpkgs-stable": [ + "ngipkgs", + "nixpkgs-stable" + ] + }, + "locked": { + "lastModified": 1713954846, + "narHash": "sha256-RWFafuSb5nkWGu8dDbW7gVb8FOQOPqmX/9MlxUUDguw=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "6fb82e44254d6a0ece014ec423cb62d92435336f", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, + "purescript-overlay": { + "inputs": { + "nixpkgs": [ + "ngipkgs", + "dream2nix", + "nixpkgs" + ], + "slimlock": "slimlock" + }, + "locked": { + "lastModified": 1696022621, + "narHash": "sha256-eMjFmsj2G1E0Q5XiibUNgFjTiSz0GxIeSSzzVdoN730=", + "owner": "thomashoneyman", + "repo": "purescript-overlay", + "rev": "047c7933abd6da8aa239904422e22d190ce55ead", + "type": "github" + }, + "original": { + "owner": "thomashoneyman", + "repo": "purescript-overlay", + "type": "github" + } + }, + "pyproject-nix": { + "flake": false, + "locked": { + "lastModified": 1702448246, + "narHash": "sha256-hFg5s/hoJFv7tDpiGvEvXP0UfFvFEDgTdyHIjDVHu1I=", + "owner": "davhau", + "repo": "pyproject.nix", + "rev": "5a06a2697b228c04dd2f35659b4b659ca74f7aeb", + "type": "github" + }, + "original": { + "owner": "davhau", + "ref": "dream2nix", + "repo": "pyproject.nix", + "type": "github" + } + }, "root": { "inputs": { "agenix": "agenix", @@ -512,12 +723,13 @@ "hardware": "hardware", "home-manager": "home-manager_2", "llamacpp": "llamacpp", + "ngipkgs": "ngipkgs", "nix-matrix-appservices": "nix-matrix-appservices", "nixos-hardware": "nixos-hardware", - "nixpkgs": "nixpkgs_2", + "nixpkgs": "nixpkgs_3", "nur": "nur", "poonam": "poonam", - "rust-overlay": "rust-overlay", + "rust-overlay": "rust-overlay_2", "tidalcycles": "tidalcycles", "unstable": "unstable", "vimwikicli": "vimwikicli" @@ -525,17 +737,21 @@ }, "rust-overlay": { "inputs": { - "flake-utils": "flake-utils_4", + "flake-utils": [ + "ngipkgs", + "flake-utils" + ], "nixpkgs": [ + "ngipkgs", "nixpkgs" ] }, "locked": { - "lastModified": 1691201768, - "narHash": "sha256-h+QJMpawZoK1+8efF6UjQoY1EHZfHteXVa5OYnlqRWA=", + "lastModified": 1714270637, + "narHash": "sha256-sq/0YEupY9yoRpg9ft8r2sjoRo84MQipionTuk4w1YI=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "18ee2a71de24273e4ad4503b5604532f0b53f382", + "rev": "44f8738f4b9805f7c60118c48f85da835839311a", "type": "github" }, "original": { @@ -544,6 +760,75 @@ "type": "github" } }, + "rust-overlay_2": { + "inputs": { + "flake-utils": "flake-utils_5", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1715912155, + "narHash": "sha256-UXHk4dKvvm5mSuDDON3lXU5CHKiTRnIjA5mUtDOtKEU=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "d3a96b08a7280a5753246129b462eed3662815d5", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, + "slimlock": { + "inputs": { + "nixpkgs": [ + "ngipkgs", + "dream2nix", + "purescript-overlay", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1688610262, + "narHash": "sha256-Wg0ViDotFWGWqKIQzyYCgayeH8s4U1OZcTiWTQYdAp4=", + "owner": "thomashoneyman", + "repo": "slimlock", + "rev": "b5c6cdcaf636ebbebd0a1f32520929394493f1a6", + "type": "github" + }, + "original": { + "owner": "thomashoneyman", + "repo": "slimlock", + "type": "github" + } + }, + "sops-nix": { + "inputs": { + "nixpkgs": [ + "ngipkgs", + "nixpkgs" + ], + "nixpkgs-stable": [ + "ngipkgs", + "nixpkgs-stable" + ] + }, + "locked": { + "lastModified": 1713892811, + "narHash": "sha256-uIGmA2xq41vVFETCF1WW4fFWFT2tqBln+aXnWrvjGRE=", + "owner": "Mic92", + "repo": "sops-nix", + "rev": "f1b0adc27265274e3b0c9b872a8f476a098679bd", + "type": "github" + }, + "original": { + "owner": "Mic92", + "repo": "sops-nix", + "type": "github" + } + }, "superdirt-src": { "flake": false, "locked": { @@ -592,6 +877,21 @@ } }, "systems_3": { + "locked": { + "lastModified": 1689347949, + "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", + "owner": "nix-systems", + "repo": "default-linux", + "rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default-linux", + "type": "github" + } + }, + "systems_4": { "locked": { "lastModified": 1681028828, "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", @@ -651,11 +951,11 @@ }, "unstable": { "locked": { - "lastModified": 1704194953, - "narHash": "sha256-RtDKd8Mynhe5CFnVT8s0/0yqtWFMM9LmCzXv/YKxnq4=", + "lastModified": 1712163089, + "narHash": "sha256-Um+8kTIrC19vD4/lUCN9/cU9kcOsD1O1m+axJqQPyMM=", "owner": "nixos", "repo": "nixpkgs", - "rev": "bd645e8668ec6612439a9ee7e71f7eac4099d4f6", + "rev": "fd281bd6b7d3e32ddfa399853946f782553163b5", "type": "github" }, "original": { -- 2.51.2 From 7e5bd0cc2b5257bb9d0eab60681ba8c0e1ac4917 Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Sun, 26 May 2024 00:00:07 -0700 Subject: [PATCH 28/78] updating website --- flake.lock | 314 ++--------------------------------------------------- 1 file changed, 7 insertions(+), 307 deletions(-) diff --git a/flake.lock b/flake.lock index 2df7d92..ec7ec4f 100644 --- a/flake.lock +++ b/flake.lock @@ -143,29 +143,6 @@ "type": "github" } }, - "dream2nix": { - "inputs": { - "nixpkgs": [ - "ngipkgs", - "nixpkgs" - ], - "purescript-overlay": "purescript-overlay", - "pyproject-nix": "pyproject-nix" - }, - "locked": { - "lastModified": 1714329124, - "narHash": "sha256-WD0cmUjWc691xABl6Oc8MH7tdCdE9s34GjFgwZWEqLM=", - "owner": "nix-community", - "repo": "dream2nix", - "rev": "9e457e1fbdc5f3224cf6875b42205a71313a722d", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "dream2nix", - "type": "github" - } - }, "eww": { "inputs": { "flake-compat": "flake-compat_2", @@ -223,22 +200,6 @@ } }, "flake-compat_3": { - "flake": false, - "locked": { - "lastModified": 1696426674, - "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", - "owner": "edolstra", - "repo": "flake-compat", - "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", - "type": "github" - }, - "original": { - "owner": "edolstra", - "repo": "flake-compat", - "type": "github" - } - }, - "flake-compat_4": { "flake": false, "locked": { "lastModified": 1641205782, @@ -304,28 +265,7 @@ }, "flake-utils_4": { "inputs": { - "systems": [ - "ngipkgs", - "systems" - ] - }, - "locked": { - "lastModified": 1710146030, - "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "flake-utils_5": { - "inputs": { - "systems": "systems_4" + "systems": "systems_3" }, "locked": { "lastModified": 1705309234, @@ -341,28 +281,6 @@ "type": "github" } }, - "gitignore": { - "inputs": { - "nixpkgs": [ - "ngipkgs", - "pre-commit-hooks", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1709087332, - "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", - "owner": "hercules-ci", - "repo": "gitignore.nix", - "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", - "type": "github" - }, - "original": { - "owner": "hercules-ci", - "repo": "gitignore.nix", - "type": "github" - } - }, "grasp": { "inputs": { "flake-utils": "flake-utils_2", @@ -463,38 +381,12 @@ "type": "github" } }, - "ngipkgs": { - "inputs": { - "dream2nix": "dream2nix", - "flake-utils": "flake-utils_4", - "nixpkgs": "nixpkgs", - "nixpkgs-stable": "nixpkgs-stable", - "pre-commit-hooks": "pre-commit-hooks", - "rust-overlay": "rust-overlay", - "sops-nix": "sops-nix", - "systems": "systems_3" - }, - "locked": { - "lastModified": 1715912428, - "narHash": "sha256-LjCcGL7hTCu84mJwB9X1oS0tQ/IdBDpd8NvVJxSRrI0=", - "owner": "Chickensoupwithrice", - "repo": "ngipkgs", - "rev": "86b3c17c35f1d23e3c82245ce79ceed262dcba9f", - "type": "github" - }, - "original": { - "owner": "Chickensoupwithrice", - "ref": "aynish/atomic-server-module", - "repo": "ngipkgs", - "type": "github" - } - }, "nix-matrix-appservices": { "inputs": { "devshell": "devshell", - "flake-compat": "flake-compat_4", + "flake-compat": "flake-compat_3", "nixlib": "nixlib", - "nixpkgs": "nixpkgs_2" + "nixpkgs": "nixpkgs" }, "locked": { "lastModified": 1683490239, @@ -542,38 +434,6 @@ } }, "nixpkgs": { - "locked": { - "lastModified": 1714245158, - "narHash": "sha256-9P2M0+tf1TE7Z5PwDVwhheuD2mFf6/phPr0Jvl7cxcc=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "2b1f64b358f2cab62617f26b3870fd0ee375d848", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs-stable": { - "locked": { - "lastModified": 1714272655, - "narHash": "sha256-3/ghIWCve93ngkx5eNPdHIKJP/pMzSr5Wc4rNKE1wOc=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "12430e43bd9b81a6b4e79e64f87c624ade701eaf", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-23.11", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_2": { "locked": { "lastModified": 1662099760, "narHash": "sha256-MdZLCTJPeHi/9fg6R9fiunyDwP3XHJqDd51zWWz9px0=", @@ -589,7 +449,7 @@ "type": "github" } }, - "nixpkgs_3": { + "nixpkgs_2": { "locked": { "lastModified": 1710420202, "narHash": "sha256-MvFKESbq4rUWuaf2RKPNYENaSZEw/jaCLo2gU6oREcM=", @@ -641,77 +501,6 @@ "url": "ssh://gitea@git.sealight.xyz/aynish/kitaab" } }, - "pre-commit-hooks": { - "inputs": { - "flake-compat": "flake-compat_3", - "flake-utils": [ - "ngipkgs", - "flake-utils" - ], - "gitignore": "gitignore", - "nixpkgs": [ - "ngipkgs", - "nixpkgs" - ], - "nixpkgs-stable": [ - "ngipkgs", - "nixpkgs-stable" - ] - }, - "locked": { - "lastModified": 1713954846, - "narHash": "sha256-RWFafuSb5nkWGu8dDbW7gVb8FOQOPqmX/9MlxUUDguw=", - "owner": "cachix", - "repo": "pre-commit-hooks.nix", - "rev": "6fb82e44254d6a0ece014ec423cb62d92435336f", - "type": "github" - }, - "original": { - "owner": "cachix", - "repo": "pre-commit-hooks.nix", - "type": "github" - } - }, - "purescript-overlay": { - "inputs": { - "nixpkgs": [ - "ngipkgs", - "dream2nix", - "nixpkgs" - ], - "slimlock": "slimlock" - }, - "locked": { - "lastModified": 1696022621, - "narHash": "sha256-eMjFmsj2G1E0Q5XiibUNgFjTiSz0GxIeSSzzVdoN730=", - "owner": "thomashoneyman", - "repo": "purescript-overlay", - "rev": "047c7933abd6da8aa239904422e22d190ce55ead", - "type": "github" - }, - "original": { - "owner": "thomashoneyman", - "repo": "purescript-overlay", - "type": "github" - } - }, - "pyproject-nix": { - "flake": false, - "locked": { - "lastModified": 1702448246, - "narHash": "sha256-hFg5s/hoJFv7tDpiGvEvXP0UfFvFEDgTdyHIjDVHu1I=", - "owner": "davhau", - "repo": "pyproject.nix", - "rev": "5a06a2697b228c04dd2f35659b4b659ca74f7aeb", - "type": "github" - }, - "original": { - "owner": "davhau", - "ref": "dream2nix", - "repo": "pyproject.nix", - "type": "github" - } - }, "root": { "inputs": { "agenix": "agenix", @@ -723,13 +512,12 @@ "hardware": "hardware", "home-manager": "home-manager_2", "llamacpp": "llamacpp", - "ngipkgs": "ngipkgs", "nix-matrix-appservices": "nix-matrix-appservices", "nixos-hardware": "nixos-hardware", - "nixpkgs": "nixpkgs_3", + "nixpkgs": "nixpkgs_2", "nur": "nur", "poonam": "poonam", - "rust-overlay": "rust-overlay_2", + "rust-overlay": "rust-overlay", "tidalcycles": "tidalcycles", "unstable": "unstable", "vimwikicli": "vimwikicli" @@ -737,32 +525,7 @@ }, "rust-overlay": { "inputs": { - "flake-utils": [ - "ngipkgs", - "flake-utils" - ], - "nixpkgs": [ - "ngipkgs", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1714270637, - "narHash": "sha256-sq/0YEupY9yoRpg9ft8r2sjoRo84MQipionTuk4w1YI=", - "owner": "oxalica", - "repo": "rust-overlay", - "rev": "44f8738f4b9805f7c60118c48f85da835839311a", - "type": "github" - }, - "original": { - "owner": "oxalica", - "repo": "rust-overlay", - "type": "github" - } - }, - "rust-overlay_2": { - "inputs": { - "flake-utils": "flake-utils_5", + "flake-utils": "flake-utils_4", "nixpkgs": [ "nixpkgs" ] @@ -781,54 +544,6 @@ "type": "github" } }, - "slimlock": { - "inputs": { - "nixpkgs": [ - "ngipkgs", - "dream2nix", - "purescript-overlay", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1688610262, - "narHash": "sha256-Wg0ViDotFWGWqKIQzyYCgayeH8s4U1OZcTiWTQYdAp4=", - "owner": "thomashoneyman", - "repo": "slimlock", - "rev": "b5c6cdcaf636ebbebd0a1f32520929394493f1a6", - "type": "github" - }, - "original": { - "owner": "thomashoneyman", - "repo": "slimlock", - "type": "github" - } - }, - "sops-nix": { - "inputs": { - "nixpkgs": [ - "ngipkgs", - "nixpkgs" - ], - "nixpkgs-stable": [ - "ngipkgs", - "nixpkgs-stable" - ] - }, - "locked": { - "lastModified": 1713892811, - "narHash": "sha256-uIGmA2xq41vVFETCF1WW4fFWFT2tqBln+aXnWrvjGRE=", - "owner": "Mic92", - "repo": "sops-nix", - "rev": "f1b0adc27265274e3b0c9b872a8f476a098679bd", - "type": "github" - }, - "original": { - "owner": "Mic92", - "repo": "sops-nix", - "type": "github" - } - }, "superdirt-src": { "flake": false, "locked": { @@ -877,21 +592,6 @@ } }, "systems_3": { - "locked": { - "lastModified": 1689347949, - "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", - "owner": "nix-systems", - "repo": "default-linux", - "rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default-linux", - "type": "github" - } - }, - "systems_4": { "locked": { "lastModified": 1681028828, "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", -- 2.51.2 From 8f452ad9950735d6ea18e762b1b4a198358fd424 Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Tue, 4 Jun 2024 00:00:12 -0700 Subject: [PATCH 29/78] updating website --- flake.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/flake.lock b/flake.lock index ec7ec4f..b8ac30e 100644 --- a/flake.lock +++ b/flake.lock @@ -487,11 +487,11 @@ ] }, "locked": { - "lastModified": 1715745634, - "narHash": "sha256-EOzHQuA+7pheBQlHZ/M7UL7lZNBATYBNqS53wDLoFB4=", + "lastModified": 1716631235, + "narHash": "sha256-dqKpiRfE30BHdKNkudLCBK4ySPaja+tAROPJ81iiuL4=", "ref": "main", - "rev": "1dc420092f8dda38d9befa9e5366d870cfc27ba4", - "revCount": 1420, + "rev": "5ee63e9b51bd5aa73e9a7dcff72c93c4d1e4b37c", + "revCount": 1431, "type": "git", "url": "ssh://gitea@git.sealight.xyz/aynish/kitaab" }, -- 2.51.2 From 6522536dc80d823f42ccca6bcc834e9b82da4b8f Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Sun, 14 Jul 2024 16:43:57 -0700 Subject: [PATCH 30/78] dns: add write.sealight.xyz? --- .gitignore | 1 + dns/dnsconfig.js | 1 + hosts/profiles/blogg/default.nix | 18 ++++ modules/nixos/blogging.nix | 148 +++++++++++++++++++++++++++++++ pkgs/gpodder2go.nix | 14 +++ 5 files changed, 182 insertions(+) create mode 100644 .gitignore create mode 100644 hosts/profiles/blogg/default.nix create mode 100644 modules/nixos/blogging.nix create mode 100644 pkgs/gpodder2go.nix diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9b42106 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.direnv/ diff --git a/dns/dnsconfig.js b/dns/dnsconfig.js index a081943..6ce4159 100644 --- a/dns/dnsconfig.js +++ b/dns/dnsconfig.js @@ -39,6 +39,7 @@ D('sealight.xyz', REG_NONE, DnsProvider(DNS_HEDNS), A('git', '69.61.2.203', TTL(300)), A('bin', '69.61.2.203', TTL(300)), A('ci', '69.61.2.203', TTL(300)), + A('write', '69.61.2.203', TTL(300)), // vultr -> nulled: lituus A('@', '45.77.48.108', TTL(300)), A('jitsi', '45.77.48.108', TTL(300)), diff --git a/hosts/profiles/blogg/default.nix b/hosts/profiles/blogg/default.nix new file mode 100644 index 0000000..6ea900c --- /dev/null +++ b/hosts/profiles/blogg/default.nix @@ -0,0 +1,18 @@ +{pkgs, ... }: +{ + services.nginx = { + enable = true; + recommendedGzipSettings = true; + recommendedOptimisation = true; + recommendedProxySettings = true; + recommendedTlsSettings = true; + }; + + # Enables MySQL + services.mysql = { + enable = true; + package = pkgs.mariadb; + }; + + services."write.sealight.xyz".enable = true; +} diff --git a/modules/nixos/blogging.nix b/modules/nixos/blogging.nix new file mode 100644 index 0000000..f4fed91 --- /dev/null +++ b/modules/nixos/blogging.nix @@ -0,0 +1,148 @@ +{ options, lib, config, pkgs, ... }: +let + # domain for the Ghost blog + serverName = "write.sealight.xyz"; + # port on which the Ghost service runs + port = 1357; + # user used to run the Ghost service + userName = builtins.replaceStrings [ "." ] [ "_" ] serverName; + # MySQL database used by Ghost + dbName = userName; + # MySQL user used by Ghost + dbUser = userName; + # directory used to save the blog content + dataDir = "/var/lib/${userName}"; + # Ghost package we created in the section above + ghost = import ./ghost { inherit pkgs; }; + # script that sets up the Ghost content directory + setupScript = pkgs.writeScript "${serverName}-setup.sh" '' + #! ${pkgs.stdenv.shell} -e + chmod g+s "${dataDir}" + [[ ! -d "${dataDir}/content" ]] && cp -r "${ghost}/content" "${dataDir}/content" + chown -R "${userName}":"${userName}" "${dataDir}/content" + chmod -R +w "${dataDir}/content" + ln -f -s "/etc/${serverName}.json" "${dataDir}/config.production.json" + [[ -d "${dataDir}/current" ]] && rm "${dataDir}/current" + ln -f -s "${ghost}/current" "${dataDir}/current" + [[ -d "${dataDir}/content/themes/casper" ]] && rm "${dataDir}/content/themes/casper" + ln -f -s "${ghost}/current/content/themes/casper" "${dataDir}/content/themes/casper" + ''; + + databaseService = "mysql.service"; + + serviceConfig = config.services."${serverName}"; + options = { enable = lib.mkEnableOption "${serverName} service"; }; +in { + options.services.${serverName} = options; + config = lib.mkIf serviceConfig.enable { + # Creates the user and group + users.users.${userName} = { + isSystemUser = true; + group = userName; + createHome = true; + home = dataDir; + }; + users.groups.${userName} = { }; + + # Creates the Ghost config + environment.etc."${serverName}.json".text = '' + { + "url": "https://${serverName}", + "server": { + "port": ${port}, + "host": "0.0.0.0" + }, + "database": { + "client": "mysql", + "connection": { + "host": "localhost", + "user": "${dbUser}", + "database": "${dbName}", + "password": "", + "socketPath": "/run/mysqld/mysqld.sock" + } + }, + "mail": { + "transport": "sendmail" + }, + "logging": { + "transports": ["stdout"] + }, + "paths": { + "contentPath": "${dataDir}/content" + } + } + ''; + + # Sets up the Systemd service + systemd.services."${serverName}" = { + enable = true; + description = "${serverName} ghost blog"; + restartIfChanged = true; + restartTriggers = + [ ghost config.environment.etc."${serverName}.json".source ]; + requires = [ databaseService ]; + after = [ databaseService ]; + path = [ pkgs.nodejs pkgs.vips ]; + wantedBy = [ "multi-user.target" ]; + serviceConfig = { + User = userName; + Group = userName; + WorkingDirectory = dataDir; + # Executes the setup script before start + ExecStartPre = setupScript; + # Runs Ghost with node + ExecStart = "${pkgs.nodejs}/bin/node current/index.js"; + # Sandboxes the Systemd service + AmbientCapabilities = [ ]; + CapabilityBoundingSet = [ ]; + KeyringMode = "private"; + LockPersonality = true; + NoNewPrivileges = true; + PrivateDevices = true; + PrivateMounts = true; + PrivateTmp = true; + ProtectClock = true; + ProtectControlGroups = true; + ProtectHome = true; + ProtectHostname = true; + ProtectKernelLogs = true; + ProtectKernelModules = true; + ProtectKernelTunables = true; + ProtectSystem = "full"; + RemoveIPC = true; + RestrictAddressFamilies = [ ]; + RestrictNamespaces = true; + RestrictRealtime = true; + }; + environment = { NODE_ENV = "production"; }; + }; + + # Sets up the blog virtual host on NGINX + services.nginx.virtualHosts.${serverName} = { + # Sets up Lets Encrypt SSL certificates for the blog + forceSSL = true; + enableACME = true; + locations."/" = { proxyPass = "http://127.0.0.1:${toString port}"; }; + extraConfig = '' + charset UTF-8; + + add_header Strict-Transport-Security "max-age=2592000; includeSubDomains" always; + add_header Referrer-Policy "strict-origin-when-cross-origin"; + add_header X-Frame-Options "SAMEORIGIN"; + add_header X-XSS-Protection "1; mode=block"; + add_header X-Content-Type-Options nosniff; + ''; + }; + + # Sets up MySQL database and user for Ghost + services.mysql = { + ensureDatabases = [ dbName ]; + ensureUsers = [{ + name = dbUser; + ensurePermissions = { "${dbName}.*" = "ALL PRIVILEGES"; }; + }]; + }; + }; +} + diff --git a/pkgs/gpodder2go.nix b/pkgs/gpodder2go.nix new file mode 100644 index 0000000..f46e87f --- /dev/null +++ b/pkgs/gpodder2go.nix @@ -0,0 +1,14 @@ +{ pkgs, ... }: + +pkgs.buildGoModule rec { + name = "gpodder2go"; + src = pkgs.fetchFromGitHub { + owner = "oxtyped"; + repo = "gpodder2go"; + rev = "v0.1.2"; + hash = "sha256-RAt0rd4DZwI7b7IEFd1o4s4ivADzgzBzBaeGVL8OmYo"; + }; + + vendorHash = "sha256-mbSgY5WjIAesT27uRgaiRF3N06yuUntjTp6kjUMh6Bw"; + doCheck = false; +} -- 2.51.2 From d496c20a825a99394c5388ddc5abbe2f75ac3c74 Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Sun, 14 Jul 2024 16:44:39 -0700 Subject: [PATCH 31/78] fix: taskwarrior moved from home/cli to home/gui --- home/core/default.nix | 1 - home/gui/default.nix | 1 + home/profiles/task/default.nix | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/home/core/default.nix b/home/core/default.nix index 08abf68..f712f44 100644 --- a/home/core/default.nix +++ b/home/core/default.nix @@ -4,7 +4,6 @@ ../profiles/cli ../profiles/direnv ../profiles/git - ../profiles/task ]; home.stateVersion = "22.05"; } diff --git a/home/gui/default.nix b/home/gui/default.nix index bc975be..f085974 100644 --- a/home/gui/default.nix +++ b/home/gui/default.nix @@ -9,5 +9,6 @@ ../profiles/cal ../profiles/sync/kitaab ../profiles/ssh + ../profiles/task ]; } diff --git a/home/profiles/task/default.nix b/home/profiles/task/default.nix index f308278..5813cca 100644 --- a/home/profiles/task/default.nix +++ b/home/profiles/task/default.nix @@ -8,7 +8,7 @@ # taskwarrior needs write access to this file for centexts # this way, we get a copy of the file, and we make sure it's writable ".taskrc".source = ./taskrc; - ".taskrc".executable = true; + # ".taskrc".executable = true; # ".taskrc".onChange = "cp ~/.taskrc ~/.taskrc2;rm ~/.taskrc;mv ~/.taskrc2 ~/.taskrc;chmod +w ~/.taskrc"; ".task/keys/ca.cert".source = ./ca.cert; ".task/keys/public.cert".source = ./public.cert; -- 2.51.2 From 0b5a013fafd2369a6fc1f2c7ae73001f7cceb982 Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Sun, 14 Jul 2024 16:45:02 -0700 Subject: [PATCH 32/78] remove: ngipkgs from flake input --- flake.lock | 314 ++--------------------------------------------------- flake.nix | 7 ++ 2 files changed, 14 insertions(+), 307 deletions(-) diff --git a/flake.lock b/flake.lock index 2df7d92..ec7ec4f 100644 --- a/flake.lock +++ b/flake.lock @@ -143,29 +143,6 @@ "type": "github" } }, - "dream2nix": { - "inputs": { - "nixpkgs": [ - "ngipkgs", - "nixpkgs" - ], - "purescript-overlay": "purescript-overlay", - "pyproject-nix": "pyproject-nix" - }, - "locked": { - "lastModified": 1714329124, - "narHash": "sha256-WD0cmUjWc691xABl6Oc8MH7tdCdE9s34GjFgwZWEqLM=", - "owner": "nix-community", - "repo": "dream2nix", - "rev": "9e457e1fbdc5f3224cf6875b42205a71313a722d", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "dream2nix", - "type": "github" - } - }, "eww": { "inputs": { "flake-compat": "flake-compat_2", @@ -223,22 +200,6 @@ } }, "flake-compat_3": { - "flake": false, - "locked": { - "lastModified": 1696426674, - "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", - "owner": "edolstra", - "repo": "flake-compat", - "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", - "type": "github" - }, - "original": { - "owner": "edolstra", - "repo": "flake-compat", - "type": "github" - } - }, - "flake-compat_4": { "flake": false, "locked": { "lastModified": 1641205782, @@ -304,28 +265,7 @@ }, "flake-utils_4": { "inputs": { - "systems": [ - "ngipkgs", - "systems" - ] - }, - "locked": { - "lastModified": 1710146030, - "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "flake-utils_5": { - "inputs": { - "systems": "systems_4" + "systems": "systems_3" }, "locked": { "lastModified": 1705309234, @@ -341,28 +281,6 @@ "type": "github" } }, - "gitignore": { - "inputs": { - "nixpkgs": [ - "ngipkgs", - "pre-commit-hooks", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1709087332, - "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", - "owner": "hercules-ci", - "repo": "gitignore.nix", - "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", - "type": "github" - }, - "original": { - "owner": "hercules-ci", - "repo": "gitignore.nix", - "type": "github" - } - }, "grasp": { "inputs": { "flake-utils": "flake-utils_2", @@ -463,38 +381,12 @@ "type": "github" } }, - "ngipkgs": { - "inputs": { - "dream2nix": "dream2nix", - "flake-utils": "flake-utils_4", - "nixpkgs": "nixpkgs", - "nixpkgs-stable": "nixpkgs-stable", - "pre-commit-hooks": "pre-commit-hooks", - "rust-overlay": "rust-overlay", - "sops-nix": "sops-nix", - "systems": "systems_3" - }, - "locked": { - "lastModified": 1715912428, - "narHash": "sha256-LjCcGL7hTCu84mJwB9X1oS0tQ/IdBDpd8NvVJxSRrI0=", - "owner": "Chickensoupwithrice", - "repo": "ngipkgs", - "rev": "86b3c17c35f1d23e3c82245ce79ceed262dcba9f", - "type": "github" - }, - "original": { - "owner": "Chickensoupwithrice", - "ref": "aynish/atomic-server-module", - "repo": "ngipkgs", - "type": "github" - } - }, "nix-matrix-appservices": { "inputs": { "devshell": "devshell", - "flake-compat": "flake-compat_4", + "flake-compat": "flake-compat_3", "nixlib": "nixlib", - "nixpkgs": "nixpkgs_2" + "nixpkgs": "nixpkgs" }, "locked": { "lastModified": 1683490239, @@ -542,38 +434,6 @@ } }, "nixpkgs": { - "locked": { - "lastModified": 1714245158, - "narHash": "sha256-9P2M0+tf1TE7Z5PwDVwhheuD2mFf6/phPr0Jvl7cxcc=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "2b1f64b358f2cab62617f26b3870fd0ee375d848", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs-stable": { - "locked": { - "lastModified": 1714272655, - "narHash": "sha256-3/ghIWCve93ngkx5eNPdHIKJP/pMzSr5Wc4rNKE1wOc=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "12430e43bd9b81a6b4e79e64f87c624ade701eaf", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-23.11", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_2": { "locked": { "lastModified": 1662099760, "narHash": "sha256-MdZLCTJPeHi/9fg6R9fiunyDwP3XHJqDd51zWWz9px0=", @@ -589,7 +449,7 @@ "type": "github" } }, - "nixpkgs_3": { + "nixpkgs_2": { "locked": { "lastModified": 1710420202, "narHash": "sha256-MvFKESbq4rUWuaf2RKPNYENaSZEw/jaCLo2gU6oREcM=", @@ -641,77 +501,6 @@ "url": "ssh://gitea@git.sealight.xyz/aynish/kitaab" } }, - "pre-commit-hooks": { - "inputs": { - "flake-compat": "flake-compat_3", - "flake-utils": [ - "ngipkgs", - "flake-utils" - ], - "gitignore": "gitignore", - "nixpkgs": [ - "ngipkgs", - "nixpkgs" - ], - "nixpkgs-stable": [ - "ngipkgs", - "nixpkgs-stable" - ] - }, - "locked": { - "lastModified": 1713954846, - "narHash": "sha256-RWFafuSb5nkWGu8dDbW7gVb8FOQOPqmX/9MlxUUDguw=", - "owner": "cachix", - "repo": "pre-commit-hooks.nix", - "rev": "6fb82e44254d6a0ece014ec423cb62d92435336f", - "type": "github" - }, - "original": { - "owner": "cachix", - "repo": "pre-commit-hooks.nix", - "type": "github" - } - }, - "purescript-overlay": { - "inputs": { - "nixpkgs": [ - "ngipkgs", - "dream2nix", - "nixpkgs" - ], - "slimlock": "slimlock" - }, - "locked": { - "lastModified": 1696022621, - "narHash": "sha256-eMjFmsj2G1E0Q5XiibUNgFjTiSz0GxIeSSzzVdoN730=", - "owner": "thomashoneyman", - "repo": "purescript-overlay", - "rev": "047c7933abd6da8aa239904422e22d190ce55ead", - "type": "github" - }, - "original": { - "owner": "thomashoneyman", - "repo": "purescript-overlay", - "type": "github" - } - }, - "pyproject-nix": { - "flake": false, - "locked": { - "lastModified": 1702448246, - "narHash": "sha256-hFg5s/hoJFv7tDpiGvEvXP0UfFvFEDgTdyHIjDVHu1I=", - "owner": "davhau", - "repo": "pyproject.nix", - "rev": "5a06a2697b228c04dd2f35659b4b659ca74f7aeb", - "type": "github" - }, - "original": { - "owner": "davhau", - "ref": "dream2nix", - "repo": "pyproject.nix", - "type": "github" - } - }, "root": { "inputs": { "agenix": "agenix", @@ -723,13 +512,12 @@ "hardware": "hardware", "home-manager": "home-manager_2", "llamacpp": "llamacpp", - "ngipkgs": "ngipkgs", "nix-matrix-appservices": "nix-matrix-appservices", "nixos-hardware": "nixos-hardware", - "nixpkgs": "nixpkgs_3", + "nixpkgs": "nixpkgs_2", "nur": "nur", "poonam": "poonam", - "rust-overlay": "rust-overlay_2", + "rust-overlay": "rust-overlay", "tidalcycles": "tidalcycles", "unstable": "unstable", "vimwikicli": "vimwikicli" @@ -737,32 +525,7 @@ }, "rust-overlay": { "inputs": { - "flake-utils": [ - "ngipkgs", - "flake-utils" - ], - "nixpkgs": [ - "ngipkgs", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1714270637, - "narHash": "sha256-sq/0YEupY9yoRpg9ft8r2sjoRo84MQipionTuk4w1YI=", - "owner": "oxalica", - "repo": "rust-overlay", - "rev": "44f8738f4b9805f7c60118c48f85da835839311a", - "type": "github" - }, - "original": { - "owner": "oxalica", - "repo": "rust-overlay", - "type": "github" - } - }, - "rust-overlay_2": { - "inputs": { - "flake-utils": "flake-utils_5", + "flake-utils": "flake-utils_4", "nixpkgs": [ "nixpkgs" ] @@ -781,54 +544,6 @@ "type": "github" } }, - "slimlock": { - "inputs": { - "nixpkgs": [ - "ngipkgs", - "dream2nix", - "purescript-overlay", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1688610262, - "narHash": "sha256-Wg0ViDotFWGWqKIQzyYCgayeH8s4U1OZcTiWTQYdAp4=", - "owner": "thomashoneyman", - "repo": "slimlock", - "rev": "b5c6cdcaf636ebbebd0a1f32520929394493f1a6", - "type": "github" - }, - "original": { - "owner": "thomashoneyman", - "repo": "slimlock", - "type": "github" - } - }, - "sops-nix": { - "inputs": { - "nixpkgs": [ - "ngipkgs", - "nixpkgs" - ], - "nixpkgs-stable": [ - "ngipkgs", - "nixpkgs-stable" - ] - }, - "locked": { - "lastModified": 1713892811, - "narHash": "sha256-uIGmA2xq41vVFETCF1WW4fFWFT2tqBln+aXnWrvjGRE=", - "owner": "Mic92", - "repo": "sops-nix", - "rev": "f1b0adc27265274e3b0c9b872a8f476a098679bd", - "type": "github" - }, - "original": { - "owner": "Mic92", - "repo": "sops-nix", - "type": "github" - } - }, "superdirt-src": { "flake": false, "locked": { @@ -877,21 +592,6 @@ } }, "systems_3": { - "locked": { - "lastModified": 1689347949, - "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", - "owner": "nix-systems", - "repo": "default-linux", - "rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default-linux", - "type": "github" - } - }, - "systems_4": { "locked": { "lastModified": 1681028828, "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", diff --git a/flake.nix b/flake.nix index 06cd127..e74eeec 100644 --- a/flake.nix +++ b/flake.nix @@ -7,6 +7,9 @@ unstable.url = "github:nixos/nixpkgs/nixos-unstable"; nixos-hardware.url = "github:NixOS/nixos-hardware/master"; + # ngipkgs.url = "github:Chickensoupwithrice/ngipkgs?ref=aynish/atomic-server-module"; + # ngipkgs-local.url = "path:/home/anish/usr/ngipkgs"; + # Home manager home-manager.url = "github:nix-community/home-manager/release-23.11"; home-manager.inputs.nixpkgs.follows = "nixpkgs"; @@ -133,6 +136,8 @@ # ]; overlays = [ agenix.overlays.default + self.overlays.additions + self.overlays.modifications tidalcycles.overlays.default # needed for nvim which comes pre-installed lol ]; }); @@ -171,6 +176,7 @@ agenix.nixosModules.age self.nixosModules.backup self.nixosModules.wireguard + self.nixosModules.wallabag nixos-hardware.nixosModules.lenovo-thinkpad-x270 home-manager.nixosModules.home-manager { @@ -192,6 +198,7 @@ agenix.nixosModules.age self.nixosModules.backup self.nixosModules.wireguard + self.nixosModules.blogg # self.nixosModules.microbin disko.nixosModules.disko ]; -- 2.51.2 From 557706c7fd6a521e3ab6e96bd51740b9098712f0 Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Sun, 14 Jul 2024 16:51:38 -0700 Subject: [PATCH 33/78] website: move to helix --- dns/dnsconfig.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dns/dnsconfig.js b/dns/dnsconfig.js index 6ce4159..f711db3 100644 --- a/dns/dnsconfig.js +++ b/dns/dnsconfig.js @@ -8,8 +8,8 @@ D("lakhwara.com", REG_NONE, DnsProvider(DNS_HEDNS), DefaultTTL(86400), //SOA('@', 'ns1.he.net.', 'hostmaster.he.net.', 2022041702, 86400, 7200, 3600000, 86400, TTL(172800)), - A('anish', '103.16.130.98'), - A('coaching', '103.16.130.98'), + A('anish', '69.61.2.203'), + //A('coaching', '103.16.130.98'), TXT('anish', 'datkey=dat://1a240a14fab2bae9c85ebad29bddc04505aaba24e5fb809c2ccb4cdf71e3a7d5'), CNAME('fm1._domainkey', 'fm1.lakhwara.com.dkim.fmhosted.com.'), CNAME('fm2._domainkey', 'fm2.lakhwara.com.dkim.fmhosted.com.'), -- 2.51.2 From 7c96b1ff5bd2a67629ba3e2c523ce9db8f88234c Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Sun, 14 Jul 2024 16:52:11 -0700 Subject: [PATCH 34/78] website: move to helix --- flake.nix | 3 ++- hosts/helix/default.nix | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index e74eeec..2508b5d 100644 --- a/flake.nix +++ b/flake.nix @@ -198,7 +198,8 @@ agenix.nixosModules.age self.nixosModules.backup self.nixosModules.wireguard - self.nixosModules.blogg + # self.nixosModules.blogg + basant.nixosModule # self.nixosModules.microbin disko.nixosModules.disko ]; diff --git a/hosts/helix/default.nix b/hosts/helix/default.nix index 9ffeefa..246822e 100644 --- a/hosts/helix/default.nix +++ b/hosts/helix/default.nix @@ -11,6 +11,8 @@ # ../profiles/mount-mossnet ../profiles/freshrss ../profiles/microbin + ../profiles/site + # ../profiles/postgres_upgrade_script ]; -- 2.51.2 From 12862e0891dd267be6a9c6700506be2f033f7c16 Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Sun, 14 Jul 2024 18:48:24 -0700 Subject: [PATCH 35/78] dns: update lakhwara.com to point to helix --- dns/dnsconfig.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dns/dnsconfig.js b/dns/dnsconfig.js index f711db3..2d9ff1a 100644 --- a/dns/dnsconfig.js +++ b/dns/dnsconfig.js @@ -6,15 +6,15 @@ var DNS_HEDNS = NewDnsProvider('hedns'); D("lakhwara.com", REG_NONE, DnsProvider(DNS_HEDNS), - DefaultTTL(86400), + DefaultTTL(300), //SOA('@', 'ns1.he.net.', 'hostmaster.he.net.', 2022041702, 86400, 7200, 3600000, 86400, TTL(172800)), A('anish', '69.61.2.203'), + A('@', '69.61.2.203'), //A('coaching', '103.16.130.98'), TXT('anish', 'datkey=dat://1a240a14fab2bae9c85ebad29bddc04505aaba24e5fb809c2ccb4cdf71e3a7d5'), CNAME('fm1._domainkey', 'fm1.lakhwara.com.dkim.fmhosted.com.'), CNAME('fm2._domainkey', 'fm2.lakhwara.com.dkim.fmhosted.com.'), CNAME('fm3._domainkey', 'fm3.lakhwara.com.dkim.fmhosted.com.'), - A('@', '103.16.130.98'), MX('@', 10, 'in1-smtp.messagingengine.com.'), MX('@', 20, 'in2-smtp.messagingengine.com.'), //NAMESERVER('ns1.he.net.'), -- 2.51.2 From 07891dc81d64372011396e3ae37a1b78c3268236 Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Sun, 14 Jul 2024 18:48:44 -0700 Subject: [PATCH 36/78] remove sublime-music --- hosts/profiles/desktop/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hosts/profiles/desktop/default.nix b/hosts/profiles/desktop/default.nix index 9dfc06d..956601a 100644 --- a/hosts/profiles/desktop/default.nix +++ b/hosts/profiles/desktop/default.nix @@ -62,7 +62,7 @@ in }; environment.systemPackages = with pkgs; [ - unstable.sublime-music + #unstable.sublime-music unstable.nheko unstable.signal-desktop unstable.tuba -- 2.51.2 From c5acd82638083c1dfc9463ba2b75cda24e65bcfc Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Sun, 14 Jul 2024 19:41:36 -0700 Subject: [PATCH 37/78] updating website --- flake.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/flake.lock b/flake.lock index b8ac30e..a9fcf71 100644 --- a/flake.lock +++ b/flake.lock @@ -487,11 +487,11 @@ ] }, "locked": { - "lastModified": 1716631235, - "narHash": "sha256-dqKpiRfE30BHdKNkudLCBK4ySPaja+tAROPJ81iiuL4=", + "lastModified": 1721008827, + "narHash": "sha256-EwXAswswx4ykc5QVt1g05UzGmrXJH7ZZyPCF9LabcXA=", "ref": "main", - "rev": "5ee63e9b51bd5aa73e9a7dcff72c93c4d1e4b37c", - "revCount": 1431, + "rev": "d2af22cb18ba74a4357f9959d32888f1a6e15cd1", + "revCount": 1437, "type": "git", "url": "ssh://gitea@git.sealight.xyz/aynish/kitaab" }, -- 2.51.2 From c1af9a9ca7646c403d565af5fee00c90125aa3cd Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Sun, 14 Jul 2024 20:20:49 -0700 Subject: [PATCH 38/78] fix(box): wallabag is working again!!! --- hosts/profiles/wallabag/default.nix | 80 +----- modules/nixos/default.nix | 1 + modules/nixos/wallabag.nix | 418 ++++++++++++++-------------- overlays/default.nix | 9 + pkgs/default.nix | 4 + pkgs/wallabag-data.patch | 51 +++- pkgs/wallabag.nix | 4 +- 7 files changed, 274 insertions(+), 293 deletions(-) diff --git a/hosts/profiles/wallabag/default.nix b/hosts/profiles/wallabag/default.nix index e2b3523..119c9b5 100644 --- a/hosts/profiles/wallabag/default.nix +++ b/hosts/profiles/wallabag/default.nix @@ -1,10 +1,10 @@ { self, pkgs, config, lib, ... }: { - # age.secrets.wallabag-password.file = "${self}/secrets/wallabag-password.age"; - # age.secrets.wallabag-secret.file = "${self}/secrets/wallabag-secret.age"; - # age.secrets.wallabag-password.owner = "wallabag"; - # age.secrets.wallabag-secret.owner = "wallabag"; + age.secrets.wallabag-password.file = "${self}/secrets/wallabag-password.age"; + age.secrets.wallabag-secret.file = "${self}/secrets/wallabag-secret.age"; + age.secrets.wallabag-password.owner = "wallabag"; + age.secrets.wallabag-secret.owner = "wallabag"; services.postgresql = { enable = true; package = pkgs.postgresql_15; @@ -18,74 +18,20 @@ } ]; authentication = '' - local wallabag all md5 + local wallabag all peer ''; }; services.wallabag = { enable = true; - hostName = "read.mossnet.lan"; + domain = "read.mossnet.lan"; + virtualHost.enable = true; package = pkgs.my-wallabag; - dataDir = "/var/lib/wallabag"; - conf = '' - # This file is a "template" of what your parameters.yml file should look like - parameters: - database_driver: pdo_pgsql - database_host: localhost - database_port: ~ - database_name: wallabag - database_user: wallabag - database_password: wallabag - # For SQLite, database_path should be "%kernel.project_dir%/data/db/wallabag.sqlite" - database_path: ~ - database_table_prefix: wallabag_ - database_socket: null - # with PostgreSQL and SQLite, you must set "utf8" - database_charset: utf8 - - domain_name: http://read.mossnet.lan - server_name: "mossnet wallabag instance" - - mailer_dsn: null:// - locale: en - - # A secret key that's used to generate certain security-related tokens - secret: SAFGOECRIlfal89oe6u0(*^dsaaih961 - - # two factor stuff - twofactor_auth: false - twofactor_sender: no-reply@wallabag.org - - # fosuser stuff - fosuser_registration: false - fosuser_confirmation: true - - # how long the access token should live in seconds for the API - fos_oauth_server_access_token_lifetime: 3600 - # how long the refresh token should life in seconds for the API - fos_oauth_server_refresh_token_lifetime: 1209600 - - from_email: ops@sealight.xyz - - rss_limit: 50 - - # RabbitMQ processing - rabbitmq_host: localhost - rabbitmq_port: 5672 - rabbitmq_user: guest - rabbitmq_password: guest - rabbitmq_prefetch_count: 10 - - # Redis processing - redis_scheme: tcp - redis_host: localhost - redis_port: 6379 - redis_path: null - redis_password: null - - # sentry logging - sentry_dsn: ~ - ''; + # Systemd now defaults to /var/lib? + # dataDir = "/var/lib/wallabag"; + parameters = { + "env(SECRET_FILE)" = config.age.secrets.wallabag-secret.path; + secret = "%env(file:resolve:SECRET_FILE)%"; + }; }; - # networking.firewall.allowedTCPPorts = [ 8080 ]; } diff --git a/modules/nixos/default.nix b/modules/nixos/default.nix index d4efdc5..38962ff 100644 --- a/modules/nixos/default.nix +++ b/modules/nixos/default.nix @@ -9,5 +9,6 @@ wireguard = import ./wireguard.nix; backup = import ./backup.nix; ulogger-server = import ./ulogger.nix; + blogg = import ./blogging.nix; # microbin = import ./microbin.nix; # includide in 23.11 } diff --git a/modules/nixos/wallabag.nix b/modules/nixos/wallabag.nix index 14bfe26..f2a1547 100644 --- a/modules/nixos/wallabag.nix +++ b/modules/nixos/wallabag.nix @@ -1,253 +1,245 @@ -{ config, options, lib, pkgs, ... }: - -with lib; +{ config, lib, pkgs, ... }: let - cfg = config.services.wallabag; - - poolName = "wallabag"; - - configFile = pkgs.writeTextFile { - name = "wallabag-config"; - text = cfg.conf; - destination = "/app/config/parameters.yml"; + # Based on https://github.com/wallabag/wallabag/blob/2.6.6/app/config/parameters.yml.dist + settings = { + database_driver = "${cfg.database_type}"; + database_host = null; + database_port = 5432; + database_name = "wallabag"; + database_user = "wallabag"; + database_password = null; + database_path = null; + database_table_prefix = "wallabag_"; + database_socket = "/run/postgresql"; + database_charset = "utf8"; + + domain_name = "http://${cfg.domain}"; + server_name = "Wallabag"; + + # Needs an explicit command since Symfony version used by Wallabag does not yet support the `native` transport + # and the `sendmail` transport does not respect `sendmail_path` configured in `php.ini`. + mailer_dsn = "sendmail://default?command=/run/wrappers/bin/sendmail%%20-t%%20-i"; + + locale = "en"; + + # A secret key that's used to generate certain security-related tokens. + # "env(SECRET_FILE)" = "/run/secrets/wallabag"; + # secret = "%env(file:resolve:SECRET_FILE)%"; + + # two factor stuff + twofactor_auth = false; + twofactor_sender = ""; + + # fosuser stuff + fosuser_registration = false; + fosuser_confirmation = false; + + # how long the access token should live in seconds for the API + fos_oauth_server_access_token_lifetime = 3600; + # how long the refresh token should life in seconds for the API + fos_oauth_server_refresh_token_lifetime = 1209600; + + from_email = "wallabag@read.mossnet.lan"; + + # RabbitMQ processing + redis_scheme = "unix"; + redis_host = ""; # Ignored for unix scheme + redis_port = 0; # Ignored for unix scheme + redis_path = config.services.redis.servers.wallabag.unixSocket; + redis_password = null; + + # Redis processing + rabbitmq_host = ""; + rabbitmq_port = 0; + rabbitmq_user = ""; + rabbitmq_password = ""; + rabbitmq_prefetch_count = 0; + + # sentry logging + sentry_dsn = null; + } // cfg.parameters; + + php = cfg.php.package.withExtensions ({ enabled, all }: enabled ++ (with all; [ + imagick + tidy + ])); + + commonServiceConfig = { + CacheDirectory = "wallabag"; + # Stores sessions. + CacheDirectoryMode = "700"; + ConfigurationDirectory = "wallabag"; + LogsDirectory = "wallabag"; + StateDirectory = "wallabag"; + # Stores site-credentials-secret-key.txt. + StateDirectoryMode = "700"; }; - appDir = pkgs.buildEnv { - name = "wallabag-app-dir"; - ignoreCollisions = true; - checkCollisionContents = false; - paths = [ configFile "${cfg.package}" ]; - pathsToLink = [ "/app" "/src" "/translations" ]; - }; + cfg = config.services.wallabag; +in { + options.services.wallabag = with lib; { + enable = mkEnableOption (mdDoc "Wallabag read-it-later service"); - # See there for available commands: - # https://doc.wallabag.org/en/admin/console_commands.html - # A user can be made admin with the fos:user:promote --super command - console = pkgs.writeShellScriptBin "wallabag-console" '' - export WALLABAG_DATA="${cfg.dataDir}" - cd "${cfg.dataDir}" - ${pkgs.php}/bin/php ${cfg.package}/bin/console --env=prod $@ - ''; + package = mkOption { + type = types.package; + default = pkgs.wallabag; + }; -in -{ + php.package = mkOption { + type = types.package; + default = pkgs.php; + }; - options = { + parameters = mkOption { + type = types.attrsOf types.str; + default = {}; + description = mdDoc "Parameters to override from the default. See for values."; + }; - services.wallabag = { - enable = mkEnableOption "wallabag"; + database_type = mkOption { + type = types.enum [ + "pdo_sqlite3" + "pdo_pgsql" + ]; + default = if config.services.postgresql.enable + then "pdo_pgsql" + else "pdo_sqlite3"; + defaultText = '' + if config.services.postgresql.enable + then "pdo_pgsql" + else "pdo_sqlite3" + ''; + description = mdDoc '' + The database engine name. Can be pdo_sqlite3 or pdo_pgsql. + ''; + }; - user = mkOption { - type = types.str; - default = "nginx"; - description = '' - User account under which both the update daemon and the web-application run. - ''; - }; + domain = mkOption { + type = types.str; + description = "Bare domain name for Wallabag"; + }; - dataDir = mkOption { - type = types.path; - default = "/var/lib/wallabag"; - description = '' - Data directory. - ''; - }; + virtualHost.enable = mkEnableOption (mdDoc "Define nginx virtualhost for Wallabag"); + }; - package = mkOption { - type = types.package; - default = pkgs.wallabag; - description = '' - Wallabag package to use. - ''; + config = lib.mkIf cfg.enable { + environment.etc."wallabag/parameters.yml" = { + source = pkgs.writeTextFile { + name = "wallabag-config"; + text = builtins.toJSON { + parameters = settings; + }; }; + }; - hostName = mkOption { - type = types.str; - description = '' - Name of the nginx virtualhost to use and setup. - ''; - }; + services.nginx = lib.mkIf cfg.virtualHost.enable { + enable = true; - poolConfig = mkOption { - type = types.lines; - default = '' - pm = dynamic - pm.max_children = 75 - pm.start_servers = 1 - pm.min_spare_servers = 1 - pm.max_spare_servers = 20 - pm.max_requests = 500 - catch_workers_output = 1 - ''; - description = '' - Options for wallabag's PHP pool. See the documentation on php-fpm.conf for details on configuration directives. - ''; - }; + virtualHosts = { + "${cfg.domain}" = { + root = "${pkgs.wallabag}/web"; - conf = mkOption { - type = types.str; - description = '' - Contents of the wallabag configuration file (parameters.yml) + extraConfig = '' + add_header X-Frame-Options SAMEORIGIN; + add_header X-Content-Type-Options nosniff; + add_header X-XSS-Protection "1; mode=block"; ''; + + locations."/" = { + extraConfig = '' + try_files $uri /app.php$is_args$args; + ''; + }; + + locations."/assets".root = "${pkgs.wallabag}/app/web"; + + locations."~ ^/app\\.php(/|$)" = { + extraConfig = '' + fastcgi_pass unix:${config.services.phpfpm.pools.wallabag.socket}; + include ${config.services.nginx.package}/conf/fastcgi.conf; + fastcgi_param PATH_INFO $fastcgi_path_info; + fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; + fastcgi_param SCRIPT_FILENAME ${pkgs.wallabag}/web/$fastcgi_script_name; + fastcgi_param DOCUMENT_ROOT ${pkgs.wallabag}/web; + fastcgi_read_timeout 120; + internal; + ''; + }; + + locations."~ /(?!app)\\.php$" = { + extraConfig = '' + return 404; + ''; + }; + }; }; }; - }; - - config = mkIf cfg.enable { - - services.phpfpm.pools."${poolName}" = { - user = "${cfg.user}"; - group = "nginx"; - phpPackage = pkgs.php; - phpEnv = { - WALLABAG_DATA = cfg.dataDir; - PATH = lib.makeBinPath [pkgs.php]; - }; + services.phpfpm.pools.wallabag = { + user = config.users.users.wallabag.name; + phpPackage = php; settings = { - "listen.owner" = "nginx"; - "listen.group" = "nginx"; - "listen.mode" = "0600"; - "user" = "${cfg.user}"; - "group" = "nginx"; + "catch_workers_output" = true; + + "listen.owner" = config.services.nginx.user; + "listen.group" = "root"; "pm" = "dynamic"; - "pm.max_children" = "75"; - "pm.min_spare_servers" = "5"; - "pm.max_spare_servers" = "20"; - "pm.max_requests" = "10"; - "catch_workers_output" = "1"; - "php_admin_value[error_log]" = "stderr"; + "pm.max_children" = 5; + "pm.start_servers" = 2; + "pm.min_spare_servers" = 1; + "pm.max_spare_servers" = 3; + "php_admin_value[error_log]" = "/var/log/wallabag/error.log"; + "php_admin_value[access_log]" = "/var/log/wallabag/access.log"; "php_admin_flag[log_errors]" = true; }; - }; - services.phpfpm.phpOptions = '' - max_execution_time = 120 + phpOptions = '' + ; Set up $_ENV superglobal. + ; http://php.net/request-order + variables_order = "EGPCS" + # Wallabag will crash on start-up. + # https://github.com/wallabag/wallabag/issues/6042 + # error_reporting = E_ALL & ~E_USER_DEPRECATED & ~E_DEPRECATED ''; - - services.nginx.enable = mkDefault true; - environment.systemPackages = [ console ]; - - # services.nginx.virtualHosts."${cfg.hostName}" = { - # forceSSL = false; - # enableACME = false; - # extraConfig = '' - # error_log /var/log/nginx/wallabag_error.log; - # access_log /var/log/nginx/wallabag_access.log; - # ''; - - # root = "${cfg.package}/web"; - # locations."/" = { - # priority = 10; - # tryFiles = "$uri /app.php$is_args$args"; - # }; - # locations."/assets".root = "${cfg.dataDir}/web"; - # locations."~ ^/app\\.php(/|$)" = { - # priority = 100; - # fastcgiParams = { - # SCRIPT_FILENAME = "$realpath_root$fastcgi_script_name"; - # DOCUMENT_ROOT = "$realpath_root"; - # }; - # extraConfig = '' - # fastcgi_pass unix:${config.services.phpfpm.pools."${poolName}".socket}; - # include ${config.services.nginx.package}/conf/fastcgi_params; - # include ${config.services.nginx.package}/conf/fastcgi.conf; - # internal; - # ''; - # }; - # locations."~ \\.php$" = { - # priority = 1000; - # return = "404"; - # }; - # }; - - - services.nginx.virtualHosts."${cfg.hostName}" = { - enableACME = false; - forceSSL = false; - root = "${cfg.package}/web"; - - # extraConfig = '' - # add_header X-Frame-Options SAMEORIGIN; - # add_header X-Content-Type-Options nosniff; - # add_header X-XSS-Protection "1; mode=block"; - # ''; - - locations."/" = { - tryFiles = "$uri /app.php$is_args$args"; - }; - - locations."/assets".root = "${cfg.dataDir}/web"; - - locations."~ ^/app\\.php(/|$)" = { - # fastcgiParams = { - # SCRIPT_FILENAME = "$realpath_root$fastcgi_script_name"; - # DOCUMENT_ROOT = "$realpath_root"; - # }; - extraConfig = '' - fastcgi_pass unix:${config.services.phpfpm.pools."${poolName}".socket}; - fastcgi_split_path_info ^(.+\.php)(/.*)$; - include ${pkgs.nginx}/conf/fastcgi_params; - fastcgi_param SCRIPT_FILENAME ${cfg.package}/web/$fastcgi_script_name; - fastcgi_param DOCUMENT_ROOT ${cfg.package}/web; - fastcgi_read_timeout 120; - internal; - ''; + settings = { + # Accept settings from the systemd service. + clear_env = false; }; + }; - locations."~ /(?!app)\\.php$" = { - extraConfig = '' - return 404; - ''; - }; + users.users.wallabag = { + isSystemUser = true; + group = "wallabag"; }; + users.groups.wallabag = {}; + services.redis.servers.wallabag = { + enable = true; + user = "wallabag"; + }; + services.rabbitmq.enable = false; + + systemd.services.phpfpm-wallabag.serviceConfig = commonServiceConfig; systemd.services.wallabag-install = { description = "Wallabag install service"; wantedBy = [ "multi-user.target" ]; before = [ "phpfpm-wallabag.service" ]; - after = [ "mysql.service" "postgresql.service" ]; + after = [ "postgresql.service" ]; path = with pkgs; [ coreutils php phpPackages.composer ]; serviceConfig = { - User = cfg.user; + User = "wallabag"; Type = "oneshot"; - RemainAfterExit = "yes"; - PermissionsStartOnly = true; - }; - - preStart = '' - mkdir -p "${cfg.dataDir}" - chown ${cfg.user}:nginx "${cfg.dataDir}" - ''; + } // commonServiceConfig; script = '' - echo "Setting up wallabag files in ${cfg.dataDir} ..." - cd "${cfg.dataDir}" - - rm -rf var/cache/* - rm -f app src translations - ln -sf ${appDir}/app app - ln -sf ${appDir}/src src - ln -sf ${appDir}/translations translations - ln -sf ${cfg.package}/composer.{json,lock} . - - export WALLABAG_DATA="${cfg.dataDir}" - if [ ! -f installed ]; then - echo "Install file not found, installing ..." - php ${cfg.package}/bin/console --env=prod doctrine:database:create --if-not-exists --no-interaction - php ${cfg.package}/bin/console --env=prod doctrine:migrations:migrate --no-interaction - # Until https://github.com/wallabag/wallabag/issues/3662 is fixed - # yes no | php ${cfg.package}/bin/console --env=prod wallabag:install - touch installed - else - php ${cfg.package}/bin/console --env=prod doctrine:migrations:migrate --no-interaction - fi - php ${cfg.package}/bin/console --env=prod cache:clear - ''; + if [ ! -f "$STATE_DIRECTORY/installed" ]; then + php ${pkgs.wallabag}/bin/console --env=prod wallabag:install + touch "$STATE_DIRECTORY/installed" + else + php ${pkgs.wallabag}/bin/console --env=prod doctrine:migrations:migrate --no-interaction + fi + php ${pkgs.wallabag}/bin/console --env=prod cache:clear + ''; }; }; - - meta = with stdenv.lib; { - maintainers = with maintainers; [ nadrieril ]; - }; } diff --git a/overlays/default.nix b/overlays/default.nix index 903ccd8..02df4d9 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -14,6 +14,15 @@ buildInputs = prevAttrs.propagatedBuildInputs ++ [ final.python3.pkgs.aiosqlite ]; # We're using sqlite and upstream doesn't package this dependency }); + wallabag = prev.wallabag.overrideAttrs (attrs: { + patches = builtins.filter (patch: builtins.baseNameOf patch != "wallabag-data.patch") attrs.patches ++ [ + # Out of the box, Wallabag wants to write to various subdirectories of the project directory. + # Let’s replace references to such paths with designated systemd locations + # so that the project source can remain immutable. + ../pkgs/wallabag-data.patch + ]; + }); + # Need to do server and agent too, maybe # woodpecker-cli-next = # let diff --git a/pkgs/default.nix b/pkgs/default.nix index 0d35317..8a5ef55 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -8,6 +8,10 @@ kobopatch = pkgs.callPackage ./kobopatch.nix { }; my-mautrix-discord = pkgs.callPackage ./mautrix-discord.nix { }; # Handled by matrix-appservices input ulogger-server = pkgs.callPackage ./ulogger.nix { }; + # Wallabag is now an overlay + # TODO: we still use the patch from this folder though my-wallabag = pkgs.callPackage ./wallabag.nix { }; mautrix-slack = pkgs.callPackage ./mautrix-slack.nix { }; + gpodder2go = pkgs.callPackage ./gpodder2go.nix { }; + ghost = pkgs.callPackage ./ghost { }; } diff --git a/pkgs/wallabag-data.patch b/pkgs/wallabag-data.patch index 4276af5..fd6f478 100644 --- a/pkgs/wallabag-data.patch +++ b/pkgs/wallabag-data.patch @@ -1,26 +1,55 @@ diff --git a/app/AppKernel.php b/app/AppKernel.php -index 61b734e06..d25d1aaa3 100644 +index 61b734e06..0902c20fc 100644 --- a/app/AppKernel.php +++ b/app/AppKernel.php -@@ -62,14 +62,19 @@ class AppKernel extends Kernel - return $bundles; - } +@@ -64,12 +64,12 @@ class AppKernel extends Kernel -+ public function getProjectDir() -+ { -+ return getenv('WALLABAG_DATA') ?: dirname(__DIR__); -+ } -+ public function getCacheDir() { - return dirname(__DIR__) . '/var/cache/' . $this->getEnvironment(); -+ return $this->getProjectDir() . '/var/cache/' . $this->getEnvironment(); ++ return getenv('CACHE_DIRECTORY') . '/' . $this->getEnvironment(); } public function getLogDir() { - return dirname(__DIR__) . '/var/logs'; -+ return $this->getProjectDir() . '/var/logs'; ++ return getenv('LOGS_DIRECTORY'); } public function registerContainerConfiguration(LoaderInterface $loader) +diff --git a/app/config/config.yml b/app/config/config.yml +index 7f0a4ca6c..77b5175c8 100644 +--- a/app/config/config.yml ++++ b/app/config/config.yml +@@ -1,5 +1,7 @@ + imports: +- - { resource: parameters.yml } ++ # Unfortunately, we cannot use %env(string:CONFIGURATION_DIRECTORY)%. Hardcoding the path for simplicity. ++ # https://symfony.com/doc/current/service_container/import.html#importing-configuration-with-imports ++ - { resource: '/etc/wallabag/parameters.yml' } + - { resource: security.yml } + - { resource: services.yml } + - { resource: wallabag.yml } +@@ -28,7 +30,7 @@ framework: + session: + # handler_id set to null will use default session handler from php.ini + handler_id: session.handler.native_file +- save_path: "%kernel.project_dir%/var/sessions/%kernel.environment%" ++ save_path: "%env(string:CACHE_DIRECTORY)%/sessions/%kernel.environment%" + cookie_secure: auto + fragments: ~ + http_method_override: true +diff --git a/app/config/wallabag.yml b/app/config/wallabag.yml +index bd57d6377..8e1cd0970 100644 +--- a/app/config/wallabag.yml ++++ b/app/config/wallabag.yml +@@ -35,7 +35,7 @@ wallabag_core: + fetching_error_message: | + wallabag can't retrieve contents for this article. Please troubleshoot this issue. + api_limit_mass_actions: 10 +- encryption_key_path: "%kernel.project_dir%/data/site-credentials-secret-key.txt" ++ encryption_key_path: "%env(string:STATE_DIRECTORY)%/site-credentials-secret-key.txt" + default_internal_settings: + - + name: share_public + diff --git a/pkgs/wallabag.nix b/pkgs/wallabag.nix index 7922920..8ba8799 100644 --- a/pkgs/wallabag.nix +++ b/pkgs/wallabag.nix @@ -15,7 +15,7 @@ let pname = "wallabag"; - version = "2.6.8"; + version = "2.6.9"; in stdenv.mkDerivation { inherit pname version; @@ -23,7 +23,7 @@ stdenv.mkDerivation { # Release tarball includes vendored files src = fetchurl { url = "https://github.com/wallabag/wallabag/releases/download/${version}/wallabag-${version}.tar.gz"; - hash = "sha256-pmQXafqpd5rTwBIYG9NnwIIPta6Ek7iYaPaHvz1s550="; + hash = "sha256-V4s5/y9fFAmZ+WnUxU03UyRivEihD1ZUKQOOq4TLEKw="; }; patches = [ -- 2.51.2 From 20a8684f60ec864656beeeb8e8898188374eda80 Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Sun, 14 Jul 2024 20:21:12 -0700 Subject: [PATCH 39/78] add git machete --- home/profiles/cli/default.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/home/profiles/cli/default.nix b/home/profiles/cli/default.nix index 6c1fcd1..7403e9f 100644 --- a/home/profiles/cli/default.nix +++ b/home/profiles/cli/default.nix @@ -7,6 +7,7 @@ dasht dosfstools #git + git-machete bottom gptfdisk starship -- 2.51.2 From ca6a9fdafbefce640939070095708bb345f46492 Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Sun, 14 Jul 2024 20:21:20 -0700 Subject: [PATCH 40/78] add gopls to nvim --- home/profiles/nvim/default.nix | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/home/profiles/nvim/default.nix b/home/profiles/nvim/default.nix index 9400cdb..a2597b1 100644 --- a/home/profiles/nvim/default.nix +++ b/home/profiles/nvim/default.nix @@ -635,7 +635,7 @@ in } } - local servers = { 'clojure_lsp', 'terraform_lsp', 'zls', 'pyright', 'rust_analyzer', 'tsserver', 'lua_ls', 'nil_ls'} + local servers = { 'clojure_lsp', 'terraform_lsp', 'zls', 'pyright', 'rust_analyzer', 'tsserver', 'lua_ls', 'nil_ls', 'gopls'} for _, lsp in ipairs(servers) do lspconfig[lsp].setup { on_attach = function(client, bufnr) @@ -864,6 +864,7 @@ in rust-analyzer clj-kondo zls + gopls gcc nodePackages_latest.pyright shellcheck -- 2.51.2 From c5ce7117846cc87a2db7fa8ad0bf8ecf5f18768d Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Sun, 14 Jul 2024 20:21:29 -0700 Subject: [PATCH 41/78] lituus: use unstable mautrix-signal --- hosts/profiles/matrix/mautrix-services.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hosts/profiles/matrix/mautrix-services.nix b/hosts/profiles/matrix/mautrix-services.nix index 0cfad4b..8c7eacc 100644 --- a/hosts/profiles/matrix/mautrix-services.nix +++ b/hosts/profiles/matrix/mautrix-services.nix @@ -34,7 +34,7 @@ signal = { port = 29184; format = "mautrix-python"; - package = pkgs.mautrix-signal; + package = pkgs.unstable.mautrix-signal; serviceConfig = { StateDirectory = [ "matrix-as-signal" "signald" ]; SupplementaryGroups = [ "signald" ]; -- 2.51.2 From e0165b2f3788e493d6d16efeb17fccf472439c04 Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Sun, 14 Jul 2024 20:21:55 -0700 Subject: [PATCH 42/78] lituus: remove /storage (i'll need to add it back eventually) --- hosts/lituus/hardware-configuration.nix | 5 ----- 1 file changed, 5 deletions(-) diff --git a/hosts/lituus/hardware-configuration.nix b/hosts/lituus/hardware-configuration.nix index 727deed..6feedb4 100644 --- a/hosts/lituus/hardware-configuration.nix +++ b/hosts/lituus/hardware-configuration.nix @@ -20,11 +20,6 @@ fsType = "btrfs"; }; - fileSystems."/storage" = - { device = "/dev/disk/by-uuid/c2181608-cbb0-40ab-b62b-158cdc9b9300"; - fsType = "btrfs"; - }; - swapDevices = [ ]; hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; -- 2.51.2 From 54b3654d3b7bdb785e8818e57b229ee34a254ee0 Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Sun, 14 Jul 2024 20:22:43 -0700 Subject: [PATCH 43/78] box: change website deploy to point to helix --- hosts/profiles/sync/website/default.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hosts/profiles/sync/website/default.nix b/hosts/profiles/sync/website/default.nix index 6017b1c..699d48f 100644 --- a/hosts/profiles/sync/website/default.nix +++ b/hosts/profiles/sync/website/default.nix @@ -18,7 +18,7 @@ git add flake.lock git diff-index --quiet HEAD || git commit -m 'updating website' # if nothing, don't exit 1 git push - deploy .#cube + deploy .#helix exit 0 ''; serviceConfig = { -- 2.51.2 From 3bd1a5d622fe63d095d97c49e37d9403eaf990e3 Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Mon, 15 Jul 2024 00:00:07 -0700 Subject: [PATCH 44/78] updating website --- flake.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/flake.lock b/flake.lock index a9fcf71..f7dfc7a 100644 --- a/flake.lock +++ b/flake.lock @@ -487,11 +487,11 @@ ] }, "locked": { - "lastModified": 1721008827, - "narHash": "sha256-EwXAswswx4ykc5QVt1g05UzGmrXJH7ZZyPCF9LabcXA=", + "lastModified": 1721019622, + "narHash": "sha256-IAxon/AyL7+jLW2zxmPJWnAcn62BmwBFne57qHfehsg=", "ref": "main", - "rev": "d2af22cb18ba74a4357f9959d32888f1a6e15cd1", - "revCount": 1437, + "rev": "6eb4e0b57e0656b87a98717d17b33f26782e5a14", + "revCount": 1440, "type": "git", "url": "ssh://gitea@git.sealight.xyz/aynish/kitaab" }, -- 2.51.2 From b46c1ae4fb3cf17e91edf415ce5676f5cf1ee5ff Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Tue, 16 Jul 2024 00:00:14 -0700 Subject: [PATCH 45/78] updating website --- flake.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/flake.lock b/flake.lock index f7dfc7a..a86a200 100644 --- a/flake.lock +++ b/flake.lock @@ -487,11 +487,11 @@ ] }, "locked": { - "lastModified": 1721019622, - "narHash": "sha256-IAxon/AyL7+jLW2zxmPJWnAcn62BmwBFne57qHfehsg=", + "lastModified": 1721106021, + "narHash": "sha256-I3lQhbwVZ29WefC36G74UFE6Oh9ZjtPGV9xeqMsEQ9Y=", "ref": "main", - "rev": "6eb4e0b57e0656b87a98717d17b33f26782e5a14", - "revCount": 1440, + "rev": "0c746da7f84279be559a7d73758a2ac4d9e06bd9", + "revCount": 1443, "type": "git", "url": "ssh://gitea@git.sealight.xyz/aynish/kitaab" }, -- 2.51.2 From 56da25133db0c50c042e0cd408fd7ecd43b5ea84 Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Fri, 19 Jul 2024 00:00:09 -0700 Subject: [PATCH 46/78] updating website --- flake.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/flake.lock b/flake.lock index a86a200..e0b1a88 100644 --- a/flake.lock +++ b/flake.lock @@ -487,11 +487,11 @@ ] }, "locked": { - "lastModified": 1721106021, - "narHash": "sha256-I3lQhbwVZ29WefC36G74UFE6Oh9ZjtPGV9xeqMsEQ9Y=", + "lastModified": 1721358006, + "narHash": "sha256-R+P2rmTfw1KYxJR67NiCByEse5Jd3mpgJXZzDfcRYuc=", "ref": "main", - "rev": "0c746da7f84279be559a7d73758a2ac4d9e06bd9", - "revCount": 1443, + "rev": "00dd6eec825f184121abae8153a8e7c98b93f24f", + "revCount": 1445, "type": "git", "url": "ssh://gitea@git.sealight.xyz/aynish/kitaab" }, -- 2.51.2 From 6de4e4fe1e78cfbfff8dabea2bcaf9ce82e309ae Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Sun, 21 Jul 2024 00:00:09 -0700 Subject: [PATCH 47/78] updating website --- flake.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/flake.lock b/flake.lock index e0b1a88..89c3789 100644 --- a/flake.lock +++ b/flake.lock @@ -487,11 +487,11 @@ ] }, "locked": { - "lastModified": 1721358006, - "narHash": "sha256-R+P2rmTfw1KYxJR67NiCByEse5Jd3mpgJXZzDfcRYuc=", + "lastModified": 1721527214, + "narHash": "sha256-EKEbDBApkJxczqJ5nGL/Diq69pjypqgO78/ROrKvg5o=", "ref": "main", - "rev": "00dd6eec825f184121abae8153a8e7c98b93f24f", - "revCount": 1445, + "rev": "ff4530b50033ae5a3ff0721ae097ef41fe5a191e", + "revCount": 1446, "type": "git", "url": "ssh://gitea@git.sealight.xyz/aynish/kitaab" }, -- 2.51.2 From 9559e354a12f58173d6ca17ffa2c785ac1039d36 Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Mon, 22 Jul 2024 00:00:12 -0700 Subject: [PATCH 48/78] updating website --- flake.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/flake.lock b/flake.lock index 89c3789..90195e6 100644 --- a/flake.lock +++ b/flake.lock @@ -487,11 +487,11 @@ ] }, "locked": { - "lastModified": 1721527214, - "narHash": "sha256-EKEbDBApkJxczqJ5nGL/Diq69pjypqgO78/ROrKvg5o=", + "lastModified": 1721628014, + "narHash": "sha256-ZPQE01yKJ2H1+q+wDZNI7KrujZX1HvkezyMbYeAZqCQ=", "ref": "main", - "rev": "ff4530b50033ae5a3ff0721ae097ef41fe5a191e", - "revCount": 1446, + "rev": "7d32be9da6db561955d54bcf1e330930ba675621", + "revCount": 1447, "type": "git", "url": "ssh://gitea@git.sealight.xyz/aynish/kitaab" }, -- 2.51.2 From 564cd8d3d53633a2ed8fc62390de4532f1923367 Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Fri, 2 Aug 2024 00:00:15 -0700 Subject: [PATCH 49/78] updating website --- flake.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/flake.lock b/flake.lock index 90195e6..b86fbb1 100644 --- a/flake.lock +++ b/flake.lock @@ -487,11 +487,11 @@ ] }, "locked": { - "lastModified": 1721628014, - "narHash": "sha256-ZPQE01yKJ2H1+q+wDZNI7KrujZX1HvkezyMbYeAZqCQ=", + "lastModified": 1722578414, + "narHash": "sha256-C7vFKI1MYJRvlHCXTXz44a1tkO23jsO1UFCQyPDQ7GI=", "ref": "main", - "rev": "7d32be9da6db561955d54bcf1e330930ba675621", - "revCount": 1447, + "rev": "30f16b342f37a06802efc294c6959ac30f4a9692", + "revCount": 1448, "type": "git", "url": "ssh://gitea@git.sealight.xyz/aynish/kitaab" }, -- 2.51.2 From 7e725a29266176b14e1a3e9aee70d257db85b951 Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Sun, 4 Aug 2024 00:00:12 -0700 Subject: [PATCH 50/78] updating website --- flake.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/flake.lock b/flake.lock index b86fbb1..afd1059 100644 --- a/flake.lock +++ b/flake.lock @@ -487,11 +487,11 @@ ] }, "locked": { - "lastModified": 1722578414, - "narHash": "sha256-C7vFKI1MYJRvlHCXTXz44a1tkO23jsO1UFCQyPDQ7GI=", + "lastModified": 1722675615, + "narHash": "sha256-Jat6S54r3SOf11ZJRJVQLcPI3Sbem/Tgl8T/lkCqWg0=", "ref": "main", - "rev": "30f16b342f37a06802efc294c6959ac30f4a9692", - "revCount": 1448, + "rev": "3a854494b4cc8d007385d47dce3a9f828aeb3c79", + "revCount": 1449, "type": "git", "url": "ssh://gitea@git.sealight.xyz/aynish/kitaab" }, -- 2.51.2 From 5dcf12980a1549ce03d5b3c71b14d24c95b5b959 Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Thu, 8 Aug 2024 00:00:11 -0700 Subject: [PATCH 51/78] updating website --- flake.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/flake.lock b/flake.lock index afd1059..7b34eee 100644 --- a/flake.lock +++ b/flake.lock @@ -487,11 +487,11 @@ ] }, "locked": { - "lastModified": 1722675615, - "narHash": "sha256-Jat6S54r3SOf11ZJRJVQLcPI3Sbem/Tgl8T/lkCqWg0=", + "lastModified": 1723003214, + "narHash": "sha256-xPqpd7TgBoTJbRa0tYYnxTF7LpBRQtGANaZFbE8VV10=", "ref": "main", - "rev": "3a854494b4cc8d007385d47dce3a9f828aeb3c79", - "revCount": 1449, + "rev": "47d8edc8b670d4ca58f0512a3bab1a05b34fd9d0", + "revCount": 1452, "type": "git", "url": "ssh://gitea@git.sealight.xyz/aynish/kitaab" }, -- 2.51.2 From 83dd8db5eff625fad6ecf286b4131c84192632b9 Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Fri, 16 Aug 2024 00:00:07 -0700 Subject: [PATCH 52/78] updating website --- flake.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/flake.lock b/flake.lock index 7b34eee..c21d079 100644 --- a/flake.lock +++ b/flake.lock @@ -487,11 +487,11 @@ ] }, "locked": { - "lastModified": 1723003214, - "narHash": "sha256-xPqpd7TgBoTJbRa0tYYnxTF7LpBRQtGANaZFbE8VV10=", + "lastModified": 1723788014, + "narHash": "sha256-8SBZud7krr5GZf6OsQC0X6WWqBvS3jAoMTMQPw9ULYg=", "ref": "main", - "rev": "47d8edc8b670d4ca58f0512a3bab1a05b34fd9d0", - "revCount": 1452, + "rev": "ff6c35c0480c2192460b7af56d2cce7147f3f3b2", + "revCount": 1459, "type": "git", "url": "ssh://gitea@git.sealight.xyz/aynish/kitaab" }, -- 2.51.2 From a1da6fac2b1077472cbd8b7f27557abcb12dc3d2 Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Sat, 17 Aug 2024 00:00:10 -0700 Subject: [PATCH 53/78] updating website --- flake.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/flake.lock b/flake.lock index c21d079..f6892c6 100644 --- a/flake.lock +++ b/flake.lock @@ -487,11 +487,11 @@ ] }, "locked": { - "lastModified": 1723788014, - "narHash": "sha256-8SBZud7krr5GZf6OsQC0X6WWqBvS3jAoMTMQPw9ULYg=", + "lastModified": 1723852814, + "narHash": "sha256-P0mYUxYH097oG5x0n84qABgk2tQfBLznwd1TGh5vgnk=", "ref": "main", - "rev": "ff6c35c0480c2192460b7af56d2cce7147f3f3b2", - "revCount": 1459, + "rev": "8de8ac0e086187a749c719893f3aa9c460978f9a", + "revCount": 1462, "type": "git", "url": "ssh://gitea@git.sealight.xyz/aynish/kitaab" }, -- 2.51.2 From 92e293d863885ce9c389877056641a4c3c1be8bc Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Sun, 18 Aug 2024 18:55:28 -0700 Subject: [PATCH 54/78] feat(wireguard): add hyperplane and work --- hosts/profiles/wireguard-server/default.nix | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/hosts/profiles/wireguard-server/default.nix b/hosts/profiles/wireguard-server/default.nix index bbe87f7..50e7f5f 100644 --- a/hosts/profiles/wireguard-server/default.nix +++ b/hosts/profiles/wireguard-server/default.nix @@ -36,11 +36,16 @@ publicKey = "gcdq86hhEUlqF2chqYB/F8pALyAMNFvwLycxBoHuoDs="; allowedIPs = [ "10.0.69.5/32" ]; } - # { - # # hyperplane - # publicKey = ""; - # allowedIPs = [ "10.0.69.6/32" ]; - # } + { + # hyperplane + publicKey = "v+EUuM60yZLvBmdCG9GxfFAtSjS1VvbUWcyNb8emjDg="; + allowedIPs = [ "10.0.69.6/32" ]; + } + { + # work + publicKey = "/gv66s8DfppCCjaEN/jlc8z95IhEWPgDumykqKEl0QU="; + allowedIPs = [ "10.0.69.7/32" ]; + } ]; }; } -- 2.51.2 From d6d2aaa32916095c3e7e4aaafc1ffedea82095e8 Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Mon, 19 Aug 2024 21:07:02 -0700 Subject: [PATCH 55/78] updating website --- flake.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/flake.lock b/flake.lock index f6892c6..56be03c 100644 --- a/flake.lock +++ b/flake.lock @@ -487,11 +487,11 @@ ] }, "locked": { - "lastModified": 1723852814, - "narHash": "sha256-P0mYUxYH097oG5x0n84qABgk2tQfBLznwd1TGh5vgnk=", + "lastModified": 1724050814, + "narHash": "sha256-THf50ZcBPY6r7/cyvE8bxYDvrctHrWbYaMx4udr4OUM=", "ref": "main", - "rev": "8de8ac0e086187a749c719893f3aa9c460978f9a", - "revCount": 1462, + "rev": "7628c26fd92f684ab5c7572c63de4af8b4b3a7b4", + "revCount": 1464, "type": "git", "url": "ssh://gitea@git.sealight.xyz/aynish/kitaab" }, -- 2.51.2 From e92a34b76ad917d68385c6dec4c5e3358711f407 Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Mon, 19 Aug 2024 21:28:53 -0700 Subject: [PATCH 56/78] delete failed blog attempt --- hosts/profiles/blogg/default.nix | 18 ---- hosts/profiles/ghost/default.nix | 18 ---- modules/nixos/blogging.nix | 148 ------------------------------- modules/nixos/ghost.nix | 148 ------------------------------- pkgs/ghost/builder.sh | 9 -- pkgs/ghost/default.nix | 11 --- 6 files changed, 352 deletions(-) delete mode 100644 hosts/profiles/blogg/default.nix delete mode 100644 hosts/profiles/ghost/default.nix delete mode 100644 modules/nixos/blogging.nix delete mode 100644 modules/nixos/ghost.nix delete mode 100644 pkgs/ghost/builder.sh delete mode 100644 pkgs/ghost/default.nix diff --git a/hosts/profiles/blogg/default.nix b/hosts/profiles/blogg/default.nix deleted file mode 100644 index 6ea900c..0000000 --- a/hosts/profiles/blogg/default.nix +++ /dev/null @@ -1,18 +0,0 @@ -{pkgs, ... }: -{ - services.nginx = { - enable = true; - recommendedGzipSettings = true; - recommendedOptimisation = true; - recommendedProxySettings = true; - recommendedTlsSettings = true; - }; - - # Enables MySQL - services.mysql = { - enable = true; - package = pkgs.mariadb; - }; - - services."write.sealight.xyz".enable = true; -} diff --git a/hosts/profiles/ghost/default.nix b/hosts/profiles/ghost/default.nix deleted file mode 100644 index 6ea900c..0000000 --- a/hosts/profiles/ghost/default.nix +++ /dev/null @@ -1,18 +0,0 @@ -{pkgs, ... }: -{ - services.nginx = { - enable = true; - recommendedGzipSettings = true; - recommendedOptimisation = true; - recommendedProxySettings = true; - recommendedTlsSettings = true; - }; - - # Enables MySQL - services.mysql = { - enable = true; - package = pkgs.mariadb; - }; - - services."write.sealight.xyz".enable = true; -} diff --git a/modules/nixos/blogging.nix b/modules/nixos/blogging.nix deleted file mode 100644 index f4fed91..0000000 --- a/modules/nixos/blogging.nix +++ /dev/null @@ -1,148 +0,0 @@ -{ options, lib, config, pkgs, ... }: -let - # domain for the Ghost blog - serverName = "write.sealight.xyz"; - # port on which the Ghost service runs - port = 1357; - # user used to run the Ghost service - userName = builtins.replaceStrings [ "." ] [ "_" ] serverName; - # MySQL database used by Ghost - dbName = userName; - # MySQL user used by Ghost - dbUser = userName; - # directory used to save the blog content - dataDir = "/var/lib/${userName}"; - # Ghost package we created in the section above - ghost = import ./ghost { inherit pkgs; }; - # script that sets up the Ghost content directory - setupScript = pkgs.writeScript "${serverName}-setup.sh" '' - #! ${pkgs.stdenv.shell} -e - chmod g+s "${dataDir}" - [[ ! -d "${dataDir}/content" ]] && cp -r "${ghost}/content" "${dataDir}/content" - chown -R "${userName}":"${userName}" "${dataDir}/content" - chmod -R +w "${dataDir}/content" - ln -f -s "/etc/${serverName}.json" "${dataDir}/config.production.json" - [[ -d "${dataDir}/current" ]] && rm "${dataDir}/current" - ln -f -s "${ghost}/current" "${dataDir}/current" - [[ -d "${dataDir}/content/themes/casper" ]] && rm "${dataDir}/content/themes/casper" - ln -f -s "${ghost}/current/content/themes/casper" "${dataDir}/content/themes/casper" - ''; - - databaseService = "mysql.service"; - - serviceConfig = config.services."${serverName}"; - options = { enable = lib.mkEnableOption "${serverName} service"; }; -in { - options.services.${serverName} = options; - config = lib.mkIf serviceConfig.enable { - # Creates the user and group - users.users.${userName} = { - isSystemUser = true; - group = userName; - createHome = true; - home = dataDir; - }; - users.groups.${userName} = { }; - - # Creates the Ghost config - environment.etc."${serverName}.json".text = '' - { - "url": "https://${serverName}", - "server": { - "port": ${port}, - "host": "0.0.0.0" - }, - "database": { - "client": "mysql", - "connection": { - "host": "localhost", - "user": "${dbUser}", - "database": "${dbName}", - "password": "", - "socketPath": "/run/mysqld/mysqld.sock" - } - }, - "mail": { - "transport": "sendmail" - }, - "logging": { - "transports": ["stdout"] - }, - "paths": { - "contentPath": "${dataDir}/content" - } - } - ''; - - # Sets up the Systemd service - systemd.services."${serverName}" = { - enable = true; - description = "${serverName} ghost blog"; - restartIfChanged = true; - restartTriggers = - [ ghost config.environment.etc."${serverName}.json".source ]; - requires = [ databaseService ]; - after = [ databaseService ]; - path = [ pkgs.nodejs pkgs.vips ]; - wantedBy = [ "multi-user.target" ]; - serviceConfig = { - User = userName; - Group = userName; - WorkingDirectory = dataDir; - # Executes the setup script before start - ExecStartPre = setupScript; - # Runs Ghost with node - ExecStart = "${pkgs.nodejs}/bin/node current/index.js"; - # Sandboxes the Systemd service - AmbientCapabilities = [ ]; - CapabilityBoundingSet = [ ]; - KeyringMode = "private"; - LockPersonality = true; - NoNewPrivileges = true; - PrivateDevices = true; - PrivateMounts = true; - PrivateTmp = true; - ProtectClock = true; - ProtectControlGroups = true; - ProtectHome = true; - ProtectHostname = true; - ProtectKernelLogs = true; - ProtectKernelModules = true; - ProtectKernelTunables = true; - ProtectSystem = "full"; - RemoveIPC = true; - RestrictAddressFamilies = [ ]; - RestrictNamespaces = true; - RestrictRealtime = true; - }; - environment = { NODE_ENV = "production"; }; - }; - - # Sets up the blog virtual host on NGINX - services.nginx.virtualHosts.${serverName} = { - # Sets up Lets Encrypt SSL certificates for the blog - forceSSL = true; - enableACME = true; - locations."/" = { proxyPass = "http://127.0.0.1:${toString port}"; }; - extraConfig = '' - charset UTF-8; - - add_header Strict-Transport-Security "max-age=2592000; includeSubDomains" always; - add_header Referrer-Policy "strict-origin-when-cross-origin"; - add_header X-Frame-Options "SAMEORIGIN"; - add_header X-XSS-Protection "1; mode=block"; - add_header X-Content-Type-Options nosniff; - ''; - }; - - # Sets up MySQL database and user for Ghost - services.mysql = { - ensureDatabases = [ dbName ]; - ensureUsers = [{ - name = dbUser; - ensurePermissions = { "${dbName}.*" = "ALL PRIVILEGES"; }; - }]; - }; - }; -} - diff --git a/modules/nixos/ghost.nix b/modules/nixos/ghost.nix deleted file mode 100644 index f4fed91..0000000 --- a/modules/nixos/ghost.nix +++ /dev/null @@ -1,148 +0,0 @@ -{ options, lib, config, pkgs, ... }: -let - # domain for the Ghost blog - serverName = "write.sealight.xyz"; - # port on which the Ghost service runs - port = 1357; - # user used to run the Ghost service - userName = builtins.replaceStrings [ "." ] [ "_" ] serverName; - # MySQL database used by Ghost - dbName = userName; - # MySQL user used by Ghost - dbUser = userName; - # directory used to save the blog content - dataDir = "/var/lib/${userName}"; - # Ghost package we created in the section above - ghost = import ./ghost { inherit pkgs; }; - # script that sets up the Ghost content directory - setupScript = pkgs.writeScript "${serverName}-setup.sh" '' - #! ${pkgs.stdenv.shell} -e - chmod g+s "${dataDir}" - [[ ! -d "${dataDir}/content" ]] && cp -r "${ghost}/content" "${dataDir}/content" - chown -R "${userName}":"${userName}" "${dataDir}/content" - chmod -R +w "${dataDir}/content" - ln -f -s "/etc/${serverName}.json" "${dataDir}/config.production.json" - [[ -d "${dataDir}/current" ]] && rm "${dataDir}/current" - ln -f -s "${ghost}/current" "${dataDir}/current" - [[ -d "${dataDir}/content/themes/casper" ]] && rm "${dataDir}/content/themes/casper" - ln -f -s "${ghost}/current/content/themes/casper" "${dataDir}/content/themes/casper" - ''; - - databaseService = "mysql.service"; - - serviceConfig = config.services."${serverName}"; - options = { enable = lib.mkEnableOption "${serverName} service"; }; -in { - options.services.${serverName} = options; - config = lib.mkIf serviceConfig.enable { - # Creates the user and group - users.users.${userName} = { - isSystemUser = true; - group = userName; - createHome = true; - home = dataDir; - }; - users.groups.${userName} = { }; - - # Creates the Ghost config - environment.etc."${serverName}.json".text = '' - { - "url": "https://${serverName}", - "server": { - "port": ${port}, - "host": "0.0.0.0" - }, - "database": { - "client": "mysql", - "connection": { - "host": "localhost", - "user": "${dbUser}", - "database": "${dbName}", - "password": "", - "socketPath": "/run/mysqld/mysqld.sock" - } - }, - "mail": { - "transport": "sendmail" - }, - "logging": { - "transports": ["stdout"] - }, - "paths": { - "contentPath": "${dataDir}/content" - } - } - ''; - - # Sets up the Systemd service - systemd.services."${serverName}" = { - enable = true; - description = "${serverName} ghost blog"; - restartIfChanged = true; - restartTriggers = - [ ghost config.environment.etc."${serverName}.json".source ]; - requires = [ databaseService ]; - after = [ databaseService ]; - path = [ pkgs.nodejs pkgs.vips ]; - wantedBy = [ "multi-user.target" ]; - serviceConfig = { - User = userName; - Group = userName; - WorkingDirectory = dataDir; - # Executes the setup script before start - ExecStartPre = setupScript; - # Runs Ghost with node - ExecStart = "${pkgs.nodejs}/bin/node current/index.js"; - # Sandboxes the Systemd service - AmbientCapabilities = [ ]; - CapabilityBoundingSet = [ ]; - KeyringMode = "private"; - LockPersonality = true; - NoNewPrivileges = true; - PrivateDevices = true; - PrivateMounts = true; - PrivateTmp = true; - ProtectClock = true; - ProtectControlGroups = true; - ProtectHome = true; - ProtectHostname = true; - ProtectKernelLogs = true; - ProtectKernelModules = true; - ProtectKernelTunables = true; - ProtectSystem = "full"; - RemoveIPC = true; - RestrictAddressFamilies = [ ]; - RestrictNamespaces = true; - RestrictRealtime = true; - }; - environment = { NODE_ENV = "production"; }; - }; - - # Sets up the blog virtual host on NGINX - services.nginx.virtualHosts.${serverName} = { - # Sets up Lets Encrypt SSL certificates for the blog - forceSSL = true; - enableACME = true; - locations."/" = { proxyPass = "http://127.0.0.1:${toString port}"; }; - extraConfig = '' - charset UTF-8; - - add_header Strict-Transport-Security "max-age=2592000; includeSubDomains" always; - add_header Referrer-Policy "strict-origin-when-cross-origin"; - add_header X-Frame-Options "SAMEORIGIN"; - add_header X-XSS-Protection "1; mode=block"; - add_header X-Content-Type-Options nosniff; - ''; - }; - - # Sets up MySQL database and user for Ghost - services.mysql = { - ensureDatabases = [ dbName ]; - ensureUsers = [{ - name = dbUser; - ensurePermissions = { "${dbName}.*" = "ALL PRIVILEGES"; }; - }]; - }; - }; -} - diff --git a/pkgs/ghost/builder.sh b/pkgs/ghost/builder.sh deleted file mode 100644 index e30d101..0000000 --- a/pkgs/ghost/builder.sh +++ /dev/null @@ -1,9 +0,0 @@ -source "$stdenv"/setup - -export HOME=$(mktemp -d) -npm install --loglevel=info --logs-max=0 "ghost-cli@$ghostCliVersion" - -mkdir --parents "$out"/ -node_modules/ghost-cli/bin/ghost install "$version" --db=sqlite3 \ - --no-enable --no-prompt --no-stack --no-setup --no-start --dir "$out" - diff --git a/pkgs/ghost/default.nix b/pkgs/ghost/default.nix deleted file mode 100644 index 52ac793..0000000 --- a/pkgs/ghost/default.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ pkgs }: - -let - pname = "ghost"; - version = "5.8.0"; -in pkgs.stdenv.mkDerivation { - inherit pname version; - buildInputs = with pkgs; [ nodejs yarn vips ]; - ghostCliVersion = "1.21.1"; - builder = ./builder.sh; -} -- 2.51.2 From fb9d89201532e328d61dcd2dc8c65b3522e29338 Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Mon, 19 Aug 2024 21:29:25 -0700 Subject: [PATCH 57/78] feat: gpodder2go module + pkg --- hosts/profiles/gpodder/default.nix | 4 + modules/nixos/default.nix | 2 +- modules/nixos/gpodder2go.nix | 114 +++++++++++++++++++++++++++++ pkgs/default.nix | 3 +- 4 files changed, 120 insertions(+), 3 deletions(-) create mode 100644 hosts/profiles/gpodder/default.nix create mode 100644 modules/nixos/gpodder2go.nix diff --git a/hosts/profiles/gpodder/default.nix b/hosts/profiles/gpodder/default.nix new file mode 100644 index 0000000..bc30455 --- /dev/null +++ b/hosts/profiles/gpodder/default.nix @@ -0,0 +1,4 @@ +{ + services.gpodder.enable = true; + networking.firewall.allowedTCPPorts = [ 3005 ]; +} diff --git a/modules/nixos/default.nix b/modules/nixos/default.nix index 38962ff..cf3f7fe 100644 --- a/modules/nixos/default.nix +++ b/modules/nixos/default.nix @@ -9,6 +9,6 @@ wireguard = import ./wireguard.nix; backup = import ./backup.nix; ulogger-server = import ./ulogger.nix; - blogg = import ./blogging.nix; + gpodder2go = import ./gpodder2go.nix; # microbin = import ./microbin.nix; # includide in 23.11 } diff --git a/modules/nixos/gpodder2go.nix b/modules/nixos/gpodder2go.nix new file mode 100644 index 0000000..4621996 --- /dev/null +++ b/modules/nixos/gpodder2go.nix @@ -0,0 +1,114 @@ +{ self, config, lib, pkgs, ... }: + +with lib; + +let + cfg = config.services.gpodder2go; +in +{ + options = { + + services.gpodder = { + enable = mkEnableOption "A gpodder instance"; + + user = mkOption { + type = types.str; + default = "gpodder"; + description = "User account under which gpodder runs."; + }; + + group = mkOption { + type = types.str; + default = "gpodder"; + description = "Group account under which gpodder runs."; + }; + + hostname = mkOption { + type = types.str; + description = "Hostname of your gpodder service"; + }; + + dataFolder = mkOption { + type = types.str; + default = "/var/lib/gpodder"; + description = "State director"; + }; + + VERIFIER_SECRET_KEY = mkOption { + type = types.str; + default = "satnheiycglsrcgaecrlufg"; + description = "Verifer Secret"; + }; + + }; + }; + + config = mkIf cfg.enable { + systemd.services.gpodder = { + description = "gpodder2go A gpodder instance"; + after = [ "remote-fs.target" "network.target" ]; + wantedBy = [ "multi-user.target" ]; + serviceConfig = { + ExecStart = "${pkgs.gpodder2go}/bin/gpodder2go serve"; + Environment = [ + "VERIFIER_SECRET_KEY=${cfg.VERIFIER_SECRET_KEY}" + ]; + WorkingDirectory = dataFolder; + TimeoutStopSec = " 20 "; + KillMode = " process "; + RestartSec = " 10 "; + User = cfg.user; + Group = cfg.group; + DevicePolicy = " closed "; + NoNewPrivileges = " yes "; + PrivateTmp = " yes "; + PrivateUsers = " yes "; + ProtectControlGroups = " yes "; + ProtectKernelModules = " yes "; + ProtectKernelTunables = " yes "; + RestrictAddressFamilies = " + AF_UNIX + AF_INET + AF_INET6 "; + RestrictNamespaces = " yes "; + RestrictRealtime = " yes "; + SystemCallFilter = "~@clock @debug @module @mount @obsolete @privileged @reboot @setuid @swap"; + ReadWritePaths = dataFolder; + StateDirectory = baseNameOf dataFolder; + }; + }; + + users.users = optionalAttrs (cfg.user == "gpodder") ({ + gpodder = { + description = "gpodder service user"; + name = cfg.user; + group = cfg.group; + isSystemUser = true; + }; + }); + + users.groups = optionalAttrs (cfg.group == "gpodder") ({ + gpodder = { }; + }); + }; + + systemd.services.gpodder-install = { + description = "gpodder install service"; + wantedBy = [ "multi-user.target" ]; + before = [ "gpodder.service" ]; + path = with pkgs; [ gpodder2go ]; + + serviceConfig = { + User = cfg.user; + Type = "oneshot"; + } // commonServiceConfig; + + script = '' + if [ ! -f "${cfg.dataFolder}/installed" ]; then + ${pkgs.gpodder2go}/bin/gpodder2go init + touch "${cfg.dataFolder}/installed" + fi + ''; + }; +} + diff --git a/pkgs/default.nix b/pkgs/default.nix index 8a5ef55..5f20de2 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -5,7 +5,7 @@ plymouth-themes = pkgs.callPackage ./plymouth.nix { }; tic-80 = pkgs.callPackage ./tic-80.nix { }; fennel-ls = pkgs.callPackage ./fennel-ls.nix { }; - kobopatch = pkgs.callPackage ./kobopatch.nix { }; + # kobopatch = pkgs.callPackage ./kobopatch.nix { }; my-mautrix-discord = pkgs.callPackage ./mautrix-discord.nix { }; # Handled by matrix-appservices input ulogger-server = pkgs.callPackage ./ulogger.nix { }; # Wallabag is now an overlay @@ -13,5 +13,4 @@ my-wallabag = pkgs.callPackage ./wallabag.nix { }; mautrix-slack = pkgs.callPackage ./mautrix-slack.nix { }; gpodder2go = pkgs.callPackage ./gpodder2go.nix { }; - ghost = pkgs.callPackage ./ghost { }; } -- 2.51.2 From afb1c0efb4e26feea6545318aa9c47c03522a62b Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Mon, 19 Aug 2024 21:29:41 -0700 Subject: [PATCH 58/78] update to 24.05 --- flake.lock | 258 ++++++------------------ flake.nix | 24 +-- home/profiles/cli/default.nix | 2 +- home/profiles/desktop/default.nix | 5 +- hosts/box/configuration.nix | 2 +- hosts/box/default.nix | 3 +- hosts/curve/configuration.nix | 2 +- hosts/curve/default.nix | 2 +- hosts/profiles/core/default.nix | 2 +- hosts/profiles/desktop/default.nix | 6 +- hosts/profiles/finance/default.nix | 2 +- hosts/profiles/gitea/default.nix | 6 +- hosts/profiles/gonic/default.nix | 7 +- hosts/profiles/gonic/module-gonic.nix | 4 - hosts/profiles/rss-bridge/default.nix | 2 +- hosts/profiles/sync/website/default.nix | 2 +- install-yubikey.sh | 2 +- pkgs/kobopatch.nix | 6 +- 18 files changed, 93 insertions(+), 244 deletions(-) diff --git a/flake.lock b/flake.lock index a9fcf71..9cf0b55 100644 --- a/flake.lock +++ b/flake.lock @@ -6,14 +6,15 @@ "home-manager": "home-manager", "nixpkgs": [ "nixpkgs" - ] + ], + "systems": "systems" }, "locked": { - "lastModified": 1690228878, - "narHash": "sha256-9Xe7JV0krp4RJC9W9W9WutZVlw6BlHTFMiUP/k48LQY=", + "lastModified": 1723293904, + "narHash": "sha256-b+uqzj+Wa6xgMS9aNbX4I+sXeb5biPDi39VgvSFqFvU=", "owner": "ryantm", "repo": "agenix", - "rev": "d8c973fd228949736dedf61b7f8cc1ece3236792", + "rev": "f6291c5935fdc4e0bef208cfc0dcab7e3f7a1c41", "type": "github" }, "original": { @@ -55,11 +56,11 @@ ] }, "locked": { - "lastModified": 1673295039, - "narHash": "sha256-AsdYgE8/GPwcelGgrntlijMg4t3hLFJFCRF3tL5WVjA=", + "lastModified": 1700795494, + "narHash": "sha256-gzGLZSiOhf155FW7262kdHo2YDeugp3VuIFb4/GGng0=", "owner": "lnl7", "repo": "nix-darwin", - "rev": "87b9d090ad39b25b2400029c64825fc2a8868943", + "rev": "4b9b83d5a92e8c1fbfd8eb27eda375908c11ec4d", "type": "github" }, "original": { @@ -78,11 +79,11 @@ "utils": "utils" }, "locked": { - "lastModified": 1704875591, - "narHash": "sha256-eWRLbqRcrILgztU/m/k7CYLzETKNbv0OsT2GjkaNm8A=", + "lastModified": 1718194053, + "narHash": "sha256-FaGrf7qwZ99ehPJCAwgvNY5sLCqQ3GDiE/6uLhxxwSY=", "owner": "serokell", "repo": "deploy-rs", - "rev": "1776009f1f3fb2b5d236b84d9815f2edee463a9b", + "rev": "3867348fa92bc892eba5d9ddb2d7a97b9e127a8a", "type": "github" }, "original": { @@ -109,16 +110,15 @@ "dirt-samples-src": { "flake": false, "locked": { - "lastModified": 1588278411, - "narHash": "sha256-h8vQxRym6QzNLOTZU7A43VCHuG0H77l+BFwXnC0L1CE=", + "lastModified": 1698439458, + "narHash": "sha256-Mp8qBpsOvW9Zguv95Kv7EU6S3ICaF2aO02Wz6xGURtE=", "owner": "tidalcycles", "repo": "dirt-samples", - "rev": "66d432418c9a7d82cf049d9246adfa62f46df2a6", + "rev": "9a6dff8f9ec3cd55b287290cf04e01afa6b8f532", "type": "github" }, "original": { "owner": "tidalcycles", - "ref": "master", "repo": "dirt-samples", "type": "github" } @@ -130,11 +130,11 @@ ] }, "locked": { - "lastModified": 1690739034, - "narHash": "sha256-roW02IaiQ3gnEEDMCDWL5YyN+C4nBf/te6vfL7rG0jk=", + "lastModified": 1724031427, + "narHash": "sha256-o1HdAf+7IGv9M13R3c+zc/sJ0QgeEnhsvHBcodI4UpM=", "owner": "nix-community", "repo": "disko", - "rev": "4015740375676402a2ee6adebc3c30ea625b9a94", + "rev": "4e719b38fa7c85f4f65d0308ca7084c91e7bdd6d", "type": "github" }, "original": { @@ -143,30 +143,6 @@ "type": "github" } }, - "eww": { - "inputs": { - "flake-compat": "flake-compat_2", - "nixpkgs": [ - "nixpkgs" - ], - "rust-overlay": [ - "rust-overlay" - ] - }, - "locked": { - "lastModified": 1690660426, - "narHash": "sha256-YUuH1BZ3G5dhHRZ1Z9XPXyorm8vV8G+jYbcdIGxOcOs=", - "owner": "elkowar", - "repo": "eww", - "rev": "dc3129aee2806823bdad87785f7ef80651d5245c", - "type": "github" - }, - "original": { - "owner": "elkowar", - "repo": "eww", - "type": "github" - } - }, "flake-compat": { "flake": false, "locked": { @@ -184,22 +160,6 @@ } }, "flake-compat_2": { - "flake": false, - "locked": { - "lastModified": 1650374568, - "narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=", - "owner": "edolstra", - "repo": "flake-compat", - "rev": "b4a34015c698c7793d592d66adbab377907a2be8", - "type": "github" - }, - "original": { - "owner": "edolstra", - "repo": "flake-compat", - "type": "github" - } - }, - "flake-compat_3": { "flake": false, "locked": { "lastModified": 1641205782, @@ -245,42 +205,6 @@ "type": "github" } }, - "flake-utils_3": { - "inputs": { - "systems": "systems_2" - }, - "locked": { - "lastModified": 1685518550, - "narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "flake-utils_4": { - "inputs": { - "systems": "systems_3" - }, - "locked": { - "lastModified": 1705309234, - "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, "grasp": { "inputs": { "flake-utils": "flake-utils_2", @@ -305,11 +229,11 @@ }, "hardware": { "locked": { - "lastModified": 1691179816, - "narHash": "sha256-WSMwqzU70ZMRHv1CUAfHEEKJuB0c9c9r0F+lJehXfSI=", + "lastModified": 1723310128, + "narHash": "sha256-IiH8jG6PpR4h9TxSGMYh+2/gQiJW9MwehFvheSb5rPc=", "owner": "nixos", "repo": "nixos-hardware", - "rev": "87e3122b67587492a617764f88c71991893fcf8a", + "rev": "c54cf53e022b0b3c1d3b8207aa0f9b194c24f0cf", "type": "github" }, "original": { @@ -326,11 +250,11 @@ ] }, "locked": { - "lastModified": 1682203081, - "narHash": "sha256-kRL4ejWDhi0zph/FpebFYhzqlOBrk0Pl3dzGEKSAlEw=", + "lastModified": 1703113217, + "narHash": "sha256-7ulcXOk63TIT2lVDSExj7XzFx09LpdSAPtvgtM7yQPE=", "owner": "nix-community", "repo": "home-manager", - "rev": "32d3e39c491e2f91152c84f8ad8b003420eab0a1", + "rev": "3bfaacf46133c037bb356193bd2f1765d9dc82c1", "type": "github" }, "original": { @@ -346,45 +270,24 @@ ] }, "locked": { - "lastModified": 1704099619, - "narHash": "sha256-QRVMkdxLmv+aKGjcgeEg31xtJEIsYq4i1Kbyw5EPS6g=", + "lastModified": 1720042825, + "narHash": "sha256-A0vrUB6x82/jvf17qPCpxaM+ulJnD8YZwH9Ci0BsAzE=", "owner": "nix-community", "repo": "home-manager", - "rev": "7e398b3d76bc1503171b1364c9d4a07ac06f3851", + "rev": "e1391fb22e18a36f57e6999c7a9f966dc80ac073", "type": "github" }, "original": { "owner": "nix-community", - "ref": "release-23.11", + "ref": "release-24.05", "repo": "home-manager", "type": "github" } }, - "llamacpp": { - "inputs": { - "flake-utils": "flake-utils_3", - "nixpkgs": [ - "unstable" - ] - }, - "locked": { - "lastModified": 1691180171, - "narHash": "sha256-ZmSRPACkLlPWtKfux9o+FB0mXZbINowyb0057ouAL/0=", - "owner": "ggerganov", - "repo": "llama.cpp", - "rev": "332311234a0aa2974b2450710e22e09d90dd6b0b", - "type": "github" - }, - "original": { - "owner": "ggerganov", - "repo": "llama.cpp", - "type": "github" - } - }, "nix-matrix-appservices": { "inputs": { "devshell": "devshell", - "flake-compat": "flake-compat_3", + "flake-compat": "flake-compat_2", "nixlib": "nixlib", "nixpkgs": "nixpkgs" }, @@ -419,11 +322,11 @@ }, "nixos-hardware": { "locked": { - "lastModified": 1691179816, - "narHash": "sha256-WSMwqzU70ZMRHv1CUAfHEEKJuB0c9c9r0F+lJehXfSI=", + "lastModified": 1723310128, + "narHash": "sha256-IiH8jG6PpR4h9TxSGMYh+2/gQiJW9MwehFvheSb5rPc=", "owner": "NixOS", "repo": "nixos-hardware", - "rev": "87e3122b67587492a617764f88c71991893fcf8a", + "rev": "c54cf53e022b0b3c1d3b8207aa0f9b194c24f0cf", "type": "github" }, "original": { @@ -451,27 +354,27 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1710420202, - "narHash": "sha256-MvFKESbq4rUWuaf2RKPNYENaSZEw/jaCLo2gU6oREcM=", + "lastModified": 1723938990, + "narHash": "sha256-9tUadhnZQbWIiYVXH8ncfGXGvkNq3Hag4RCBEMUk7MI=", "owner": "nixos", "repo": "nixpkgs", - "rev": "878ef7d9721bee9f81f8a80819f9211ad1f993da", + "rev": "c42fcfbdfeae23e68fc520f9182dde9f38ad1890", "type": "github" }, "original": { "owner": "nixos", - "ref": "nixos-23.11", + "ref": "nixos-24.05", "repo": "nixpkgs", "type": "github" } }, "nur": { "locked": { - "lastModified": 1691214006, - "narHash": "sha256-kdfBd+Y0DTOOdgSA6h6iIn403xVj4bzLnXqb7+yM6lQ=", + "lastModified": 1724040334, + "narHash": "sha256-Ia4gRRmhFn4oJ4SJKJPDNPomsRRFWU+bqCK7yuiLW4E=", "owner": "nix-community", "repo": "NUR", - "rev": "963ad2d1bb0a8f59b2c23ab521d4dff2148aad16", + "rev": "24471a48600e18669d13d24c9640b9859357d2cf", "type": "github" }, "original": { @@ -487,11 +390,11 @@ ] }, "locked": { - "lastModified": 1721008827, - "narHash": "sha256-EwXAswswx4ykc5QVt1g05UzGmrXJH7ZZyPCF9LabcXA=", + "lastModified": 1723852814, + "narHash": "sha256-P0mYUxYH097oG5x0n84qABgk2tQfBLznwd1TGh5vgnk=", "ref": "main", - "rev": "d2af22cb18ba74a4357f9959d32888f1a6e15cd1", - "revCount": 1437, + "rev": "8de8ac0e086187a749c719893f3aa9c460978f9a", + "revCount": 1462, "type": "git", "url": "ssh://gitea@git.sealight.xyz/aynish/kitaab" }, @@ -507,11 +410,9 @@ "basant": "basant", "deploy-rs": "deploy-rs", "disko": "disko", - "eww": "eww", "grasp": "grasp", "hardware": "hardware", "home-manager": "home-manager_2", - "llamacpp": "llamacpp", "nix-matrix-appservices": "nix-matrix-appservices", "nixos-hardware": "nixos-hardware", "nixpkgs": "nixpkgs_2", @@ -525,17 +426,16 @@ }, "rust-overlay": { "inputs": { - "flake-utils": "flake-utils_4", "nixpkgs": [ "nixpkgs" ] }, "locked": { - "lastModified": 1715912155, - "narHash": "sha256-UXHk4dKvvm5mSuDDON3lXU5CHKiTRnIjA5mUtDOtKEU=", + "lastModified": 1724034091, + "narHash": "sha256-b1g7w0sw+MDAhUAeCoX1vlTghsqcDZkxr+k9OZmxPa8=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "d3a96b08a7280a5753246129b462eed3662815d5", + "rev": "c7d36e0947826e0751a5214ffe82533fbc909bc0", "type": "github" }, "original": { @@ -547,16 +447,15 @@ "superdirt-src": { "flake": false, "locked": { - "lastModified": 1611740180, - "narHash": "sha256-GtnqZeMFqFkVhgx2Exu0wY687cHa7mNnVCgjQd6fiIA=", + "lastModified": 1697377840, + "narHash": "sha256-9qU9CHYAXbN1IE3xXDqGipuroifVaSVXj3c/cDfwM80=", "owner": "musikinformatik", "repo": "superdirt", - "rev": "7abb62e89649daa1232b9cbd6427241868abd30e", + "rev": "c7f32998572984705d340e7c1b9ed9ad998a39b6", "type": "github" }, "original": { "owner": "musikinformatik", - "ref": "master", "repo": "superdirt", "type": "github" } @@ -591,34 +490,19 @@ "type": "github" } }, - "systems_3": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - }, "tidal-src": { "flake": false, "locked": { - "lastModified": 1654350756, - "narHash": "sha256-tONM5SYYBca0orTLH1EUOilSC1FCluWrFt8AetUx+YQ=", + "lastModified": 1712519522, + "narHash": "sha256-LbvxQmVxHElidCgvt+w0g1k+QQbNLebK46vtRCgsLeQ=", "owner": "tidalcycles", "repo": "tidal", - "rev": "fda9c1ecb3722698935245e5409ef8ccdfca16c8", + "rev": "88f09edf6bef2228d5f530dea872b08a9d803066", "type": "github" }, "original": { "owner": "tidalcycles", - "ref": "main", + "ref": "v1.9.5", "repo": "tidal", "type": "github" } @@ -631,16 +515,15 @@ ], "superdirt-src": "superdirt-src", "tidal-src": "tidal-src", - "utils": "utils_2", "vim-tidal-src": "vim-tidal-src", "vowel-src": "vowel-src" }, "locked": { - "lastModified": 1664760044, - "narHash": "sha256-e5LGk/tDnphory1mYhADgPnVtShofY2w/3xY09jEE2A=", + "lastModified": 1723223284, + "narHash": "sha256-NAT+g5nsaJZkpR0sCZjerd1xx233ZUdRH3ZWwZhzq/c=", "owner": "mitchmindtree", "repo": "tidalcycles.nix", - "rev": "3f3a820cd43709077d15a24fa6062de7d623a6bf", + "rev": "82f3e8e8d02eb9f0c9dfe9ab3773b825c6bc1982", "type": "github" }, "original": { @@ -651,11 +534,11 @@ }, "unstable": { "locked": { - "lastModified": 1712163089, - "narHash": "sha256-Um+8kTIrC19vD4/lUCN9/cU9kcOsD1O1m+axJqQPyMM=", + "lastModified": 1723637854, + "narHash": "sha256-med8+5DSWa2UnOqtdICndjDAEjxr5D7zaIiK4pn0Q7c=", "owner": "nixos", "repo": "nixpkgs", - "rev": "fd281bd6b7d3e32ddfa399853946f782553163b5", + "rev": "c3aa7b8938b17aebd2deecf7be0636000d62a2b9", "type": "github" }, "original": { @@ -667,7 +550,7 @@ }, "utils": { "inputs": { - "systems": "systems" + "systems": "systems_2" }, "locked": { "lastModified": 1701680307, @@ -683,34 +566,18 @@ "type": "github" } }, - "utils_2": { - "locked": { - "lastModified": 1653893745, - "narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, "vim-tidal-src": { "flake": false, "locked": { - "lastModified": 1664252474, - "narHash": "sha256-hleiK2Q7xYndpB+tIbyyXIM2sk4NunUh9DPgMqmf/Wc=", + "lastModified": 1685703852, + "narHash": "sha256-8gyk17YLeKpLpz3LRtxiwbpsIbZka9bb63nK5/9IUoA=", "owner": "tidalcycles", "repo": "vim-tidal", - "rev": "b07f5c12986fb837e055d7fcf0acf3b7e248148f", + "rev": "e440fe5bdfe07f805e21e6872099685d38e8b761", "type": "github" }, "original": { "owner": "tidalcycles", - "ref": "master", "repo": "vim-tidal", "type": "github" } @@ -748,7 +615,6 @@ }, "original": { "owner": "supercollider-quarks", - "ref": "master", "repo": "vowel", "type": "github" } diff --git a/flake.nix b/flake.nix index 2508b5d..e742b53 100644 --- a/flake.nix +++ b/flake.nix @@ -3,7 +3,7 @@ inputs = { # Nixpkgs - nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11"; + nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05"; unstable.url = "github:nixos/nixpkgs/nixos-unstable"; nixos-hardware.url = "github:NixOS/nixos-hardware/master"; @@ -11,7 +11,7 @@ # ngipkgs-local.url = "path:/home/anish/usr/ngipkgs"; # Home manager - home-manager.url = "github:nix-community/home-manager/release-23.11"; + home-manager.url = "github:nix-community/home-manager/release-24.05"; home-manager.inputs.nixpkgs.follows = "nixpkgs"; hardware.url = "github:nixos/nixos-hardware"; @@ -43,15 +43,8 @@ url = "github:oxalica/rust-overlay"; inputs.nixpkgs.follows = "nixpkgs"; }; - eww = { - url = "github:elkowar/eww"; - inputs.nixpkgs.follows = "nixpkgs"; - inputs.rust-overlay.follows = "rust-overlay"; - }; tidalcycles.url = "github:mitchmindtree/tidalcycles.nix"; tidalcycles.inputs.nixpkgs.follows = "unstable"; - llamacpp.url = "github:ggerganov/llama.cpp"; - llamacpp.inputs.nixpkgs.follows = "unstable"; # TODO hundred rabbits software # TODO needs secrets # dhyan.url = "git+ssh://gitea@git.sealight.xyz/aynish/dhyan?ref=main"; @@ -76,8 +69,6 @@ , nur , tidalcycles , rust-overlay - , eww - , llamacpp , vimwikicli , ... }@inputs: @@ -94,9 +85,6 @@ unstable = unstable.legacyPackages.${prev.system}; deploy = deploy-rs.packages.${prev.system}.deploy-rs; }; - llamaOverlay = final: prev: { - llama = llamacpp.packages.${prev.system}.default; - }; vimwikiOverlay = final: prev: { vimwiki-cli = vimwikicli.packages.${prev.system}.vimwiki-cli; }; @@ -105,7 +93,7 @@ inherit system; config.allowUnfreePredicate = pkg: builtins.elem (nixpkgs.lib.getName pkg) [ "ripcord" - "VCV-Rack" + "vcv-rack" "SunVox" "renoise" ]; @@ -120,7 +108,6 @@ nur.overlay nix-matrix-appservices.overlay unstableOverlay - llamaOverlay vimwikiOverlay self.overlays.additions self.overlays.modifications @@ -198,10 +185,13 @@ agenix.nixosModules.age self.nixosModules.backup self.nixosModules.wireguard - # self.nixosModules.blogg basant.nixosModule # self.nixosModules.microbin disko.nixosModules.disko + { + nixpkgs.flake.setNixPath = false; + nixpkgs.flake.setFlakeRegistry = false; + } ]; }; diff --git a/home/profiles/cli/default.nix b/home/profiles/cli/default.nix index 7403e9f..065c836 100644 --- a/home/profiles/cli/default.nix +++ b/home/profiles/cli/default.nix @@ -130,7 +130,7 @@ programs.zsh = { enable = true; enableCompletion = true; - enableAutosuggestions = false; + autosuggestion.enable = false; initExtra = '' bindkey -v diff --git a/home/profiles/desktop/default.nix b/home/profiles/desktop/default.nix index 054289d..b685995 100644 --- a/home/profiles/desktop/default.nix +++ b/home/profiles/desktop/default.nix @@ -102,9 +102,6 @@ in ".local/bin/mpv-ify".source = ./bin/mpv-ify; ".local/bin/bspswallow".source = ./bin/bspswallow; ".config/bspwm/terminals".text = "Kitty"; - ".config/eww/eww.yuck".source = ./eww/eww.yuck; - ".config/eww/eww.scss".source = ./eww/eww.scss; - ".config/eww/widgets.yuck".source = ./eww/widgets.yuck; # ".local/bin/hotplug-monitor.sh".source = ./bin/hotplug-monitor.sh; }; @@ -126,7 +123,7 @@ in qt = { enable = true; - platformTheme = "gtk"; + platformTheme.name = "gtk"; style = { name = "qt5ct-style"; }; }; diff --git a/hosts/box/configuration.nix b/hosts/box/configuration.nix index 7d5ca7a..bdb3f92 100644 --- a/hosts/box/configuration.nix +++ b/hosts/box/configuration.nix @@ -91,7 +91,7 @@ sound.enable = false; programs.gnupg.agent.enable = true; - programs.gnupg.agent.pinentryFlavor = "curses"; + programs.gnupg.agent.pinentryPackage = pkgs.pinentry-curses; programs.gnupg.agent.enableSSHSupport = true; # This value determines the NixOS release with which your system is to be diff --git a/hosts/box/default.nix b/hosts/box/default.nix index c677617..65bb691 100644 --- a/hosts/box/default.nix +++ b/hosts/box/default.nix @@ -24,7 +24,8 @@ # ../profiles/woodpecker-agent # ../profiles/jellyfin ../profiles/ulogger-server - ../profiles/photoprism + ../profiles/photoprism # Replace with immich + ../profiles/gpodder #../profiles/postgres_upgrade_script ]; diff --git a/hosts/curve/configuration.nix b/hosts/curve/configuration.nix index 0d9fe3f..24ac9c6 100644 --- a/hosts/curve/configuration.nix +++ b/hosts/curve/configuration.nix @@ -36,5 +36,5 @@ sound.enable = true; - services.xserver.libinput.enable = true; + services.libinput.enable = true; } diff --git a/hosts/curve/default.nix b/hosts/curve/default.nix index 31d539a..26808fd 100644 --- a/hosts/curve/default.nix +++ b/hosts/curve/default.nix @@ -33,7 +33,7 @@ }; programs.gnupg.agent.enable = true; - programs.gnupg.agent.pinentryFlavor = "gnome3"; + programs.gnupg.agent.pinentryPackage = pkgs.pinentry-gnome3; fileSystems."/mnt/ftp" = { device = "192.168.1.240:/home/ftp"; diff --git a/hosts/profiles/core/default.nix b/hosts/profiles/core/default.nix index b231c53..c68fb4c 100644 --- a/hosts/profiles/core/default.nix +++ b/hosts/profiles/core/default.nix @@ -32,7 +32,7 @@ in }; environment.systemPackages = with pkgs; [ - pinentry-gnome + pinentry-gnome3 cached-nix-shell ]; diff --git a/hosts/profiles/desktop/default.nix b/hosts/profiles/desktop/default.nix index 956601a..df06c1f 100644 --- a/hosts/profiles/desktop/default.nix +++ b/hosts/profiles/desktop/default.nix @@ -77,7 +77,6 @@ in feh sxiv xkblayout-state - vcv-rack zathura calibre mpv @@ -87,7 +86,6 @@ in rofi rofimoji rofi-calc - # eww obs-studio lightdm dunst @@ -121,15 +119,15 @@ in night = 3700; }; }; + displayManager.defaultSession = "none+bspwm"; xserver = { enable = true; # TODO should be xkb.layout - layout = "us"; + xkb.layout = "us"; # xkb.variant = "dvorak"; desktopManager.wallpaper.mode = "fill"; displayManager = { # startx.enable = true; - defaultSession = "none+bspwm"; sessionCommands = '' ${pkgs.xorg.xrdb}/bin/xrdb -merge < /mnt/etc/nixos/configuration.nix <<'endmsg' sound.enable = true; hardware.pulseaudio.enable = true; - services.xserver.libinput.enable = true; + services.libinput.enable = true; # Hmmm maybe somewhere else? users.users.anish = { diff --git a/pkgs/kobopatch.nix b/pkgs/kobopatch.nix index 4b4e87e..c13fe2b 100644 --- a/pkgs/kobopatch.nix +++ b/pkgs/kobopatch.nix @@ -1,16 +1,16 @@ { lib, buildGoModule, fetchFromGitHub }: -buildGoModule rec { +buildGoModule { name = "kobopatch"; version = "0.15.0"; - vendorSha256 = "1i6srhyig4x8mywyc2l8wzzm1afvb7wxmjsr84c447sb1xss6p7x"; + vendorHash = "sha256-1i6srhyig4x8mywyc2l8wzzm1afvb7wxmjsr84c447sb1xss6p7x"; src = fetchFromGitHub { owner = "geek1011"; repo = "kobopatch"; rev = "653070c67c83ec61884854efc4f8a3132d82a2e5"; - sha256 = "09hr3zh0w0f78cx40d2yydqv0mmjdh4iwdgia7sikraphvha85nn"; + hash = "sha256-09hr3zh0w0f78cx40d2yydqv0mmjdh4iwdgia7sikraphvha85nn"; }; meta = with lib; { -- 2.51.2 From 676ed31aadd7202c357285e4833da2331a2bd66c Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Mon, 19 Aug 2024 22:16:53 -0700 Subject: [PATCH 59/78] feat(box): gpodder deployed --- flake.nix | 21 +--------- hosts/profiles/dns/default.nix | 1 + hosts/profiles/gpodder/default.nix | 12 ++++++ hosts/profiles/mossnet-hosts/default.nix | 1 + modules/nixos/gpodder2go.nix | 50 +++++++++++++----------- 5 files changed, 43 insertions(+), 42 deletions(-) diff --git a/flake.nix b/flake.nix index e742b53..60e2903 100644 --- a/flake.nix +++ b/flake.nix @@ -214,19 +214,6 @@ ]; }; - cube = nixpkgs.lib.nixosSystem rec { - specialArgs = { inherit inputs self; }; - system = "x86_64-linux"; - pkgs = litePkgsFor.${system}; - modules = [ - ./hosts/cube - agenix.nixosModules.age - self.nixosModules.backup - self.nixosModules.wireguard - basant.nixosModule - ]; - }; - box = nixpkgs.lib.nixosSystem rec { specialArgs = { inherit inputs self; }; system = "x86_64-linux"; @@ -237,6 +224,7 @@ self.nixosModules.backup self.nixosModules.wireguard self.nixosModules.gonic + self.nixosModules.gpodder2go self.nixosModules.wallabag self.nixosModules.ulogger-server grasp.nixosModule @@ -292,13 +280,6 @@ path = deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations.helix; }; }; - cube = { - hostname = "lakhwara.com"; - profiles.system = { - user = "root"; - path = deploy-rs.lib.x86_64-linux.activate.nixos self.nixosConfigurations.cube; - }; - }; }; checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks self.deploy) deploy-rs.lib; diff --git a/hosts/profiles/dns/default.nix b/hosts/profiles/dns/default.nix index 0ad0bf0..3872f14 100644 --- a/hosts/profiles/dns/default.nix +++ b/hosts/profiles/dns/default.nix @@ -39,6 +39,7 @@ let "tracks.mossnet.lan" "grasp.mossnet.lan" "photos.mossnet.lan" + "pod.mossnet.lan" ]; in diff --git a/hosts/profiles/gpodder/default.nix b/hosts/profiles/gpodder/default.nix index bc30455..af747f3 100644 --- a/hosts/profiles/gpodder/default.nix +++ b/hosts/profiles/gpodder/default.nix @@ -1,4 +1,16 @@ { services.gpodder.enable = true; networking.firewall.allowedTCPPorts = [ 3005 ]; + services.nginx.virtualHosts."pod.mossnet.lan" = { + extraConfig = "client_max_body_size 20M;"; + + locations."/" = { + extraConfig = '' + proxy_pass http://localhost:3005/; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + ''; + }; + }; } diff --git a/hosts/profiles/mossnet-hosts/default.nix b/hosts/profiles/mossnet-hosts/default.nix index 9857c69..ebb59bb 100644 --- a/hosts/profiles/mossnet-hosts/default.nix +++ b/hosts/profiles/mossnet-hosts/default.nix @@ -18,6 +18,7 @@ 192.168.1.240 tracks.mossnet.lan 192.168.1.240 grasp.mossnet.lan 192.168.1.240 photos.mossnet.lan + 192.168.1.240 pod.mossnet.lan ''; # 10.0.69.4 mossnet.lan # 10.0.69.4 links.mossnet.lan diff --git a/modules/nixos/gpodder2go.nix b/modules/nixos/gpodder2go.nix index 4621996..de25908 100644 --- a/modules/nixos/gpodder2go.nix +++ b/modules/nixos/gpodder2go.nix @@ -3,7 +3,7 @@ with lib; let - cfg = config.services.gpodder2go; + cfg = config.services.gpodder; in { options = { @@ -53,7 +53,7 @@ in Environment = [ "VERIFIER_SECRET_KEY=${cfg.VERIFIER_SECRET_KEY}" ]; - WorkingDirectory = dataFolder; + WorkingDirectory = cfg.dataFolder; TimeoutStopSec = " 20 "; KillMode = " process "; RestartSec = " 10 "; @@ -73,8 +73,8 @@ in RestrictNamespaces = " yes "; RestrictRealtime = " yes "; SystemCallFilter = "~@clock @debug @module @mount @obsolete @privileged @reboot @setuid @swap"; - ReadWritePaths = dataFolder; - StateDirectory = baseNameOf dataFolder; + ReadWritePaths = cfg.dataFolder; + StateDirectory = baseNameOf cfg.dataFolder; }; }; @@ -90,25 +90,31 @@ in users.groups = optionalAttrs (cfg.group == "gpodder") ({ gpodder = { }; }); - }; - systemd.services.gpodder-install = { - description = "gpodder install service"; - wantedBy = [ "multi-user.target" ]; - before = [ "gpodder.service" ]; - path = with pkgs; [ gpodder2go ]; - - serviceConfig = { - User = cfg.user; - Type = "oneshot"; - } // commonServiceConfig; - - script = '' - if [ ! -f "${cfg.dataFolder}/installed" ]; then - ${pkgs.gpodder2go}/bin/gpodder2go init - touch "${cfg.dataFolder}/installed" - fi - ''; + # systemd.services.gpodder-install = { + # description = "gpodder install service"; + # wantedBy = [ "multi-user.target" ]; + # before = [ "gpodder.service" ]; + # path = with pkgs; [ gpodder2go ]; + + # serviceConfig = { + # User = cfg.user; + # Type = "oneshot"; + # CacheDirectory = "gpodder"; + # # Stores sessions. + # CacheDirectoryMode = "700"; + # ConfigurationDirectory = "gpodder"; + # LogsDirectory = "gpodder"; + # StateDirectory = "gpodder"; + # }; + + # script = '' + # if [ ! -f "${cfg.dataFolder}/installed" ]; then + # ${pkgs.gpodder2go}/bin/gpodder2go init + # touch "${cfg.dataFolder}/installed" + # fi + # ''; + # }; }; } -- 2.51.2 From 6538121f1df1256ad7a5994be568bf1bdba84746 Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Mon, 19 Aug 2024 22:36:57 -0700 Subject: [PATCH 60/78] update flake.lock --- flake.lock | 8 -------- 1 file changed, 8 deletions(-) diff --git a/flake.lock b/flake.lock index 1b18334..13d0484 100644 --- a/flake.lock +++ b/flake.lock @@ -390,19 +390,11 @@ ] }, "locked": { -<<<<<<< HEAD - "lastModified": 1723852814, - "narHash": "sha256-P0mYUxYH097oG5x0n84qABgk2tQfBLznwd1TGh5vgnk=", - "ref": "main", - "rev": "8de8ac0e086187a749c719893f3aa9c460978f9a", - "revCount": 1462, -======= "lastModified": 1724050814, "narHash": "sha256-THf50ZcBPY6r7/cyvE8bxYDvrctHrWbYaMx4udr4OUM=", "ref": "main", "rev": "7628c26fd92f684ab5c7572c63de4af8b4b3a7b4", "revCount": 1464, ->>>>>>> d6d2aaa32916095c3e7e4aaafc1ffedea82095e8 "type": "git", "url": "ssh://gitea@git.sealight.xyz/aynish/kitaab" }, -- 2.51.2 From 2f93cff966d480adec17f61e1f9f746c22852fdc Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Wed, 21 Aug 2024 22:09:39 -0700 Subject: [PATCH 61/78] helix: fix gitea --- hosts/profiles/gitea/default.nix | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/hosts/profiles/gitea/default.nix b/hosts/profiles/gitea/default.nix index c29d6df..26eea47 100644 --- a/hosts/profiles/gitea/default.nix +++ b/hosts/profiles/gitea/default.nix @@ -6,8 +6,13 @@ services.forgejo = { enable = true; + user = "gitea"; + group = "gitea"; + stateDir = "/var/lib/gitea"; database = { type = "postgres"; + user = "gitea"; + name = "gitea"; passwordFile = "/run/agenix/gitea-dbpass"; }; settings = { @@ -43,6 +48,15 @@ }; }; + users.users.gitea = { + home = "/var/lib/gitea"; + useDefaultShell = true; + group = "gitea"; + isSystemUser = true; + }; + + users.groups.gitea = {}; + environment.systemPackages = [ pkgs.pandoc ]; services.postgresql = { enable = true; # Ensure postgresql is enabled -- 2.51.2 From 0f34a00a4ed434242017f0be9e706289e2754397 Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Sat, 24 Aug 2024 03:51:29 -0700 Subject: [PATCH 62/78] started nvim rewrite in fnl --- home/profiles/nvim/config/conf/formatting.fnl | 0 home/profiles/nvim/config/conf/init.fnl | 29 ++ home/profiles/nvim/config/conf/lsp.fnl | 7 + home/profiles/nvim/config/conf/mappingns.fnl | 84 ++++ home/profiles/nvim/config/conf/plugins.fnl | 3 + home/profiles/nvim/config/init.lua | 37 ++ home/profiles/nvim/config/lib/nvim.fnl | 37 ++ home/profiles/nvim/default.nix | 394 ++---------------- 8 files changed, 241 insertions(+), 350 deletions(-) create mode 100644 home/profiles/nvim/config/conf/formatting.fnl create mode 100644 home/profiles/nvim/config/conf/init.fnl create mode 100644 home/profiles/nvim/config/conf/lsp.fnl create mode 100644 home/profiles/nvim/config/conf/mappingns.fnl create mode 100644 home/profiles/nvim/config/conf/plugins.fnl create mode 100644 home/profiles/nvim/config/init.lua create mode 100644 home/profiles/nvim/config/lib/nvim.fnl diff --git a/home/profiles/nvim/config/conf/formatting.fnl b/home/profiles/nvim/config/conf/formatting.fnl new file mode 100644 index 0000000..e69de29 diff --git a/home/profiles/nvim/config/conf/init.fnl b/home/profiles/nvim/config/conf/init.fnl new file mode 100644 index 0000000..e52fb28 --- /dev/null +++ b/home/profiles/nvim/config/conf/init.fnl @@ -0,0 +1,29 @@ +(local nvim (require :lib/nvim)) + +(nvim.g :mapleader " ") + +(nvim.opt :runtimepath (.. vim.opt.runtimepath "/home/anish/.config/nvim/,")) +(nvim.opt :tabstop 2) +(nvim.opt :showmatch) +(nvim.opt :shiftwidth 2) +(nvim.opt :autoindent) +(nvim.opt :undofile) +(nvim.opt :signcolumn "auto:4") +(nvim.opt :title) +(nvim.opt :number) +(nvim.opt :nocompatible) +(nvim.opt :relativenumber) +(nvim.opt :showtabline 2) +(nvim.opt :expandtab) +(nvim.opt :autowriteall) + +(nvim.opt :lisp) ; include - in word to move better in snake-case) +(nvim.g :sexp_filetypes "clojure,scheme,lisp,janet,fennel,yuck") ; include the lisps I use + +(nvim.opt :termguicolors) +(nvim.colorscheme "ayu-mirage") + +(require :conf.plugins) +(require :conf.mappings) +(require :conf.lsp) +(require :conf.formatting) diff --git a/home/profiles/nvim/config/conf/lsp.fnl b/home/profiles/nvim/config/conf/lsp.fnl new file mode 100644 index 0000000..a9eb8fe --- /dev/null +++ b/home/profiles/nvim/config/conf/lsp.fnl @@ -0,0 +1,7 @@ + +; Set Diagnostics +; local signs = { Error = " ", Warn = " ", Hint = " ", Info = " " } +; for type, icon in pairs(signs) do +; local hl = "DiagnosticSign" .. type +; vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl}) +; end diff --git a/home/profiles/nvim/config/conf/mappingns.fnl b/home/profiles/nvim/config/conf/mappingns.fnl new file mode 100644 index 0000000..e739149 --- /dev/null +++ b/home/profiles/nvim/config/conf/mappingns.fnl @@ -0,0 +1,84 @@ +(local nvim (require :lib/nvim)) +(local wk (require :which-key)) + +(local + normal-map-leader + {"t" ["" + "Toggle neo-tree"] + "w" [":w" + "Write file"] + "q" [":q" + "Quit"] + "r" [":RainbowParenthesesToggleAll" + "Toggle Rainbow Parens"] + ; Telescope + "f" {:Name "Files" + :f ["Telescope find_files" + "Find Files (in Telescope)"] + :g ["Telescope live_grep" + "Find Grep (in Telescope)"] + :b ["Telescope buffers" + "Find Buffers"] + :h ["Telescope help_tags" + "Find Help"] + :t ["Telescope tags" + "Find Tags"] + :r ["Telescope oldfiles" + "Recent files"]} + ; Git + "g" {:Name "Git" + "s" [":G" + "Git Status"] + "f" [":G fetch --all" + "Git Fetch"] + "b" [":GBranches" + "Git Branch"] + "p" [":Git! push" + "Git Push"] + "d" [":GDiff" + "Git Diff"] + "h" ["" + "Commit Hunk under Cursor"]} + ; nmap gl :diffget //3 + ; nmap gh :diffget //2 + ; nnoremap gc :G commit -v -q %:p + ; Buffers + "b" {:Name "Buffer" + :a ["" + "Buffer Add"] + :q ["" + "Buffer Quit"] + :n ["" + "Buffer Next"] + :N [":tabp" + "Buffer Previous"] + :p [":tabp" + "Buffer Previous"]} + ; Search + "s" {:Name "Search" + :b ["Telescope current_buffer_fuzzy_find" + "Search in current buffer"] + :s ["Telescope live_grep" + "Search in project"] + :t ["TodoTelescope" + "Search TODOs in project"] + :c ["let @/ = \"\":echo 'Search highlight cleared'" + "Clear search"]} + ; Code + "c" {:Name "Code" + :d [":lua vim.lsp.buf.definition()" + "Go to Definition"] + :i [":lua require('telescope.builtin').lsp_implementation()" + "Implementation"] + :s [":lua vim.lsp.buf.signature_help()" + "Signature Help"] + :r [":Lspsaga rename" + "Rename Symbol"] + :h [":Lspsaga hover_doc" + "Hover doc"] + :o [":LSoutlineToggle" + "Outline"]} + ; Kitaab + "z" {:Name "Kitaab"}}) + +(wk.register normal-map-leader {:prefix ""}) diff --git a/home/profiles/nvim/config/conf/plugins.fnl b/home/profiles/nvim/config/conf/plugins.fnl new file mode 100644 index 0000000..d1d2a49 --- /dev/null +++ b/home/profiles/nvim/config/conf/plugins.fnl @@ -0,0 +1,3 @@ +(local nvim (require :lib/nvim)) + +(nvim.g :tidal_target "terminal") diff --git a/home/profiles/nvim/config/init.lua b/home/profiles/nvim/config/init.lua new file mode 100644 index 0000000..986fcf3 --- /dev/null +++ b/home/profiles/nvim/config/init.lua @@ -0,0 +1,37 @@ +-- A function that applies passes the output of string.format to the print +-- function +---@param string string #template string +local function fprint(string, ...) + print(string.format(string, ...)) +end + +if pcall(require, "hotpot") then + -- Setup hotpot.nvim + require("hotpot").setup({ + provide_require_fennel = true, + -- show fennel compiler results in when editing fennel files + enable_hotpot_diagnostics = true, + compiler = { + -- options passed to fennel.compile for modules, defaults to {} + modules = { + -- not default but recommended, align lua lines with fnl source + -- for more debuggable errors, but less readable lua. + correlate = true + }, + macros = { + -- allow macros to access vim global, needed for nyoom modules + env = "_COMPILER", + compilerEnv = _G, + allowGlobals = true, + }, + } + }) + -- Import neovim configuration + require("conf") +else + print("Unable to require hotpot") +end + +-- vim.cmd[[colorscheme tokyonight]] +-- -- vim.cmd[[colorscheme lumona]] +-- vim.cmd[[packadd cfilter]] diff --git a/home/profiles/nvim/config/lib/nvim.fnl b/home/profiles/nvim/config/lib/nvim.fnl new file mode 100644 index 0000000..c62cbe3 --- /dev/null +++ b/home/profiles/nvim/config/lib/nvim.fnl @@ -0,0 +1,37 @@ +(fn autocmd [events opts] + "Create autocommand" + (vim.api.nvim_create_autocmd events opts)) + +(fn clear-autocmds [opts] + "Clear autocommands" + (vim.api.nvim_clear_autocmds opts)) + +(fn augroup [name ?opts] + "Create autocommand group" + (vim.api.nvim_create_augroup name (or opts {}))) + +(fn keymap [mode lhs rhs ?opts] + "Sets a global mapping for the given mode. + Ex: `(keymap [:n :i] ...)`" + (let [string-mode (table.concat mode)] + (vim.api.nvim_set_keymap string-mode lhs rhs (or opts {})))) + +(fn opt [key value] + "Set a vim option" + (tset vim.opt key value)) + +(fn g [key value] + "Set a vim global" + (tset vim.g key value)) + +(fn colorscheme [name] + "Set the current colorscheme" + (vim.cmd (.. "colorscheme " name))) + +{: autocmd + : clear-autocmds + : augroup + : keymap + : opt + : g + : colorscheme} diff --git a/home/profiles/nvim/default.nix b/home/profiles/nvim/default.nix index a2597b1..1fb9344 100644 --- a/home/profiles/nvim/default.nix +++ b/home/profiles/nvim/default.nix @@ -1,158 +1,32 @@ { pkgs, ... }: -let - customPlugins = { - vim-zettel = pkgs.vimUtils.buildVimPlugin { - name = "vim-zettel"; - src = pkgs.fetchFromGitHub { - owner = "michal-h21"; - repo = "vim-zettel"; - rev = "929d90eec62e6f693c2702d2b6f76a93f2f1689d"; - sha256 = "1fzKmknfVlEYwqeXgbKITbb2/PJ023iJyMz6vak3qh4="; - }; - }; - lsp-format = pkgs.vimUtils.buildVimPlugin { - name = "lsp-format"; - src = pkgs.fetchFromGitHub { - owner = "lukas-reineke"; - repo = "lsp-format.nvim"; - rev = "84e117b99bb2bc0d0c8122e2b256046f046f8aff"; - sha256 = "rs3NTZwWdsmBGXnrgUeVxUiNjbN/ULxJHifPYJD9mT4="; - }; - }; - my-lspsaga = pkgs.vimUtils.buildVimPlugin { - name = "lspsaga.nvim"; - src = pkgs.fetchFromGitHub { - owner = "glepnir"; - repo = "lspsaga.nvim"; - rev = "b7b4777369b441341b2dcd45c738ea4167c11c9e"; - sha256 = "sciX/fMxzY1YOxXxjj1+ymrdMi451avcFFu+14R+/pk="; - }; - }; - nvim-luapad = pkgs.vimUtils.buildVimPlugin { - name = "nvim-luapad"; - src = pkgs.fetchFromGitHub { - owner = "rafcamlet"; - repo = "nvim-luapad"; - rev = "9815e2659ce8e2ef4b55e401531cf09b6423e0ea"; - sha256 = "gMaS5YFi3+gmUIfkCMEt9vhm8XSgv54Cquv5+WCWeTo="; - }; - }; - leap = pkgs.vimUtils.buildVimPlugin { - name = "leap"; - src = pkgs.fetchFromGitHub { - owner = "ggandor"; - repo = "leap.nvim"; - rev = "1bb1fec369b1e9ae96e6ff1b829ea9272c51f844"; - sha256 = "dH0v1D5q5OlMLA/omTDMb/taKyIgQ5VfVMYXJ609k/k="; - }; - }; - nvim-navic = pkgs.vimUtils.buildVimPlugin { - name = "nvim-navic"; - src = pkgs.fetchFromGitHub { - owner = "SmiteshP"; - repo = "nvim-navic"; - rev = "096b23e73c84a653fd317c0c10261875fa573a6d"; - sha256 = "vX7ZVJxgatIicmijehtaRvyHxk1i4gFfXrbPM/+VoFc="; - }; - }; - my-which-key-nvim = pkgs.vimUtils.buildVimPlugin { - pname = "which-key.nvim"; - version = "2022-05-04"; - src = pkgs.fetchFromGitHub { - owner = "folke"; - repo = "which-key.nvim"; - rev = "bd4411a2ed4dd8bb69c125e339d837028a6eea71"; - sha256 = "0vf685xgdb967wmvffk1pfrvbhg1jkvzp1kb7r0vs90mg8gpv1aj"; - }; - meta.homepage = "https://github.com/folke/which-key.nvim/"; - }; - scnvim = pkgs.vimUtils.buildVimPlugin { - pname = "scnvim"; - version = "2022-06-04"; - src = pkgs.fetchFromGitHub { - owner = "davidgranstrom"; - repo = "scnvim"; - rev = "746cc0db820d02a9c36b8f9ba2eac9725fa73107"; - sha256 = "kvSwS6FNUY2Ue84NhWLLcm0ldLMSp4WqQ7s6TUoX6Cc="; - }; - }; - yuck-vim = pkgs.vimUtils.buildVimPlugin { - pname = "yuck.vim"; - version = "2021-08-09"; - src = pkgs.fetchFromGitHub { - owner = "elkowar"; - repo = "yuck.vim"; - rev = "6dc3da77c53820c32648cf67cbdbdfb6994f4e08"; - sha256 = "lp7qJWkvelVfoLCyI0aAiajTC+0W1BzDhmtta7tnICE="; - }; - }; - nvim-parinfer = pkgs.vimUtils.buildVimPlugin { - pname = "nvim-parinfer"; - version = "v1.2.0"; - src = pkgs.fetchFromGitHub { - owner = "gpanders"; - repo = "nvim-parinfer"; - rev = "82bce5798993f4fe5ced20e74003b492490b4fe8"; - sha256 = "Dlzfp3CZTzq8zQeHByWf3ER6/Em+KNGYNI4Z17ui8Lc="; - }; - }; - my-marks = pkgs.vimUtils.buildVimPlugin { - pname = "marks"; - version = "2022-08-31"; - src = pkgs.fetchFromGitHub { - owner = "chentoast"; - repo = "marks.nvim"; - rev = "b27cbb78e9082229590b396d3ae4fe07f1aeafe0"; - sha256 = "XdbgIWuAHNdTfyKDrKmQVq5oSbBoi56DpwtgOqhScAk="; - }; - }; - my-fterm = pkgs.vimUtils.buildVimPlugin { - pname = "fterm"; - version = "2022-07-22"; - src = pkgs.fetchFromGitHub { - owner = "numToStr"; - repo = "FTerm.nvim"; - rev = "efd10656724a269e21ba68d65e2b058a4e606424"; - sha256 = "rR6KDwj58aYfyaSsoUy75536SdBhk394yspCUl/hzfE="; - }; - }; - my-nvim-peekup = pkgs.vimUtils.buildVimPlugin { - pname = "nvim-peekup"; - version = "0.1.0"; - src = pkgs.fetchFromGitHub { - owner = "gennaro-tedesco"; - repo = "nvim-peekup"; - rev = "73a67c1ee3b5a7ea7b42d85399bf093f428c8ee3"; - sha256 = "czKjJgCpvRSdtR7rNGlJrluDgPIdx94KUyx33op5gdY="; - }; - }; - }; +# let + # customPlugins = { + # vim-zettel = pkgs.vimUtils.buildVimPlugin { + # name = "vim-zettel"; + # src = pkgs.fetchFromGitHub { + # owner = "michal-h21"; + # repo = "vim-zettel"; + # rev = "929d90eec62e6f693c2702d2b6f76a93f2f1689d"; + # sha256 = "1fzKmknfVlEYwqeXgbKITbb2/PJ023iJyMz6vak3qh4="; + # }; + # }; + # }; + + # Thank god I don't use python anymore + # my-python-packages = python-packages: with python-packages; [ + # # other python packages you want + # ]; + # python-with-my-packages = pkgs.python3.withPackages my-python-packages; +# in - my-python-packages = python-packages: with python-packages; [ - tasklib - pynvim - six - pylsp-mypy - #pyls-isort - #pyls-black - black - isort - # other python packages you want - ]; - python-with-my-packages = pkgs.python3.withPackages my-python-packages; -in { home.sessionVariables.EDITOR = "nvim"; home.shellAliases = { k = "cd ~/kitaab/vimwiki; vim -c :VimwikiIndex; cd $OLDPWD"; # kitaab zettel kz = "cd ~/kitaab/vimwiki; vim -c :VimwikiIndex -c :ZettelNew; cd $OLDPWD"; - # kitaab recents - kr = "cd /home/anish/kitaab/vimwiki; eza --sort=modified --reverse | fzf --preview 'bat --style=numbers --color=always --terminal-width -1 ./{}';cd $OLDPWD"; # kitaab get by tagged kt = "cd /home/anish/kitaab/vimwiki; eza *_index.wiki | fzf --preview 'bat --style=numbers --color=always --terminal-width -1 ./{}';cd $OLDPWD"; - # List files that have no links in them - ku = "cd /home/anish/kitaab/;vim ./vimwiki/$(python3 poonam/main.py report --titles=false | tail -n +4 | fzf --preview 'bat --style=numbers --color=always --terminal-width -1 ./vimwiki/{}');cd $OLDPWD"; }; # Add %update to the highlight clause for vimwiki files home.file.".config/nvim/after/syntax/vimwiki.vim".text = '' @@ -167,33 +41,8 @@ in enable = true; extraConfig = '' - " so our custom files still get included - set runtimepath+=/home/anish/.config/nvim/ - set tabstop=2 - set showmatch - set shiftwidth=2 - set noexpandtab - set autoindent - set undofile - set signcolumn=auto:4 - set title - - " set foldmethod=indent " fold based on indent - set number - set nocompatible - set relativenumber - set showtabline=2 - set noexpandtab - set autowriteall - set list lcs=tab:\|\ filetype plugin on - " include - in word to move across easier in lisp / clojure - set iskeyword+=- - - set termguicolors - colorscheme ayu-mirage - " set spell set spelllang=en_gb set ignorecase @@ -215,59 +64,6 @@ in " highlight row set cursorline - let mapleader = "\" - let maplocalleader = "," - - " window - nmap wh :topleft vnew - nmap wl :botright vnew - nmap wk :topleft new - nmap wj :botright new - - " tabs - nmap rt :retab! - vmap rt :retab! - - " moving splits with vim movements. - :tnoremap h - :tnoremap j - :tnoremap k - :tnoremap l - :inoremap h - :inoremap j - :inoremap k - :inoremap l - :nnoremap h - :nnoremap j - :nnoremap k - :nnoremap l - :nnoremap "=strftime("%Y-%m-%d %H:%M") - :inoremap =strftime("%Y-%m-%d %H:%M") - :inoremap =strftime("%H:%M") - - " tidal nvim terminal - let g:tidal_target = "terminal" - - " latex - " let g:tex_flavor='latex' - " let g:vimtex_view_method='zathura' - " let g:vimtex_quickfix_mode=0 - " set conceallevel=1 - " let g:tex_conceal='abdmg' - - " telescope - " Find files using Telescope command-line sugar. - nnoremap ff Telescope find_files - nnoremap fg Telescope live_grep - nnoremap fb Telescope buffers - nnoremap fh Telescope help_tags - nnoremap ft Telescope tags - - " exit normal mode in terminal - :tnoremap - - " Sexp in Conjure (since it's fennel) - let g:sexp_filetypes = "clojure,scheme,lisp,janet,fennel,yuck" let g:conjure#filetype#fennel = "conjure.client.fennel.stdio" " we only use fennel with love; no we don't... let g:conjure#client#fennel#stdio#command = "fennel" @@ -278,10 +74,6 @@ in autocmd BufReadPost,BufNewFile c,clj,cljs RainbowParenthesesToggleAll " general commands - map t :NERDTreeToggle - map s :w - map q :q - map r :RainbowParenthesesToggleAll nnoremap :noh map Q nnoremap Y y$ @@ -319,16 +111,6 @@ in nnoremap gj :BufferPick nnoremap gq :BufferClose - " git - nnoremap ga :G fetch --all - nmap gs :G - nmap gl :diffget //3 - nmap gh :diffget //2 - nmap gb :GBranches - nnoremap gp :Git! push - nnoremap gd :Gdiff - nnoremap gc :G commit -v -q %:p - " kitaab map cz :VimwikiIndex:ZettelNew map zs :ZettelSearch @@ -338,100 +120,16 @@ in map wt :VimwikiMakeTomorrowDiaryNote map wd :VimwikiMakeYesterdayDiaryNote map zm :ZenMode:setlocal nospell - let g:vimwiki_list = [{ 'path': '~/kitaab/vimwiki', 'auto_tags': 1, 'auto_diary_index': 1, 'auto_generate_links': 1 }] + let g:vimwiki_list = [{ 'path': '~/kitaab/vimwiki', 'auto_tags': 1, 'auto_diary_index': 1, 'auto_generate_links': 0, 'nested_syntaxes': {'python': 'python', 'c++': 'cpp', 'nix': 'nix', 'bash': 'sh'} }] let g:sync_taskwarrior = 0 let g:zettel_format = "%y%m%d-%H%M" - let g:vimwiki_list = [{'path': '~/kitaab/vimwiki', 'nested_syntaxes': {'python': 'python', 'c++': 'cpp', 'nix': 'nix', 'bash': 'sh'}}] - - let g:mapleader="\" - - " fzf - " not sure we even use this - let g:fzf_layout = { 'window': { 'width': 0.8, 'height': 0.8 } } - - " lsp commands - nnoremap vgd :lua vim.lsp.buf.definition() - nnoremap vi :lua require('telescope.builtin').lsp_implementation() - nnoremap vsh :lua vim.lsp.buf.signature_help() - nnoremap vrr :lua require('telescope.builtin').lsp_references() - " nnoremap vrn :lua vim.lsp.buf.rename() - " nnoremap vh :lua vim.lsp.buf.hover() - " nnoremap vca :lua vim.lsp.buf.code_action() - " nnoremap vsd :lua vim.lsp.util.show_line_diagnostics() - " nnoremap vn :lua vim.lsp.diagnostic.goto_next() - " nnoremap va :lua require('telescope.builtin').lsp_code_actions(require('telescope.themes').get_cursor()) - " lspsaga stuff doesn't work - nnoremap vd :Lspsaga peek_definition - nnoremap vrn :Lspsaga rename - nnoremap vh :Lspsaga hover_doc - nnoremap vca :Lspsaga code_action - nnoremap vsd :Lspsaga show_line_diagnostics - nnoremap vs :Dasht - nnoremap vn :Lspsaga diagnostic_jump_prev - nnoremap vo :LSoutlineToggle - - " dashboard - let g:dashboard_custom_header = [ - \' ', - \' ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣤⣦⠀⠀⠀⠀⠀⠀⠀⠀⠀⣤⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀', - \'⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⣿⡆⠀⠀⠀⠀⠀⠀⠀⠀⣿⠁⠀⠀⠀⠀⠀⠀⠀⢠⣿⣶⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ', - \'⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢹⣧⠀⠀⠀⠀⠀⠀⠀⠀⢻⠀⠀⠀⠀⠀⠀⠀⠀⣸⣿⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ', - \'⠀⠀⠀⠀⠀⠀⠀⢴⣷⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢻⡀⠀⠀⠀⠀⠀⠀⠀⠘⠀⠀⠀⠀⠀⠀⠀⠀⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⣿⡆⠀⠀⠀⠀⠀⠀ ', - \'⠀⠀⠀⠀⠀⠀⠀⠈⢿⣧⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⠂⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠋⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣿⠟⠉⠀⠀⠀⠀⠀⠀⠀ ', - \'⠀⠀⠀⠀⠀⠀⠀⠀⠀⠻⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠶⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ', - \'⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ', - \'⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ', - \'⠀⠀⠀⠀⠀⠀⠀⢀⣀⡤⠤⠤⠖⣒⠒⡖⠲⡦⣤⣄⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣤⣤⣤⣤⣤⣀⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ', - \'⠀⠀⠀⠀⠀⣠⢶⠉⠩⢀⣠⡤⠤⠯⠬⠥⣼⣅⡃⠸⠉⠛⡷⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣤⢶⢻⢻⢹⣃⣨⣧⣤⣴⣹⣉⠛⢶⣄⠀⠀⠀⠀⠀⠀ ', - \'⠀⠀⠀⣰⠞⠁⢈⡤⠚⠉⠀⠀⠘⣆⡀⠀⡀⠀⠉⠙⠲⢼⣰⢡⣟⢶⣄⠀⠀⠀⠀⠀⠀⠀⢀⣠⠶⡟⣇⣺⠾⠋⠉⠁⠀⠀⠀⠀⠀⠉⠙⠳⢿⣷⣄⠀⠀⠀⠀ ', - \'⠀⢀⡼⡁⢸⣰⠏⠀⠀⠀⠀⠀⠀⠘⡞⠀⠀⠀⠀⠀⠀⠀⠉⠻⣿⡞⡼⣷⣄⠀⠀⠀⣠⣾⠛⠄⣷⠟⠋⠀⠀⠀⠀⠀⠀⠀⢀⣀⠀⠀⠀⢠⠀⠈⠻⣧⠀⠀⠀ ', - \'⠀⡼⠁⢀⡼⠁⠀⠀⠀⣀⠤⠖⠛⠛⠛⠛⠓⠲⠤⣄⡀⠀⠀⠀⠀⠻⢷⣿⣿⣷⣤⣾⠹⢌⡷⠛⠁⠀⠀⠀⠀⣀⡤⠔⠛⠉⠉⠈⠉⠛⠲⣄⣇⠀⠀⠙⣷⠀⠀ ', - \'⢰⠷⣀⡜⠁⠀⠀⢀⠞⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉⠲⣤⡀⢀⡤⠚⢻⣿⣿⢣⢈⡴⠋⠀⠀⠀⠀⣠⠔⠋⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⢻⡇⠀⠀⠘⣇⠀ ', - \'⣾⣇⣹⢃⡀⠀⢀⡏⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢿⣷⣾⣞⡇⢹⡼⠋⠀⠀⠀⢠⡴⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢹⠀⠀⠀⢹⠀ ', - \'⢹⢀⣿⠘⡇⠀⢸⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡴⢟⢱⢹⡾⠋⠀⠀⠀⣠⣾⣿⣦⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⠀⠀⠀⢸⡀ ', - \'⢸⣅⣯⠀⣆⠀⢸⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡴⢻⣹⢸⡼⠋⠀⠀⠀⢀⡼⢻⣻⣿⡽⡹⠳⢤⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡾⠀⠀⠀⢸⠀ ', - \'⠈⣿⣿⡀⠘⠀⠈⣿⣤⣀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣤⢾⢻⢿⣿⠟⠋⠀⠀⠀⠀⣠⣟⠘⣿⡏⠋⠻⢥⣃⡎⣽⠻⢦⣄⣀⠀⠀⠀⠀⠀⣀⡴⣾⠃⠀⠀⠀⡼⠀ ', - \'⠀⠙⣎⣧⠀⠀⠀⠈⢻⣍⠓⠲⣶⣶⣶⣶⡖⢋⣿⣏⡧⠞⠋⠁⠀⠀⠀⢀⣤⠞⠁⠈⠻⣷⣧⠀⡀⠀⠉⠓⢧⣇⢰⢈⠙⢻⠒⡖⢲⠚⣍⡴⠃⠀⠀⠀⣴⠃⠀ ', - \'⠀⠀⠙⢾⣷⡀⠀⠀⠀⠈⠙⠓⠾⠿⠾⠿⠿⠚⠉⠁⠀⠀⠀⠀⠀⣠⡴⠛⠁⠀⠀⠀⠀⠀⠙⠷⣝⠣⠀⠀⠀⠈⠉⠒⠶⠾⠤⠧⠼⠚⠉⠀⠀⠀⢀⡴⠃⠀⠀ ', - \'⠀⠀⠀⠀⠙⠿⣦⣀⠀⠀⠀⠀⠀⡄⠀⠀⠀⠀⠀⠀⠀⢀⣠⡴⠞⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠛⠶⣄⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠄⢀⡴⠟⠁⠀⠀⠀ ', - \'⠀⠀⠀⠀⠀⠀⠀⠈⠛⠒⠤⠤⣄⣀⣀⣀⣠⠤⠤⠶⠛⠋⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠉⠛⠒⠦⠤⢤⣀⣀⣠⡤⠤⠟⠋⠀⠀⠀⠀⠀⠀ ', - \'⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ', - \'⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⡆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠸⣆⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ', - \'⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⡶⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⢷⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ', - \'⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⡾⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠻⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀ ', - \'⠀⠀⠀⠀⠀⠀⢀⣴⡾⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢹⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⢿⣦⣀⠀⠀⠀⠀⠀⠀ ', - \'⠀⠀⠀⠀⠀⠘⠻⠋⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣴⠏⠀⠀⠀⠀⠀⠀⠀⠀⠰⡆⠀⠀⠀⠀⠀⠀⠀⠀⠹⣦⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠽⠟⠁⠀⠀⠀⠀⠀ ', - \'⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣼⠟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠙⣷⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ', - \'⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⠿⠂⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ', - \'⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠹⠓⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ', - \] - let g:dashboard_default_executive = 'telescope' - nmap ss :SessionSave - nmap sl :SessionLoad - " nnoremap fh :DashboardFindHistory - " nnoremap fm :DashboardJumpMark - " nnoremap cn :DashboardNewFile - autocmd FileType dashboard set showtabline=0 | autocmd WinLeave set showtabline=2 - let g:dashboard_custom_footer = ["Run wild"] - let g:dashboard_custom_section={ - \ 'create_zettel': { - \ 'description': [' Create Zettel SPC c z'], - \ 'command': ':VimwikiIndex' }, - \ 'load_session': { - \ 'description': [' Load Session SPC s l'], - \ 'command': 'SessionLoad' } - \ } + let g:scnvim_snippet_format = "luasnip" " lua config lua <', 'lua require("FTerm").toggle()', opts) - map('t', '', 'lua require("FTerm").toggle()', opts) + map('t', '', 'lua require("FTerm").toggle()', opts) -- Custom functions function update_date() @@ -853,20 +551,16 @@ in EOF ''; - extraPackages = with pkgs // customPlugins; [ + extraPackages = with pkgs; [ # used to compile tree-sitter grammar - python-with-my-packages + # python-with-my-packages nodejs clojure-lsp clojure - nil - terraform-lsp - rust-analyzer clj-kondo - zls + terraform-lsp gopls gcc - nodePackages_latest.pyright shellcheck proselint statix @@ -874,47 +568,47 @@ in nodePackages.typescript-language-server luajitPackages.lua-lsp fennel-ls + starpls-bin ]; - plugins = with pkgs.vimPlugins // customPlugins; [ + plugins = with pkgs.vimPlugins; [ # ui lualine-nvim fzf-vim - nerdtree - neovim-ayu - rainbow_parentheses-vim - vim-surround vim-devicons nvim-web-devicons - undotree telescope-nvim plenary-nvim nvim-navic - (nvim-treesitter.withPlugins (p: [ p.nix p.clojure p.python p.fennel p.lua p.html p.css p.regex p.supercollider p.beancount p.markdown p.glsl p.yaml p.toml p.dockerfile p.json ])) - nvim-treesitter-context - my-fterm + fterm barbar-nvim + + # TODO + # neotree + neovim-ayu + rainbow_parentheses-vim + vim-surround + undotree + + (nvim-treesitter.withPlugins (p: [ p.nix p.clojure p.fennel p.lua p.html p.css p.regex p.supercollider p.beancount p.markdown p.glsl p.yaml p.toml p.dockerfile p.json ])) + nvim-treesitter-context auto-session - my-marks which-key-nvim - nvim-peekup zen-mode-nvim twilight-nvim - my-lspsaga + + # TODO remove? vim-dasht # language vim-nix - vim-elixir emmet-vim csv-vim direnv-vim - zig-vim conjure # kitaab stuff vimwiki - taskwiki vim-zettel hologram-nvim @@ -926,6 +620,7 @@ in cmp-nvim-lsp cmp-treesitter nvim-lsp-ts-utils + lspsaga cmp-conjure cmp-buffer cmp-path @@ -956,13 +651,12 @@ in vim-beancount # vimtex # custom - yuck-vim nvim-parinfer # vim-processing ]; - withPython3 = true; - extraPython3Packages = pkgs: with pkgs; [ tasklib six ]; - vimAlias = true; + # withPython3 = true; + # extraPython3Packages = pkgs: with pkgs; [ tasklib six ]; + # vimAlias = true; }; } -- 2.51.2 From d623b212349aa720ac1b452673d6cd4b654b3f9f Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Sun, 25 Aug 2024 00:46:03 -0700 Subject: [PATCH 63/78] nvim: tested fnl install, working fterm --- home/profiles/nvim/config/conf/plugins.fnl | 3 - .../nvim/config/{ => fnl}/conf/formatting.fnl | 0 .../nvim/config/{ => fnl}/conf/init.fnl | 22 +- .../nvim/config/{ => fnl}/conf/lsp.fnl | 0 .../mappingns.fnl => fnl/conf/mappings.fnl} | 34 +- home/profiles/nvim/config/fnl/conf/music.fnl | 0 .../profiles/nvim/config/fnl/conf/plugins.fnl | 22 + .../nvim/config/{ => fnl}/lib/nvim.fnl | 0 home/profiles/nvim/config/init.lua | 11 - home/profiles/nvim/default.nix | 1032 ++++++++--------- 10 files changed, 571 insertions(+), 553 deletions(-) delete mode 100644 home/profiles/nvim/config/conf/plugins.fnl rename home/profiles/nvim/config/{ => fnl}/conf/formatting.fnl (100%) rename home/profiles/nvim/config/{ => fnl}/conf/init.fnl (50%) rename home/profiles/nvim/config/{ => fnl}/conf/lsp.fnl (100%) rename home/profiles/nvim/config/{conf/mappingns.fnl => fnl/conf/mappings.fnl} (72%) create mode 100644 home/profiles/nvim/config/fnl/conf/music.fnl create mode 100644 home/profiles/nvim/config/fnl/conf/plugins.fnl rename home/profiles/nvim/config/{ => fnl}/lib/nvim.fnl (100%) diff --git a/home/profiles/nvim/config/conf/plugins.fnl b/home/profiles/nvim/config/conf/plugins.fnl deleted file mode 100644 index d1d2a49..0000000 --- a/home/profiles/nvim/config/conf/plugins.fnl +++ /dev/null @@ -1,3 +0,0 @@ -(local nvim (require :lib/nvim)) - -(nvim.g :tidal_target "terminal") diff --git a/home/profiles/nvim/config/conf/formatting.fnl b/home/profiles/nvim/config/fnl/conf/formatting.fnl similarity index 100% rename from home/profiles/nvim/config/conf/formatting.fnl rename to home/profiles/nvim/config/fnl/conf/formatting.fnl diff --git a/home/profiles/nvim/config/conf/init.fnl b/home/profiles/nvim/config/fnl/conf/init.fnl similarity index 50% rename from home/profiles/nvim/config/conf/init.fnl rename to home/profiles/nvim/config/fnl/conf/init.fnl index e52fb28..ab48e1b 100644 --- a/home/profiles/nvim/config/conf/init.fnl +++ b/home/profiles/nvim/config/fnl/conf/init.fnl @@ -2,22 +2,22 @@ (nvim.g :mapleader " ") -(nvim.opt :runtimepath (.. vim.opt.runtimepath "/home/anish/.config/nvim/,")) +; (nvim.opt :runtimepath (.. vim.opt.runtimepath "/home/anish/.config/nvim/,")) (nvim.opt :tabstop 2) -(nvim.opt :showmatch) +(nvim.opt :showmatch true) (nvim.opt :shiftwidth 2) -(nvim.opt :autoindent) -(nvim.opt :undofile) +(nvim.opt :autoindent true) +(nvim.opt :undofile true) (nvim.opt :signcolumn "auto:4") -(nvim.opt :title) -(nvim.opt :number) -(nvim.opt :nocompatible) -(nvim.opt :relativenumber) +(nvim.opt :title true) +(nvim.opt :number true) +; (nvim.opt :nocompatible) +(nvim.opt :relativenumber true) (nvim.opt :showtabline 2) -(nvim.opt :expandtab) -(nvim.opt :autowriteall) +(nvim.opt :expandtab true) +(nvim.opt :autowriteall true) -(nvim.opt :lisp) ; include - in word to move better in snake-case) +(nvim.opt :lisp true) ; include - in word to move better in snake-case) (nvim.g :sexp_filetypes "clojure,scheme,lisp,janet,fennel,yuck") ; include the lisps I use (nvim.opt :termguicolors) diff --git a/home/profiles/nvim/config/conf/lsp.fnl b/home/profiles/nvim/config/fnl/conf/lsp.fnl similarity index 100% rename from home/profiles/nvim/config/conf/lsp.fnl rename to home/profiles/nvim/config/fnl/conf/lsp.fnl diff --git a/home/profiles/nvim/config/conf/mappingns.fnl b/home/profiles/nvim/config/fnl/conf/mappings.fnl similarity index 72% rename from home/profiles/nvim/config/conf/mappingns.fnl rename to home/profiles/nvim/config/fnl/conf/mappings.fnl index e739149..b21806a 100644 --- a/home/profiles/nvim/config/conf/mappingns.fnl +++ b/home/profiles/nvim/config/fnl/conf/mappings.fnl @@ -1,9 +1,21 @@ (local nvim (require :lib/nvim)) (local wk (require :which-key)) +;; Convenient way to indent stuff in visual mode +(nvim.keymap [:v] "<" "" ">gv" {:noremap true}) +(nvim.keymap [:n] "" "" {:noremap true :silent true}) + +(vim.api.nvim_create_user_command "FTermToggle" (fn [_] + ((-> (require :FTerm) + (. :toggle)))) + {:bang true}) +(nvim.keymap [:t] "" ":FTermToggle") +(nvim.keymap [:n] "" ":FTermToggle" {:nnoremap true}) + (local normal-map-leader - {"t" ["" + {"t" [":Neotree toggle" "Toggle neo-tree"] "w" [":w" "Write file"] @@ -12,7 +24,7 @@ "r" [":RainbowParenthesesToggleAll" "Toggle Rainbow Parens"] ; Telescope - "f" {:Name "Files" + "f" {:name "Files" :f ["Telescope find_files" "Find Files (in Telescope)"] :g ["Telescope live_grep" @@ -26,16 +38,16 @@ :r ["Telescope oldfiles" "Recent files"]} ; Git - "g" {:Name "Git" + "g" {:name "Git" "s" [":G" "Git Status"] - "f" [":G fetch --all" + "f" [":G fetch --all" "Git Fetch"] - "b" [":GBranches" + "b" [":GBranches" "Git Branch"] - "p" [":Git! push" + "p" [":Git! push" "Git Push"] - "d" [":GDiff" + "d" [":GDiff" "Git Diff"] "h" ["" "Commit Hunk under Cursor"]} @@ -43,7 +55,7 @@ ; nmap gh :diffget //2 ; nnoremap gc :G commit -v -q %:p ; Buffers - "b" {:Name "Buffer" + "b" {:name "Buffer" :a ["" "Buffer Add"] :q ["" @@ -55,7 +67,7 @@ :p [":tabp" "Buffer Previous"]} ; Search - "s" {:Name "Search" + "s" {:name "Search" :b ["Telescope current_buffer_fuzzy_find" "Search in current buffer"] :s ["Telescope live_grep" @@ -65,7 +77,7 @@ :c ["let @/ = \"\":echo 'Search highlight cleared'" "Clear search"]} ; Code - "c" {:Name "Code" + "c" {:name "Code" :d [":lua vim.lsp.buf.definition()" "Go to Definition"] :i [":lua require('telescope.builtin').lsp_implementation()" @@ -79,6 +91,6 @@ :o [":LSoutlineToggle" "Outline"]} ; Kitaab - "z" {:Name "Kitaab"}}) + "z" {:name "Kitaab"}}) (wk.register normal-map-leader {:prefix ""}) diff --git a/home/profiles/nvim/config/fnl/conf/music.fnl b/home/profiles/nvim/config/fnl/conf/music.fnl new file mode 100644 index 0000000..e69de29 diff --git a/home/profiles/nvim/config/fnl/conf/plugins.fnl b/home/profiles/nvim/config/fnl/conf/plugins.fnl new file mode 100644 index 0000000..c2f7003 --- /dev/null +++ b/home/profiles/nvim/config/fnl/conf/plugins.fnl @@ -0,0 +1,22 @@ +(local nvim (require :lib/nvim)) + +(nvim.g :tidal_target "terminal") + +(local navic (require :nvim-navic)) + +(let [lualine (require :lualine)] + (lualine.setup {:options {:theme "ayu"} + :sections {:lualine_c [:filename {1 navic.get_location + :cond navic.is_available}] + :lualine_y [(fn [] + (let [msg "No Active Lsp" + buf_ft (vim.api.nvim_buf_get_option 0 "filetype") + clients (vim.lsp.get_active_clients)] + (if (= (next clients) nil) msg) + (each [_ client (ipairs clients)] + (let [filetypes (. client :config :filetypes)] + (if (and filetypes (vim.fn.index filetypes buf_ft)) client.name))) + msg))] + :lualine_x [:filetype]}})) + +(require :neo-tree) diff --git a/home/profiles/nvim/config/lib/nvim.fnl b/home/profiles/nvim/config/fnl/lib/nvim.fnl similarity index 100% rename from home/profiles/nvim/config/lib/nvim.fnl rename to home/profiles/nvim/config/fnl/lib/nvim.fnl diff --git a/home/profiles/nvim/config/init.lua b/home/profiles/nvim/config/init.lua index 986fcf3..b0bbd64 100644 --- a/home/profiles/nvim/config/init.lua +++ b/home/profiles/nvim/config/init.lua @@ -1,10 +1,3 @@ --- A function that applies passes the output of string.format to the print --- function ----@param string string #template string -local function fprint(string, ...) - print(string.format(string, ...)) -end - if pcall(require, "hotpot") then -- Setup hotpot.nvim require("hotpot").setup({ @@ -31,7 +24,3 @@ if pcall(require, "hotpot") then else print("Unable to require hotpot") end - --- vim.cmd[[colorscheme tokyonight]] --- -- vim.cmd[[colorscheme lumona]] --- vim.cmd[[packadd cfilter]] diff --git a/home/profiles/nvim/default.nix b/home/profiles/nvim/default.nix index 1fb9344..65182a5 100644 --- a/home/profiles/nvim/default.nix +++ b/home/profiles/nvim/default.nix @@ -40,517 +40,512 @@ programs.neovim = { enable = true; - extraConfig = '' - filetype plugin on - - " set spell - set spelllang=en_gb - set ignorecase - set smartcase - set incsearch - " if hidden is not set, TextEdit might fail. - set hidden - " Some servers have issues with backup files, see #649 - set nobackup - set nowritebackup - " Better display for messages - set cmdheight=2 - " You will have bad experience for diagnostic messages when it's default 4000. - set updatetime=300 - " don't give |ins-completion-menu| messages. - set shortmess+=c - " always show signcolumns - set signcolumn=yes - " highlight row - set cursorline - - let g:conjure#filetype#fennel = "conjure.client.fennel.stdio" - " we only use fennel with love; no we don't... - let g:conjure#client#fennel#stdio#command = "fennel" - " let g:conjure#extract#tree_sitter#enabled = true - map lt :ConjureLogToggle - - let g:rainbow_active = 0 - autocmd BufReadPost,BufNewFile c,clj,cljs RainbowParenthesesToggleAll - - " general commands - nnoremap :noh - map Q - nnoremap Y y$ - nnoremap n :vnew - " center moving - nnoremap n nzzzv - nnoremap N Nzzzv - nnoremap J mzJ'z - " undo points - inoremap , ,u - inoremap . .u - inoremap ? ?u - inoremap ! !u - inoremap ) )u - inoremap [ [u - inoremap ] ]u - inoremap { {u - inoremap ( (u - inoremap } }u - " moving text - vnoremap J :m '>+1gv=gv - vnoremap K :m '>-2gv=gv - inoremap :m .+1== - inoremap :m .-2== - nnoremap j :m .+1== - nnoremap k :m .-2== - " Pasting - :map sy :!xclip -i - :vmap sy "*y - :map sp :r!xclip -o - - " barbar - nnoremap gT :BufferPrevious - nnoremap gt :BufferNext - nnoremap gj :BufferPick - nnoremap gq :BufferClose - - " kitaab - map cz :VimwikiIndex:ZettelNew - map zs :ZettelSearch - map zn :ZettelNew - map zo :ZettelOpen - map zf :Telescope oldfiles only_cwd=true - map wt :VimwikiMakeTomorrowDiaryNote - map wd :VimwikiMakeYesterdayDiaryNote - map zm :ZenMode:setlocal nospell - let g:vimwiki_list = [{ 'path': '~/kitaab/vimwiki', 'auto_tags': 1, 'auto_diary_index': 1, 'auto_generate_links': 0, 'nested_syntaxes': {'python': 'python', 'c++': 'cpp', 'nix': 'nix', 'bash': 'sh'} }] - let g:sync_taskwarrior = 0 - let g:zettel_format = "%y%m%d-%H%M" - - - let g:scnvim_snippet_format = "luasnip" - - - " lua config - lua <vt', ':call v:lua.toggle_diagnostics()', {noremap = true, silent = true}) - - -- autopairs - require('nvim-autopairs').setup{} - - -- marks - require('marks').setup{} - - -- Setup nvim-cmp. - local has_words_before = function() - local line, col = unpack(vim.api.nvim_win_get_cursor(0)) - return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil - end - - local luasnip = require("luasnip") - local lspkind = require("lspkind") - local cmp = require('cmp') - local cmp_autopairs = require('nvim-autopairs.completion.cmp') - local t = function(str) - return vim.api.nvim_replace_termcodes(str, true, true, true) - end - local check_back_space = function() - local col = vim.fn.col(".") - 1 - return col == 0 or vim.fn.getline("."):sub(col, col):match("%s") ~= nil - end - cmp.setup { - formatting = { - format = lspkind.cmp_format({ - mode = 'symbol_text', - maxwidth = 50, - }) - }, - mapping = { - [''] = cmp.mapping.select_prev_item(), - [''] = cmp.mapping.select_next_item(), - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.scroll_docs(4), - [''] = cmp.mapping.complete(), - [''] = cmp.mapping.close(), - [''] = cmp.mapping.confirm({ - behavior = cmp.ConfirmBehavior.Insert, - select = true - }), - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - elseif luasnip.expand_or_jumpable() then - luasnip.expand_or_jump() - elseif has_words_before() then - cmp.complete() - else - fallback() - end - end, {"i", "s"}), - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item() - elseif luasnip.jumpable(-1) then - luasnip.jump(-1) - else - fallback() - end - end, { "i", "s" }), - }, - snippet = { - expand = function(args) - require'luasnip'.lsp_expand(args.body) - end - }, - sources = { - {name = 'buffer'}, {name = 'nvim_lsp'}, - {name = "look"}, {name = "path"}, - {name = "calc"}, {name = "spell"}, - {name = 'cmp-conjure'}, {name = "luasnip"}, - {name = 'tags'} - }, - completion = {completeopt = 'menu,menuone,noinsert'} - } - cmp.event:on( 'confirm_done', cmp_autopairs.on_confirm_done({ map_char = { tex = ' ' } })) - require("luasnip.loaders.from_vscode").lazy_load() - - -- null-ls - -- being very janky - local null_ls = require("null-ls") - null_ls.setup({ - sources = { - null_ls.builtins.diagnostics.shellcheck, - null_ls.builtins.diagnostics.proselint.with({ filetypes = { "vimwiki", "mail", }, }), - null_ls.builtins.diagnostics.commitlint, - null_ls.builtins.diagnostics.jsonlint, - -- null_ls.builtins.code_actions.statix, - -- null_ls.builtins.diagnostics.clj_kondo, - -- null_ls.builtins.formatting.isort, - -- null_ls.builtins.formatting.black, - }, - }) - - -- Setup lspconfig - require("lsp-format").setup {} - require("nvim-navic").setup {} - local format = require("lsp-format") - local navic = require("nvim-navic") - - -- lspsaga, code_action lightbulb is annoying - local saga = require('lspsaga') - saga.init_lsp_saga({ - border_style = "rounded", - code_action_icon = "", - code_action_num_shortcut = true, - code_action_lightbulb = { - enable = false, - enable_in_insert = false, - cache_code_action = true, - sign = true, - update_time = 150, - sign_priority = 20, - virtual_text = false, - }, - code_action_keys = { - quit = 'q', - exec = '', - }, - -- show outline - show_outline = { - win_position = 'right', - --set special filetype win that outline window split.like NvimTree neotree - -- defx, db_ui - auto_enter = true, - auto_preview = true, - virt_text = '┃', - jump_key = 'o', - -- auto refresh when change buffer - auto_refresh = true, - }, - }) - - capabilities = require('cmp_nvim_lsp').default_capabilities() - - -- fennel-ls is bleeding edge - local lspconfig = require('lspconfig') - require("lspconfig.configs")["fennel-ls"] = { - default_config = { - cmd = {"fennel-ls"}, - filetypes = {"fennel"}, - root_dir = function(dir) return lspconfig.util.find_git_ancestor(dir) end, - settings = {} - } - } - - local servers = { 'clojure_lsp', 'terraform_lsp', 'zls', 'pyright', 'rust_analyzer', 'tsserver', 'lua_ls', 'nil_ls', 'gopls'} - for _, lsp in ipairs(servers) do - lspconfig[lsp].setup { - on_attach = function(client, bufnr) - format.on_attach(client) - navic.attach(client, bufnr) - end, - capabilities = capabilities, - } - end - - -- fennel-ls doesn't support gps - lspconfig['fennel-ls'].setup { - on_attach = function(client, bufnr) - format.on_attach(client) - end, - capabilities = capabilities, - } - - -- deprecated pylsp - -- require('lspconfig').pylsp.setup { - -- on_attach = function(client, bufnr) - -- format.on_attach(client) - -- navic.attach(client, bufnr) - -- end, - -- capabilities = capabilities, - -- settings = { - -- pylsp = { - -- configurationSources = { "flake8", "mypy", "black" }, - -- plugins = { - -- black = {enabled = true}, - -- jedi_signature_help = {enabled = true}, - -- jedi_completion = { include_params = true }, - -- pylsp_mypy={ enabled = true }, - -- pycodestyle={ - -- enabled=true, - -- ignore={'E501', 'E231'}, - -- maxLineLength=120, - -- }, - -- }, - -- }, - -- }, - -- } - - require('gitsigns').setup { sign_priority=80 } - - -- treesitter - require('nvim-treesitter.configs').setup { - -- parser_install_dir = "~/.local/share/nvim/site/parser/", - -- ensure_installed={'nix', 'clojure', 'python', 'fennel', 'lua', 'html', 'css', 'regex', 'supercollider', 'beancount', 'janet'}, - highlight = { enabled = true, additional_vim_regex_highting = true, }, - textobjects = { enabled = true }, - } - -- 'glsl' needs c++ compiler lol - - -- lualine - local navic = require("nvim-navic") - require('lualine').setup { - options = { theme = 'ayu' }, - sections = { - lualine_c = { - 'filename', { navic.get_location, condition=navic.is_available }, - }, - lualine_y = { - function() - local msg = 'No Active Lsp' - local buf_ft = vim.api.nvim_buf_get_option(0, 'filetype') - local clients = vim.lsp.get_active_clients() - if next(clients) == nil then - return msg - end - for _, client in ipairs(clients) do - local filetypes = client.config.filetypes - if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then - return client.name - end - end - return msg - end - }, - lualine_x = {'filetype'} - } - } - - -- nvim-lint - -- require('lint').linters_by_ft = { - -- markdown = {'vale'}, - -- } - - -- f_term - local map = vim.api.nvim_set_keymap - local opts = { noremap = true, silent = true } - map('n', '', 'lua require("FTerm").toggle()', opts) - map('t', '', 'lua require("FTerm").toggle()', opts) - - -- Custom functions - function update_date() - local time = os.date("%Y-%m-%d %H:%M") - local message = "%update " .. time - local lines = vim.api.nvim_buf_get_lines(0, 0,4,false) - for i=1,4,1 do - if (lines[i]:len() == 0) then - vim.api.nvim_buf_set_lines(0, i-1, i, false, {message, ""}) - return - end - end - if (lines[4]:len() ~= 0) then - vim.api.nvim_buf_set_lines(0, 3, 4, false, {message}) - end - return - end - - vim.api.nvim_create_autocmd( - "BufWritePre", - { pattern = { "*.wiki" }, callback = update_date} - ) - - -- set spelling for text files - vim.api.nvim_create_autocmd( - { "BufRead", "BufNewFile" }, - { pattern = { "*.wiki", "*.txt", "*.md", "*.tex" }, - command = "setlocal spell" } - ) - vim.api.nvim_create_autocmd( - "FileType", - { pattern = { "mail" }, - command = "setlocal spell" } - ) - - -- auto session - require('auto-session').setup { - log_level = 'info', - auto_session_suppress_dirs = {'~/'} - } - vim.o.sessionoptions="blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal" - - require("which-key").setup{} - require('leap').set_default_keymaps() - - -- supercollider - local scnvim = require 'scnvim' - local map = scnvim.map - local map_expr = scnvim.map_expr - scnvim.setup { - keymaps = { - ['e'] = map('editor.send_line', {'i', 'n'}), - ['s'] = map_expr('CmdPeriod.run', {'i', 'n'}), - ['t'] = { - map('editor.send_block', {'i', 'n'}), - map('editor.send_selection', 'x'), - }, - [''] = map('postwin.toggle'), - [''] = map('postwin.toggle', 'i'), - [''] = map('postwin.clear', {'n', 'i'}), - [''] = map('signature.show', {'n', 'i'}), - [''] = map('sclang.hard_stop', {'n', 'x', 'i'}), - ['st'] = map('sclang.start'), - ['sk'] = map('sclang.recompile'), - [''] = map_expr('s.boot'), - [''] = map_expr('s.meter'), - } - } - -- You gotta run :SCNvimGenerateAssets for this first - -- require("luasnip").add_snippets("supercollider", require("scnvim/utils").get_snippets()) - - -- zen mode - require('zen-mode').setup{ - window = { - backdrop = 1.0, -- shade the backdrop of the Zen window. Set to 1 to keep the same as Normal - -- height and width can be: - -- * an absolute number of cells when > 1 - -- * a percentage of the width / height of the editor when <= 1 - -- * a function that returns the width or the height - width = 120, -- width of the Zen window - height = 1, -- height of the Zen window - -- by default, no options are changed for the Zen window - -- uncomment any of the options below, or add other vim.wo options you want to apply - options = { - signcolumn = "no", -- disable signcolumn - number = false, -- disable number column - relativenumber = false, -- disable relative numbers - cursorline = false, -- disable cursorline - cursorcolumn = false, -- disable cursor column - foldcolumn = "0", -- disable fold column - list = false, -- disable whitespace characters - }, - }, - plugins = { - -- disable some global vim options (vim.o...) - -- comment the lines to not apply the options - options = { - enabled = true, - ruler = false, -- disables the ruler text in the cmd line area - showcmd = false, -- disables the command in the last line of the screen - }, - twilight = { enabled = true }, -- enable to start Twilight when zen mode opens - gitsigns = { enabled = false }, -- disables git signs - tmux = { enabled = false }, -- disables the tmux statusline - -- this will change the font size on kitty when in zen mode - -- to make this work, you need to set the following kitty options: - -- - allow_remote_control socket-only - -- - listen_on unix:/tmp/kitty - kitty = { - enabled = true, - font = "+2", -- font size increment - }, - }, - } - require('twilight').setup{} - - -- hologram - require('hologram').setup{ - auto_display = false -- WIP automatic markdown image display, may be prone to breaking - } - - EOF - - ''; + # extraConfig = '' + # filetype plugin on + + # " set spell + # set spelllang=en_gb + # set ignorecase + # set smartcase + # set incsearch + # " if hidden is not set, TextEdit might fail. + # set hidden + # " Some servers have issues with backup files, see #649 + # set nobackup + # set nowritebackup + # " Better display for messages + # set cmdheight=2 + # " You will have bad experience for diagnostic messages when it's default 4000. + # set updatetime=300 + # " don't give |ins-completion-menu| messages. + # set shortmess+=c + # " always show signcolumns + # set signcolumn=yes + # " highlight row + # set cursorline + + # let g:conjure#filetype#fennel = "conjure.client.fennel.stdio" + # " we only use fennel with love; no we don't... + # let g:conjure#client#fennel#stdio#command = "fennel" + # " let g:conjure#extract#tree_sitter#enabled = true + # map lt :ConjureLogToggle + + # let g:rainbow_active = 0 + # autocmd BufReadPost,BufNewFile c,clj,cljs RainbowParenthesesToggleAll + + # " general commands + # nnoremap :noh + # map Q + # nnoremap Y y$ + # nnoremap n :vnew + # " center moving + # nnoremap n nzzzv + # nnoremap N Nzzzv + # nnoremap J mzJ'z + # " undo points + # inoremap , ,u + # inoremap . .u + # inoremap ? ?u + # inoremap ! !u + # inoremap ) )u + # inoremap [ [u + # inoremap ] ]u + # inoremap { {u + # inoremap ( (u + # inoremap } }u + # " moving text + # vnoremap J :m '>+1gv=gv + # vnoremap K :m '>-2gv=gv + # inoremap :m .+1== + # inoremap :m .-2== + # nnoremap j :m .+1== + # nnoremap k :m .-2== + # " Pasting + # :map sy :!xclip -i + # :vmap sy "*y + # :map sp :r!xclip -o + + # " barbar + # nnoremap gT :BufferPrevious + # nnoremap gt :BufferNext + # nnoremap gj :BufferPick + # nnoremap gq :BufferClose + + # " kitaab + # map cz :VimwikiIndex:ZettelNew + # map zs :ZettelSearch + # map zn :ZettelNew + # map zo :ZettelOpen + # map zf :Telescope oldfiles only_cwd=true + # map wt :VimwikiMakeTomorrowDiaryNote + # map wd :VimwikiMakeYesterdayDiaryNote + # map zm :ZenMode:setlocal nospell + # let g:vimwiki_list = [{ 'path': '~/kitaab/vimwiki', 'auto_tags': 1, 'auto_diary_index': 1, 'auto_generate_links': 0, 'nested_syntaxes': {'python': 'python', 'c++': 'cpp', 'nix': 'nix', 'bash': 'sh'} }] + # let g:sync_taskwarrior = 0 + # let g:zettel_format = "%y%m%d-%H%M" + + + # let g:scnvim_snippet_format = "luasnip" + + + # " lua config + # lua <vt', ':call v:lua.toggle_diagnostics()', {noremap = true, silent = true}) + + # -- autopairs + # require('nvim-autopairs').setup{} + + # -- marks + # require('marks').setup{} + + # -- Setup nvim-cmp. + # local has_words_before = function() + # local line, col = unpack(vim.api.nvim_win_get_cursor(0)) + # return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil + # end + + # local luasnip = require("luasnip") + # local lspkind = require("lspkind") + # local cmp = require('cmp') + # local cmp_autopairs = require('nvim-autopairs.completion.cmp') + # local t = function(str) + # return vim.api.nvim_replace_termcodes(str, true, true, true) + # end + # local check_back_space = function() + # local col = vim.fn.col(".") - 1 + # return col == 0 or vim.fn.getline("."):sub(col, col):match("%s") ~= nil + # end + # cmp.setup { + # formatting = { + # format = lspkind.cmp_format({ + # mode = 'symbol_text', + # maxwidth = 50, + # }) + # }, + # mapping = { + # [''] = cmp.mapping.select_prev_item(), + # [''] = cmp.mapping.select_next_item(), + # [''] = cmp.mapping.scroll_docs(-4), + # [''] = cmp.mapping.scroll_docs(4), + # [''] = cmp.mapping.complete(), + # [''] = cmp.mapping.close(), + # [''] = cmp.mapping.confirm({ + # behavior = cmp.ConfirmBehavior.Insert, + # select = true + # }), + # [""] = cmp.mapping(function(fallback) + # if cmp.visible() then + # cmp.select_next_item() + # elseif luasnip.expand_or_jumpable() then + # luasnip.expand_or_jump() + # elseif has_words_before() then + # cmp.complete() + # else + # fallback() + # end + # end, {"i", "s"}), + # [""] = cmp.mapping(function(fallback) + # if cmp.visible() then + # cmp.select_prev_item() + # elseif luasnip.jumpable(-1) then + # luasnip.jump(-1) + # else + # fallback() + # end + # end, { "i", "s" }), + # }, + # snippet = { + # expand = function(args) + # require'luasnip'.lsp_expand(args.body) + # end + # }, + # sources = { + # {name = 'buffer'}, {name = 'nvim_lsp'}, + # {name = "look"}, {name = "path"}, + # {name = "calc"}, {name = "spell"}, + # {name = 'cmp-conjure'}, {name = "luasnip"}, + # {name = 'tags'} + # }, + # completion = {completeopt = 'menu,menuone,noinsert'} + # } + # cmp.event:on( 'confirm_done', cmp_autopairs.on_confirm_done({ map_char = { tex = ' ' } })) + # require("luasnip.loaders.from_vscode").lazy_load() + + # -- null-ls + # -- being very janky + # local null_ls = require("null-ls") + # null_ls.setup({ + # sources = { + # null_ls.builtins.diagnostics.shellcheck, + # null_ls.builtins.diagnostics.proselint.with({ filetypes = { "vimwiki", "mail", }, }), + # null_ls.builtins.diagnostics.commitlint, + # null_ls.builtins.diagnostics.jsonlint, + # -- null_ls.builtins.code_actions.statix, + # -- null_ls.builtins.diagnostics.clj_kondo, + # -- null_ls.builtins.formatting.isort, + # -- null_ls.builtins.formatting.black, + # }, + # }) + + # -- Setup lspconfig + # require("lsp-format").setup {} + # require("nvim-navic").setup {} + # local format = require("lsp-format") + # local navic = require("nvim-navic") + + # -- lspsaga, code_action lightbulb is annoying + # local saga = require('lspsaga') + # saga.init_lsp_saga({ + # border_style = "rounded", + # code_action_icon = "", + # code_action_num_shortcut = true, + # code_action_lightbulb = { + # enable = false, + # enable_in_insert = false, + # cache_code_action = true, + # sign = true, + # update_time = 150, + # sign_priority = 20, + # virtual_text = false, + # }, + # code_action_keys = { + # quit = 'q', + # exec = '', + # }, + # -- show outline + # show_outline = { + # win_position = 'right', + # --set special filetype win that outline window split.like NvimTree neotree + # -- defx, db_ui + # auto_enter = true, + # auto_preview = true, + # virt_text = '┃', + # jump_key = 'o', + # -- auto refresh when change buffer + # auto_refresh = true, + # }, + # }) + + # capabilities = require('cmp_nvim_lsp').default_capabilities() + + # -- fennel-ls is bleeding edge + # local lspconfig = require('lspconfig') + # require("lspconfig.configs")["fennel-ls"] = { + # default_config = { + # cmd = {"fennel-ls"}, + # filetypes = {"fennel"}, + # root_dir = function(dir) return lspconfig.util.find_git_ancestor(dir) end, + # settings = {} + # } + # } + + # local servers = { 'clojure_lsp', 'terraform_lsp', 'zls', 'pyright', 'rust_analyzer', 'tsserver', 'lua_ls', 'nil_ls', 'gopls'} + # for _, lsp in ipairs(servers) do + # lspconfig[lsp].setup { + # on_attach = function(client, bufnr) + # format.on_attach(client) + # navic.attach(client, bufnr) + # end, + # capabilities = capabilities, + # } + # end + + # -- fennel-ls doesn't support gps + # lspconfig['fennel-ls'].setup { + # on_attach = function(client, bufnr) + # format.on_attach(client) + # end, + # capabilities = capabilities, + # } + + # -- deprecated pylsp + # -- require('lspconfig').pylsp.setup { + # -- on_attach = function(client, bufnr) + # -- format.on_attach(client) + # -- navic.attach(client, bufnr) + # -- end, + # -- capabilities = capabilities, + # -- settings = { + # -- pylsp = { + # -- configurationSources = { "flake8", "mypy", "black" }, + # -- plugins = { + # -- black = {enabled = true}, + # -- jedi_signature_help = {enabled = true}, + # -- jedi_completion = { include_params = true }, + # -- pylsp_mypy={ enabled = true }, + # -- pycodestyle={ + # -- enabled=true, + # -- ignore={'E501', 'E231'}, + # -- maxLineLength=120, + # -- }, + # -- }, + # -- }, + # -- }, + # -- } + + # require('gitsigns').setup { sign_priority=80 } + + # -- treesitter + # require('nvim-treesitter.configs').setup { + # -- parser_install_dir = "~/.local/share/nvim/site/parser/", + # -- ensure_installed={'nix', 'clojure', 'python', 'fennel', 'lua', 'html', 'css', 'regex', 'supercollider', 'beancount', 'janet'}, + # highlight = { enabled = true, additional_vim_regex_highting = true, }, + # textobjects = { enabled = true }, + # } + # -- 'glsl' needs c++ compiler lol + + # -- lualine + # local navic = require("nvim-navic") + # require('lualine').setup { + # options = { theme = 'ayu' }, + # sections = { + # lualine_c = { + # 'filename', { navic.get_location, condition=navic.is_available }, + # }, + # lualine_y = { + # function() + # local msg = 'No Active Lsp' + # local buf_ft = vim.api.nvim_buf_get_option(0, 'filetype') + # local clients = vim.lsp.get_active_clients() + # if next(clients) == nil then + # return msg + # end + # for _, client in ipairs(clients) do + # local filetypes = client.config.filetypes + # if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then + # return client.name + # end + # end + # return msg + # end + # }, + # lualine_x = {'filetype'} + # } + # } + + # -- nvim-lint + # -- require('lint').linters_by_ft = { + # -- markdown = {'vale'}, + # -- } + + + # -- Custom functions + # function update_date() + # local time = os.date("%Y-%m-%d %H:%M") + # local message = "%update " .. time + # local lines = vim.api.nvim_buf_get_lines(0, 0,4,false) + # for i=1,4,1 do + # if (lines[i]:len() == 0) then + # vim.api.nvim_buf_set_lines(0, i-1, i, false, {message, ""}) + # return + # end + # end + # if (lines[4]:len() ~= 0) then + # vim.api.nvim_buf_set_lines(0, 3, 4, false, {message}) + # end + # return + # end + + # vim.api.nvim_create_autocmd( + # "BufWritePre", + # { pattern = { "*.wiki" }, callback = update_date} + # ) + + # -- set spelling for text files + # vim.api.nvim_create_autocmd( + # { "BufRead", "BufNewFile" }, + # { pattern = { "*.wiki", "*.txt", "*.md", "*.tex" }, + # command = "setlocal spell" } + # ) + # vim.api.nvim_create_autocmd( + # "FileType", + # { pattern = { "mail" }, + # command = "setlocal spell" } + # ) + + # -- auto session + # require('auto-session').setup { + # log_level = 'info', + # auto_session_suppress_dirs = {'~/'} + # } + # vim.o.sessionoptions="blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal" + + # require("which-key").setup{} + # require('leap').set_default_keymaps() + # + # -- supercollider + # local scnvim = require 'scnvim' + # local map = scnvim.map + # local map_expr = scnvim.map_expr + # scnvim.setup { + # keymaps = { + # ['e'] = map('editor.send_line', {'i', 'n'}), + # ['s'] = map_expr('CmdPeriod.run', {'i', 'n'}), + # ['t'] = { + # map('editor.send_block', {'i', 'n'}), + # map('editor.send_selection', 'x'), + # }, + # [''] = map('postwin.toggle'), + # [''] = map('postwin.toggle', 'i'), + # [''] = map('postwin.clear', {'n', 'i'}), + # [''] = map('signature.show', {'n', 'i'}), + # [''] = map('sclang.hard_stop', {'n', 'x', 'i'}), + # ['st'] = map('sclang.start'), + # ['sk'] = map('sclang.recompile'), + # [''] = map_expr('s.boot'), + # [''] = map_expr('s.meter'), + # } + # } + # -- You gotta run :SCNvimGenerateAssets for this first + # -- require("luasnip").add_snippets("supercollider", require("scnvim/utils").get_snippets()) + + # -- zen mode + # require('zen-mode').setup{ + # window = { + # backdrop = 1.0, -- shade the backdrop of the Zen window. Set to 1 to keep the same as Normal + # -- height and width can be: + # -- * an absolute number of cells when > 1 + # -- * a percentage of the width / height of the editor when <= 1 + # -- * a function that returns the width or the height + # width = 120, -- width of the Zen window + # height = 1, -- height of the Zen window + # -- by default, no options are changed for the Zen window + # -- uncomment any of the options below, or add other vim.wo options you want to apply + # options = { + # signcolumn = "no", -- disable signcolumn + # number = false, -- disable number column + # relativenumber = false, -- disable relative numbers + # cursorline = false, -- disable cursorline + # cursorcolumn = false, -- disable cursor column + # foldcolumn = "0", -- disable fold column + # list = false, -- disable whitespace characters + # }, + # }, + # plugins = { + # -- disable some global vim options (vim.o...) + # -- comment the lines to not apply the options + # options = { + # enabled = true, + # ruler = false, -- disables the ruler text in the cmd line area + # showcmd = false, -- disables the command in the last line of the screen + # }, + # twilight = { enabled = true }, -- enable to start Twilight when zen mode opens + # gitsigns = { enabled = false }, -- disables git signs + # tmux = { enabled = false }, -- disables the tmux statusline + # -- this will change the font size on kitty when in zen mode + # -- to make this work, you need to set the following kitty options: + # -- - allow_remote_control socket-only + # -- - listen_on unix:/tmp/kitty + # kitty = { + # enabled = true, + # font = "+2", -- font size increment + # }, + # }, + # } + # require('twilight').setup{} + + # -- hologram + # require('hologram').setup{ + # auto_display = false -- WIP automatic markdown image display, may be prone to breaking + # } + + # EOF + + # ''; extraPackages = with pkgs; [ # used to compile tree-sitter grammar # python-with-my-packages @@ -568,19 +563,22 @@ nodePackages.typescript-language-server luajitPackages.lua-lsp fennel-ls - starpls-bin + # starpls-bin # TODO find this!! ]; plugins = with pkgs.vimPlugins; [ + #hotpot + hotpot-nvim # ui lualine-nvim + neo-tree-nvim fzf-vim vim-devicons nvim-web-devicons telescope-nvim plenary-nvim nvim-navic - fterm + FTerm-nvim barbar-nvim # TODO @@ -620,7 +618,7 @@ cmp-nvim-lsp cmp-treesitter nvim-lsp-ts-utils - lspsaga + lspsaga-nvim cmp-conjure cmp-buffer cmp-path @@ -628,7 +626,7 @@ nvim-autopairs cmp_luasnip luasnip - lsp-format + lsp-format-nvim friendly-snippets lspkind-nvim @@ -647,11 +645,11 @@ # experimental nvim-luapad scnvim - leap + leap-nvim vim-beancount # vimtex # custom - nvim-parinfer + # nvim-parinfer # vim-processing ]; # withPython3 = true; -- 2.51.2 From 7fab1f798c203cf403e36270e4e852f14444baaf Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Sun, 25 Aug 2024 00:46:13 -0700 Subject: [PATCH 64/78] cli: remove vim mode on zsh (use C-x e!) --- home/profiles/cli/default.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/home/profiles/cli/default.nix b/home/profiles/cli/default.nix index 065c836..b912c38 100644 --- a/home/profiles/cli/default.nix +++ b/home/profiles/cli/default.nix @@ -133,7 +133,6 @@ autosuggestion.enable = false; initExtra = '' - bindkey -v autopair-init ''; sessionVariables = { -- 2.51.2 From 0709b64a716a89010323065cafb3cf503a62c06a Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Sun, 25 Aug 2024 23:44:07 -0700 Subject: [PATCH 65/78] gopls configured, but cmp broken --- home/profiles/nvim/config/fnl/conf/init.fnl | 13 +- home/profiles/nvim/config/fnl/conf/lsp.fnl | 111 +++++++++ .../nvim/config/fnl/conf/mappings.fnl | 51 ++++- home/profiles/nvim/config/fnl/conf/music.fnl | 4 + .../profiles/nvim/config/fnl/conf/plugins.fnl | 3 +- .../nvim/config/fnl/conf/plugins/cmp.fnl | 57 +++++ .../nvim/config/fnl/conf/plugins/kitaab.fnl | 11 + home/profiles/nvim/config/fnl/lib/nvim.fnl | 4 +- home/profiles/nvim/default.nix | 215 +----------------- 9 files changed, 251 insertions(+), 218 deletions(-) create mode 100644 home/profiles/nvim/config/fnl/conf/plugins/cmp.fnl create mode 100644 home/profiles/nvim/config/fnl/conf/plugins/kitaab.fnl diff --git a/home/profiles/nvim/config/fnl/conf/init.fnl b/home/profiles/nvim/config/fnl/conf/init.fnl index ab48e1b..2408d1f 100644 --- a/home/profiles/nvim/config/fnl/conf/init.fnl +++ b/home/profiles/nvim/config/fnl/conf/init.fnl @@ -16,6 +16,15 @@ (nvim.opt :showtabline 2) (nvim.opt :expandtab true) (nvim.opt :autowriteall true) +(nvim.opt :cmdheight 2) +(nvim.opt :spelllang "en_gb") +(nvim.opt :ignorecase true) +(nvim.opt :smartcase true) +(nvim.opt :incsearch true) +(nvim.opt :updatetime 300) ; Diagnostics response time +(nvim.opt :signcolumn "yes") +(nvim.opt :cursorline true) + (nvim.opt :lisp true) ; include - in word to move better in snake-case) (nvim.g :sexp_filetypes "clojure,scheme,lisp,janet,fennel,yuck") ; include the lisps I use @@ -26,4 +35,6 @@ (require :conf.plugins) (require :conf.mappings) (require :conf.lsp) -(require :conf.formatting) +(require :conf.plugins.cmp) +; (require :conf.formatting) +; (require :conf.kitaab) diff --git a/home/profiles/nvim/config/fnl/conf/lsp.fnl b/home/profiles/nvim/config/fnl/conf/lsp.fnl index a9eb8fe..db20eca 100644 --- a/home/profiles/nvim/config/fnl/conf/lsp.fnl +++ b/home/profiles/nvim/config/fnl/conf/lsp.fnl @@ -1,7 +1,118 @@ +; (local lspfuzzy (require :lspfuzzy)) +(local lspkind (require :lspkind)) +(local lspconfig (require :lspconfig)) +(local cmp (require :cmp)) +(local nvim (require :lib/nvim)) +; (local sg (require :sg)) +; (local lsputil (require :lspconfig/util)) +(tset vim.lsp.handlers + :textDocument/hover + (vim.lsp.with vim.lsp.handlers.hover + {:focusable false :border "rounded"})) + +(tset vim.lsp.handlers + :textDocument/signatureHelp + (vim.lsp.with vim.lsp.handlers.signature_help + {:focusable false :border "rounded"})) + +(local capabilities (let [cmp_nvim_lsp (require :cmp_nvim_lsp)] + (cmp_nvim_lsp.default_capabilities))) + +(local formatting-augroup (nvim.augroup :LspFormatting)) + +(fn goimports [wait-ms] + (let [params (vim.lsp.util.make_range_params) + result (do + (tset params :context {:only [:source.organizeImports]}) + (vim.lsp.buf_request_sync 0 :textDocument/codeAction params wait-ms))] + (each [_ res (pairs (or result {}))] + (each [_ r (pairs (or res.result {}))] + (if r.edit + (vim.lsp.util.apply_workspace_edit r.edit "utf-16") + (vim.lsp.buf.execute_command r.command)))) + (vim.lsp.buf.format))) + +(fn on-attach [client bufnr] + (let [filetype (vim.api.nvim_buf_get_option 0 "filetype")] + (if (client.supports_method "textDocument/formatting") + (do (nvim.autocmd "BufWritePre" + {:group formatting-augroup + :buffer bufnr + :callback (fn [_] (if (= filetype "go") + (goimports 2000) + (vim.lsp.buf.format {:bufnr bufnr})))}))))) + +(lspconfig.gopls.setup + {:capabilities capabilities + :codelens {:generate true :gc_details true} + :semanticTokens true + :flags { :debounce_text_changes 200} + :analyses {:unusedparams true + :unusedvariables true + :unusedwrite true + :nilness true + :unusedwrite true + :useany true} + :completeUnimported true + :staticcheck true + :experimentalPostfixCompletions true + :hints {:constantValues true + :functionTypeParameters true + :assignVariablesTypes true + :compositeLiteralTypes true + :compositeLiteralFields true + :parameterNames true + :rangeVariableTypes true} + :on_attach on-attach}) + + +; # local servers = { 'clojure_lsp', 'terraform_lsp', 'zls', 'pyright', 'rust_analyzer', 'tsserver', 'lua_ls', 'nil_ls', 'gopls'} +; # for _, lsp in ipairs(servers) do +; # lspconfig[lsp].setup {} +; # on_attach = function(client, bufnr) +; # format.on_attach(client) +; # navic.attach(client, bufnr) +; # end, +; # capabilities = capabilities, +; # +; # end) +;; Diagnostics Config I don't yet understand ; Set Diagnostics ; local signs = { Error = " ", Warn = " ", Hint = " ", Info = " " } ; for type, icon in pairs(signs) do ; local hl = "DiagnosticSign" .. type ; vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl}) ; end + +; vim.g.diagnostics_active = true +; function _G.toggle_diagnostics() +; if vim.g.diagnostics_active then +; vim.g.diagnostics_active = false +; vim.lsp.diagnostic.clear(0) +; vim.lsp.handlers["textDocument/publishDiagnostics"] = function() end +; else +; vim.g.diagnostics_active = true +; vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with( +; vim.lsp.diagnostic.on_publish_diagnostics, { +; virtual_text = true, +; signs = true, +; underline = true, +; update_in_insert = false, +; } +; ) +; end +; end +; +; vim.diagnostic.config({ +; signs = true, +; update_in_insert = false, +; underline = false, +; severity_sort = true, +; float = { +; focusable = false, +; style = 'minimal', +; border = 'rounded', +; source = 'always', +; }, +; }) diff --git a/home/profiles/nvim/config/fnl/conf/mappings.fnl b/home/profiles/nvim/config/fnl/conf/mappings.fnl index b21806a..9763329 100644 --- a/home/profiles/nvim/config/fnl/conf/mappings.fnl +++ b/home/profiles/nvim/config/fnl/conf/mappings.fnl @@ -5,13 +5,33 @@ (nvim.keymap [:v] "<" "" ">gv" {:noremap true}) (nvim.keymap [:n] "" "" {:noremap true :silent true}) +;; Convenient way to move stuff in visual mode +(nvim.keymap [:v] "J" ":m '>+1gv=gv" {:noremap true}) +(nvim.keymap [:v] "K" ":m '>-2gv=gv" {:noremap true}) +;; Convientent screen shifting +(nvim.keymap [:n] "n" "nzzzv" {:noremap true}) +(nvim.keymap [:n] "N" "Nzzzv" {:noremap true}) +(nvim.keymap [:n] "J" "mzJ'z" {:noremap true}) +; Fix Y +(nvim.keymap [:n] "Y" "y$") +; Unmap Q +(nvim.keymap [] "Q" "") +; FTerm (vim.api.nvim_create_user_command "FTermToggle" (fn [_] ((-> (require :FTerm) (. :toggle)))) {:bang true}) (nvim.keymap [:t] "" ":FTermToggle") -(nvim.keymap [:n] "" ":FTermToggle" {:nnoremap true}) +(nvim.keymap [:n] "" ":FTermToggle" {:noremap true}) + +; Buffer Movement +(nvim.keymap [:n] "gT" ":BufferPrevious" {:silent true :noremap true}) +(nvim.keymap [:n] "gt" ":BufferNext" {:silent true :noremap true}) +(nvim.keymap [:n] "gj" ":BufferPick" {:silent true :noremap true}) +(nvim.keymap [:n] "gb" ":Telescope buffers" {:silent true :noremap true}) +(nvim.keymap [:n] "gq" ":BufferClosoe" {:silent true :noremap true}) + (local normal-map-leader @@ -23,6 +43,8 @@ "Quit"] "r" [":RainbowParenthesesToggleAll" "Toggle Rainbow Parens"] + "u" [":UndotreeToggle" + "Toggle Undo Tree"] ; Telescope "f" {:name "Files" :f ["Telescope find_files" @@ -51,16 +73,17 @@ "Git Diff"] "h" ["" "Commit Hunk under Cursor"]} - ; nmap gl :diffget //3 - ; nmap gh :diffget //2 - ; nnoremap gc :G commit -v -q %:p + ; For handling merges + ; nmap gl :diffget //3 + ; nmap gh :diffget //2 + ; nnoremap gc :G commit -v -q %:p ; Buffers "b" {:name "Buffer" - :a ["" - "Buffer Add"] - :q ["" + :b [":Telescope buffers" + "Buffer List"] + :q [":BufferClose" "Buffer Quit"] - :n ["" + :n [":BufferNext" "Buffer Next"] :N [":tabp" "Buffer Previous"] @@ -89,8 +112,16 @@ :h [":Lspsaga hover_doc" "Hover doc"] :o [":LSoutlineToggle" - "Outline"]} + "Outline"] + :t [":call v:lua.toggle_diagnostics()"]} ; Kitaab - "z" {:name "Kitaab"}}) + "z" {:name "Kitaab" + :n [":ZettelNew" + "Zettel New"]} + "v" {:name "Tabs" + :v [":vnew" + "Vertical Split"] + :h [":new" + "Horizontal Split"]}}) (wk.register normal-map-leader {:prefix ""}) diff --git a/home/profiles/nvim/config/fnl/conf/music.fnl b/home/profiles/nvim/config/fnl/conf/music.fnl index e69de29..81136de 100644 --- a/home/profiles/nvim/config/fnl/conf/music.fnl +++ b/home/profiles/nvim/config/fnl/conf/music.fnl @@ -0,0 +1,4 @@ +(local nvim (require :lib/nvim)) + +(nvim.g :tidal_target "terminal") +(nvim.g :scnvim_snippet_format "luasnip") diff --git a/home/profiles/nvim/config/fnl/conf/plugins.fnl b/home/profiles/nvim/config/fnl/conf/plugins.fnl index c2f7003..9b9ef6f 100644 --- a/home/profiles/nvim/config/fnl/conf/plugins.fnl +++ b/home/profiles/nvim/config/fnl/conf/plugins.fnl @@ -1,7 +1,5 @@ (local nvim (require :lib/nvim)) -(nvim.g :tidal_target "terminal") - (local navic (require :nvim-navic)) (let [lualine (require :lualine)] @@ -9,6 +7,7 @@ :sections {:lualine_c [:filename {1 navic.get_location :cond navic.is_available}] :lualine_y [(fn [] + ; TODO broken? (let [msg "No Active Lsp" buf_ft (vim.api.nvim_buf_get_option 0 "filetype") clients (vim.lsp.get_active_clients)] diff --git a/home/profiles/nvim/config/fnl/conf/plugins/cmp.fnl b/home/profiles/nvim/config/fnl/conf/plugins/cmp.fnl new file mode 100644 index 0000000..0ccead0 --- /dev/null +++ b/home/profiles/nvim/config/fnl/conf/plugins/cmp.fnl @@ -0,0 +1,57 @@ +(local cmp (require :cmp)) + +(fn has-words-before [] + (let [(line col) (unpack (vim.api.nvim_win_get_cursor 0)) + cur-line (. (vim.api.nvim_buf_get_lines 0 + (- line 1) + line + true + 1))] + (and (not= col 0) + (= (: (: cur-line :sub col col) :match "%s") + nil)))) + +(fn tab [fallback] + (let [cmp (require :cmp) + luasnip (require :luasnip)] + (if (cmp.visible) + (cmp.select_next_item) + (let [available (luasnip.expand_or_jumpable)] + (if (= (available) true) + (luasnip.expand_or_jump) + (if (has-words-before) + (cmp.complete) + (fallback))))))) + +(fn stab [fallback] + (let [cmp (require :cmp) + luasnip (require :luasnip)] + (if (cmp.visible) + (cmp.select_prev_item) + (let [available (luasnip.jumpable -1)] + (if (= (available) true) + (luasnip.jump -1) + (if (has-words-before) + (cmp.complete) + (fallback))))))) + +(let [lspkind (require :lspkind) + luasnip_loaders (require :luasnip.loaders.from_vscode)] + (luasnip_loaders.lazy_load) + (cmp.setup {:formatting {:format lspkind.cmp_format} + :snippet {:expand (fn [args] + (let [luasnip (require :luasnip)] + (luasnip.lsp_expand args.body)))} + :sources [{:name "buffer"} {:name "nvim_lsp"} + {:name "look"} {:name "path"} + {:name "calc"} {:name "spell"} + {:name "cmp-conjure"} {:name "luasnip"} + {:name "tags"}] + :mapping {"" (cmp.mapping.scroll_docs -4) + "" (cmp.mapping.scroll_docs 4) + "" (cmp.mapping (cmp.mapping.select_prev_item) [:i :c]) + "" (cmp.mapping (cmp.mapping.select_next_item) [:i :c]) + "" (cmp.mapping.close) + "" (cmp.mapping.confirm {:select true}) + "" (cmp.mapping tab [:i :s]) + "" (cmp.mapping stab [:i :s])}})) diff --git a/home/profiles/nvim/config/fnl/conf/plugins/kitaab.fnl b/home/profiles/nvim/config/fnl/conf/plugins/kitaab.fnl new file mode 100644 index 0000000..990752e --- /dev/null +++ b/home/profiles/nvim/config/fnl/conf/plugins/kitaab.fnl @@ -0,0 +1,11 @@ +(local nvim (require :lib/nvim)) + +(nvim.g :vimwiki_list [{:path "~/kitaab/vimwiki" + :auto_tags 1 + :auto_diary_index 1 + :auto_generate_links 0 + :nested_syntaxes {:python "python" + :c++ "cpp" + :nix "nix" + :bash "sh"}}]) +(nvim.g :zettel_format "%y%m%d-%H%M") diff --git a/home/profiles/nvim/config/fnl/lib/nvim.fnl b/home/profiles/nvim/config/fnl/lib/nvim.fnl index c62cbe3..a79d301 100644 --- a/home/profiles/nvim/config/fnl/lib/nvim.fnl +++ b/home/profiles/nvim/config/fnl/lib/nvim.fnl @@ -8,13 +8,13 @@ (fn augroup [name ?opts] "Create autocommand group" - (vim.api.nvim_create_augroup name (or opts {}))) + (vim.api.nvim_create_augroup name (or ?opts {}))) (fn keymap [mode lhs rhs ?opts] "Sets a global mapping for the given mode. Ex: `(keymap [:n :i] ...)`" (let [string-mode (table.concat mode)] - (vim.api.nvim_set_keymap string-mode lhs rhs (or opts {})))) + (vim.api.nvim_set_keymap string-mode lhs rhs (or ?opts {})))) (fn opt [key value] "Set a vim option" diff --git a/home/profiles/nvim/default.nix b/home/profiles/nvim/default.nix index 65182a5..69d16bc 100644 --- a/home/profiles/nvim/default.nix +++ b/home/profiles/nvim/default.nix @@ -28,13 +28,17 @@ # kitaab get by tagged kt = "cd /home/anish/kitaab/vimwiki; eza *_index.wiki | fzf --preview 'bat --style=numbers --color=always --terminal-width -1 ./{}';cd $OLDPWD"; }; - # Add %update to the highlight clause for vimwiki files - home.file.".config/nvim/after/syntax/vimwiki.vim".text = '' - " match with %update - syntax match VimwikiPlaceholder /^\s*%update\ze\%(\s.*\)\?$/ nextgroup=VimwikiPlaceholderParam skipwhite - " match with %link - syntax match VimwikiPlaceholder /^\s*%link\ze\%(\s.*\)\?$/ nextgroup=VimwikiPlaceholderParam skipwhite - ''; + + home.file = { + # Add %update to the highlight clause for vimwiki files + # ".config/nvim/after/syntax/vimwiki.vim".text = '' + # " match with %update + # syntax match VimwikiPlaceholder /^\s*%update\ze\%(\s.*\)\?$/ nextgroup=VimwikiPlaceholderParam skipwhite + # " match with %link + # syntax match VimwikiPlaceholder /^\s*%link\ze\%(\s.*\)\?$/ nextgroup=VimwikiPlaceholderParam skipwhite + # ''; + ".config/nvim".source = ./config; + }; #environment.systemPackages = with customPlugins; [ tidal ]; programs.neovim = { @@ -43,138 +47,17 @@ # extraConfig = '' # filetype plugin on - # " set spell - # set spelllang=en_gb - # set ignorecase - # set smartcase - # set incsearch - # " if hidden is not set, TextEdit might fail. - # set hidden - # " Some servers have issues with backup files, see #649 - # set nobackup - # set nowritebackup - # " Better display for messages - # set cmdheight=2 - # " You will have bad experience for diagnostic messages when it's default 4000. - # set updatetime=300 - # " don't give |ins-completion-menu| messages. # set shortmess+=c # " always show signcolumns - # set signcolumn=yes - # " highlight row - # set cursorline - - # let g:conjure#filetype#fennel = "conjure.client.fennel.stdio" - # " we only use fennel with love; no we don't... - # let g:conjure#client#fennel#stdio#command = "fennel" - # " let g:conjure#extract#tree_sitter#enabled = true - # map lt :ConjureLogToggle - - # let g:rainbow_active = 0 - # autocmd BufReadPost,BufNewFile c,clj,cljs RainbowParenthesesToggleAll - - # " general commands - # nnoremap :noh - # map Q - # nnoremap Y y$ - # nnoremap n :vnew - # " center moving - # nnoremap n nzzzv - # nnoremap N Nzzzv - # nnoremap J mzJ'z - # " undo points - # inoremap , ,u - # inoremap . .u - # inoremap ? ?u - # inoremap ! !u - # inoremap ) )u - # inoremap [ [u - # inoremap ] ]u - # inoremap { {u - # inoremap ( (u - # inoremap } }u - # " moving text - # vnoremap J :m '>+1gv=gv - # vnoremap K :m '>-2gv=gv - # inoremap :m .+1== - # inoremap :m .-2== - # nnoremap j :m .+1== - # nnoremap k :m .-2== + # " Pasting # :map sy :!xclip -i # :vmap sy "*y # :map sp :r!xclip -o - # " barbar - # nnoremap gT :BufferPrevious - # nnoremap gt :BufferNext - # nnoremap gj :BufferPick - # nnoremap gq :BufferClose - - # " kitaab - # map cz :VimwikiIndex:ZettelNew - # map zs :ZettelSearch - # map zn :ZettelNew - # map zo :ZettelOpen - # map zf :Telescope oldfiles only_cwd=true - # map wt :VimwikiMakeTomorrowDiaryNote - # map wd :VimwikiMakeYesterdayDiaryNote - # map zm :ZenMode:setlocal nospell - # let g:vimwiki_list = [{ 'path': '~/kitaab/vimwiki', 'auto_tags': 1, 'auto_diary_index': 1, 'auto_generate_links': 0, 'nested_syntaxes': {'python': 'python', 'c++': 'cpp', 'nix': 'nix', 'bash': 'sh'} }] - # let g:sync_taskwarrior = 0 - # let g:zettel_format = "%y%m%d-%H%M" - - - # let g:scnvim_snippet_format = "luasnip" - - # " lua config # lua <vt', ':call v:lua.toggle_diagnostics()', {noremap = true, silent = true}) - # -- autopairs # require('nvim-autopairs').setup{} @@ -193,15 +74,9 @@ # require('marks').setup{} # -- Setup nvim-cmp. - # local has_words_before = function() - # local line, col = unpack(vim.api.nvim_win_get_cursor(0)) - # return col ~= 0 and vim.api.nvim_buf_get_lines(0, line - 1, line, true)[1]:sub(col, col):match("%s") == nil - # end # local luasnip = require("luasnip") # local lspkind = require("lspkind") - # local cmp = require('cmp') - # local cmp_autopairs = require('nvim-autopairs.completion.cmp') # local t = function(str) # return vim.api.nvim_replace_termcodes(str, true, true, true) # end @@ -209,61 +84,6 @@ # local col = vim.fn.col(".") - 1 # return col == 0 or vim.fn.getline("."):sub(col, col):match("%s") ~= nil # end - # cmp.setup { - # formatting = { - # format = lspkind.cmp_format({ - # mode = 'symbol_text', - # maxwidth = 50, - # }) - # }, - # mapping = { - # [''] = cmp.mapping.select_prev_item(), - # [''] = cmp.mapping.select_next_item(), - # [''] = cmp.mapping.scroll_docs(-4), - # [''] = cmp.mapping.scroll_docs(4), - # [''] = cmp.mapping.complete(), - # [''] = cmp.mapping.close(), - # [''] = cmp.mapping.confirm({ - # behavior = cmp.ConfirmBehavior.Insert, - # select = true - # }), - # [""] = cmp.mapping(function(fallback) - # if cmp.visible() then - # cmp.select_next_item() - # elseif luasnip.expand_or_jumpable() then - # luasnip.expand_or_jump() - # elseif has_words_before() then - # cmp.complete() - # else - # fallback() - # end - # end, {"i", "s"}), - # [""] = cmp.mapping(function(fallback) - # if cmp.visible() then - # cmp.select_prev_item() - # elseif luasnip.jumpable(-1) then - # luasnip.jump(-1) - # else - # fallback() - # end - # end, { "i", "s" }), - # }, - # snippet = { - # expand = function(args) - # require'luasnip'.lsp_expand(args.body) - # end - # }, - # sources = { - # {name = 'buffer'}, {name = 'nvim_lsp'}, - # {name = "look"}, {name = "path"}, - # {name = "calc"}, {name = "spell"}, - # {name = 'cmp-conjure'}, {name = "luasnip"}, - # {name = 'tags'} - # }, - # completion = {completeopt = 'menu,menuone,noinsert'} - # } - # cmp.event:on( 'confirm_done', cmp_autopairs.on_confirm_done({ map_char = { tex = ' ' } })) - # require("luasnip.loaders.from_vscode").lazy_load() # -- null-ls # -- being very janky @@ -320,7 +140,6 @@ # }, # }) - # capabilities = require('cmp_nvim_lsp').default_capabilities() # -- fennel-ls is bleeding edge # local lspconfig = require('lspconfig') @@ -333,16 +152,6 @@ # } # } - # local servers = { 'clojure_lsp', 'terraform_lsp', 'zls', 'pyright', 'rust_analyzer', 'tsserver', 'lua_ls', 'nil_ls', 'gopls'} - # for _, lsp in ipairs(servers) do - # lspconfig[lsp].setup { - # on_attach = function(client, bufnr) - # format.on_attach(client) - # navic.attach(client, bufnr) - # end, - # capabilities = capabilities, - # } - # end # -- fennel-ls doesn't support gps # lspconfig['fennel-ls'].setup { -- 2.51.2 From 10f6614348dea6bbc0f8911cb8991a54089f0926 Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Mon, 26 Aug 2024 23:09:08 -0700 Subject: [PATCH 66/78] almost at parity now, can dog food Needs: - surrond? - diagnostics icons - cmp still seems to shit the bed sometimes - lspsaga breadcrumbs on lualine - more which-key config!! - tests on svelte / web dev --- .../nvim/config/fnl/conf/formatting.fnl | 11 + home/profiles/nvim/config/fnl/conf/init.fnl | 11 +- home/profiles/nvim/config/fnl/conf/lsp.fnl | 82 +++---- .../nvim/config/fnl/conf/mappings.fnl | 14 +- home/profiles/nvim/config/fnl/conf/music.fnl | 26 +++ .../profiles/nvim/config/fnl/conf/plugins.fnl | 27 ++- .../nvim/config/fnl/conf/plugins/cmp.fnl | 44 +--- .../nvim/config/fnl/conf/plugins/kitaab.fnl | 24 +++ home/profiles/nvim/config/fnl/lib/macros.fnl | 6 + home/profiles/nvim/default.nix | 200 +++--------------- 10 files changed, 184 insertions(+), 261 deletions(-) create mode 100644 home/profiles/nvim/config/fnl/lib/macros.fnl diff --git a/home/profiles/nvim/config/fnl/conf/formatting.fnl b/home/profiles/nvim/config/fnl/conf/formatting.fnl index e69de29..bbfc9a7 100644 --- a/home/profiles/nvim/config/fnl/conf/formatting.fnl +++ b/home/profiles/nvim/config/fnl/conf/formatting.fnl @@ -0,0 +1,11 @@ +(import-macros {: do-req } :lib/macros) + +(do-req :conform :setup + {:formatters_by_ft {:lua ["stylua"] + :nix ["nixfmt"] + ; :go ["goimports" "gofmt"] ; Go handled in special case + :terraform ["terraform_fmt"] + :sh ["shfmt"] + :bazel ["buildifier"]} + :format_on_save {:lsp_format "fallback" + :timeout_ms 500}}) diff --git a/home/profiles/nvim/config/fnl/conf/init.fnl b/home/profiles/nvim/config/fnl/conf/init.fnl index 2408d1f..be0765f 100644 --- a/home/profiles/nvim/config/fnl/conf/init.fnl +++ b/home/profiles/nvim/config/fnl/conf/init.fnl @@ -25,7 +25,6 @@ (nvim.opt :signcolumn "yes") (nvim.opt :cursorline true) - (nvim.opt :lisp true) ; include - in word to move better in snake-case) (nvim.g :sexp_filetypes "clojure,scheme,lisp,janet,fennel,yuck") ; include the lisps I use @@ -36,5 +35,13 @@ (require :conf.mappings) (require :conf.lsp) (require :conf.plugins.cmp) -; (require :conf.formatting) +(require :conf.formatting) ; (require :conf.kitaab) + +; Spelling +(vim.api.nvim_create_autocmd ["BufRead" "BufNewFile"] + {:pattern ["*.wiki" "*.txt" "*.md" "*.tex"] + :command "setlocal spell"}) +(vim.api.nvim_create_autocmd ["FileType"] + {:pattern ["mail"] + :command "setlocal spell"}) diff --git a/home/profiles/nvim/config/fnl/conf/lsp.fnl b/home/profiles/nvim/config/fnl/conf/lsp.fnl index db20eca..6cce7f4 100644 --- a/home/profiles/nvim/config/fnl/conf/lsp.fnl +++ b/home/profiles/nvim/config/fnl/conf/lsp.fnl @@ -1,10 +1,31 @@ -; (local lspfuzzy (require :lspfuzzy)) +(import-macros {: do-req } :lib/macros) (local lspkind (require :lspkind)) (local lspconfig (require :lspconfig)) +(local lspsaga (require :lspsaga)) (local cmp (require :cmp)) (local nvim (require :lib/nvim)) +; (local lspfuzzy (require :lspfuzzy)) ; (local sg (require :sg)) ; (local lsputil (require :lspconfig/util)) +; (local navic (require :nvim-navic)) + +(lspsaga.setup {:border_style "rounded" + :code_action_icon "" + :code_action_num_shortcut true + :code_action_lightbulb { + :enable false + } + ; show outline + :show_outline { + :win_position "right" + :auto_enter true + :auto_preview true + :virt_text "┃" + :jump_key "o" + ; auto refresh when change buffer + :auto_refresh true + } + }) (tset vim.lsp.handlers :textDocument/hover @@ -47,7 +68,7 @@ {:capabilities capabilities :codelens {:generate true :gc_details true} :semanticTokens true - :flags { :debounce_text_changes 200} + :flags {:debounce_text_changes 200} :analyses {:unusedparams true :unusedvariables true :unusedwrite true @@ -66,53 +87,14 @@ :rangeVariableTypes true} :on_attach on-attach}) +(local lsps [:nil_ls :terraform_lsp :fennel_ls :tsserver]) +(each [index lsp (ipairs lsps)] + ((. (. lspconfig lsp) :setup) {})) -; # local servers = { 'clojure_lsp', 'terraform_lsp', 'zls', 'pyright', 'rust_analyzer', 'tsserver', 'lua_ls', 'nil_ls', 'gopls'} -; # for _, lsp in ipairs(servers) do -; # lspconfig[lsp].setup {} -; # on_attach = function(client, bufnr) -; # format.on_attach(client) -; # navic.attach(client, bufnr) -; # end, -; # capabilities = capabilities, -; # -; # end) -;; Diagnostics Config I don't yet understand -; Set Diagnostics -; local signs = { Error = " ", Warn = " ", Hint = " ", Info = " " } -; for type, icon in pairs(signs) do -; local hl = "DiagnosticSign" .. type -; vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = hl}) -; end +; null-ls +(let [null-ls (require :null-ls)] + (null-ls.setup {:sources [;null-ls.builtins.diagnostics.shellcheck + null-ls.builtins.diagnostics.commitlint]})) + ;null-ls.builtins.diagnostics.jsonlint]})) + ;(null-ls.builtins.diagnostics.proselint.with {:filetypes ["vimwiki" "mail"]})]})) -; vim.g.diagnostics_active = true -; function _G.toggle_diagnostics() -; if vim.g.diagnostics_active then -; vim.g.diagnostics_active = false -; vim.lsp.diagnostic.clear(0) -; vim.lsp.handlers["textDocument/publishDiagnostics"] = function() end -; else -; vim.g.diagnostics_active = true -; vim.lsp.handlers["textDocument/publishDiagnostics"] = vim.lsp.with( -; vim.lsp.diagnostic.on_publish_diagnostics, { -; virtual_text = true, -; signs = true, -; underline = true, -; update_in_insert = false, -; } -; ) -; end -; end -; -; vim.diagnostic.config({ -; signs = true, -; update_in_insert = false, -; underline = false, -; severity_sort = true, -; float = { -; focusable = false, -; style = 'minimal', -; border = 'rounded', -; source = 'always', -; }, -; }) diff --git a/home/profiles/nvim/config/fnl/conf/mappings.fnl b/home/profiles/nvim/config/fnl/conf/mappings.fnl index 9763329..6c38cd5 100644 --- a/home/profiles/nvim/config/fnl/conf/mappings.fnl +++ b/home/profiles/nvim/config/fnl/conf/mappings.fnl @@ -1,4 +1,6 @@ (local nvim (require :lib/nvim)) +(import-macros {: do-req } :lib/macros) + (local wk (require :which-key)) ;; Convenient way to indent stuff in visual mode @@ -30,8 +32,13 @@ (nvim.keymap [:n] "gt" ":BufferNext" {:silent true :noremap true}) (nvim.keymap [:n] "gj" ":BufferPick" {:silent true :noremap true}) (nvim.keymap [:n] "gb" ":Telescope buffers" {:silent true :noremap true}) -(nvim.keymap [:n] "gq" ":BufferClosoe" {:silent true :noremap true}) +(nvim.keymap [:n] "gq" ":BufferClose" {:silent true :noremap true}) +; Flash +(vim.api.nvim_create_user_command "Flash" (fn [_] (do-req :flash :jump)) {}) +(vim.api.nvim_create_user_command "FlashTreesitter" (fn [] (do-req :flash :treesitter)) {}) +(nvim.keymap [:n] "f" "Flash") +(nvim.keymap [:n] "s" "FlashTreesitter") (local normal-map-leader @@ -111,9 +118,10 @@ "Rename Symbol"] :h [":Lspsaga hover_doc" "Hover doc"] - :o [":LSoutlineToggle" + :o ["AerialToggle!" "Outline"] - :t [":call v:lua.toggle_diagnostics()"]} + :t [":LspDiagnostics 0" + "Find Errors in Buffer"]} ; Kitaab "z" {:name "Kitaab" :n [":ZettelNew" diff --git a/home/profiles/nvim/config/fnl/conf/music.fnl b/home/profiles/nvim/config/fnl/conf/music.fnl index 81136de..28d3065 100644 --- a/home/profiles/nvim/config/fnl/conf/music.fnl +++ b/home/profiles/nvim/config/fnl/conf/music.fnl @@ -2,3 +2,29 @@ (nvim.g :tidal_target "terminal") (nvim.g :scnvim_snippet_format "luasnip") + +; -- supercollider +; local scnvim = require 'scnvim' +; local map = scnvim.map +; local map_expr = scnvim.map_expr +; scnvim.setup { +; keymaps = { +; ['e'] = map('editor.send_line', {'i', 'n'}), +; ['s'] = map_expr('CmdPeriod.run', {'i', 'n'}), +; ['t'] = { +; map('editor.send_block', {'i', 'n'}), +; map('editor.send_selection', 'x'), +; }, +; [''] = map('postwin.toggle'), +; [''] = map('postwin.toggle', 'i'), +; [''] = map('postwin.clear', {'n', 'i'}), +; [''] = map('signature.show', {'n', 'i'}), +; [''] = map('sclang.hard_stop', {'n', 'x', 'i'}), +; ['st'] = map('sclang.start'), +; ['sk'] = map('sclang.recompile'), +; [''] = map_expr('s.boot'), +; [''] = map_expr('s.meter'), +; } +; } +; -- You gotta run :SCNvimGenerateAssets for this first +; -- require("luasnip").add_snippets("supercollider", require("scnvim/utils").get_snippets()) diff --git a/home/profiles/nvim/config/fnl/conf/plugins.fnl b/home/profiles/nvim/config/fnl/conf/plugins.fnl index 9b9ef6f..e165437 100644 --- a/home/profiles/nvim/config/fnl/conf/plugins.fnl +++ b/home/profiles/nvim/config/fnl/conf/plugins.fnl @@ -1,13 +1,14 @@ (local nvim (require :lib/nvim)) - (local navic (require :nvim-navic)) +(import-macros {: do-req } :lib/macros) + (let [lualine (require :lualine)] (lualine.setup {:options {:theme "ayu"} :sections {:lualine_c [:filename {1 navic.get_location :cond navic.is_available}] :lualine_y [(fn [] - ; TODO broken? + ; TODO broken (let [msg "No Active Lsp" buf_ft (vim.api.nvim_buf_get_option 0 "filetype") clients (vim.lsp.get_active_clients)] @@ -19,3 +20,25 @@ :lualine_x [:filetype]}})) (require :neo-tree) +(do-req :gitsigns :setup) +(do-req :marks :setup) +(do-req :mini.pairs :setup) +(do-req :mini.diff :setup) +(do-req :mini.ai :setup) +;TODO (do-req :mini.surround :setup) +(do-req :todo-comments :setup) +(do-req :ibl :setup) + +(do-req :nvim-treesitter.configs :setup {:highlight {:enable true} + :textobjects {:enable true} + :indent {:enable true}}) +(do-req :treesitter-context :setup {:max_lines 5}) + +(do-req :auto-session :setup {:log_level "info" + :auto_session_suppress_dirs ["~/"]}) +(nvim.opt :sessionoptions "blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal") + +(do-req :aerial :setup {:on_attach (fn [bufnr] + (do + (vim.keymap.set "n" "{" "AerialPrev" { :buffer bufnr}) + (vim.keymap.set "n" "}" "AerialNext" { :buffer bufnr})))}) diff --git a/home/profiles/nvim/config/fnl/conf/plugins/cmp.fnl b/home/profiles/nvim/config/fnl/conf/plugins/cmp.fnl index 0ccead0..51a60d5 100644 --- a/home/profiles/nvim/config/fnl/conf/plugins/cmp.fnl +++ b/home/profiles/nvim/config/fnl/conf/plugins/cmp.fnl @@ -11,47 +11,21 @@ (= (: (: cur-line :sub col col) :match "%s") nil)))) -(fn tab [fallback] - (let [cmp (require :cmp) - luasnip (require :luasnip)] - (if (cmp.visible) - (cmp.select_next_item) - (let [available (luasnip.expand_or_jumpable)] - (if (= (available) true) - (luasnip.expand_or_jump) - (if (has-words-before) - (cmp.complete) - (fallback))))))) - -(fn stab [fallback] - (let [cmp (require :cmp) - luasnip (require :luasnip)] - (if (cmp.visible) - (cmp.select_prev_item) - (let [available (luasnip.jumpable -1)] - (if (= (available) true) - (luasnip.jump -1) - (if (has-words-before) - (cmp.complete) - (fallback))))))) - -(let [lspkind (require :lspkind) - luasnip_loaders (require :luasnip.loaders.from_vscode)] - (luasnip_loaders.lazy_load) - (cmp.setup {:formatting {:format lspkind.cmp_format} - :snippet {:expand (fn [args] - (let [luasnip (require :luasnip)] - (luasnip.lsp_expand args.body)))} +(let [lspkind (require :lspkind)] + (cmp.setup {:formatting {:format lspkind.cmp_format + :show_labelDetails true} + ;:snippet {:expand (fn [args] + ; (let [luasnip (require :luasnip)] + ; (luasnip.lsp_expand args.body)) :sources [{:name "buffer"} {:name "nvim_lsp"} {:name "look"} {:name "path"} {:name "calc"} {:name "spell"} - {:name "cmp-conjure"} {:name "luasnip"} {:name "tags"}] :mapping {"" (cmp.mapping.scroll_docs -4) "" (cmp.mapping.scroll_docs 4) "" (cmp.mapping (cmp.mapping.select_prev_item) [:i :c]) "" (cmp.mapping (cmp.mapping.select_next_item) [:i :c]) "" (cmp.mapping.close) - "" (cmp.mapping.confirm {:select true}) - "" (cmp.mapping tab [:i :s]) - "" (cmp.mapping stab [:i :s])}})) + "" (cmp.mapping.confirm {:select true})}})) + ; "" (cmp.mapping tab [:i :s]) + ; "" (cmp.mapping stab [:i :s])}})) diff --git a/home/profiles/nvim/config/fnl/conf/plugins/kitaab.fnl b/home/profiles/nvim/config/fnl/conf/plugins/kitaab.fnl index 990752e..fc8bfea 100644 --- a/home/profiles/nvim/config/fnl/conf/plugins/kitaab.fnl +++ b/home/profiles/nvim/config/fnl/conf/plugins/kitaab.fnl @@ -1,5 +1,10 @@ +; Kitaab is why I'm so tied to vim. +; If only I could find a nice notes editor... + (local nvim (require :lib/nvim)) +(import-macros {: do-req } :lib/macros) + (nvim.g :vimwiki_list [{:path "~/kitaab/vimwiki" :auto_tags 1 :auto_diary_index 1 @@ -9,3 +14,22 @@ :nix "nix" :bash "sh"}}]) (nvim.g :zettel_format "%y%m%d-%H%M") + +; Custom functions +(fn update_date [] + (var written false) + (let [time (os.date "%Y-%m-%d %H:%M") + message (.. "%update " time) + lines (vim.api.nvim_buf_get_lines 0 0 4 false)] + (each [index line (ipairs lines)] + (if (and (= (length line) 0) (not written)) + (do + (vim.api.nvim_buf_set_lines 0 (- index 1) index false [message ""]) + (set written true))) + (if (and (= index 4) (not written)) + (vim.api.nvim_buf_set_lines 0 3 index false [message]))))) + +(vim.api.nvim_create_autocmd "BufWritePre" {:pattern ["*.wiki"] + :callback update_date}) + +(do-req :hologram :setup {:auto_display false}) diff --git a/home/profiles/nvim/config/fnl/lib/macros.fnl b/home/profiles/nvim/config/fnl/lib/macros.fnl new file mode 100644 index 0000000..9985c15 --- /dev/null +++ b/home/profiles/nvim/config/fnl/lib/macros.fnl @@ -0,0 +1,6 @@ +(fn do-req [mod key ...] + `(let [name# (require ,mod) + fun# (. name# ,key)] + (fun# ,...))) + +{: do-req} diff --git a/home/profiles/nvim/default.nix b/home/profiles/nvim/default.nix index 69d16bc..f99fbb9 100644 --- a/home/profiles/nvim/default.nix +++ b/home/profiles/nvim/default.nix @@ -22,6 +22,7 @@ { home.sessionVariables.EDITOR = "nvim"; home.shellAliases = { + vim = "nvim"; k = "cd ~/kitaab/vimwiki; vim -c :VimwikiIndex; cd $OLDPWD"; # kitaab zettel kz = "cd ~/kitaab/vimwiki; vim -c :VimwikiIndex -c :ZettelNew; cd $OLDPWD"; @@ -48,7 +49,6 @@ # filetype plugin on # set shortmess+=c - # " always show signcolumns # " Pasting # :map sy :!xclip -i @@ -59,21 +59,7 @@ # lua <e'] = map('editor.send_line', {'i', 'n'}), - # ['s'] = map_expr('CmdPeriod.run', {'i', 'n'}), - # ['t'] = { - # map('editor.send_block', {'i', 'n'}), - # map('editor.send_selection', 'x'), - # }, - # [''] = map('postwin.toggle'), - # [''] = map('postwin.toggle', 'i'), - # [''] = map('postwin.clear', {'n', 'i'}), - # [''] = map('signature.show', {'n', 'i'}), - # [''] = map('sclang.hard_stop', {'n', 'x', 'i'}), - # ['st'] = map('sclang.start'), - # ['sk'] = map('sclang.recompile'), - # [''] = map_expr('s.boot'), - # [''] = map_expr('s.meter'), - # } - # } - # -- You gotta run :SCNvimGenerateAssets for this first - # -- require("luasnip").add_snippets("supercollider", require("scnvim/utils").get_snippets()) # -- zen mode # require('zen-mode').setup{ @@ -347,10 +217,6 @@ # } # require('twilight').setup{} - # -- hologram - # require('hologram').setup{ - # auto_display = false -- WIP automatic markdown image display, may be prone to breaking - # } # EOF @@ -358,19 +224,20 @@ extraPackages = with pkgs; [ # used to compile tree-sitter grammar # python-with-my-packages - nodejs - clojure-lsp - clojure - clj-kondo + # nodejs + # clojure-lsp + # clojure + # clj-kondo terraform-lsp + nil gopls gcc shellcheck proselint - statix - nodePackages.typescript - nodePackages.typescript-language-server - luajitPackages.lua-lsp + # statix + # nodePackages.typescript + # nodePackages.typescript-language-server + # luajitPackages.lua-lsp fennel-ls # starpls-bin # TODO find this!! ]; @@ -386,33 +253,32 @@ nvim-web-devicons telescope-nvim plenary-nvim - nvim-navic FTerm-nvim barbar-nvim - - # TODO - # neotree neovim-ayu rainbow_parentheses-vim - vim-surround - undotree - - (nvim-treesitter.withPlugins (p: [ p.nix p.clojure p.fennel p.lua p.html p.css p.regex p.supercollider p.beancount p.markdown p.glsl p.yaml p.toml p.dockerfile p.json ])) - nvim-treesitter-context auto-session which-key-nvim - zen-mode-nvim - twilight-nvim - - # TODO remove? - vim-dasht + aerial-nvim + todo-comments-nvim + indent-blankline-nvim + + # Tree sitter + (nvim-treesitter.withPlugins (p: [ p.nix p.clojure p.fennel p.lua p.html p.css p.regex p.supercollider p.beancount p.markdown_inline p.markdown p.glsl p.yaml p.toml p.dockerfile p.json p.go ])) + nvim-treesitter-context + nvim-treesitter-textobjects + + # TODO + nvim-navic + undotree + marks-nvim # language vim-nix emmet-vim csv-vim direnv-vim - conjure + # conjure # kitaab stuff vimwiki @@ -420,24 +286,20 @@ hologram-nvim # lsp stuff - # nvim-lint - null-ls-nvim nvim-lspconfig nvim-cmp cmp-nvim-lsp cmp-treesitter - nvim-lsp-ts-utils - lspsaga-nvim - cmp-conjure + # cmp-conjure cmp-buffer cmp-path cmp-spell - nvim-autopairs - cmp_luasnip - luasnip - lsp-format-nvim - friendly-snippets lspkind-nvim + conform-nvim + none-ls-nvim + mini-nvim + lspsaga-nvim + # nvim-lspfuzzy # git stuff vim-fugitive @@ -454,7 +316,7 @@ # experimental nvim-luapad scnvim - leap-nvim + flash-nvim vim-beancount # vimtex # custom -- 2.51.2 From f7d7d75bb30d08130bded37d04e3a7e535f13946 Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Mon, 26 Aug 2024 23:15:22 -0700 Subject: [PATCH 67/78] add support for starpls-bin?? --- home/profiles/nvim/config/fnl/conf/lsp.fnl | 7 +- home/profiles/nvim/default.nix | 135 +-------------------- 2 files changed, 10 insertions(+), 132 deletions(-) diff --git a/home/profiles/nvim/config/fnl/conf/lsp.fnl b/home/profiles/nvim/config/fnl/conf/lsp.fnl index 6cce7f4..8bb37ce 100644 --- a/home/profiles/nvim/config/fnl/conf/lsp.fnl +++ b/home/profiles/nvim/config/fnl/conf/lsp.fnl @@ -4,7 +4,7 @@ (local lspsaga (require :lspsaga)) (local cmp (require :cmp)) (local nvim (require :lib/nvim)) -; (local lspfuzzy (require :lspfuzzy)) +; (local lspfuzzy (require :lspfuzzy)) ; Not available on Nix ; (local sg (require :sg)) ; (local lsputil (require :lspconfig/util)) ; (local navic (require :nvim-navic)) @@ -87,13 +87,14 @@ :rangeVariableTypes true} :on_attach on-attach}) -(local lsps [:nil_ls :terraform_lsp :fennel_ls :tsserver]) +(local lsps [:nil_ls :terraform_lsp :fennel_ls :tsserver :starbin]) (each [index lsp (ipairs lsps)] ((. (. lspconfig lsp) :setup) {})) ; null-ls (let [null-ls (require :null-ls)] - (null-ls.setup {:sources [;null-ls.builtins.diagnostics.shellcheck + (null-ls.setup {:sources [; TODO fix these + ;null-ls.builtins.diagnostics.shellcheck null-ls.builtins.diagnostics.commitlint]})) ;null-ls.builtins.diagnostics.jsonlint]})) ;(null-ls.builtins.diagnostics.proselint.with {:filetypes ["vimwiki" "mail"]})]})) diff --git a/home/profiles/nvim/default.nix b/home/profiles/nvim/default.nix index f99fbb9..b9188a5 100644 --- a/home/profiles/nvim/default.nix +++ b/home/profiles/nvim/default.nix @@ -1,24 +1,6 @@ { pkgs, ... }: -# let - # customPlugins = { - # vim-zettel = pkgs.vimUtils.buildVimPlugin { - # name = "vim-zettel"; - # src = pkgs.fetchFromGitHub { - # owner = "michal-h21"; - # repo = "vim-zettel"; - # rev = "929d90eec62e6f693c2702d2b6f76a93f2f1689d"; - # sha256 = "1fzKmknfVlEYwqeXgbKITbb2/PJ023iJyMz6vak3qh4="; - # }; - # }; - # }; - - # Thank god I don't use python anymore - # my-python-packages = python-packages: with python-packages; [ - # # other python packages you want - # ]; - # python-with-my-packages = pkgs.python3.withPackages my-python-packages; -# in - +# TODO Need to find a solution to have my own packages? +# Or at least update to recent versions of the packages I do use in nixpkgs { home.sessionVariables.EDITOR = "nvim"; home.shellAliases = { @@ -47,7 +29,6 @@ # extraConfig = '' # filetype plugin on - # set shortmess+=c # " Pasting @@ -57,10 +38,6 @@ # " lua config # lua < Date: Mon, 26 Aug 2024 23:17:11 -0700 Subject: [PATCH 68/78] final touches? --- home/profiles/nvim/config/fnl/conf/plugins.fnl | 10 +++++----- home/profiles/nvim/default.nix | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/home/profiles/nvim/config/fnl/conf/plugins.fnl b/home/profiles/nvim/config/fnl/conf/plugins.fnl index e165437..4bbdce2 100644 --- a/home/profiles/nvim/config/fnl/conf/plugins.fnl +++ b/home/profiles/nvim/config/fnl/conf/plugins.fnl @@ -12,11 +12,11 @@ (let [msg "No Active Lsp" buf_ft (vim.api.nvim_buf_get_option 0 "filetype") clients (vim.lsp.get_active_clients)] - (if (= (next clients) nil) msg) - (each [_ client (ipairs clients)] - (let [filetypes (. client :config :filetypes)] - (if (and filetypes (vim.fn.index filetypes buf_ft)) client.name))) - msg))] + (if (= (next clients) nil) msg) + (each [_ client (ipairs clients)] + (let [filetypes (. client :config :filetypes)] + (if (and filetypes (vim.fn.index filetypes buf_ft)) client.name))) + msg))] :lualine_x [:filetype]}})) (require :neo-tree) diff --git a/home/profiles/nvim/default.nix b/home/profiles/nvim/default.nix index b9188a5..00821c6 100644 --- a/home/profiles/nvim/default.nix +++ b/home/profiles/nvim/default.nix @@ -20,7 +20,7 @@ # " match with %link # syntax match VimwikiPlaceholder /^\s*%link\ze\%(\s.*\)\?$/ nextgroup=VimwikiPlaceholderParam skipwhite # ''; - ".config/nvim".source = ./config; + ".config/nvim".source = ./config; }; #environment.systemPackages = with customPlugins; [ tidal ]; -- 2.51.2 From ac06734c3b08c00d93ee544a316dae8c21706238 Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Tue, 27 Aug 2024 19:18:33 -0700 Subject: [PATCH 69/78] =?UTF-8?q?it's=20finished=20now=20=F0=9F=98=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../nvim/config/fnl/after/syntax/vimwiki.vim | 4 + home/profiles/nvim/config/fnl/conf/lsp.fnl | 34 +- .../profiles/nvim/config/fnl/conf/plugins.fnl | 37 +- .../nvim/config/fnl/conf/plugins/cmp.fnl | 22 +- home/profiles/nvim/default.nix | 322 +++++++++--------- 5 files changed, 211 insertions(+), 208 deletions(-) create mode 100644 home/profiles/nvim/config/fnl/after/syntax/vimwiki.vim diff --git a/home/profiles/nvim/config/fnl/after/syntax/vimwiki.vim b/home/profiles/nvim/config/fnl/after/syntax/vimwiki.vim new file mode 100644 index 0000000..1813a1f --- /dev/null +++ b/home/profiles/nvim/config/fnl/after/syntax/vimwiki.vim @@ -0,0 +1,4 @@ +" match with %update +syntax match VimwikiPlaceholder /^\s*%update\ze\%(\s.*\)\?$/ nextgroup=VimwikiPlaceholderParam skipwhite +" match with %link +syntax match VimwikiPlaceholder /^\s*%link\ze\%(\s.*\)\?$/ nextgroup=VimwikiPlaceholderParam skipwhite diff --git a/home/profiles/nvim/config/fnl/conf/lsp.fnl b/home/profiles/nvim/config/fnl/conf/lsp.fnl index 8bb37ce..03192fd 100644 --- a/home/profiles/nvim/config/fnl/conf/lsp.fnl +++ b/home/profiles/nvim/config/fnl/conf/lsp.fnl @@ -7,31 +7,29 @@ ; (local lspfuzzy (require :lspfuzzy)) ; Not available on Nix ; (local sg (require :sg)) ; (local lsputil (require :lspconfig/util)) -; (local navic (require :nvim-navic)) (lspsaga.setup {:border_style "rounded" - :code_action_icon "" - :code_action_num_shortcut true - :code_action_lightbulb { - :enable false - } - ; show outline - :show_outline { - :win_position "right" - :auto_enter true - :auto_preview true - :virt_text "┃" - :jump_key "o" - ; auto refresh when change buffer - :auto_refresh true - } - }) + :code_action_icon "" + :code_action_num_shortcut true + :code_action_lightbulb { :enable false} + :show_outline { :enable false}}) + +(nvim.opt :winbar "%f") + +(local signs {:Error " " + :Warn " " + :Hint " " + :Info " "}) +(each [t icon (pairs signs)] + (let [hl (.. "DiagnosticSign" t)] + (vim.fn.sign_define hl {:text icon + :texthl hl + :numhl hl}))) (tset vim.lsp.handlers :textDocument/hover (vim.lsp.with vim.lsp.handlers.hover {:focusable false :border "rounded"})) - (tset vim.lsp.handlers :textDocument/signatureHelp (vim.lsp.with vim.lsp.handlers.signature_help diff --git a/home/profiles/nvim/config/fnl/conf/plugins.fnl b/home/profiles/nvim/config/fnl/conf/plugins.fnl index 4bbdce2..94a264d 100644 --- a/home/profiles/nvim/config/fnl/conf/plugins.fnl +++ b/home/profiles/nvim/config/fnl/conf/plugins.fnl @@ -5,29 +5,30 @@ (let [lualine (require :lualine)] (lualine.setup {:options {:theme "ayu"} - :sections {:lualine_c [:filename {1 navic.get_location - :cond navic.is_available}] + :sections {:lualine_c [:filename (fn [] + (let [lspsaga (require :lspsaga.symbol.winbar)] + (lspsaga.get_bar)))] :lualine_y [(fn [] - ; TODO broken - (let [msg "No Active Lsp" - buf_ft (vim.api.nvim_buf_get_option 0 "filetype") - clients (vim.lsp.get_active_clients)] - (if (= (next clients) nil) msg) - (each [_ client (ipairs clients)] - (let [filetypes (. client :config :filetypes)] - (if (and filetypes (vim.fn.index filetypes buf_ft)) client.name))) - msg))] + (var msg "No Active LSP") + (let [buf_ft (vim.api.nvim_buf_get_option 0 "filetype") + clients (vim.lsp.get_active_clients)] + (each [_ client (ipairs clients)] + (let [filetypes (. client :config :filetypes)] + (if (and filetypes (vim.fn.index filetypes buf_ft)) (set msg client.name)))) + msg))] :lualine_x [:filetype]}})) (require :neo-tree) (do-req :gitsigns :setup) (do-req :marks :setup) -(do-req :mini.pairs :setup) +; (do-req :mini.pairs :setup) (do-req :mini.diff :setup) (do-req :mini.ai :setup) -;TODO (do-req :mini.surround :setup) +(do-req :mini.surround :setup {:mappings {:add "ys" + :delete "ds" + :replace "cs"}}) (do-req :todo-comments :setup) -(do-req :ibl :setup) +(do-req :ibl :setup {:exclude {:language ["fennel" "clojure" "janet"]}}) (do-req :nvim-treesitter.configs :setup {:highlight {:enable true} :textobjects {:enable true} @@ -38,7 +39,7 @@ :auto_session_suppress_dirs ["~/"]}) (nvim.opt :sessionoptions "blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal") -(do-req :aerial :setup {:on_attach (fn [bufnr] - (do - (vim.keymap.set "n" "{" "AerialPrev" { :buffer bufnr}) - (vim.keymap.set "n" "}" "AerialNext" { :buffer bufnr})))}) +(do-req :aerial :setup {}) ;{:on_attach (fn [bufnr] + ; (do + ; (vim.keymap.set "n" "{" "AerialPrev" { :buffer bufnr}) + ; (vim.keymap.set "n" "}" "AerialNext" { :buffer bufnr})) diff --git a/home/profiles/nvim/config/fnl/conf/plugins/cmp.fnl b/home/profiles/nvim/config/fnl/conf/plugins/cmp.fnl index 51a60d5..556b30d 100644 --- a/home/profiles/nvim/config/fnl/conf/plugins/cmp.fnl +++ b/home/profiles/nvim/config/fnl/conf/plugins/cmp.fnl @@ -12,20 +12,24 @@ nil)))) (let [lspkind (require :lspkind)] - (cmp.setup {:formatting {:format lspkind.cmp_format + (cmp.setup {:formatting {:format (lspkind.cmp_format {:mode "symbol_text" + :maxwidth 50}) :show_labelDetails true} - ;:snippet {:expand (fn [args] - ; (let [luasnip (require :luasnip)] - ; (luasnip.lsp_expand args.body)) + :snippet {:expand (fn [args] (vim.snippet.expand args.body))} :sources [{:name "buffer"} {:name "nvim_lsp"} {:name "look"} {:name "path"} {:name "calc"} {:name "spell"} {:name "tags"}] :mapping {"" (cmp.mapping.scroll_docs -4) "" (cmp.mapping.scroll_docs 4) - "" (cmp.mapping (cmp.mapping.select_prev_item) [:i :c]) - "" (cmp.mapping (cmp.mapping.select_next_item) [:i :c]) "" (cmp.mapping.close) - "" (cmp.mapping.confirm {:select true})}})) - ; "" (cmp.mapping tab [:i :s]) - ; "" (cmp.mapping stab [:i :s])}})) + "" (cmp.mapping.confirm {:select true}) + "" (cmp.mapping (fn [fallback] + (if (cmp.visible) (cmp.select_next_item) + (has-words-before) (cmp.complete) + (fallback))) + [:i :s]) + "" (cmp.mapping (fn [fallback] + (if (cmp.visible) (cmp.select_prev_item) + (fallback))) + [:i :s])}})) diff --git a/home/profiles/nvim/default.nix b/home/profiles/nvim/default.nix index 00821c6..66a0254 100644 --- a/home/profiles/nvim/default.nix +++ b/home/profiles/nvim/default.nix @@ -9,95 +9,75 @@ # kitaab zettel kz = "cd ~/kitaab/vimwiki; vim -c :VimwikiIndex -c :ZettelNew; cd $OLDPWD"; # kitaab get by tagged - kt = "cd /home/anish/kitaab/vimwiki; eza *_index.wiki | fzf --preview 'bat --style=numbers --color=always --terminal-width -1 ./{}';cd $OLDPWD"; + kt = + "cd /home/anish/kitaab/vimwiki; eza *_index.wiki | fzf --preview 'bat --style=numbers --color=always --terminal-width -1 ./{}';cd $OLDPWD"; }; - home.file = { - # Add %update to the highlight clause for vimwiki files - # ".config/nvim/after/syntax/vimwiki.vim".text = '' - # " match with %update - # syntax match VimwikiPlaceholder /^\s*%update\ze\%(\s.*\)\?$/ nextgroup=VimwikiPlaceholderParam skipwhite - # " match with %link - # syntax match VimwikiPlaceholder /^\s*%link\ze\%(\s.*\)\?$/ nextgroup=VimwikiPlaceholderParam skipwhite - # ''; - ".config/nvim".source = ./config; - }; + home.file.".config/nvim".source = ./config; #environment.systemPackages = with customPlugins; [ tidal ]; programs.neovim = { enable = true; # extraConfig = '' - # filetype plugin on - # set shortmess+=c - - # " Pasting - # :map sy :!xclip -i - # :vmap sy "*y - # :map sp :r!xclip -o - - # " lua config - # lua < 1 - # -- * a percentage of the width / height of the editor when <= 1 - # -- * a function that returns the width or the height - # width = 120, -- width of the Zen window - # height = 1, -- height of the Zen window - # -- by default, no options are changed for the Zen window - # -- uncomment any of the options below, or add other vim.wo options you want to apply - # options = { - # signcolumn = "no", -- disable signcolumn - # number = false, -- disable number column - # relativenumber = false, -- disable relative numbers - # cursorline = false, -- disable cursorline - # cursorcolumn = false, -- disable cursor column - # foldcolumn = "0", -- disable fold column - # list = false, -- disable whitespace characters - # }, - # }, - # plugins = { - # -- disable some global vim options (vim.o...) - # -- comment the lines to not apply the options - # options = { - # enabled = true, - # ruler = false, -- disables the ruler text in the cmd line area - # showcmd = false, -- disables the command in the last line of the screen - # }, - # twilight = { enabled = true }, -- enable to start Twilight when zen mode opens - # gitsigns = { enabled = false }, -- disables git signs - # tmux = { enabled = false }, -- disables the tmux statusline - # -- this will change the font size on kitty when in zen mode - # -- to make this work, you need to set the following kitty options: - # -- - allow_remote_control socket-only - # -- - listen_on unix:/tmp/kitty - # kitty = { - # enabled = true, - # font = "+2", -- font size increment - # }, - # }, - # } - # require('twilight').setup{} - # EOF - # ''; - - extraPackages = with pkgs; [ + # filetype plugin on + # set shortmess+=c + + # " Pasting + # :map sy :!xclip -i + # :vmap sy "*y + # :map sp :r!xclip -o + + # " lua config + + # -- zen mode + # require('zen-mode').setup{ + # window = { + # backdrop = 1.0, -- shade the backdrop of the Zen window. Set to 1 to keep the same as Normal + # -- height and width can be: + # -- * an absolute number of cells when > 1 + # -- * a percentage of the width / height of the editor when <= 1 + # -- * a function that returns the width or the height + # width = 120, -- width of the Zen window + # height = 1, -- height of the Zen window + # -- by default, no options are changed for the Zen window + # -- uncomment any of the options below, or add other vim.wo options you want to apply + # options = { + # signcolumn = "no", -- disable signcolumn + # number = false, -- disable number column + # relativenumber = false, -- disable relative numbers + # cursorline = false, -- disable cursorline + # cursorcolumn = false, -- disable cursor column + # foldcolumn = "0", -- disable fold column + # list = false, -- disable whitespace characters + # }, + # }, + # plugins = { + # -- disable some global vim options (vim.o...) + # -- comment the lines to not apply the options + # options = { + # enabled = true, + # ruler = false, -- disables the ruler text in the cmd line area + # showcmd = false, -- disables the command in the last line of the screen + # }, + # twilight = { enabled = true }, -- enable to start Twilight when zen mode opens + # gitsigns = { enabled = false }, -- disables git signs + # tmux = { enabled = false }, -- disables the tmux statusline + # -- this will change the font size on kitty when in zen mode + # -- to make this work, you need to set the following kitty options: + # -- - allow_remote_control socket-only + # -- - listen_on unix:/tmp/kitty + # kitty = { + # enabled = true, + # font = "+2", -- font size increment + # }, + # }, + # } + # require('twilight').setup{} + # EOF + # ''; + + extraPackages = with pkgs; [ # used to compile tree-sitter grammar # python-with-my-packages # nodejs @@ -109,6 +89,7 @@ gopls gcc shellcheck + shfmt proselint nixfmt # statix @@ -116,90 +97,105 @@ # nodePackages.typescript-language-server # luajitPackages.lua-lsp fennel-ls - unstable.starpls-bin + unstable.starpls-bin ]; - plugins = with pkgs.vimPlugins; [ - #hotpot - hotpot-nvim - # ui - lualine-nvim - neo-tree-nvim - fzf-vim - vim-devicons - nvim-web-devicons - telescope-nvim - plenary-nvim - FTerm-nvim - barbar-nvim - neovim-ayu - rainbow_parentheses-vim - auto-session - which-key-nvim - aerial-nvim - todo-comments-nvim - indent-blankline-nvim - - # Tree sitter - (nvim-treesitter.withPlugins (p: [ p.nix p.clojure p.fennel p.lua p.html p.css p.regex p.supercollider p.beancount p.markdown_inline p.markdown p.glsl p.yaml p.toml p.dockerfile p.json p.go p.starlark ])) - nvim-treesitter-context - nvim-treesitter-textobjects - - # TODO - nvim-navic - undotree - marks-nvim - - # language - vim-nix - emmet-vim - csv-vim - direnv-vim - # conjure - - # kitaab stuff - vimwiki - vim-zettel - hologram-nvim - - # lsp stuff - nvim-lspconfig - nvim-cmp - cmp-nvim-lsp - cmp-treesitter - # cmp-conjure - cmp-buffer - cmp-path - cmp-spell - lspkind-nvim - conform-nvim - none-ls-nvim - mini-nvim - lspsaga-nvim - # nvim-lspfuzzy - - # git stuff - vim-fugitive - gitsigns-nvim - fzf-checkout-vim - - # Clojure stuff - # conjure - vim-sexp - vim-sexp-mappings-for-regular-people - fennel-vim - - vim-tidal - # experimental - nvim-luapad - scnvim - flash-nvim - vim-beancount - # vimtex - # custom - # nvim-parinfer - # vim-processing - ]; + plugins = with pkgs.unstable.vimPlugins; + [ + #hotpot + hotpot-nvim + nvim-navic + # ui + lualine-nvim + neo-tree-nvim + fzf-vim + vim-devicons + nvim-web-devicons + telescope-nvim + plenary-nvim + FTerm-nvim + barbar-nvim + neovim-ayu + rainbow_parentheses-vim + auto-session + which-key-nvim + aerial-nvim + todo-comments-nvim + indent-blankline-nvim + nvim-parinfer + + # Tree sitter + (nvim-treesitter.withPlugins (p: [ + p.nix + p.clojure + p.fennel + p.lua + p.html + p.css + p.regex + p.supercollider + p.beancount + p.markdown_inline + p.markdown + p.glsl + p.yaml + p.toml + p.dockerfile + p.json + p.go + p.starlark + ])) + nvim-treesitter-context + nvim-treesitter-textobjects + + # TODO + undotree + marks-nvim + + # language + vim-nix + emmet-vim + csv-vim + direnv-vim + # conjure + + # kitaab stuff + vimwiki + vim-zettel + hologram-nvim + + # lsp stuff + nvim-lspconfig + nvim-cmp + cmp-nvim-lsp + cmp-treesitter + # cmp-conjure + cmp-buffer + cmp-path + cmp-spell + lspkind-nvim + conform-nvim + none-ls-nvim + mini-nvim + lspsaga-nvim + # nvim-lspfuzzy + + # git stuff + vim-fugitive + gitsigns-nvim + fzf-checkout-vim + + # Clojure stuff + # conjure + vim-sexp + vim-sexp-mappings-for-regular-people + fennel-vim + + # nvim-luapad + scnvim + flash-nvim + vim-beancount + ] ++ [ pkgs.vimPlugins.vim-tidal ]; # withPython3 = true; # extraPython3Packages = pkgs: with pkgs; [ tasklib six ]; # vimAlias = true; -- 2.51.2 From 622e3811576cebc974b32790ef98fe263250c9d7 Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Tue, 27 Aug 2024 19:45:20 -0700 Subject: [PATCH 70/78] it's done, i promise --- home/profiles/nvim/config/fnl/conf/lsp.fnl | 16 ++++++++-------- home/profiles/nvim/config/fnl/conf/plugins.fnl | 8 ++++---- home/profiles/nvim/default.nix | 1 - 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/home/profiles/nvim/config/fnl/conf/lsp.fnl b/home/profiles/nvim/config/fnl/conf/lsp.fnl index 03192fd..eba06d6 100644 --- a/home/profiles/nvim/config/fnl/conf/lsp.fnl +++ b/home/profiles/nvim/config/fnl/conf/lsp.fnl @@ -1,20 +1,20 @@ (import-macros {: do-req } :lib/macros) (local lspkind (require :lspkind)) (local lspconfig (require :lspconfig)) -(local lspsaga (require :lspsaga)) +; (local lspsaga (require :lspsaga)) (local cmp (require :cmp)) (local nvim (require :lib/nvim)) ; (local lspfuzzy (require :lspfuzzy)) ; Not available on Nix ; (local sg (require :sg)) ; (local lsputil (require :lspconfig/util)) -(lspsaga.setup {:border_style "rounded" - :code_action_icon "" - :code_action_num_shortcut true - :code_action_lightbulb { :enable false} - :show_outline { :enable false}}) - -(nvim.opt :winbar "%f") +;(lspsaga.setup {:border_style "rounded" +; :code_action_icon "" +; :code_action_num_shortcut false +; :ui {:code_action ""} +; :show_outline {:enable false})) +; +;(nvim.opt :winbar nil) (local signs {:Error " " :Warn " " diff --git a/home/profiles/nvim/config/fnl/conf/plugins.fnl b/home/profiles/nvim/config/fnl/conf/plugins.fnl index 94a264d..f136589 100644 --- a/home/profiles/nvim/config/fnl/conf/plugins.fnl +++ b/home/profiles/nvim/config/fnl/conf/plugins.fnl @@ -5,9 +5,9 @@ (let [lualine (require :lualine)] (lualine.setup {:options {:theme "ayu"} - :sections {:lualine_c [:filename (fn [] - (let [lspsaga (require :lspsaga.symbol.winbar)] - (lspsaga.get_bar)))] + :sections {; :lualine_c [:filename (fn [] + ; (let [lspsaga (require :lspsaga.symbol.winbar)] + ; (lspsaga.get_bar)) :lualine_y [(fn [] (var msg "No Active LSP") (let [buf_ft (vim.api.nvim_buf_get_option 0 "filetype") @@ -28,7 +28,7 @@ :delete "ds" :replace "cs"}}) (do-req :todo-comments :setup) -(do-req :ibl :setup {:exclude {:language ["fennel" "clojure" "janet"]}}) +(do-req :ibl :setup {:scope {:exclude {:language ["fennel" "clojure" "janet"]}}}) (do-req :nvim-treesitter.configs :setup {:highlight {:enable true} :textobjects {:enable true} diff --git a/home/profiles/nvim/default.nix b/home/profiles/nvim/default.nix index 66a0254..aff4ef2 100644 --- a/home/profiles/nvim/default.nix +++ b/home/profiles/nvim/default.nix @@ -177,7 +177,6 @@ conform-nvim none-ls-nvim mini-nvim - lspsaga-nvim # nvim-lspfuzzy # git stuff -- 2.51.2 From 0c331b8db892fcc52e67582721959b9ba47de250 Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Tue, 27 Aug 2024 19:48:42 -0700 Subject: [PATCH 71/78] put after dir in the right place --- home/profiles/nvim/config/{fnl => }/after/syntax/vimwiki.vim | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename home/profiles/nvim/config/{fnl => }/after/syntax/vimwiki.vim (100%) diff --git a/home/profiles/nvim/config/fnl/after/syntax/vimwiki.vim b/home/profiles/nvim/config/after/syntax/vimwiki.vim similarity index 100% rename from home/profiles/nvim/config/fnl/after/syntax/vimwiki.vim rename to home/profiles/nvim/config/after/syntax/vimwiki.vim -- 2.51.2 From b096dcc50218d8df6a447e19cd6a4fad46053d6a Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Tue, 27 Aug 2024 21:21:13 -0700 Subject: [PATCH 72/78] remove old config --- home/profiles/nvim/default.nix | 58 ---------------------------------- 1 file changed, 58 deletions(-) diff --git a/home/profiles/nvim/default.nix b/home/profiles/nvim/default.nix index aff4ef2..48580ac 100644 --- a/home/profiles/nvim/default.nix +++ b/home/profiles/nvim/default.nix @@ -19,64 +19,6 @@ programs.neovim = { enable = true; - # extraConfig = '' - # filetype plugin on - # set shortmess+=c - - # " Pasting - # :map sy :!xclip -i - # :vmap sy "*y - # :map sp :r!xclip -o - - # " lua config - - # -- zen mode - # require('zen-mode').setup{ - # window = { - # backdrop = 1.0, -- shade the backdrop of the Zen window. Set to 1 to keep the same as Normal - # -- height and width can be: - # -- * an absolute number of cells when > 1 - # -- * a percentage of the width / height of the editor when <= 1 - # -- * a function that returns the width or the height - # width = 120, -- width of the Zen window - # height = 1, -- height of the Zen window - # -- by default, no options are changed for the Zen window - # -- uncomment any of the options below, or add other vim.wo options you want to apply - # options = { - # signcolumn = "no", -- disable signcolumn - # number = false, -- disable number column - # relativenumber = false, -- disable relative numbers - # cursorline = false, -- disable cursorline - # cursorcolumn = false, -- disable cursor column - # foldcolumn = "0", -- disable fold column - # list = false, -- disable whitespace characters - # }, - # }, - # plugins = { - # -- disable some global vim options (vim.o...) - # -- comment the lines to not apply the options - # options = { - # enabled = true, - # ruler = false, -- disables the ruler text in the cmd line area - # showcmd = false, -- disables the command in the last line of the screen - # }, - # twilight = { enabled = true }, -- enable to start Twilight when zen mode opens - # gitsigns = { enabled = false }, -- disables git signs - # tmux = { enabled = false }, -- disables the tmux statusline - # -- this will change the font size on kitty when in zen mode - # -- to make this work, you need to set the following kitty options: - # -- - allow_remote_control socket-only - # -- - listen_on unix:/tmp/kitty - # kitty = { - # enabled = true, - # font = "+2", -- font size increment - # }, - # }, - # } - # require('twilight').setup{} - # EOF - # ''; - extraPackages = with pkgs; [ # used to compile tree-sitter grammar # python-with-my-packages -- 2.51.2 From c313ef0f394e8b72fd0ae7eab673e68ea6731b02 Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Thu, 29 Aug 2024 18:28:39 -0700 Subject: [PATCH 73/78] add work ssh key to allowed keys on anish --- hosts/users/anish/default.nix | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hosts/users/anish/default.nix b/hosts/users/anish/default.nix index 51309b3..163c46b 100644 --- a/hosts/users/anish/default.nix +++ b/hosts/users/anish/default.nix @@ -4,7 +4,8 @@ programs.zsh.enable = true; users.users.anish = { description = "Personal user for Anish"; - hashedPassword = "$y$j9T$y3DPt/dWaPE.gRazQqw1w0$1RMH5sl/Nu8kW3ZMywYCPRniHD/jF5qRh0VKrdJ.bV2"; + hashedPassword = + "$y$j9T$y3DPt/dWaPE.gRazQqw1w0$1RMH5sl/Nu8kW3ZMywYCPRniHD/jF5qRh0VKrdJ.bV2"; shell = pkgs.zsh; isNormalUser = true; extraGroups = [ "wheel" "audio" "networkmanager" "video" ]; @@ -15,6 +16,8 @@ "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDtU2GMYjXj6RGO1+mwM4TDGOo0qrKLTL4Di8+QgDX0p5vUEsnE1PS9wnuqCmSu75U8g0XIAMtvtdYyGk1N+Bx01erAZpT8DLYtIXFCyaiN28PVu5T1D0T+TQ7xgIH1qenXZR2DOQdf6kpvKEfm7+7bWhCo0N/KFMpmReubyzHDQcq/1qQasxTL+YALQFOjwKqsOTBXbHwZ103AEAcQX4ftBFEOfVli4/1aKIK4dNSZYB7J9Htq707YnsEqo9RLAMh0aOTTYgTx9AoSUDeqGuh/AGkcB7NcS7EEtI6d5YUGylwZh/gF6hqE0jl8kn2m5jMKXL3CRohZvjifue8x/GIjpu5WRabUuhBEbrfTQQaC7taHnt5rvYCGzKZx09TexUzhuz2CL480DRoxSG+P+lCNm1dIg/EZrnGEzXCSr36PlOqS5t5gm8tPkzCmZf2wU15A3ZIYUPmnYLqsn4WmIV7rKmdqt2ctWELUXow3PPiZXBucP9P3xpsYEfF1SB2SGNc= u0_a139@localhost" # Box "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDKN8/SH55DBiwVoSnTU8k2Pen+wmovL9QaMyehxGEsJJv/8fzwsswGalD4C/4O51LOvdu4UKkZW5hG02uVSK+58p3UV3pOPyoqsu/aDeIsWsqmTeTzUrBIWOlNzcDKnohLz2oGC5YO+wyTJ9Iteq6aGJDjErsW7sG3h5lXCs551EmJNNGhtBQaaoytMNnWqSdlVjDNCijurH7WUpp40U/RjEp532l4rX6eIIj3jBKEFbhZkFSSjqbj4xM4SyFt+Jmigb1RMjsQjmpfY1vDtM84RcYfpTUte/T5w2dkD5H6kccmWnwKSJpm9wXfx4E7lR9APdUGnau2U1+XxiD3ytGl anish@box" + # Work + "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC/vvh0i6+uAN0GWlK6ZfyTlc/AW54xe2CroUDsDSoGnFKeIUiSsWexobODlVakNhqwCKfsvUh6g+RdA8ZVcamATcYqxysP4X5fRksmAzRm5281O7ZBDHMB2BdcfHSTgiz7JvMRIQYWDlU8Ck6IL4wlN0b2GMUj9t/GeG37us8280rxpRNoIY7M27AJEZ7XNQhctBIVujxctVBgIMYmZiTwziU7ywJv4rNT5OAWvjRXSo1rkxdvx3VESv4y/mp8m7dEupZpIjIFsLs52+UG5LtadulUqtTWg05sCw8LEcmRhflgZSAvjw60RrKFCuWxc8+/Pmaw+zExeBMenqi0NzuTc3S3k2wCKVIZDh/0tlXzIwZ6WRqxDevUtEKfvbEFMXd8akhTfYs0dyszcFRevBxOBPbcKku+FK/HkdPLmEANvxYty3cv+Eipkz3c8JPJPvXNTXrjepXMm0LUKodO3c15hGogCOxUO38kykkyYnn+MxxHparoMfEr2+oHNpQoS5wA1G43ppqjVoRDgnhleu6ixwRkLZzphY3cnOd5jL9Ie5xIGbFWH1qSlQRdHBkHjuf85z7+QK8nFYAhmG1K3Vt3GNtF8LN1tYQkfwBJ/vsroMNzGPoq4PjVbqb80Eq+96cP89XKfU2/xw1g+p2lJDm/zC1WCjXVzf8NRwC7gqPavQ== anishlakhwara@anishs-mbp.lan" ]; }; } -- 2.51.2 From a8909b7a6a7c1d8ae2083d09d774179640d67f03 Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Sat, 12 Oct 2024 23:08:19 -0700 Subject: [PATCH 74/78] as much effor as i'm currently willing to put in --- home/profiles/nvim/config/fnl/conf/init.fnl | 4 ++++ home/profiles/nvim/config/fnl/conf/mappings.fnl | 7 ++++++- home/profiles/nvim/config/fnl/conf/plugins.fnl | 2 +- home/profiles/nvim/config/fnl/conf/plugins/kitaab.fnl | 3 +++ home/profiles/nvim/config/fnl/lib/macros.fnl | 2 ++ home/profiles/nvim/default.nix | 4 ++++ 6 files changed, 20 insertions(+), 2 deletions(-) diff --git a/home/profiles/nvim/config/fnl/conf/init.fnl b/home/profiles/nvim/config/fnl/conf/init.fnl index be0765f..e59db72 100644 --- a/home/profiles/nvim/config/fnl/conf/init.fnl +++ b/home/profiles/nvim/config/fnl/conf/init.fnl @@ -45,3 +45,7 @@ (vim.api.nvim_create_autocmd ["FileType"] {:pattern ["mail"] :command "setlocal spell"}) + +; Svelte +(vim.api.nvim_create_autocmd ["BufNewFile" "BufRead"] {:pattern ["*.svelte"] + :command "setf svelte"}) diff --git a/home/profiles/nvim/config/fnl/conf/mappings.fnl b/home/profiles/nvim/config/fnl/conf/mappings.fnl index 6c38cd5..94e506c 100644 --- a/home/profiles/nvim/config/fnl/conf/mappings.fnl +++ b/home/profiles/nvim/config/fnl/conf/mappings.fnl @@ -18,6 +18,9 @@ (nvim.keymap [:n] "Y" "y$") ; Unmap Q (nvim.keymap [] "Q" "") +; TODO +; ESC clears search +; (nvim.keymap [:n] "" "") ; FTerm (vim.api.nvim_create_user_command "FTermToggle" (fn [_] @@ -105,7 +108,9 @@ :t ["TodoTelescope" "Search TODOs in project"] :c ["let @/ = \"\":echo 'Search highlight cleared'" - "Clear search"]} + "Clear search"] + :g ["Telescope live_grep" + "Find Grep (in Telescope)"]} ; Code "c" {:name "Code" :d [":lua vim.lsp.buf.definition()" diff --git a/home/profiles/nvim/config/fnl/conf/plugins.fnl b/home/profiles/nvim/config/fnl/conf/plugins.fnl index f136589..2648369 100644 --- a/home/profiles/nvim/config/fnl/conf/plugins.fnl +++ b/home/profiles/nvim/config/fnl/conf/plugins.fnl @@ -37,7 +37,7 @@ (do-req :auto-session :setup {:log_level "info" :auto_session_suppress_dirs ["~/"]}) -(nvim.opt :sessionoptions "blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal") +(nvim.opt :sessionoptions "blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal,localoptions") (do-req :aerial :setup {}) ;{:on_attach (fn [bufnr] ; (do diff --git a/home/profiles/nvim/config/fnl/conf/plugins/kitaab.fnl b/home/profiles/nvim/config/fnl/conf/plugins/kitaab.fnl index fc8bfea..06f21ad 100644 --- a/home/profiles/nvim/config/fnl/conf/plugins/kitaab.fnl +++ b/home/profiles/nvim/config/fnl/conf/plugins/kitaab.fnl @@ -29,6 +29,9 @@ (if (and (= index 4) (not written)) (vim.api.nvim_buf_set_lines 0 3 index false [message]))))) +; Custom function for inserting links through telescope grep_search +; Visual mode too! + (vim.api.nvim_create_autocmd "BufWritePre" {:pattern ["*.wiki"] :callback update_date}) diff --git a/home/profiles/nvim/config/fnl/lib/macros.fnl b/home/profiles/nvim/config/fnl/lib/macros.fnl index 9985c15..2a532d4 100644 --- a/home/profiles/nvim/config/fnl/lib/macros.fnl +++ b/home/profiles/nvim/config/fnl/lib/macros.fnl @@ -1,3 +1,5 @@ +;; fennel-ls: macro-file + (fn do-req [mod key ...] `(let [name# (require ,mod) fun# (. name# ,key)] diff --git a/home/profiles/nvim/default.nix b/home/profiles/nvim/default.nix index 48580ac..81fff75 100644 --- a/home/profiles/nvim/default.nix +++ b/home/profiles/nvim/default.nix @@ -85,6 +85,9 @@ p.dockerfile p.json p.go + p.svelte + p.javascript + p.janet-simple p.starlark ])) nvim-treesitter-context @@ -99,6 +102,7 @@ emmet-vim csv-vim direnv-vim + vim-svelte # conjure # kitaab stuff -- 2.51.2 From 0f8923ea4d4a20be9c5e7d64528cd2d62466d3a2 Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Sat, 12 Oct 2024 23:08:36 -0700 Subject: [PATCH 75/78] add gitbug --- shell.nix | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/shell.nix b/shell.nix index 33bd22c..dea7de7 100644 --- a/shell.nix +++ b/shell.nix @@ -5,6 +5,14 @@ default = pkgs.mkShell { # Enable experimental features without having to specify the argument NIX_CONFIG = "experimental-features = nix-command flakes"; - nativeBuildInputs = with pkgs; [ nix home-manager git agenix deploy-rs dnscontrol ]; + nativeBuildInputs = with pkgs; [ + nix + home-manager + git + agenix + deploy-rs + dnscontrol + git-bug + ]; }; } -- 2.51.2 From 7e85c8ce68a8ee8a1622f27a077a586a81fb485a Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Sat, 12 Oct 2024 23:09:05 -0700 Subject: [PATCH 76/78] curnve does ssh now too --- hosts/curve/default.nix | 39 ++++++++++++++++++++++------------- hosts/users/anish/default.nix | 4 ++-- 2 files changed, 27 insertions(+), 16 deletions(-) diff --git a/hosts/curve/default.nix b/hosts/curve/default.nix index 26808fd..39534ad 100644 --- a/hosts/curve/default.nix +++ b/hosts/curve/default.nix @@ -1,5 +1,4 @@ -{ self, pkgs, ... }: -{ +{ self, pkgs, ... }: { imports = [ ./configuration.nix ../users/anish @@ -17,19 +16,26 @@ # ../profiles/mount-mossnet ]; + # temporarily allow ssh access for work, to be able to do deploy new services + services.openssh = { + enable = true; + settings.PasswordAuthentication = false; + settings.PermitRootLogin = "no"; + }; + # import profiling tools programs.systemtap.enable = true; virtualisation.docker.enable = true; virtualisation.docker.storageDriver = "btrfs"; - environment.systemPackages = with pkgs; [ - docker-compose - ]; + environment.systemPackages = with pkgs; [ docker-compose ]; # Speed up boot by removing dependency on network systemd = { - targets.network-online.wantedBy = pkgs.lib.mkForce [ ]; # Normally ["multi-user.target"] - services.NetworkManager-wait-online.wantedBy = pkgs.lib.mkForce [ ]; # Normally ["network-online.target"] + targets.network-online.wantedBy = + pkgs.lib.mkForce [ ]; # Normally ["multi-user.target"] + services.NetworkManager-wait-online.wantedBy = + pkgs.lib.mkForce [ ]; # Normally ["network-online.target"] }; programs.gnupg.agent.enable = true; @@ -64,8 +70,15 @@ # lazy enable of ports necessary for KDE connect which is installed via cli home profile (for some reason?) networking.firewall = { - allowedTCPPortRanges = [{ from = 1714; to = 1764; }]; - allowedUDPPortRanges = [{ from = 1714; to = 1764; }]; + allowedTCPPorts = [ 22 ]; # allow ssh + allowedTCPPortRanges = [{ + from = 1714; + to = 1764; + }]; + allowedUDPPortRanges = [{ + from = 1714; + to = 1764; + }]; }; age.secrets.curve-wg.file = "${self}/secrets/curve-wg.age"; @@ -81,10 +94,7 @@ mossnet.backup = { enable = true; name = "curve"; - paths = [ - "/home/anish/usr" - "/home/anish/.ssh" - ]; + paths = [ "/home/anish/usr" "/home/anish/.ssh" ]; }; # enable adb @@ -93,7 +103,8 @@ #virtualisation.docker.enable = true; boot.blacklistedKernelModules = [ "qcserial" ]; # Used for packer Capsul - users.users.anish.extraGroups = [ "adbusers" "wheel" "plugdev" "libvertd" "docker" ]; + users.users.anish.extraGroups = + [ "adbusers" "wheel" "plugdev" "libvertd" "docker" ]; virtualisation.libvirtd.enable = true; hardware.keyboard.zsa.enable = true; services.udev.extraRules = '' diff --git a/hosts/users/anish/default.nix b/hosts/users/anish/default.nix index 163c46b..2dbc901 100644 --- a/hosts/users/anish/default.nix +++ b/hosts/users/anish/default.nix @@ -12,10 +12,10 @@ openssh.authorizedKeys.keys = [ # Curve "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDM0Zvei46x/yZl/IeBCq6+IYQQ0avulzVyBysF9cPigZMCybWRV7IEU+E3k9t6JrbdbdGfJkcZIWmsWDdKS8W8mBnZpVoT0ffLynu8JQ/TKdGm4Qv6bgUeKNrGsNv0ZPs2CDaGSLj0oJfRF7Ko10tcLP0vW+yujrh+y6TH/vVzJioaV4TGvtCUpn+wEQah9ROwPQLUUofsSWdnRsDJ/gp37zXWs4l5wyjSKtP3O9RZUP7kBekbSqEgSXiTk0oUQSVqIWl9NDiP6onk/gSOjXsR/JPqsSN/XI/c/yj6gyY0f51Ru2D7iBxuMJIJcWV+rU6coIj+ULcQWLzt/7TI8jq5AOOzI/ll4zbL24Eo84Rz+TP9tvMMhDZ0VaMN22AJ8qQEjc5P09tWKsX7Jg39XelyV1jHXncE4yvIE9F4RSCHzWCeKeXakizQNuzSaxTxIExRFYHjNW5bR6+3MTGwVrEIXU+qML+0yFTR86MT+tdY5AreAJQLwbog79O1NupeXJE= anish@curve" - # Line - "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDtU2GMYjXj6RGO1+mwM4TDGOo0qrKLTL4Di8+QgDX0p5vUEsnE1PS9wnuqCmSu75U8g0XIAMtvtdYyGk1N+Bx01erAZpT8DLYtIXFCyaiN28PVu5T1D0T+TQ7xgIH1qenXZR2DOQdf6kpvKEfm7+7bWhCo0N/KFMpmReubyzHDQcq/1qQasxTL+YALQFOjwKqsOTBXbHwZ103AEAcQX4ftBFEOfVli4/1aKIK4dNSZYB7J9Htq707YnsEqo9RLAMh0aOTTYgTx9AoSUDeqGuh/AGkcB7NcS7EEtI6d5YUGylwZh/gF6hqE0jl8kn2m5jMKXL3CRohZvjifue8x/GIjpu5WRabUuhBEbrfTQQaC7taHnt5rvYCGzKZx09TexUzhuz2CL480DRoxSG+P+lCNm1dIg/EZrnGEzXCSr36PlOqS5t5gm8tPkzCmZf2wU15A3ZIYUPmnYLqsn4WmIV7rKmdqt2ctWELUXow3PPiZXBucP9P3xpsYEfF1SB2SGNc= u0_a139@localhost" # Box "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDKN8/SH55DBiwVoSnTU8k2Pen+wmovL9QaMyehxGEsJJv/8fzwsswGalD4C/4O51LOvdu4UKkZW5hG02uVSK+58p3UV3pOPyoqsu/aDeIsWsqmTeTzUrBIWOlNzcDKnohLz2oGC5YO+wyTJ9Iteq6aGJDjErsW7sG3h5lXCs551EmJNNGhtBQaaoytMNnWqSdlVjDNCijurH7WUpp40U/RjEp532l4rX6eIIj3jBKEFbhZkFSSjqbj4xM4SyFt+Jmigb1RMjsQjmpfY1vDtM84RcYfpTUte/T5w2dkD5H6kccmWnwKSJpm9wXfx4E7lR9APdUGnau2U1+XxiD3ytGl anish@box" + # Nix-on-droid line + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJOiXBPVvZAp1fY0a0Tupxj0Ml6MoA51lvqt/jAQq249 nix-on-droid@localhost" # Work "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC/vvh0i6+uAN0GWlK6ZfyTlc/AW54xe2CroUDsDSoGnFKeIUiSsWexobODlVakNhqwCKfsvUh6g+RdA8ZVcamATcYqxysP4X5fRksmAzRm5281O7ZBDHMB2BdcfHSTgiz7JvMRIQYWDlU8Ck6IL4wlN0b2GMUj9t/GeG37us8280rxpRNoIY7M27AJEZ7XNQhctBIVujxctVBgIMYmZiTwziU7ywJv4rNT5OAWvjRXSo1rkxdvx3VESv4y/mp8m7dEupZpIjIFsLs52+UG5LtadulUqtTWg05sCw8LEcmRhflgZSAvjw60RrKFCuWxc8+/Pmaw+zExeBMenqi0NzuTc3S3k2wCKVIZDh/0tlXzIwZ6WRqxDevUtEKfvbEFMXd8akhTfYs0dyszcFRevBxOBPbcKku+FK/HkdPLmEANvxYty3cv+Eipkz3c8JPJPvXNTXrjepXMm0LUKodO3c15hGogCOxUO38kykkyYnn+MxxHparoMfEr2+oHNpQoS5wA1G43ppqjVoRDgnhleu6ixwRkLZzphY3cnOd5jL9Ie5xIGbFWH1qSlQRdHBkHjuf85z7+QK8nFYAhmG1K3Vt3GNtF8LN1tYQkfwBJ/vsroMNzGPoq4PjVbqb80Eq+96cP89XKfU2/xw1g+p2lJDm/zC1WCjXVzf8NRwC7gqPavQ== anishlakhwara@anishs-mbp.lan" ]; -- 2.51.2 From 3e595b6e044929efa235a24ca159d54663095492 Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Sat, 12 Oct 2024 23:09:21 -0700 Subject: [PATCH 77/78] some bspwmrc changes --- home/profiles/desktop/bspwmrc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/home/profiles/desktop/bspwmrc b/home/profiles/desktop/bspwmrc index 852a46a..236fe0c 100755 --- a/home/profiles/desktop/bspwmrc +++ b/home/profiles/desktop/bspwmrc @@ -6,7 +6,7 @@ # esac export MONITOR=$(xrandr -q | grep primary | cut -d' ' -f1) -export MONITORS=( $(xrandr -q | grep ' connected' | cut -d' ' -f1) ) +export MONITORS=($(xrandr -q | grep ' connected' | cut -d' ' -f1)) MONITOR=${MONITOR:-${MONITORS[0]}} # Only have workspaces for primary monitor @@ -26,7 +26,7 @@ bspc config active_border_color "#181a23" bspc config focused_border_color "#bd93f9" bspc config presel_feedback_color "#bd93f9" -bspc config split_ratio 0.71 +bspc config split_ratio 0.71 # Extra padding for polybar bspc config -m primary top_padding 34 -- 2.51.2 From 805190291f7663ed10abed55f5c2fc109d5d2079 Mon Sep 17 00:00:00 2001 From: Anish Lakhwara Date: Sat, 3 May 2025 22:51:12 -0700 Subject: [PATCH 78/78] add zk --- home/profiles/nvim/config/fnl/conf/plugins.fnl | 2 ++ home/profiles/nvim/default.nix | 1 + 2 files changed, 3 insertions(+) diff --git a/home/profiles/nvim/config/fnl/conf/plugins.fnl b/home/profiles/nvim/config/fnl/conf/plugins.fnl index 2648369..0b3390c 100644 --- a/home/profiles/nvim/config/fnl/conf/plugins.fnl +++ b/home/profiles/nvim/config/fnl/conf/plugins.fnl @@ -43,3 +43,5 @@ ; (do ; (vim.keymap.set "n" "{" "AerialPrev" { :buffer bufnr}) ; (vim.keymap.set "n" "}" "AerialNext" { :buffer bufnr})) + +(do-req :zk :setup) diff --git a/home/profiles/nvim/default.nix b/home/profiles/nvim/default.nix index 81fff75..0bf0eba 100644 --- a/home/profiles/nvim/default.nix +++ b/home/profiles/nvim/default.nix @@ -109,6 +109,7 @@ vimwiki vim-zettel hologram-nvim + zk-nvim # lsp stuff nvim-lspconfig -- 2.51.2