diff options
Diffstat (limited to 'third_party/overlays')
-rw-r--r-- | third_party/overlays/dhall/OWNERS | 1 | ||||
-rw-r--r-- | third_party/overlays/dhall/default.nix | 30 | ||||
-rw-r--r-- | third_party/overlays/ecl-static.nix | 37 | ||||
-rw-r--r-- | third_party/overlays/emacs.nix | 4 | ||||
-rw-r--r-- | third_party/overlays/haskell/.skip-subtree | 1 | ||||
-rw-r--r-- | third_party/overlays/haskell/default.nix | 48 | ||||
-rw-r--r-- | third_party/overlays/haskell/extra-pkgs/brick-0.73.nix | 70 | ||||
-rw-r--r-- | third_party/overlays/haskell/extra-pkgs/random-fu-0.2.nix | 41 | ||||
-rw-r--r-- | third_party/overlays/haskell/extra-pkgs/rvar-0.2.nix | 25 | ||||
-rw-r--r-- | third_party/overlays/patches/buf-tests-dont-use-file-transport.patch | 64 | ||||
-rw-r--r-- | third_party/overlays/patches/notmuch-dottime.patch | 81 | ||||
-rw-r--r-- | third_party/overlays/tvl.nix | 128 |
12 files changed, 530 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/default.nix b/third_party/overlays/haskell/default.nix new file mode 100644 index 000000000000..8c4871fb084a --- /dev/null +++ b/third_party/overlays/haskell/default.nix @@ -0,0 +1,48 @@ +# 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: { + # 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; + }; + }; + + 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/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/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..3163a95db301 --- /dev/null +++ b/third_party/overlays/tvl.nix @@ -0,0 +1,128 @@ +# This overlay is used to make TVL-specific modifications in the +# nixpkgs tree, where required. +{ 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; + + # Too match telega in emacs-overlay or wherever + tdlib = super.tdlib.overrideAttrs (_: { + version = "1.8.12"; + src = self.fetchFromGitHub { + owner = "tdlib"; + repo = "td"; + rev = "70bee089d492437ce931aa78446d89af3da182fc"; + sha256 = "1m1mnvrk9nr3d3sq191i5y1bdgnp1hnq0c6iqybzmyswr501prz3"; + }; + }); + + 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. + exwm = 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:` + crate2nix = super.crate2nix.overrideAttrs (old: rec { + version = "0.11.0-rc.1"; + + src = self.fetchFromGitHub { + owner = "kolloch"; + repo = "crate2nix"; + rev = "v0.11.0-rc.1"; + hash = "sha256:02yvn61w16sgkdxa019l5y9i2ybyk8h4516718gmarqxx5ws2kz8"; + }; + + cargoDeps = old.cargoDeps.overrideAttrs (_: { + inherit src; + outputHash = "sha256:03yny9ikqzfpi2mr27r82g54an2s8k9lqi2i4fqalg7g0s2cr2yd"; + }); + }); +} |