├── README.md └── examples └── binary_cache ├── README.md ├── common.nix ├── ipfs_binary.nix ├── ipfs_binary_cache_network.nix └── ipfs_gateway.nix /README.md: -------------------------------------------------------------------------------- 1 | Notes on Nix + IPFS 2 | =================== 3 | 4 | This repository can be used to gather ideas how to use IPFS/IPLD within 5 | the Nix ecosystem. 6 | 7 | `/examples` contains some example configs and hashes to test against 8 | -------------------------------------------------------------------------------- /examples/binary_cache/README.md: -------------------------------------------------------------------------------- 1 | IPFS Binary Cache 2 | ================= 3 | 4 | [A script](https://github.com/NixIPFS/nixipfs-scripts) publishes currently to 5 | 6 | `/ipns/Qmdjn23LZJAK5qnMVZRy6v5rtRcRuoLz1uNNm2PLf3EkLy` 7 | 8 | which is also linked from (be aware: no DNSSEC) 9 | 10 | `/ipns/nix.ipfs.sourcediver.org` 11 | 12 | If you want to try it out for yourself, simply deploy 13 | the config in this folder using NixOps. 14 | You can then do some `nix-store --realise /nix/store/PATH` 15 | to test. 16 | 17 | Browse through the `.narinfo` files on 18 | 19 | https://ipfs.io/ipns/nix.ipfs.sourcediver.org/binary_cache 20 | 21 | to find out what is currently available. 22 | 23 | You need to deploy from this nixpkgs repo: 24 | 25 | https://github.com/NixIPFS/nixpkgs/tree/ipfs_binary_cache 26 | 27 | This uses this Nix repo: 28 | 29 | https://github.com/NixIPFS/nix/tree/ipfs_binary_cache 30 | -------------------------------------------------------------------------------- /examples/binary_cache/common.nix: -------------------------------------------------------------------------------- 1 | { 2 | system.stateVersion = "16.09"; 3 | deployment.targetEnv = "virtualbox"; 4 | deployment.virtualbox.memorySize = 2048; 5 | deployment.virtualbox.headless = true; 6 | 7 | i18n.defaultLocale = "en_US.UTF-8"; 8 | services.nixosManual.showManual = false; 9 | services.ntp.enable = false; 10 | services.openssh.allowSFTP = false; 11 | services.openssh.passwordAuthentication = false; 12 | 13 | users = { 14 | mutableUsers = false; 15 | users.root.openssh.authorizedKeys.keyFiles = [ ~/.ssh/id_rsa.pub ]; 16 | }; 17 | } 18 | -------------------------------------------------------------------------------- /examples/binary_cache/ipfs_binary.nix: -------------------------------------------------------------------------------- 1 | { config, pkgs, ... }: 2 | { 3 | imports = [ ./common.nix ]; 4 | 5 | nix = { 6 | package = pkgs.nixIPFS; 7 | binaryCaches = [ 8 | "/ipns/nix.ipfs.sourcediver.org/binary_cache?gateway=http://ipfs_gw&use_gateway=0" 9 | ]; 10 | }; 11 | 12 | services.ipfs = { 13 | enable = true; 14 | emptyRepo = true; 15 | }; 16 | } 17 | -------------------------------------------------------------------------------- /examples/binary_cache/ipfs_binary_cache_network.nix: -------------------------------------------------------------------------------- 1 | { 2 | network.description = "Test binary caches stored directly in IPFS"; 3 | bc_user = import ./ipfs_binary.nix; 4 | ipfs_gw = import ./ipfs_gateway.nix; 5 | } 6 | -------------------------------------------------------------------------------- /examples/binary_cache/ipfs_gateway.nix: -------------------------------------------------------------------------------- 1 | { config, pkgs, ... }: 2 | { 3 | imports = [ ./common.nix ]; 4 | 5 | networking.firewall.allowedTCPPorts = [ 80 4001 ]; 6 | services.ipfs = { 7 | enable = true; 8 | emptyRepo = true; 9 | }; 10 | 11 | services.nginx = { 12 | enable = true; 13 | virtualHosts = { 14 | "_" = { 15 | default = true; 16 | locations."/" = { 17 | extraConfig = '' 18 | proxy_pass http://127.0.0.1:8080; 19 | ''; 20 | }; 21 | }; 22 | }; 23 | }; 24 | } 25 | --------------------------------------------------------------------------------