summary refs log tree commit diff
diff options
context:
space:
mode:
authorWill Dietz <w@wdtz.org>2017-10-03 06:43:40 -0500
committerWill Dietz <w@wdtz.org>2018-02-20 10:34:19 -0600
commite5e29284a91cc6b3f18ab5525b144a219b6d8d3f (patch)
tree6d5dfa5eeedbb4933f50770e4fedce106cf8dcd6
parent39ff4984183e098a6bf52abdd8378e468d450792 (diff)
downloadnixpkgs-e5e29284a91cc6b3f18ab5525b144a219b6d8d3f.tar
nixpkgs-e5e29284a91cc6b3f18ab5525b144a219b6d8d3f.tar.gz
nixpkgs-e5e29284a91cc6b3f18ab5525b144a219b6d8d3f.tar.bz2
nixpkgs-e5e29284a91cc6b3f18ab5525b144a219b6d8d3f.tar.lz
nixpkgs-e5e29284a91cc6b3f18ab5525b144a219b6d8d3f.tar.xz
nixpkgs-e5e29284a91cc6b3f18ab5525b144a219b6d8d3f.tar.zst
nixpkgs-e5e29284a91cc6b3f18ab5525b144a219b6d8d3f.zip
webos: init novacom, novacomd, cmake-modules; add nixos service
-rw-r--r--nixos/modules/module-list.nix1
-rw-r--r--nixos/modules/services/misc/novacomd.nix31
-rw-r--r--pkgs/development/mobile/webos/cmake-modules.nix32
-rw-r--r--pkgs/development/mobile/webos/cmake-setup-hook.sh9
-rw-r--r--pkgs/development/mobile/webos/novacom.nix27
-rw-r--r--pkgs/development/mobile/webos/novacomd.nix40
-rw-r--r--pkgs/top-level/all-packages.nix7
7 files changed, 147 insertions, 0 deletions
diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix
index 795f6fda305..7ee27303a5f 100644
--- a/nixos/modules/module-list.nix
+++ b/nixos/modules/module-list.nix
@@ -341,6 +341,7 @@
   ./services/misc/nix-optimise.nix
   ./services/misc/nixos-manual.nix
   ./services/misc/nix-ssh-serve.nix
+  ./services/misc/novacomd.nix
   ./services/misc/nzbget.nix
   ./services/misc/octoprint.nix
   ./services/misc/osrm.nix
