Closed jhakonen closed 4 months ago
Hello :wave:,
lollypops expects an SSH server running and treats localhost as any other host. If you don't want to expose your laptop via ssh, you can configure it to only accept connections on port 22 at the 127.0.0.1
address.
local-evaluation
causes nixos-rebuild to evaluate locally, but the --target-host
is stil reached via SSH. Also the copying operation is done via rsync over ssh.
Ah, thank you, now I understand. Used to do local deployment for my laptop, I was confused how to do it with lollypops. Using ssh as you suggested worked just fine!
In my old way of deploying configs to remote hosts (nixos vm on synology, nixos gaming/kodi pc, and nixos rpi3) I had remote commands for running:
I cooked up custom tasks for doing those like so:
lollypops.extraTasks.reboot = {
desc = "Reboot machine";
cmds = [
"echo Rebooting machine"
"ssh ${config.lollypops.deployment.ssh.user}@${config.lollypops.deployment.ssh.host} reboot"
];
};
lollypops.extraTasks.rebuild-debug = {
desc = "Rebuild with debug output";
cmds = [
"echo Rebuilding with debug information"
''
ssh ${config.lollypops.deployment.ssh.user}@${config.lollypops.deployment.ssh.host} \
nixos-rebuild switch \
--flake '${config.lollypops.deployment.config-dir}#${config.lollypops.deployment.ssh.host}' \
--show-trace --verbose --option eval-cache false
''
];
};
In order to figure out how to run remote commands I had to check lollypops's sources and come up with a similar ssh command to do it. Would it make sense have some custom command that would allow running commands on the remote host, e.g. remote-run reboot
that would be exposed to the task cmds?
Also exposing something like e.g. the flake's path#config as a variable would be useful.
Would it make sense have some custom command that would allow running commands on the remote host, e.g. remote-run reboot that would be exposed to the task cmds? Also exposing something like e.g. the flake's path#config as a variable would be useful.
I'm open to review PR's on this if you want to give it a go. I think that is a separate issue though, so I'll close this one as the original question seems fixed
How do I rebuild my configuration to my local NixOS laptop?
I have so far used this command to rebuild it:
Now I'm trying to take lollypops into use and I wonder what would be the equivalent with it?
I tried this but lollypops starts fiddling with ssh:
I have set
lollypops.deployment.local-evaluation = true;
but it doesn't seem to have any effect. I don't have ssh server setup on the laptop, so its expected that connect would fail. The flake config is at current working directory, so there shouldn't be any reason to connect anywhere. Do I need some extra configuration to get this working?