Giter VIP home page Giter VIP logo

spongix's Introduction

Spongix

A proxy that acts as binary cache for Nix

  • Signs Narinfo in flight with own private key
  • Authenticates with S3 to forward NARs for long-term storage
  • Keeps a local cache on disk for faster responses.
  • Provides a minimal Docker registry

Usage

Start spongix:

nix key generate-secret --key-name foo > skey
nix build
./result/bin/spongix \
  --substituters "https://cache.nixos.org" "https://hydra.iohk.io" \
  --secret-key-files ./skey \
  --trusted-public-keys "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" "hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=" \
  --listen :7745 \
  --dir /tmp/spongix

To add store paths to the cache, you can use nix copy:

nix copy --to 'http://127.0.0.1:7745?compression=none' github:nixos/nix

To use this as your binary cache, specify it as a substituter:

nix build github:nixos/nix \
  --option substituters http://127.0.0.1:7745 \
  --option trusted-public-keys "$(< pkey)"

Signatures are checked against the the trusted-public-keys of your configuration.

Upload after every build

Set a post-build-hook in your nix configuration to a script like this:

#!/bin/sh
set -euf
export IFS=' '
if [[ -n "$OUT_PATHS" ]]; then
  echo "Uploading to cache: $OUT_PATHS"
  exec nix copy --to 'http://127.0.0.1:7745?compression=none' $OUT_PATHS
fi

TODO

  • Write better integration tests (with cicero)
  • Healthchecks
  • A way to horizontally scale (probably by just locking via consul, s3, raft, postgres, rqlite, dqlite, ...)
  • Proper CLI usage
  • Benchmark of desync index vs db lookup performance
  • Additional signing for a set of allowed public keys
  • Disk cache size limits and LRU eviction
  • Forward lookups across multiple upstream caches
  • Identify and solve concurrency issues
  • Prometheus metrics
  • Store narinfo in a database
  • Upload to S3 as well as the local store
  • Verify existing signatures

spongix's People

Contributors

blaggacao avatar manveru avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.