From bf533545dd0df5b3a06a1dca170d1ab946db264b Mon Sep 17 00:00:00 2001
From: Jens Nolte <jens@nightmarestudio.de>
Date: Tue, 11 Feb 2020 02:03:49 +0100
Subject: [PATCH] Add package wayvnc

---
 nixos/layers/desktop.nix       |  1 +
 nixos/pkgs/default.nix         |  2 ++
 nixos/pkgs/neatvnc/default.nix |  5 +++++
 nixos/pkgs/neatvnc/neatvnc.nix | 36 ++++++++++++++++++++++++++++++++++
 nixos/pkgs/neatvnc/repo.json   |  6 ++++++
 nixos/pkgs/neatvnc/update      |  5 +++++
 nixos/pkgs/wayvnc/default.nix  |  8 ++++++++
 nixos/pkgs/wayvnc/repo.json    |  6 ++++++
 nixos/pkgs/wayvnc/update       |  5 +++++
 nixos/pkgs/wayvnc/wayvnc.nix   | 36 ++++++++++++++++++++++++++++++++++
 10 files changed, 110 insertions(+)
 create mode 100644 nixos/pkgs/neatvnc/default.nix
 create mode 100644 nixos/pkgs/neatvnc/neatvnc.nix
 create mode 100644 nixos/pkgs/neatvnc/repo.json
 create mode 100755 nixos/pkgs/neatvnc/update
 create mode 100644 nixos/pkgs/wayvnc/default.nix
 create mode 100644 nixos/pkgs/wayvnc/repo.json
 create mode 100755 nixos/pkgs/wayvnc/update
 create mode 100644 nixos/pkgs/wayvnc/wayvnc.nix

diff --git a/nixos/layers/desktop.nix b/nixos/layers/desktop.nix
index a7bb56e..8a7a994 100644
--- a/nixos/layers/desktop.nix
+++ b/nixos/layers/desktop.nix
@@ -33,6 +33,7 @@ in
     gnome3.gnome-disk-utility
     vscode
     networkmanagerapplet
+    wayvnc
 
     # cursor theme
     simpleandsoft
diff --git a/nixos/pkgs/default.nix b/nixos/pkgs/default.nix
index b91589f..88171f9 100644
--- a/nixos/pkgs/default.nix
+++ b/nixos/pkgs/default.nix
@@ -12,6 +12,8 @@ let
     neovim = (import ./neovim { inherit pkgs; }).neovim;
     nginx-sso = callPackage ./nginx-sso {};
     simpleandsoft = (import ./simpleandsoft { inherit pkgs; }).simpleandsoft;
+    neatvnc = callPackage ./neatvnc/neatvnc.nix {};
+    wayvnc = callPackage ./wayvnc/wayvnc.nix {};
   };
 
 in newpkgs
