From c0a3fd18ca2a8be9b45071ae4c7f22dc47cdce9b Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Sun, 7 Mar 2021 13:39:06 +0100 Subject: [PATCH 1/3] hercules-ci-agent: Fix and update build --- .../haskell-modules/configuration-common.nix | 16 ++++++++++++++-- .../hercules-ci-agent/default.nix | 6 ++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/pkgs/development/haskell-modules/configuration-common.nix b/pkgs/development/haskell-modules/configuration-common.nix index eb849342ec8d..3d2676df1264 100644 --- a/pkgs/development/haskell-modules/configuration-common.nix +++ b/pkgs/development/haskell-modules/configuration-common.nix @@ -1518,8 +1518,20 @@ self: super: { # Upstream issue: https://github.com/haskell-servant/servant-swagger/issues/129 servant-swagger = dontCheck super.servant-swagger; - # 2020-11-27: cxx-options is broken in Cabal 3.2.0.0 - hercules-ci-agent = addSetupDepend super.hercules-ci-agent self.Cabal_3_2_1_0; + hercules-ci-agent = super.hercules-ci-agent.override { + cachix = + # https://github.com/cachix/cachix/pull/361 + (appendPatch + (addBuildDepend super.cachix super.hercules-ci-cnix-store) + (pkgs.fetchpatch { + name = "cachix-361.patch"; + url = "https://patch-diff.githubusercontent.com/raw/cachix/cachix/pull/361.patch"; + sha256 = "0wwlcpmnqmvk1css5f723dzgjvg4jr7i58ifhni5zg9h5iwycdfr"; + stripLen = 1; + includes = ["*.cabal" "*.hs"]; + }) + ); + }; # 2020-12-05: http-client is fixed on too old version essence-of-live-coding-warp = super.essence-of-live-coding-warp.override { diff --git a/pkgs/development/tools/continuous-integration/hercules-ci-agent/default.nix b/pkgs/development/tools/continuous-integration/hercules-ci-agent/default.nix index c8316f4bb571..ccb8b4eba656 100644 --- a/pkgs/development/tools/continuous-integration/hercules-ci-agent/default.nix +++ b/pkgs/development/tools/continuous-integration/hercules-ci-agent/default.nix @@ -1,7 +1,9 @@ -{ gnutar, gzip, git, haskell, haskellPackages, lib, makeWrapper }: +{ gnutar, gzip, git, haskell, haskellPackages, lib, makeWrapper, runc, stdenv }: let inherit (haskell.lib) overrideCabal addBuildDepends; inherit (lib) makeBinPath; + bundledBins = [ gnutar gzip git ] ++ lib.optional stdenv.isLinux runc; + pkg = # justStaticExecutables is needed due to https://github.com/NixOS/nix/issues/2990 overrideCabal @@ -11,7 +13,7 @@ let ${o.postInstall or ""} mkdir -p $out/libexec mv $out/bin/hercules-ci-agent $out/libexec - makeWrapper $out/libexec/hercules-ci-agent $out/bin/hercules-ci-agent --prefix PATH : ${makeBinPath [ gnutar gzip git ]} + makeWrapper $out/libexec/hercules-ci-agent $out/bin/hercules-ci-agent --prefix PATH : ${makeBinPath bundledBins} ''; }); in pkg // { From fdfbd17b70726172bcb3c43d2a1e6d9fbc725865 Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Sun, 7 Mar 2021 13:40:17 +0100 Subject: [PATCH 2/3] hci: init at 0.1.0 --- .../haskell-modules/configuration-common.nix | 5 ++++ .../haskell-modules/non-hackage-packages.nix | 4 ++++ .../hercules-ci-optparse-applicative.nix | 21 +++++++++++++++++ .../continuous-integration/hci/default.nix | 23 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 ++ 5 files changed, 55 insertions(+) create mode 100644 pkgs/development/misc/haskell/hercules-ci-optparse-applicative.nix create mode 100644 pkgs/development/tools/continuous-integration/hci/default.nix diff --git a/pkgs/development/haskell-modules/configuration-common.nix b/pkgs/development/haskell-modules/configuration-common.nix index 3d2676df1264..7a3efeaa9e93 100644 --- a/pkgs/development/haskell-modules/configuration-common.nix +++ b/pkgs/development/haskell-modules/configuration-common.nix @@ -1533,6 +1533,11 @@ self: super: { ); }; + hercules-ci-cli = generateOptparseApplicativeCompletion "hci" ( + # See hercules-ci-optparse-applicative in non-hackage-packages.nix. + addBuildDepend (unmarkBroken super.hercules-ci-cli) super.hercules-ci-optparse-applicative + ); + # 2020-12-05: http-client is fixed on too old version essence-of-live-coding-warp = super.essence-of-live-coding-warp.override { http-client = self.http-client_0_7_6; diff --git a/pkgs/development/haskell-modules/non-hackage-packages.nix b/pkgs/development/haskell-modules/non-hackage-packages.nix index 4d66478f338d..86123d8a70f4 100644 --- a/pkgs/development/haskell-modules/non-hackage-packages.nix +++ b/pkgs/development/haskell-modules/non-hackage-packages.nix @@ -28,4 +28,8 @@ self: super: { graphql-parser = self.callPackage ../misc/haskell/hasura/graphql-parser {}; # cabal2nix --subpath server --maintainer offline --no-check --revision 1.2.1 https://github.com/hasura/graphql-engine.git graphql-engine = self.callPackage ../misc/haskell/hasura/graphql-engine {}; + + # Unofficial fork until PRs are merged https://github.com/pcapriotti/optparse-applicative/pulls/roberth + # cabal2nix --maintainer roberth https://github.com/hercules-ci/optparse-applicative.git > pkgs/development/misc/haskell/hercules-ci-optparse-applicative.nix + hercules-ci-optparse-applicative = self.callPackage ../misc/haskell/hercules-ci-optparse-applicative.nix {}; } diff --git a/pkgs/development/misc/haskell/hercules-ci-optparse-applicative.nix b/pkgs/development/misc/haskell/hercules-ci-optparse-applicative.nix new file mode 100644 index 000000000000..7f49430c15c3 --- /dev/null +++ b/pkgs/development/misc/haskell/hercules-ci-optparse-applicative.nix @@ -0,0 +1,21 @@ +{ mkDerivation, ansi-wl-pprint, base, fetchgit, lib, process, QuickCheck +, transformers, transformers-compat +}: +mkDerivation { + pname = "hercules-ci-optparse-applicative"; + version = "0.16.1.0"; + src = fetchgit { + url = "https://github.com/hercules-ci/optparse-applicative.git"; + sha256 = "0v0r11jaav95im82if976256kncp0ji7nfdrlpbgmwxnkj1hxl48"; + rev = "f9d1242f9889d2e09ff852db9dc2d231d9a3e8d8"; + fetchSubmodules = true; + }; + libraryHaskellDepends = [ + ansi-wl-pprint base process transformers transformers-compat + ]; + testHaskellDepends = [ base QuickCheck ]; + homepage = "https://github.com/hercules-ci/optparse-applicative"; + description = "Utilities and combinators for parsing command line options (fork)"; + license = lib.licenses.bsd3; + maintainers = with lib.maintainers; [ roberth ]; +} diff --git a/pkgs/development/tools/continuous-integration/hci/default.nix b/pkgs/development/tools/continuous-integration/hci/default.nix new file mode 100644 index 000000000000..dfca0c4d388e --- /dev/null +++ b/pkgs/development/tools/continuous-integration/hci/default.nix @@ -0,0 +1,23 @@ +{ haskell, haskellPackages, lib, makeWrapper, runc, stdenv }: +let + inherit (haskell.lib) overrideCabal addBuildDepends; + inherit (lib) makeBinPath; + bundledBins = lib.optional stdenv.isLinux runc; + + pkg = + # justStaticExecutables is needed due to https://github.com/NixOS/nix/issues/2990 + overrideCabal + (addBuildDepends (haskell.lib.justStaticExecutables haskellPackages.hercules-ci-cli) [ makeWrapper ]) + (o: { + postInstall = '' + ${o.postInstall or ""} + mkdir -p $out/libexec + mv $out/bin/hci $out/libexec + makeWrapper $out/libexec/hci $out/bin/hci --prefix PATH : ${makeBinPath bundledBins} + ''; + }); +in pkg // { + meta = pkg.meta // { + position = toString ./default.nix + ":1"; + }; + } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index df8a55a35251..e163b5c36596 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -13452,6 +13452,8 @@ in hercules-ci-agent = callPackage ../development/tools/continuous-integration/hercules-ci-agent { }; + hci = callPackage ../development/tools/continuous-integration/hci { }; + niv = lib.getBin (haskell.lib.justStaticExecutables haskellPackages.niv); ormolu = haskellPackages.ormolu.bin; From abfbcb13bc88b22bbc3801fec3a04b06ca035015 Mon Sep 17 00:00:00 2001 From: Robert Hensing Date: Sun, 7 Mar 2021 13:55:30 +0100 Subject: [PATCH 3/3] haskellPackages: Add packages maintained by roberth --- .../haskell-modules/configuration-hackage2nix.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkgs/development/haskell-modules/configuration-hackage2nix.yaml b/pkgs/development/haskell-modules/configuration-hackage2nix.yaml index 73794191f9d6..d698264f6bb6 100644 --- a/pkgs/development/haskell-modules/configuration-hackage2nix.yaml +++ b/pkgs/development/haskell-modules/configuration-hackage2nix.yaml @@ -2785,8 +2785,12 @@ package-maintainers: roberth: - arion-compose - hercules-ci-agent + - hercules-ci-api - hercules-ci-api-agent - hercules-ci-api-core + - hercules-ci-cli + - hercules-ci-cnix-expr + - hercules-ci-cnix-store cdepillabout: - pretty-simple - spago