about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/virtualization/driver/win-qemu/default.nix
blob: 1fa3e76d18fde546a0e3e85ac8db5a9034f44439 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
{ stdenv, fetchurl, p7zip }:

stdenv.mkDerivation  {
  name = "win-qemu-0.1.105-1";
  version = "0.1.105-1";

  phases = [ "buildPhase" "installPhase" ];

  src = fetchurl {
    url = "https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/archive-virtio/virtio-win-0.1.105-1/virtio-win.iso";
    sha256 = "065gz7s77y0q9kfqbr27451sr28rm9azpi88sqjkfph8c6r8q3wc";
  };

  buildPhase = ''
    ${p7zip}/bin/7z x $src
    '';

  installPhase =
    let
      copy_pvpanic = arch: version: "mkdir -p $out/${arch}/qemupanic; cp pvpanic/${version}/${arch}/* $out/${arch}/qemupanic/. \n";
      copy_pciserial = arch: "mkdir -p $out/${arch}/qemupciserial; cp qemupciserial/* $out/${arch}/qemupciserial/. \n";
      copy_agent = arch: ''
        mkdir -p $out/${arch}/qemuagent
        cp guest-agent/${if arch=="x86" then "qemu-ga-x86.msi" else "qemu-ga-x64.msi"} $out/${arch}/qemuagent/qemu-guest-agent.msi
        (cd $out/${arch}/qemuagent; ${p7zip}/bin/7z x qemu-guest-agent.msi; rm qemu-guest-agent.msi)
        '';
      copy = arch: version: (copy_pvpanic arch version) + (copy_pciserial arch) + (copy_agent arch);
    in
      (copy "amd64" "w8.1") + (copy "x86" "w8.1");

  meta = with stdenv.lib; {
    description = "Windows QEMU Drivers";
    homepage = https://fedoraproject.org/wiki/Windows_Virtio_Drivers;
    maintainers = [ maintainers.tstrobel ];
    platforms = platforms.linux;
    license = licenses.gpl2;
  };
}