diff --git a/nixos/pkgs/neatvnc/default.nix b/nixos/pkgs/neatvnc/default.nix
new file mode 100644
index 0000000..ff342f4
--- /dev/null
+++ b/nixos/pkgs/neatvnc/default.nix
@@ -0,0 +1,5 @@
+{ pkgs ? import <nixpkgs> {} }:
+
+{
+  neatvnc = pkgs.callPackage ./neatvnc.nix {};
+}
\ No newline at end of file
diff --git a/nixos/pkgs/neatvnc/neatvnc.nix b/nixos/pkgs/neatvnc/neatvnc.nix
new file mode 100644
index 0000000..0886e75
--- /dev/null
+++ b/nixos/pkgs/neatvnc/neatvnc.nix
@@ -0,0 +1,36 @@
+{ stdenv, fetchFromGitHub, meson, pkgconfig, ninja, libdrm, pixman, libuv, gnutls, libjpeg_turbo }:
+
+with builtins;
+
+let
+  repo = fromJSON ( readFile ./repo.json );
+in
+stdenv.mkDerivation {
+  pname = "neatvnc";
+  version = repo.rev;
+
+  src = fetchFromGitHub repo;
+
+  nativeBuildInputs = [
+    pkgconfig meson ninja
+  ];
+
+  buildInputs = [
+    pixman libuv gnutls libdrm libjpeg_turbo
+  ];
+
+  enableParallelBuilding = true;
+
+  # mesonFlags = [
+  #   "-Ddefault-wallpaper=false" "-Dxwayland=enabled" "-Dgdk-pixbuf=enabled"
+  #   "-Dtray=enabled" "-Dman-pages=enabled"
+  # ];
+
+  # meta = with stdenv.lib; {
+  #   description = "i3-compatible tiling Wayland compositor";
+  #   homepage    = https://swaywm.org;
+  #   license     = licenses.mit;
+  #   platforms   = platforms.linux;
+  #   maintainers = with maintainers; [ primeos synthetica ma27 ];
+  # };
+}
\ No newline at end of file
diff --git a/nixos/pkgs/neatvnc/repo.json b/nixos/pkgs/neatvnc/repo.json
new file mode 100644
index 0000000..e19bbad
--- /dev/null
+++ b/nixos/pkgs/neatvnc/repo.json
@@ -0,0 +1,6 @@
+{
+    "owner": "any1",
+    "repo": "neatvnc",
+    "rev": "992b4445edea7199ec0d2d673d726767f1da4f5f",
+    "sha256": "12nv74x4mjw9xz2ahj1mm45jfifmdrpbap3dpn2w7nj5av6ivvm6"
+}
\ No newline at end of file
diff --git a/nixos/pkgs/neatvnc/update b/nixos/pkgs/neatvnc/update
new file mode 100755
index 0000000..9decc08
--- /dev/null
+++ b/nixos/pkgs/neatvnc/update
@@ -0,0 +1,5 @@
+#!/usr/bin/env nix-shell
+#! nix-shell -i sh -p nix-prefetch-github
+
+nix-prefetch-github any1 neatvnc > repo.json
+
diff --git a/nixos/pkgs/wayvnc/default.nix b/nixos/pkgs/wayvnc/default.nix
new file mode 100644
index 0000000..29fddff
--- /dev/null
+++ b/nixos/pkgs/wayvnc/default.nix
@@ -0,0 +1,8 @@
+{ pkgs ? import <nixpkgs> {} }:
+
+let
+  neatvnc = pkgs.callPackage ../neatvnc/neatvnc.nix {};
+in
+{
+  wayvnc = pkgs.callPackage ./wayvnc.nix { inherit neatvnc; };
+}
\ No newline at end of file
diff --git a/nixos/pkgs/wayvnc/repo.json b/nixos/pkgs/wayvnc/repo.json
new file mode 100644
index 0000000..7c58977
--- /dev/null
+++ b/nixos/pkgs/wayvnc/repo.json
@@ -0,0 +1,6 @@
+{
+    "owner": "any1",
+    "repo": "wayvnc",
+    "rev": "908ba0f904a0e552a6bbe63fbd04e243b4f4685f",
+    "sha256": "0vly9m10jd3zlrpncipblqsqc3jf94lyhz5yb05b5c8hvqdk8w3g"
+}
\ No newline at end of file
diff --git a/nixos/pkgs/wayvnc/update b/nixos/pkgs/wayvnc/update
new file mode 100755
index 0000000..0ce5ae1
--- /dev/null
+++ b/nixos/pkgs/wayvnc/update
@@ -0,0 +1,5 @@
+#!/usr/bin/env nix-shell
+#! nix-shell -i sh -p nix-prefetch-github
+
+nix-prefetch-github any1 wayvnc > repo.json
+
diff --git a/nixos/pkgs/wayvnc/wayvnc.nix b/nixos/pkgs/wayvnc/wayvnc.nix
new file mode 100644
index 0000000..33e3bd5
--- /dev/null
+++ b/nixos/pkgs/wayvnc/wayvnc.nix
@@ -0,0 +1,36 @@
+{ stdenv, fetchFromGitHub, meson, pkgconfig, ninja, libdrm, libX11, pixman, libuv, libGL, libxkbcommon, wayland, neatvnc }:
+
+with builtins;
+
+let
+  repo = fromJSON ( readFile ./repo.json );
+in
+stdenv.mkDerivation {
+  pname = "wayvnc";
+  version = repo.rev;
+
+  src = fetchFromGitHub repo;
+
+  nativeBuildInputs = [
+    pkgconfig meson ninja
+  ];
+
+  buildInputs = [
+    pixman libuv libGL libxkbcommon wayland neatvnc libdrm libX11
+  ];
+
+  enableParallelBuilding = true;
+
+  # mesonFlags = [
+  #   "-Ddefault-wallpaper=false" "-Dxwayland=enabled" "-Dgdk-pixbuf=enabled"
+  #   "-Dtray=enabled" "-Dman-pages=enabled"
+  # ];
+
+  # meta = with stdenv.lib; {
+  #   description = "i3-compatible tiling Wayland compositor";
+  #   homepage    = https://swaywm.org;
+  #   license     = licenses.mit;
+  #   platforms   = platforms.linux;
+  #   maintainers = with maintainers; [ primeos synthetica ma27 ];
+  # };
+}
\ No newline at end of file
-- 
GitLab