;;; GNU Guix --- Functional package management for GNU
;;; Copyright Â© 2018, 2019, 2020, 2022 Oleg Pykhalov <go.wigust@gmail.com>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (wigust packages virtualization)
  #:use-module (gnu packages)
  #:use-module (gnu packages admin)
  #:use-module (gnu packages attr)
  #:use-module (gnu packages autotools)
  #:use-module (gnu packages bison)
  #:use-module (gnu packages check)
  #:use-module (gnu packages compression)
  #:use-module (gnu packages curl)
  #:use-module (gnu packages cyrus-sasl)
  #:use-module (gnu packages elf)
  #:use-module (gnu packages disk)
  #:use-module (gnu packages dns)
  #:use-module (gnu packages docbook)
  #:use-module (gnu packages documentation)
  #:use-module (gnu packages flex)
  #:use-module (gnu packages fontutils)
  #:use-module (gnu packages gettext)
  #:use-module (gnu packages gl)
  #:use-module (gnu packages glib)
  #:use-module (gnu packages gnome)
  #:use-module (gnu packages gnupg)
  #:use-module (gnu packages golang)
  #:use-module (gnu packages gtk)
  #:use-module (gnu packages image)
  #:use-module (gnu packages libusb)
  #:use-module (gnu packages linux)
  #:use-module (gnu packages ncurses)
  #:use-module (gnu packages nettle)
  #:use-module (gnu packages networking)
  #:use-module (gnu packages package-management)
  #:use-module (gnu packages perl)
  #:use-module (gnu packages pkg-config)
  #:use-module (gnu packages polkit)
  #:use-module (gnu packages protobuf)
  #:use-module (gnu packages python)
  #:use-module (gnu packages python-web)
  #:use-module (gnu packages pulseaudio)
  #:use-module (gnu packages selinux)
  #:use-module (gnu packages sdl)
  #:use-module (gnu packages spice)
  #:use-module (gnu packages texinfo)
  #:use-module (gnu packages textutils)
  #:use-module (gnu packages tls)
  #:use-module (gnu packages web)
  #:use-module (gnu packages xdisorg)
  #:use-module (gnu packages xml)
  #:use-module (guix build-system gnu)
  #:use-module (guix build-system cmake)
  #:use-module (guix download)
  #:use-module (guix git-download)
  #:use-module ((guix licenses) #:select (gpl2 gpl2+ gpl3+ lgpl2.1 lgpl2.1+
                                               asl2.0))
  #:use-module (gnu packages virtualization)
  #:use-module (guix packages)
  #:use-module (guix utils)
  #:use-module (srfi srfi-1))

(define-public dynamips
  (package
    (name "dynamips")
    (version "0.2.18")
    (source (origin
              (method url-fetch)
              (uri (string-append"https://github.com/GNS3/dynamips/archive/v"
                                 version ".tar.gz"))
              (file-name (string-append name "-" version ".tar.gz"))
              (sha256
               (base32
                "1h6avqs1zirpnwxwayha43nmmx8clwb7mbqy2srnvm8hyhiapf1r"))))
    (build-system cmake-build-system)
    (inputs
     `(("libelf" ,libelf)
       ("libpcap" ,libpcap)))
    (arguments
     `(#:tests? ;no tests
       #f))
    (home-page "https://github.com/GNS3/dynamips/")
    (synopsis "Cisco router emulator")
    (description "@code{dynamips} provides an emulator for a Cisco router.")
    (license gpl2+)))

(define-public qemu-my
  (package
    (inherit qemu)
    (name "qemu-my")
    (arguments
     (substitute-keyword-arguments
         (package-arguments qemu)
       ((#:phases phases)
        `(modify-phases ,phases
           (add-after 'unpack 'patch-source
             (lambda _
               ;; Hide menu bar at start.
               (substitute* "ui/gtk.c"
                 (("gtk_widget_show_all\\(s->window\\);" original)
                  (string-append original "\n    gtk_widget_hide(s->menu_bar);")))))))))))

(define-public virt-manager-fullscreen
  (package
    (inherit virt-manager)
    (name "virt-manager-fullscreen")
    (source
     (origin
       (inherit (package-source virt-manager))
       (patches (search-patches "virt-manager-fullscreen.patch"))))))
