Merge pull request #230406 from dit7ya/mox

mox: init at 0.0.5
This commit is contained in:
Nikolay Korotkiy 2023-07-22 12:16:46 +04:00 committed by GitHub
commit 6e242f7615
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 81 additions and 0 deletions

View File

@ -0,0 +1,34 @@
{ lib
, buildGoModule
, fetchFromGitHub
}:
buildGoModule rec {
pname = "mox";
version = "0.0.5";
src = fetchFromGitHub {
owner = "mjl-";
repo = "mox";
rev = "v${version}";
hash = "sha256-f5/K6cPqJJkbdiVCNGOTd9Fjx2/gvSZCxeR6nnEaeJw=";
};
# set the version during buildtime
patches = [ ./version.patch ];
vendorHash = null;
ldflags = [
"-s"
"-w"
"-X github.com/mjl-/mox/moxvar.Version=${version}"
];
meta = {
description = "Modern full-featured open source secure mail server for low-maintenance self-hosted email";
homepage = "https://github.com/mjl-/mox";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ dit7ya ];
};
}

View File

@ -0,0 +1,45 @@
diff --git a/moxvar/version.go b/moxvar/version.go
index 8c6bac8..69b5f7c 100644
--- a/moxvar/version.go
+++ b/moxvar/version.go
@@ -1,38 +1,5 @@
// Package moxvar provides the version number of a mox build.
package moxvar
-import (
- "runtime/debug"
-)
-
-// Version is set at runtime based on the Go module used to build.
-var Version = "(devel)"
-
-func init() {
- buildInfo, ok := debug.ReadBuildInfo()
- if !ok {
- return
- }
- Version = buildInfo.Main.Version
- if Version == "(devel)" {
- var vcsRev, vcsMod string
- for _, setting := range buildInfo.Settings {
- if setting.Key == "vcs.revision" {
- vcsRev = setting.Value
- } else if setting.Key == "vcs.modified" {
- vcsMod = setting.Value
- }
- }
- if vcsRev == "" {
- return
- }
- Version = vcsRev
- switch vcsMod {
- case "false":
- case "true":
- Version += "+modifications"
- default:
- Version += "+unknown"
- }
- }
-}
+// Version is set via a build flag
+var Version string;

View File

@ -6242,6 +6242,8 @@ with pkgs;
mountain-duck = callPackage ../tools/filesystems/mountain-duck { }; mountain-duck = callPackage ../tools/filesystems/mountain-duck { };
mox = callPackage ../servers/mail/mox { };
mozlz4a = callPackage ../tools/compression/mozlz4a { }; mozlz4a = callPackage ../tools/compression/mozlz4a { };
msr-tools = callPackage ../os-specific/linux/msr-tools { }; msr-tools = callPackage ../os-specific/linux/msr-tools { };