Skip to content

Instantly share code, notes, and snippets.

@ckiee
Created July 11, 2026 09:07
Show Gist options
  • Select an option

  • Save ckiee/f7768f55a938aa7c985406f209a6f114 to your computer and use it in GitHub Desktop.

Select an option

Save ckiee/f7768f55a938aa7c985406f209a6f114 to your computer and use it in GitHub Desktop.
Using NixOS-ified home-manager config on a host you don't manage (example implementation)
let
sources = import ../nix/sources.nix;
eval = import "${sources.morph}/data/eval-machines.nix" {
networkExpr = ./morph.nix;
};
pkgs = import sources.nixpkgs { };
inherit (eval) uncheckedNodes nodes;
inherit (pkgs) lib;
in pkgs.writeScriptBin "ckie-hm-port"
nodes.hmporter.config.systemd.services.home-manager-ckie.serviceConfig.ExecStart
# …
elif [ "$1" == "hmport" ]; then
shift
# This will build the derivation on the target host.
path="$(nix-instantiate hm-only.nix)"
nix copy --to "ssh://$@" --derivation "$path"
ssh "$@" '$(nix-store -r '$path')/bin/ckie-hm-port'
else
# …
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment