Setup SSH added, hms fixed, removed shared SSH keys

This commit is contained in:
Greg Hellings
2023-03-17 20:08:11 -05:00
parent 36f8b12f31
commit 003cec8db0
10 changed files with 23 additions and 173 deletions
+3
View File
@@ -62,6 +62,9 @@ in rec {
hms = super.callPackage ./hms.nix {
pkgs = self.pkgs;
};
setup-ssh = super.callPackage ./setup-ssh.nix {
pkgs = self.pkgs;
};
kiwix-tools = super.callPackage ./kiwix-tools.nix {};
libkiwix = super.callPackage ./libkiwix.nix {};
zimlib = super.callPackage ./zimlib.nix {};
+3
View File
@@ -7,9 +7,11 @@ if [ "$(uname -s)" == "Darwin" ]; then
# On macOS
src="${HOME}/.config/nix/"
flavor="gui"
arch="${arch}-darwin"
elif [ x"${WSL_DISTRO_NAME}" != "x" ]; then
src=/etc/nixos
flavor="cli"
arch="${arch}-linux"
else
# On Linux systems
if [ -z "${DISPLAY}" ]; then
@@ -18,6 +20,7 @@ else
flavor="gdm"
fi
src=/etc/nixos
arch="${arch}-linux"
fi
# Build and switch
+3
View File
@@ -0,0 +1,3 @@
{ pkgs, ... }:
pkgs.writeShellScriptBin "setup-ssh" (builtins.readFile ./setup-ssh.sh)
+11
View File
@@ -0,0 +1,11 @@
# vim: set ft=bash:
if [ ! -f "${HOME}/.ssh/id_rsa" ]; then
echo "Generating a new key"
ssh-keygen -t rsa -b 8192 -f "${HOME}/.ssh/id_rsa" -N ''
cat "${HOME}/.ssh/id_rsa.pub" >> /etc/nixos/home/ssh/authorized_keys
echo "Authing key to GitHub - may fail"
gh auth refresh -h github.com -s admin:public_key
gh ssh-key add -t ${HOSTNAME}-auto ~/.ssh/id_rsa.pub || true
fi
cp /etc/nixos/home/ssh/authorized_keys "${HOME}/.ssh/authorized_keys"