From f30debc65ca41beddde696393718764376b9e299 Mon Sep 17 00:00:00 2001 From: lassulus Date: Thu, 3 May 2018 13:11:21 +0200 Subject: kops -> krops --- pkgs/kops/default.nix | 48 ------------------------------------------------ pkgs/krops/default.nix | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ pkgs/overlay.nix | 2 +- 3 files changed, 49 insertions(+), 49 deletions(-) delete mode 100644 pkgs/kops/default.nix create mode 100644 pkgs/krops/default.nix diff --git a/pkgs/kops/default.nix b/pkgs/kops/default.nix deleted file mode 100644 index fc52327..0000000 --- a/pkgs/kops/default.nix +++ /dev/null @@ -1,48 +0,0 @@ -let - lib = import ../../lib // { - isLocalTarget = let - origin = lib.mkTarget ""; - in target: - target.host == origin.host && - target.user == origin.user; - }; -in - -{ nix, openssh, populate, writeDash, writeJSON }: { - - writeDeploy = name: { source, target }: let - target' = lib.mkTarget target; - in - writeDash name '' - set -efu - - ${populate}/bin/populate \ - ${target'.user}@${target'.host}:${target'.port}${target'.path} \ - < ${writeJSON "${name}-source.json" source} - - ${openssh}/bin/ssh \ - ${target'.user}@${target'.host} -p ${target'.port} \ - nixos-rebuild switch -I ${target'.path} - ''; - - writeTest = name: { source, target }: let - target' = lib.mkTarget target; - in - assert lib.isLocalTarget target'; - writeDash name '' - set -efu - - ${populate}/bin/populate --force \ - ${target'.path} \ - < ${writeJSON "${name}-source.json" source} - - ${nix}/bin/nix-build \ - -A config.system.build.toplevel \ - -I ${target'.path} \ - --arg modules '[]' \ - --no-out-link \ - --show-trace \ - '' - ''; - -} diff --git a/pkgs/krops/default.nix b/pkgs/krops/default.nix new file mode 100644 index 0000000..fc52327 --- /dev/null +++ b/pkgs/krops/default.nix @@ -0,0 +1,48 @@ +let + lib = import ../../lib // { + isLocalTarget = let + origin = lib.mkTarget ""; + in target: + target.host == origin.host && + target.user == origin.user; + }; +in + +{ nix, openssh, populate, writeDash, writeJSON }: { + + writeDeploy = name: { source, target }: let + target' = lib.mkTarget target; + in + writeDash name '' + set -efu + + ${populate}/bin/populate \ + ${target'.user}@${target'.host}:${target'.port}${target'.path} \ + < ${writeJSON "${name}-source.json" source} + + ${openssh}/bin/ssh \ + ${target'.user}@${target'.host} -p ${target'.port} \ + nixos-rebuild switch -I ${target'.path} + ''; + + writeTest = name: { source, target }: let + target' = lib.mkTarget target; + in + assert lib.isLocalTarget target'; + writeDash name '' + set -efu + + ${populate}/bin/populate --force \ + ${target'.path} \ + < ${writeJSON "${name}-source.json" source} + + ${nix}/bin/nix-build \ + -A config.system.build.toplevel \ + -I ${target'.path} \ + --arg modules '[]' \ + --no-out-link \ + --show-trace \ + '' + ''; + +} diff --git a/pkgs/overlay.nix b/pkgs/overlay.nix index 89024bd..95d4938 100644 --- a/pkgs/overlay.nix +++ b/pkgs/overlay.nix @@ -3,7 +3,7 @@ let in self: super: { - kops = self.callPackage ./kops {}; + krops = self.callPackage ./krops {}; populate = self.callPackage ./populate {}; writeDash = name: text: self.writeScript name '' #! ${self.dash}/bin/dash -- cgit v1.2.3