From 40b97e47baa2db4a52341520f38146ef62c65dca Mon Sep 17 00:00:00 2001 From: Ingolf Wagner Date: Sun, 30 Sep 2018 09:12:03 +0200 Subject: [PATCH] indention of the text --- content/nixos/krops.md | 53 +++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 29 deletions(-) diff --git a/content/nixos/krops.md b/content/nixos/krops.md index c4f9b70..39f53fd 100644 --- a/content/nixos/krops.md +++ b/content/nixos/krops.md @@ -104,7 +104,7 @@ it is a library you use to write executables which do the actual deployment. Let's say you have a very simple `configuration.nix` -``` +```nix { pkgs, ... }: { environment.systemPackages = [ pkgs.git ]; @@ -114,40 +114,35 @@ Let's say you have a very simple `configuration.nix` Than you can use the following script (let's name it `krops.nix`) to deploy it on the machine `server01.mydomain.org`. -``` +```nix let + krops = builtins.fetchGit { + url = "https://cgit.krebsco.de/krops/"; + }; + lib = import "${krops}/lib"; + pkgs = import "${krops}/pkgs" {}; -krops = builtins.fetchGit { - url = "https://cgit.krebsco.de/krops/"; -}; + source = lib.evalSource [ + { + nixpkgs.git = { + ref = "nixos-18.03"; + url = https://github.com/NixOS/nixpkgs-channels; + }; + nixos-config.file = toString ./configuration.nix; + } + ]; -lib = import "${krops}/lib"; -pkgs = import "${krops}/pkgs" {}; - -source = lib.evalSource [ - { - nixpkgs.git = { - ref = "nixos-18.03"; - url = https://github.com/NixOS/nixpkgs-channels; - }; - - nixos-config.file = toString ./configuration.nix; + in { + server01 = pkgs.krops.writeDeploy "deploy-server01" { + source = source; + target = "root@server01.mydomain.org"; + }; } -]; - -server01 = pkgs.krops.writeDeploy "deploy-server01" { - source = source; - target = "root@server01.mydomain.org"; -}; - -in { - - server01 = server01; - -} ``` + Now you can deploy the machine by running: -``` + +```shell $> nix-build ./krops.nix -A server01 && result ``` You need to make sure you have ssh access to the root user on `server01.mydomain.org`