summaryrefslogtreecommitdiff
path: root/hosts/muhammed/dev-vm/default.nix
diff options
context:
space:
mode:
authorLinnnus <[email protected]>2025-02-21 18:03:30 +0100
committerLinnnus <[email protected]>2025-02-21 18:03:52 +0100
commit3d9cf579a3e4d40221e08c36048e1f0d1de15ed0 (patch)
tree4205852e76de53fcaf675ce68f6ffa0285c30f4a /hosts/muhammed/dev-vm/default.nix
parent3900ce318bd6a656822f3cfebc5a2c1c39ef0bea (diff)
muhammed: Remove dev-vm
Diffstat (limited to 'hosts/muhammed/dev-vm/default.nix')
-rw-r--r--hosts/muhammed/dev-vm/default.nix68
1 files changed, 0 insertions, 68 deletions
diff --git a/hosts/muhammed/dev-vm/default.nix b/hosts/muhammed/dev-vm/default.nix
deleted file mode 100644
index e7fb05b..0000000
--- a/hosts/muhammed/dev-vm/default.nix
+++ /dev/null
@@ -1,68 +0,0 @@
-# This module sets up a development VM which I use for developing Linux stuff
-# on this Darwin host.
-{
- lib,
- pkgs,
- flakeInputs,
- flakeOutputs,
- metadata,
- ...
-}: let
- workingDirectory = "/var/lib/dev-vm";
-
- # Port 22 on the guest is forwarded to this port on the host.
- port = 31023;
-
- guest-system = import "${pkgs.path}/nixos" {
- configuration = {
- imports = [
- {
- _module.args = {
- hostPkgs = pkgs;
- hostPort = port;
- inherit workingDirectory flakeInputs flakeOutputs metadata;
- };
- }
- flakeInputs.home-manager.nixosModules.home-manager
- flakeInputs.agenix.nixosModules.default
- ./configuration/configuration.nix
- ];
- };
- system = builtins.replaceStrings ["darwin"] ["linux"] pkgs.stdenv.hostPlatform.system;
- };
-in {
- system.activationScripts.preActivation.text = ''
- mkdir -p ${lib.escapeShellArg workingDirectory}
- '';
-
- launchd.agents.dev-vm = {
- script = ''
- # create-builder uses TMPDIR to share files with the builder, notably certs.
- # macOS will clean up files in /tmp automatically that haven't been accessed in 3+ days.
- # If we let it use /tmp, leaving the computer asleep for 3 days makes the certs vanish.
- # So we'll use /run/org.nixos.dev-vm instead and clean it up ourselves.
- export TMPDIR=/run/org.nixos.dev-vm
- export USE_TMPDIR=1
-
- rm -rf "$TMPDIR"
- mkdir -p "$TMPDIR"
- trap 'rm -rf "$TMPDIR"' EXIT
-
- ${guest-system.config.system.build.macos-vm-installer}/bin/create-builder
- '';
-
- serviceConfig = {
- KeepAlive = true;
- RunAtLoad = true;
- WorkingDirectory = workingDirectory;
- };
- };
-
- environment.etc."ssh/ssh_config.d/100-dev-vm.conf".text = ''
- Host ${guest-system.config.networking.hostName}
- User linus # Also hardcoded in `configuration.nix`.
- Hostname localhost
- Port ${toString port}
- IdentityFile ${./keys/ssh_vmhost_ed25519_key}
- '';
-}