From 5e399209b22aaabffeafffb2577d4d6b71f51cf2 Mon Sep 17 00:00:00 2001 From: Brian Picciano Date: Thu, 20 Oct 2022 22:06:22 +0200 Subject: [PATCH] Rename go-workspace to just entrypoint, clean out unused wait-for tools --- AppDir/bin/wait-for-ip | 9 -------- default.nix | 7 ++----- entrypoint/default.nix | 14 +++++++++++++ .../src/admin/admin.go | 0 .../src/bootstrap/bootstrap.go | 0 .../src/bootstrap/garage.go | 0 .../src/bootstrap/garage_global_bucket.go | 0 .../src/bootstrap/hosts.go | 0 .../src/bootstrap/nebula.go | 0 .../src/cmd/entrypoint/admin.go | 0 .../src/cmd/entrypoint/daemon.go | 0 .../src/cmd/entrypoint/daemon_util.go | 0 .../src/cmd/entrypoint/daemon_yml.go | 0 .../src/cmd/entrypoint/garage.go | 0 .../src/cmd/entrypoint/garage_util.go | 0 .../src/cmd/entrypoint/hosts.go | 0 .../src/cmd/entrypoint/main.go | 0 .../src/cmd/entrypoint/nebula_util.go | 0 .../src/cmd/entrypoint/sub_cmd.go | 0 .../src/cmd/entrypoint/version.go | 0 .../src/daemon_yml.go | 0 {go-workspace => entrypoint}/src/doc.go | 0 {go-workspace => entrypoint}/src/env.go | 0 .../src/garage/admin_client.go | 0 .../src/garage/client.go | 0 .../src/garage/garage.go | 0 .../src/garage/infinite_reader.go | 0 .../src/garage/infinite_reader_test.go | 0 .../src/garage/peer.go | 0 .../src/garage/tpl.go | 0 {go-workspace => entrypoint}/src/go.mod | 0 {go-workspace => entrypoint}/src/go.sum | 0 .../src/nebula/nebula.go | 0 {go-workspace => entrypoint}/src/proc_lock.go | 0 .../src/tarutil/tarutil.go | 0 .../src/tarutil/tgz_writer.go | 0 .../src/yamlutil/yamlutil.go | 0 go-workspace/README.md | 9 -------- go-workspace/default.nix | 18 ---------------- nix/wait-for.nix | 21 ------------------- 40 files changed, 16 insertions(+), 62 deletions(-) delete mode 100644 AppDir/bin/wait-for-ip create mode 100644 entrypoint/default.nix rename {go-workspace => entrypoint}/src/admin/admin.go (100%) rename {go-workspace => entrypoint}/src/bootstrap/bootstrap.go (100%) rename {go-workspace => entrypoint}/src/bootstrap/garage.go (100%) rename {go-workspace => entrypoint}/src/bootstrap/garage_global_bucket.go (100%) rename {go-workspace => entrypoint}/src/bootstrap/hosts.go (100%) rename {go-workspace => entrypoint}/src/bootstrap/nebula.go (100%) rename {go-workspace => entrypoint}/src/cmd/entrypoint/admin.go (100%) rename {go-workspace => entrypoint}/src/cmd/entrypoint/daemon.go (100%) rename {go-workspace => entrypoint}/src/cmd/entrypoint/daemon_util.go (100%) rename {go-workspace => entrypoint}/src/cmd/entrypoint/daemon_yml.go (100%) rename {go-workspace => entrypoint}/src/cmd/entrypoint/garage.go (100%) rename {go-workspace => entrypoint}/src/cmd/entrypoint/garage_util.go (100%) rename {go-workspace => entrypoint}/src/cmd/entrypoint/hosts.go (100%) rename {go-workspace => entrypoint}/src/cmd/entrypoint/main.go (100%) rename {go-workspace => entrypoint}/src/cmd/entrypoint/nebula_util.go (100%) rename {go-workspace => entrypoint}/src/cmd/entrypoint/sub_cmd.go (100%) rename {go-workspace => entrypoint}/src/cmd/entrypoint/version.go (100%) rename {go-workspace => entrypoint}/src/daemon_yml.go (100%) rename {go-workspace => entrypoint}/src/doc.go (100%) rename {go-workspace => entrypoint}/src/env.go (100%) rename {go-workspace => entrypoint}/src/garage/admin_client.go (100%) rename {go-workspace => entrypoint}/src/garage/client.go (100%) rename {go-workspace => entrypoint}/src/garage/garage.go (100%) rename {go-workspace => entrypoint}/src/garage/infinite_reader.go (100%) rename {go-workspace => entrypoint}/src/garage/infinite_reader_test.go (100%) rename {go-workspace => entrypoint}/src/garage/peer.go (100%) rename {go-workspace => entrypoint}/src/garage/tpl.go (100%) rename {go-workspace => entrypoint}/src/go.mod (100%) rename {go-workspace => entrypoint}/src/go.sum (100%) rename {go-workspace => entrypoint}/src/nebula/nebula.go (100%) rename {go-workspace => entrypoint}/src/proc_lock.go (100%) rename {go-workspace => entrypoint}/src/tarutil/tarutil.go (100%) rename {go-workspace => entrypoint}/src/tarutil/tgz_writer.go (100%) rename {go-workspace => entrypoint}/src/yamlutil/yamlutil.go (100%) delete mode 100644 go-workspace/README.md delete mode 100644 go-workspace/default.nix delete mode 100644 nix/wait-for.nix diff --git a/AppDir/bin/wait-for-ip b/AppDir/bin/wait-for-ip deleted file mode 100644 index 988e20b..0000000 --- a/AppDir/bin/wait-for-ip +++ /dev/null @@ -1,9 +0,0 @@ - -ip="$1" -shift; - -echo "waiting for $ip to become available..." - -while true; do ping -c1 -W1 "$ip" &> /dev/null && break; done - -exec "$@" diff --git a/default.nix b/default.nix index c8fcbff..a524792 100644 --- a/default.nix +++ b/default.nix @@ -44,7 +44,7 @@ ''; }; - goWorkspace = pkgs.callPackage ./go-workspace {}; + entrypoint = pkgs.callPackage ./entrypoint {}; dnsmasq = (pkgs.callPackage ./dnsmasq { glibcStatic = pkgs.glibc.static; @@ -60,8 +60,6 @@ pkgs.pkgsStatic.bash pkgs.pkgsStatic.coreutils - pkgs.pkgsStatic.unixtools.ping - pkgs.pkgsStatic.netcat # required by waitFor pkgs.pkgsStatic.gnutar pkgs.pkgsStatic.gzip @@ -73,8 +71,7 @@ version dnsmasq garage - waitFor - goWorkspace.entrypoint + entrypoint ] ++ (if bootstrap != null then [ rootedBootstrap ] else []); }; diff --git a/entrypoint/default.nix b/entrypoint/default.nix new file mode 100644 index 0000000..e78a46c --- /dev/null +++ b/entrypoint/default.nix @@ -0,0 +1,14 @@ +{ + + buildGoModule, + +}: buildGoModule { + + pname = "cryptic-net-entrypoint"; + version = "unstable"; + src = ./src; + vendorSha256 = "sha256-URmrK9Sd/5yhXrWxXZq05TS7aY7IWptQFMKfXKJY7Hc="; + subPackages = [ + "cmd/entrypoint" + ]; +} diff --git a/go-workspace/src/admin/admin.go b/entrypoint/src/admin/admin.go similarity index 100% rename from go-workspace/src/admin/admin.go rename to entrypoint/src/admin/admin.go diff --git a/go-workspace/src/bootstrap/bootstrap.go b/entrypoint/src/bootstrap/bootstrap.go similarity index 100% rename from go-workspace/src/bootstrap/bootstrap.go rename to entrypoint/src/bootstrap/bootstrap.go diff --git a/go-workspace/src/bootstrap/garage.go b/entrypoint/src/bootstrap/garage.go similarity index 100% rename from go-workspace/src/bootstrap/garage.go rename to entrypoint/src/bootstrap/garage.go diff --git a/go-workspace/src/bootstrap/garage_global_bucket.go b/entrypoint/src/bootstrap/garage_global_bucket.go similarity index 100% rename from go-workspace/src/bootstrap/garage_global_bucket.go rename to entrypoint/src/bootstrap/garage_global_bucket.go diff --git a/go-workspace/src/bootstrap/hosts.go b/entrypoint/src/bootstrap/hosts.go similarity index 100% rename from go-workspace/src/bootstrap/hosts.go rename to entrypoint/src/bootstrap/hosts.go diff --git a/go-workspace/src/bootstrap/nebula.go b/entrypoint/src/bootstrap/nebula.go similarity index 100% rename from go-workspace/src/bootstrap/nebula.go rename to entrypoint/src/bootstrap/nebula.go diff --git a/go-workspace/src/cmd/entrypoint/admin.go b/entrypoint/src/cmd/entrypoint/admin.go similarity index 100% rename from go-workspace/src/cmd/entrypoint/admin.go rename to entrypoint/src/cmd/entrypoint/admin.go diff --git a/go-workspace/src/cmd/entrypoint/daemon.go b/entrypoint/src/cmd/entrypoint/daemon.go similarity index 100% rename from go-workspace/src/cmd/entrypoint/daemon.go rename to entrypoint/src/cmd/entrypoint/daemon.go diff --git a/go-workspace/src/cmd/entrypoint/daemon_util.go b/entrypoint/src/cmd/entrypoint/daemon_util.go similarity index 100% rename from go-workspace/src/cmd/entrypoint/daemon_util.go rename to entrypoint/src/cmd/entrypoint/daemon_util.go diff --git a/go-workspace/src/cmd/entrypoint/daemon_yml.go b/entrypoint/src/cmd/entrypoint/daemon_yml.go similarity index 100% rename from go-workspace/src/cmd/entrypoint/daemon_yml.go rename to entrypoint/src/cmd/entrypoint/daemon_yml.go diff --git a/go-workspace/src/cmd/entrypoint/garage.go b/entrypoint/src/cmd/entrypoint/garage.go similarity index 100% rename from go-workspace/src/cmd/entrypoint/garage.go rename to entrypoint/src/cmd/entrypoint/garage.go diff --git a/go-workspace/src/cmd/entrypoint/garage_util.go b/entrypoint/src/cmd/entrypoint/garage_util.go similarity index 100% rename from go-workspace/src/cmd/entrypoint/garage_util.go rename to entrypoint/src/cmd/entrypoint/garage_util.go diff --git a/go-workspace/src/cmd/entrypoint/hosts.go b/entrypoint/src/cmd/entrypoint/hosts.go similarity index 100% rename from go-workspace/src/cmd/entrypoint/hosts.go rename to entrypoint/src/cmd/entrypoint/hosts.go diff --git a/go-workspace/src/cmd/entrypoint/main.go b/entrypoint/src/cmd/entrypoint/main.go similarity index 100% rename from go-workspace/src/cmd/entrypoint/main.go rename to entrypoint/src/cmd/entrypoint/main.go diff --git a/go-workspace/src/cmd/entrypoint/nebula_util.go b/entrypoint/src/cmd/entrypoint/nebula_util.go similarity index 100% rename from go-workspace/src/cmd/entrypoint/nebula_util.go rename to entrypoint/src/cmd/entrypoint/nebula_util.go diff --git a/go-workspace/src/cmd/entrypoint/sub_cmd.go b/entrypoint/src/cmd/entrypoint/sub_cmd.go similarity index 100% rename from go-workspace/src/cmd/entrypoint/sub_cmd.go rename to entrypoint/src/cmd/entrypoint/sub_cmd.go diff --git a/go-workspace/src/cmd/entrypoint/version.go b/entrypoint/src/cmd/entrypoint/version.go similarity index 100% rename from go-workspace/src/cmd/entrypoint/version.go rename to entrypoint/src/cmd/entrypoint/version.go diff --git a/go-workspace/src/daemon_yml.go b/entrypoint/src/daemon_yml.go similarity index 100% rename from go-workspace/src/daemon_yml.go rename to entrypoint/src/daemon_yml.go diff --git a/go-workspace/src/doc.go b/entrypoint/src/doc.go similarity index 100% rename from go-workspace/src/doc.go rename to entrypoint/src/doc.go diff --git a/go-workspace/src/env.go b/entrypoint/src/env.go similarity index 100% rename from go-workspace/src/env.go rename to entrypoint/src/env.go diff --git a/go-workspace/src/garage/admin_client.go b/entrypoint/src/garage/admin_client.go similarity index 100% rename from go-workspace/src/garage/admin_client.go rename to entrypoint/src/garage/admin_client.go diff --git a/go-workspace/src/garage/client.go b/entrypoint/src/garage/client.go similarity index 100% rename from go-workspace/src/garage/client.go rename to entrypoint/src/garage/client.go diff --git a/go-workspace/src/garage/garage.go b/entrypoint/src/garage/garage.go similarity index 100% rename from go-workspace/src/garage/garage.go rename to entrypoint/src/garage/garage.go diff --git a/go-workspace/src/garage/infinite_reader.go b/entrypoint/src/garage/infinite_reader.go similarity index 100% rename from go-workspace/src/garage/infinite_reader.go rename to entrypoint/src/garage/infinite_reader.go diff --git a/go-workspace/src/garage/infinite_reader_test.go b/entrypoint/src/garage/infinite_reader_test.go similarity index 100% rename from go-workspace/src/garage/infinite_reader_test.go rename to entrypoint/src/garage/infinite_reader_test.go diff --git a/go-workspace/src/garage/peer.go b/entrypoint/src/garage/peer.go similarity index 100% rename from go-workspace/src/garage/peer.go rename to entrypoint/src/garage/peer.go diff --git a/go-workspace/src/garage/tpl.go b/entrypoint/src/garage/tpl.go similarity index 100% rename from go-workspace/src/garage/tpl.go rename to entrypoint/src/garage/tpl.go diff --git a/go-workspace/src/go.mod b/entrypoint/src/go.mod similarity index 100% rename from go-workspace/src/go.mod rename to entrypoint/src/go.mod diff --git a/go-workspace/src/go.sum b/entrypoint/src/go.sum similarity index 100% rename from go-workspace/src/go.sum rename to entrypoint/src/go.sum diff --git a/go-workspace/src/nebula/nebula.go b/entrypoint/src/nebula/nebula.go similarity index 100% rename from go-workspace/src/nebula/nebula.go rename to entrypoint/src/nebula/nebula.go diff --git a/go-workspace/src/proc_lock.go b/entrypoint/src/proc_lock.go similarity index 100% rename from go-workspace/src/proc_lock.go rename to entrypoint/src/proc_lock.go diff --git a/go-workspace/src/tarutil/tarutil.go b/entrypoint/src/tarutil/tarutil.go similarity index 100% rename from go-workspace/src/tarutil/tarutil.go rename to entrypoint/src/tarutil/tarutil.go diff --git a/go-workspace/src/tarutil/tgz_writer.go b/entrypoint/src/tarutil/tgz_writer.go similarity index 100% rename from go-workspace/src/tarutil/tgz_writer.go rename to entrypoint/src/tarutil/tgz_writer.go diff --git a/go-workspace/src/yamlutil/yamlutil.go b/entrypoint/src/yamlutil/yamlutil.go similarity index 100% rename from go-workspace/src/yamlutil/yamlutil.go rename to entrypoint/src/yamlutil/yamlutil.go diff --git a/go-workspace/README.md b/go-workspace/README.md deleted file mode 100644 index 459014a..0000000 --- a/go-workspace/README.md +++ /dev/null @@ -1,9 +0,0 @@ -# go-workspace - -This module is used for building all custom go binaries within the cryptic-net -project. - -The reason binaries are contained here, and not under the sub-directory for the -sub-process the correspond to like most other code in this project, is that nix -makes it difficult to compose multiple modules defined locally. If nix ever -fixes this we should split this out. diff --git a/go-workspace/default.nix b/go-workspace/default.nix deleted file mode 100644 index 41542ab..0000000 --- a/go-workspace/default.nix +++ /dev/null @@ -1,18 +0,0 @@ -{ - buildGoModule, -}: let - - build = subPackage: buildGoModule { - - pname = "cryptic-net-" + (builtins.baseNameOf subPackage); - version = "unstable"; - src = ./src; - vendorSha256 = "sha256-URmrK9Sd/5yhXrWxXZq05TS7aY7IWptQFMKfXKJY7Hc="; - subPackages = [ - subPackage - ]; - }; - -in { - entrypoint = build "cmd/entrypoint"; -} diff --git a/nix/wait-for.nix b/nix/wait-for.nix deleted file mode 100644 index 7da480a..0000000 --- a/nix/wait-for.nix +++ /dev/null @@ -1,21 +0,0 @@ -{ - fetchFromGitHub, - stdenv, -}: stdenv.mkDerivation rec { - - pname = "cryptic-net-wait-for"; - version = "2.2.2"; - - src = fetchFromGitHub { - owner = "eficode"; - repo = "wait-for"; - rev = "v${version}"; - sha256 = "sha256-qYeBOF63/+8bbFHiR6HT2mMQDFKCVkLNzIGLeEZJ4sk="; - }; - - builder = builtins.toFile "builder.sh" '' - source $stdenv/setup - mkdir -p "$out"/bin - cp "$src"/wait-for "$out"/bin/ - ''; -}