grace/dots

dotfiles/nix configs

git clone https://git.gae.moe/grace/dots

Grace Yoderbig changesc1be8e3

main
627 B32 linesraw
1{
2  principals ? (import ../hosts.nix).sshPrincipals or [ ],
3  extraKeys ? [ ],
4}:
5
6{
7  lib,
8  ...
9}:
10
11let
12  host = import ../hosts.nix;
13  authorizedKeys = lib.concatStringsSep "\n" (
14    import ../ssh-keys.nix {
15      inherit host principals extraKeys;
16    }
17  );
18in
19{
20  home.activation.authorizedKeys = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
21          run mkdir -p "$HOME/.ssh"
22          run chmod 700 "$HOME/.ssh"
23
24          if [[ -z "''${DRY_RUN:-}" ]]; then
25            cat > "$HOME/.ssh/authorized_keys" <<'EOF'
26    ${authorizedKeys}
27    EOF
28
29            chmod 600 "$HOME/.ssh/authorized_keys"
30          fi
31  '';
32}