Created
July 16, 2018 05:30
-
-
Save dhess/6bbb00100b0fe9b8e17472c0c62bfb10 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { config, lib, pkgs, ... }: | |
| let | |
| in | |
| { | |
| # Deploy the Hydra's GitHub SSH key, so that it can pull from my | |
| # private repos. | |
| # | |
| # Note that in order to make use of this, we also need to install | |
| # the GitHub host key in the system's known_hosts. | |
| programs.ssh.knownHosts = [ | |
| { | |
| hostNames = [ "github.com" ]; | |
| publicKeyFile = ./github.com.pub; | |
| } | |
| ]; | |
| deployment.keys."hydra-github" = { | |
| text = "your-private-key-here"; | |
| user = "hydra"; | |
| group = "hydra"; | |
| permissions = "0400"; | |
| }; | |
| systemd.services.install-hydra-github-key = rec { | |
| description = "Install the Hydra GitHub key"; | |
| after = [ "hydra-github-key.service" ]; | |
| wants = after; | |
| wantedBy = [ "multi-user.target" ]; | |
| script = '' | |
| mkdir -p ~hydra/.ssh || true | |
| chmod 0700 ~hydra/.ssh | |
| cp -pf /run/keys/hydra-github ~hydra/.ssh/id_ed25519 | |
| chown -R hydra:hydra ~hydra/.ssh | |
| chmod 0400 ~hydra/.ssh/id_ed25519 | |
| ''; | |
| }; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment