diff --git a/pkgs/by-name/oa/oama/generated-package.nix b/pkgs/by-name/oa/oama/generated-package.nix new file mode 100644 index 000000000000..f024cc98466d --- /dev/null +++ b/pkgs/by-name/oa/oama/generated-package.nix @@ -0,0 +1,94 @@ +# This file has been autogenerate with cabal2nix. +# Update via ./update.sh +{ + mkDerivation, + aeson, + base, + bytestring, + containers, + directory, + fetchgit, + hsyslog, + http-conduit, + lib, + mtl, + network, + network-uri, + optparse-applicative, + pretty-simple, + process, + streaming-commons, + string-qq, + strings, + text, + time, + twain, + unix, + utf8-string, + warp, + yaml, +}: +mkDerivation { + pname = "oama"; + version = "0.14"; + src = fetchgit { + url = "https://github.com/pdobsan/oama.git"; + sha256 = "1hdhkc6hh4nvx31vkaii7hd2rxlwqrsvr6i1i0a9r1xlda05ffq0"; + rev = "4e1ffd3001034771d284678f0160060c1871707c"; + fetchSubmodules = true; + }; + isLibrary = true; + isExecutable = true; + libraryHaskellDepends = [ + aeson + base + bytestring + containers + directory + hsyslog + http-conduit + mtl + network + network-uri + optparse-applicative + pretty-simple + process + streaming-commons + string-qq + strings + text + time + twain + unix + utf8-string + warp + yaml + ]; + executableHaskellDepends = [ + aeson + base + bytestring + containers + directory + hsyslog + http-conduit + mtl + network + network-uri + optparse-applicative + pretty-simple + process + streaming-commons + string-qq + strings + text + time + twain + unix + utf8-string + warp + yaml + ]; + license = lib.licenses.bsd3; + mainProgram = "oama"; +} diff --git a/pkgs/by-name/oa/oama/package.nix b/pkgs/by-name/oa/oama/package.nix new file mode 100644 index 000000000000..c408ef4e87f8 --- /dev/null +++ b/pkgs/by-name/oa/oama/package.nix @@ -0,0 +1,29 @@ +{ + haskell, + haskellPackages, + lib, +}: +let + inherit (haskell.lib.compose) overrideCabal justStaticExecutables; + + overrides = { + description = "OAuth credential MAnager"; + homepage = "https://github.com/pdobsan/oama"; + maintainers = with lib.maintainers; [ aidalgol ]; + + passthru.updateScript = ./update.sh; + }; + + raw-pkg = (haskellPackages.callPackage ./generated-package.nix { }).overrideScope ( + final: prev: { + # Dependency twain requires an older version of http2, and we cannot mix + # versions of transitive dependencies. + http2 = final.http2_3_0_3; + warp = final.warp_3_3_30; + } + ); +in +lib.pipe raw-pkg [ + (overrideCabal overrides) + justStaticExecutables +] diff --git a/pkgs/by-name/oa/oama/update.sh b/pkgs/by-name/oa/oama/update.sh new file mode 100755 index 000000000000..60d1c74cbca1 --- /dev/null +++ b/pkgs/by-name/oa/oama/update.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env nix-shell +#!nix-shell -i bash -p cabal2nix curl jq nixfmt-rfc-style + +set -euo 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}/generated-package.nix" +latest_version="$(curl --silent https://api.github.com/repos/pdobsan/oama/releases/latest | jq --raw-output '.tag_name')" + +echo "Updating oama to version ${latest_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 --revision "${latest_version}" https://github.com/pdobsan/oama.git >> "${derivation_file}" +nixfmt "${derivation_file}" + +echo "Finished."