diff --git a/pkgs/development/haskell-modules/configuration-nix.nix b/pkgs/development/haskell-modules/configuration-nix.nix index 032b2577c515..c8893a751fd1 100644 --- a/pkgs/development/haskell-modules/configuration-nix.nix +++ b/pkgs/development/haskell-modules/configuration-nix.nix @@ -700,11 +700,6 @@ self: super: builtins.intersectAttrs super { testToolDepends = [ pkgs.git pkgs.mercurial ] ++ drv.testToolDepends or []; }) super.retrie_1_2_0_0; - nix-output-monitor = overrideCabal { - # Can't ran the golden-tests with nix, because they call nix - testTarget = "unit-tests"; - } super.nix-output-monitor; - haskell-language-server = overrideCabal (drv: { # starting with 1.6.1.1 haskell-language-server wants to be linked dynamically # by default. Unless we reflect this in the generic builder, GHC is going to diff --git a/pkgs/tools/nix/nix-output-monitor/default.nix b/pkgs/tools/nix/nix-output-monitor/default.nix index 5c4c64c15490..214a25b36803 100644 --- a/pkgs/tools/nix/nix-output-monitor/default.nix +++ b/pkgs/tools/nix/nix-output-monitor/default.nix @@ -1,32 +1,145 @@ -{ mkDerivation, ansi-terminal, async, attoparsec, base, containers -, cassava, directory, HUnit, mtl, nix-derivation, process, relude, lib -, stm, terminal-size, text, time, unix, wcwidth, fetchFromGitHub -, lock-file, data-default, expect, runtimeShell +# This file has been autogenerate with cabal2nix. +# Update via ./update.sh" +{ + mkDerivation, + ansi-terminal, + async, + attoparsec, + base, + cassava, + containers, + data-default, + directory, + expect, + extra, + fetchzip, + filepath, + generic-optics, + HUnit, + lib, + lock-file, + MemoTrie, + mtl, + nix-derivation, + optics, + process, + random, + relude, + runtimeShell, + safe, + stm, + streamly, + terminal-size, + text, + time, + unix, + vector, + wcwidth, }: -mkDerivation rec { +mkDerivation { pname = "nix-output-monitor"; - version = "1.0.5.0"; - src = fetchFromGitHub { - owner = "maralorn"; - repo = "nix-output-monitor"; - hash = "sha256-7vjGE/MfRlFplGQBkhYwqMWjiFfky7J9aI8Tt5FycBo="; - rev = "v${version}"; + version = "1.1.1.0"; + src = fetchzip { + url = "https://github.com/maralorn/nix-output-monitor/archive/refs/tags/v1.1.1.0.tar.gz"; + sha256 = "1zw7x1snyycl1bp5w7jh8wwnynqvw3g4glr293bnzi5jyirj5wlg"; }; isLibrary = true; isExecutable = true; libraryHaskellDepends = [ - ansi-terminal async attoparsec base cassava containers directory mtl - nix-derivation relude stm terminal-size text time unix wcwidth lock-file + ansi-terminal + async + attoparsec + base + cassava + containers data-default + directory + extra + filepath + generic-optics + lock-file + MemoTrie + mtl + nix-derivation + optics + random + relude + safe + stm + streamly + terminal-size + text + time + unix + vector + wcwidth ]; executableHaskellDepends = [ - ansi-terminal async attoparsec base containers directory mtl - nix-derivation relude stm text time unix + ansi-terminal + async + attoparsec + base + cassava + containers + data-default + directory + extra + filepath + generic-optics + lock-file + MemoTrie + mtl + nix-derivation + optics + random + relude + safe + stm + streamly + terminal-size + text + time + unix + vector + wcwidth ]; testHaskellDepends = [ - ansi-terminal async attoparsec base containers directory HUnit mtl - nix-derivation process relude stm text time unix + ansi-terminal + async + attoparsec + base + cassava + containers + data-default + directory + extra + filepath + generic-optics + HUnit + lock-file + MemoTrie + mtl + nix-derivation + optics + process + random + relude + safe + stm + streamly + terminal-size + text + time + unix + vector + wcwidth ]; + homepage = "https://github.com/maralorn/nix-output-monitor"; + description = "Parses output of nix-build to show additional information"; + license = lib.licenses.agpl3Plus; + maintainers = with lib.maintainers; [maralorn]; + passthru.updateScript = ./update.sh; + testTarget = "unit-tests"; postInstall = '' cat > $out/bin/nom-build << EOF #!${runtimeShell} @@ -34,8 +147,4 @@ mkDerivation rec { EOF chmod a+x $out/bin/nom-build ''; - homepage = "https://github.com/maralorn/nix-output-monitor"; - description = "Parses output of nix-build to show additional information"; - license = lib.licenses.agpl3Plus; - maintainers = [ lib.maintainers.maralorn ]; } diff --git a/pkgs/tools/nix/nix-output-monitor/update.sh b/pkgs/tools/nix/nix-output-monitor/update.sh new file mode 100755 index 000000000000..938736e91942 --- /dev/null +++ b/pkgs/tools/nix/nix-output-monitor/update.sh @@ -0,0 +1,40 @@ +#!/usr/bin/env nix-shell +#!nix-shell -i bash -p cabal2nix curl jq alejandra +# +# This script will update the nix-output-monitor derivation to the latest version using +# cabal2nix. + +set -eo pipefail + +# This is the directory of this update.sh script. +script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" + +derivation_file="${script_dir}/default.nix" + +# This is the latest released version of nix-output-monitor on GitHub. +new_version=$(curl --silent "https://api.github.com/repos/maralorn/nix-output-monitor/releases" | jq '.[0].tag_name' --raw-output) + +echo "Updating nix-output-monitor to version $new_version." +echo "Running cabal2nix and outputting to ${derivation_file}..." + +cat > "$derivation_file" << EOF +# This file has been autogenerate with cabal2nix. +# Update via ./update.sh" +EOF +cabal2nix --extra-arguments expect --extra-arguments runtimeShell --maintainer maralorn "https://github.com/maralorn/nix-output-monitor/archive/refs/tags/${new_version}.tar.gz" | head -n-1 >> "$derivation_file" +cat >> "$derivation_file" << EOF + passthru.updateScript = ./update.sh; + testTarget = "unit-tests"; + postInstall = '' + cat > \$out/bin/nom-build << EOF + #!\${runtimeShell} + \${expect}/bin/unbuffer nix-build "\\\$@" 2>&1 | exec \$out/bin/nom + EOF + chmod a+x \$out/bin/nom-build + ''; +} +EOF + +alejandra "${derivation_file}" | cat + +echo "Finished."