diff --git a/nixos/modules/services/misc/novacomd.nix b/nixos/modules/services/misc/novacomd.nix
new file mode 100644
index 00000000000..7cfc68d2b67
--- /dev/null
+++ b/nixos/modules/services/misc/novacomd.nix
@@ -0,0 +1,31 @@
+{ config, lib, pkgs, ... }:
+
+with lib;
+
+let
+
+  cfg = config.services.novacomd;
+
+in {
+
+  options = {
+    services.novacomd = {
+      enable = mkEnableOption "Novacom service for connecting to WebOS devices";
+    };
+  };
+
+  config = mkIf cfg.enable {
+    environment.systemPackages = [ pkgs.webos.novacom ];
+
+    systemd.services.novacomd = {
+      description = "Novacom WebOS daemon";
+      wantedBy = [ "multi-user.target" ];
+
+      serviceConfig = {
+        ExecStart = "${pkgs.webos.novacomd}/sbin/novacomd";
+      };
+    };
+  };
+
+  meta.maintainers = with maintainers; [ dtzWill ];
+}
diff --git a/pkgs/development/mobile/webos/cmake-modules.nix b/pkgs/development/mobile/webos/cmake-modules.nix
new file mode 100644
index 00000000000..f149cb622e1
--- /dev/null
+++ b/pkgs/development/mobile/webos/cmake-modules.nix
@@ -0,0 +1,32 @@
+{ stdenv, fetchFromGitHub, cmake }:
+
+stdenv.mkDerivation rec {
+  name = "cmake-modules-webos-${version}";
+  version = "19";
+
+  src = fetchFromGitHub {
+    owner = "openwebos";
+    repo = "cmake-modules-webos";
+    rev = "submissions/${version}";
+    sha256 = "1l4hpcmgc98kp9g1642sy111ki5qyk3q7j10xzkgmnvz8lqffnxp";
+  };
+
+  nativeBuildInputs = [ cmake ];
+
+  prePatch = ''
+    substituteInPlace CMakeLists.txt --replace "CMAKE_ROOT}/Modules" "CMAKE_INSTALL_PREFIX}/lib/cmake"
+    substituteInPlace webOS/webOS.cmake \
+      --replace ' ''${CMAKE_ROOT}/Modules' " $out/lib/cmake" \
+      --replace 'INSTALL_ROOT}/usr' 'INSTALL_ROOT}'
+
+    sed -i '/CMAKE_INSTALL_PREFIX/d' webOS/webOS.cmake
+  '';
+
+  setupHook = ./cmake-setup-hook.sh;
+
+  meta = with stdenv.lib; {
+    description = "CMake modules needed to build Open WebOS components";
+    license = licenses.asl20;
+    maintainers = with maintainers; [ dtzWill ];
+  };
+}
diff --git a/pkgs/development/mobile/webos/cmake-setup-hook.sh b/pkgs/development/mobile/webos/cmake-setup-hook.sh
new file mode 100644
index 00000000000..7e52681e9a9
--- /dev/null
+++ b/pkgs/development/mobile/webos/cmake-setup-hook.sh
@@ -0,0 +1,9 @@
+_addWebOSCMakeFlags() {
+  # Help find the webOS cmake module
+  cmakeFlagsArray+=(-DCMAKE_MODULE_PATH=@out@/lib/cmake)
+
+  # fix installation path (doesn't use CMAKE_INSTALL_PREFIX)
+  cmakeFlagsArray+=(-DWEBOS_INSTALL_ROOT=${!outputBin})
+}
+
+preConfigureHooks+=(_addWebOSCMakeFlags)
diff --git a/pkgs/development/mobile/webos/novacom.nix b/pkgs/development/mobile/webos/novacom.nix
new file mode 100644
index 00000000000..52b50635e33
--- /dev/null
+++ b/pkgs/development/mobile/webos/novacom.nix
@@ -0,0 +1,27 @@
+{ stdenv, fetchFromGitHub, webos, cmake, pkgconfig }:
+
+stdenv.mkDerivation rec {
+  name = "novacom-${version}";
+  version = "18";
+
+  src = fetchFromGitHub {
+    owner = "openwebos";
+    repo = "novacom";
+    rev = "submissions/${version}";
+    sha256 = "12s6g7l20kakyjlhqpli496miv2kfsdp17lcwhdrzdxvxl6hnf4n";
+  };
+
+  nativeBuildInputs = [ cmake pkgconfig webos.cmake-modules ];
+
+  postInstall = ''
+    install -Dm755 -t $out/bin ../scripts/novaterm
+    substituteInPlace $out/bin/novaterm --replace "exec novacom" "exec $out/bin/novacom"
+  '';
+
+  meta = with stdenv.lib; {
+    description = "Utility for communicating with WebOS devices";
+    license = licenses.asl20;
+    maintainers = with maintainers; [ dtzWill ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/pkgs/development/mobile/webos/novacomd.nix b/pkgs/development/mobile/webos/novacomd.nix
new file mode 100644
index 00000000000..f82009b0c39
--- /dev/null
+++ b/pkgs/development/mobile/webos/novacomd.nix
@@ -0,0 +1,40 @@
+{ stdenv,
+fetchFromGitHub, fetchpatch,
+webos, cmake, pkgconfig,
+libusb }:
+
+stdenv.mkDerivation rec {
+  name = "novacomd-${version}";
+  version = "127";
+
+  src = fetchFromGitHub {
+    owner = "openwebos";
+    repo = "novacomd";
+    rev = "submissions/${version}";
+    sha256 = "1gahc8bvvvs4d6svrsw24iw5r0mhy4a2ars3j2gz6mp6sh42bznl";
+  };
+
+  patches = [
+    (fetchpatch {
+      url = "https://aur.archlinux.org/cgit/aur.git/plain/0001-Use-usb_bulk_-read-write-instead-of-homemade-handler.patch?h=palm-novacom-git";
+      sha256 = "116r6p4l767fqxfvq03sy6v7vxja8pkxlrc5hqby351a40b5dkiv";
+    })
+    (fetchpatch {
+      url = "https://raw.githubusercontent.com/feniksa/webos-overlay/40e2c113fc9426d50bdf37779da57ce4ff06ee6e/net-misc/novacomd/files/0011-Remove-verbose-output.patch";
+      sha256 = "09lmv06ziwkfg19b1h3jsmkm6g1f0nxxq1717dircjx8m45ypjq9";
+    })
+  ];
+
+  nativeBuildInputs = [ cmake pkgconfig webos.cmake-modules ];
+
+  buildInputs = [ libusb ];
+
+  cmakeFlags = [ "-DWEBOS_TARGET_MACHINE_IMPL=host" ];
+
+  meta = with stdenv.lib; {
+    description = "Daemon for communicating with WebOS devices";
+    license = licenses.asl20;
+    maintainers = with maintainers; [ dtzWill ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index ffc8abcdf23..3e7abceb0fd 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -685,6 +685,13 @@ with pkgs;
 
   androidsdk_extras = self.androidenv.androidsdk_8_0_extras;
 
+  webos = recurseIntoAttrs {
+    cmake-modules = callPackage ../development/mobile/webos/cmake-modules.nix { };
+
+    novacom = callPackage ../development/mobile/webos/novacom.nix { };
+    novacomd = callPackage ../development/mobile/webos/novacomd.nix { };
+  };
+
   arc-theme = callPackage ../misc/themes/arc { };
 
   arc-kde-theme = callPackage ../misc/themes/arc-kde { };