vmix.nix/flake.nix
Git Sagar 192ea9b54d fix: use vmix's own locked nixpkgs for all image building
The NixOS module was importing lib directly with the host's pkgs,
causing image customization to use the host's guestfs-tools instead
of vmix's locked version. guestfs-tools 1.52.2 (from host nixpkgs)
has a bug that overwrites /boot/grub/grub.cfg with resolv.conf
content, breaking VM boot.

Now vmixLib is built once in flake.nix with vmix's own nixpkgs and
passed through the overlay to pkgs.vmixLib. Removes overlay.nix and
module.nix as the logic is inlined in flake.nix.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-06-15 10:04:52 -03:00

49 lines
1.4 KiB
Nix

{
description = "vmix composable QEMU VM image building and orchestration";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
};
outputs = { self, nixpkgs, ... }:
let
system = "x86_64-linux";
pkgs = import nixpkgs {
inherit system;
config.allowUnfree = true;
};
lib = pkgs.lib;
vmixLib = import ./lib { inherit pkgs lib system; };
in {
overlays.default = final: prev: { inherit vmixLib; };
nixosModules.default = { config, pkgs, lib, ... }: {
imports = [ ./nixos/default.nix ];
config.nixpkgs.overlays = [ self.overlays.default ];
};
lib.${system} = vmixLib;
packages.${system}.default = import ./cli.nix { inherit pkgs self system; };
apps.${system}.default = {
type = "app";
program = "${self.packages.${system}.default}/bin/vmix";
};
devShells.${system}.default = pkgs.mkShell {
shellHook = ''
# vmix CLI available as local flake
export VMIX_FLAKE="path:$PWD"
alias vmix='nix run "$VMIX_FLAKE" --'
# bash prompt
PROMPT_COMMAND='PS1_CMD1=$(git branch --show-current 2>/dev/null)'; PS1='\[\e[1;7m\]$?\[\e[0m\] \[\e[2m\]\A\[\e[0m\] \[\e[91m\]\u@\h\[\e[0m\] \[\e[92;1m\]\w\[\e[0m\] \[\e[96m\]''${PS1_CMD1}\[\e[0m\] \[\e[1;2m\]$\[\e[0;1m\] \[\e[0m\]'
'';
buildInputs = with pkgs; [
bashInteractive
git
];
};
};
}