From 53ddba445703cbb7ba8721e8f3895ae83d0d0e0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matej=20Jane=C5=BEi=C4=8D?= Date: Sat, 7 Mar 2026 22:10:25 +0100 Subject: [PATCH] feat: add ephvm host --- flake.lock | 17 +++++++ flake.nix | 14 ++++-- hosts/ephvm/configuration.nix | 69 ++++++++++++++++++++++++++ hosts/ephvm/hardware-configuration.nix | 20 ++++++++ 4 files changed, 116 insertions(+), 4 deletions(-) create mode 100644 hosts/ephvm/configuration.nix create mode 100644 hosts/ephvm/hardware-configuration.nix diff --git a/flake.lock b/flake.lock index 68e69f0..275a1c5 100644 --- a/flake.lock +++ b/flake.lock @@ -468,6 +468,22 @@ "type": "github" } }, + "nvim": { + "flake": false, + "locked": { + "lastModified": 1771940146, + "narHash": "sha256-z52fdPOWd3hUKKd9IojZ6rFYAgQrdrw/lNKFVdO2jf8=", + "ref": "refs/heads/main", + "rev": "058c9c730d8d60f482d97b61702561e1ea978847", + "revCount": 91, + "type": "git", + "url": "https://git.janezic.dev/janezicmatej/nvim.git" + }, + "original": { + "type": "git", + "url": "https://git.janezic.dev/janezicmatej/nvim.git" + } + }, "pre-commit": { "inputs": { "flake-compat": "flake-compat", @@ -503,6 +519,7 @@ "nixpkgs": "nixpkgs_3", "nixpkgs-master": "nixpkgs-master", "nixpkgs-unstable": "nixpkgs-unstable", + "nvim": "nvim", "stylix": "stylix" } }, diff --git a/flake.nix b/flake.nix index b3358a2..8f8b152 100644 --- a/flake.nix +++ b/flake.nix @@ -10,10 +10,10 @@ # url = "git+https://git.janezic.dev/janezicmatej/.dotfiles.git"; # flake = false; # }; - # nvim = { - # url = "git+https://git.janezic.dev/janezicmatej/nvim.git?ref=rewrite"; - # flake = false; - # }; + nvim = { + url = "git+https://git.janezic.dev/janezicmatej/nvim.git"; + flake = false; + }; nixos-hardware.url = "github:NixOS/nixos-hardware/master"; @@ -82,6 +82,11 @@ iso = mkHost "iso" { system = "x86_64-linux"; }; + + ephvm = mkHost "ephvm" { + system = "x86_64-linux"; + user = "matej"; + }; }; nixosModules = import ./modules/nixos { @@ -123,6 +128,7 @@ packages = [ pkgs.pre-commit pkgs.statix + pkgs.qemu ]; }; } diff --git a/hosts/ephvm/configuration.nix b/hosts/ephvm/configuration.nix new file mode 100644 index 0000000..9b1d450 --- /dev/null +++ b/hosts/ephvm/configuration.nix @@ -0,0 +1,69 @@ +{ + pkgs, + lib, + inputs, + config, + ... +}: +{ + networking.hostName = "ephvm"; + + profiles.base.enable = true; + + vm-guest = { + enable = true; + headless = true; + }; + + vm-9p-automount = { + enable = true; + user = "matej"; + }; + + localisation = { + timeZone = "UTC"; + defaultLocale = "en_US.UTF-8"; + }; + + virtualisation.docker = { + enable = true; + logDriver = "json-file"; + }; + + # TODO:(@janezicmatej) move neovim dotfiles wiring to a cleaner place + home-manager.users.matej = { + neovim.dotfiles = inputs.nvim; + }; + + # writable claude config via 9p + fileSystems."/home/matej/.claude" = { + device = "claude"; + fsType = "9p"; + options = [ + "trans=virtio" + "version=9p2000.L" + "nofail" + "x-systemd.automount" + ]; + }; + + # .claude.json passed via qemu fw_cfg + boot.kernelModules = [ "qemu_fw_cfg" ]; + systemd.services.claude-json = { + after = [ "systemd-modules-load.service" ]; + wants = [ "systemd-modules-load.service" ]; + wantedBy = [ "multi-user.target" ]; + serviceConfig = { + Type = "oneshot"; + RemainAfterExit = true; + ExecStart = pkgs.writeShellScript "claude-json" '' + src="/sys/firmware/qemu_fw_cfg/by_name/opt/claude.json/raw" + [ -f "$src" ] || exit 0 + cp "$src" /home/matej/.claude.json + chown matej:users /home/matej/.claude.json + ''; + }; + }; + + system.stateVersion = "25.11"; +} diff --git a/hosts/ephvm/hardware-configuration.nix b/hosts/ephvm/hardware-configuration.nix new file mode 100644 index 0000000..2050d4f --- /dev/null +++ b/hosts/ephvm/hardware-configuration.nix @@ -0,0 +1,20 @@ +{ + lib, + pkgs, + modulesPath, + ... +}: +{ + imports = [ + (modulesPath + "/profiles/qemu-guest.nix") + ]; + + fileSystems."/" = { + device = "/dev/disk/by-label/nixos"; + autoResize = true; + fsType = "ext4"; + }; + + # image.modules (disk-image.nix) overrides boot loader per variant + boot.loader.grub.device = lib.mkDefault "/dev/vda"; +}