summaryrefslogtreecommitdiffstats
path: root/krebs/5pkgs
diff options
context:
space:
mode:
Diffstat (limited to 'krebs/5pkgs')
-rw-r--r--krebs/5pkgs/default.nix21
-rw-r--r--krebs/5pkgs/get-ssh-port/default.nix29
2 files changed, 40 insertions, 10 deletions
diff --git a/krebs/5pkgs/default.nix b/krebs/5pkgs/default.nix
index 0c39324a7..5ec0d54e9 100644
--- a/krebs/5pkgs/default.nix
+++ b/krebs/5pkgs/default.nix
@@ -14,7 +14,16 @@ with config.krebs.lib;
then trace "Upstream `${upstream.name}' gets overridden by `${override.name}'." override
else override;
- in {
+ in {}
+ // import ./builders.nix args
+ // mapAttrs (_: flip callPackage {})
+ (filterAttrs (_: dir.has-default-nix)
+ (subdirsOf ./.))
+ // {
+ get-ssh-port = callPackage ./get-ssh-port {
+ inherit config;
+ };
+
haskellPackages = pkgs.haskellPackages.override {
overrides = self: super:
mapAttrs (name: path: self.callPackage path {})
@@ -29,18 +38,10 @@ with config.krebs.lib;
(builtins.readDir ./haskell-overrides));
};
- push = callPackage ./push {
- inherit (subdirs) get;
- };
-
ReaktorPlugins = callPackage ./Reaktor/plugins.nix {};
test = {
infest-cac-centos7 = callPackage ./test/infest-cac-centos7 {};
};
- }
- // import ./builders.nix args
- // mapAttrs (_: flip callPackage {})
- (filterAttrs (_: dir.has-default-nix)
- (subdirsOf ./.));
+ };
}
diff --git a/krebs/5pkgs/get-ssh-port/default.nix b/krebs/5pkgs/get-ssh-port/default.nix
new file mode 100644
index 000000000..2d106b2b6
--- /dev/null
+++ b/krebs/5pkgs/get-ssh-port/default.nix
@@ -0,0 +1,29 @@
+{ config, pkgs, ... }: with config.krebs.lib;
+
+pkgs.writeScriptBin "get-ssh-port" ''
+ #! ${pkgs.dash}/bin/dash
+ set -efu
+ if test $# != 1 || test $1 = -h || test $1 = --help; then
+ echo "usage: get-ssh-port HOSTNAME" >&2
+ exit 23
+ fi
+ case $1 in
+ ${concatMapStringsSep ";;\n"
+ (host: toString [
+ "(${shell.escape host.name})"
+ "echo ${toString host.nets.${config.krebs.search-domain}.ssh.port}"
+ ])
+ (filter (host: hasAttr config.krebs.search-domain host.nets)
+ (attrValues config.krebs.hosts))
+ };;
+ ${concatMapStringsSep ";;\n"
+ (net: toString [
+ "(${concatMapStringsSep "|" shell.escape net.aliases})"
+ "echo ${toString net.ssh.port}"
+ ])
+ (concatMap (host: attrValues host.nets) (attrValues config.krebs.hosts))
+ };;
+ (*) echo "get-ssh-port: don't know ssh port of $1" >&2
+ exit 1
+ esac
+''