summaryrefslogblamecommitdiffstats
path: root/default.nix
blob: 20984f4bba6a5345a845cf057d7644b0210cdfd2 (plain) (tree)
































                                                                       
{
  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 ]}
    '';
  }