This repository has no description
0

Configure Feed

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

tools.bin_shim: init

+50
+24
tools/bin_shim/bin_shim.sh
··· 1 + set -efu 2 + # set -x 3 + FLAKE=${FLAKE:-.} 4 + echo "$FLAKE" 5 + 6 + pkg=$1 7 + shift 8 + 9 + flake=$(nix flake prefetch "$FLAKE" --json 2>/dev/null | jq -r .storePath) 10 + hash=$(echo "$flake" | md5sum | cut -d' ' -f1) 11 + 12 + # Use XDG_RUNTIME_DIR if available, otherwise /tmp 13 + if [ -n "${XDG_RUNTIME_DIR:-}" ] && [ -d "$XDG_RUNTIME_DIR" ]; then 14 + cache_dir="$XDG_RUNTIME_DIR/bin_shim/$hash" 15 + else 16 + cache_dir="/tmp/bin_shim-$(id -u)/$hash" 17 + fi 18 + mkdir -p "$cache_dir" 19 + if ! [ -e "$cache_dir"/"$pkg" ]; then 20 + out=$(nix build "$flake"#"$pkg" --no-link --print-out-paths) 21 + mainProgram=$(nix eval --raw "$flake"#"$pkg".meta.mainProgram) 22 + echo "$out"/bin/"$mainProgram" > "$cache_dir"/"$pkg" 23 + fi 24 + exec "$(cat "$cache_dir"/"$pkg")" "$@"
+26
tools/bin_shim/flake-module.nix
··· 1 + { self, ... }: 2 + { 3 + perSystem = 4 + { pkgs, lib, ... }: 5 + rec { 6 + packages.bin_shim = pkgs.writeShellApplication { 7 + name = "bin_shim"; 8 + runtimeInputs = [ 9 + pkgs.jq 10 + ]; 11 + text = builtins.readFile ./bin_shim.sh; 12 + }; 13 + legacyPackages.bin_shim = 14 + { 15 + pkg_name, 16 + name ? pkg_name, 17 + }: 18 + pkgs.writeScriptBin name '' 19 + #!/bin/sh 20 + set -efu 21 + set -x 22 + 23 + FLAKE=${self} ${lib.getExe packages.bin_shim} ${pkg_name} "$@" 24 + ''; 25 + }; 26 + }