ctucx.git: nimtradfri

[nimlang] incomplete library to interact with ikea tradfri-gateways

commit 848ea4b70c43fd4e7b91839675e1eaea45b8eaa7
parent a0d4508a39c273990fc3826d1188e0f89fd4e8a3
Author: Milan Pässler <me@pbb.lc>
Date: Wed, 16 Sep 2020 09:48:55 +0200

add default.nix, shell.nix
2 files changed, 50 insertions(+), 0 deletions(-)
A
default.nix
|
33
+++++++++++++++++++++++++++++++++
A
shell.nix
|
17
+++++++++++++++++
diff --git a/default.nix b/default.nix
@@ -0,0 +1,33 @@
+{
+  pkgs ? import <nixpkgs> {}
+, src ? ./.
+}:
+
+with pkgs;
+
+let
+  libcoap-with-dtls = libcoap.overrideAttrs (oldAttrs: {
+    configureFlags = oldAttrs.configureFlags ++ [ "--enable-dtls" ];
+    buildInputs = [ openssl ];
+  });
+in 
+  stdenv.mkDerivation {
+    pname = "tradfri-cli";
+    version = "0.1.0";
+    inherit src;
+    nativeBuildInputs = [ nim makeWrapper ];
+    buildPhase = ''
+      runHook preBuild
+      nim c -d:release --nimcache:$PWD tradfriCli
+      runHook postBuild
+    '';
+    installPhase = ''
+      runHook preInstall
+      install -Dm755 tradfriCli $out/bin/tradfriCli
+      runHook postInstall
+    '';
+    fixupPhase = ''
+      wrapProgram $out/bin/tradfriCli \
+        --prefix PATH : ${stdenv.lib.makeBinPath [ libcoap-with-dtls ]}
+    '';
+  }
diff --git a/shell.nix b/shell.nix
@@ -0,0 +1,17 @@
+{ pkgs ? import <nixpkgs> {} }:
+
+with pkgs;
+
+let
+  libcoap-with-dtls = libcoap.overrideAttrs (oldAttrs: {
+    configureFlags = oldAttrs.configureFlags ++ [ "--enable-dtls" ];
+    buildInputs = [ openssl ];
+  });
+
+in stdenv.mkDerivation {
+  pname = "tradfri.nim";
+  version = "0.1.0";
+  nativeBuildInputs = [ nim libcoap-with-dtls ];
+  #NIX_ENFORCE_PURITY = 0;
+  #NIX_HARDENING_ENABLE = 0;
+}