wiki/_next/data/Ie9t5zutrXP6Of75Cb5xF/tools.nix.reproducible-executables.json

1 line
2.8 KiB
JSON
Raw Normal View History

2022-07-29 15:41:17 +00:00
{"pageProps":{"metadata":{"date":"2021-07-18 22:16:30 +08:00","date_modified":"2021-07-18 22:16:30 +08:00","language":"en","source":""},"title":"Reproducible executables with Nix","hast":{"type":"root","children":[{"type":"element","tagName":"nav","properties":{"className":"toc"},"children":[{"type":"element","tagName":"ol","properties":{"className":"toc-level toc-level-1"},"children":[]}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"You can create a "},{"type":"element","tagName":"a","properties":{"href":"https://nix.dev/tutorials/ad-hoc-developer-environments#reproducible-executables"},"children":[{"type":"text","value":"reproducible executable"}]},{"type":"text","value":" that only requires Nix.\n"}]},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Here's a sample script that uses multiple dependencies.\n"}]},{"type":"element","tagName":"div","properties":{"className":["special-block","block-tip"]},"children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"If the script interact with the network (e.g., "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"curl"}]},{"type":"text","value":", "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"wget"}]},{"type":"text","value":") and the environment is completely pure, don't forget to install public Certificate Authorities with "},{"type":"element","tagName":"code","properties":{"className":["inline-verbatim"]},"children":[{"type":"text","value":"cacert"}]},{"type":"text","value":".\n"}]}]},{"type":"element","tagName":"pre","properties":{"className":["src-block"]},"children":[{"type":"element","tagName":"code","properties":{"className":["language-bash"]},"children":[{"type":"text","value":"#!/usr/bin/env nix-shell\n#! nix-shell --pure -i bash -p coreutils curl cacert jq fzf findutils\n\n# A quick command line interface for creating a gitignore with the API from https://gitignore.io.\n# This script comes with a simple caching to avoid creating too much requests.\n\nset -eo pipefail\n\nCACHE_FILE=\"${XDG_CACHE_DIR:-$HOME/.cache}/gitignore-io.langs.json\"\n\n# Check if the language list is downloaded for the last hour (3600 seconds).\nif [ ! -e $CACHE_FILE ] || test $(expr $(date \"+%s\") - $(date -r $CACHE_FILE \"+%s\")) -gt 3600\nthen\n ping \"gitignore.io\" --count 4 && curl --silent --location --output $CACHE_FILE \"https://gitignore.io/api/list?format=json\"\nfi\n\nKEYS=$(jq 'keys | .[] | @text' --raw-output $CACHE_FILE | fzf --multi | while read lang; do echo \" .[\\\"$lang\\\"].contents\"; done | paste -s -d ',')\n\njq \"$KEYS\" --raw-output $CACHE_FILE\n"}]}]}]},"backlinks":[{"path":"/tools.nix","title":"Nix package manager"}]},"__N_SSG":true}