{ config, lib, pkgs, ... }: let qemurc = (pkgs.writeScriptBin "qemurc" ( builtins.readFile ( pkgs.replaceVars ./files/qemurc.bash { "OVMFfd" = "${pkgs.OVMF.fd}"; mount_root = "/vm"; zfs_root = "zroot/linux/nix/vm"; } ) )).overrideAttrs (old: { buildCommand = '' ${old.buildCommand} patchShebangs $out ''; }); qemurc_wrapped = (pkgs.writeScriptBin "qemurc" '' #!/usr/bin/env bash export "PATH=${ lib.makeBinPath [ pkgs.swtpm pkgs.tmux ] }:''${PATH}" exec ${qemurc}/bin/qemurc "''${@}" '').overrideAttrs (old: { buildCommand = '' ${old.buildCommand} patchShebangs $out ''; }); in { imports = [ ]; options.me = { qemu.enable = lib.mkOption { type = lib.types.bool; default = false; example = true; description = "Whether we want to install qemu."; }; }; config = lib.mkIf config.me.qemu.enable ( lib.mkMerge [ { environment.systemPackages = with pkgs; [ qemu qemurc_wrapped ]; } ] ); }