nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 buildGoModule,
4 fetchFromGitHub,
5 installShellFiles,
6 nixosTests,
7}:
8
9buildGoModule rec {
10 pname = "sftpgo";
11 version = "2.6.6";
12
13 src = fetchFromGitHub {
14 owner = "drakkan";
15 repo = "sftpgo";
16 tag = "v${version}";
17 hash = "sha256-SembD+BM5Zetexh0iLTfrq/I1tz2BCwGUn6OyFeTHF4=";
18 };
19
20 vendorHash = "sha256-7hS4E7PXlydHFi4ul5+hyUPOvozialXW/m1tDLqbQUs=";
21
22 ldflags = [
23 "-s"
24 "-w"
25 "-X github.com/drakkan/sftpgo/v2/internal/version.commit=${src.rev}"
26 "-X github.com/drakkan/sftpgo/v2/internal/version.date=1970-01-01T00:00:00Z"
27 ];
28
29 nativeBuildInputs = [ installShellFiles ];
30
31 doCheck = false;
32
33 subPackages = [ "." ];
34
35 postInstall = ''
36 $out/bin/sftpgo gen man
37 installManPage man/*.1
38
39 installShellCompletion --cmd sftpgo \
40 --bash <($out/bin/sftpgo gen completion bash) \
41 --zsh <($out/bin/sftpgo gen completion zsh) \
42 --fish <($out/bin/sftpgo gen completion fish)
43
44 shareDirectory="$out/share/sftpgo"
45 mkdir -p "$shareDirectory"
46 cp -r ./{openapi,static,templates} "$shareDirectory"
47 '';
48
49 passthru.tests = nixosTests.sftpgo;
50
51 meta = {
52 homepage = "https://github.com/drakkan/sftpgo";
53 changelog = "https://github.com/drakkan/sftpgo/releases/tag/v${version}";
54 description = "Fully featured and highly configurable SFTP server";
55 longDescription = ''
56 Fully featured and highly configurable SFTP server
57 with optional HTTP/S, FTP/S and WebDAV support.
58 Several storage backends are supported:
59 local filesystem, encrypted local filesystem, S3 (compatible) Object Storage,
60 Google Cloud Storage, Azure Blob Storage, SFTP.
61 '';
62 license = with lib.licenses; [
63 agpl3Only
64 unfreeRedistributable
65 ]; # Software is AGPLv3, web UI is unfree
66 maintainers = with lib.maintainers; [
67 thenonameguy
68 ryan4yin
69 ];
70 mainProgram = "sftpgo";
71 };
72}