summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMilan Pässler <me@pbb.lc>2020-09-16 09:48:55 +0200
committerMilan Pässler <me@pbb.lc>2020-09-16 09:52:29 +0200
commitc93e5b202523419184f8ac26c6e28f7a1e473759 (patch)
tree5cc39c8be71573622cf3a06153eb3234f03064ca
parent1ae809fade110907393a9c0fdf6ab825a92c9a7a (diff)
downloadnimtradfri-master.tar.gz
nimtradfri-master.tar.bz2
nimtradfri-master.zip
add default.nix, shell.nixHEADmaster
-rw-r--r--default.nix33
-rw-r--r--shell.nix17
2 files changed, 50 insertions, 0 deletions
diff --git a/default.nix b/default.nix
new file mode 100644
index 0000000..20984f4
--- /dev/null
+++ 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
new file mode 100644
index 0000000..d38f3fe
--- /dev/null
+++ 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;
+}