From d9b1f2283a4310eb3ec420485815bf73e5466fae Mon Sep 17 00:00:00 2001 From: jacobi petrucciani Date: Thu, 27 Apr 2023 17:40:21 -0400 Subject: [PATCH] move more things to new pkgs system --- mods/pkgs/cli.nix | 151 ------------------------ mods/pkgs/cloud.nix | 64 ---------- mods/pkgs/server.nix | 84 ------------- pkgs/cli/comcast.nix | 25 ++++ pkgs/cli/lastresort.nix | 23 ++++ pkgs/cli/tlsh-go.nix | 36 ++++++ pkgs/cloud/bigquery-emulator.nix | 37 ++++++ pkgs/cloud/goaws.nix | 30 +++++ pkgs/cloud/gofakes3.nix | 26 ++++ pkgs/cloud/s3-edit.nix | 27 +++++ pkgs/cloud/terraform-cloud-exporter.nix | 21 ++++ pkgs/server/poglets.nix | 38 ++++++ 12 files changed, 263 insertions(+), 299 deletions(-) create mode 100644 pkgs/cli/comcast.nix create mode 100644 pkgs/cli/lastresort.nix create mode 100644 pkgs/cli/tlsh-go.nix create mode 100644 pkgs/cloud/bigquery-emulator.nix create mode 100644 pkgs/cloud/goaws.nix create mode 100644 pkgs/cloud/gofakes3.nix create mode 100644 pkgs/cloud/s3-edit.nix create mode 100644 pkgs/cloud/terraform-cloud-exporter.nix create mode 100644 pkgs/server/poglets.nix diff --git a/mods/pkgs/cli.nix b/mods/pkgs/cli.nix index 128db0c94..a3799e512 100644 --- a/mods/pkgs/cli.nix +++ b/mods/pkgs/cli.nix @@ -4,37 +4,6 @@ let shardsDerivation = shards: builtins.toFile "shards.nix" (lib.generators.toPretty { } shards); in { - s3-edit = prev.callPackage - ({ lib, buildGo120Module, fetchFromGitHub }: - buildGo120Module rec { - pname = "s3-edit"; - version = "0.0.16"; - - src = fetchFromGitHub { - owner = "tsub"; - repo = "s3-edit"; - rev = "v${version}"; - sha256 = "sha256-BNFbg3IRsLOdakh8d53P0FSOGaGXYJuexECPlCMWCC0="; - }; - - ldflags = [ - "-s" - "-w" - "-X cmd.version=${version}" - ]; - - vendorHash = "sha256-ZM5Z3yLOwOYpOTyoXmSbyPFBE31F+Jvc6DN4rmHmyt0="; - - meta = with lib; { - inherit (src.meta) homepage; - description = "Edit directly a file on Amazon S3 in CLI"; - license = licenses.mit; - maintainers = with maintainers; [ jpetrucciani ]; - }; - } - ) - { }; - memzoom = prev.callPackage ({ stdenv, lib }: stdenv.mkDerivation rec { pname = "memzoom"; @@ -144,35 +113,6 @@ in ) { }; - comcast = prev.callPackage - ({ lib, buildGo119Module, fetchFromGitHub }: - buildGo119Module rec { - pname = "comcast"; - version = "1.0.1"; - - # this is forked to fix go mod stuff - src = fetchFromGitHub { - owner = "jpetrucciani"; - repo = "comcast"; - rev = "93b2589b3e677c4f351c2ee7bf8709ce762ca697"; - sha256 = "sha256-jfVxoKkZscemOdlyQNFXckhlEcl7UZ+MPoIQu2lcUaE="; - }; - - vendorHash = "sha256-AruaKBvPmHw13NTr0folQW1HouRVMW5M3gbFWT1tF/s="; - - # disable checks because they need networking - doCheck = false; - - meta = with lib; { - inherit (src.meta) homepage; - description = "Simulating shitty network connections so you can build better systems"; - license = licenses.asl20; - maintainers = with maintainers; [ jpetrucciani ]; - }; - } - ) - { }; - watcher = prev.callPackage ({ stdenv, clang13Stdenv, lib, fetchFromGitHub }: let @@ -206,46 +146,6 @@ in }) { }; - tlsh-go = prev.callPackage - ({ lib, buildGo120Module, fetchFromGitHub }: - let - version = "0.3.0"; - date = "2022-12-12"; - in - buildGo120Module rec { - inherit version; - pname = "tlsh-go"; - - src = fetchFromGitHub { - owner = "glaslos"; - repo = "tlsh"; - rev = "v${version}"; - sha256 = "sha256-fDFMF7ajhJ0veylJPoSxOtkkdwcRmR9G7MJgk5fnAdY="; - }; - - ldflags = [ - "-s" - "-w" - "-X main.VERSION=${version}" - "-X main.BUILDDATE=${date}" - ]; - - postInstall = '' - mv $out/bin/app $out/bin/tlsh - ''; - - vendorHash = null; - - meta = with lib; { - inherit (src.meta) homepage; - description = "TLSH lib in Golang"; - license = licenses.asl20; - maintainers = with maintainers; [ jpetrucciani ]; - }; - } - ) - { }; - ov = prev.callPackage ({ lib, buildGo120Module, fetchFromGitHub }: buildGo120Module rec { @@ -372,57 +272,6 @@ in ) { }; - lastresort = prev.callPackage - ({ lib, fetchFromGitHub, rustPlatform }: - let - pname = "lastresort"; - version = "0.4.0"; - in - rustPlatform.buildRustPackage rec { - inherit pname version; - - src = fetchFromGitHub { - owner = "ctsrc"; - repo = "Base256"; - rev = "v${version}"; - sha256 = "sha256-wwwm7x42Fk7Hsf1rE+dKLQJGTkmZnbFGDl5OX3gJ1rU="; - }; - - cargoSha256 = "sha256-tt5B8jt3DSb7LWCCDWITpe9XD/EmFbGubUmlysFqRuM="; - - meta = with lib; { - description = "Encode and decode data in base 256 easily typed words"; - license = licenses.isc; - maintainers = with maintainers; [ jpetrucciani ]; - }; - }) - { }; - - terraform-cloud-exporter = prev.callPackage - ({ lib, buildGo119Module, fetchFromGitHub }: - buildGo119Module rec { - pname = "terraform-cloud-exporter"; - version = "2.3.0"; - - src = fetchFromGitHub { - owner = "pacoguzman"; - repo = pname; - rev = "v${version}"; - sha256 = "sha256-77ns9cBKr/d7gCZRdizuJm+adkk0WNeCVtKMZMLXmQA="; - }; - - vendorHash = "sha256-aw2Hv3utc/sIZC1E3RDsQcmT+FVIhTWkdU0+dB0/4ho="; - - meta = with lib; { - inherit (src.meta) homepage; - description = "Prometheus exporter for Terraform Cloud metrics"; - license = licenses.mit; - maintainers = with maintainers; [ jpetrucciani ]; - }; - } - ) - { }; - buffalo = prev.callPackage ({ lib, buildGo120Module, fetchFromGitHub }: buildGo120Module rec { diff --git a/mods/pkgs/cloud.nix b/mods/pkgs/cloud.nix index f454435c3..061f4b52c 100644 --- a/mods/pkgs/cloud.nix +++ b/mods/pkgs/cloud.nix @@ -50,68 +50,4 @@ with prev; ) { }; - gofakes3 = prev.callPackage - ({ lib, buildGo120Module, fetchFromGitHub }: - buildGo120Module rec { - pname = "gofakes3"; - version = "0.0.0"; - - src = fetchFromGitHub { - owner = "johannesboyne"; - repo = pname; - rev = "c0edf658332badad9eb3a69f44dbdcbfec487a68"; - sha256 = "sha256-aToCIEkjfoQzG5+RyiLCK5IyEYyj3rJ9OoSm8lRMiVc="; - }; - - ldflags = [ - "-s" - "-w" - ]; - - vendorHash = "sha256-5Q2X0Wl/ltpP5SFr9TUbirISNL7IAyaDUkcESwqss/g="; - - meta = with lib; { - description = "A simple fake AWS S3 object storage (used for local test-runs against AWS S3 APIs)"; - homepage = "https://github.com/johannesboyne/gofakes3"; - license = licenses.mit; - maintainers = with maintainers; [ jpetrucciani ]; - }; - } - ) - { }; - - goaws = prev.callPackage - ({ lib, buildGo120Module, fetchFromGitHub }: - buildGo120Module rec { - pname = "goaws"; - version = "0.4.1"; - - src = fetchFromGitHub { - owner = "Admiral-Piett"; - repo = pname; - rev = "v${version}"; - sha256 = "sha256-f0iEz/V/bnTxuXDo7X6yxQCBAhRyAEFzQoTC9ZB/9pM="; - }; - - vendorHash = "sha256-VqRRCQKtqhRtxG8uJrf332vXr1Lo0ivu8UNWf6y/K2s="; - - ldflags = [ - "-s" - "-w" - ]; - - postInstall = '' - mv $out/bin/cmd $out/bin/goaws - ''; - - meta = with lib; { - description = "AWS (SQS/SNS) Clone for Development testing"; - homepage = "https://github.com/Admiral-Piett/goaws"; - license = licenses.mit; - maintainers = with maintainers; [ jpetrucciani ]; - }; - } - ) - { }; - } diff --git a/mods/pkgs/server.nix b/mods/pkgs/server.nix index 0f0d6342c..dd0f9a0a7 100644 --- a/mods/pkgs/server.nix +++ b/mods/pkgs/server.nix @@ -18,88 +18,4 @@ rec { version = "2.6.5"; sha256 = "sha256-zp4Z6/zdQ+Ua+KYJDx341RLZct33QvpkimQ7uxkFZgU="; }; - - poglets = prev.callPackage - ({ lib, buildGo120Module, fetchFromGitHub }: - buildGo120Module rec { - pname = "poglets"; - version = "0.0.3"; - commit = "0e96c5f5887cd317cd92e6e51eb366929cee3ed1"; - - src = fetchFromGitHub { - owner = "jpetrucciani"; - repo = pname; - rev = version; - sha256 = "sha256-owWLviFu/Y+365XZEw7vjmJMmz8wAYMkvGonVJDJ9rU="; - }; - - vendorHash = "sha256-Hjdv2Fvl1S52CDs4TAR3Yt9pEFUIvs5N5sVhZY+Edzo="; - - nativeBuildInputs = [ installShellFiles ]; - - ldflags = [ - "-s" - "-w" - "-X main.Version=${version}" - "-X main.GitCommit=${commit}" - ]; - - postInstall = '' - installShellCompletion --cmd poglets \ - --bash <($out/bin/poglets completion bash) \ - --fish <($out/bin/poglets completion fish) \ - --zsh <($out/bin/poglets completion zsh) - ''; - - meta = with lib; { - inherit (src.meta) homepage; - description = ""; - license = licenses.mit; - maintainers = with maintainers; [ jpetrucciani ]; - }; - } - ) - { }; - - bigquery-emulator = prev.callPackage - ({ lib, buildGo120Module, fetchFromGitHub, clangStdenv }: - (buildGo120Module.override { stdenv = clangStdenv; }) rec { - pname = "bigquery-emulator"; - version = "0.2.12"; - commit = "f21fa982972a8be6444c23459a88df58de7b14b4"; - - src = fetchFromGitHub { - owner = "goccy"; - repo = pname; - rev = "v${version}"; - sha256 = "sha256-mGR3s7OHuiMN1LqoWKRkJoXmZkqL7Ye9zJkDC4OFtus="; - }; - - vendorHash = "sha256-NJktyKDyByAWLAc/oayOSQxohKPcxAHiW2ynM77cCOY="; - - CGO_ENABLED = 1; - - nativeBuildInputs = [ ]; - subPackages = [ - "./cmd/bigquery-emulator" - ]; - - ldflags = [ - "-s" - "-w" - "-X main.version=${version}" - "-X main.revision=${commit}" - "-linkmode external" - ]; - - meta = with lib; { - inherit (src.meta) homepage; - description = "BigQuery emulator server implemented in Go"; - license = licenses.mit; - maintainers = with maintainers; [ jpetrucciani ]; - }; - } - ) - { }; - } diff --git a/pkgs/cli/comcast.nix b/pkgs/cli/comcast.nix new file mode 100644 index 000000000..834ac1ce9 --- /dev/null +++ b/pkgs/cli/comcast.nix @@ -0,0 +1,25 @@ +{ lib, buildGo120Module, fetchFromGitHub }: +buildGo120Module rec { + pname = "comcast"; + version = "1.0.1"; + + # this is forked to fix go mod stuff + src = fetchFromGitHub { + owner = "jpetrucciani"; + repo = "comcast"; + rev = "93b2589b3e677c4f351c2ee7bf8709ce762ca697"; + hash = "sha256-jfVxoKkZscemOdlyQNFXckhlEcl7UZ+MPoIQu2lcUaE="; + }; + + vendorHash = "sha256-AruaKBvPmHw13NTr0folQW1HouRVMW5M3gbFWT1tF/s="; + + # disable checks because they need networking + doCheck = false; + + meta = with lib; { + inherit (src.meta) homepage; + description = "Simulating shitty network connections so you can build better systems"; + license = licenses.asl20; + maintainers = with maintainers; [ jpetrucciani ]; + }; +} diff --git a/pkgs/cli/lastresort.nix b/pkgs/cli/lastresort.nix new file mode 100644 index 000000000..34dcbc116 --- /dev/null +++ b/pkgs/cli/lastresort.nix @@ -0,0 +1,23 @@ +{ lib, fetchFromGitHub, rustPlatform }: +let + pname = "lastresort"; + version = "0.4.0"; +in +rustPlatform.buildRustPackage rec { + inherit pname version; + + src = fetchFromGitHub { + owner = "ctsrc"; + repo = "Base256"; + rev = "v${version}"; + sha256 = "sha256-wwwm7x42Fk7Hsf1rE+dKLQJGTkmZnbFGDl5OX3gJ1rU="; + }; + + cargoSha256 = "sha256-tt5B8jt3DSb7LWCCDWITpe9XD/EmFbGubUmlysFqRuM="; + + meta = with lib; { + description = "Encode and decode data in base 256 easily typed words"; + license = licenses.isc; + maintainers = with maintainers; [ jpetrucciani ]; + }; +} diff --git a/pkgs/cli/tlsh-go.nix b/pkgs/cli/tlsh-go.nix new file mode 100644 index 000000000..adaefd234 --- /dev/null +++ b/pkgs/cli/tlsh-go.nix @@ -0,0 +1,36 @@ +{ lib, buildGo120Module, fetchFromGitHub }: +let + version = "0.3.0"; + date = "2022-12-12"; +in +buildGo120Module rec { + inherit version; + pname = "tlsh-go"; + + src = fetchFromGitHub { + owner = "glaslos"; + repo = "tlsh"; + rev = "v${version}"; + sha256 = "sha256-fDFMF7ajhJ0veylJPoSxOtkkdwcRmR9G7MJgk5fnAdY="; + }; + + ldflags = [ + "-s" + "-w" + "-X main.VERSION=${version}" + "-X main.BUILDDATE=${date}" + ]; + + postInstall = '' + mv $out/bin/app $out/bin/tlsh + ''; + + vendorHash = null; + + meta = with lib; { + inherit (src.meta) homepage; + description = "TLSH lib in Golang"; + license = licenses.asl20; + maintainers = with maintainers; [ jpetrucciani ]; + }; +} diff --git a/pkgs/cloud/bigquery-emulator.nix b/pkgs/cloud/bigquery-emulator.nix new file mode 100644 index 000000000..efe42b626 --- /dev/null +++ b/pkgs/cloud/bigquery-emulator.nix @@ -0,0 +1,37 @@ +{ lib, buildGo120Module, fetchFromGitHub, clangStdenv }: +(buildGo120Module.override { stdenv = clangStdenv; }) rec { + pname = "bigquery-emulator"; + version = "0.2.12"; + commit = "f21fa982972a8be6444c23459a88df58de7b14b4"; + + src = fetchFromGitHub { + owner = "goccy"; + repo = pname; + rev = "v${version}"; + hash = "sha256-mGR3s7OHuiMN1LqoWKRkJoXmZkqL7Ye9zJkDC4OFtus="; + }; + + vendorHash = "sha256-NJktyKDyByAWLAc/oayOSQxohKPcxAHiW2ynM77cCOY="; + + CGO_ENABLED = 1; + + nativeBuildInputs = [ ]; + subPackages = [ + "./cmd/bigquery-emulator" + ]; + + ldflags = [ + "-s" + "-w" + "-X main.version=${version}" + "-X main.revision=${commit}" + "-linkmode external" + ]; + + meta = with lib; { + inherit (src.meta) homepage; + description = "BigQuery emulator server implemented in Go"; + license = licenses.mit; + maintainers = with maintainers; [ jpetrucciani ]; + }; +} diff --git a/pkgs/cloud/goaws.nix b/pkgs/cloud/goaws.nix new file mode 100644 index 000000000..9a7d77f1f --- /dev/null +++ b/pkgs/cloud/goaws.nix @@ -0,0 +1,30 @@ +{ lib, buildGo120Module, fetchFromGitHub }: +buildGo120Module rec { + pname = "goaws"; + version = "0.4.1"; + + src = fetchFromGitHub { + owner = "Admiral-Piett"; + repo = pname; + rev = "v${version}"; + hash = "sha256-f0iEz/V/bnTxuXDo7X6yxQCBAhRyAEFzQoTC9ZB/9pM="; + }; + + vendorHash = "sha256-VqRRCQKtqhRtxG8uJrf332vXr1Lo0ivu8UNWf6y/K2s="; + + ldflags = [ + "-s" + "-w" + ]; + + postInstall = '' + mv $out/bin/cmd $out/bin/goaws + ''; + + meta = with lib; { + description = "AWS (SQS/SNS) Clone for Development testing"; + homepage = "https://github.com/Admiral-Piett/goaws"; + license = licenses.mit; + maintainers = with maintainers; [ jpetrucciani ]; + }; +} diff --git a/pkgs/cloud/gofakes3.nix b/pkgs/cloud/gofakes3.nix new file mode 100644 index 000000000..0909917e0 --- /dev/null +++ b/pkgs/cloud/gofakes3.nix @@ -0,0 +1,26 @@ +{ lib, buildGo120Module, fetchFromGitHub }: +buildGo120Module rec { + pname = "gofakes3"; + version = "0.0.0"; + + src = fetchFromGitHub { + owner = "johannesboyne"; + repo = pname; + rev = "c0edf658332badad9eb3a69f44dbdcbfec487a68"; + hash = "sha256-aToCIEkjfoQzG5+RyiLCK5IyEYyj3rJ9OoSm8lRMiVc="; + }; + + ldflags = [ + "-s" + "-w" + ]; + + vendorHash = "sha256-5Q2X0Wl/ltpP5SFr9TUbirISNL7IAyaDUkcESwqss/g="; + + meta = with lib; { + description = "A simple fake AWS S3 object storage (used for local test-runs against AWS S3 APIs)"; + homepage = "https://github.com/johannesboyne/gofakes3"; + license = licenses.mit; + maintainers = with maintainers; [ jpetrucciani ]; + }; +} diff --git a/pkgs/cloud/s3-edit.nix b/pkgs/cloud/s3-edit.nix new file mode 100644 index 000000000..1cab4196d --- /dev/null +++ b/pkgs/cloud/s3-edit.nix @@ -0,0 +1,27 @@ +{ lib, buildGo120Module, fetchFromGitHub }: +buildGo120Module rec { + pname = "s3-edit"; + version = "0.0.16"; + + src = fetchFromGitHub { + owner = "tsub"; + repo = "s3-edit"; + rev = "v${version}"; + hash = "sha256-BNFbg3IRsLOdakh8d53P0FSOGaGXYJuexECPlCMWCC0="; + }; + + ldflags = [ + "-s" + "-w" + "-X cmd.version=${version}" + ]; + + vendorHash = "sha256-ZM5Z3yLOwOYpOTyoXmSbyPFBE31F+Jvc6DN4rmHmyt0="; + + meta = with lib; { + inherit (src.meta) homepage; + description = "Edit directly a file on Amazon S3 in CLI"; + license = licenses.mit; + maintainers = with maintainers; [ jpetrucciani ]; + }; +} diff --git a/pkgs/cloud/terraform-cloud-exporter.nix b/pkgs/cloud/terraform-cloud-exporter.nix new file mode 100644 index 000000000..53a9e307d --- /dev/null +++ b/pkgs/cloud/terraform-cloud-exporter.nix @@ -0,0 +1,21 @@ +{ lib, buildGo120Module, fetchFromGitHub }: +buildGo120Module rec { + pname = "terraform-cloud-exporter"; + version = "2.3.0"; + + src = fetchFromGitHub { + owner = "pacoguzman"; + repo = pname; + rev = "v${version}"; + hash = "sha256-77ns9cBKr/d7gCZRdizuJm+adkk0WNeCVtKMZMLXmQA="; + }; + + vendorHash = "sha256-aw2Hv3utc/sIZC1E3RDsQcmT+FVIhTWkdU0+dB0/4ho="; + + meta = with lib; { + inherit (src.meta) homepage; + description = "Prometheus exporter for Terraform Cloud metrics"; + license = licenses.mit; + maintainers = with maintainers; [ jpetrucciani ]; + }; +} diff --git a/pkgs/server/poglets.nix b/pkgs/server/poglets.nix new file mode 100644 index 000000000..d1c2af65f --- /dev/null +++ b/pkgs/server/poglets.nix @@ -0,0 +1,38 @@ +{ lib, buildGo120Module, fetchFromGitHub, installShellFiles }: +buildGo120Module rec { + pname = "poglets"; + version = "0.0.3"; + commit = "0e96c5f5887cd317cd92e6e51eb366929cee3ed1"; + + src = fetchFromGitHub { + owner = "jpetrucciani"; + repo = pname; + rev = version; + hash = "sha256-owWLviFu/Y+365XZEw7vjmJMmz8wAYMkvGonVJDJ9rU="; + }; + + vendorHash = "sha256-Hjdv2Fvl1S52CDs4TAR3Yt9pEFUIvs5N5sVhZY+Edzo="; + + nativeBuildInputs = [ installShellFiles ]; + + ldflags = [ + "-s" + "-w" + "-X main.Version=${version}" + "-X main.GitCommit=${commit}" + ]; + + postInstall = '' + installShellCompletion --cmd poglets \ + --bash <($out/bin/poglets completion bash) \ + --fish <($out/bin/poglets completion fish) \ + --zsh <($out/bin/poglets completion zsh) + ''; + + meta = with lib; { + inherit (src.meta) homepage; + description = ""; + license = licenses.mit; + maintainers = with maintainers; [ jpetrucciani ]; + }; +}