From 2ae0d70482973c3027110c3e71c974fc66fc4c3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Pacana?= Date: Mon, 27 Jul 2026 09:39:50 +0200 Subject: [PATCH] Move the Lima VM list out of the shared ssh module * ssh.nix hardcoded nixden, the one host fact living in a module shared by all accounts and hosts. It now renders aliases from a my.limaVms option, so the host file that declares the VMs also declares their aliases, and accounts without VMs get an empty config.d/lima. --- hosts/pro.nix | 1 + modules/core.nix | 8 ++++++++ modules/ssh.nix | 5 ++--- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/hosts/pro.nix b/hosts/pro.nix index ed4aa14..67cde0b 100644 --- a/hosts/pro.nix +++ b/hosts/pro.nix @@ -76,6 +76,7 @@ pkgs.lima pkgs.rtl_433 ]; # runs the VMs; radio tinkering + my.limaVms = [ "nixden" ]; # aliased in ssh config; declared in vms below my.logseqGraphs = [ "Notes/mostlyobvious" "Notes/hraba.gs" diff --git a/modules/core.nix b/modules/core.nix index 1449813..99cc857 100644 --- a/modules/core.nix +++ b/modules/core.nix @@ -28,6 +28,14 @@ description = "Email address used as the git commit author."; }; + # Lima VM names to expose as stable SSH host aliases. Set by the host file, + # which also declares the VMs; consumed by ssh.nix. + options.my.limaVms = lib.mkOption { + type = lib.types.listOf lib.types.str; + default = [ ]; + description = "Lima VM instance names to alias in SSH config."; + }; + # Home-relative Logseq graph dirs to receive the nightfox custom.css. Per # account, since graphs differ and custom.css is loaded per-graph. options.my.logseqGraphs = lib.mkOption { diff --git a/modules/ssh.nix b/modules/ssh.nix index 5356df8..90857a4 100644 --- a/modules/ssh.nix +++ b/modules/ssh.nix @@ -1,7 +1,6 @@ -{ lib, ... }: +{ config, lib, ... }: let - limaInstances = [ "nixden" ]; limaHost = name: '' Host ${name} HostName 127.0.0.1 @@ -56,5 +55,5 @@ in # Stable aliases for Lima VMs. The proxy reuses Lima's generated ssh.config, # so changing forwarded ports after a restart do not require regenerating this. - home.file.".ssh/config.d/lima".text = lib.concatMapStrings limaHost limaInstances; + home.file.".ssh/config.d/lima".text = lib.concatMapStrings limaHost config.my.limaVms; } -- 2.51.2