summary refs log tree commit diff
path: root/pkgs/tools
diff options
context:
space:
mode:
authorMalte Brandy <malte.brandy@maralorn.de>2022-03-16 14:40:56 +0100
committerMalte Brandy <malte.brandy@maralorn.de>2022-03-16 15:04:52 +0100
commitc998ef53b8c90dfe8ab17016922d1c2b70b2663e (patch)
treea62da88344f24b225480e22cee0defe94c738a99 /pkgs/tools
parent73ad5f9e147c0d2a2061f1d4bd91e05078dc0b58 (diff)
downloadnixpkgs-c998ef53b8c90dfe8ab17016922d1c2b70b2663e.tar
nixpkgs-c998ef53b8c90dfe8ab17016922d1c2b70b2663e.tar.gz
nixpkgs-c998ef53b8c90dfe8ab17016922d1c2b70b2663e.tar.bz2
nixpkgs-c998ef53b8c90dfe8ab17016922d1c2b70b2663e.tar.lz
nixpkgs-c998ef53b8c90dfe8ab17016922d1c2b70b2663e.tar.xz
nixpkgs-c998ef53b8c90dfe8ab17016922d1c2b70b2663e.tar.zst
nixpkgs-c998ef53b8c90dfe8ab17016922d1c2b70b2663e.zip
nix-output-monitor: 1.1.2.0 -> 1.1.2.1 + Refactor
Diffstat (limited to 'pkgs/tools')
-rw-r--r--pkgs/tools/nix/nix-output-monitor/default.nix179
-rw-r--r--pkgs/tools/nix/nix-output-monitor/generated-package.nix147
-rwxr-xr-xpkgs/tools/nix/nix-output-monitor/update.sh25
3 files changed, 168 insertions, 183 deletions
diff --git a/pkgs/tools/nix/nix-output-monitor/default.nix b/pkgs/tools/nix/nix-output-monitor/default.nix
index 0f78600a050..a79b41a4a5d 100644
--- a/pkgs/tools/nix/nix-output-monitor/default.nix
+++ b/pkgs/tools/nix/nix-output-monitor/default.nix
@@ -1,164 +1,23 @@
-# This file has been autogenerate with cabal2nix.
-# Update via ./update.sh"
 {
-  mkDerivation,
-  ansi-terminal,
-  async,
-  attoparsec,
-  base,
-  bytestring,
-  cassava,
-  containers,
-  data-default,
-  directory,
+  haskell,
   expect,
-  extra,
-  fetchzip,
-  filepath,
-  generic-optics,
-  HUnit,
+  haskellPackages,
   installShellFiles,
-  lib,
-  lock-file,
-  MemoTrie,
-  mtl,
-  nix-derivation,
-  optics,
-  process,
-  random,
-  relude,
-  runtimeShell,
-  safe,
-  stm,
-  streamly,
-  terminal-size,
-  text,
-  time,
-  unix,
-  vector,
-  wcwidth,
-  word8,
-}:
-mkDerivation {
-  pname = "nix-output-monitor";
-  version = "1.1.2.0";
-  src = fetchzip {
-    url = "https://github.com/maralorn/nix-output-monitor/archive/refs/tags/v1.1.2.0.tar.gz";
-    sha256 = "03qhy4xzika41pxlmvpz3psgy54va72ipn9v1lv33l6369ikrhl1";
+}: let
+  inherit (haskell.lib.compose) justStaticExecutables overrideCabal;
+  overrides = {
+    passthru.updateScript = ./update.sh;
+    testTarget = "unit-tests";
+    buildTools = [installShellFiles];
+    postInstall = ''
+      substitute "exe-sh/nom-build" "$out/bin/nom-build" \
+        --replace 'unbuffer' '${expect}/bin/unbuffer' \
+        --replace 'nom' "$out/bin/nom"
+      chmod a+x $out/bin/nom-build
+      installShellCompletion --zsh --name _nom-build completions/completion.zsh
+    '';
   };
-  isLibrary = true;
-  isExecutable = true;
-  libraryHaskellDepends = [
-    ansi-terminal
-    async
-    attoparsec
-    base
-    bytestring
-    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
-    word8
-  ];
-  executableHaskellDepends = [
-    ansi-terminal
-    async
-    attoparsec
-    base
-    bytestring
-    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
-    word8
-  ];
-  testHaskellDepends = [
-    ansi-terminal
-    async
-    attoparsec
-    base
-    bytestring
-    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
-    word8
-  ];
-  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";
-  buildTools = [installShellFiles];
-  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
-    installShellCompletion --zsh --name _nom-build ${builtins.toFile "completion.zsh" ''
-      #compdef nom-build
-      compdef nom-build=nix-build
-    ''}
-  '';
-}
+in
+  justStaticExecutables
+  (overrideCabal overrides
+    (haskellPackages.callPackage ./generated-package.nix {}))
diff --git a/pkgs/tools/nix/nix-output-monitor/generated-package.nix b/pkgs/tools/nix/nix-output-monitor/generated-package.nix
new file mode 100644
index 00000000000..9f4d4b5042b
--- /dev/null
+++ b/pkgs/tools/nix/nix-output-monitor/generated-package.nix
@@ -0,0 +1,147 @@
+# This file has been autogenerate with cabal2nix.
+# Update via ./update.sh"
+{
+  mkDerivation,
+  ansi-terminal,
+  async,
+  attoparsec,
+  base,
+  bytestring,
+  cassava,
+  containers,
+  data-default,
+  directory,
+  extra,
+  fetchzip,
+  filepath,
+  generic-optics,
+  HUnit,
+  lib,
+  lock-file,
+  MemoTrie,
+  mtl,
+  nix-derivation,
+  optics,
+  process,
+  random,
+  relude,
+  safe,
+  stm,
+  streamly,
+  terminal-size,
+  text,
+  time,
+  unix,
+  vector,
+  wcwidth,
+  word8,
+}:
+mkDerivation {
+  pname = "nix-output-monitor";
+  version = "1.1.2.1";
+  src = fetchzip {
+    url = "https://github.com/maralorn/nix-output-monitor/archive/refs/tags/v1.1.2.1.tar.gz";
+    sha256 = "00jn963jskyqnwvbvn5x0z92x2gv105p5h8m13nlmr90lj4axynx";
+  };
+  isLibrary = true;
+  isExecutable = true;
+  libraryHaskellDepends = [
+    ansi-terminal
+    async
+    attoparsec
+    base
+    bytestring
+    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
+    word8
+  ];
+  executableHaskellDepends = [
+    ansi-terminal
+    async
+    attoparsec
+    base
+    bytestring
+    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
+    word8
+  ];
+  testHaskellDepends = [
+    ansi-terminal
+    async
+    attoparsec
+    base
+    bytestring
+    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
+    word8
+  ];
+  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];
+}
diff --git a/pkgs/tools/nix/nix-output-monitor/update.sh b/pkgs/tools/nix/nix-output-monitor/update.sh
index ad5da000030..b25a65fca2d 100755
--- a/pkgs/tools/nix/nix-output-monitor/update.sh
+++ b/pkgs/tools/nix/nix-output-monitor/update.sh
@@ -9,7 +9,7 @@ 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"
+derivation_file="${script_dir}/generated-package.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)
@@ -23,30 +23,9 @@ cat > "$derivation_file" << EOF
 EOF
 
 cabal2nix \
-  --extra-arguments expect \
-  --extra-arguments runtimeShell\
-  --extra-arguments installShellFiles\
   --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";
-    buildTools = [ installShellFiles ];
-    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
-        installShellCompletion --zsh --name _nom-build \${builtins.toFile "completion.zsh" ''
-            #compdef nom-build
-            compdef nom-build=nix-build
-        ''}
-    '';
-}
-EOF
+  >> "$derivation_file"
 
 alejandra "${derivation_file}" | cat