From e20e27bd7a6f331c28f33f25af00fd9e3e120a29 Mon Sep 17 00:00:00 2001 From: moons-14 Date: Thu, 30 Oct 2025 16:43:31 +0900 Subject: [PATCH] git --- flake.nix | 2 ++ modules/core/default.nix | 1 + modules/core/ssh.nix | 16 ++++++++++++++++ modules/home/default.nix | 2 ++ modules/home/ssh.nix | 19 +++++++++++++++++++ profiles/cli-minimal.nix | 2 -- 6 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 modules/core/ssh.nix create mode 100644 modules/home/ssh.nix diff --git a/flake.nix b/flake.nix index 72f7dba..af0613c 100644 --- a/flake.nix +++ b/flake.nix @@ -12,6 +12,7 @@ vicinae.url = "github:vicinaehq/vicinae"; ghostty.url = "github:ghostty-org/ghostty"; + inputs.auth-keys-hub.url = "github:input-output-hk/auth-keys-hub"; quickshell = { url = "github:outfoxxed/quickshell"; @@ -39,6 +40,7 @@ inherit profile; }; modules = [ + ./modules/core ./profiles/${profile}.nix ./hosts/${host} ] ++ extraModules; diff --git a/modules/core/default.nix b/modules/core/default.nix index 3ce97ea..8260c3b 100644 --- a/modules/core/default.nix +++ b/modules/core/default.nix @@ -10,6 +10,7 @@ ./network.nix ./packages.nix ./services.nix + ./ssh.nix ./system.nix ./user.nix ./xserver.nix diff --git a/modules/core/ssh.nix b/modules/core/ssh.nix new file mode 100644 index 0000000..bb81dbf --- /dev/null +++ b/modules/core/ssh.nix @@ -0,0 +1,16 @@ +{ inputs, pkgs, ... }: +{ + imports = [ inputs.auth-keys-hub.nixosModules.auth-keys-hub ]; + + services.openssh = { + enable = true; + openFirewall = true; + }; + + programs.auth-keys-hub = { + enable = true; + github = { + users = [ "moons-14:moons" ]; + }; + }; +} diff --git a/modules/home/default.nix b/modules/home/default.nix index 9700237..66f5343 100644 --- a/modules/home/default.nix +++ b/modules/home/default.nix @@ -3,5 +3,7 @@ imports = [ ./git.nix ./fcitx5 + ./ssh.nix + ./zsh.nix ]; } \ No newline at end of file diff --git a/modules/home/ssh.nix b/modules/home/ssh.nix new file mode 100644 index 0000000..edcee29 --- /dev/null +++ b/modules/home/ssh.nix @@ -0,0 +1,19 @@ +{ config, lib, ... }: +{ + programs.ssh.startAgent = true; + + home.packages = [ pkgs.openssh ]; + + home.activation.generateSshKey = lib.hm.dag.entryAfter [ "writeBoundary" ] '' + key="$HOME/.ssh/id_ed25519" + if [ ! -f "$key" ]; then + umask 077 + mkdir -p "$HOME/.ssh" + ssh-keygen -t ed25519 -N "" -f "$key" \ + -C "${config.home.username}@$(hostnamectl --static)" + echo "Generated SSH key at $key" + echo "Public key:" + cat "$key.pub" + fi + ''; +} diff --git a/profiles/cli-minimal.nix b/profiles/cli-minimal.nix index f7d4936..368bd5f 100644 --- a/profiles/cli-minimal.nix +++ b/profiles/cli-minimal.nix @@ -1,10 +1,8 @@ { ... }: { imports = [ - ./../modules/core ]; home-manager.users.moons.imports = [ - ./../modules/home/zsh.nix ]; } \ No newline at end of file