2021-01-25 09:26:54 +01:00
|
|
|
{ lib
|
2020-10-16 10:31:31 +02:00
|
|
|
, stdenv
|
2020-09-13 14:07:37 +02:00
|
|
|
, buildGoModule
|
|
|
|
, fetchFromGitHub
|
2021-09-19 16:44:19 +02:00
|
|
|
, fuse
|
|
|
|
, makeWrapper
|
2020-09-13 14:07:37 +02:00
|
|
|
, openssl
|
|
|
|
, pandoc
|
|
|
|
, pkg-config
|
2020-10-16 10:31:31 +02:00
|
|
|
, libfido2
|
2020-09-13 14:07:37 +02:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildGoModule rec {
|
2019-07-11 07:29:36 +02:00
|
|
|
pname = "gocryptfs";
|
2021-10-29 22:20:22 +02:00
|
|
|
version = "2.2.1";
|
2016-11-17 14:15:47 +01:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "rfjakob";
|
2019-07-11 07:29:36 +02:00
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
2021-10-29 22:20:22 +02:00
|
|
|
sha256 = "sha256-qERtX9UcdMolbffzPiVQlblirzJ5baOmHonJIO8ang0=";
|
2016-11-17 14:15:47 +01:00
|
|
|
};
|
|
|
|
|
2021-10-29 22:20:22 +02:00
|
|
|
vendorSha256 = "sha256-yJ7RYwhArgmGlFmSplrX1hiLkc7FkS1qQCUcRlbnNWQ=";
|
2020-10-16 10:31:31 +02:00
|
|
|
|
|
|
|
nativeBuildInputs = [
|
2021-09-19 16:44:19 +02:00
|
|
|
makeWrapper
|
2020-10-16 10:31:31 +02:00
|
|
|
pkg-config
|
|
|
|
pandoc
|
|
|
|
];
|
2020-09-13 14:07:37 +02:00
|
|
|
|
|
|
|
buildInputs = [ openssl ];
|
2016-11-17 14:15:47 +01:00
|
|
|
|
2020-10-16 10:31:31 +02: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
|
|
|
|
2020-09-13 14:07:37 +02:00
|
|
|
subPackages = [ "." "gocryptfs-xray" "contrib/statfs" ];
|
2018-07-06 00:18:36 +02:00
|
|
|
|
2021-09-05 22:09:29 +02:00
|
|
|
postBuild = ''
|
2020-09-13 14:07:37 +02:00
|
|
|
pushd Documentation/
|
2018-07-06 00:18:36 +02:00
|
|
|
mkdir -p $out/share/man/man1
|
2020-10-16 10:31:31 +02:00
|
|
|
# taken from Documentation/MANPAGE-render.bash
|
2018-07-06 00:18:36 +02:00
|
|
|
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
|
2020-09-13 14:07:37 +02:00
|
|
|
pandoc MANPAGE-STATFS.md -s -t man -o $out/share/man/man1/statfs.1
|
2018-07-06 00:18:36 +02:00
|
|
|
popd
|
|
|
|
'';
|
|
|
|
|
2021-09-30 17:52:42 +02:00
|
|
|
# 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
|
2021-09-19 16:44:19 +02:00
|
|
|
postInstall = ''
|
|
|
|
wrapProgram $out/bin/gocryptfs \
|
2021-09-30 17:52:42 +02:00
|
|
|
--suffix PATH : ${lib.makeBinPath [ fuse ]}
|
2021-09-19 16:44:19 +02:00
|
|
|
ln -s $out/bin/gocryptfs $out/bin/mount.fuse.gocryptfs
|
|
|
|
'';
|
|
|
|
|
2021-01-11 08:54:33 +01:00
|
|
|
meta = with lib; {
|
2016-11-17 14:15:47 +01:00
|
|
|
description = "Encrypted overlay filesystem written in Go";
|
|
|
|
license = licenses.mit;
|
2020-04-01 03:11:51 +02:00
|
|
|
homepage = "https://nuetzlich.net/gocryptfs/";
|
2020-09-13 14:07:37 +02:00
|
|
|
maintainers = with maintainers; [ flokli offline prusnak ];
|
2018-07-06 00:18:36 +02:00
|
|
|
platforms = platforms.unix;
|
2016-11-17 14:15:47 +01:00
|
|
|
};
|
|
|
|
}
|