das-labor / neopg

The multiversal cryptoengine!
Other
216 stars 16 forks source link

nixos packaging #55

Open lambdafu opened 6 years ago

lambdafu commented 6 years ago

See discussion here: https://github.com/das-labor/neopg/commit/cbd2fc5d7d363cf13b441d0700b513169832a057

erictapen commented 6 years ago

This was my first attempt, a few weeks ago:

with import <nixpkgs> { };

stdenv.mkDerivation rec {
  name = "neopg";
  version = "0.0.4";

  # Don't do that, as it doesn't fetch submodules.
  # src = pkgs.fetchFromGitHub {
  #   owner = "das-labor";
  #   repo = name;
  #   rev = "v${version}";
  #   sha256 = "1xdn91xmkzgmvz0xiph123cxh0xj2wdmbbrarxip8zblr0rvphd3";
  # };

  src = fetchgit {
    url = "https://github.com/das-labor/neopg.git";
    rev = "refs/tags/v${version}";
    sha256 = "0hhkl326ff6f76k8pwggpzmivbm13fz497nlyy6ybn5bmi9xfblm";
  };

  buildInputs = with pkgs; [ cmake sqlite botan2 boost164 curl gettext pkgconfig doxygen libusb gnutls ];

  preConfigure = ''
    cd build
    cmake .. -DCMAKE_INSTALL_PREFIX=$out
    cd ..
    echo `pwd`
  '';

  buildPhase = ''
    echo `pwd`
    make
  '';

  postInstall = ''
    mkdir -p $out/bin
    cp src/neopg $out/bin/neopg
  '';
}

I lost interest in it temporarily, but maybe it is of use for anyone.

This is just for building the package. Integration into nixpkgs needs a few more steps.

Mic92 commented 6 years ago

preConfigure and buildPhase actually should be not necessary, since our build hooks are doing the same, if cmake is in buildInputs.

erictapen commented 6 years ago

Aha, thats useful information. Thanks.

erictapen commented 6 years ago

I did a first attempt at https://github.com/NixOS/nixpkgs/pull/37700. At first look, it seems to be right, but if you want to test it:

# Clone nixpkgs with the PR included
nix-shell --pure -p neopg -I nixpkgs=path/to/your/clone/of/nixpkgs

This drops you into a shell, with only neopg being installed.

IIRC there are no man pages to package, am I right?

Mic92 commented 6 years ago

neopg is now available in nixpkgs. This issue can be merged.