{ sources ? import ../website/npins , system ? builtins.currentSystem , pkgs ? import sources.nixpkgs { inherit system; config = { }; overlays = [ ]; } , lib ? import "${sources.nixpkgs}/lib" }: let # TODO: this is a hard copy of the IP in the config; wire all of it up with NixOps4 ipv4 = "185.206.232.106"; deploy = pkgs.writeShellApplication { name = "deploy-webserver"; text = '' # HACK: decouple system evaluation from shell evaluation # the structured way for using this hack is encoded in https://github.com/fricklerhandwerk/lazy-drv result="$(nix-build ${toString ./.} -A machine --no-out-link --eval-store auto --store ssh-ng://${ipv4})" # shellcheck disable=SC2087 ssh ${ipv4} << EOF nix-env -p /nix/var/nix/profiles/system --set "$result" "$result"/bin/switch-to-configuration switch EOF ''; }; nixos-configuration = config: import "${pkgs.path}/nixos/lib/eval-config.nix" { modules = [ config ]; system = null; }; in rec { nixos = nixos-configuration ./configuration.nix; machine = nixos.config.system.build.toplevel; shell = pkgs.mkShellNoCC { packages = with pkgs; [ deploy ]; env = { # TODO: reusing other pins for now; wire up the whole repo to use the same dependencies NPINS_DIRECTORY = toString ../website/npins; }; }; }