From 2cb7f5fb1e502fe5502d37fce0a9b7a16ea24fd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20Hamb=C3=BCchen?= Date: Fri, 26 Oct 2018 18:07:56 +0200 Subject: [PATCH] consul: 0.9.3 -> 1.3.0. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Removes the old UI build tooling; it is no longer necessary because as of 1.2.0 it's bundled into the server binary. It doesn't even need to have JS built, because it's bundled into the release commit's source tree (see #48714). The UI is enabled by default, so the NixOS service is updated to directly use `ui = webUi;` now. Fixes #48714. Fixes #44192. Fixes #41243. Fixes #35602. Signed-off-by: Niklas Hambüchen --- nixos/modules/services/networking/consul.nix | 7 ++- pkgs/servers/consul/Gemfile | 5 -- pkgs/servers/consul/Gemfile.lock | 25 -------- pkgs/servers/consul/default.nix | 19 +++--- pkgs/servers/consul/gemset.nix | 62 -------------------- pkgs/servers/consul/ui-no-bundle-exec.patch | 17 ------ pkgs/servers/consul/ui.nix | 41 ------------- pkgs/top-level/all-packages.nix | 2 - 8 files changed, 16 insertions(+), 162 deletions(-) delete mode 100644 pkgs/servers/consul/Gemfile delete mode 100644 pkgs/servers/consul/Gemfile.lock delete mode 100644 pkgs/servers/consul/gemset.nix delete mode 100644 pkgs/servers/consul/ui-no-bundle-exec.patch delete mode 100644 pkgs/servers/consul/ui.nix diff --git a/nixos/modules/services/networking/consul.nix b/nixos/modules/services/networking/consul.nix index ab3f81037681..0e90fed788b9 100644 --- a/nixos/modules/services/networking/consul.nix +++ b/nixos/modules/services/networking/consul.nix @@ -6,9 +6,10 @@ let dataDir = "/var/lib/consul"; cfg = config.services.consul; - configOptions = { data_dir = dataDir; } // - (if cfg.webUi then { ui_dir = "${cfg.package.ui}"; } else { }) // - cfg.extraConfig; + configOptions = { + data_dir = dataDir; + ui = cfg.webUi; + } // cfg.extraConfig; configFiles = [ "/etc/consul.json" "/etc/consul-addrs.json" ] ++ cfg.extraConfigFiles; diff --git a/pkgs/servers/consul/Gemfile b/pkgs/servers/consul/Gemfile deleted file mode 100644 index 0e782af6b000..000000000000 --- a/pkgs/servers/consul/Gemfile +++ /dev/null @@ -1,5 +0,0 @@ -# A sample Gemfile -source "https://rubygems.org" - -gem "uglifier" -gem "sass" diff --git a/pkgs/servers/consul/Gemfile.lock b/pkgs/servers/consul/Gemfile.lock deleted file mode 100644 index 60a565f66951..000000000000 --- a/pkgs/servers/consul/Gemfile.lock +++ /dev/null @@ -1,25 +0,0 @@ -GEM - remote: https://rubygems.org/ - specs: - execjs (2.7.0) - ffi (1.9.23) - rb-fsevent (0.10.3) - rb-inotify (0.9.10) - ffi (>= 0.5.0, < 2) - sass (3.5.6) - sass-listen (~> 4.0.0) - sass-listen (4.0.0) - rb-fsevent (~> 0.9, >= 0.9.4) - rb-inotify (~> 0.9, >= 0.9.7) - uglifier (4.1.10) - execjs (>= 0.3.0, < 3) - -PLATFORMS - ruby - -DEPENDENCIES - sass - uglifier - -BUNDLED WITH - 1.14.6 diff --git a/pkgs/servers/consul/default.nix b/pkgs/servers/consul/default.nix index 5cf192791000..d1dcd78667f0 100644 --- a/pkgs/servers/consul/default.nix +++ b/pkgs/servers/consul/default.nix @@ -1,22 +1,27 @@ -{ stdenv, buildGoPackage, consul-ui, fetchFromGitHub }: +{ stdenv, buildGoPackage, fetchFromGitHub }: buildGoPackage rec { name = "consul-${version}"; - version = "0.9.3"; + version = "1.3.0"; rev = "v${version}"; goPackagePath = "github.com/hashicorp/consul"; + # Note: Currently only release tags are supported, because they have the Consul UI + # vendored. See + # https://github.com/NixOS/nixpkgs/pull/48714#issuecomment-433454834 + # If you want to use a non-release commit as `src`, you probably want to improve + # this derivation so that it can build the UI's JavaScript from source. + # See https://github.com/NixOS/nixpkgs/pull/49082 for something like that. + # Or, if you want to patch something that doesn't touch the UI, you may want + # to apply your changes as patches on top of a release commit. src = fetchFromGitHub { owner = "hashicorp"; repo = "consul"; inherit rev; - sha256 = "1176frp7kimpycsmz9wrbizf46jgxr8jq7hz5w4q1x90lswvrxv3"; + sha256 = "1zv84snvrjm74w3v3rr27linsbxj00m73xd047sb78a4766xs2h0"; }; - # Keep consul.ui for backward compatability - passthru.ui = consul-ui; - preBuild = '' buildFlagsArray+=("-ldflags" "-X github.com/hashicorp/consul/version.GitDescribe=v${version} -X github.com/hashicorp/consul/version.Version=${version} -X github.com/hashicorp/consul/version.VersionPrerelease=") ''; @@ -26,6 +31,6 @@ buildGoPackage rec { homepage = https://www.consul.io/; platforms = platforms.linux ++ platforms.darwin; license = licenses.mpl20; - maintainers = with maintainers; [ pradeepchhetri ]; + maintainers = with maintainers; [ pradeepchhetri vdemeester nh2 ]; }; } diff --git a/pkgs/servers/consul/gemset.nix b/pkgs/servers/consul/gemset.nix deleted file mode 100644 index 2a5425ccf5f5..000000000000 --- a/pkgs/servers/consul/gemset.nix +++ /dev/null @@ -1,62 +0,0 @@ -{ - execjs = { - source = { - remotes = ["https://rubygems.org"]; - sha256 = "1yz55sf2nd3l666ms6xr18sm2aggcvmb8qr3v53lr4rir32y1yp1"; - type = "gem"; - }; - version = "2.7.0"; - }; - ffi = { - source = { - remotes = ["https://rubygems.org"]; - sha256 = "0zw6pbyvmj8wafdc7l5h7w20zkp1vbr2805ql5d941g2b20pk4zr"; - type = "gem"; - }; - version = "1.9.23"; - }; - rb-fsevent = { - source = { - remotes = ["https://rubygems.org"]; - sha256 = "1lm1k7wpz69jx7jrc92w3ggczkjyjbfziq5mg62vjnxmzs383xx8"; - type = "gem"; - }; - version = "0.10.3"; - }; - rb-inotify = { - dependencies = ["ffi"]; - source = { - remotes = ["https://rubygems.org"]; - sha256 = "0yfsgw5n7pkpyky6a9wkf1g9jafxb0ja7gz0qw0y14fd2jnzfh71"; - type = "gem"; - }; - version = "0.9.10"; - }; - sass = { - dependencies = ["sass-listen"]; - source = { - remotes = ["https://rubygems.org"]; - sha256 = "19wyzp9qsg8hdkkxlsv713w0qmy66qrdp0shj42587ssx4qhrlag"; - type = "gem"; - }; - version = "3.5.6"; - }; - sass-listen = { - dependencies = ["rb-fsevent" "rb-inotify"]; - source = { - remotes = ["https://rubygems.org"]; - sha256 = "0xw3q46cmahkgyldid5hwyiwacp590zj2vmswlll68ryvmvcp7df"; - type = "gem"; - }; - version = "4.0.0"; - }; - uglifier = { - dependencies = ["execjs"]; - source = { - remotes = ["https://rubygems.org"]; - sha256 = "0dycp9c5xiricla6sgvg0vf22i3axs5k1v1607dvl7nv1xkkaczi"; - type = "gem"; - }; - version = "4.1.10"; - }; -} \ No newline at end of file diff --git a/pkgs/servers/consul/ui-no-bundle-exec.patch b/pkgs/servers/consul/ui-no-bundle-exec.patch deleted file mode 100644 index 5707b871049b..000000000000 --- a/pkgs/servers/consul/ui-no-bundle-exec.patch +++ /dev/null @@ -1,17 +0,0 @@ -diff --git a/ui/scripts/dist.sh b/ui/scripts/dist.sh -index 0ad6e28e..db340da0 100755 ---- a/ui/scripts/dist.sh -+++ b/ui/scripts/dist.sh -@@ -15,10 +15,9 @@ DEPLOY="../pkg/web_ui" - rm -rf $DEPLOY - mkdir -p $DEPLOY - --bundle check >/dev/null 2>&1 || bundle install --bundle exec sass styles/base.scss static/base.css -+sass styles/base.scss static/base.css - --bundle exec ruby scripts/compile.rb -+ruby scripts/compile.rb - - # Copy into deploy - shopt -s dotglob diff --git a/pkgs/servers/consul/ui.nix b/pkgs/servers/consul/ui.nix deleted file mode 100644 index da9b518bad73..000000000000 --- a/pkgs/servers/consul/ui.nix +++ /dev/null @@ -1,41 +0,0 @@ -{ stdenv, consul, ruby, bundlerEnv, zip, nodejs }: - -let - # `sass` et al - gems = bundlerEnv { - name = "consul-ui-deps"; - gemdir = ./.; - }; -in - -stdenv.mkDerivation { - name = "consul-ui-${consul.version}"; - - src = consul.src; - - buildInputs = [ ruby gems zip nodejs ]; - - patches = [ ./ui-no-bundle-exec.patch ]; - - postPatch = "patchShebangs ./ui/scripts/dist.sh"; - - buildPhase = '' - # Build ui static files - cd ui - make dist - ''; - - installPhase = '' - # Install ui static files - mkdir -p $out - mv ../pkg/web_ui/* $out - ''; - - meta = with stdenv.lib; { - homepage = https://www.consul.io/; - description = "A tool for service discovery, monitoring and configuration"; - maintainers = with maintainers; [ cstrahan wkennington ]; - license = licenses.mpl20 ; - platforms = platforms.unix; - }; -} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 38ade0014b1b..d647840fc18d 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -1136,8 +1136,6 @@ with pkgs; consul = callPackage ../servers/consul { }; - consul-ui = callPackage ../servers/consul/ui.nix { }; - consul-alerts = callPackage ../servers/monitoring/consul-alerts { }; consul-template = callPackage ../tools/system/consul-template { };