A Discord API Library for Gleam! 💫
0

Configure Feed

Select the types of activity you want to include in your feed.

init

author
Filip Hoffmann
date (Apr 12, 2025, 2:52 PM +0200) commit e6cd5595
+2259
+19
.direnv/bin/nix-direnv-reload
··· 1 + #!/usr/bin/env bash 2 + set -e 3 + if [[ ! -d "/home/folo/flybycord" ]]; then 4 + echo "Cannot find source directory; Did you move it?" 5 + echo "(Looking for "/home/folo/flybycord")" 6 + echo 'Cannot force reload with this script - use "direnv reload" manually and then try again' 7 + exit 1 8 + fi 9 + 10 + # rebuild the cache forcefully 11 + _nix_direnv_force_reload=1 direnv exec "/home/folo/flybycord" true 12 + 13 + # Update the mtime for .envrc. 14 + # This will cause direnv to reload again - but without re-building. 15 + touch "/home/folo/flybycord/.envrc" 16 + 17 + # Also update the timestamp of whatever profile_rc we have. 18 + # This makes sure that we know we are up to date. 19 + touch -r "/home/folo/flybycord/.envrc" "/home/folo/flybycord/.direnv"/*.rc
+1
.direnv/flake-inputs/460822m6mh3aylp8sik5jnl6skaglp6m-source
··· 1 + /nix/store/460822m6mh3aylp8sik5jnl6skaglp6m-source
+1
.direnv/flake-inputs/zd0x43g1jcav0xy0k6q9pdhy3bvif77n-source
··· 1 + /nix/store/zd0x43g1jcav0xy0k6q9pdhy3bvif77n-source
+1
.direnv/flake-profile-a5d5b61aa8a61b7d9d765e1daf971a9a578f1cfa
··· 1 + /nix/store/g2alxysdm2dp059rgvfs08a4m3skjllm-nix-shell-env
+2089
.direnv/flake-profile-a5d5b61aa8a61b7d9d765e1daf971a9a578f1cfa.rc
··· 1 + unset shellHook 2 + PATH=${PATH:-} 3 + nix_saved_PATH="$PATH" 4 + XDG_DATA_DIRS=${XDG_DATA_DIRS:-} 5 + nix_saved_XDG_DATA_DIRS="$XDG_DATA_DIRS" 6 + AR='ar' 7 + export AR 8 + AS='as' 9 + export AS 10 + BASH='/nix/store/58br4vk3q5akf4g8lx0pqzfhn47k3j8d-bash-5.2p37/bin/bash' 11 + CC='gcc' 12 + export CC 13 + CONFIG_SHELL='/nix/store/58br4vk3q5akf4g8lx0pqzfhn47k3j8d-bash-5.2p37/bin/bash' 14 + export CONFIG_SHELL 15 + CXX='g++' 16 + export CXX 17 + HOSTTYPE='x86_64' 18 + HOST_PATH='/nix/store/yg8chrcasxcrff1v38a0xhk0s6y921vs-gleam-1.9.1/bin:/nix/store/vsld7i3p22gqmfw35lbq15jsncdllr3a-rebar3-3.24.0/bin:/nix/store/ca20vikndz85svs4xaj8szpwac3xa4pk-erlang-27.3.2/bin:/nix/store/yh6qg1nsi5h2xblcr67030pz58fsaxx3-coreutils-9.6/bin:/nix/store/xq5f95pp297afc2xjgrmhmf9w631qp7m-findutils-4.10.0/bin:/nix/store/wj1c3gsiajabnq50ifxqnlv60i5rhqj7-diffutils-3.10/bin:/nix/store/xhql0ilzbiqwnmz4z8y0phk611wynxf2-gnused-4.9/bin:/nix/store/40yifhx34v4g4llrdn3v2ag8w02j10fv-gnugrep-3.11/bin:/nix/store/r66s4mjwqi7zkqqyry5yhhv0wm5rw96a-gawk-5.3.1/bin:/nix/store/hfkclq54gppdb9fshnkwfdph1safyvli-gnutar-1.35/bin:/nix/store/4q2sv4sqb7y8y4pp3n9bf2aabmgqmwmy-gzip-1.13/bin:/nix/store/pcf18502sz0b25qya2lzm5f7wy0pd7a6-bzip2-1.0.8-bin/bin:/nix/store/zzgldw3dwyhzn7sw9cyq7d7k57h0yx46-gnumake-4.4.1/bin:/nix/store/58br4vk3q5akf4g8lx0pqzfhn47k3j8d-bash-5.2p37/bin:/nix/store/lf3ln60nya8xmkymabap9i7gqj60k9py-patch-2.7.6/bin:/nix/store/f246qzchy7zy00z1f42dqz9jiwcf5n7f-xz-5.6.4-bin/bin:/nix/store/hyp4b779nh5y4m48zvvhd4y3z1gm8hd5-file-5.46/bin' 19 + export HOST_PATH 20 + IFS=' 21 + ' 22 + IN_NIX_SHELL='impure' 23 + export IN_NIX_SHELL 24 + LD='ld' 25 + export LD 26 + LINENO='76' 27 + MACHTYPE='x86_64-pc-linux-gnu' 28 + NIX_BINTOOLS='/nix/store/r8gajll0yb0c08hd734lyj3jmqav3p9a-binutils-wrapper-2.43.1' 29 + export NIX_BINTOOLS 30 + NIX_BINTOOLS_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu='1' 31 + export NIX_BINTOOLS_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu 32 + NIX_BUILD_CORES='8' 33 + export NIX_BUILD_CORES 34 + NIX_CC='/nix/store/8v6k283dpbc0qkdq81nb6mrxrgcb10i1-gcc-wrapper-14-20241116' 35 + export NIX_CC 36 + NIX_CC_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu='1' 37 + export NIX_CC_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu 38 + NIX_CFLAGS_COMPILE=' -frandom-seed=g2alxysdm2' 39 + export NIX_CFLAGS_COMPILE 40 + NIX_ENFORCE_NO_NATIVE='1' 41 + export NIX_ENFORCE_NO_NATIVE 42 + NIX_HARDENING_ENABLE='bindnow format fortify fortify3 pic relro stackclashprotection stackprotector strictoverflow zerocallusedregs' 43 + export NIX_HARDENING_ENABLE 44 + NIX_LDFLAGS='-rpath /home/folo/flybycord/outputs/out/lib -L/nix/store/yg8chrcasxcrff1v38a0xhk0s6y921vs-gleam-1.9.1/lib -L/nix/store/yg8chrcasxcrff1v38a0xhk0s6y921vs-gleam-1.9.1/lib' 45 + export NIX_LDFLAGS 46 + NIX_NO_SELF_RPATH='1' 47 + NIX_STORE='/nix/store' 48 + export NIX_STORE 49 + NM='nm' 50 + export NM 51 + OBJCOPY='objcopy' 52 + export OBJCOPY 53 + OBJDUMP='objdump' 54 + export OBJDUMP 55 + OLDPWD='' 56 + export OLDPWD 57 + OPTERR='1' 58 + OSTYPE='linux-gnu' 59 + PATH='/nix/store/nk427kbyf9l6fpfdxb8hmrq2nlkl8nfl-patchelf-0.15.0/bin:/nix/store/8v6k283dpbc0qkdq81nb6mrxrgcb10i1-gcc-wrapper-14-20241116/bin:/nix/store/2agih0y5ns3sgbviw2xhivdgg59b41g9-gcc-14-20241116/bin:/nix/store/nq61v7a601gjndijq5nndprkzpwz4q9g-glibc-2.40-66-bin/bin:/nix/store/yh6qg1nsi5h2xblcr67030pz58fsaxx3-coreutils-9.6/bin:/nix/store/r8gajll0yb0c08hd734lyj3jmqav3p9a-binutils-wrapper-2.43.1/bin:/nix/store/s40y31bdn82sj6daaxid1bn3p7la03lv-binutils-2.43.1/bin:/nix/store/yg8chrcasxcrff1v38a0xhk0s6y921vs-gleam-1.9.1/bin:/nix/store/vsld7i3p22gqmfw35lbq15jsncdllr3a-rebar3-3.24.0/bin:/nix/store/ca20vikndz85svs4xaj8szpwac3xa4pk-erlang-27.3.2/bin:/nix/store/yh6qg1nsi5h2xblcr67030pz58fsaxx3-coreutils-9.6/bin:/nix/store/xq5f95pp297afc2xjgrmhmf9w631qp7m-findutils-4.10.0/bin:/nix/store/wj1c3gsiajabnq50ifxqnlv60i5rhqj7-diffutils-3.10/bin:/nix/store/xhql0ilzbiqwnmz4z8y0phk611wynxf2-gnused-4.9/bin:/nix/store/40yifhx34v4g4llrdn3v2ag8w02j10fv-gnugrep-3.11/bin:/nix/store/r66s4mjwqi7zkqqyry5yhhv0wm5rw96a-gawk-5.3.1/bin:/nix/store/hfkclq54gppdb9fshnkwfdph1safyvli-gnutar-1.35/bin:/nix/store/4q2sv4sqb7y8y4pp3n9bf2aabmgqmwmy-gzip-1.13/bin:/nix/store/pcf18502sz0b25qya2lzm5f7wy0pd7a6-bzip2-1.0.8-bin/bin:/nix/store/zzgldw3dwyhzn7sw9cyq7d7k57h0yx46-gnumake-4.4.1/bin:/nix/store/58br4vk3q5akf4g8lx0pqzfhn47k3j8d-bash-5.2p37/bin:/nix/store/lf3ln60nya8xmkymabap9i7gqj60k9py-patch-2.7.6/bin:/nix/store/f246qzchy7zy00z1f42dqz9jiwcf5n7f-xz-5.6.4-bin/bin:/nix/store/hyp4b779nh5y4m48zvvhd4y3z1gm8hd5-file-5.46/bin' 60 + export PATH 61 + PS4='+ ' 62 + RANLIB='ranlib' 63 + export RANLIB 64 + READELF='readelf' 65 + export READELF 66 + SHELL='/nix/store/58br4vk3q5akf4g8lx0pqzfhn47k3j8d-bash-5.2p37/bin/bash' 67 + export SHELL 68 + SIZE='size' 69 + export SIZE 70 + SOURCE_DATE_EPOCH='315532800' 71 + export SOURCE_DATE_EPOCH 72 + STRINGS='strings' 73 + export STRINGS 74 + STRIP='strip' 75 + export STRIP 76 + XDG_DATA_DIRS='/nix/store/nk427kbyf9l6fpfdxb8hmrq2nlkl8nfl-patchelf-0.15.0/share' 77 + export XDG_DATA_DIRS 78 + __structuredAttrs='' 79 + export __structuredAttrs 80 + _substituteStream_has_warned_replace_deprecation='false' 81 + buildInputs='/nix/store/yg8chrcasxcrff1v38a0xhk0s6y921vs-gleam-1.9.1 /nix/store/vsld7i3p22gqmfw35lbq15jsncdllr3a-rebar3-3.24.0 /nix/store/ca20vikndz85svs4xaj8szpwac3xa4pk-erlang-27.3.2' 82 + export buildInputs 83 + buildPhase='{ echo "------------------------------------------------------------"; 84 + echo " WARNING: the existence of this path is not guaranteed."; 85 + echo " It is an internal implementation detail for pkgs.mkShell."; 86 + echo "------------------------------------------------------------"; 87 + echo; 88 + # Record all build inputs as runtime dependencies 89 + export; 90 + } >> "$out" 91 + ' 92 + export buildPhase 93 + builder='/nix/store/58br4vk3q5akf4g8lx0pqzfhn47k3j8d-bash-5.2p37/bin/bash' 94 + export builder 95 + cmakeFlags='' 96 + export cmakeFlags 97 + configureFlags='' 98 + export configureFlags 99 + defaultBuildInputs='' 100 + defaultNativeBuildInputs='/nix/store/nk427kbyf9l6fpfdxb8hmrq2nlkl8nfl-patchelf-0.15.0 /nix/store/qjb61crwqjr60mgd75z8cfx0cmjgd1i9-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/8v6k283dpbc0qkdq81nb6mrxrgcb10i1-gcc-wrapper-14-20241116' 101 + depsBuildBuild='' 102 + export depsBuildBuild 103 + depsBuildBuildPropagated='' 104 + export depsBuildBuildPropagated 105 + depsBuildTarget='' 106 + export depsBuildTarget 107 + depsBuildTargetPropagated='' 108 + export depsBuildTargetPropagated 109 + depsHostHost='' 110 + export depsHostHost 111 + depsHostHostPropagated='' 112 + export depsHostHostPropagated 113 + depsTargetTarget='' 114 + export depsTargetTarget 115 + depsTargetTargetPropagated='' 116 + export depsTargetTargetPropagated 117 + doCheck='' 118 + export doCheck 119 + doInstallCheck='' 120 + export doInstallCheck 121 + dontAddDisableDepTrack='1' 122 + export dontAddDisableDepTrack 123 + declare -a envBuildBuildHooks=() 124 + declare -a envBuildHostHooks=() 125 + declare -a envBuildTargetHooks=() 126 + declare -a envHostHostHooks=('ccWrapper_addCVars' 'bintoolsWrapper_addLDVars' ) 127 + declare -a envHostTargetHooks=('ccWrapper_addCVars' 'bintoolsWrapper_addLDVars' ) 128 + declare -a envTargetTargetHooks=() 129 + 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' ) 130 + guess='8' 131 + initialPath='/nix/store/yh6qg1nsi5h2xblcr67030pz58fsaxx3-coreutils-9.6 /nix/store/xq5f95pp297afc2xjgrmhmf9w631qp7m-findutils-4.10.0 /nix/store/wj1c3gsiajabnq50ifxqnlv60i5rhqj7-diffutils-3.10 /nix/store/xhql0ilzbiqwnmz4z8y0phk611wynxf2-gnused-4.9 /nix/store/40yifhx34v4g4llrdn3v2ag8w02j10fv-gnugrep-3.11 /nix/store/r66s4mjwqi7zkqqyry5yhhv0wm5rw96a-gawk-5.3.1 /nix/store/hfkclq54gppdb9fshnkwfdph1safyvli-gnutar-1.35 /nix/store/4q2sv4sqb7y8y4pp3n9bf2aabmgqmwmy-gzip-1.13 /nix/store/pcf18502sz0b25qya2lzm5f7wy0pd7a6-bzip2-1.0.8-bin /nix/store/zzgldw3dwyhzn7sw9cyq7d7k57h0yx46-gnumake-4.4.1 /nix/store/58br4vk3q5akf4g8lx0pqzfhn47k3j8d-bash-5.2p37 /nix/store/lf3ln60nya8xmkymabap9i7gqj60k9py-patch-2.7.6 /nix/store/f246qzchy7zy00z1f42dqz9jiwcf5n7f-xz-5.6.4-bin /nix/store/hyp4b779nh5y4m48zvvhd4y3z1gm8hd5-file-5.46' 132 + mesonFlags='' 133 + export mesonFlags 134 + name='nix-shell-env' 135 + export name 136 + nativeBuildInputs='' 137 + export nativeBuildInputs 138 + out='/home/folo/flybycord/outputs/out' 139 + export out 140 + outputBin='out' 141 + outputDev='out' 142 + outputDevdoc='REMOVE' 143 + outputDevman='out' 144 + outputDoc='out' 145 + outputInclude='out' 146 + outputInfo='out' 147 + outputLib='out' 148 + outputMan='out' 149 + outputs='out' 150 + export outputs 151 + patches='' 152 + export patches 153 + phases='buildPhase' 154 + export phases 155 + pkg='/nix/store/8v6k283dpbc0qkdq81nb6mrxrgcb10i1-gcc-wrapper-14-20241116' 156 + declare -a pkgsBuildBuild=() 157 + declare -a pkgsBuildHost=('/nix/store/nk427kbyf9l6fpfdxb8hmrq2nlkl8nfl-patchelf-0.15.0' '/nix/store/qjb61crwqjr60mgd75z8cfx0cmjgd1i9-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/8v6k283dpbc0qkdq81nb6mrxrgcb10i1-gcc-wrapper-14-20241116' '/nix/store/r8gajll0yb0c08hd734lyj3jmqav3p9a-binutils-wrapper-2.43.1' ) 158 + declare -a pkgsBuildTarget=() 159 + declare -a pkgsHostHost=() 160 + declare -a pkgsHostTarget=('/nix/store/yg8chrcasxcrff1v38a0xhk0s6y921vs-gleam-1.9.1' '/nix/store/vsld7i3p22gqmfw35lbq15jsncdllr3a-rebar3-3.24.0' '/nix/store/ca20vikndz85svs4xaj8szpwac3xa4pk-erlang-27.3.2' ) 161 + declare -a pkgsTargetTarget=() 162 + declare -a postFixupHooks=('noBrokenSymlinksInAllOutputs' '_makeSymlinksRelativeInAllOutputs' '_multioutPropagateDev' ) 163 + declare -a postUnpackHooks=('_updateSourceDateEpochFromSourceRoot' ) 164 + declare -a preConfigureHooks=('_multioutConfig' ) 165 + preConfigurePhases=' updateAutotoolsGnuConfigScriptsPhase' 166 + declare -a preFixupHooks=('_moveToShare' '_multioutDocs' '_multioutDevs' ) 167 + preferLocalBuild='1' 168 + export preferLocalBuild 169 + prefix='/home/folo/flybycord/outputs/out' 170 + declare -a propagatedBuildDepFiles=('propagated-build-build-deps' 'propagated-native-build-inputs' 'propagated-build-target-deps' ) 171 + propagatedBuildInputs='' 172 + export propagatedBuildInputs 173 + declare -a propagatedHostDepFiles=('propagated-host-host-deps' 'propagated-build-inputs' ) 174 + propagatedNativeBuildInputs='' 175 + export propagatedNativeBuildInputs 176 + declare -a propagatedTargetDepFiles=('propagated-target-target-deps' ) 177 + shell='/nix/store/58br4vk3q5akf4g8lx0pqzfhn47k3j8d-bash-5.2p37/bin/bash' 178 + export shell 179 + shellHook='' 180 + export shellHook 181 + stdenv='/nix/store/9r1nl9ksiyszy4qzzg6y2gcdkca0xmhy-stdenv-linux' 182 + export stdenv 183 + strictDeps='' 184 + export strictDeps 185 + system='x86_64-linux' 186 + export system 187 + declare -a unpackCmdHooks=('_defaultUnpack' ) 188 + _activatePkgs () 189 + { 190 + 191 + local hostOffset targetOffset; 192 + local pkg; 193 + for hostOffset in "${allPlatOffsets[@]}"; 194 + do 195 + local pkgsVar="${pkgAccumVarVars[hostOffset + 1]}"; 196 + for targetOffset in "${allPlatOffsets[@]}"; 197 + do 198 + (( hostOffset <= targetOffset )) || continue; 199 + local pkgsRef="${pkgsVar}[$targetOffset - $hostOffset]"; 200 + local pkgsSlice="${!pkgsRef}[@]"; 201 + for pkg in ${!pkgsSlice+"${!pkgsSlice}"}; 202 + do 203 + activatePackage "$pkg" "$hostOffset" "$targetOffset"; 204 + done; 205 + done; 206 + done 207 + } 208 + _addRpathPrefix () 209 + { 210 + 211 + if [ "${NIX_NO_SELF_RPATH:-0}" != 1 ]; then 212 + export NIX_LDFLAGS="-rpath $1/lib ${NIX_LDFLAGS-}"; 213 + fi 214 + } 215 + _addToEnv () 216 + { 217 + 218 + local depHostOffset depTargetOffset; 219 + local pkg; 220 + for depHostOffset in "${allPlatOffsets[@]}"; 221 + do 222 + local hookVar="${pkgHookVarVars[depHostOffset + 1]}"; 223 + local pkgsVar="${pkgAccumVarVars[depHostOffset + 1]}"; 224 + for depTargetOffset in "${allPlatOffsets[@]}"; 225 + do 226 + (( depHostOffset <= depTargetOffset )) || continue; 227 + local hookRef="${hookVar}[$depTargetOffset - $depHostOffset]"; 228 + if [[ -z "${strictDeps-}" ]]; then 229 + local visitedPkgs=""; 230 + for pkg in "${pkgsBuildBuild[@]}" "${pkgsBuildHost[@]}" "${pkgsBuildTarget[@]}" "${pkgsHostHost[@]}" "${pkgsHostTarget[@]}" "${pkgsTargetTarget[@]}"; 231 + do 232 + if [[ "$visitedPkgs" = *"$pkg"* ]]; then 233 + continue; 234 + fi; 235 + runHook "${!hookRef}" "$pkg"; 236 + visitedPkgs+=" $pkg"; 237 + done; 238 + else 239 + local pkgsRef="${pkgsVar}[$depTargetOffset - $depHostOffset]"; 240 + local pkgsSlice="${!pkgsRef}[@]"; 241 + for pkg in ${!pkgsSlice+"${!pkgsSlice}"}; 242 + do 243 + runHook "${!hookRef}" "$pkg"; 244 + done; 245 + fi; 246 + done; 247 + done 248 + } 249 + _allFlags () 250 + { 251 + 252 + export system pname name version; 253 + while IFS='' read -r varName; do 254 + nixTalkativeLog "@${varName}@ -> ${!varName}"; 255 + args+=("--subst-var" "$varName"); 256 + done < <(awk 'BEGIN { for (v in ENVIRON) if (v ~ /^[a-z][a-zA-Z0-9_]*$/) print v }') 257 + } 258 + _assignFirst () 259 + { 260 + 261 + local varName="$1"; 262 + local _var; 263 + local REMOVE=REMOVE; 264 + shift; 265 + for _var in "$@"; 266 + do 267 + if [ -n "${!_var-}" ]; then 268 + eval "${varName}"="${_var}"; 269 + return; 270 + fi; 271 + done; 272 + echo; 273 + echo "error: _assignFirst: could not find a non-empty variable whose name to assign to ${varName}."; 274 + echo " The following variables were all unset or empty:"; 275 + echo " $*"; 276 + if [ -z "${out:-}" ]; then 277 + echo ' If you do not want an "out" output in your derivation, make sure to define'; 278 + echo ' the other specific required outputs. This can be achieved by picking one'; 279 + echo " of the above as an output."; 280 + echo ' You do not have to remove "out" if you want to have a different default'; 281 + echo ' output, because the first output is taken as a default.'; 282 + echo; 283 + fi; 284 + return 1 285 + } 286 + _callImplicitHook () 287 + { 288 + 289 + local def="$1"; 290 + local hookName="$2"; 291 + if declare -F "$hookName" > /dev/null; then 292 + nixTalkativeLog "calling implicit '$hookName' function hook"; 293 + "$hookName"; 294 + else 295 + if type -p "$hookName" > /dev/null; then 296 + nixTalkativeLog "sourcing implicit '$hookName' script hook"; 297 + source "$hookName"; 298 + else 299 + if [ -n "${!hookName:-}" ]; then 300 + nixTalkativeLog "evaling implicit '$hookName' string hook"; 301 + eval "${!hookName}"; 302 + else 303 + return "$def"; 304 + fi; 305 + fi; 306 + fi 307 + } 308 + _defaultUnpack () 309 + { 310 + 311 + local fn="$1"; 312 + local destination; 313 + if [ -d "$fn" ]; then 314 + destination="$(stripHash "$fn")"; 315 + if [ -e "$destination" ]; then 316 + echo "Cannot copy $fn to $destination: destination already exists!"; 317 + echo "Did you specify two \"srcs\" with the same \"name\"?"; 318 + return 1; 319 + fi; 320 + cp -r --preserve=mode,timestamps --reflink=auto -- "$fn" "$destination"; 321 + else 322 + case "$fn" in 323 + *.tar.xz | *.tar.lzma | *.txz) 324 + ( XZ_OPT="--threads=$NIX_BUILD_CORES" xz -d < "$fn"; 325 + true ) | tar xf - --mode=+w --warning=no-timestamp 326 + ;; 327 + *.tar | *.tar.* | *.tgz | *.tbz2 | *.tbz) 328 + tar xf "$fn" --mode=+w --warning=no-timestamp 329 + ;; 330 + *) 331 + return 1 332 + ;; 333 + esac; 334 + fi 335 + } 336 + _doStrip () 337 + { 338 + 339 + local -ra flags=(dontStripHost dontStripTarget); 340 + local -ra debugDirs=(stripDebugList stripDebugListTarget); 341 + local -ra allDirs=(stripAllList stripAllListTarget); 342 + local -ra stripCmds=(STRIP STRIP_FOR_TARGET); 343 + local -ra ranlibCmds=(RANLIB RANLIB_FOR_TARGET); 344 + stripDebugList=${stripDebugList[*]:-lib lib32 lib64 libexec bin sbin Applications Library/Frameworks}; 345 + stripDebugListTarget=${stripDebugListTarget[*]:-}; 346 + stripAllList=${stripAllList[*]:-}; 347 + stripAllListTarget=${stripAllListTarget[*]:-}; 348 + local i; 349 + for i in ${!stripCmds[@]}; 350 + do 351 + local -n flag="${flags[$i]}"; 352 + local -n debugDirList="${debugDirs[$i]}"; 353 + local -n allDirList="${allDirs[$i]}"; 354 + local -n stripCmd="${stripCmds[$i]}"; 355 + local -n ranlibCmd="${ranlibCmds[$i]}"; 356 + if [[ -n "${dontStrip-}" || -n "${flag-}" ]] || ! type -f "${stripCmd-}" 2> /dev/null 1>&2; then 357 + continue; 358 + fi; 359 + stripDirs "$stripCmd" "$ranlibCmd" "$debugDirList" "${stripDebugFlags[*]:--S -p}"; 360 + stripDirs "$stripCmd" "$ranlibCmd" "$allDirList" "${stripAllFlags[*]:--s -p}"; 361 + done 362 + } 363 + _eval () 364 + { 365 + 366 + if declare -F "$1" > /dev/null 2>&1; then 367 + "$@"; 368 + else 369 + eval "$1"; 370 + fi 371 + } 372 + _logHook () 373 + { 374 + 375 + if [[ -z ${NIX_LOG_FD-} ]]; then 376 + return; 377 + fi; 378 + local hookKind="$1"; 379 + local hookExpr="$2"; 380 + shift 2; 381 + if declare -F "$hookExpr" > /dev/null 2>&1; then 382 + nixTalkativeLog "calling '$hookKind' function hook '$hookExpr'" "$@"; 383 + else 384 + if type -p "$hookExpr" > /dev/null; then 385 + nixTalkativeLog "sourcing '$hookKind' script hook '$hookExpr'"; 386 + else 387 + if [[ "$hookExpr" != "_callImplicitHook"* ]]; then 388 + local exprToOutput; 389 + if [[ ${NIX_DEBUG:-0} -ge 5 ]]; then 390 + exprToOutput="$hookExpr"; 391 + else 392 + local hookExprLine; 393 + while IFS= read -r hookExprLine; do 394 + hookExprLine="${hookExprLine#"${hookExprLine%%[![:space:]]*}"}"; 395 + if [[ -n "$hookExprLine" ]]; then 396 + exprToOutput+="$hookExprLine\\n "; 397 + fi; 398 + done <<< "$hookExpr"; 399 + exprToOutput="${exprToOutput%%\\n }"; 400 + fi; 401 + nixTalkativeLog "evaling '$hookKind' string hook '$exprToOutput'"; 402 + fi; 403 + fi; 404 + fi 405 + } 406 + _makeSymlinksRelative () 407 + { 408 + 409 + local symlinkTarget; 410 + if [ "${dontRewriteSymlinks-}" ] || [ ! -e "$prefix" ]; then 411 + return; 412 + fi; 413 + while IFS= read -r -d '' f; do 414 + symlinkTarget=$(readlink "$f"); 415 + if [[ "$symlinkTarget"/ != "$prefix"/* ]]; then 416 + continue; 417 + fi; 418 + if [ ! -e "$symlinkTarget" ]; then 419 + echo "the symlink $f is broken, it points to $symlinkTarget (which is missing)"; 420 + fi; 421 + echo "rewriting symlink $f to be relative to $prefix"; 422 + ln -snrf "$symlinkTarget" "$f"; 423 + done < <(find $prefix -type l -print0) 424 + } 425 + _makeSymlinksRelativeInAllOutputs () 426 + { 427 + 428 + local output; 429 + for output in $(getAllOutputNames); 430 + do 431 + prefix="${!output}" _makeSymlinksRelative; 432 + done 433 + } 434 + _moveLib64 () 435 + { 436 + 437 + if [ "${dontMoveLib64-}" = 1 ]; then 438 + return; 439 + fi; 440 + if [ ! -e "$prefix/lib64" -o -L "$prefix/lib64" ]; then 441 + return; 442 + fi; 443 + echo "moving $prefix/lib64/* to $prefix/lib"; 444 + mkdir -p $prefix/lib; 445 + shopt -s dotglob; 446 + for i in $prefix/lib64/*; 447 + do 448 + mv --no-clobber "$i" $prefix/lib; 449 + done; 450 + shopt -u dotglob; 451 + rmdir $prefix/lib64; 452 + ln -s lib $prefix/lib64 453 + } 454 + _moveSbin () 455 + { 456 + 457 + if [ "${dontMoveSbin-}" = 1 ]; then 458 + return; 459 + fi; 460 + if [ ! -e "$prefix/sbin" -o -L "$prefix/sbin" ]; then 461 + return; 462 + fi; 463 + echo "moving $prefix/sbin/* to $prefix/bin"; 464 + mkdir -p $prefix/bin; 465 + shopt -s dotglob; 466 + for i in $prefix/sbin/*; 467 + do 468 + mv "$i" $prefix/bin; 469 + done; 470 + shopt -u dotglob; 471 + rmdir $prefix/sbin; 472 + ln -s bin $prefix/sbin 473 + } 474 + _moveSystemdUserUnits () 475 + { 476 + 477 + if [ "${dontMoveSystemdUserUnits:-0}" = 1 ]; then 478 + return; 479 + fi; 480 + if [ ! -e "${prefix:?}/lib/systemd/user" ]; then 481 + return; 482 + fi; 483 + local source="$prefix/lib/systemd/user"; 484 + local target="$prefix/share/systemd/user"; 485 + echo "moving $source/* to $target"; 486 + mkdir -p "$target"; 487 + ( shopt -s dotglob; 488 + for i in "$source"/*; 489 + do 490 + mv "$i" "$target"; 491 + done ); 492 + rmdir "$source"; 493 + ln -s "$target" "$source" 494 + } 495 + _moveToShare () 496 + { 497 + 498 + if [ -n "$__structuredAttrs" ]; then 499 + if [ -z "${forceShare-}" ]; then 500 + forceShare=(man doc info); 501 + fi; 502 + else 503 + forceShare=(${forceShare:-man doc info}); 504 + fi; 505 + if [[ -z "$out" ]]; then 506 + return; 507 + fi; 508 + for d in "${forceShare[@]}"; 509 + do 510 + if [ -d "$out/$d" ]; then 511 + if [ -d "$out/share/$d" ]; then 512 + echo "both $d/ and share/$d/ exist!"; 513 + else 514 + echo "moving $out/$d to $out/share/$d"; 515 + mkdir -p $out/share; 516 + mv $out/$d $out/share/; 517 + fi; 518 + fi; 519 + done 520 + } 521 + _multioutConfig () 522 + { 523 + 524 + if [ "$(getAllOutputNames)" = "out" ] || [ -z "${setOutputFlags-1}" ]; then 525 + return; 526 + fi; 527 + if [ -z "${shareDocName:-}" ]; then 528 + local confScript="${configureScript:-}"; 529 + if [ -z "$confScript" ] && [ -x ./configure ]; then 530 + confScript=./configure; 531 + fi; 532 + if [ -f "$confScript" ]; then 533 + local shareDocName="$(sed -n "s/^PACKAGE_TARNAME='\(.*\)'$/\1/p" < "$confScript")"; 534 + fi; 535 + if [ -z "$shareDocName" ] || echo "$shareDocName" | grep -q '[^a-zA-Z0-9_-]'; then 536 + shareDocName="$(echo "$name" | sed 's/-[^a-zA-Z].*//')"; 537 + fi; 538 + fi; 539 + 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; 540 + prependToVar installFlags pkgconfigdir="${!outputDev}"/lib/pkgconfig m4datadir="${!outputDev}"/share/aclocal aclocaldir="${!outputDev}"/share/aclocal 541 + } 542 + _multioutDevs () 543 + { 544 + 545 + if [ "$(getAllOutputNames)" = "out" ] || [ -z "${moveToDev-1}" ]; then 546 + return; 547 + fi; 548 + moveToOutput include "${!outputInclude}"; 549 + moveToOutput lib/pkgconfig "${!outputDev}"; 550 + moveToOutput share/pkgconfig "${!outputDev}"; 551 + moveToOutput lib/cmake "${!outputDev}"; 552 + moveToOutput share/aclocal "${!outputDev}"; 553 + for f in "${!outputDev}"/{lib,share}/pkgconfig/*.pc; 554 + do 555 + echo "Patching '$f' includedir to output ${!outputInclude}"; 556 + sed -i "/^includedir=/s,=\${prefix},=${!outputInclude}," "$f"; 557 + done 558 + } 559 + _multioutDocs () 560 + { 561 + 562 + local REMOVE=REMOVE; 563 + moveToOutput share/info "${!outputInfo}"; 564 + moveToOutput share/doc "${!outputDoc}"; 565 + moveToOutput share/gtk-doc "${!outputDevdoc}"; 566 + moveToOutput share/devhelp/books "${!outputDevdoc}"; 567 + moveToOutput share/man "${!outputMan}"; 568 + moveToOutput share/man/man3 "${!outputDevman}" 569 + } 570 + _multioutPropagateDev () 571 + { 572 + 573 + if [ "$(getAllOutputNames)" = "out" ]; then 574 + return; 575 + fi; 576 + local outputFirst; 577 + for outputFirst in $(getAllOutputNames); 578 + do 579 + break; 580 + done; 581 + local propagaterOutput="$outputDev"; 582 + if [ -z "$propagaterOutput" ]; then 583 + propagaterOutput="$outputFirst"; 584 + fi; 585 + if [ -z "${propagatedBuildOutputs+1}" ]; then 586 + local po_dirty="$outputBin $outputInclude $outputLib"; 587 + set +o pipefail; 588 + propagatedBuildOutputs=`echo "$po_dirty" | tr -s ' ' '\n' | grep -v -F "$propagaterOutput" | sort -u | tr '\n' ' ' `; 589 + set -o pipefail; 590 + fi; 591 + if [ -z "$propagatedBuildOutputs" ]; then 592 + return; 593 + fi; 594 + mkdir -p "${!propagaterOutput}"/nix-support; 595 + for output in $propagatedBuildOutputs; 596 + do 597 + echo -n " ${!output}" >> "${!propagaterOutput}"/nix-support/propagated-build-inputs; 598 + done 599 + } 600 + _nixLogWithLevel () 601 + { 602 + 603 + [[ -z ${NIX_LOG_FD-} || ${NIX_DEBUG:-0} -lt ${1:?} ]] && return 0; 604 + local logLevel; 605 + case "${1:?}" in 606 + 0) 607 + logLevel=ERROR 608 + ;; 609 + 1) 610 + logLevel=WARN 611 + ;; 612 + 2) 613 + logLevel=NOTICE 614 + ;; 615 + 3) 616 + logLevel=INFO 617 + ;; 618 + 4) 619 + logLevel=TALKATIVE 620 + ;; 621 + 5) 622 + logLevel=CHATTY 623 + ;; 624 + 6) 625 + logLevel=DEBUG 626 + ;; 627 + 7) 628 + logLevel=VOMIT 629 + ;; 630 + *) 631 + echo "_nixLogWithLevel: called with invalid log level: ${1:?}" >&"$NIX_LOG_FD"; 632 + return 1 633 + ;; 634 + esac; 635 + local callerName="${FUNCNAME[2]}"; 636 + if [[ $callerName == "_callImplicitHook" ]]; then 637 + callerName="${hookName:?}"; 638 + fi; 639 + printf "%s: %s: %s\n" "$logLevel" "$callerName" "${2:?}" >&"$NIX_LOG_FD" 640 + } 641 + _overrideFirst () 642 + { 643 + 644 + if [ -z "${!1-}" ]; then 645 + _assignFirst "$@"; 646 + fi 647 + } 648 + _pruneLibtoolFiles () 649 + { 650 + 651 + if [ "${dontPruneLibtoolFiles-}" ] || [ ! -e "$prefix" ]; then 652 + return; 653 + fi; 654 + find "$prefix" -type f -name '*.la' -exec grep -q '^# Generated by .*libtool' {} \; -exec grep -q "^old_library=''" {} \; -exec sed -i {} -e "/^dependency_libs='[^']/ c dependency_libs='' #pruned" \; 655 + } 656 + _updateSourceDateEpochFromSourceRoot () 657 + { 658 + 659 + if [ -n "$sourceRoot" ]; then 660 + updateSourceDateEpoch "$sourceRoot"; 661 + fi 662 + } 663 + activatePackage () 664 + { 665 + 666 + local pkg="$1"; 667 + local -r hostOffset="$2"; 668 + local -r targetOffset="$3"; 669 + (( hostOffset <= targetOffset )) || exit 1; 670 + if [ -f "$pkg" ]; then 671 + nixTalkativeLog "sourcing setup hook '$pkg'"; 672 + source "$pkg"; 673 + fi; 674 + if [[ -z "${strictDeps-}" || "$hostOffset" -le -1 ]]; then 675 + addToSearchPath _PATH "$pkg/bin"; 676 + fi; 677 + if (( hostOffset <= -1 )); then 678 + addToSearchPath _XDG_DATA_DIRS "$pkg/share"; 679 + fi; 680 + if [[ "$hostOffset" -eq 0 && -d "$pkg/bin" ]]; then 681 + addToSearchPath _HOST_PATH "$pkg/bin"; 682 + fi; 683 + if [[ -f "$pkg/nix-support/setup-hook" ]]; then 684 + nixTalkativeLog "sourcing setup hook '$pkg/nix-support/setup-hook'"; 685 + source "$pkg/nix-support/setup-hook"; 686 + fi 687 + } 688 + addEnvHooks () 689 + { 690 + 691 + local depHostOffset="$1"; 692 + shift; 693 + local pkgHookVarsSlice="${pkgHookVarVars[$depHostOffset + 1]}[@]"; 694 + local pkgHookVar; 695 + for pkgHookVar in "${!pkgHookVarsSlice}"; 696 + do 697 + eval "${pkgHookVar}s"'+=("$@")'; 698 + done 699 + } 700 + addToSearchPath () 701 + { 702 + 703 + addToSearchPathWithCustomDelimiter ":" "$@" 704 + } 705 + addToSearchPathWithCustomDelimiter () 706 + { 707 + 708 + local delimiter="$1"; 709 + local varName="$2"; 710 + local dir="$3"; 711 + if [[ -d "$dir" && "${!varName:+${delimiter}${!varName}${delimiter}}" != *"${delimiter}${dir}${delimiter}"* ]]; then 712 + export "${varName}=${!varName:+${!varName}${delimiter}}${dir}"; 713 + fi 714 + } 715 + appendToVar () 716 + { 717 + 718 + local -n nameref="$1"; 719 + local useArray type; 720 + if [ -n "$__structuredAttrs" ]; then 721 + useArray=true; 722 + else 723 + useArray=false; 724 + fi; 725 + if type=$(declare -p "$1" 2> /dev/null); then 726 + case "${type#* }" in 727 + -A*) 728 + echo "appendToVar(): ERROR: trying to use appendToVar on an associative array, use variable+=([\"X\"]=\"Y\") instead." 1>&2; 729 + return 1 730 + ;; 731 + -a*) 732 + useArray=true 733 + ;; 734 + *) 735 + useArray=false 736 + ;; 737 + esac; 738 + fi; 739 + shift; 740 + if $useArray; then 741 + nameref=(${nameref+"${nameref[@]}"} "$@"); 742 + else 743 + nameref="${nameref-} $*"; 744 + fi 745 + } 746 + auditTmpdir () 747 + { 748 + 749 + local dir="$1"; 750 + [ -e "$dir" ] || return 0; 751 + echo "checking for references to $TMPDIR/ in $dir..."; 752 + local i; 753 + find "$dir" -type f -print0 | while IFS= read -r -d '' i; do 754 + if [[ "$i" =~ .build-id ]]; then 755 + continue; 756 + fi; 757 + if isELF "$i"; then 758 + if { 759 + printf :; 760 + patchelf --print-rpath "$i" 761 + } | grep -q -F ":$TMPDIR/"; then 762 + echo "RPATH of binary $i contains a forbidden reference to $TMPDIR/"; 763 + exit 1; 764 + fi; 765 + fi; 766 + if isScript "$i"; then 767 + if [ -e "$(dirname "$i")/.$(basename "$i")-wrapped" ]; then 768 + if grep -q -F "$TMPDIR/" "$i"; then 769 + echo "wrapper script $i contains a forbidden reference to $TMPDIR/"; 770 + exit 1; 771 + fi; 772 + fi; 773 + fi; 774 + done 775 + } 776 + bintoolsWrapper_addLDVars () 777 + { 778 + 779 + local role_post; 780 + getHostRoleEnvHook; 781 + if [[ -d "$1/lib64" && ! -L "$1/lib64" ]]; then 782 + export NIX_LDFLAGS${role_post}+=" -L$1/lib64"; 783 + fi; 784 + if [[ -d "$1/lib" ]]; then 785 + local -a glob=($1/lib/lib*); 786 + if [ "${#glob[*]}" -gt 0 ]; then 787 + export NIX_LDFLAGS${role_post}+=" -L$1/lib"; 788 + fi; 789 + fi 790 + } 791 + buildPhase () 792 + { 793 + 794 + runHook preBuild; 795 + if [[ -z "${makeFlags-}" && -z "${makefile:-}" && ! ( -e Makefile || -e makefile || -e GNUmakefile ) ]]; then 796 + echo "no Makefile or custom buildPhase, doing nothing"; 797 + else 798 + foundMakefile=1; 799 + local flagsArray=(${enableParallelBuilding:+-j${NIX_BUILD_CORES}} SHELL="$SHELL"); 800 + concatTo flagsArray makeFlags makeFlagsArray buildFlags buildFlagsArray; 801 + echoCmd 'build flags' "${flagsArray[@]}"; 802 + make ${makefile:+-f $makefile} "${flagsArray[@]}"; 803 + unset flagsArray; 804 + fi; 805 + runHook postBuild 806 + } 807 + ccWrapper_addCVars () 808 + { 809 + 810 + local role_post; 811 + getHostRoleEnvHook; 812 + if [ -d "$1/include" ]; then 813 + export NIX_CFLAGS_COMPILE${role_post}+=" -isystem $1/include"; 814 + fi; 815 + if [ -d "$1/Library/Frameworks" ]; then 816 + export NIX_CFLAGS_COMPILE${role_post}+=" -iframework $1/Library/Frameworks"; 817 + fi 818 + } 819 + checkPhase () 820 + { 821 + 822 + runHook preCheck; 823 + if [[ -z "${foundMakefile:-}" ]]; then 824 + echo "no Makefile or custom checkPhase, doing nothing"; 825 + runHook postCheck; 826 + return; 827 + fi; 828 + if [[ -z "${checkTarget:-}" ]]; then 829 + if make -n ${makefile:+-f $makefile} check > /dev/null 2>&1; then 830 + checkTarget="check"; 831 + else 832 + if make -n ${makefile:+-f $makefile} test > /dev/null 2>&1; then 833 + checkTarget="test"; 834 + fi; 835 + fi; 836 + fi; 837 + if [[ -z "${checkTarget:-}" ]]; then 838 + echo "no check/test target in ${makefile:-Makefile}, doing nothing"; 839 + else 840 + local flagsArray=(${enableParallelChecking:+-j${NIX_BUILD_CORES}} SHELL="$SHELL"); 841 + concatTo flagsArray makeFlags makeFlagsArray checkFlags=VERBOSE=y checkFlagsArray checkTarget; 842 + echoCmd 'check flags' "${flagsArray[@]}"; 843 + make ${makefile:+-f $makefile} "${flagsArray[@]}"; 844 + unset flagsArray; 845 + fi; 846 + runHook postCheck 847 + } 848 + compressManPages () 849 + { 850 + 851 + local dir="$1"; 852 + if [ -L "$dir"/share ] || [ -L "$dir"/share/man ] || [ ! -d "$dir/share/man" ]; then 853 + return; 854 + fi; 855 + echo "gzipping man pages under $dir/share/man/"; 856 + find "$dir"/share/man/ -type f -a '!' -regex '.*\.\(bz2\|gz\|xz\)$' -print0 | while IFS= read -r -d '' f; do 857 + if gzip -c -n "$f" > "$f".gz; then 858 + rm "$f"; 859 + else 860 + rm "$f".gz; 861 + fi; 862 + done; 863 + find "$dir"/share/man/ -type l -a '!' -regex '.*\.\(bz2\|gz\|xz\)$' -print0 | sort -z | while IFS= read -r -d '' f; do 864 + local target; 865 + target="$(readlink -f "$f")"; 866 + if [ -f "$target".gz ]; then 867 + ln -sf "$target".gz "$f".gz && rm "$f"; 868 + fi; 869 + done 870 + } 871 + concatStringsSep () 872 + { 873 + 874 + local sep="$1"; 875 + local name="$2"; 876 + local type oldifs; 877 + if type=$(declare -p "$name" 2> /dev/null); then 878 + local -n nameref="$name"; 879 + case "${type#* }" in 880 + -A*) 881 + echo "concatStringsSep(): ERROR: trying to use concatStringsSep on an associative array." 1>&2; 882 + return 1 883 + ;; 884 + -a*) 885 + local IFS="$(printf '\036')" 886 + ;; 887 + *) 888 + local IFS=" " 889 + ;; 890 + esac; 891 + local ifs_separated="${nameref[*]}"; 892 + echo -n "${ifs_separated//"$IFS"/"$sep"}"; 893 + fi 894 + } 895 + concatTo () 896 + { 897 + 898 + local -; 899 + set -o noglob; 900 + local -n targetref="$1"; 901 + shift; 902 + local arg default name type; 903 + for arg in "$@"; 904 + do 905 + IFS="=" read -r name default <<< "$arg"; 906 + local -n nameref="$name"; 907 + if [[ -z "${nameref[*]}" && -n "$default" ]]; then 908 + targetref+=("$default"); 909 + else 910 + if type=$(declare -p "$name" 2> /dev/null); then 911 + case "${type#* }" in 912 + -A*) 913 + echo "concatTo(): ERROR: trying to use concatTo on an associative array." 1>&2; 914 + return 1 915 + ;; 916 + -a*) 917 + targetref+=("${nameref[@]}") 918 + ;; 919 + *) 920 + if [[ "$name" = *"Array" ]]; then 921 + nixErrorLog "concatTo(): $name is not declared as array, treating as a singleton. This will become an error in future"; 922 + targetref+=(${nameref+"${nameref[@]}"}); 923 + else 924 + targetref+=(${nameref-}); 925 + fi 926 + ;; 927 + esac; 928 + fi; 929 + fi; 930 + done 931 + } 932 + configurePhase () 933 + { 934 + 935 + runHook preConfigure; 936 + : "${configureScript=}"; 937 + if [[ -z "$configureScript" && -x ./configure ]]; then 938 + configureScript=./configure; 939 + fi; 940 + if [ -z "${dontFixLibtool:-}" ]; then 941 + export lt_cv_deplibs_check_method="${lt_cv_deplibs_check_method-pass_all}"; 942 + local i; 943 + find . -iname "ltmain.sh" -print0 | while IFS='' read -r -d '' i; do 944 + echo "fixing libtool script $i"; 945 + fixLibtool "$i"; 946 + done; 947 + CONFIGURE_MTIME_REFERENCE=$(mktemp configure.mtime.reference.XXXXXX); 948 + find . -executable -type f -name configure -exec grep -l 'GNU Libtool is free software; you can redistribute it and/or modify' {} \; -exec touch -r {} "$CONFIGURE_MTIME_REFERENCE" \; -exec sed -i s_/usr/bin/file_file_g {} \; -exec touch -r "$CONFIGURE_MTIME_REFERENCE" {} \;; 949 + rm -f "$CONFIGURE_MTIME_REFERENCE"; 950 + fi; 951 + if [[ -z "${dontAddPrefix:-}" && -n "$prefix" ]]; then 952 + prependToVar configureFlags "${prefixKey:---prefix=}$prefix"; 953 + fi; 954 + if [[ -f "$configureScript" ]]; then 955 + if [ -z "${dontAddDisableDepTrack:-}" ]; then 956 + if grep -q dependency-tracking "$configureScript"; then 957 + prependToVar configureFlags --disable-dependency-tracking; 958 + fi; 959 + fi; 960 + if [ -z "${dontDisableStatic:-}" ]; then 961 + if grep -q enable-static "$configureScript"; then 962 + prependToVar configureFlags --disable-static; 963 + fi; 964 + fi; 965 + if [ -z "${dontPatchShebangsInConfigure:-}" ]; then 966 + patchShebangs --build "$configureScript"; 967 + fi; 968 + fi; 969 + if [ -n "$configureScript" ]; then 970 + local -a flagsArray; 971 + concatTo flagsArray configureFlags configureFlagsArray; 972 + echoCmd 'configure flags' "${flagsArray[@]}"; 973 + $configureScript "${flagsArray[@]}"; 974 + unset flagsArray; 975 + else 976 + echo "no configure script, doing nothing"; 977 + fi; 978 + runHook postConfigure 979 + } 980 + consumeEntire () 981 + { 982 + 983 + if IFS='' read -r -d '' "$1"; then 984 + echo "consumeEntire(): ERROR: Input null bytes, won't process" 1>&2; 985 + return 1; 986 + fi 987 + } 988 + distPhase () 989 + { 990 + 991 + runHook preDist; 992 + local flagsArray=(); 993 + concatTo flagsArray distFlags distFlagsArray distTarget=dist; 994 + echo 'dist flags: %q' "${flagsArray[@]}"; 995 + make ${makefile:+-f $makefile} "${flagsArray[@]}"; 996 + if [ "${dontCopyDist:-0}" != 1 ]; then 997 + mkdir -p "$out/tarballs"; 998 + cp -pvd ${tarballs[*]:-*.tar.gz} "$out/tarballs"; 999 + fi; 1000 + runHook postDist 1001 + } 1002 + dumpVars () 1003 + { 1004 + 1005 + if [ "${noDumpEnvVars:-0}" != 1 ]; then 1006 + { 1007 + install -m 0600 /dev/null "$NIX_BUILD_TOP/env-vars" && export 2> /dev/null >| "$NIX_BUILD_TOP/env-vars" 1008 + } || true; 1009 + fi 1010 + } 1011 + echoCmd () 1012 + { 1013 + 1014 + printf "%s:" "$1"; 1015 + shift; 1016 + printf ' %q' "$@"; 1017 + echo 1018 + } 1019 + exitHandler () 1020 + { 1021 + 1022 + exitCode="$?"; 1023 + set +e; 1024 + if [ -n "${showBuildStats:-}" ]; then 1025 + read -r -d '' -a buildTimes < <(times); 1026 + echo "build times:"; 1027 + echo "user time for the shell ${buildTimes[0]}"; 1028 + echo "system time for the shell ${buildTimes[1]}"; 1029 + echo "user time for all child processes ${buildTimes[2]}"; 1030 + echo "system time for all child processes ${buildTimes[3]}"; 1031 + fi; 1032 + if (( "$exitCode" != 0 )); then 1033 + runHook failureHook; 1034 + if [ -n "${succeedOnFailure:-}" ]; then 1035 + echo "build failed with exit code $exitCode (ignored)"; 1036 + mkdir -p "$out/nix-support"; 1037 + printf "%s" "$exitCode" > "$out/nix-support/failed"; 1038 + exit 0; 1039 + fi; 1040 + else 1041 + runHook exitHook; 1042 + fi; 1043 + return "$exitCode" 1044 + } 1045 + findInputs () 1046 + { 1047 + 1048 + local -r pkg="$1"; 1049 + local -r hostOffset="$2"; 1050 + local -r targetOffset="$3"; 1051 + (( hostOffset <= targetOffset )) || exit 1; 1052 + local varVar="${pkgAccumVarVars[hostOffset + 1]}"; 1053 + local varRef="$varVar[$((targetOffset - hostOffset))]"; 1054 + local var="${!varRef}"; 1055 + unset -v varVar varRef; 1056 + local varSlice="$var[*]"; 1057 + case " ${!varSlice-} " in 1058 + *" $pkg "*) 1059 + return 0 1060 + ;; 1061 + esac; 1062 + unset -v varSlice; 1063 + eval "$var"'+=("$pkg")'; 1064 + if ! [ -e "$pkg" ]; then 1065 + echo "build input $pkg does not exist" 1>&2; 1066 + exit 1; 1067 + fi; 1068 + function mapOffset () 1069 + { 1070 + local -r inputOffset="$1"; 1071 + local -n outputOffset="$2"; 1072 + if (( inputOffset <= 0 )); then 1073 + outputOffset=$((inputOffset + hostOffset)); 1074 + else 1075 + outputOffset=$((inputOffset - 1 + targetOffset)); 1076 + fi 1077 + }; 1078 + local relHostOffset; 1079 + for relHostOffset in "${allPlatOffsets[@]}"; 1080 + do 1081 + local files="${propagatedDepFilesVars[relHostOffset + 1]}"; 1082 + local hostOffsetNext; 1083 + mapOffset "$relHostOffset" hostOffsetNext; 1084 + (( -1 <= hostOffsetNext && hostOffsetNext <= 1 )) || continue; 1085 + local relTargetOffset; 1086 + for relTargetOffset in "${allPlatOffsets[@]}"; 1087 + do 1088 + (( "$relHostOffset" <= "$relTargetOffset" )) || continue; 1089 + local fileRef="${files}[$relTargetOffset - $relHostOffset]"; 1090 + local file="${!fileRef}"; 1091 + unset -v fileRef; 1092 + local targetOffsetNext; 1093 + mapOffset "$relTargetOffset" targetOffsetNext; 1094 + (( -1 <= hostOffsetNext && hostOffsetNext <= 1 )) || continue; 1095 + [[ -f "$pkg/nix-support/$file" ]] || continue; 1096 + local pkgNext; 1097 + read -r -d '' pkgNext < "$pkg/nix-support/$file" || true; 1098 + for pkgNext in $pkgNext; 1099 + do 1100 + findInputs "$pkgNext" "$hostOffsetNext" "$targetOffsetNext"; 1101 + done; 1102 + done; 1103 + done 1104 + } 1105 + fixLibtool () 1106 + { 1107 + 1108 + local search_path; 1109 + for flag in $NIX_LDFLAGS; 1110 + do 1111 + case $flag in 1112 + -L*) 1113 + search_path+=" ${flag#-L}" 1114 + ;; 1115 + esac; 1116 + done; 1117 + sed -i "$1" -e "s^eval \(sys_lib_search_path=\).*^\1'${search_path:-}'^" -e 's^eval sys_lib_.+search_path=.*^^' 1118 + } 1119 + fixupPhase () 1120 + { 1121 + 1122 + local output; 1123 + for output in $(getAllOutputNames); 1124 + do 1125 + if [ -e "${!output}" ]; then 1126 + chmod -R u+w,u-s,g-s "${!output}"; 1127 + fi; 1128 + done; 1129 + runHook preFixup; 1130 + local output; 1131 + for output in $(getAllOutputNames); 1132 + do 1133 + prefix="${!output}" runHook fixupOutput; 1134 + done; 1135 + recordPropagatedDependencies; 1136 + if [ -n "${setupHook:-}" ]; then 1137 + mkdir -p "${!outputDev}/nix-support"; 1138 + substituteAll "$setupHook" "${!outputDev}/nix-support/setup-hook"; 1139 + fi; 1140 + if [ -n "${setupHooks:-}" ]; then 1141 + mkdir -p "${!outputDev}/nix-support"; 1142 + local hook; 1143 + for hook in ${setupHooks[@]}; 1144 + do 1145 + local content; 1146 + consumeEntire content < "$hook"; 1147 + substituteAllStream content "file '$hook'" >> "${!outputDev}/nix-support/setup-hook"; 1148 + unset -v content; 1149 + done; 1150 + unset -v hook; 1151 + fi; 1152 + if [ -n "${propagatedUserEnvPkgs:-}" ]; then 1153 + mkdir -p "${!outputBin}/nix-support"; 1154 + printWords "${propagatedUserEnvPkgs[@]}" > "${!outputBin}/nix-support/propagated-user-env-packages"; 1155 + fi; 1156 + runHook postFixup 1157 + } 1158 + genericBuild () 1159 + { 1160 + 1161 + export GZIP_NO_TIMESTAMPS=1; 1162 + if [ -f "${buildCommandPath:-}" ]; then 1163 + source "$buildCommandPath"; 1164 + return; 1165 + fi; 1166 + if [ -n "${buildCommand:-}" ]; then 1167 + eval "$buildCommand"; 1168 + return; 1169 + fi; 1170 + if [ -z "${phases[*]:-}" ]; then 1171 + phases="${prePhases[*]:-} unpackPhase patchPhase ${preConfigurePhases[*]:-} configurePhase ${preBuildPhases[*]:-} buildPhase checkPhase ${preInstallPhases[*]:-} installPhase ${preFixupPhases[*]:-} fixupPhase installCheckPhase ${preDistPhases[*]:-} distPhase ${postPhases[*]:-}"; 1172 + fi; 1173 + for curPhase in ${phases[*]}; 1174 + do 1175 + runPhase "$curPhase"; 1176 + done 1177 + } 1178 + getAllOutputNames () 1179 + { 1180 + 1181 + if [ -n "$__structuredAttrs" ]; then 1182 + echo "${!outputs[*]}"; 1183 + else 1184 + echo "$outputs"; 1185 + fi 1186 + } 1187 + getHostRole () 1188 + { 1189 + 1190 + getRole "$hostOffset" 1191 + } 1192 + getHostRoleEnvHook () 1193 + { 1194 + 1195 + getRole "$depHostOffset" 1196 + } 1197 + getRole () 1198 + { 1199 + 1200 + case $1 in 1201 + -1) 1202 + role_post='_FOR_BUILD' 1203 + ;; 1204 + 0) 1205 + role_post='' 1206 + ;; 1207 + 1) 1208 + role_post='_FOR_TARGET' 1209 + ;; 1210 + *) 1211 + echo "binutils-wrapper-2.43.1: used as improper sort of dependency" 1>&2; 1212 + return 1 1213 + ;; 1214 + esac 1215 + } 1216 + getTargetRole () 1217 + { 1218 + 1219 + getRole "$targetOffset" 1220 + } 1221 + getTargetRoleEnvHook () 1222 + { 1223 + 1224 + getRole "$depTargetOffset" 1225 + } 1226 + getTargetRoleWrapper () 1227 + { 1228 + 1229 + case $targetOffset in 1230 + -1) 1231 + export NIX_BINTOOLS_WRAPPER_TARGET_BUILD_x86_64_unknown_linux_gnu=1 1232 + ;; 1233 + 0) 1234 + export NIX_BINTOOLS_WRAPPER_TARGET_HOST_x86_64_unknown_linux_gnu=1 1235 + ;; 1236 + 1) 1237 + export NIX_BINTOOLS_WRAPPER_TARGET_TARGET_x86_64_unknown_linux_gnu=1 1238 + ;; 1239 + *) 1240 + echo "binutils-wrapper-2.43.1: used as improper sort of dependency" 1>&2; 1241 + return 1 1242 + ;; 1243 + esac 1244 + } 1245 + installCheckPhase () 1246 + { 1247 + 1248 + runHook preInstallCheck; 1249 + if [[ -z "${foundMakefile:-}" ]]; then 1250 + echo "no Makefile or custom installCheckPhase, doing nothing"; 1251 + else 1252 + if [[ -z "${installCheckTarget:-}" ]] && ! make -n ${makefile:+-f $makefile} "${installCheckTarget:-installcheck}" > /dev/null 2>&1; then 1253 + echo "no installcheck target in ${makefile:-Makefile}, doing nothing"; 1254 + else 1255 + local flagsArray=(${enableParallelChecking:+-j${NIX_BUILD_CORES}} SHELL="$SHELL"); 1256 + concatTo flagsArray makeFlags makeFlagsArray installCheckFlags installCheckFlagsArray installCheckTarget=installcheck; 1257 + echoCmd 'installcheck flags' "${flagsArray[@]}"; 1258 + make ${makefile:+-f $makefile} "${flagsArray[@]}"; 1259 + unset flagsArray; 1260 + fi; 1261 + fi; 1262 + runHook postInstallCheck 1263 + } 1264 + installPhase () 1265 + { 1266 + 1267 + runHook preInstall; 1268 + if [[ -z "${makeFlags-}" && -z "${makefile:-}" && ! ( -e Makefile || -e makefile || -e GNUmakefile ) ]]; then 1269 + echo "no Makefile or custom installPhase, doing nothing"; 1270 + runHook postInstall; 1271 + return; 1272 + else 1273 + foundMakefile=1; 1274 + fi; 1275 + if [ -n "$prefix" ]; then 1276 + mkdir -p "$prefix"; 1277 + fi; 1278 + local flagsArray=(${enableParallelInstalling:+-j${NIX_BUILD_CORES}} SHELL="$SHELL"); 1279 + concatTo flagsArray makeFlags makeFlagsArray installFlags installFlagsArray installTargets=install; 1280 + echoCmd 'install flags' "${flagsArray[@]}"; 1281 + make ${makefile:+-f $makefile} "${flagsArray[@]}"; 1282 + unset flagsArray; 1283 + runHook postInstall 1284 + } 1285 + isELF () 1286 + { 1287 + 1288 + local fn="$1"; 1289 + local fd; 1290 + local magic; 1291 + exec {fd}< "$fn"; 1292 + read -r -n 4 -u "$fd" magic; 1293 + exec {fd}>&-; 1294 + if [ "$magic" = 'ELF' ]; then 1295 + return 0; 1296 + else 1297 + return 1; 1298 + fi 1299 + } 1300 + isMachO () 1301 + { 1302 + 1303 + local fn="$1"; 1304 + local fd; 1305 + local magic; 1306 + exec {fd}< "$fn"; 1307 + read -r -n 4 -u "$fd" magic; 1308 + exec {fd}>&-; 1309 + if [[ "$magic" = $(echo -ne "\xfe\xed\xfa\xcf") || "$magic" = $(echo -ne "\xcf\xfa\xed\xfe") ]]; then 1310 + return 0; 1311 + else 1312 + if [[ "$magic" = $(echo -ne "\xfe\xed\xfa\xce") || "$magic" = $(echo -ne "\xce\xfa\xed\xfe") ]]; then 1313 + return 0; 1314 + else 1315 + if [[ "$magic" = $(echo -ne "\xca\xfe\xba\xbe") || "$magic" = $(echo -ne "\xbe\xba\xfe\xca") ]]; then 1316 + return 0; 1317 + else 1318 + return 1; 1319 + fi; 1320 + fi; 1321 + fi 1322 + } 1323 + isScript () 1324 + { 1325 + 1326 + local fn="$1"; 1327 + local fd; 1328 + local magic; 1329 + exec {fd}< "$fn"; 1330 + read -r -n 2 -u "$fd" magic; 1331 + exec {fd}>&-; 1332 + if [[ "$magic" =~ \#! ]]; then 1333 + return 0; 1334 + else 1335 + return 1; 1336 + fi 1337 + } 1338 + mapOffset () 1339 + { 1340 + 1341 + local -r inputOffset="$1"; 1342 + local -n outputOffset="$2"; 1343 + if (( inputOffset <= 0 )); then 1344 + outputOffset=$((inputOffset + hostOffset)); 1345 + else 1346 + outputOffset=$((inputOffset - 1 + targetOffset)); 1347 + fi 1348 + } 1349 + moveToOutput () 1350 + { 1351 + 1352 + local patt="$1"; 1353 + local dstOut="$2"; 1354 + local output; 1355 + for output in $(getAllOutputNames); 1356 + do 1357 + if [ "${!output}" = "$dstOut" ]; then 1358 + continue; 1359 + fi; 1360 + local srcPath; 1361 + for srcPath in "${!output}"/$patt; 1362 + do 1363 + if [ ! -e "$srcPath" ] && [ ! -L "$srcPath" ]; then 1364 + continue; 1365 + fi; 1366 + if [ "$dstOut" = REMOVE ]; then 1367 + echo "Removing $srcPath"; 1368 + rm -r "$srcPath"; 1369 + else 1370 + local dstPath="$dstOut${srcPath#${!output}}"; 1371 + echo "Moving $srcPath to $dstPath"; 1372 + if [ -d "$dstPath" ] && [ -d "$srcPath" ]; then 1373 + rmdir "$srcPath" --ignore-fail-on-non-empty; 1374 + if [ -d "$srcPath" ]; then 1375 + mv -t "$dstPath" "$srcPath"/*; 1376 + rmdir "$srcPath"; 1377 + fi; 1378 + else 1379 + mkdir -p "$(readlink -m "$dstPath/..")"; 1380 + mv "$srcPath" "$dstPath"; 1381 + fi; 1382 + fi; 1383 + local srcParent="$(readlink -m "$srcPath/..")"; 1384 + if [ -n "$(find "$srcParent" -maxdepth 0 -type d -empty 2> /dev/null)" ]; then 1385 + echo "Removing empty $srcParent/ and (possibly) its parents"; 1386 + rmdir -p --ignore-fail-on-non-empty "$srcParent" 2> /dev/null || true; 1387 + fi; 1388 + done; 1389 + done 1390 + } 1391 + nixChattyLog () 1392 + { 1393 + 1394 + _nixLogWithLevel 5 "$*" 1395 + } 1396 + nixDebugLog () 1397 + { 1398 + 1399 + _nixLogWithLevel 6 "$*" 1400 + } 1401 + nixErrorLog () 1402 + { 1403 + 1404 + _nixLogWithLevel 0 "$*" 1405 + } 1406 + nixInfoLog () 1407 + { 1408 + 1409 + _nixLogWithLevel 3 "$*" 1410 + } 1411 + nixLog () 1412 + { 1413 + 1414 + [[ -z ${NIX_LOG_FD-} ]] && return 0; 1415 + local callerName="${FUNCNAME[1]}"; 1416 + if [[ $callerName == "_callImplicitHook" ]]; then 1417 + callerName="${hookName:?}"; 1418 + fi; 1419 + printf "%s: %s\n" "$callerName" "$*" >&"$NIX_LOG_FD" 1420 + } 1421 + nixNoticeLog () 1422 + { 1423 + 1424 + _nixLogWithLevel 2 "$*" 1425 + } 1426 + nixTalkativeLog () 1427 + { 1428 + 1429 + _nixLogWithLevel 4 "$*" 1430 + } 1431 + nixVomitLog () 1432 + { 1433 + 1434 + _nixLogWithLevel 7 "$*" 1435 + } 1436 + nixWarnLog () 1437 + { 1438 + 1439 + _nixLogWithLevel 1 "$*" 1440 + } 1441 + noBrokenSymlinks () 1442 + { 1443 + 1444 + local -r output="${1:?}"; 1445 + local path; 1446 + local pathParent; 1447 + local symlinkTarget; 1448 + local -i numDanglingSymlinks=0; 1449 + local -i numReflexiveSymlinks=0; 1450 + local -i numUnreadableSymlinks=0; 1451 + if [[ ! -e $output ]]; then 1452 + nixWarnLog "skipping non-existent output $output"; 1453 + return 0; 1454 + fi; 1455 + nixInfoLog "running on $output"; 1456 + while IFS= read -r -d '' path; do 1457 + pathParent="$(dirname "$path")"; 1458 + if ! symlinkTarget="$(readlink "$path")"; then 1459 + nixErrorLog "the symlink $path is unreadable"; 1460 + numUnreadableSymlinks+=1; 1461 + continue; 1462 + fi; 1463 + if [[ $symlinkTarget == /* ]]; then 1464 + nixInfoLog "symlink $path points to absolute target $symlinkTarget"; 1465 + else 1466 + nixInfoLog "symlink $path points to relative target $symlinkTarget"; 1467 + symlinkTarget="$(realpath --no-symlinks --canonicalize-missing "$pathParent/$symlinkTarget")"; 1468 + fi; 1469 + if [[ $symlinkTarget != "$NIX_STORE"/* ]]; then 1470 + nixInfoLog "symlink $path points outside the Nix store; ignoring"; 1471 + continue; 1472 + fi; 1473 + if [[ $path == "$symlinkTarget" ]]; then 1474 + nixErrorLog "the symlink $path is reflexive"; 1475 + numReflexiveSymlinks+=1; 1476 + else 1477 + if [[ ! -e $symlinkTarget ]]; then 1478 + nixErrorLog "the symlink $path points to a missing target: $symlinkTarget"; 1479 + numDanglingSymlinks+=1; 1480 + else 1481 + nixDebugLog "the symlink $path is irreflexive and points to a target which exists"; 1482 + fi; 1483 + fi; 1484 + done < <(find "$output" -type l -print0); 1485 + if ((numDanglingSymlinks > 0 || numReflexiveSymlinks > 0 || numUnreadableSymlinks > 0)); then 1486 + nixErrorLog "found $numDanglingSymlinks dangling symlinks, $numReflexiveSymlinks reflexive symlinks and $numUnreadableSymlinks unreadable symlinks"; 1487 + exit 1; 1488 + fi; 1489 + return 0 1490 + } 1491 + noBrokenSymlinksInAllOutputs () 1492 + { 1493 + 1494 + if [[ -z ${dontCheckForBrokenSymlinks-} ]]; then 1495 + for output in $(getAllOutputNames); 1496 + do 1497 + noBrokenSymlinks "${!output}"; 1498 + done; 1499 + fi 1500 + } 1501 + patchELF () 1502 + { 1503 + 1504 + local dir="$1"; 1505 + [ -e "$dir" ] || return 0; 1506 + echo "shrinking RPATHs of ELF executables and libraries in $dir"; 1507 + local i; 1508 + while IFS= read -r -d '' i; do 1509 + if [[ "$i" =~ .build-id ]]; then 1510 + continue; 1511 + fi; 1512 + if ! isELF "$i"; then 1513 + continue; 1514 + fi; 1515 + echo "shrinking $i"; 1516 + patchelf --shrink-rpath "$i" || true; 1517 + done < <(find "$dir" -type f -print0) 1518 + } 1519 + patchPhase () 1520 + { 1521 + 1522 + runHook prePatch; 1523 + local -a patchesArray; 1524 + concatTo patchesArray patches; 1525 + for i in "${patchesArray[@]}"; 1526 + do 1527 + echo "applying patch $i"; 1528 + local uncompress=cat; 1529 + case "$i" in 1530 + *.gz) 1531 + uncompress="gzip -d" 1532 + ;; 1533 + *.bz2) 1534 + uncompress="bzip2 -d" 1535 + ;; 1536 + *.xz) 1537 + uncompress="xz -d" 1538 + ;; 1539 + *.lzma) 1540 + uncompress="lzma -d" 1541 + ;; 1542 + esac; 1543 + local -a flagsArray; 1544 + concatTo flagsArray patchFlags=-p1; 1545 + $uncompress < "$i" 2>&1 | patch "${flagsArray[@]}"; 1546 + done; 1547 + runHook postPatch 1548 + } 1549 + patchShebangs () 1550 + { 1551 + 1552 + local pathName; 1553 + local update=false; 1554 + while [[ $# -gt 0 ]]; do 1555 + case "$1" in 1556 + --host) 1557 + pathName=HOST_PATH; 1558 + shift 1559 + ;; 1560 + --build) 1561 + pathName=PATH; 1562 + shift 1563 + ;; 1564 + --update) 1565 + update=true; 1566 + shift 1567 + ;; 1568 + --) 1569 + shift; 1570 + break 1571 + ;; 1572 + -* | --*) 1573 + echo "Unknown option $1 supplied to patchShebangs" 1>&2; 1574 + return 1 1575 + ;; 1576 + *) 1577 + break 1578 + ;; 1579 + esac; 1580 + done; 1581 + echo "patching script interpreter paths in $@"; 1582 + local f; 1583 + local oldPath; 1584 + local newPath; 1585 + local arg0; 1586 + local args; 1587 + local oldInterpreterLine; 1588 + local newInterpreterLine; 1589 + if [[ $# -eq 0 ]]; then 1590 + echo "No arguments supplied to patchShebangs" 1>&2; 1591 + return 0; 1592 + fi; 1593 + local f; 1594 + while IFS= read -r -d '' f; do 1595 + isScript "$f" || continue; 1596 + read -r oldInterpreterLine < "$f" || [ "$oldInterpreterLine" ]; 1597 + read -r oldPath arg0 args <<< "${oldInterpreterLine:2}"; 1598 + if [[ -z "${pathName:-}" ]]; then 1599 + if [[ -n $strictDeps && $f == "$NIX_STORE"* ]]; then 1600 + pathName=HOST_PATH; 1601 + else 1602 + pathName=PATH; 1603 + fi; 1604 + fi; 1605 + if [[ "$oldPath" == *"/bin/env" ]]; then 1606 + if [[ $arg0 == "-S" ]]; then 1607 + arg0=${args%% *}; 1608 + [[ "$args" == *" "* ]] && args=${args#* } || args=; 1609 + newPath="$(PATH="${!pathName}" type -P "env" || true)"; 1610 + args="-S $(PATH="${!pathName}" type -P "$arg0" || true) $args"; 1611 + else 1612 + if [[ $arg0 == "-"* || $arg0 == *"="* ]]; then 1613 + echo "$f: unsupported interpreter directive \"$oldInterpreterLine\" (set dontPatchShebangs=1 and handle shebang patching yourself)" 1>&2; 1614 + exit 1; 1615 + else 1616 + newPath="$(PATH="${!pathName}" type -P "$arg0" || true)"; 1617 + fi; 1618 + fi; 1619 + else 1620 + if [[ -z $oldPath ]]; then 1621 + oldPath="/bin/sh"; 1622 + fi; 1623 + newPath="$(PATH="${!pathName}" type -P "$(basename "$oldPath")" || true)"; 1624 + args="$arg0 $args"; 1625 + fi; 1626 + newInterpreterLine="$newPath $args"; 1627 + newInterpreterLine=${newInterpreterLine%${newInterpreterLine##*[![:space:]]}}; 1628 + if [[ -n "$oldPath" && ( "$update" == true || "${oldPath:0:${#NIX_STORE}}" != "$NIX_STORE" ) ]]; then 1629 + if [[ -n "$newPath" && "$newPath" != "$oldPath" ]]; then 1630 + echo "$f: interpreter directive changed from \"$oldInterpreterLine\" to \"$newInterpreterLine\""; 1631 + escapedInterpreterLine=${newInterpreterLine//\\/\\\\}; 1632 + timestamp=$(stat --printf "%y" "$f"); 1633 + sed -i -e "1 s|.*|#\!$escapedInterpreterLine|" "$f"; 1634 + touch --date "$timestamp" "$f"; 1635 + fi; 1636 + fi; 1637 + done < <(find "$@" -type f -perm -0100 -print0) 1638 + } 1639 + patchShebangsAuto () 1640 + { 1641 + 1642 + if [[ -z "${dontPatchShebangs-}" && -e "$prefix" ]]; then 1643 + if [[ "$output" != out && "$output" = "$outputDev" ]]; then 1644 + patchShebangs --build "$prefix"; 1645 + else 1646 + patchShebangs --host "$prefix"; 1647 + fi; 1648 + fi 1649 + } 1650 + prependToVar () 1651 + { 1652 + 1653 + local -n nameref="$1"; 1654 + local useArray type; 1655 + if [ -n "$__structuredAttrs" ]; then 1656 + useArray=true; 1657 + else 1658 + useArray=false; 1659 + fi; 1660 + if type=$(declare -p "$1" 2> /dev/null); then 1661 + case "${type#* }" in 1662 + -A*) 1663 + echo "prependToVar(): ERROR: trying to use prependToVar on an associative array." 1>&2; 1664 + return 1 1665 + ;; 1666 + -a*) 1667 + useArray=true 1668 + ;; 1669 + *) 1670 + useArray=false 1671 + ;; 1672 + esac; 1673 + fi; 1674 + shift; 1675 + if $useArray; then 1676 + nameref=("$@" ${nameref+"${nameref[@]}"}); 1677 + else 1678 + nameref="$* ${nameref-}"; 1679 + fi 1680 + } 1681 + printLines () 1682 + { 1683 + 1684 + (( "$#" > 0 )) || return 0; 1685 + printf '%s\n' "$@" 1686 + } 1687 + printWords () 1688 + { 1689 + 1690 + (( "$#" > 0 )) || return 0; 1691 + printf '%s ' "$@" 1692 + } 1693 + recordPropagatedDependencies () 1694 + { 1695 + 1696 + declare -ra flatVars=(depsBuildBuildPropagated propagatedNativeBuildInputs depsBuildTargetPropagated depsHostHostPropagated propagatedBuildInputs depsTargetTargetPropagated); 1697 + declare -ra flatFiles=("${propagatedBuildDepFiles[@]}" "${propagatedHostDepFiles[@]}" "${propagatedTargetDepFiles[@]}"); 1698 + local propagatedInputsIndex; 1699 + for propagatedInputsIndex in "${!flatVars[@]}"; 1700 + do 1701 + local propagatedInputsSlice="${flatVars[$propagatedInputsIndex]}[@]"; 1702 + local propagatedInputsFile="${flatFiles[$propagatedInputsIndex]}"; 1703 + [[ -n "${!propagatedInputsSlice}" ]] || continue; 1704 + mkdir -p "${!outputDev}/nix-support"; 1705 + printWords ${!propagatedInputsSlice} > "${!outputDev}/nix-support/$propagatedInputsFile"; 1706 + done 1707 + } 1708 + runHook () 1709 + { 1710 + 1711 + local hookName="$1"; 1712 + shift; 1713 + local hooksSlice="${hookName%Hook}Hooks[@]"; 1714 + local hook; 1715 + for hook in "_callImplicitHook 0 $hookName" ${!hooksSlice+"${!hooksSlice}"}; 1716 + do 1717 + _logHook "$hookName" "$hook" "$@"; 1718 + _eval "$hook" "$@"; 1719 + done; 1720 + return 0 1721 + } 1722 + runOneHook () 1723 + { 1724 + 1725 + local hookName="$1"; 1726 + shift; 1727 + local hooksSlice="${hookName%Hook}Hooks[@]"; 1728 + local hook ret=1; 1729 + for hook in "_callImplicitHook 1 $hookName" ${!hooksSlice+"${!hooksSlice}"}; 1730 + do 1731 + _logHook "$hookName" "$hook" "$@"; 1732 + if _eval "$hook" "$@"; then 1733 + ret=0; 1734 + break; 1735 + fi; 1736 + done; 1737 + return "$ret" 1738 + } 1739 + runPhase () 1740 + { 1741 + 1742 + local curPhase="$*"; 1743 + if [[ "$curPhase" = unpackPhase && -n "${dontUnpack:-}" ]]; then 1744 + return; 1745 + fi; 1746 + if [[ "$curPhase" = patchPhase && -n "${dontPatch:-}" ]]; then 1747 + return; 1748 + fi; 1749 + if [[ "$curPhase" = configurePhase && -n "${dontConfigure:-}" ]]; then 1750 + return; 1751 + fi; 1752 + if [[ "$curPhase" = buildPhase && -n "${dontBuild:-}" ]]; then 1753 + return; 1754 + fi; 1755 + if [[ "$curPhase" = checkPhase && -z "${doCheck:-}" ]]; then 1756 + return; 1757 + fi; 1758 + if [[ "$curPhase" = installPhase && -n "${dontInstall:-}" ]]; then 1759 + return; 1760 + fi; 1761 + if [[ "$curPhase" = fixupPhase && -n "${dontFixup:-}" ]]; then 1762 + return; 1763 + fi; 1764 + if [[ "$curPhase" = installCheckPhase && -z "${doInstallCheck:-}" ]]; then 1765 + return; 1766 + fi; 1767 + if [[ "$curPhase" = distPhase && -z "${doDist:-}" ]]; then 1768 + return; 1769 + fi; 1770 + showPhaseHeader "$curPhase"; 1771 + dumpVars; 1772 + local startTime endTime; 1773 + startTime=$(date +"%s"); 1774 + eval "${!curPhase:-$curPhase}"; 1775 + endTime=$(date +"%s"); 1776 + showPhaseFooter "$curPhase" "$startTime" "$endTime"; 1777 + if [ "$curPhase" = unpackPhase ]; then 1778 + [ -n "${sourceRoot:-}" ] && chmod +x -- "${sourceRoot}"; 1779 + cd -- "${sourceRoot:-.}"; 1780 + fi 1781 + } 1782 + showPhaseFooter () 1783 + { 1784 + 1785 + local phase="$1"; 1786 + local startTime="$2"; 1787 + local endTime="$3"; 1788 + local delta=$(( endTime - startTime )); 1789 + (( delta < 30 )) && return; 1790 + local H=$((delta/3600)); 1791 + local M=$((delta%3600/60)); 1792 + local S=$((delta%60)); 1793 + echo -n "$phase completed in "; 1794 + (( H > 0 )) && echo -n "$H hours "; 1795 + (( M > 0 )) && echo -n "$M minutes "; 1796 + echo "$S seconds" 1797 + } 1798 + showPhaseHeader () 1799 + { 1800 + 1801 + local phase="$1"; 1802 + echo "Running phase: $phase"; 1803 + if [[ -z ${NIX_LOG_FD-} ]]; then 1804 + return; 1805 + fi; 1806 + printf "@nix { \"action\": \"setPhase\", \"phase\": \"%s\" }\n" "$phase" >&"$NIX_LOG_FD" 1807 + } 1808 + stripDirs () 1809 + { 1810 + 1811 + local cmd="$1"; 1812 + local ranlibCmd="$2"; 1813 + local paths="$3"; 1814 + local stripFlags="$4"; 1815 + local excludeFlags=(); 1816 + local pathsNew=; 1817 + [ -z "$cmd" ] && echo "stripDirs: Strip command is empty" 1>&2 && exit 1; 1818 + [ -z "$ranlibCmd" ] && echo "stripDirs: Ranlib command is empty" 1>&2 && exit 1; 1819 + local pattern; 1820 + if [ -n "${stripExclude:-}" ]; then 1821 + for pattern in "${stripExclude[@]}"; 1822 + do 1823 + excludeFlags+=(-a '!' '(' -name "$pattern" -o -wholename "$prefix/$pattern" ')'); 1824 + done; 1825 + fi; 1826 + local p; 1827 + for p in ${paths}; 1828 + do 1829 + if [ -e "$prefix/$p" ]; then 1830 + pathsNew="${pathsNew} $prefix/$p"; 1831 + fi; 1832 + done; 1833 + paths=${pathsNew}; 1834 + if [ -n "${paths}" ]; then 1835 + echo "stripping (with command $cmd and flags $stripFlags) in $paths"; 1836 + local striperr; 1837 + striperr="$(mktemp --tmpdir="$TMPDIR" 'striperr.XXXXXX')"; 1838 + 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=$?; 1839 + [[ "$exit_code" = 123 || -z "$exit_code" ]] || ( cat "$striperr" 1>&2 && exit 1 ); 1840 + rm "$striperr"; 1841 + find $paths -name '*.a' -type f -exec $ranlibCmd '{}' \; 2> /dev/null; 1842 + fi 1843 + } 1844 + stripHash () 1845 + { 1846 + 1847 + local strippedName casematchOpt=0; 1848 + strippedName="$(basename -- "$1")"; 1849 + shopt -q nocasematch && casematchOpt=1; 1850 + shopt -u nocasematch; 1851 + if [[ "$strippedName" =~ ^[a-z0-9]{32}- ]]; then 1852 + echo "${strippedName:33}"; 1853 + else 1854 + echo "$strippedName"; 1855 + fi; 1856 + if (( casematchOpt )); then 1857 + shopt -s nocasematch; 1858 + fi 1859 + } 1860 + substitute () 1861 + { 1862 + 1863 + local input="$1"; 1864 + local output="$2"; 1865 + shift 2; 1866 + if [ ! -f "$input" ]; then 1867 + echo "substitute(): ERROR: file '$input' does not exist" 1>&2; 1868 + return 1; 1869 + fi; 1870 + local content; 1871 + consumeEntire content < "$input"; 1872 + if [ -e "$output" ]; then 1873 + chmod +w "$output"; 1874 + fi; 1875 + substituteStream content "file '$input'" "$@" > "$output" 1876 + } 1877 + substituteAll () 1878 + { 1879 + 1880 + local input="$1"; 1881 + local output="$2"; 1882 + local -a args=(); 1883 + _allFlags; 1884 + substitute "$input" "$output" "${args[@]}" 1885 + } 1886 + substituteAllInPlace () 1887 + { 1888 + 1889 + local fileName="$1"; 1890 + shift; 1891 + substituteAll "$fileName" "$fileName" "$@" 1892 + } 1893 + substituteAllStream () 1894 + { 1895 + 1896 + local -a args=(); 1897 + _allFlags; 1898 + substituteStream "$1" "$2" "${args[@]}" 1899 + } 1900 + substituteInPlace () 1901 + { 1902 + 1903 + local -a fileNames=(); 1904 + for arg in "$@"; 1905 + do 1906 + if [[ "$arg" = "--"* ]]; then 1907 + break; 1908 + fi; 1909 + fileNames+=("$arg"); 1910 + shift; 1911 + done; 1912 + if ! [[ "${#fileNames[@]}" -gt 0 ]]; then 1913 + echo "substituteInPlace called without any files to operate on (files must come before options!)" 1>&2; 1914 + return 1; 1915 + fi; 1916 + for file in "${fileNames[@]}"; 1917 + do 1918 + substitute "$file" "$file" "$@"; 1919 + done 1920 + } 1921 + substituteStream () 1922 + { 1923 + 1924 + local var=$1; 1925 + local description=$2; 1926 + shift 2; 1927 + while (( "$#" )); do 1928 + local replace_mode="$1"; 1929 + case "$1" in 1930 + --replace) 1931 + if ! "$_substituteStream_has_warned_replace_deprecation"; then 1932 + echo "substituteStream() in derivation $name: WARNING: '--replace' is deprecated, use --replace-{fail,warn,quiet}. ($description)" 1>&2; 1933 + _substituteStream_has_warned_replace_deprecation=true; 1934 + fi; 1935 + replace_mode='--replace-warn' 1936 + ;& 1937 + --replace-quiet | --replace-warn | --replace-fail) 1938 + pattern="$2"; 1939 + replacement="$3"; 1940 + shift 3; 1941 + if ! [[ "${!var}" == *"$pattern"* ]]; then 1942 + if [ "$replace_mode" == --replace-warn ]; then 1943 + printf "substituteStream() in derivation $name: WARNING: pattern %q doesn't match anything in %s\n" "$pattern" "$description" 1>&2; 1944 + else 1945 + if [ "$replace_mode" == --replace-fail ]; then 1946 + printf "substituteStream() in derivation $name: ERROR: pattern %q doesn't match anything in %s\n" "$pattern" "$description" 1>&2; 1947 + return 1; 1948 + fi; 1949 + fi; 1950 + fi; 1951 + eval "$var"'=${'"$var"'//"$pattern"/"$replacement"}' 1952 + ;; 1953 + --subst-var) 1954 + local varName="$2"; 1955 + shift 2; 1956 + if ! [[ "$varName" =~ ^[a-zA-Z_][a-zA-Z0-9_]*$ ]]; then 1957 + echo "substituteStream() in derivation $name: ERROR: substitution variables must be valid Bash names, \"$varName\" isn't." 1>&2; 1958 + return 1; 1959 + fi; 1960 + if [ -z ${!varName+x} ]; then 1961 + echo "substituteStream() in derivation $name: ERROR: variable \$$varName is unset" 1>&2; 1962 + return 1; 1963 + fi; 1964 + pattern="@$varName@"; 1965 + replacement="${!varName}"; 1966 + eval "$var"'=${'"$var"'//"$pattern"/"$replacement"}' 1967 + ;; 1968 + --subst-var-by) 1969 + pattern="@$2@"; 1970 + replacement="$3"; 1971 + eval "$var"'=${'"$var"'//"$pattern"/"$replacement"}'; 1972 + shift 3 1973 + ;; 1974 + *) 1975 + echo "substituteStream() in derivation $name: ERROR: Invalid command line argument: $1" 1>&2; 1976 + return 1 1977 + ;; 1978 + esac; 1979 + done; 1980 + printf "%s" "${!var}" 1981 + } 1982 + unpackFile () 1983 + { 1984 + 1985 + curSrc="$1"; 1986 + echo "unpacking source archive $curSrc"; 1987 + if ! runOneHook unpackCmd "$curSrc"; then 1988 + echo "do not know how to unpack source archive $curSrc"; 1989 + exit 1; 1990 + fi 1991 + } 1992 + unpackPhase () 1993 + { 1994 + 1995 + runHook preUnpack; 1996 + if [ -z "${srcs:-}" ]; then 1997 + if [ -z "${src:-}" ]; then 1998 + echo 'variable $src or $srcs should point to the source'; 1999 + exit 1; 2000 + fi; 2001 + srcs="$src"; 2002 + fi; 2003 + local -a srcsArray; 2004 + concatTo srcsArray srcs; 2005 + local dirsBefore=""; 2006 + for i in *; 2007 + do 2008 + if [ -d "$i" ]; then 2009 + dirsBefore="$dirsBefore $i "; 2010 + fi; 2011 + done; 2012 + for i in "${srcsArray[@]}"; 2013 + do 2014 + unpackFile "$i"; 2015 + done; 2016 + : "${sourceRoot=}"; 2017 + if [ -n "${setSourceRoot:-}" ]; then 2018 + runOneHook setSourceRoot; 2019 + else 2020 + if [ -z "$sourceRoot" ]; then 2021 + for i in *; 2022 + do 2023 + if [ -d "$i" ]; then 2024 + case $dirsBefore in 2025 + *\ $i\ *) 2026 + 2027 + ;; 2028 + *) 2029 + if [ -n "$sourceRoot" ]; then 2030 + echo "unpacker produced multiple directories"; 2031 + exit 1; 2032 + fi; 2033 + sourceRoot="$i" 2034 + ;; 2035 + esac; 2036 + fi; 2037 + done; 2038 + fi; 2039 + fi; 2040 + if [ -z "$sourceRoot" ]; then 2041 + echo "unpacker appears to have produced no directories"; 2042 + exit 1; 2043 + fi; 2044 + echo "source root is $sourceRoot"; 2045 + if [ "${dontMakeSourcesWritable:-0}" != 1 ]; then 2046 + chmod -R u+w -- "$sourceRoot"; 2047 + fi; 2048 + runHook postUnpack 2049 + } 2050 + updateAutotoolsGnuConfigScriptsPhase () 2051 + { 2052 + 2053 + if [ -n "${dontUpdateAutotoolsGnuConfigScripts-}" ]; then 2054 + return; 2055 + fi; 2056 + for script in config.sub config.guess; 2057 + do 2058 + for f in $(find . -type f -name "$script"); 2059 + do 2060 + echo "Updating Autotools / GNU config script to a newer upstream version: $f"; 2061 + cp -f "/nix/store/w0mv8cgqp312dcnwlc6pz9v8nkjgw4lr-gnu-config-2024-01-01/$script" "$f"; 2062 + done; 2063 + done 2064 + } 2065 + updateSourceDateEpoch () 2066 + { 2067 + 2068 + local path="$1"; 2069 + [[ $path == -* ]] && path="./$path"; 2070 + 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)); 2071 + local time="${res[0]//\.[0-9]*/}"; 2072 + local newestFile="${res[1]}"; 2073 + if [ "${time:-0}" -gt "$SOURCE_DATE_EPOCH" ]; then 2074 + echo "setting SOURCE_DATE_EPOCH to timestamp $time of file $newestFile"; 2075 + export SOURCE_DATE_EPOCH="$time"; 2076 + local now="$(date +%s)"; 2077 + if [ "$time" -gt $((now - 60)) ]; then 2078 + echo "warning: file $newestFile may be generated; SOURCE_DATE_EPOCH may be non-deterministic"; 2079 + fi; 2080 + fi 2081 + } 2082 + PATH="$PATH${nix_saved_PATH:+:$nix_saved_PATH}" 2083 + XDG_DATA_DIRS="$XDG_DATA_DIRS${nix_saved_XDG_DATA_DIRS:+:$nix_saved_XDG_DATA_DIRS}" 2084 + export NIX_BUILD_TOP="$(mktemp -d -t nix-shell.XXXXXX)" 2085 + export TMP="$NIX_BUILD_TOP" 2086 + export TMPDIR="$NIX_BUILD_TOP" 2087 + export TEMP="$NIX_BUILD_TOP" 2088 + export TEMPDIR="$NIX_BUILD_TOP" 2089 + eval "${shellHook:-}"
+1
.envrc
··· 1 + use flake
+23
.github/workflows/test.yml
··· 1 + name: test 2 + 3 + on: 4 + push: 5 + branches: 6 + - master 7 + - main 8 + pull_request: 9 + 10 + jobs: 11 + test: 12 + runs-on: ubuntu-latest 13 + steps: 14 + - uses: actions/checkout@v4 15 + - uses: erlef/setup-beam@v1 16 + with: 17 + otp-version: "27.1.2" 18 + gleam-version: "1.9.1" 19 + rebar3-version: "3" 20 + # elixir-version: "1" 21 + - run: gleam deps download 22 + - run: gleam test 23 + - run: gleam format --check src test
+4
.gitignore
··· 1 + *.beam 2 + *.ez 3 + /build 4 + erl_crash.dump
+24
README.md
··· 1 + # flybycord 2 + 3 + [![Package Version](https://img.shields.io/hexpm/v/flybycord)](https://hex.pm/packages/flybycord) 4 + [![Hex Docs](https://img.shields.io/badge/hex-docs-ffaff3)](https://hexdocs.pm/flybycord/) 5 + 6 + ```sh 7 + gleam add flybycord@1 8 + ``` 9 + ```gleam 10 + import flybycord 11 + 12 + pub fn main() { 13 + // TODO: An example of the project in use 14 + } 15 + ``` 16 + 17 + Further documentation can be found at <https://hexdocs.pm/flybycord>. 18 + 19 + ## Development 20 + 21 + ```sh 22 + gleam run # Run the project 23 + gleam test # Run the tests 24 + ```
+26
flake.lock
··· 1 + { 2 + "nodes": { 3 + "nixpkgs": { 4 + "locked": { 5 + "lastModified": 1744232761, 6 + "narHash": "sha256-gbl9hE39nQRpZaLjhWKmEu5ejtQsgI5TWYrIVVJn30U=", 7 + "owner": "NixOS", 8 + "repo": "nixpkgs", 9 + "rev": "f675531bc7e6657c10a18b565cfebd8aa9e24c14", 10 + "type": "github" 11 + }, 12 + "original": { 13 + "id": "nixpkgs", 14 + "ref": "nixos-unstable", 15 + "type": "indirect" 16 + } 17 + }, 18 + "root": { 19 + "inputs": { 20 + "nixpkgs": "nixpkgs" 21 + } 22 + } 23 + }, 24 + "root": "root", 25 + "version": 7 26 + }
+18
flake.nix
··· 1 + { 2 + inputs.nixpkgs.url = "nixpkgs/nixos-unstable"; 3 + outputs = { 4 + self, 5 + nixpkgs, 6 + ... 7 + }: let 8 + pkgs = import nixpkgs {system = "x86_64-linux";}; 9 + in { 10 + devShells."x86_64-linux".default = pkgs.mkShell { 11 + buildInputs = with pkgs; [ 12 + gleam 13 + rebar3 14 + beamPackages.erlang 15 + ]; 16 + }; 17 + }; 18 + }
+20
gleam.toml
··· 1 + name = "flybycord" 2 + version = "1.0.0" 3 + 4 + # Fill out these fields if you intend to generate HTML documentation or publish 5 + # your project to the Hex package manager. 6 + # 7 + # description = "" 8 + # licences = ["Apache-2.0"] 9 + # repository = { type = "github", user = "", repo = "" } 10 + # links = [{ title = "Website", href = "" }] 11 + # 12 + # For a full reference of all the available options, you can have a look at 13 + # https://gleam.run/writing-gleam/gleam-toml/. 14 + 15 + [dependencies] 16 + gleam_stdlib = ">= 0.44.0 and < 2.0.0" 17 + gleam_httpc = ">= 4.1.0 and < 5.0.0" 18 + 19 + [dev-dependencies] 20 + gleeunit = ">= 1.0.0 and < 2.0.0"
+15
manifest.toml
··· 1 + # This file was generated by Gleam 2 + # You typically do not need to edit this file 3 + 4 + packages = [ 5 + { name = "gleam_erlang", version = "0.34.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_erlang", source = "hex", outer_checksum = "0C38F2A128BAA0CEF17C3000BD2097EB80634E239CE31A86400C4416A5D0FDCC" }, 6 + { name = "gleam_http", version = "4.0.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_http", source = "hex", outer_checksum = "0A62451FC85B98062E0907659D92E6A89F5F3C0FBE4AB8046C99936BF6F91DBC" }, 7 + { name = "gleam_httpc", version = "4.1.0", build_tools = ["gleam"], requirements = ["gleam_erlang", "gleam_http", "gleam_stdlib"], otp_app = "gleam_httpc", source = "hex", outer_checksum = "1A38507AF26CACA145248733688703EADCB734EA971D4E34FB97B7613DECF132" }, 8 + { name = "gleam_stdlib", version = "0.59.0", build_tools = ["gleam"], requirements = [], otp_app = "gleam_stdlib", source = "hex", outer_checksum = "F8FEE9B35797301994B81AF75508CF87C328FE1585558B0FFD188DC2B32EAA95" }, 9 + { name = "gleeunit", version = "1.3.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleeunit", source = "hex", outer_checksum = "0E6C83834BA65EDCAAF4FE4FB94AC697D9262D83E6F58A750D63C9F6C8A9D9FF" }, 10 + ] 11 + 12 + [requirements] 13 + gleam_httpc = { version = ">= 4.1.0 and < 5.0.0" } 14 + gleam_stdlib = { version = ">= 0.44.0 and < 2.0.0" } 15 + gleeunit = { version = ">= 1.0.0 and < 2.0.0" }
+5
src/flybycord.gleam
··· 1 + import gleam/io 2 + 3 + pub fn main() { 4 + io.println("Hello from flybycord!") 5 + }
+12
test/flybycord_test.gleam
··· 1 + import gleeunit 2 + import gleeunit/should 3 + 4 + pub fn main() { 5 + gleeunit.main() 6 + } 7 + 8 + // gleeunit test functions end in `_test` 9 + pub fn hello_world_test() { 10 + 1 11 + |> should.equal(1) 12 + }