Skip to content

Instantly share code, notes, and snippets.

@ivan
Created November 18, 2019 11:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ivan/a07096a01b2f05b7d27232ec19477627 to your computer and use it in GitHub Desktop.
Save ivan/a07096a01b2f05b7d27232ec19477627 to your computer and use it in GitHub Desktop.
{ config, lib, pkgs, ... }:
let
machines = import ./machines.nix;
in
{
services.nix-serve = {
enable = true;
port = 5000;
bindAddress = machines.${config.networking.hostName}.wireguard_ip;
secretKeyFile = "/var/secrets/nix/secret_key";
};
nix = {
allowedUsers = [ "nix-serve" ];
extraOptions = ''
secret-key-files = /var/secrets/nix/secret_key
# Keep source tarballs
keep-outputs = true
'';
};
networking.firewall = {
extraCommands =
''
iptables -A nixos-fw -p tcp -i wg0 --dport 5000 -j nixos-fw-accept # nix-serve
'';
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment