diff options
Diffstat (limited to 'third_party/overlays')
21 files changed, 792 insertions, 0 deletions
diff --git a/third_party/overlays/dhall/OWNERS b/third_party/overlays/dhall/OWNERS new file mode 100644 index 000000000000..a64022791462 --- /dev/null +++ b/third_party/overlays/dhall/OWNERS @@ -0,0 +1 @@ +Profpatsch diff --git a/third_party/overlays/dhall/default.nix b/third_party/overlays/dhall/default.nix new file mode 100644 index 000000000000..462503599966 --- /dev/null +++ b/third_party/overlays/dhall/default.nix @@ -0,0 +1,30 @@ +{ ... }: + +self: super: + +let + + # binary releases of dhall tools, since the build in nixpkgs is + # broken most of the time. The binaries are also fully static + # builds, instead of the half-static crap that nixpkgs produces. + easy-dhall-nix = + import + (builtins.fetchTarball { + url = "https://github.com/justinwoo/easy-dhall-nix/archive/dce9acbb99776a7f1344db4751d6080380f76f57.tar.gz"; + sha256 = "0ckp6515gfvbxm08yyll87d9vg8sq2l21gwav2npzvwc3xz2lccf"; + }) + { pkgs = self; }; +in +{ + # ATTN: see the haskell overlay for some overrides we need. + + # dhall = easy-dhall-nix.dhall-simple; + # dhall-nix = easy-dhall-nix.dhall-nix-simple; + dhall-bash = easy-dhall-nix.dhall-bash-simple; + dhall-docs = easy-dhall-nix.dhall-docs-simple; + dhall-json = easy-dhall-nix.dhall-json-simple; + dhall-lsp-server = easy-dhall-nix.dhall-lsp-simple; + # not yet in dhall-simple + # dhall-nixpkgs = easy-dhall-nix.dhall-nixpkgs-simple; + dhall-yaml = easy-dhall-nix.dhall-yaml-simple; +} diff --git a/third_party/overlays/ecl-static.nix b/third_party/overlays/ecl-static.nix new file mode 100644 index 000000000000..66579c33abce --- /dev/null +++ b/third_party/overlays/ecl-static.nix @@ -0,0 +1,37 @@ +{ ... }: + +self: super: + +{ + # Statically linked ECL with statically linked dependencies. + # Works quite well, but solving this properly in a nixpkgs + # context will require figuring out cross compilation (for + # pkgsStatic), so we're gonna use this override for now. + # + # Note that ecl-static does mean that we have things + # statically linked against GMP and ECL which are LGPL. + # I believe this should be alright: The way ppl are gonna + # interact with the distributed binaries (i. e. the binary + # cache) is Nix in the depot monorepo, so the separability + # requirement should be satisfied: Source code or overriding + # would be available as ways to swap out the used GMP in the + # program. + # See https://www.gnu.org/licenses/gpl-faq.en.html#LGPLStaticVsDynamic + ecl-static = (super.pkgsMusl.ecl.override { + inherit (self.pkgsStatic) gmp libffi boehmgc; + }).overrideAttrs (drv: rec { + # version must not be changed as it indicates where to find the bundled libs, + # using ecl HEAD is necessary for us since it includes multiple fixes to do + # with bytecode compilation and allows to concatenate fasc files again. + src = self.fetchFromGitLab { + owner = "embeddable-common-lisp"; + repo = "ecl"; + rev = "1c989247c1b0bf1d38a76aec30b9ca5e41afe1e3"; + sha256 = "0bzjqw6m1kk5z5b81yizic347k931msp5lf78x65dcw3fqfwv3xn"; + }; + configureFlags = drv.configureFlags ++ [ + "--disable-shared" + "--with-dffi=no" # will fail at runtime anyways if statically linked + ]; + }); +} diff --git a/third_party/overlays/emacs.nix b/third_party/overlays/emacs.nix new file mode 100644 index 000000000000..341feb501507 --- /dev/null +++ b/third_party/overlays/emacs.nix @@ -0,0 +1,4 @@ +# Emacs overlay from https://github.com/nix-community/emacs-overlay +{ depot, ... }: + +import depot.third_party.sources.emacs-overlay diff --git a/third_party/overlays/haskell/.skip-subtree b/third_party/overlays/haskell/.skip-subtree new file mode 100644 index 000000000000..2a528eaa8a3a --- /dev/null +++ b/third_party/overlays/haskell/.skip-subtree @@ -0,0 +1 @@ +extra-pkgs need to be callPackage-ed diff --git a/third_party/overlays/haskell/OWNERS b/third_party/overlays/haskell/OWNERS new file mode 100644 index 000000000000..5f87d2f27102 --- /dev/null +++ b/third_party/overlays/haskell/OWNERS @@ -0,0 +1,2 @@ +Profpatsch +sterni diff --git a/third_party/overlays/haskell/default.nix b/third_party/overlays/haskell/default.nix new file mode 100644 index 000000000000..9841631e73d4 --- /dev/null +++ b/third_party/overlays/haskell/default.nix @@ -0,0 +1,70 @@ +# Defines an overlay for overriding Haskell packages, for example to +# avoid breakage currently present in nixpkgs or to modify package +# versions. + +{ lib, ... }: + +self: super: # overlay parameters for the nixpkgs overlay + +let + haskellLib = self.haskell.lib.compose; + dhall-source = subdir: pkg: + haskellLib.overrideSrc + { + src = "${super.fetchFromGitHub { + owner = "Profpatsch"; + repo = "dhall-haskell"; + # https://github.com/dhall-lang/dhall-haskell/pull/2426 + rev = "5e3a407d8ac826597d935d8398825a0ca73fc4e9"; + sha256 = "005plj6kgxlkm9npaq07kmsgmiqk50dpwb9li9w1ly4aj1zgfjnd"; + }}/${subdir}"; + } + (haskellLib.overrideCabal { patches = [ ]; } pkg); + + +in +{ + haskellPackages = super.haskellPackages.override { + overrides = hsSelf: hsSuper: { + + ihp-hsx = lib.pipe hsSuper.ihp-hsx [ + (haskellLib.overrideSrc { + version = "1.1.0"; + src = "${self.fetchFromGitHub { + owner = "digitallyinduced"; + repo = "ihp"; + rev = "b5d47963c998ccd779aa5c3d46484338fd621f0d"; + sha256 = "sha256-M22W8VX4sRaeU2yVraR0S2t2VOwWGmoteD/M8TahdoE="; + }}/ihp-hsx"; + }) + haskellLib.doJailbreak + ]; + + # TODO: this is to fix a bug in dhall-nix + dhall = dhall-source "dhall" hsSuper.dhall; + dhall-nix = dhall-source "dhall-nix" hsSuper.dhall-nix; + + pa-prelude = hsSelf.callPackage ./extra-pkgs/pa-prelude-0.1.0.0.nix { }; + pa-error-tree = hsSelf.callPackage ./extra-pkgs/pa-error-tree-0.1.0.0.nix { }; + pa-field-parser = hsSelf.callPackage ./extra-pkgs/pa-field-parser-0.1.0.1.nix { }; + pa-label = hsSelf.callPackage ./extra-pkgs/pa-label-0.1.0.1.nix { }; + pa-pretty = hsSelf.callPackage ./extra-pkgs/pa-pretty-0.1.1.0.nix { }; + pa-json = hsSelf.callPackage ./extra-pkgs/pa-json-0.2.1.0.nix { }; + pa-run-command = hsSelf.callPackage ./extra-pkgs/pa-run-command-0.1.0.0.nix { }; + }; + }; + + haskell = lib.recursiveUpdate super.haskell { + packages.ghc8107 = super.haskell.packages.ghc8107.override { + overrides = hsSelf: hsSuper: { + # TODO(sterni): TODO(grfn): patch xanthous to work with random-fu 0.3.*, + # so we can use GHC 9.0.2 and benefit from upstream binary cache. + random-fu = hsSelf.callPackage ./extra-pkgs/random-fu-0.2.nix { }; + rvar = hsSelf.callPackage ./extra-pkgs/rvar-0.2.nix { }; + + # TODO(grfn): port to brick 1.4 (EventM gains an additional type argument in 1.0) + brick = hsSelf.callPackage ./extra-pkgs/brick-0.73.nix { }; + }; + }; + }; +} diff --git a/third_party/overlays/haskell/extra-pkgs/brick-0.73.nix b/third_party/overlays/haskell/extra-pkgs/brick-0.73.nix new file mode 100644 index 000000000000..c5e2883c751f --- /dev/null +++ b/third_party/overlays/haskell/extra-pkgs/brick-0.73.nix @@ -0,0 +1,70 @@ +{ mkDerivation +, base +, bytestring +, config-ini +, containers +, contravariant +, data-clist +, deepseq +, directory +, dlist +, exceptions +, filepath +, lib +, microlens +, microlens-mtl +, microlens-th +, QuickCheck +, stm +, template-haskell +, text +, text-zipper +, transformers +, unix +, vector +, vty +, word-wrap +}: +mkDerivation { + pname = "brick"; + version = "0.73"; + sha256 = "741c8d0717f0ab5addd5d3acc88cb36d645a0c73907bde509b2fd9d9bc02039c"; + isLibrary = true; + isExecutable = true; + libraryHaskellDepends = [ + base + bytestring + config-ini + containers + contravariant + data-clist + deepseq + directory + dlist + exceptions + filepath + microlens + microlens-mtl + microlens-th + stm + template-haskell + text + text-zipper + transformers + unix + vector + vty + word-wrap + ]; + testHaskellDepends = [ + base + containers + microlens + QuickCheck + vector + vty + ]; + homepage = "https://github.com/jtdaugherty/brick/"; + description = "A declarative terminal user interface library"; + license = lib.licenses.bsd3; +} diff --git a/third_party/overlays/haskell/extra-pkgs/pa-error-tree-0.1.0.0.nix b/third_party/overlays/haskell/extra-pkgs/pa-error-tree-0.1.0.0.nix new file mode 100644 index 000000000000..a38cd4efaace --- /dev/null +++ b/third_party/overlays/haskell/extra-pkgs/pa-error-tree-0.1.0.0.nix @@ -0,0 +1,10 @@ +{ mkDerivation, base, containers, lib, pa-prelude }: +mkDerivation { + pname = "pa-error-tree"; + version = "0.1.0.0"; + sha256 = "f82d3d905e8d9f0d31c81f31c424b9a95c65a8925517ccac92134f410cf8d639"; + libraryHaskellDepends = [ base containers pa-prelude ]; + homepage = "https://github.com/possehl-analytics/pa-hackage"; + description = "Collect a tree of errors and pretty-print"; + license = lib.licenses.bsd3; +} diff --git a/third_party/overlays/haskell/extra-pkgs/pa-field-parser-0.1.0.1.nix b/third_party/overlays/haskell/extra-pkgs/pa-field-parser-0.1.0.1.nix new file mode 100644 index 000000000000..b327340d349a --- /dev/null +++ b/third_party/overlays/haskell/extra-pkgs/pa-field-parser-0.1.0.1.nix @@ -0,0 +1,35 @@ +{ mkDerivation +, aeson +, aeson-better-errors +, attoparsec +, base +, case-insensitive +, containers +, lib +, pa-error-tree +, pa-prelude +, scientific +, semigroupoids +, text +}: +mkDerivation { + pname = "pa-field-parser"; + version = "0.1.0.1"; + sha256 = "e7fd0369898b6993e6e2aaab43e7cc84d173dc2d21eadca1884d2e7a780ad71f"; + libraryHaskellDepends = [ + aeson + aeson-better-errors + attoparsec + base + case-insensitive + containers + pa-error-tree + pa-prelude + scientific + semigroupoids + text + ]; + homepage = "https://github.com/possehl-analytics/pa-hackage"; + description = "“Vertical” parsing of values"; + license = lib.licenses.bsd3; +} diff --git a/third_party/overlays/haskell/extra-pkgs/pa-json-0.2.1.0.nix b/third_party/overlays/haskell/extra-pkgs/pa-json-0.2.1.0.nix new file mode 100644 index 000000000000..4beeba32fe61 --- /dev/null +++ b/third_party/overlays/haskell/extra-pkgs/pa-json-0.2.1.0.nix @@ -0,0 +1,45 @@ +{ mkDerivation +, aeson +, aeson-better-errors +, aeson-pretty +, base +, base64-bytestring +, bytestring +, containers +, hspec-core +, hspec-expectations +, lib +, pa-error-tree +, pa-label +, pa-prelude +, scientific +, text +, time +, vector +}: +mkDerivation { + pname = "pa-json"; + version = "0.2.1.0"; + sha256 = "d0c274fa38c05d38e9c2c15ee9dd4ff3ac369650dbc918c973863457110646c8"; + libraryHaskellDepends = [ + aeson + aeson-better-errors + aeson-pretty + base + base64-bytestring + bytestring + containers + hspec-core + hspec-expectations + pa-error-tree + pa-label + pa-prelude + scientific + text + time + vector + ]; + homepage = "https://github.com/possehl-analytics/pa-hackage"; + description = "Our JSON parsers/encoders"; + license = lib.licenses.bsd3; +} diff --git a/third_party/overlays/haskell/extra-pkgs/pa-label-0.1.0.1.nix b/third_party/overlays/haskell/extra-pkgs/pa-label-0.1.0.1.nix new file mode 100644 index 000000000000..1da78260cc66 --- /dev/null +++ b/third_party/overlays/haskell/extra-pkgs/pa-label-0.1.0.1.nix @@ -0,0 +1,10 @@ +{ mkDerivation, base, lib }: +mkDerivation { + pname = "pa-label"; + version = "0.1.0.1"; + sha256 = "0131ab7718d910a94cd8cc881e51b7371a060dadfeabc8fd78513a7f27ee8d35"; + libraryHaskellDepends = [ base ]; + homepage = "https://github.com/possehl-analytics/pa-hackage"; + description = "Labels, and labelled tuples and enums (GHC >9.2)"; + license = lib.licenses.bsd3; +} diff --git a/third_party/overlays/haskell/extra-pkgs/pa-prelude-0.1.0.0.nix b/third_party/overlays/haskell/extra-pkgs/pa-prelude-0.1.0.0.nix new file mode 100644 index 000000000000..765ed31ba6c3 --- /dev/null +++ b/third_party/overlays/haskell/extra-pkgs/pa-prelude-0.1.0.0.nix @@ -0,0 +1,37 @@ +{ mkDerivation +, base +, bytestring +, containers +, error +, exceptions +, lib +, mtl +, profunctors +, PyF +, semigroupoids +, text +, these +, validation-selective +}: +mkDerivation { + pname = "pa-prelude"; + version = "0.1.0.0"; + sha256 = "554556e3acbf7154131ed05209d803a19d6aa1c7d675fcb10501de50869c49ab"; + libraryHaskellDepends = [ + base + bytestring + containers + error + exceptions + mtl + profunctors + PyF + semigroupoids + text + these + validation-selective + ]; + homepage = "https://github.com/possehl-analytics/pa-hackage"; + description = "The Possehl Analytics Prelude"; + license = lib.licenses.bsd3; +} diff --git a/third_party/overlays/haskell/extra-pkgs/pa-pretty-0.1.1.0.nix b/third_party/overlays/haskell/extra-pkgs/pa-pretty-0.1.1.0.nix new file mode 100644 index 000000000000..d6dadef849a1 --- /dev/null +++ b/third_party/overlays/haskell/extra-pkgs/pa-pretty-0.1.1.0.nix @@ -0,0 +1,29 @@ +{ mkDerivation +, aeson +, aeson-pretty +, ansi-terminal +, base +, hscolour +, lib +, nicify-lib +, pa-prelude +, text +}: +mkDerivation { + pname = "pa-pretty"; + version = "0.1.1.0"; + sha256 = "da925a7cf2ac49c5769d7ebd08c2599b537efe45b3d506bf4d7c8673633ef6c9"; + libraryHaskellDepends = [ + aeson + aeson-pretty + ansi-terminal + base + hscolour + nicify-lib + pa-prelude + text + ]; + homepage = "https://github.com/possehl-analytics/pa-hackage"; + description = "Some pretty-printing helpers"; + license = lib.licenses.bsd3; +} diff --git a/third_party/overlays/haskell/extra-pkgs/pa-run-command-0.1.0.0.nix b/third_party/overlays/haskell/extra-pkgs/pa-run-command-0.1.0.0.nix new file mode 100644 index 000000000000..b12eb5efbf5f --- /dev/null +++ b/third_party/overlays/haskell/extra-pkgs/pa-run-command-0.1.0.0.nix @@ -0,0 +1,25 @@ +{ mkDerivation +, base +, bytestring +, lib +, monad-logger +, pa-prelude +, text +, typed-process +}: +mkDerivation { + pname = "pa-run-command"; + version = "0.1.0.0"; + sha256 = "37837e0cddedc9b615063f0357115739c53b5dcb8af82ce86a95a3a5c88c29a3"; + libraryHaskellDepends = [ + base + bytestring + monad-logger + pa-prelude + text + typed-process + ]; + homepage = "https://github.com/possehl-analytics/pa-hackage"; + description = "Helper functions for spawning subprocesses"; + license = lib.licenses.bsd3; +} diff --git a/third_party/overlays/haskell/extra-pkgs/random-fu-0.2.nix b/third_party/overlays/haskell/extra-pkgs/random-fu-0.2.nix new file mode 100644 index 000000000000..1626eca7be4b --- /dev/null +++ b/third_party/overlays/haskell/extra-pkgs/random-fu-0.2.nix @@ -0,0 +1,41 @@ +{ mkDerivation +, base +, erf +, lib +, math-functions +, monad-loops +, mtl +, random +, random-shuffle +, random-source +, rvar +, syb +, template-haskell +, transformers +, vector +}: +mkDerivation { + pname = "random-fu"; + version = "0.2.7.7"; + sha256 = "8466bcfb5290bdc30a571c91e1eb526c419ea9773bc118996778b516cfc665ca"; + revision = "1"; + editedCabalFile = "16nhymfriygqr2by9v72vdzv93v6vhd9z07pgaji4zvv66jikv82"; + libraryHaskellDepends = [ + base + erf + math-functions + monad-loops + mtl + random + random-shuffle + random-source + rvar + syb + template-haskell + transformers + vector + ]; + homepage = "https://github.com/mokus0/random-fu"; + description = "Random number generation"; + license = lib.licenses.publicDomain; +} diff --git a/third_party/overlays/haskell/extra-pkgs/rvar-0.2.nix b/third_party/overlays/haskell/extra-pkgs/rvar-0.2.nix new file mode 100644 index 000000000000..c00f5a1a8d9b --- /dev/null +++ b/third_party/overlays/haskell/extra-pkgs/rvar-0.2.nix @@ -0,0 +1,25 @@ +{ mkDerivation +, base +, lib +, MonadPrompt +, mtl +, random-source +, transformers +}: +mkDerivation { + pname = "rvar"; + version = "0.2.0.6"; + sha256 = "01e18875ffde43f9591a8acd9f60c9c51704a026e51c1a6797faecd1c7ae8cd3"; + revision = "1"; + editedCabalFile = "1jn9ivlj3k65n8d9sfsp882m5lvni1ah79mk0cvkz91pgywvkiyq"; + libraryHaskellDepends = [ + base + MonadPrompt + mtl + random-source + transformers + ]; + homepage = "https://github.com/mokus0/random-fu"; + description = "Random Variables"; + license = lib.licenses.publicDomain; +} diff --git a/third_party/overlays/patches/buf-tests-dont-use-file-transport.patch b/third_party/overlays/patches/buf-tests-dont-use-file-transport.patch new file mode 100644 index 000000000000..34be80eb361d --- /dev/null +++ b/third_party/overlays/patches/buf-tests-dont-use-file-transport.patch @@ -0,0 +1,64 @@ +commit e9219b88de5ed37af337ee2d2e71e7ec7c0aad1b +Author: Robbert van Ginkel <rvanginkel@buf.build> +Date: Thu Oct 20 16:43:28 2022 -0400 + + Fix git unit test by using fake git server rather than file:// (#1518) + + More recent versions of git fix a CVE by disabling some usage of the + `file://` transport, see + https://github.blog/2022-10-18-git-security-vulnerabilities-announced/#cve-2022-39253. + We were using this transport in tests. + + Instead, use https://git-scm.com/docs/git-http-backend to serve up this + repository locally so we don't have to use the file protocol. This + should be a more accurate tests, since we mostly expect submodules to + come from servers. + +diff --git a/.golangci.yml b/.golangci.yml +index 318d1171..865e03e7 100644 +--- a/.golangci.yml ++++ b/.golangci.yml +@@ -136,3 +136,8 @@ issues: + - linters: + - containedctx + path: private/bufpkg/bufmodule/bufmoduleprotocompile ++ # We should be able to use net/http/cgi in a unit test, in addition the CVE mentions only versions of go < 1.6.3 are affected. ++ - linters: ++ - gosec ++ path: private/pkg/git/git_test.go ++ text: "G504:" +diff --git a/private/pkg/git/git_test.go b/private/pkg/git/git_test.go +index 7b77b6cd..7132054e 100644 +--- a/private/pkg/git/git_test.go ++++ b/private/pkg/git/git_test.go +@@ -17,6 +17,8 @@ package git + import ( + "context" + "errors" ++ "net/http/cgi" ++ "net/http/httptest" + "os" + "os/exec" + "path/filepath" +@@ -213,6 +215,21 @@ func createGitDirs( + runCommand(ctx, t, container, runner, "git", "-C", submodulePath, "add", "test.proto") + runCommand(ctx, t, container, runner, "git", "-C", submodulePath, "commit", "-m", "commit 0") + ++ gitExecPath, err := command.RunStdout(ctx, container, runner, "git", "--exec-path") ++ require.NoError(t, err) ++ t.Log(filepath.Join(string(gitExecPath), "git-http-backend")) ++ // https://git-scm.com/docs/git-http-backend#_description ++ f, err := os.Create(filepath.Join(submodulePath, ".git", "git-daemon-export-ok")) ++ require.NoError(t, err) ++ require.NoError(t, f.Close()) ++ server := httptest.NewServer(&cgi.Handler{ ++ Path: filepath.Join(strings.TrimSpace(string(gitExecPath)), "git-http-backend"), ++ Dir: submodulePath, ++ Env: []string{"GIT_PROJECT_ROOT=" + submodulePath}, ++ }) ++ t.Cleanup(server.Close) ++ submodulePath = server.URL ++ + originPath := filepath.Join(tmpDir, "origin") + require.NoError(t, os.MkdirAll(originPath, 0777)) + runCommand(ctx, t, container, runner, "git", "-C", originPath, "init") diff --git a/third_party/overlays/patches/evans-add-support-for-unix-domain-sockets.patch b/third_party/overlays/patches/evans-add-support-for-unix-domain-sockets.patch new file mode 100644 index 000000000000..c66528f53880 --- /dev/null +++ b/third_party/overlays/patches/evans-add-support-for-unix-domain-sockets.patch @@ -0,0 +1,39 @@ +From 55d7e7af7c56f678eb817059417241bb61ee5181 Mon Sep 17 00:00:00 2001 +From: Florian Klink <flokli@flokli.de> +Date: Sun, 8 Oct 2023 11:00:27 +0200 +Subject: [PATCH] add support for unix domain sockets + +grpc.NewClient already supports connecting to unix domain sockets, and +accepts a string anyways. + +As a quick fix, detect the `address` starting with `unix://` and don't +add the port. + +In the long term, we might want to deprecate `host` and `port` cmdline +args in favor of a single `address` arg. +--- + mode/common.go | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/mode/common.go b/mode/common.go +index dfc7839..55f1e36 100644 +--- a/mode/common.go ++++ b/mode/common.go +@@ -13,7 +13,13 @@ import ( + ) + + func newGRPCClient(cfg *config.Config) (grpc.Client, error) { +- addr := fmt.Sprintf("%s:%s", cfg.Server.Host, cfg.Server.Port) ++ addr := cfg.Server.Host ++ ++ // as long as the address doesn't start with unix, also add the port. ++ if !strings.HasPrefix(cfg.Server.Host, "unix://") { ++ addr = fmt.Sprintf("%s:%s", cfg.Server.Host, cfg.Server.Port) ++ } ++ + if cfg.Request.Web { + //TODO: remove second arg + return grpc.NewWebClient(addr, cfg.Server.Reflection, false, "", "", "", grpc.Headers(cfg.Request.Header)), nil +-- +2.42.0 + diff --git a/third_party/overlays/patches/notmuch-dottime.patch b/third_party/overlays/patches/notmuch-dottime.patch new file mode 100644 index 000000000000..7a9cfc6cc2a9 --- /dev/null +++ b/third_party/overlays/patches/notmuch-dottime.patch @@ -0,0 +1,81 @@ +From 569438172fa0e38129de4e61a72e06eff3330dca Mon Sep 17 00:00:00 2001 +From: Vincent Ambo <tazjin@google.com> +Date: Thu, 10 Dec 2020 10:53:47 +0100 +Subject: [PATCH] time: Use dottime for formatting non-relative timestamps + +--- + notmuch-time.c | 10 +++++----- + util/gmime-extra.c | 7 +++++-- + util/gmime-extra.h | 2 ++ + 3 files changed, 12 insertions(+), 7 deletions(-) + +diff --git a/notmuch-time.c b/notmuch-time.c +index cc7ffc23..3030a667 100644 +--- a/notmuch-time.c ++++ b/notmuch-time.c +@@ -50,8 +50,8 @@ notmuch_time_relative_date (const void *ctx, time_t then) + time_t delta; + char *result; + +- localtime_r (&now, &tm_now); +- localtime_r (&then, &tm_then); ++ gmtime_r (&now, &tm_now); ++ gmtime_r (&then, &tm_then); + + result = talloc_zero_size (ctx, RELATIVE_DATE_MAX); + if (result == NULL) +@@ -78,16 +78,16 @@ notmuch_time_relative_date (const void *ctx, time_t then) + if (tm_then.tm_wday == tm_now.tm_wday && + delta < DAY) { + strftime (result, RELATIVE_DATE_MAX, +- "Today %R", &tm_then); /* Today 12:30 */ ++ "Today %k·%M", &tm_then); /* Today 12·30 */ + return result; + } else if ((tm_now.tm_wday + 7 - tm_then.tm_wday) % 7 == 1) { + strftime (result, RELATIVE_DATE_MAX, +- "Yest. %R", &tm_then); /* Yest. 12:30 */ ++ "Yest. %k·%M", &tm_then); /* Yest. 12·30 */ + return result; + } else { + if (tm_then.tm_wday != tm_now.tm_wday) { + strftime (result, RELATIVE_DATE_MAX, +- "%a. %R", &tm_then); /* Mon. 12:30 */ ++ "%a. %k·%M", &tm_then); /* Mon. 12·30 */ + return result; + } + } +diff --git a/util/gmime-extra.c b/util/gmime-extra.c +index 04d8ed3d..868a2f69 100644 +--- a/util/gmime-extra.c ++++ b/util/gmime-extra.c +@@ -131,10 +131,13 @@ g_mime_message_get_date_string (void *ctx, GMimeMessage *message) + GDateTime *parsed_date = g_mime_message_get_date (message); + + if (parsed_date) { +- char *date = g_mime_utils_header_format_date (parsed_date); ++ char *date = g_date_time_format( ++ parsed_date, ++ "%a, %d %b %Y %H·%M%z" ++ ); + return g_string_talloc_strdup (ctx, date); + } else { +- return talloc_strdup (ctx, "Thu, 01 Jan 1970 00:00:00 +0000"); ++ return talloc_strdup (ctx, "Thu, 01 Jan 1970 00·00:00"); + } + } + +diff --git a/util/gmime-extra.h b/util/gmime-extra.h +index 094309ec..e6c98f8d 100644 +--- a/util/gmime-extra.h ++++ b/util/gmime-extra.h +@@ -1,5 +1,7 @@ + #ifndef _GMIME_EXTRA_H + #define _GMIME_EXTRA_H ++#include <glib.h> ++#include <glib/gprintf.h> + #include <gmime/gmime.h> + #include <talloc.h> + +-- +2.29.2.576.ga3fc446d84-goog + diff --git a/third_party/overlays/tvl.nix b/third_party/overlays/tvl.nix new file mode 100644 index 000000000000..c88bd4d74176 --- /dev/null +++ b/third_party/overlays/tvl.nix @@ -0,0 +1,136 @@ +# This overlay is used to make TVL-specific modifications in the +# nixpkgs tree, where required. +{ lib, depot, localSystem, ... }: + +self: super: +let + # Rollback Nix to a stable version (2.3) with backports for + # build-user problems applied. + nixSrc = + let + # branch 2.3-backport-await-users + rev = "46a91f2abaee85135cbb447c13957d3c5e9091a9"; + in + self.fetchFromGitHub + { + owner = "tvlfyi"; + repo = "nix"; + inherit rev; + hash = "sha256:0rwyrh471c5y64axyd8vzzzmzlscg97fsrjbgbm1a93wnzxcvnvk"; + } // { revCount = 0; shortRev = builtins.substring 0 7 rev; }; + + nixTarball = (scopedImport + { + # The tarball job always uses currentSystem which we need to purify + builtins = builtins // { currentSystem = localSystem; }; + } + "${nixSrc}/release.nix" + { + nix = nixSrc; + nixpkgs = self.path; + systems = [ ]; + } + ).tarball; +in +depot.nix.readTree.drvTargets { + nix_2_3 = super.nix_2_3.overrideAttrs (_: { + src = "${nixTarball}/tarballs/nix-${nixTarball.version}.tar.xz"; + }); + nix = self.nix_2_3; + nix_latest = super.nix; + + # To match telega in emacs-overlay or wherever + tdlib = super.tdlib.overrideAttrs (_: { + version = "1.8.16"; + src = self.fetchFromGitHub { + owner = "tdlib"; + repo = "td"; + rev = "cde095db6c75827fe4bd237039574aad373ad96b"; + sha256 = "1zzacz2mhjmc36aqdc5v8a7zdi0mi7k8hnrnpj9gii061pm4vx4v"; + }; + }); + + home-manager = super.home-manager.overrideAttrs (_: { + src = depot.third_party.sources.home-manager; + version = "git-" + + builtins.substring 0 7 depot.third_party.sources.home-manager.rev; + }); + + clang-tools_11 = self.clang-tools.override { + llvmPackages = self.llvmPackages_11; + }; + + # stdenv which uses clang, lld and libc++; full is a slight exaggeration, + # we for example don't use LLVM's libunwind + fullLlvm11Stdenv = self.overrideCC self.stdenv + (self.llvmPackages_11.libcxxStdenv.cc.override { + inherit (self.llvmPackages_11) bintools; + }); + + # Add our Emacs packages to the fixpoint + emacsPackagesFor = emacs: ( + (super.emacsPackagesFor emacs).overrideScope' (eself: esuper: { + tvlPackages = depot.tools.emacs-pkgs // depot.third_party.emacs; + + # Use the notmuch from nixpkgs instead of from the Emacs + # overlay, to avoid versions being out of sync. + notmuch = super.notmuch.emacs; + + # Build EXWM with the depot sources instead. + depotExwm = esuper.exwm.overrideAttrs (_: { + src = depot.path.origSrc + "/third_party/exwm"; + }); + + # Workaround for magit checking the git version at load time + magit = esuper.magit.overrideAttrs (_: { + propagatedNativeBuildInputs = [ + self.git + ]; + }); + }) + ); + + # dottime support for notmuch + notmuch = super.notmuch.overrideAttrs (old: { + passthru = old.passthru // { + patches = old.patches ++ [ ./patches/notmuch-dottime.patch ]; + }; + }); + + # nix-serve does not work with nix 2.4 + # https://github.com/edolstra/nix-serve/issues/28 + nix-serve = super.nix-serve.override { nix = self.nix_2_3; }; + + # Avoid builds of mkShell derivations in CI. + mkShell = super.lib.makeOverridable (args: (super.mkShell args).overrideAttrs (_: { + passthru = { + meta.ci.skip = true; + }; + })); + + # Pin a newer version of crate2nix from git, which is not officially + # released but supports `dep:` and conditional features + crate2nix = super.crate2nix.overrideAttrs (old: rec { + version = "unstable-2023-09-26"; + + src = self.fetchFromGitHub { + owner = "nix-community"; + repo = "crate2nix"; + rev = "8a33aec8795dcc98afbb0cd1030bb1c939ede211"; + hash = "sha256-eFT2SUxTopxEvW0rcxSjQU6nbrQLI2FbyaVgtV8oiTk="; + }; + + cargoDeps = old.cargoDeps.overrideAttrs (_: { + inherit src; + outputHash = "sha256-elEIWHxyY3iccprIcbQA6GWFiq/n5kozpGfw/OmoSIg="; + }); + }); + + evans = super.evans.overrideAttrs (old: { + patches = old.patches or [ ] ++ [ + # add support for unix domain sockets + # https://github.com/ktr0731/evans/pull/680 + ./patches/evans-add-support-for-unix-domain-sockets.patch + ]; + }); +} |