feat: add ephvm host

This commit is contained in:
2026-03-07 22:10:25 +01:00
parent aaee9558a7
commit 53ddba4457
4 changed files with 116 additions and 4 deletions

17
flake.lock generated
View File

@@ -468,6 +468,22 @@
"type": "github" "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": { "pre-commit": {
"inputs": { "inputs": {
"flake-compat": "flake-compat", "flake-compat": "flake-compat",
@@ -503,6 +519,7 @@
"nixpkgs": "nixpkgs_3", "nixpkgs": "nixpkgs_3",
"nixpkgs-master": "nixpkgs-master", "nixpkgs-master": "nixpkgs-master",
"nixpkgs-unstable": "nixpkgs-unstable", "nixpkgs-unstable": "nixpkgs-unstable",
"nvim": "nvim",
"stylix": "stylix" "stylix": "stylix"
} }
}, },

View File

@@ -10,10 +10,10 @@
# url = "git+https://git.janezic.dev/janezicmatej/.dotfiles.git"; # url = "git+https://git.janezic.dev/janezicmatej/.dotfiles.git";
# flake = false; # flake = false;
# }; # };
# nvim = { nvim = {
# url = "git+https://git.janezic.dev/janezicmatej/nvim.git?ref=rewrite"; url = "git+https://git.janezic.dev/janezicmatej/nvim.git";
# flake = false; flake = false;
# }; };
nixos-hardware.url = "github:NixOS/nixos-hardware/master"; nixos-hardware.url = "github:NixOS/nixos-hardware/master";
@@ -82,6 +82,11 @@
iso = mkHost "iso" { iso = mkHost "iso" {
system = "x86_64-linux"; system = "x86_64-linux";
}; };
ephvm = mkHost "ephvm" {
system = "x86_64-linux";
user = "matej";
};
}; };
nixosModules = import ./modules/nixos { nixosModules = import ./modules/nixos {
@@ -123,6 +128,7 @@
packages = [ packages = [
pkgs.pre-commit pkgs.pre-commit
pkgs.statix pkgs.statix
pkgs.qemu
]; ];
}; };
} }

View File

@@ -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";
}

View File

@@ -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";
}