From 680e063c0fe208da326eaa8fe01c9c712e8e04db Mon Sep 17 00:00:00 2001 From: lassulus Date: Mon, 4 Jun 2018 12:55:49 +0200 Subject: kops -> krops --- krebs/kops.nix | 64 -------------------------------------------------------- krebs/krops.nix | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ krebs/source.nix | 2 +- 3 files changed, 64 insertions(+), 65 deletions(-) delete mode 100644 krebs/kops.nix create mode 100644 krebs/krops.nix diff --git a/krebs/kops.nix b/krebs/kops.nix deleted file mode 100644 index add1a359c..000000000 --- a/krebs/kops.nix +++ /dev/null @@ -1,64 +0,0 @@ -{ name }: rec { - - kops = (import {}).fetchgit { - url = https://cgit.krebsco.de/kops/; - rev = "e89cf20d4310070a877c2e24a287659546b561c9"; - sha256 = "0wg8d80sxa46z4i7ir79sci2hwmv3qskzqdg0si64p6vazy8vckb"; - }; - - lib = import "${kops}/lib"; - - # TODO document why pkgs should be used like this - pkgs = import "${kops}/pkgs" {}; - - krebs-source = { - nixpkgs.git = { - ref = "ef74cafd3e5914fdadd08bf20303328d72d65d6c"; - url = https://github.com/NixOS/nixpkgs; - }; - stockholm.file = toString ../.; - stockholm-version.pipe = toString (pkgs.writeDash "${name}-version" '' - set -efu - cd $HOME/stockholm - V=$(${pkgs.coreutils}/bin/date +%y.%m) - if test -d .git; then - V=$V.git.$(${pkgs.git}/bin/git describe --always --dirty) - case $V in (*-dirty) - V=$V@''${HOSTNAME-$(${pkgs.nettools}/bin/hostname)} - esac - fi - printf %s "$V" - ''); - }; - - source ={ test }: lib.evalSource [ - krebs-source - { - nixos-config.symlink = "stockholm/krebs/1systems/${name}/config.nix"; - secrets = - if test - then { - file = toString ; - } - else { - pass = { - dir = "${lib.getEnv "HOME"}/brain"; - name = "krebs-secrets/${name}"; - }; - } - ; - } - ]; - - # usage: $(nix-build --no-out-link --argstr name HOSTNAME -A deploy) - deploy = pkgs.kops.writeDeploy "${name}-deploy" { - source = source { test = false; }; - target = "root@${name}/var/src"; - }; - - # usage: $(nix-build --no-out-link --argstr name HOSTNAME -A test) - test = pkgs.kops.writeTest "${name}-test" { - source = source { test = true; }; - target = "${lib.getEnv "HOME"}/tmp/${name}-kops-test-src"; - }; -} diff --git a/krebs/krops.nix b/krebs/krops.nix new file mode 100644 index 000000000..03bcdc83e --- /dev/null +++ b/krebs/krops.nix @@ -0,0 +1,63 @@ +{ name }: rec { + + krops = builtins.fetchGit { + url = https://cgit.krebsco.de/krops/; + rev = "4e466eaf05861b47365c5ef46a31a188b70f3615"; + }; + + lib = import "${krops}/lib"; + + # TODO document why pkgs should be used like this + pkgs = import "${krops}/pkgs" {}; + + krebs-source = { + nixpkgs.git = { + ref = "ef74cafd3e5914fdadd08bf20303328d72d65d6c"; + url = https://github.com/NixOS/nixpkgs; + }; + stockholm.file = toString ../.; + stockholm-version.pipe = toString (pkgs.writeDash "${name}-version" '' + set -efu + cd $HOME/stockholm + V=$(${pkgs.coreutils}/bin/date +%y.%m) + if test -d .git; then + V=$V.git.$(${pkgs.git}/bin/git describe --always --dirty) + case $V in (*-dirty) + V=$V@''${HOSTNAME-$(${pkgs.nettools}/bin/hostname)} + esac + fi + printf %s "$V" + ''); + }; + + source ={ test }: lib.evalSource [ + krebs-source + { + nixos-config.symlink = "stockholm/krebs/1systems/${name}/config.nix"; + secrets = + if test + then { + file = toString ; + } + else { + pass = { + dir = "${lib.getEnv "HOME"}/brain"; + name = "krebs-secrets/${name}"; + }; + } + ; + } + ]; + + # usage: $(nix-build --no-out-link --argstr name HOSTNAME -A deploy) + deploy = pkgs.krops.writeDeploy "${name}-deploy" { + source = source { test = false; }; + target = "root@${name}/var/src"; + }; + + # usage: $(nix-build --no-out-link --argstr name HOSTNAME -A test) + test = pkgs.krops.writeTest "${name}-test" { + source = source { test = true; }; + target = "${lib.getEnv "HOME"}/tmp/${name}-krops-test-src"; + }; +} diff --git a/krebs/source.nix b/krebs/source.nix index 49f464f61..2aaa27b2b 100644 --- a/krebs/source.nix +++ b/krebs/source.nix @@ -22,7 +22,7 @@ in }; stockholm.file = toString ; stockholm-version.pipe = "${pkgs.stockholm}/bin/get-version"; - nixpkgs = (import ./kops.nix { name = ""; }).krebs-source.nixpkgs; + nixpkgs = (import ./krops.nix { name = ""; }).krebs-source.nixpkgs; } override ] -- cgit v1.2.3