nixpkgs/pkgs/tools/filesystems/gocryptfs/default.nix

70 lines
1.7 KiB
Nix
Raw Normal View History

{ lib
, stdenv
, buildGoModule
, fetchFromGitHub
, fuse
, makeWrapper
, openssl
, pandoc
, pkg-config
, libfido2
}:
buildGoModule rec {
pname = "gocryptfs";
2021-08-22 03:36:21 +02:00
version = "2.1";
2016-11-17 14:15:47 +01:00
src = fetchFromGitHub {
owner = "rfjakob";
repo = pname;
rev = "v${version}";
2021-08-22 03:36:21 +02:00
sha256 = "sha256-nACBEOL/vnqxdAGI37k9bxgQKgpi35/tsuCxsQ9I2sw=";
2016-11-17 14:15:47 +01:00
};
2021-08-22 03:36:21 +02:00
vendorSha256 = "sha256-Q/oBT5xdLpgQCIk7KES6c8+BaCQVUIwCwVufl4oTFRs=";
nativeBuildInputs = [
makeWrapper
pkg-config
pandoc
];
buildInputs = [ openssl ];
2016-11-17 14:15:47 +01:00
propagatedBuildInputs = [ libfido2 ];
2021-08-26 08:45:51 +02:00
ldflags = [
"-X main.GitVersion=${version}"
"-X main.GitVersionFuse=[vendored]"
"-X main.BuildDate=unknown"
];
2016-11-17 14:15:47 +01:00
subPackages = [ "." "gocryptfs-xray" "contrib/statfs" ];
postBuild = ''
pushd Documentation/
mkdir -p $out/share/man/man1
# taken from Documentation/MANPAGE-render.bash
pandoc MANPAGE.md -s -t man -o $out/share/man/man1/gocryptfs.1
pandoc MANPAGE-XRAY.md -s -t man -o $out/share/man/man1/gocryptfs-xray.1
pandoc MANPAGE-STATFS.md -s -t man -o $out/share/man/man1/statfs.1
popd
'';
# use --suffix here to ensure we don't shadow /run/wrappers/bin/fusermount,
# as the setuid wrapper is required to use gocryptfs as non-root on NixOS
postInstall = ''
wrapProgram $out/bin/gocryptfs \
--suffix PATH : ${lib.makeBinPath [ fuse ]}
ln -s $out/bin/gocryptfs $out/bin/mount.fuse.gocryptfs
'';
meta = with lib; {
2016-11-17 14:15:47 +01:00
description = "Encrypted overlay filesystem written in Go";
license = licenses.mit;
homepage = "https://nuetzlich.net/gocryptfs/";
maintainers = with maintainers; [ flokli offline prusnak ];
platforms = platforms.unix;
2016-11-17 14:15:47 +01:00
};
}