diff --git a/.direnv/bin/nix-direnv-reload b/.direnv/bin/nix-direnv-reload old mode 100644 new mode 100755 index 186ac961..15932940 --- a/.direnv/bin/nix-direnv-reload +++ b/.direnv/bin/nix-direnv-reload @@ -1,8 +1,19 @@ #!/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 +set -e +if [[ ! -d "/home/anish/usr/helm" ]]; then + echo "Cannot find source directory; Did you move it?" + echo "(Looking for "/home/anish/usr/helm")" + echo 'Cannot force reload with this script - use "direnv reload" manually and then try again' + exit 1 +fi +# rebuild the cache forcefully +_nix_direnv_force_reload=1 direnv exec "/home/anish/usr/helm" true + +# Update the mtime for .envrc. +# This will cause direnv to reload again - but without re-building. +touch "/home/anish/usr/helm/.envrc" + +# Also update the timestamp of whatever profile_rc we have. +# This makes sure that we know we are up to date. +touch -r "/home/anish/usr/helm/.envrc" "/home/anish/usr/helm/.direnv"/*.rc diff --git a/.direnv/flake-profile-a5d5b61aa8a61b7d9d765e1daf971a9a578f1cfa.rc b/.direnv/flake-profile-a5d5b61aa8a61b7d9d765e1daf971a9a578f1cfa.rc index 02887e50..0d32b85e 100644 --- a/.direnv/flake-profile-a5d5b61aa8a61b7d9d765e1daf971a9a578f1cfa.rc +++ b/.direnv/flake-profile-a5d5b61aa8a61b7d9d765e1daf971a9a578f1cfa.rc @@ -7,15 +7,15 @@ AR='ar' export AR AS='as' export AS -BASH='/nix/store/7dpxg7ki7g8ynkdwcqf493p2x8divb4i-bash-5.2-p15/bin/bash' +BASH='/nix/store/cfqbabpc7xwg8akbcchqbq3cai6qq2vs-bash-5.2p37/bin/bash' CC='gcc' export CC -CONFIG_SHELL='/nix/store/7dpxg7ki7g8ynkdwcqf493p2x8divb4i-bash-5.2-p15/bin/bash' +CONFIG_SHELL='/nix/store/cfqbabpc7xwg8akbcchqbq3cai6qq2vs-bash-5.2p37/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' +HOST_PATH='/nix/store/rry6qingvsrqmc7ll7jgaqpybcbdgf5v-coreutils-9.7/bin:/nix/store/392hs9nhm6wfw4imjllbvb1wil1n39qx-findutils-4.10.0/bin:/nix/store/xw0mf3shymq3k7zlncf09rm8917sdi4h-diffutils-3.12/bin:/nix/store/4rpiqv9yr2pw5094v4wc33ijkqjpm9sa-gnused-4.9/bin:/nix/store/l2wvwyg680h0v2la18hz3yiznxy2naqw-gnugrep-3.11/bin:/nix/store/c1z5j28ndxljf1ihqzag57bwpfpzms0g-gawk-5.3.2/bin:/nix/store/w60s4xh1pjg6dwbw7j0b4xzlpp88q5qg-gnutar-1.35/bin:/nix/store/xd9m9jkvrs8pbxvmkzkwviql33rd090j-gzip-1.14/bin:/nix/store/w1pxx760yidi7n9vbi5bhpii9xxl5vdj-bzip2-1.0.8-bin/bin:/nix/store/xk0d14zpm0njxzdm182dd722aqhav2cc-gnumake-4.4.1/bin:/nix/store/cfqbabpc7xwg8akbcchqbq3cai6qq2vs-bash-5.2p37/bin:/nix/store/gj54zvf7vxll1mzzmqhqi1p4jiws3mfb-patch-2.7.6/bin:/nix/store/22rpb6790f346c55iqi6s9drr5qgmyjf-xz-5.8.1-bin/bin:/nix/store/xlmpcglsq8l09qh03rf0virz0331pjdc-file-5.45/bin' export HOST_PATH IFS=' ' @@ -25,25 +25,25 @@ LD='ld' export LD LINENO='76' MACHTYPE='x86_64-pc-linux-gnu' -NIX_BINTOOLS='/nix/store/qcg3rpl1l103zb1xfsw40wm9j5hzrp7y-binutils-wrapper-2.40' +NIX_BINTOOLS='/nix/store/87zpmcmwvn48z4lbrfba74b312h22s6c-binutils-wrapper-2.44' 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' +NIX_CC='/nix/store/kaj8d1zcn149m40s9h0xi0khakibiphz-gcc-wrapper-14.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' +NIX_CFLAGS_COMPILE=' -frandom-seed=5s10b8rs3j -isystem /nix/store/8znh07lsz9q2fdp6fgcdwwv035xxfrl1-nix-2.28.4-dev/include -isystem /nix/store/qwnz3z0hf5pdhwsn92dc9lhlq4a3lsqk-boehm-gc-8.2.8-dev/include -isystem /nix/store/235hvgzcbl06fxy53515q8sr6lljvf68-nlohmann_json-3.11.3/include -isystem /nix/store/a5b9czim7vrihag71f8dy1c467qh3mph-libarchive-3.8.0-dev/include -isystem /nix/store/0vy272ral6dwzx96wkvd90l37v0gdrk7-attr-2.5.2-dev/include -isystem /nix/store/ra69jxg2pnnjymvkn83mfr7cnhllmwnj-acl-2.3.2-dev/include -isystem /nix/store/8znh07lsz9q2fdp6fgcdwwv035xxfrl1-nix-2.28.4-dev/include -isystem /nix/store/qwnz3z0hf5pdhwsn92dc9lhlq4a3lsqk-boehm-gc-8.2.8-dev/include -isystem /nix/store/235hvgzcbl06fxy53515q8sr6lljvf68-nlohmann_json-3.11.3/include -isystem /nix/store/a5b9czim7vrihag71f8dy1c467qh3mph-libarchive-3.8.0-dev/include -isystem /nix/store/0vy272ral6dwzx96wkvd90l37v0gdrk7-attr-2.5.2-dev/include -isystem /nix/store/ra69jxg2pnnjymvkn83mfr7cnhllmwnj-acl-2.3.2-dev/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' +NIX_HARDENING_ENABLE='bindnow format fortify fortify3 pic relro stackclashprotection stackprotector strictoverflow zerocallusedregs' 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' +NIX_LDFLAGS='-rpath /home/anish/usr/helm/outputs/out/lib -L/nix/store/mrbslgynzhg5jfc05x2rlnsykzcxp2v0-boehm-gc-8.2.8/lib -L/nix/store/ik62z14lxr205b5gzfh4cjcla6gh9l6z-attr-2.5.2/lib -L/nix/store/8smmj5gbhnnqaf28qxak4xv57ccgm96p-acl-2.3.2/lib -L/nix/store/y130gnbp2qkfq6svqdv0s61b3m4043yp-libarchive-3.8.0-lib/lib -L/nix/store/7q9ll9pjrdfdb3qyfza2bzrk829izk9s-nix-2.28.4/lib -L/nix/store/mrbslgynzhg5jfc05x2rlnsykzcxp2v0-boehm-gc-8.2.8/lib -L/nix/store/ik62z14lxr205b5gzfh4cjcla6gh9l6z-attr-2.5.2/lib -L/nix/store/8smmj5gbhnnqaf28qxak4xv57ccgm96p-acl-2.3.2/lib -L/nix/store/y130gnbp2qkfq6svqdv0s61b3m4043yp-libarchive-3.8.0-lib/lib -L/nix/store/7q9ll9pjrdfdb3qyfza2bzrk829izk9s-nix-2.28.4/lib' export NIX_LDFLAGS NIX_NO_SELF_RPATH='1' NIX_STORE='/nix/store' @@ -58,13 +58,15 @@ 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' +PATH='/nix/store/53cx9nd6i328f9zqsgx6sh1krsngy5jl-attr-2.5.2-bin/bin:/nix/store/61066bhvr54xkl2ssippfa5qylwgafqf-acl-2.3.2-bin/bin:/nix/store/8fq8mhb1dlwzgq7xfaxwgn0x623yjb43-libarchive-3.8.0/bin:/nix/store/7q9ll9pjrdfdb3qyfza2bzrk829izk9s-nix-2.28.4/bin:/nix/store/hr950wkqix97b759inrbxvljkqxj5113-home-manager-0-unstable-2025-05-13/bin:/nix/store/3kwbkj8xnzw5787gbannr741bczjkrq6-git-2.50.1/bin:/nix/store/s801pmgfwy4nifm72s638v0m4f32pnc5-agenix-0.15.0/bin:/nix/store/vlc65hzrqq9a29m7j0sb4hpqlwn0ny56-deploy-rs-0-unstable-2025-06-05/bin:/nix/store/dgqa38y4hxyw30g6bvrgd18750h364vr-dnscontrol-4.20.0/bin:/nix/store/g7i75czfbw9sy5f8v7rjbama6lr3ya3s-patchelf-0.15.0/bin:/nix/store/kaj8d1zcn149m40s9h0xi0khakibiphz-gcc-wrapper-14.3.0/bin:/nix/store/8adzgnxs3s0pbj22qhk9zjxi1fqmz3xv-gcc-14.3.0/bin:/nix/store/p2ixvjsas4qw58dcwk01d22skwq4fyka-glibc-2.40-66-bin/bin:/nix/store/rry6qingvsrqmc7ll7jgaqpybcbdgf5v-coreutils-9.7/bin:/nix/store/87zpmcmwvn48z4lbrfba74b312h22s6c-binutils-wrapper-2.44/bin:/nix/store/ap35np2bkwaba3rxs3qlxpma57n2awyb-binutils-2.44/bin:/nix/store/rry6qingvsrqmc7ll7jgaqpybcbdgf5v-coreutils-9.7/bin:/nix/store/392hs9nhm6wfw4imjllbvb1wil1n39qx-findutils-4.10.0/bin:/nix/store/xw0mf3shymq3k7zlncf09rm8917sdi4h-diffutils-3.12/bin:/nix/store/4rpiqv9yr2pw5094v4wc33ijkqjpm9sa-gnused-4.9/bin:/nix/store/l2wvwyg680h0v2la18hz3yiznxy2naqw-gnugrep-3.11/bin:/nix/store/c1z5j28ndxljf1ihqzag57bwpfpzms0g-gawk-5.3.2/bin:/nix/store/w60s4xh1pjg6dwbw7j0b4xzlpp88q5qg-gnutar-1.35/bin:/nix/store/xd9m9jkvrs8pbxvmkzkwviql33rd090j-gzip-1.14/bin:/nix/store/w1pxx760yidi7n9vbi5bhpii9xxl5vdj-bzip2-1.0.8-bin/bin:/nix/store/xk0d14zpm0njxzdm182dd722aqhav2cc-gnumake-4.4.1/bin:/nix/store/cfqbabpc7xwg8akbcchqbq3cai6qq2vs-bash-5.2p37/bin:/nix/store/gj54zvf7vxll1mzzmqhqi1p4jiws3mfb-patch-2.7.6/bin:/nix/store/22rpb6790f346c55iqi6s9drr5qgmyjf-xz-5.8.1-bin/bin:/nix/store/xlmpcglsq8l09qh03rf0virz0331pjdc-file-5.45/bin' export PATH PS4='+ ' RANLIB='ranlib' export RANLIB READELF='readelf' export READELF +SHELL='/nix/store/cfqbabpc7xwg8akbcchqbq3cai6qq2vs-bash-5.2p37/bin/bash' +export SHELL SIZE='size' export SIZE SOURCE_DATE_EPOCH='315532800' @@ -73,10 +75,11 @@ 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' +XDG_DATA_DIRS='/nix/store/mrbslgynzhg5jfc05x2rlnsykzcxp2v0-boehm-gc-8.2.8/share:/nix/store/235hvgzcbl06fxy53515q8sr6lljvf68-nlohmann_json-3.11.3/share:/nix/store/ik62z14lxr205b5gzfh4cjcla6gh9l6z-attr-2.5.2/share:/nix/store/8smmj5gbhnnqaf28qxak4xv57ccgm96p-acl-2.3.2/share:/nix/store/8fq8mhb1dlwzgq7xfaxwgn0x623yjb43-libarchive-3.8.0/share:/nix/store/7q9ll9pjrdfdb3qyfza2bzrk829izk9s-nix-2.28.4/share:/nix/store/hr950wkqix97b759inrbxvljkqxj5113-home-manager-0-unstable-2025-05-13/share:/nix/store/3kwbkj8xnzw5787gbannr741bczjkrq6-git-2.50.1/share:/nix/store/dgqa38y4hxyw30g6bvrgd18750h364vr-dnscontrol-4.20.0/share:/nix/store/g7i75czfbw9sy5f8v7rjbama6lr3ya3s-patchelf-0.15.0/share' export XDG_DATA_DIRS __structuredAttrs='' export __structuredAttrs +_substituteStream_has_warned_replace_deprecation='false' buildInputs='' export buildInputs buildPhase='{ echo "------------------------------------------------------------"; @@ -89,14 +92,14 @@ buildPhase='{ echo "------------------------------------------------------------ } >> "$out" ' export buildPhase -builder='/nix/store/7dpxg7ki7g8ynkdwcqf493p2x8divb4i-bash-5.2-p15/bin/bash' +builder='/nix/store/cfqbabpc7xwg8akbcchqbq3cai6qq2vs-bash-5.2p37/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' +defaultNativeBuildInputs='/nix/store/g7i75czfbw9sy5f8v7rjbama6lr3ya3s-patchelf-0.15.0 /nix/store/gi6g289i9ydm3z896x67q210y0qq29zg-update-autotools-gnu-config-scripts-hook /nix/store/jjhw2phnaip4kg0qjas3x3fsaifi8y0w-no-broken-symlinks.sh /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/cmzya9irvxzlkh7lfy6i82gbp0saxqj3-multiple-outputs.sh /nix/store/hxv896faph0rqxjq2ycxpcrbnngc95sz-patch-shebangs.sh /nix/store/cickvswrvann041nqxb0rxilc46svw1n-prune-libtool-files.sh /nix/store/xyff06pkhki3qy1ls77w10s0v79c9il0-reproducible-builds.sh /nix/store/z7k98578dfzi6l3hsvbivzm7hfqlk0zc-set-source-date-epoch-to-latest.sh /nix/store/pilsssjjdxvdphlg2h19p0bfx5q0jzkn-strip.sh /nix/store/kaj8d1zcn149m40s9h0xi0khakibiphz-gcc-wrapper-14.3.0' depsBuildBuild='' export depsBuildBuild depsBuildBuildPropagated='' @@ -127,12 +130,12 @@ 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' +initialPath='/nix/store/rry6qingvsrqmc7ll7jgaqpybcbdgf5v-coreutils-9.7 /nix/store/392hs9nhm6wfw4imjllbvb1wil1n39qx-findutils-4.10.0 /nix/store/xw0mf3shymq3k7zlncf09rm8917sdi4h-diffutils-3.12 /nix/store/4rpiqv9yr2pw5094v4wc33ijkqjpm9sa-gnused-4.9 /nix/store/l2wvwyg680h0v2la18hz3yiznxy2naqw-gnugrep-3.11 /nix/store/c1z5j28ndxljf1ihqzag57bwpfpzms0g-gawk-5.3.2 /nix/store/w60s4xh1pjg6dwbw7j0b4xzlpp88q5qg-gnutar-1.35 /nix/store/xd9m9jkvrs8pbxvmkzkwviql33rd090j-gzip-1.14 /nix/store/w1pxx760yidi7n9vbi5bhpii9xxl5vdj-bzip2-1.0.8-bin /nix/store/xk0d14zpm0njxzdm182dd722aqhav2cc-gnumake-4.4.1 /nix/store/cfqbabpc7xwg8akbcchqbq3cai6qq2vs-bash-5.2p37 /nix/store/gj54zvf7vxll1mzzmqhqi1p4jiws3mfb-patch-2.7.6 /nix/store/22rpb6790f346c55iqi6s9drr5qgmyjf-xz-5.8.1-bin /nix/store/xlmpcglsq8l09qh03rf0virz0331pjdc-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' +nativeBuildInputs='/nix/store/8znh07lsz9q2fdp6fgcdwwv035xxfrl1-nix-2.28.4-dev /nix/store/hr950wkqix97b759inrbxvljkqxj5113-home-manager-0-unstable-2025-05-13 /nix/store/3kwbkj8xnzw5787gbannr741bczjkrq6-git-2.50.1 /nix/store/s801pmgfwy4nifm72s638v0m4f32pnc5-agenix-0.15.0 /nix/store/vlc65hzrqq9a29m7j0sb4hpqlwn0ny56-deploy-rs-0-unstable-2025-06-05 /nix/store/dgqa38y4hxyw30g6bvrgd18750h364vr-dnscontrol-4.20.0' export nativeBuildInputs out='/home/anish/usr/helm/outputs/out' export out @@ -151,14 +154,14 @@ patches='' export patches phases='buildPhase' export phases -pkg='/nix/store/vylmp73qymnv4siaqn1kl2hghj07hrj8-gcc-wrapper-12.3.0' +pkg='/nix/store/kaj8d1zcn149m40s9h0xi0khakibiphz-gcc-wrapper-14.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 pkgsBuildHost=('/nix/store/8znh07lsz9q2fdp6fgcdwwv035xxfrl1-nix-2.28.4-dev' '/nix/store/qwnz3z0hf5pdhwsn92dc9lhlq4a3lsqk-boehm-gc-8.2.8-dev' '/nix/store/mrbslgynzhg5jfc05x2rlnsykzcxp2v0-boehm-gc-8.2.8' '/nix/store/235hvgzcbl06fxy53515q8sr6lljvf68-nlohmann_json-3.11.3' '/nix/store/a5b9czim7vrihag71f8dy1c467qh3mph-libarchive-3.8.0-dev' '/nix/store/0vy272ral6dwzx96wkvd90l37v0gdrk7-attr-2.5.2-dev' '/nix/store/53cx9nd6i328f9zqsgx6sh1krsngy5jl-attr-2.5.2-bin' '/nix/store/ik62z14lxr205b5gzfh4cjcla6gh9l6z-attr-2.5.2' '/nix/store/ra69jxg2pnnjymvkn83mfr7cnhllmwnj-acl-2.3.2-dev' '/nix/store/61066bhvr54xkl2ssippfa5qylwgafqf-acl-2.3.2-bin' '/nix/store/8smmj5gbhnnqaf28qxak4xv57ccgm96p-acl-2.3.2' '/nix/store/y130gnbp2qkfq6svqdv0s61b3m4043yp-libarchive-3.8.0-lib' '/nix/store/8fq8mhb1dlwzgq7xfaxwgn0x623yjb43-libarchive-3.8.0' '/nix/store/7q9ll9pjrdfdb3qyfza2bzrk829izk9s-nix-2.28.4' '/nix/store/hr950wkqix97b759inrbxvljkqxj5113-home-manager-0-unstable-2025-05-13' '/nix/store/3kwbkj8xnzw5787gbannr741bczjkrq6-git-2.50.1' '/nix/store/s801pmgfwy4nifm72s638v0m4f32pnc5-agenix-0.15.0' '/nix/store/vlc65hzrqq9a29m7j0sb4hpqlwn0ny56-deploy-rs-0-unstable-2025-06-05' '/nix/store/dgqa38y4hxyw30g6bvrgd18750h364vr-dnscontrol-4.20.0' '/nix/store/g7i75czfbw9sy5f8v7rjbama6lr3ya3s-patchelf-0.15.0' '/nix/store/gi6g289i9ydm3z896x67q210y0qq29zg-update-autotools-gnu-config-scripts-hook' '/nix/store/jjhw2phnaip4kg0qjas3x3fsaifi8y0w-no-broken-symlinks.sh' '/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/cmzya9irvxzlkh7lfy6i82gbp0saxqj3-multiple-outputs.sh' '/nix/store/hxv896faph0rqxjq2ycxpcrbnngc95sz-patch-shebangs.sh' '/nix/store/cickvswrvann041nqxb0rxilc46svw1n-prune-libtool-files.sh' '/nix/store/xyff06pkhki3qy1ls77w10s0v79c9il0-reproducible-builds.sh' '/nix/store/z7k98578dfzi6l3hsvbivzm7hfqlk0zc-set-source-date-epoch-to-latest.sh' '/nix/store/pilsssjjdxvdphlg2h19p0bfx5q0jzkn-strip.sh' '/nix/store/kaj8d1zcn149m40s9h0xi0khakibiphz-gcc-wrapper-14.3.0' '/nix/store/87zpmcmwvn48z4lbrfba74b312h22s6c-binutils-wrapper-2.44' ) declare -a pkgsBuildTarget=() declare -a pkgsHostHost=() declare -a pkgsHostTarget=() declare -a pkgsTargetTarget=() -declare -a postFixupHooks=('_makeSymlinksRelativeInAllOutputs' '_multioutPropagateDev' ) +declare -a postFixupHooks=('noBrokenSymlinksInAllOutputs' '_makeSymlinksRelativeInAllOutputs' '_multioutPropagateDev' ) declare -a postUnpackHooks=('_updateSourceDateEpochFromSourceRoot' ) declare -a preConfigureHooks=('_multioutConfig' ) preConfigurePhases=' updateAutotoolsGnuConfigScriptsPhase' @@ -173,42 +176,17 @@ declare -a propagatedHostDepFiles=('propagated-host-host-deps' 'propagated-build propagatedNativeBuildInputs='' export propagatedNativeBuildInputs declare -a propagatedTargetDepFiles=('propagated-target-target-deps' ) -shell='/nix/store/7dpxg7ki7g8ynkdwcqf493p2x8divb4i-bash-5.2-p15/bin/bash' +shell='/nix/store/cfqbabpc7xwg8akbcchqbq3cai6qq2vs-bash-5.2p37/bin/bash' export shell shellHook='' export shellHook -stdenv='/nix/store/kv5wkk7xgc8paw9azshzlmxraffqcg0i-stdenv-linux' +stdenv='/nix/store/p2mnji2cdxgf6h27hlqzqf7g8f9bqfsi-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 () { @@ -274,13 +252,10 @@ _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; + while IFS='' read -r varName; do + nixTalkativeLog "@${varName}@ -> ${!varName}"; args+=("--subst-var" "$varName"); - done + done < <(awk 'BEGIN { for (v in ENVIRON) if (v ~ /^[a-z][a-zA-Z0-9_]*$/) print v }') } _assignFirst () { @@ -316,12 +291,15 @@ _callImplicitHook () local def="$1"; local hookName="$2"; if declare -F "$hookName" > /dev/null; then + nixTalkativeLog "calling implicit '$hookName' function hook"; "$hookName"; else if type -p "$hookName" > /dev/null; then + nixTalkativeLog "sourcing implicit '$hookName' script hook"; source "$hookName"; else if [ -n "${!hookName:-}" ]; then + nixTalkativeLog "evaling implicit '$hookName' string hook"; eval "${!hookName}"; else return "$def"; @@ -341,14 +319,15 @@ _defaultUnpack () echo "Did you specify two \"srcs\" with the same \"name\"?"; return 1; fi; - cp -pr --reflink=auto -- "$fn" "$destination"; + cp -r --preserve=mode,timestamps --reflink=auto -- "$fn" "$destination"; else case "$fn" in *.tar.xz | *.tar.lzma | *.txz) - xz -d < "$fn" | tar xf - --warning=no-timestamp + ( XZ_OPT="--threads=$NIX_BUILD_CORES" xz -d < "$fn"; + true ) | tar xf - --mode=+w --warning=no-timestamp ;; *.tar | *.tar.* | *.tgz | *.tbz2 | *.tbz) - tar xf "$fn" --warning=no-timestamp + tar xf "$fn" --mode=+w --warning=no-timestamp ;; *) return 1 @@ -364,7 +343,7 @@ _doStrip () 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}; + stripDebugList=${stripDebugList[*]:-lib lib32 lib64 libexec bin sbin Applications Library/Frameworks}; stripDebugListTarget=${stripDebugListTarget[*]:-}; stripAllList=${stripAllList[*]:-}; stripAllListTarget=${stripAllListTarget[*]:-}; @@ -392,6 +371,40 @@ _eval () eval "$1"; fi } +_logHook () +{ + + if [[ -z ${NIX_LOG_FD-} ]]; then + return; + fi; + local hookKind="$1"; + local hookExpr="$2"; + shift 2; + if declare -F "$hookExpr" > /dev/null 2>&1; then + nixTalkativeLog "calling '$hookKind' function hook '$hookExpr'" "$@"; + else + if type -p "$hookExpr" > /dev/null; then + nixTalkativeLog "sourcing '$hookKind' script hook '$hookExpr'"; + else + if [[ "$hookExpr" != "_callImplicitHook"* ]]; then + local exprToOutput; + if [[ ${NIX_DEBUG:-0} -ge 5 ]]; then + exprToOutput="$hookExpr"; + else + local hookExprLine; + while IFS= read -r hookExprLine; do + hookExprLine="${hookExprLine#"${hookExprLine%%[![:space:]]*}"}"; + if [[ -n "$hookExprLine" ]]; then + exprToOutput+="$hookExprLine\\n "; + fi; + done <<< "$hookExpr"; + exprToOutput="${exprToOutput%%\\n }"; + fi; + nixTalkativeLog "evaling '$hookKind' string hook '$exprToOutput'"; + fi; + fi; + fi +} _makeSymlinksRelative () { @@ -525,7 +538,7 @@ _multioutConfig () 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 configureFlags --bindir="${!outputBin}"/bin --sbindir="${!outputBin}"/sbin --includedir="${!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 () @@ -586,6 +599,47 @@ _multioutPropagateDev () echo -n " ${!output}" >> "${!propagaterOutput}"/nix-support/propagated-build-inputs; done } +_nixLogWithLevel () +{ + + [[ -z ${NIX_LOG_FD-} || ${NIX_DEBUG:-0} -lt ${1:?} ]] && return 0; + local logLevel; + case "${1:?}" in + 0) + logLevel=ERROR + ;; + 1) + logLevel=WARN + ;; + 2) + logLevel=NOTICE + ;; + 3) + logLevel=INFO + ;; + 4) + logLevel=TALKATIVE + ;; + 5) + logLevel=CHATTY + ;; + 6) + logLevel=DEBUG + ;; + 7) + logLevel=VOMIT + ;; + *) + echo "_nixLogWithLevel: called with invalid log level: ${1:?}" >&"$NIX_LOG_FD"; + return 1 + ;; + esac; + local callerName="${FUNCNAME[2]}"; + if [[ $callerName == "_callImplicitHook" ]]; then + callerName="${hookName:?}"; + fi; + printf "%s: %s: %s\n" "$logLevel" "$callerName" "${2:?}" >&"$NIX_LOG_FD" +} _overrideFirst () { @@ -616,6 +670,7 @@ activatePackage () local -r targetOffset="$3"; (( hostOffset <= targetOffset )) || exit 1; if [ -f "$pkg" ]; then + nixTalkativeLog "sourcing setup hook '$pkg'"; source "$pkg"; fi; if [[ -z "${strictDeps-}" || "$hostOffset" -le -1 ]]; then @@ -628,6 +683,7 @@ activatePackage () addToSearchPath _HOST_PATH "$pkg/bin"; fi; if [[ -f "$pkg/nix-support/setup-hook" ]]; then + nixTalkativeLog "sourcing setup hook '$pkg/nix-support/setup-hook'"; source "$pkg/nix-support/setup-hook"; fi } @@ -668,18 +724,19 @@ appendToVar () 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; + if type=$(declare -p "$1" 2> /dev/null); then + case "${type#* }" in + -A*) + echo "appendToVar(): ERROR: trying to use appendToVar on an associative array, use variable+=([\"X\"]=\"Y\") instead." 1>&2; + return 1 + ;; + -a*) + useArray=true + ;; + *) + useArray=false + ;; + esac; fi; shift; if $useArray; then @@ -741,8 +798,8 @@ buildPhase () 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; + local flagsArray=(${enableParallelBuilding:+-j${NIX_BUILD_CORES}} SHELL="$SHELL"); + concatTo flagsArray makeFlags makeFlagsArray buildFlags buildFlagsArray; echoCmd 'build flags' "${flagsArray[@]}"; make ${makefile:+-f $makefile} "${flagsArray[@]}"; unset flagsArray; @@ -772,25 +829,18 @@ checkPhase () fi; if [[ -z "${checkTarget:-}" ]]; then if make -n ${makefile:+-f $makefile} check > /dev/null 2>&1; then - checkTarget=check; + checkTarget="check"; else if make -n ${makefile:+-f $makefile} test > /dev/null 2>&1; then - checkTarget=test; + 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}); + local flagsArray=(${enableParallelChecking:+-j${NIX_BUILD_CORES}} SHELL="$SHELL"); + concatTo flagsArray makeFlags makeFlagsArray checkFlags=VERBOSE=y checkFlagsArray checkTarget; echoCmd 'check flags' "${flagsArray[@]}"; make ${makefile:+-f $makefile} "${flagsArray[@]}"; unset flagsArray; @@ -820,6 +870,67 @@ compressManPages () fi; done } +concatStringsSep () +{ + + local sep="$1"; + local name="$2"; + local type oldifs; + if type=$(declare -p "$name" 2> /dev/null); then + local -n nameref="$name"; + case "${type#* }" in + -A*) + echo "concatStringsSep(): ERROR: trying to use concatStringsSep on an associative array." 1>&2; + return 1 + ;; + -a*) + local IFS="$(printf '\036')" + ;; + *) + local IFS=" " + ;; + esac; + local ifs_separated="${nameref[*]}"; + echo -n "${ifs_separated//"$IFS"/"$sep"}"; + fi +} +concatTo () +{ + + local -; + set -o noglob; + local -n targetref="$1"; + shift; + local arg default name type; + for arg in "$@"; + do + IFS="=" read -r name default <<< "$arg"; + local -n nameref="$name"; + if [[ -z "${nameref[*]}" && -n "$default" ]]; then + targetref+=("$default"); + else + if type=$(declare -p "$name" 2> /dev/null); then + case "${type#* }" in + -A*) + echo "concatTo(): ERROR: trying to use concatTo on an associative array." 1>&2; + return 1 + ;; + -a*) + targetref+=("${nameref[@]}") + ;; + *) + if [[ "$name" = *"Array" ]]; then + nixErrorLog "concatTo(): $name is not declared as array, treating as a singleton. This will become an error in future"; + targetref+=(${nameref+"${nameref[@]}"}); + else + targetref+=(${nameref-}); + fi + ;; + esac; + fi; + fi; + done +} configurePhase () { @@ -853,10 +964,13 @@ configurePhase () prependToVar configureFlags --disable-static; fi; fi; + if [ -z "${dontPatchShebangsInConfigure:-}" ]; then + patchShebangs --build "$configureScript"; + fi; fi; if [ -n "$configureScript" ]; then local -a flagsArray; - _accumFlagsArray configureFlags configureFlagsArray; + concatTo flagsArray configureFlags configureFlagsArray; echoCmd 'configure flags' "${flagsArray[@]}"; $configureScript "${flagsArray[@]}"; unset flagsArray; @@ -878,8 +992,7 @@ distPhase () runHook preDist; local flagsArray=(); - _accumFlagsArray distFlags distFlagsArray; - flagsArray+=(${distTarget:-dist}); + concatTo flagsArray distFlags distFlagsArray distTarget=dist; echo 'dist flags: %q' "${flagsArray[@]}"; make ${makefile:+-f $makefile} "${flagsArray[@]}"; if [ "${dontCopyDist:-0}" != 1 ]; then @@ -892,7 +1005,9 @@ dumpVars () { if [ "${noDumpEnvVars:-0}" != 1 ]; then - export 2> /dev/null >| "$NIX_BUILD_TOP/env-vars" || true; + { + install -m 0600 /dev/null "$NIX_BUILD_TOP/env-vars" && export 2> /dev/null >| "$NIX_BUILD_TOP/env-vars" + } || true; fi } echoCmd () @@ -941,7 +1056,7 @@ findInputs () local var="${!varRef}"; unset -v varVar varRef; local varSlice="$var[*]"; - case "${!varSlice-}" in + case " ${!varSlice-} " in *" $pkg "*) return 0 ;; @@ -1010,7 +1125,7 @@ fixupPhase () for output in $(getAllOutputNames); do if [ -e "${!output}" ]; then - chmod -R u+w "${!output}"; + chmod -R u+w,u-s,g-s "${!output}"; fi; done; runHook preFixup; @@ -1036,9 +1151,9 @@ fixupPhase () done; unset -v hook; fi; - if [ -n "${propagatedUserEnvPkgs:-}" ]; then + if [ -n "${propagatedUserEnvPkgs[*]:-}" ]; then mkdir -p "${!outputBin}/nix-support"; - printWords $propagatedUserEnvPkgs > "${!outputBin}/nix-support/propagated-user-env-packages"; + printWords "${propagatedUserEnvPkgs[@]}" > "${!outputBin}/nix-support/propagated-user-env-packages"; fi; runHook postFixup } @@ -1095,7 +1210,7 @@ getRole () role_post='_FOR_TARGET' ;; *) - echo "binutils-wrapper-2.40: used as improper sort of dependency" 1>&2; + echo "binutils-wrapper-2.44: used as improper sort of dependency" 1>&2; return 1 ;; esac @@ -1124,7 +1239,7 @@ getTargetRoleWrapper () 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; + echo "binutils-wrapper-2.44: used as improper sort of dependency" 1>&2; return 1 ;; esac @@ -1139,9 +1254,8 @@ installCheckPhase () 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}); + local flagsArray=(${enableParallelChecking:+-j${NIX_BUILD_CORES}} SHELL="$SHELL"); + concatTo flagsArray makeFlags makeFlagsArray installCheckFlags installCheckFlagsArray installCheckTarget=installcheck; echoCmd 'installcheck flags' "${flagsArray[@]}"; make ${makefile:+-f $makefile} "${flagsArray[@]}"; unset flagsArray; @@ -1163,13 +1277,8 @@ installPhase () 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; + local flagsArray=(${enableParallelInstalling:+-j${NIX_BUILD_CORES}} SHELL="$SHELL"); + concatTo flagsArray makeFlags makeFlagsArray installFlags installFlagsArray installTargets=install; echoCmd 'install flags' "${flagsArray[@]}"; make ${makefile:+-f $makefile} "${flagsArray[@]}"; unset flagsArray; @@ -1281,6 +1390,116 @@ moveToOutput () done; done } +nixChattyLog () +{ + + _nixLogWithLevel 5 "$*" +} +nixDebugLog () +{ + + _nixLogWithLevel 6 "$*" +} +nixErrorLog () +{ + + _nixLogWithLevel 0 "$*" +} +nixInfoLog () +{ + + _nixLogWithLevel 3 "$*" +} +nixLog () +{ + + [[ -z ${NIX_LOG_FD-} ]] && return 0; + local callerName="${FUNCNAME[1]}"; + if [[ $callerName == "_callImplicitHook" ]]; then + callerName="${hookName:?}"; + fi; + printf "%s: %s\n" "$callerName" "$*" >&"$NIX_LOG_FD" +} +nixNoticeLog () +{ + + _nixLogWithLevel 2 "$*" +} +nixTalkativeLog () +{ + + _nixLogWithLevel 4 "$*" +} +nixVomitLog () +{ + + _nixLogWithLevel 7 "$*" +} +nixWarnLog () +{ + + _nixLogWithLevel 1 "$*" +} +noBrokenSymlinks () +{ + + local -r output="${1:?}"; + local path; + local pathParent; + local symlinkTarget; + local -i numDanglingSymlinks=0; + local -i numReflexiveSymlinks=0; + local -i numUnreadableSymlinks=0; + if [[ ! -e $output ]]; then + nixWarnLog "skipping non-existent output $output"; + return 0; + fi; + nixInfoLog "running on $output"; + while IFS= read -r -d '' path; do + pathParent="$(dirname "$path")"; + if ! symlinkTarget="$(readlink "$path")"; then + nixErrorLog "the symlink $path is unreadable"; + numUnreadableSymlinks+=1; + continue; + fi; + if [[ $symlinkTarget == /* ]]; then + nixInfoLog "symlink $path points to absolute target $symlinkTarget"; + else + nixInfoLog "symlink $path points to relative target $symlinkTarget"; + symlinkTarget="$(realpath --no-symlinks --canonicalize-missing "$pathParent/$symlinkTarget")"; + fi; + if [[ $symlinkTarget != "$NIX_STORE"/* ]]; then + nixInfoLog "symlink $path points outside the Nix store; ignoring"; + continue; + fi; + if [[ $path == "$symlinkTarget" ]]; then + nixErrorLog "the symlink $path is reflexive"; + numReflexiveSymlinks+=1; + else + if [[ ! -e $symlinkTarget ]]; then + nixErrorLog "the symlink $path points to a missing target: $symlinkTarget"; + numDanglingSymlinks+=1; + else + nixDebugLog "the symlink $path is irreflexive and points to a target which exists"; + fi; + fi; + done < <(find "$output" -type l -print0); + if ((numDanglingSymlinks > 0 || numReflexiveSymlinks > 0 || numUnreadableSymlinks > 0)); then + nixErrorLog "found $numDanglingSymlinks dangling symlinks, $numReflexiveSymlinks reflexive symlinks and $numUnreadableSymlinks unreadable symlinks"; + exit 1; + fi; + return 0 +} +noBrokenSymlinksInAllOutputs () +{ + + if [[ -z ${dontCheckForBrokenSymlinks-} ]]; then + for output in $(getAllOutputNames); + do + noBrokenSymlinks "${!output}"; + done; + fi +} patchELF () { @@ -1304,11 +1523,9 @@ patchPhase () runHook prePatch; local -a patchesArray; - if [ -n "$__structuredAttrs" ]; then - patchesArray=(${patches:+"${patches[@]}"}); - else - patchesArray=(${patches:-}); - fi; + concatTo patchesArray patches; + local -a flagsArray; + concatTo flagsArray patchFlags=-p1; for i in "${patchesArray[@]}"; do echo "applying patch $i"; @@ -1327,12 +1544,6 @@ patchPhase () 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 @@ -1341,7 +1552,7 @@ patchShebangs () { local pathName; - local update; + local update=false; while [[ $# -gt 0 ]]; do case "$1" in --host) @@ -1384,7 +1595,7 @@ patchShebangs () local f; while IFS= read -r -d '' f; do isScript "$f" || continue; - read -r oldInterpreterLine < "$f"; + read -r oldInterpreterLine < "$f" || [ "$oldInterpreterLine" ]; read -r oldPath arg0 args <<< "${oldInterpreterLine:2}"; if [[ -z "${pathName:-}" ]]; then if [[ -n $strictDeps && $f == "$NIX_STORE"* ]]; then @@ -1396,22 +1607,22 @@ patchShebangs () 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"; + [[ "$args" == *" "* ]] && args=${args#* } || args=; + newPath="$(PATH="${!pathName}" type -P "env" || true)"; + args="-S $(PATH="${!pathName}" type -P "$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)"; + newPath="$(PATH="${!pathName}" type -P "$arg0" || true)"; fi; fi; else if [[ -z $oldPath ]]; then oldPath="/bin/sh"; fi; - newPath="$(PATH="${!pathName}" command -v "$(basename "$oldPath")" || true)"; + newPath="$(PATH="${!pathName}" type -P "$(basename "$oldPath")" || true)"; args="$arg0 $args"; fi; newInterpreterLine="$newPath $args"; @@ -1448,18 +1659,19 @@ prependToVar () 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; + if type=$(declare -p "$1" 2> /dev/null); then + case "${type#* }" in + -A*) + echo "prependToVar(): ERROR: trying to use prependToVar on an associative array." 1>&2; + return 1 + ;; + -a*) + useArray=true + ;; + *) + useArray=false + ;; + esac; fi; shift; if $useArray; then @@ -1504,6 +1716,7 @@ runHook () local hook; for hook in "_callImplicitHook 0 $hookName" ${!hooksSlice+"${!hooksSlice}"}; do + _logHook "$hookName" "$hook" "$@"; _eval "$hook" "$@"; done; return 0 @@ -1517,6 +1730,7 @@ runOneHook () local hook ret=1; for hook in "_callImplicitHook 1 $hookName" ${!hooksSlice+"${!hooksSlice}"}; do + _logHook "$hookName" "$hook" "$@"; if _eval "$hook" "$@"; then ret=0; break; @@ -1555,18 +1769,16 @@ runPhase () 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"); + local startTime endTime; + startTime=$(date +"%s"); eval "${!curPhase:-$curPhase}"; - local endTime=$(date +"%s"); + endTime=$(date +"%s"); showPhaseFooter "$curPhase" "$startTime" "$endTime"; if [ "$curPhase" = unpackPhase ]; then - [ -n "${sourceRoot:-}" ] && chmod +x "${sourceRoot}"; - cd "${sourceRoot:-.}"; + [ -n "${sourceRoot:-}" ] && chmod +x -- "${sourceRoot}"; + cd -- "${sourceRoot:-.}"; fi } showPhaseFooter () @@ -1589,7 +1801,11 @@ showPhaseHeader () { local phase="$1"; - echo "Running phase: $phase" + echo "Running phase: $phase"; + if [[ -z ${NIX_LOG_FD-} ]]; then + return; + fi; + printf "@nix { \"action\": \"setPhase\", \"phase\": \"%s\" }\n" "$phase" >&"$NIX_LOG_FD" } stripDirs () { @@ -1621,7 +1837,7 @@ stripDirs () 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=$?; + find $paths -type f "${excludeFlags[@]}" -a '!' -path "$prefix/lib/debug/*" -printf '%D-%i,%p\0' | sort -t, -k1,1 -u -z | cut -d, -f2- -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; @@ -1695,6 +1911,10 @@ substituteInPlace () fileNames+=("$arg"); shift; done; + if ! [[ "${#fileNames[@]}" -gt 0 ]]; then + echo "substituteInPlace called without any files to operate on (files must come before options!)" 1>&2; + return 1; + fi; for file in "${fileNames[@]}"; do substitute "$file" "$file" "$@"; @@ -1707,29 +1927,40 @@ substituteStream () local description=$2; shift 2; while (( "$#" )); do + local replace_mode="$1"; case "$1" in --replace) + if ! "$_substituteStream_has_warned_replace_deprecation"; then + echo "substituteStream() in derivation $name: WARNING: '--replace' is deprecated, use --replace-{fail,warn,quiet}. ($description)" 1>&2; + _substituteStream_has_warned_replace_deprecation=true; + fi; + replace_mode='--replace-warn' + ;& + --replace-quiet | --replace-warn | --replace-fail) 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; + if ! [[ "${!var}" == *"$pattern"* ]]; then + if [ "$replace_mode" == --replace-warn ]; then + printf "substituteStream() in derivation $name: WARNING: pattern %q doesn't match anything in %s\n" "$pattern" "$description" 1>&2; + else + if [ "$replace_mode" == --replace-fail ]; then + printf "substituteStream() in derivation $name: ERROR: pattern %q doesn't match anything in %s\n" "$pattern" "$description" 1>&2; + return 1; + fi; fi; - fi + fi; + eval "$var"'=${'"$var"'//"$pattern"/"$replacement"}' ;; --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; + echo "substituteStream() in derivation $name: 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; + echo "substituteStream() in derivation $name: ERROR: variable \$$varName is unset" 1>&2; return 1; fi; pattern="@$varName@"; @@ -1743,7 +1974,7 @@ substituteStream () shift 3 ;; *) - echo "substituteStream(): ERROR: Invalid command line argument: $1" 1>&2; + echo "substituteStream() in derivation $name: ERROR: Invalid command line argument: $1" 1>&2; return 1 ;; esac; @@ -1772,11 +2003,7 @@ unpackPhase () srcs="$src"; fi; local -a srcsArray; - if [ -n "$__structuredAttrs" ]; then - srcsArray=("${srcs[@]}"); - else - srcsArray=($srcs); - fi; + concatTo srcsArray srcs; local dirsBefore=""; for i in *; do @@ -1833,7 +2060,7 @@ updateAutotoolsGnuConfigScriptsPhase () 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"; + cp -f "/nix/store/khmqxw6b9q7rgkv6hf3gcqf2igk03z1g-gnu-config-2024-01-01/$script" "$f"; done; done } @@ -1841,7 +2068,8 @@ 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)); + [[ $path == -* ]] && path="./$path"; + 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 @@ -1860,4 +2088,4 @@ export TMP="$NIX_BUILD_TOP" export TMPDIR="$NIX_BUILD_TOP" export TEMP="$NIX_BUILD_TOP" export TEMPDIR="$NIX_BUILD_TOP" -eval "$shellHook" +eval "${shellHook:-}" diff --git a/flake.lock b/flake.lock index 6607a28f..95b3ac85 100644 --- a/flake.lock +++ b/flake.lock @@ -48,6 +48,23 @@ "url": "ssh://gitea@git.sealight.xyz/aynish/basant" } }, + "brew-src": { + "flake": false, + "locked": { + "lastModified": 1756059815, + "narHash": "sha256-UALOxoXoFIHbwKzcqbqCAqw5cC0MJEehLaWSet5vxfE=", + "owner": "Homebrew", + "repo": "brew", + "rev": "02947ea4edbdef5fcce9ee57fa289547f4d096c9", + "type": "github" + }, + "original": { + "owner": "Homebrew", + "ref": "4.6.7", + "repo": "brew", + "type": "github" + } + }, "darwin": { "inputs": { "nixpkgs": [ @@ -70,6 +87,27 @@ "type": "github" } }, + "darwin_2": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1757432263, + "narHash": "sha256-qHn+/0+IOz5cG68BZUwL9BV3EO/e9eNKCjH3+N7wMdI=", + "owner": "LnL7", + "repo": "nix-darwin", + "rev": "1fef4404de4d1596aa5ab2bd68078370e1b9dcdb", + "type": "github" + }, + "original": { + "owner": "LnL7", + "ref": "nix-darwin-25.05", + "repo": "nix-darwin", + "type": "github" + } + }, "deploy-rs": { "inputs": { "flake-compat": "flake-compat", @@ -284,6 +322,115 @@ "type": "github" } }, + "homebrew-bundle": { + "flake": false, + "locked": { + "lastModified": 1745335228, + "narHash": "sha256-TIKR2UgtyUmHLNZp255/vLs+1I10hXe+sciMEbAGFwE=", + "owner": "homebrew", + "repo": "homebrew-bundle", + "rev": "a3265c84b232e13048ecbf6fc18a2eedfadbeb08", + "type": "github" + }, + "original": { + "owner": "homebrew", + "repo": "homebrew-bundle", + "type": "github" + } + }, + "homebrew-cask": { + "flake": false, + "locked": { + "lastModified": 1757707077, + "narHash": "sha256-R3Mt2ofMzc3Qt5NC/c3j8f3Rqb0a7FOAT4duKcul+1I=", + "owner": "homebrew", + "repo": "homebrew-cask", + "rev": "b804675c8a9975cdcdf3996ca3e2d25c5b03e1d2", + "type": "github" + }, + "original": { + "owner": "homebrew", + "repo": "homebrew-cask", + "type": "github" + } + }, + "homebrew-core": { + "flake": false, + "locked": { + "lastModified": 1757711740, + "narHash": "sha256-98COOWpl+mDMKlHytToJ7D/pz7DPBX4nT7C0cs+2v98=", + "owner": "homebrew", + "repo": "homebrew-core", + "rev": "f7aa2e9987ef59cf692d5f8e1364b46d318732d5", + "type": "github" + }, + "original": { + "owner": "homebrew", + "repo": "homebrew-core", + "type": "github" + } + }, + "jovian": { + "inputs": { + "nix-github-actions": "nix-github-actions", + "nixpkgs": [ + "unstable" + ] + }, + "locked": { + "lastModified": 1757230583, + "narHash": "sha256-4uqu7sFPOaVTCogsxaGMgbzZ2vK40GVGMfUmrvK3/LY=", + "owner": "Jovian-Experiments", + "repo": "Jovian-NixOS", + "rev": "fc3960e6c32c9d4f95fff2ef84444284d24d3bea", + "type": "github" + }, + "original": { + "owner": "Jovian-Experiments", + "repo": "Jovian-NixOS", + "type": "github" + } + }, + "nix-github-actions": { + "inputs": { + "nixpkgs": [ + "jovian", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1729697500, + "narHash": "sha256-VFTWrbzDlZyFHHb1AlKRiD/qqCJIripXKiCSFS8fAOY=", + "owner": "zhaofengli", + "repo": "nix-github-actions", + "rev": "e418aeb728b6aa5ca8c5c71974e7159c2df1d8cf", + "type": "github" + }, + "original": { + "owner": "zhaofengli", + "ref": "matrix-name", + "repo": "nix-github-actions", + "type": "github" + } + }, + "nix-homebrew": { + "inputs": { + "brew-src": "brew-src" + }, + "locked": { + "lastModified": 1756398546, + "narHash": "sha256-n4GVDLhKu65XFraJuCzap2AaZji4xhPaZMTJ8aQdD3s=", + "owner": "zhaofengli-wip", + "repo": "nix-homebrew", + "rev": "3aa475996cb3bc1ecefa88c99c466e6f0bc17431", + "type": "github" + }, + "original": { + "owner": "zhaofengli-wip", + "repo": "nix-homebrew", + "type": "github" + } + }, "nix-matrix-appservices": { "inputs": { "devshell": "devshell", @@ -408,11 +555,17 @@ "inputs": { "agenix": "agenix", "basant": "basant", + "darwin": "darwin_2", "deploy-rs": "deploy-rs", "disko": "disko", "grasp": "grasp", "hardware": "hardware", "home-manager": "home-manager_2", + "homebrew-bundle": "homebrew-bundle", + "homebrew-cask": "homebrew-cask", + "homebrew-core": "homebrew-core", + "jovian": "jovian", + "nix-homebrew": "nix-homebrew", "nix-matrix-appservices": "nix-matrix-appservices", "nixos-hardware": "nixos-hardware", "nixpkgs": "nixpkgs_2", diff --git a/flake.nix b/flake.nix index e8df696d..ff71167f 100644 --- a/flake.nix +++ b/flake.nix @@ -38,6 +38,33 @@ # Matrix nix-matrix-appservices.url = "gitlab:coffeetables/nix-matrix-appservices"; + # Darwin + darwin = { + url = "github:LnL7/nix-darwin/nix-darwin-25.05"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + nix-homebrew = { + url = "github:zhaofengli-wip/nix-homebrew"; + }; + homebrew-bundle = { + url = "github:homebrew/homebrew-bundle"; + flake = false; + }; + homebrew-core = { + url = "github:homebrew/homebrew-core"; + flake = false; + }; + homebrew-cask = { + url = "github:homebrew/homebrew-cask"; + flake = false; + }; + + # Steam Deck / Gaming + jovian = { + url = "github:Jovian-Experiments/Jovian-NixOS"; + inputs.nixpkgs.follows = "unstable"; + }; + # Others nur.url = "github:nix-community/NUR"; rust-overlay = { @@ -57,7 +84,8 @@ outputs = { self, nixpkgs, unstable, nixos-hardware, home-manager, deploy-rs , agenix, disko, basant, grasp, nix-matrix-appservices, nur, tidalcycles - , rust-overlay, vimwikicli, ... }@inputs: + , rust-overlay, vimwikicli, darwin, nix-homebrew, homebrew-bundle + , homebrew-core, homebrew-cask, jovian, ... }@inputs: let forAllSystems = nixpkgs.lib.genAttrs [ "aarch64-linux" @@ -118,6 +146,65 @@ tidalcycles.overlays.default # needed for nvim which comes pre-installed lol ]; }); + + # Package set for Darwin systems + darwinPkgsFor = forAllSystems (system: + import nixpkgs { + inherit system; + config = { + permittedInsecurePackages = [ + "olm-3.2.16" + ]; + allowUnfreePredicate = pkg: + builtins.elem (nixpkgs.lib.getName pkg) [ + "ripcord" + "vcv-rack" + "SunVox" + "renoise" + ]; + }; + overlays = [ + rust-overlay.overlays.default + tidalcycles.overlays.default + agenix.overlays.default + nur.overlay + unstableOverlay + vimwikiOverlay + self.overlays.additions + self.overlays.modifications + ]; + }); + + # Package set for Steam Deck (gaming-focused) + deckPkgsFor = forAllSystems (system: + import unstable { + inherit system; + config = { + permittedInsecurePackages = [ + "olm-3.2.16" + ]; + allowUnfreePredicate = pkg: + builtins.elem (nixpkgs.lib.getName pkg) [ + "ripcord" + "vcv-rack" + "SunVox" + "renoise" + "steam" + "steam-original" + "steam-runtime" + ]; + }; + overlays = [ + rust-overlay.overlays.default + tidalcycles.overlays.default + agenix.overlays.default + nur.overlay + unstableOverlay + vimwikiOverlay + self.overlays.additions + self.overlays.modifications + ]; + }); in { # Your custom packages # Acessible through 'nix build', 'nix shell', etc @@ -224,6 +311,48 @@ } ]; }; + + deck = unstable.lib.nixosSystem rec { + specialArgs = { inherit inputs self; }; + system = "x86_64-linux"; + pkgs = deckPkgsFor.${system}; + modules = [ + ./hosts/deck + jovian.nixosModules.default + self.nixosModules.wireguard + agenix.nixosModules.age + self.nixosModules.backup + home-manager.nixosModules.home-manager + { + nix.registry.nixpkgs.flake = unstable; + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; + home-manager.users.anish = import ./home/gui; + } + ]; + }; + }; + + # Darwin configuration entrypoint + darwinConfigurations = { + "Anishs-MacBook-Pro" = darwin.lib.darwinSystem rec { + system = "aarch64-darwin"; + pkgs = darwinPkgsFor.${system}; + specialArgs = { inherit inputs self; }; + modules = [ + ./hosts/darwin + home-manager.darwinModules.home-manager + agenix.darwinModules.default + { + users.users.anishlakhwara.home = "/Users/anishlakhwara"; + home-manager = { + users.anishlakhwara = import ./home/darwin; + useGlobalPkgs = true; + useUserPackages = true; + }; + } + ]; + }; }; # Standalone home-manager configuration entrypoint diff --git a/home/darwin/default.nix b/home/darwin/default.nix new file mode 100644 index 00000000..289f8c84 --- /dev/null +++ b/home/darwin/default.nix @@ -0,0 +1,28 @@ +{ self, pkgs, ... }: +{ + imports = [ + ../profiles/nvim + ../profiles/cli + ../profiles/direnv + ../profiles/git + ../profiles/task + ../profiles/kitty + # ../profiles/firefox + ]; + + home.username = "anishlakhwara"; + home.homeDirectory = "/Users/anishlakhwara"; + home.stateVersion = "22.05"; + + programs.zsh.initExtra = '' + PATH=/Users/anishlakhwara/.sourcegraph/bin:/Users/anishlakhwara/.sourcegraph/sg.zsh_autocomplete:/Users/anishlakhwara/google-cloud-sdk/bin:/Users/anishlakhwara/google-cloud-sdk/completion.zsh.inc:/Users/anishlakhwara/google-cloud-sdk/path.zsh.inc:/Users/anishlakhwara/.sg:/opt/homebrew/bin:$PATH + ''; + + # Managing sketchybar plugins from home-manager + home.file = { + ".config/sketchybar" = { + source = ./sketchybar; + recursive = true; + }; + }; +} diff --git a/home/darwin/sketchybar/battery.sh b/home/darwin/sketchybar/battery.sh new file mode 100644 index 00000000..0414f3bc --- /dev/null +++ b/home/darwin/sketchybar/battery.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +COLOR="$CYAN" + +sketchybar --add item battery right \ + --set battery \ + update_freq=60 \ + icon.color="$COLOR" \ + icon.padding_left=10 \ + label.padding_right=10 \ + label.color="$COLOR" \ + background.height=26 \ + background.corner_radius="$CORNER_RADIUS" \ + background.padding_right=5 \ + background.border_width="$BORDER_WIDTH" \ + background.border_color="$COLOR" \ + background.color="$BAR_COLOR" \ + background.drawing=on \ + script="$PLUGIN_DIR/power.sh" \ + --subscribe battery power_source_change diff --git a/home/darwin/sketchybar/items/battery.sh b/home/darwin/sketchybar/items/battery.sh new file mode 100755 index 00000000..0414f3bc --- /dev/null +++ b/home/darwin/sketchybar/items/battery.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +COLOR="$CYAN" + +sketchybar --add item battery right \ + --set battery \ + update_freq=60 \ + icon.color="$COLOR" \ + icon.padding_left=10 \ + label.padding_right=10 \ + label.color="$COLOR" \ + background.height=26 \ + background.corner_radius="$CORNER_RADIUS" \ + background.padding_right=5 \ + background.border_width="$BORDER_WIDTH" \ + background.border_color="$COLOR" \ + background.color="$BAR_COLOR" \ + background.drawing=on \ + script="$PLUGIN_DIR/power.sh" \ + --subscribe battery power_source_change diff --git a/home/darwin/sketchybar/items/calendar.sh b/home/darwin/sketchybar/items/calendar.sh new file mode 100755 index 00000000..064a1919 --- /dev/null +++ b/home/darwin/sketchybar/items/calendar.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +COLOR="$BLUE" + +sketchybar --add item calendar right \ + --set calendar update_freq=15 \ + icon.color="$COLOR" \ + icon.padding_left=10 \ + label.color="$COLOR" \ + label.padding_right=10 \ + background.height=26 \ + background.corner_radius="$CORNER_RADIUS" \ + background.padding_right=5 \ + background.border_width="$BORDER_WIDTH" \ + background.border_color="$COLOR" \ + background.color="$BAR_COLOR" \ + background.drawing=on \ + script="$PLUGIN_DIR/calendar.sh" diff --git a/home/darwin/sketchybar/items/clock.sh b/home/darwin/sketchybar/items/clock.sh new file mode 100755 index 00000000..0dbf7e41 --- /dev/null +++ b/home/darwin/sketchybar/items/clock.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +COLOR="$MAGENTA" + +sketchybar --add item clock right \ + --set clock update_freq=60 \ + icon.padding_left=10 \ + icon.color="$COLOR" \ + icon=" " \ + label.color="$COLOR" \ + label.padding_right=5 \ + label.width=43 \ + align=center \ + background.height=26 \ + background.corner_radius="$CORNER_RADIUS" \ + background.padding_right=2 \ + background.border_width="$BORDER_WIDTH" \ + background.border_color="$COLOR" \ + background.color="$BAR_COLOR" \ + background.drawing=on \ + script="$PLUGIN_DIR/clock.sh" diff --git a/home/darwin/sketchybar/items/cpu.sh b/home/darwin/sketchybar/items/cpu.sh new file mode 100755 index 00000000..b4c6493e --- /dev/null +++ b/home/darwin/sketchybar/items/cpu.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +COLOR="$YELLOW" + +sketchybar --add item cpu right \ + --set cpu \ + update_freq=3 \ + icon.color="$COLOR" \ + icon.padding_left=10 \ + label.color="$COLOR" \ + label.padding_right=10 \ + background.height=26 \ + background.corner_radius="$CORNER_RADIUS" \ + background.padding_right=5 \ + background.border_width="$BORDER_WIDTH" \ + background.border_color="$COLOR" \ + background.color="$BAR_COLOR" \ + background.drawing=on \ + script="$PLUGIN_DIR/cpu.sh" diff --git a/home/darwin/sketchybar/items/front_app.sh b/home/darwin/sketchybar/items/front_app.sh new file mode 100755 index 00000000..ecee1a8c --- /dev/null +++ b/home/darwin/sketchybar/items/front_app.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +COLOR="$WHITE" + +sketchybar \ + --add item front_app left \ + --set front_app script="$PLUGIN_DIR/front_app.sh" \ + icon.drawing=off \ + background.height=26 \ + background.padding_left=0 \ + background.padding_right=10 \ + background.border_width="$BORDER_WIDTH" \ + background.border_color="$COLOR" \ + background.corner_radius="$CORNER_RADIUS" \ + background.color="$BAR_COLOR" \ + label.color="$COLOR" \ + label.padding_left=10 \ + label.padding_right=10 \ + associated_display=active \ + --subscribe front_app front_app_switched diff --git a/home/darwin/sketchybar/items/spaces.sh b/home/darwin/sketchybar/items/spaces.sh new file mode 100755 index 00000000..52743696 --- /dev/null +++ b/home/darwin/sketchybar/items/spaces.sh @@ -0,0 +1,44 @@ +#!/usr/bin/env bash + +SPACE_ICONS=("1" "2" "3" "4" "5" "6" "7" "8" "9" "10") + +sketchybar --add item spacer.1 left \ + --set spacer.1 background.drawing=off \ + label.drawing=off \ + icon.drawing=off \ + width=10 + +for i in {0..9}; do + sid=$((i + 1)) + sketchybar --add space space.$sid left \ + --set space.$sid associated_space=$sid \ + label.drawing=off \ + icon.padding_left=10 \ + icon.padding_right=10 \ + background.padding_left=-5 \ + background.padding_right=-5 \ + script="$PLUGIN_DIR/space.sh" +done + +sketchybar --add item spacer.2 left \ + --set spacer.2 background.drawing=off \ + label.drawing=off \ + icon.drawing=off \ + width=5 + +sketchybar --add bracket spaces '/space.*/' \ + --set spaces background.border_width="$BORDER_WIDTH" \ + background.border_color="$RED" \ + background.corner_radius="$CORNER_RADIUS" \ + background.color="$BAR_COLOR" \ + background.height=26 \ + background.drawing=on + +sketchybar --add item separator left \ + --set separator icon= \ + icon.font="$FONT:Regular:16.0" \ + background.padding_left=26 \ + background.padding_right=15 \ + label.drawing=off \ + associated_display=active \ + icon.color="$YELLOW" diff --git a/home/darwin/sketchybar/items/spotify.sh b/home/darwin/sketchybar/items/spotify.sh new file mode 100755 index 00000000..b94fe7aa --- /dev/null +++ b/home/darwin/sketchybar/items/spotify.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +COLOR="$ORANGE" + +sketchybar --add item spotify q \ + --set spotify \ + scroll_texts=on \ + icon=󰎆 \ + icon.color="$COLOR" \ + icon.padding_left=10 \ + background.color="$BAR_COLOR" \ + background.height=26 \ + background.corner_radius="$CORNER_RADIUS" \ + background.border_width="$BORDER_WIDTH" \ + background.border_color="$COLOR" \ + background.padding_right=-5 \ + background.drawing=on \ + label.padding_right=10 \ + label.max_chars=20 \ + associated_display=active \ + updates=on \ + script="$PLUGIN_DIR/spotify.sh" \ + --subscribe spotify media_change diff --git a/home/darwin/sketchybar/items/volume.sh b/home/darwin/sketchybar/items/volume.sh new file mode 100755 index 00000000..77f746db --- /dev/null +++ b/home/darwin/sketchybar/items/volume.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +COLOR="$GREEN" + +sketchybar \ + --add item sound right \ + --set sound \ + icon.color="$COLOR" \ + icon.padding_left=10 \ + label.color="$COLOR" \ + label.padding_right=10 \ + background.height=26 \ + background.corner_radius="$CORNER_RADIUS" \ + background.padding_right=5 \ + background.border_width="$BORDER_WIDTH" \ + background.border_color="$COLOR" \ + background.color="$BAR_COLOR" \ + background.drawing=on \ + script="$PLUGIN_DIR/sound.sh" \ + --subscribe sound volume_change diff --git a/home/darwin/sketchybar/items/vpn.sh b/home/darwin/sketchybar/items/vpn.sh new file mode 100755 index 00000000..2c640c90 --- /dev/null +++ b/home/darwin/sketchybar/items/vpn.sh @@ -0,0 +1,4 @@ +sketchybar -m --add item vpn right \ + --set vpn icon= \ + update_freq=5 \ + script="~/.config/sketchybar/plugins/vpn.sh" diff --git a/home/darwin/sketchybar/plugins/calendar.sh b/home/darwin/sketchybar/plugins/calendar.sh new file mode 100755 index 00000000..9194e224 --- /dev/null +++ b/home/darwin/sketchybar/plugins/calendar.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +sketchybar --set "$NAME" icon="󰸗 " label="$(date '+%a %d. %b')" diff --git a/home/darwin/sketchybar/plugins/clock.sh b/home/darwin/sketchybar/plugins/clock.sh new file mode 100755 index 00000000..f5f6d9f2 --- /dev/null +++ b/home/darwin/sketchybar/plugins/clock.sh @@ -0,0 +1,4 @@ +#!/usr/bin/env bash + +LABEL=$(date '+%H:%M') +sketchybar --set "$NAME" icon=" " label="$LABEL" diff --git a/home/darwin/sketchybar/plugins/cpu.sh b/home/darwin/sketchybar/plugins/cpu.sh new file mode 100755 index 00000000..77e7573b --- /dev/null +++ b/home/darwin/sketchybar/plugins/cpu.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +sketchybar --set "$NAME" icon="" label="$(ps -A -o %cpu | awk '{s+=$1} END {s /= 8} END {printf "%.1f%%\n", s}')" diff --git a/home/darwin/sketchybar/plugins/front_app.sh b/home/darwin/sketchybar/plugins/front_app.sh new file mode 100755 index 00000000..8f446a35 --- /dev/null +++ b/home/darwin/sketchybar/plugins/front_app.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +case "$SENDER" in +"front_app_switched") + sketchybar --set "$NAME" label="$INFO" + ;; +esac diff --git a/home/darwin/sketchybar/plugins/power.sh b/home/darwin/sketchybar/plugins/power.sh new file mode 100755 index 00000000..181ae01e --- /dev/null +++ b/home/darwin/sketchybar/plugins/power.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash + +PERCENTAGE=$(pmset -g batt | grep -Eo "\d+%" | cut -d% -f1) +CHARGING=$(pmset -g batt | grep 'AC Power') + +if [ "$PERCENTAGE" = "" ]; then + exit 0 +fi + +case ${PERCENTAGE} in +9[0-9] | 100) + ICON=" " + ;; +[6-8][0-9]) + ICON=" " + ;; +[3-5][0-9]) + ICON=" " + ;; +[1-2][0-9]) + ICON=" " + ;; +*) ICON=" " ;; +esac + +if [ "$CHARGING" != "" ]; then + ICON="" +fi + +sketchybar --set "$NAME" icon="$ICON" label="${PERCENTAGE}% " diff --git a/home/darwin/sketchybar/plugins/sound.sh b/home/darwin/sketchybar/plugins/sound.sh new file mode 100755 index 00000000..65f9446a --- /dev/null +++ b/home/darwin/sketchybar/plugins/sound.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +VOLUME=$(osascript -e "output volume of (get volume settings)") +MUTED=$(osascript -e "output muted of (get volume settings)") + +if [ "$MUTED" != "false" ]; then + ICON="󰖁 " + VOLUME=0 +else + case ${VOLUME} in + 100) ICON=" " ;; + [5-9]*) ICON=" " ;; + [0-9]*) ICON=" " ;; + *) ICON=" " ;; + esac +fi + +sketchybar -m \ + --set "$NAME" icon=$ICON \ + --set "$NAME" label="$VOLUME%" diff --git a/home/darwin/sketchybar/plugins/space.sh b/home/darwin/sketchybar/plugins/space.sh new file mode 100755 index 00000000..79b4d338 --- /dev/null +++ b/home/darwin/sketchybar/plugins/space.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +source "$HOME/.config/sketchybar/variables.sh" # Loads all defined colors + +SPACE_ICONS=(" " " " "󰺻 " " " " " "6" "7" "8" "9" "10") + +SPACE_CLICK_SCRIPT="yabai -m space --focus $SID 2>/dev/null" + +if [ "$SELECTED" = "true" ]; then + sketchybar --animate tanh 5 --set "$NAME" \ + icon.color="$RED" \ + icon="${SPACE_ICONS[$SID - 1]}" \ + click_script="$SPACE_CLICK_SCRIPT" +else + sketchybar --animate tanh 5 --set "$NAME" \ + icon.color="$COMMENT" \ + icon="${SPACE_ICONS[$SID - 1]}" \ + click_script="$SPACE_CLICK_SCRIPT" +fi diff --git a/home/darwin/sketchybar/plugins/spotify.sh b/home/darwin/sketchybar/plugins/spotify.sh new file mode 100755 index 00000000..d0dbc33e --- /dev/null +++ b/home/darwin/sketchybar/plugins/spotify.sh @@ -0,0 +1,11 @@ +#!/usr/bin/env bash + +STATE="$(echo "$INFO" | jq -r '.state')" +APP="$(echo "$INFO" | jq -r '.app')" + +if [ "$STATE" = "playing" ] && [ "$APP" == "Spotify" ]; then + MEDIA="$(echo "$INFO" | jq -r '.title + " - " + .artist')" + sketchybar --set "$NAME" label="$MEDIA" drawing=on +else + sketchybar --set "$NAME" drawing=off +fi diff --git a/home/darwin/sketchybar/plugins/vpn.sh b/home/darwin/sketchybar/plugins/vpn.sh new file mode 100755 index 00000000..8b71a6e2 --- /dev/null +++ b/home/darwin/sketchybar/plugins/vpn.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +### You need to edit sudoers file to run wg-quick without password + +# %admin ALL = (ALL) NOPASSWD: /nix/store/s2qw0sxax8pckbzmyw6wrarahmx65bq9-wireguard-tools-1.0.20210914/bin/wg-quick + +WG_PIDFILE="/var/run/wireguard/wg0.name" + +if [ -f $WG_PIDFILE ]; then + sketchybar -m --set vpn icon= \ + label="$VPN" \ + drawing=on \ + click_script="~/.config/sketchybar/plugins/wg_off.sh" +else + sketchybar -m --set vpn drawing=off click_script="~/.config/sketchybar/plugins/wg_on.sh" +fi diff --git a/home/darwin/sketchybar/plugins/wg_off.sh b/home/darwin/sketchybar/plugins/wg_off.sh new file mode 100755 index 00000000..8d9713e0 --- /dev/null +++ b/home/darwin/sketchybar/plugins/wg_off.sh @@ -0,0 +1,5 @@ +### You need to edit sudoers file to run wg-quick without password + +# %admin ALL = (ALL) NOPASSWD: /nix/store/s2qw0sxax8pckbzmyw6wrarahmx65bq9-wireguard-tools-1.0.20210914/bin/wg-quick + +sudo wg-quick down wg0 diff --git a/home/darwin/sketchybar/plugins/wg_on.sh b/home/darwin/sketchybar/plugins/wg_on.sh new file mode 100755 index 00000000..532ca0ad --- /dev/null +++ b/home/darwin/sketchybar/plugins/wg_on.sh @@ -0,0 +1,5 @@ +### You need to edit sudoers file to run wg-quick without password + +# %admin ALL = (ALL) NOPASSWD: /nix/store/s2qw0sxax8pckbzmyw6wrarahmx65bq9-wireguard-tools-1.0.20210914/bin/wg-quick + +sudo wg-quick up wg0 diff --git a/home/darwin/sketchybar/variables.sh b/home/darwin/sketchybar/variables.sh new file mode 100755 index 00000000..84ca8c83 --- /dev/null +++ b/home/darwin/sketchybar/variables.sh @@ -0,0 +1,50 @@ +#!/usr/bin/env sh + +# Color Palette +# Tokyonight Night +BLACK=0xff24283b +WHITE=0xffa9b1d6 +MAGENTA=0xffbb9af7 +BLUE=0xff7aa2f7 +CYAN=0xff7dcfff +GREEN=0xff9ece6a +YELLOW=0xffe0af68 +ORANGE=0xffff9e64 +RED=0xfff7768e +BAR_COLOR=0xff1a1b26 +COMMENT=0xff565f89 + +# Tokyonight Day +# BLACK=0xffe9e9ed +# WHITE=0xff3760bf +# MAGENTA=0xff9854f1 +# BLUE=0xff2e7de9 +# CYAN=0xff007197 +# GREEN=0xff587539 +# YELLOW=0xff8c6c3e +# ORANGE=0xffb15c00 +# RED=0xfff52a65 +# BAR_COLOR=0xffe1e2e7 + +TRANSPARENT=0x00000000 + +# General bar colors +ICON_COLOR=$WHITE # Color of all icons +LABEL_COLOR=$WHITE # Color of all labels + +ITEM_DIR="$HOME/.config/sketchybar/items" +PLUGIN_DIR="$HOME/.config/sketchybar/plugins" + +FONT="Iosevka Nerd Font" + +PADDINGS=3 + +POPUP_BORDER_WIDTH=2 +POPUP_CORNER_RADIUS=11 +POPUP_BACKGROUND_COLOR=$BLACK +POPUP_BORDER_COLOR=$COMMENT + +CORNER_RADIUS=15 +BORDER_WIDTH=2 + +SHADOW=on diff --git a/hosts/darwin/casks/default.nix b/hosts/darwin/casks/default.nix new file mode 100644 index 00000000..e645495e --- /dev/null +++ b/hosts/darwin/casks/default.nix @@ -0,0 +1,43 @@ +{ ... }: + +{ + homebrew.enable = true; + homebrew.brews = [ + "kind" + "kubectl" + "bazelisk" + "sourcegraph/src-cli/src-cli" + "gh" + # "postgresql@15" + # "redis" + ]; + homebrew.casks = [ + # Development Tools + "homebrew/cask/docker" + # "syncthing" + # "insomnia" + # "tableplus" + # "ngrok" + "postico" + "wireshark" + "1password" + "orbstack" + + # Communication Tools + # Already installed manually + # "loom" + # "slack" + # "zoom" + # "firefox" + # "1password-cli" + + # Utility Tools + # "syncthing" + + # Productivity Tools + "raycast" + + # AI + # "diffusionbee" + ]; +} diff --git a/hosts/darwin/default.nix b/hosts/darwin/default.nix new file mode 100644 index 00000000..25cc7264 --- /dev/null +++ b/hosts/darwin/default.nix @@ -0,0 +1,154 @@ +{ self, pkgs, config, ... }: + +{ + imports = [ + ./sketchybar + ./yabai + # ./casks + # ../../modules/darwin/home-manager.nix + # ../../modules/shared + # ../../modules/shared/cachix + ]; + + environment.systemPackages = [ + pkgs.go + pkgs.python3 + pkgs.cargo + pkgs.k9s + pkgs.kubernetes-helm + pkgs.shellcheck + ]; + + age.identityPaths = [ "/Users/anishlakhwara/.ssh/id_ed25519" ]; + age.secrets.work-wg.file = "${self}/secrets/work-wg.age"; + age.secrets.work-wg.owner = "anishlakhwara"; + networking.wg-quick.interfaces = { + wg0 = { + address = [ "10.0.69.7/24" ]; + listenPort = 60990; # to match firewall allowedUDPPorts (without this wg uses random port numbers) + privateKeyFile = config.age.secrets.work-wg.path; + dns = [ "10.0.69.4" ]; + postDown = '' + sudo /usr/sbin/networksetup -setdnsservers Wi-Fi "Empty" + ''; + peers = [ + # For a client configuration, one peer entry for the server will suffice. + { + publicKey = "c1J4p63rD3IlszugMZiki7UBV3YmDdqa3DU4UejXzAI="; + allowedIPs = [ "10.0.69.0/24" ]; + # Set this to the server IP and port. + endpoint = "sealight.xyz:60990"; # ToDo: route to endpoint not automatically configured https://wiki.archlinux.org/index.php/WireGuard#Loop_routing https://discourse.nixos.org/t/solved-minimal-firewall-setup-for-wireguard-client/7577 + persistentKeepalive = 25; + } + ]; + }; + }; + + # Auto upgrade nix package and the daemon service. + services.nix-daemon.enable = true; + nixpkgs.hostPlatform = "aarch64-darwin"; + programs.zsh.enable = true; + + # Setup user, packages, programs + nix = { + # package = pkgs.nixUnstable; + settings.trusted-users = [ "@admin" "anishlakhwara" ]; + + gc = { + user = "root"; + automatic = true; + interval = { Weekday = 0; Hour = 2; Minute = 0; }; + options = "--delete-older-than 30d"; + }; + + # Turn this on to make command line easier + extraOptions = '' + experimental-features = nix-command flakes + ''; + }; + + # Turn off NIX_PATH warnings now that we're using flakes + system.checks.verifyNixPath = false; + + # Load configuration that is shared across systems + # environment.systemPackages = with pkgs; [ + # + # ] ++ (import ../../modules/shared/packages.nix { inherit pkgs; }); + + # Enable fonts dir + # fonts.fontDir.enable = true; + fonts.packages = with pkgs; [ + fira-code + fira-code-symbols + hermit + #hack + siji + font-awesome + proggyfonts + (nerdfonts.override { fonts = [ "FiraCode" "DroidSansMono" "Iosevka" ]; }) + ]; + + system = { + stateVersion = 4; + + keyboard = { + enableKeyMapping = true; + }; + + defaults = { + LaunchServices = { + LSQuarantine = false; + }; + + NSGlobalDomain = { + AppleShowAllExtensions = true; + ApplePressAndHoldEnabled = false; + + # 120, 90, 60, 30, 12, 6, 2 + KeyRepeat = 2; + + # 120, 94, 68, 35, 25, 15 + InitialKeyRepeat = 15; + + "com.apple.mouse.tapBehavior" = 1; + "com.apple.sound.beep.volume" = 0.0; + "com.apple.sound.beep.feedback" = 0; + }; + + loginwindow = { + # disable guest account + GuestEnabled = false; + # show name instead of username + SHOWFULLNAME = false; + }; + + dock = { + autohide = true; + autohide-delay = 0.0; + autohide-time-modifier = 1.0; + static-only = false; + showhidden = false; + show-recents = false; + launchanim = true; + mouse-over-hilite-stack = true; + orientation = "bottom"; + tilesize = 48; + mru-spaces = false; + }; + + finder = { + _FXShowPosixPathInTitle = false; + }; + + trackpad = { + Clicking = false; + TrackpadThreeFingerDrag = true; + }; + }; + + # keyboard = { + # enableKeyMapping = true; + # remapCapsLockToControl = true; + # }; + }; +} diff --git a/hosts/darwin/sketchybar/default.nix b/hosts/darwin/sketchybar/default.nix new file mode 100644 index 00000000..8fe56678 --- /dev/null +++ b/hosts/darwin/sketchybar/default.nix @@ -0,0 +1,10 @@ +{ pkgs, ... }: + +{ + services.sketchybar = { + enable = true; + config = (builtins.readFile ./sketchybarrc); + extraPackages = [ pkgs.jq ]; + }; + +} diff --git a/hosts/darwin/sketchybar/sketchybarrc b/hosts/darwin/sketchybar/sketchybarrc new file mode 100755 index 00000000..775c7141 --- /dev/null +++ b/hosts/darwin/sketchybar/sketchybarrc @@ -0,0 +1,59 @@ +#!/usr/bin/env bash + +source "$HOME/.config/sketchybar/variables.sh" # Loads all defined colors + +# General bar and defaults +# parts I didn't want +# y_offset=5 \ +# margin=5 \ + +sketchybar --bar height=35 \ + color="$BAR_COLOR" \ + shadow="$SHADOW" \ + position=top \ + sticky=on \ + padding_right=0 \ + padding_left=3 \ + corner_radius="$CORNER_RADIUS" \ + blur_radius=20 \ + notch_width=200 \ + --default updates=when_shown \ + icon.font="$FONT:Bold:13.5" \ + icon.color="$ICON_COLOR" \ + icon.padding_left="$PADDINGS" \ + icon.padding_right="$PADDINGS" \ + label.font="$FONT:Bold:13.0" \ + label.color="$LABEL_COLOR" \ + label.padding_left="$PADDINGS" \ + label.padding_right="$PADDINGS" \ + background.padding_right="$PADDINGS" \ + background.padding_left="$PADDINGS" \ + popup.background.border_width=1 \ + popup.background.corner_radius=11 \ + popup.background.border_color="$POPUP_BORDER_COLOR" \ + popup.background.color="$POPUP_BACKGROUND_COLOR" \ + popup.background.shadow.drawing="$SHADOW" + +# Left +# source "$ITEM_DIR/apple.sh" +source "$ITEM_DIR/spaces.sh" + +# Center (of notch) +# source "$ITEM_DIR/spotify.sh" +source "$ITEM_DIR/front_app.sh" + +# Right +source "$ITEM_DIR/clock.sh" +source "$ITEM_DIR/calendar.sh" +source "$ITEM_DIR/battery.sh" +source "$ITEM_DIR/volume.sh" +source "$ITEM_DIR/cpu.sh" +source "$ITEM_DIR/vpn.sh" + +#################### Finalizing Setup #################### + +# sketchybar --hotload true + +sketchybar --update + +echo "sketchybar configuration loaded.." diff --git a/hosts/darwin/yabai/default.nix b/hosts/darwin/yabai/default.nix new file mode 100644 index 00000000..5a9769ef --- /dev/null +++ b/hosts/darwin/yabai/default.nix @@ -0,0 +1,102 @@ +{pkgs, ... }: + +{ + services.yabai = { + enable = true; + config = { + mouse_follows_focus = "off"; + focus_follows_mouse = "off"; + window_placement = "second_child"; + window_topmost = "off"; + window_opacity = "off"; + window_opacity_duration = 0.0; + window_shadow = "on"; + window_border = "off"; + window_border_placement = "inset"; + window_border_width = 4; + window_border_radius = -1.0; + active_window_border_topmost = "off"; + active_window_border_color = "0xff775759"; + normal_window_border_color = "0xff505050"; + insert_window_border_color = "0xffd75f5f"; + active_window_opacity = 1.0; + normal_window_opacity = 0.9; + split_ratio = 0.73; + auto_balance = "on"; + mouse_modifier = "fn"; + mouse_action1 = "move"; + mouse_action2 = "resize"; + layout = "bsp"; + top_padding = 5; + bottom_padding = 5; + left_padding = 5; + right_padding = 5; + window_gap = 5; + }; + extraConfig = '' + # Do not manage windows with certain titles eg. Copying files or moving to bin + yabai -m rule --add title="(Copy|Bin|About This Mac|Info)" manage=off + # Do not manage some apps which are not resizable + yabai -m rule --add app="^(Calculator|System Preferences|[sS]tats|[Jj]et[Bb]rains [Tt]ool[Bb]ox|kftray)$" manage=off + ''; + }; + + system.activationScripts.yabai = { + enable = true; + text = '' + yabai --install-service && yabai --start-service + ''; + }; + + services.skhd = { + enable = true; + skhdConfig = '' +# Open iTerm2 +cmd - enter : kitty --single-instance -d ~ + +################## +# Window Motions # +################## +# Rotate +lalt - r : yabai -m space --rotate 90 +# Mirror verticaly +lalt - x : yabai -m space --mirror y-axis +# Mirror horizontaly +lalt - y : yabai -m space --mirror x-axis +# yes, i know i swapped x and y, but I mainly use y-axis and y is further... +# Fullscreen +cmd - f : yabai -m window --toggle zoom-fullscreen +# Swap +lalt - q : yabai -m window --swap west +lalt - s : yabai -m window --swap south +lalt - z : yabai -m window --swap north +lalt - d : yabai -m window --swap east +# Warp +shift + lalt - q : yabai -m window --warp west +shift + lalt - s : yabai -m window --warp south +shift + lalt - z : yabai -m window --warp north +shift + lalt - d : yabai -m window --warp east + +######### +# Focus # +######### +# Clockwise +# alt - tab : yabai -m window --focus "$(yabai -m query --windows --space | jq -re "[sort_by(.id, .frame) | .[] | select(.role == \"AXWindow\" and .subrole == \"AXStandardWindow\") | .id] | nth(index($(yabai -m query --windows --window | jq -re ".id")) - 1)")" +# Counter-clockwise +# shift - tab : yabai -m window --focus "$(yabai -m query --windows --space | jq -re "[sort_by(.id, .frame) | reverse | .[] | select(.role == \"AXWindow\" and .subrole == \"AXStandardWindow\") | .id] | nth(index($(yabai -m query --windows --window | jq -re ".id")) - 1)")" + +########## +# Spaces # +########## +ctrl - left : yabai -m space --focus prev +ctrl - right : yabai -m space --focus next +ctrl + shift - right : yabai -m window --space next; yabai -m space --focus next +ctrl + shift - left : yabai -m window --space prev; yabai -m space --focus prev +cmd - 1 : yabai -m window --space 1; yabai -m space --focus 1 +cmd - 2 : yabai -m window --space 2; yabai -m space --focus 2 +cmd - 3 : yabai -m window --space 3; yabai -m space --focus 3 +cmd - 4 : yabai -m window --space 4; yabai -m space --focus 4 +cmd - 5 : yabai -m window --space 5; yabai -m space --focus 5 + ''; + }; +} diff --git a/hosts/deck/configuration.nix b/hosts/deck/configuration.nix new file mode 100644 index 00000000..8926d078 --- /dev/null +++ b/hosts/deck/configuration.nix @@ -0,0 +1,120 @@ +# Edit this configuration file to define what should be installed on +# your system. Help is available in the configuration.nix(5) man page +# and in the NixOS manual (accessible by running ‘nixos-help’). + +{ config, pkgs, ... }: + +{ + imports = + [ # Include the results of the hardware scan. + ./hardware-configuration.nix + ]; + + # Bootloader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + + networking.hostName = "deck"; # Define your hostname. + # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + + # Configure network proxy if necessary + # networking.proxy.default = "http://user:password@proxy:port/"; + # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; + + # Enable networking + networking.networkmanager.enable = true; + + # Set your time zone. + # time.timeZone = "America/Los_Angeles"; + + # Select internationalisation properties. + i18n.defaultLocale = "en_US.UTF-8"; + + # i18n.extraLocaleSettings = { + # LC_ADDRESS = "en_US.UTF-8"; + # LC_IDENTIFICATION = "en_US.UTF-8"; + # LC_MEASUREMENT = "en_US.UTF-8"; + # LC_MONETARY = "en_US.UTF-8"; + # LC_NAME = "en_US.UTF-8"; + # LC_NUMERIC = "en_US.UTF-8"; + # LC_PAPER = "en_US.UTF-8"; + # LC_TELEPHONE = "en_US.UTF-8"; + # LC_TIME = "en_US.UTF-8"; + # }; + + # Enable the X11 windowing system. + # services.xserver.enable = true; + + # Enable the GNOME Desktop Environment. + # services.xserver.displayManager.gdm.enable = true; + # services.xserver.desktopManager.gnome.enable = true; + + # Configure keymap in X11 + # services.xserver.xkb = { + # layout = "us"; + # variant = ""; + # }; + + + # use the example session manager (no others are packaged yet so this is enabled by default, + # no need to redefine it in your config for now) + #media-session.enable = true; + + # Enable touchpad support (enabled default in most desktopManager). + # services.xserver.libinput.enable = true; + + # Define a user account. Don't forget to set a password with ‘passwd’. + # users.users.anish = { + # isNormalUser = true; + # extraGroups = [ "networkmanager" "wheel" ]; + # packages = with pkgs; [ + # # thunderbird + # ]; + # }; + + # Enable automatic login for the user. + services.xserver.displayManager.autoLogin.enable = true; + services.xserver.displayManager.autoLogin.user = "anish"; + + # Workaround for GNOME autologin: https://github.com/NixOS/nixpkgs/issues/103746#issuecomment-945091229 + systemd.services."getty@tty1".enable = false; + systemd.services."autovt@tty1".enable = false; + + # Install firefox. + # programs.firefox.enable = true; + + # List packages installed in system profile. To search, run: + # $ nix search wget + environment.systemPackages = with pkgs; [ + # vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. + # wget + ]; + + # Some programs need SUID wrappers, can be configured further or are + # started in user sessions. + # programs.mtr.enable = true; + # programs.gnupg.agent = { + # enable = true; + # enableSSHSupport = true; + # }; + + # List services that you want to enable: + + # Enable the OpenSSH daemon. + # services.openssh.enable = true; + + # Open ports in the firewall. + # networking.firewall.allowedTCPPorts = [ ... ]; + # networking.firewall.allowedUDPPorts = [ ... ]; + # Or disable the firewall altogether. + # networking.firewall.enable = false; + + # This value determines the NixOS release from which the default + # settings for stateful data, like file locations and database versions + # on your system were taken. It‘s perfectly fine and recommended to leave + # this value at the release version of the first install of this system. + # Before changing this value read the documentation for this option + # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). + system.stateVersion = "24.11"; # Did you read the comment? + +} diff --git a/hosts/deck/default.nix b/hosts/deck/default.nix new file mode 100644 index 00000000..cda17705 --- /dev/null +++ b/hosts/deck/default.nix @@ -0,0 +1,51 @@ +{ self, pkgs, config, ... }: +{ + imports = [ + ./configuration.nix + ../users/anish + ../profiles/core + # ../profiles/bluetooth + # ../profiles/music + ../profiles/sync/cal + ../profiles/wifi + ../profiles/desktop + ../profiles/mimetypes + ../profiles/syncthing + ../profiles/mossnet-hosts + # ../profiles/fly-wg + # ../profiles/mount-mossnet + ]; + + # age.secrets.deck-wg.file = "${self}/secrets/deck-wg.age"; + # age.secrets.deck-wg.owner = "deck"; + # mossnet.wg = { + # enable = true; + # ips = [ "10.0.69.6/24" ]; + # privateKeyFile = "/run/agenix/deck-wg"; + # }; + + users.users.anish.extraGroups = [ "adbusers" "wheel" "plugdev" "libvertd" ]; + # boot.plymouth = { + # enable = true; + # themePackages = [ pkgs.plymouth-themes ]; + # theme = "motion"; + # }; + + jovian.steam.enable = true; + jovian.devices.steamdeck.enable = true; + jovian.steam.user = "anish"; + jovian.steam.autoStart = true; + jovian.steam.desktopSession = "gnome"; + # jovian.steam.desktopSession = "none+bspwm"; + + # Install XR drivers + # environment.systemPackages = with pkgs; [ + # xrlinuxdriver + # breezy-gnome + # ]; + + # services.udev.packages = with pkgs; [ + # xrlinuxdriver + # ]; + +} diff --git a/hosts/deck/hardware-configuration.nix b/hosts/deck/hardware-configuration.nix new file mode 100644 index 00000000..8313aefe --- /dev/null +++ b/hosts/deck/hardware-configuration.nix @@ -0,0 +1,40 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "usbhid" "sdhci_pci" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/d432dae0-3512-4891-9582-56d7ecd8524c"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/5B4C-7406"; + fsType = "vfat"; + options = [ "fmask=0077" "dmask=0077" ]; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/f75a730e-c849-4edd-a17f-52492d4260dc"; } + ]; + + # 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 + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.wlo1.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/modules/darwin/README.md b/modules/darwin/README.md new file mode 100644 index 00000000..ccff20ff --- /dev/null +++ b/modules/darwin/README.md @@ -0,0 +1,12 @@ + +## Layout +``` +. +├── dock # MacOS dock configuration +├── casks.nix # List of homebrew casks +├── default.nix # Defines module, system-level config +├── files.nix # Non-Nix, static configuration files (now immutable!) +├── home-manager.nix # Defines user programs +├── packages.nix # List of packages to install for MacOS +├── secrets.nix # Age-encrypted secrets with agenix +``` diff --git a/modules/darwin/dock/default.nix b/modules/darwin/dock/default.nix new file mode 100644 index 00000000..19af49f9 --- /dev/null +++ b/modules/darwin/dock/default.nix @@ -0,0 +1,67 @@ +{ config, pkgs, lib, ... }: +with lib; +let + cfg = config.local.dock; + inherit (pkgs) stdenv dockutil; +in +{ + options = { + local.dock.enable = mkOption { + description = "Enable dock"; + default = stdenv.isDarwin; + example = false; + }; + + local.dock.entries = mkOption + { + description = "Entries on the Dock"; + type = with types; listOf (submodule { + options = { + path = lib.mkOption { type = str; }; + section = lib.mkOption { + type = str; + default = "apps"; + }; + options = lib.mkOption { + type = str; + default = ""; + }; + }; + }); + readOnly = true; + }; + }; + + config = + mkIf cfg.enable + ( + let + normalize = path: if hasSuffix ".app" path then path + "/" else path; + entryURI = path: "file://" + (builtins.replaceStrings + [" " "!" "\"" "#" "$" "%" "&" "'" "(" ")"] + ["%20" "%21" "%22" "%23" "%24" "%25" "%26" "%27" "%28" "%29"] + (normalize path) + ); + wantURIs = concatMapStrings + (entry: "${entryURI entry.path}\n") + cfg.entries; + createEntries = concatMapStrings + (entry: "${dockutil}/bin/dockutil --no-restart --add '${entry.path}' --section ${entry.section} ${entry.options}\n") + cfg.entries; + in + { + system.activationScripts.postUserActivation.text = '' + echo >&2 "Setting up the Dock..." + haveURIs="$(${dockutil}/bin/dockutil --list | ${pkgs.coreutils}/bin/cut -f2)" + if ! diff -wu <(echo -n "$haveURIs") <(echo -n '${wantURIs}') >&2 ; then + echo >&2 "Resetting Dock." + ${dockutil}/bin/dockutil --no-restart --remove all + ${createEntries} + killall Dock + else + echo >&2 "Dock setup complete." + fi + ''; + } + ); +} diff --git a/modules/darwin/files.nix b/modules/darwin/files.nix new file mode 100644 index 00000000..530f1098 --- /dev/null +++ b/modules/darwin/files.nix @@ -0,0 +1,54 @@ +{ user, config, pkgs, ... }: + +let + xdg_configHome = "${config.users.users.${user}.home}/.config"; + xdg_dataHome = "${config.users.users.${user}.home}/.local/share"; + xdg_stateHome = "${config.users.users.${user}.home}/.local/state"; in +{ + + # Raycast script so that "Run Emacs" is available and uses Emacs daemon + "${xdg_dataHome}/bin/emacsclient" = { + executable = true; + text = '' + #!/bin/zsh + # + # Required parameters: + # @raycast.schemaVersion 1 + # @raycast.title Run Emacs + # @raycast.mode silent + # + # Optional parameters: + # @raycast.packageName Emacs + # @raycast.icon ${xdg_dataHome}/img/icons/Emacs.icns + # @raycast.iconDark ${xdg_dataHome}/img/icons/Emacs.icns + + if [[ $1 = "-t" ]]; then + # Terminal mode + ${pkgs.emacs}/bin/emacsclient -t $@ + else + # GUI mode + ${pkgs.emacs}/bin/emacsclient -c -n $@ + fi + ''; + }; + + # Script to import Drafts into Emacs org-roam + "${xdg_dataHome}/bin/import-drafts" = { + executable = true; + text = '' + #!/bin/sh + + for f in ${xdg_stateHome}/drafts/* + do + if [[ ! "$f" =~ "done" ]]; then + echo "Importing $f" + filename="$(head -c 10 $f)" + output="${xdg_dataHome}/org-roam/daily/$filename.org" + echo '\n' >> "$output" + tail -n +3 $f >> "$output" + mv $f done + fi + done + ''; + }; +} diff --git a/modules/darwin/home-manager.nix b/modules/darwin/home-manager.nix new file mode 100644 index 00000000..9f856079 --- /dev/null +++ b/modules/darwin/home-manager.nix @@ -0,0 +1,85 @@ +{ config, pkgs, lib, home-manager, ... }: + +let + user = "anishlakhwara"; + # Define the content of your file as a derivation + myEmacsLauncher = pkgs.writeScript "emacs-launcher.command" '' + #!/bin/sh + emacsclient -c -n & + ''; + sharedFiles = import ../shared/files.nix { inherit config pkgs; }; + additionalFiles = import ./files.nix { inherit user config pkgs; }; +in +{ + imports = [ + ./dock + ]; + + # It me + users.users.${user} = { + name = "${user}"; + home = "/Users/${user}"; + isHidden = false; + shell = pkgs.zsh; + }; + + # Enable home-manager + home-manager = { + useGlobalPkgs = true; + users.${user} = { pkgs, config, lib, ... }:{ + home = { + enableNixpkgsReleaseCheck = false; + packages = pkgs.callPackage ./packages.nix {}; + file = lib.mkMerge [ + sharedFiles + additionalFiles + { "emacs-launcher.command".source = myEmacsLauncher; } + ]; + + stateVersion = "23.11"; + }; + + programs = {} // import ../shared/home-manager.nix { inherit config pkgs lib; }; + + # Marked broken Oct 20, 2022 check later to remove this + # https://github.com/nix-community/home-manager/issues/3344 + manual.manpages.enable = false; + }; + }; + + # Fully declarative dock using the latest from Nix Store + local = { + dock.enable = true; + dock.entries = [ + { path = "/Applications/Slack.app/"; } + { path = "/System/Applications/Messages.app/"; } + { path = "/System/Applications/Facetime.app/"; } + { path = "/Applications/Telegram.app/"; } + { path = "${pkgs.alacritty}/Applications/Alacritty.app/"; } + { path = "/System/Applications/Music.app/"; } + { path = "/System/Applications/News.app/"; } + { path = "/System/Applications/Photos.app/"; } + { path = "/System/Applications/Photo Booth.app/"; } + { path = "/System/Applications/TV.app/"; } + { path = "${pkgs.jetbrains.phpstorm}/Applications/PhpStorm.app/"; } + { path = "/Applications/TablePlus.app/"; } + { path = "/Applications/Asana.app/"; } + { path = "/Applications/Drafts.app/"; } + { path = "/System/Applications/Home.app/"; } + { + path = toString myEmacsLauncher; + section = "others"; + } + { + path = "${config.users.users.${user}.home}/.local/share/"; + section = "others"; + options = "--sort name --view grid --display folder"; + } + { + path = "${config.users.users.${user}.home}/.local/share/downloads"; + section = "others"; + options = "--sort name --view grid --display stack"; + } + ]; + }; +} diff --git a/modules/darwin/packages.nix b/modules/darwin/packages.nix new file mode 100644 index 00000000..7eaa1d81 --- /dev/null +++ b/modules/darwin/packages.nix @@ -0,0 +1,7 @@ +{ pkgs }: + +with pkgs; +let shared-packages = import ../shared/packages.nix { inherit pkgs; }; in +shared-packages ++ [ + dockutil +] diff --git a/modules/darwin/secrets.nix b/modules/darwin/secrets.nix new file mode 100644 index 00000000..bed9479e --- /dev/null +++ b/modules/darwin/secrets.nix @@ -0,0 +1,47 @@ +{ config, pkgs, agenix, secrets, ... }: + +let user = "dustin"; in +{ + age = { + identityPaths = [ + "/Users/${user}/.ssh/id_ed25519" + ]; + + secrets = { + "syncthing-cert" = { + symlink = true; + path = "/Users/${user}/Library/Application Support/Syncthing/cert.pem"; + file = "${secrets}/darwin-syncthing-cert.age"; + mode = "644"; + owner = "${user}"; + group = "staff"; + }; + + "syncthing-key" = { + symlink = true; + path = "/Users/${user}/Library/Application Support/Syncthing/key.pem"; + file = "${secrets}/darwin-syncthing-key.age"; + mode = "600"; + owner = "${user}"; + group = "staff"; + }; + + "github-ssh-key" = { + symlink = true; + path = "/Users/${user}/.ssh/id_github"; + file = "${secrets}/github-ssh-key.age"; + mode = "600"; + owner = "${user}"; + group = "staff"; + }; + + "github-signing-key" = { + symlink = false; + path = "/Users/${user}/.ssh/pgp_github.key"; + file = "${secrets}/github-signing-key.age"; + mode = "600"; + owner = "${user}"; + }; + }; + }; +} diff --git a/pkgs/breezy-gnome.nix b/pkgs/breezy-gnome.nix new file mode 100644 index 00000000..1c90e80f --- /dev/null +++ b/pkgs/breezy-gnome.nix @@ -0,0 +1,54 @@ +# Imported from https://github.com/wheaney/breezy-desktop/pull/113/files +# Use flake or nixpkgs once upstreamed +{ + self, + lib, + stdenv, + glib, + ... +}: stdenv.mkDerivation { + pname = "breezy-gnome"; + version = "unstable"; + + src = lib.cleanSource "${self}/gnome/src/."; + + buildInputs = [ + glib + ]; + + passthru = { + extensionUuid = "breezydesktop@xronlinux.com"; + }; + + buildPhase = '' + mkdir -p build/schemas + glib-compile-schemas --targetdir="build/schemas" $src/schemas/ + cp $src/*.js build/ + cp $src/*.frag build/ + mkdir -p build/schemas/ + cp $src/schemas/*.xml build/schemas/ + mkdir -p build/dbus-interfaces/ + cp $src/dbus-interfaces/*.xml build/dbus-interfaces/ + mkdir -p build/textures/ + cp -rL $src/textures/* build/textures/ + cp $src/metadata.json build/ + ''; + + installPhase = '' + extra_source=() + for file in "$DEST_DIR"/*; do + extra_source+=("--extra-source=$file") + done + gnome-extensions pack --force "$${extra_source[@]}" "build" -o "$out" + ''; + + doInstallCheck = false; + # The default release is a script which will do an impure download + # just ensure that the application can run without network + + meta = with lib; { + homepage = "https://github.com/wheaney/breezy-desktop"; + maintainers = with maintainers; [shymega]; + platforms = platforms.linux; + }; + } diff --git a/pkgs/xr-linux-driver.nix b/pkgs/xr-linux-driver.nix new file mode 100644 index 00000000..dfccc097 --- /dev/null +++ b/pkgs/xr-linux-driver.nix @@ -0,0 +1,114 @@ +# Imported from https://github.com/wheaney/XRLinuxDriver/pull/80/files +# Use flake or nixpkgs once upstreamed +{ + self, + lib, + pkgs, + stdenv, + fetchFromGitLab, + libusb1, + curl, + openssl, + libevdev, + json_c, + hidapi, + wayland, + cmake, + pkg-config, + python3, + libffi, + autoPatchelfHook, + ... +}: let + pythonEnv = python3.withPackages (ps: [ps.pyyaml]); + buildInputs = [ + curl + hidapi + json_c + libevdev + libffi + libusb1 + openssl + stdenv.cc.cc.lib + wayland + ]; + arch = + if pkgs.system == "aarch64-linux" + then "aarch64" + else if pkgs.system == "x86_64-linux" + then "x86_64" + else throw "Unsupported system ${pkgs.system}"; +in + stdenv.mkDerivation rec { + pname = "xrlinuxdriver"; + version = "0.12.0.1"; + + srcs = [ + (fetchFromGitLab rec { + domain = "gitlab.com"; + owner = "TheJackiMonster"; + repo = "nrealAirLinuxDriver"; + rev = "3225fcc575e19a8407d5019903567cff1c3ed1a8"; + hash = "sha256-NRbcANt/CqREQZoYIYtTGVbvkZ7uo2Tm90s6prlsrQE="; + fetchSubmodules = true; + name = "${repo}-src"; + }) + (lib.cleanSourceWith { + src = self; + name = "${pname}-src"; + }) + ]; + sourceRoot = "${(builtins.elemAt srcs 1).name}"; + + postUnpack = let + nrealAirLinuxDriver = (builtins.elemAt srcs 0).name; + in '' + mkdir -p $sourceRoot/modules/xrealInterfaceLibrary + cp -R ${nrealAirLinuxDriver}/* $sourceRoot/modules/xrealInterfaceLibrary + chmod -R u+w $sourceRoot + ''; + + nativeBuildInputs = [ + cmake + pkg-config + pythonEnv + autoPatchelfHook + ]; + inherit buildInputs; + + cmakeFlags = [ + "-DCMAKE_SKIP_RPATH=ON" + ]; + cmakeBuildDir = "build"; + cmakeBuildType = "RelWithDebInfo"; + + installPhase = '' + mkdir -p $out/bin $out/lib/systemd/user $out/lib/udev/rules.d $out/lib/${arch} + cp xrDriver ../bin/xr_driver_cli ../bin/xr_driver_verify $out/bin + cp ../udev/* $out/lib/udev/rules.d/ + cp ../lib/${arch}/* $out/lib/${arch}/ + cp ../systemd/xr-driver.service $out/lib/systemd/user/xr-driver.service + cp ${hidapi}/lib/libhidapi-hidraw.so.0 $out/lib/ + substituteInPlace \ + $out/lib/systemd/user/xr-driver.service \ + --replace-fail "ExecStart={bin_dir}/xrDriver" "ExecStart=$out/bin/xrDriver" \ + --replace-fail "{ld_library_path}" "$out/lib/${arch}" + ''; + + preBuild = '' + addAutoPatchelfSearchPath $out/usr/lib/${arch} + ''; + + doInstallCheck = false; + # The default release is a script which will do an impure download + # just ensure that the application can run without network + + meta = with lib; { + homepage = "https://github.com/wheaney/XRLinuxDriver"; + license = licenses.mit; + description = "Linux service for interacting with XR devices."; + mainProgram = "xrDriver"; + maintainers = with maintainers; [shymega]; + platforms = platforms.linux; + }; + }