Skip to content

jibi/nix-dev-vm-ssh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

nix-dev-vm-ssh

bunch of helpers to quickly add root SSH access to dev VMs, so you don't need to hardcode your own SSH key or use --impure.

emphasis on dev: this will generate ephemeral, passphrase-less SSH keys and setup root access to the VM. dont use it for anything else.

Example

let
  nixosVmConfig = self.nixosConfigurations.vm.config;
in
{
  nixosConfigurations.vm = nixpkgs.lib.nixosSystem {
    inherit system;

    modules = [
      nix-dev-vm-ssh.nixosModules.default
      {
        # VM config
      }
    ];
  };

  apps.${system} = {
    vm = {
      type = "app";
      meta.description = "Boot the test VM";
      program = pkgs.lib.getExe (
        nix-dev-vm-ssh.lib.mkVmExe {
          inherit
            pkgs
            nixosVmConfig
            ;

          text = ''
            exec ${nixosVmConfig.system.build.vm}/bin/run-${nixosVmConfig.networking.hostName}-vm "$@"
          '';
        }
      );
    };

    ssh-vm = nix-dev-vm-ssh.lib.mkSshVmApp { inherit pkgs nixosVmConfig; };
  };
}

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages