From 51f9231930c4b2641eed56514fd42ae71c024db3 Mon Sep 17 00:00:00 2001 From: lassulus Date: Sat, 22 Dec 2018 22:49:09 +0100 Subject: [PATCH] fix some typos in nix-instantiate article --- content/nixos/nix-instantiate.md | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/content/nixos/nix-instantiate.md b/content/nixos/nix-instantiate.md index 1d55c77..4697670 100644 --- a/content/nixos/nix-instantiate.md +++ b/content/nixos/nix-instantiate.md @@ -13,19 +13,19 @@ summary: > # nix-instantiate I like NixOS and the way modules work. -I miss it when I do tasks in other languages, +I miss them when I do tasks in other languages, which have less power than NixOS, for example [Ansible](https://www.ansible.com) and [Terraform](https://www.terraform.io). Luckily all these tools can be configured via JSON, and Nix can easily create JSON. -The tool go to tool for that job is +The goto tool for that job is [nix-instantiate](https://nixos.org/nix/manual/#sec-nix-instantiate) which every NixOS has installed (yeye!). ## Small overview -I will show you how easy it is, with a few lines of nix +I will show you how easy it is, with a few lines of nix, to create a JSON renderer for terraform configuration files. But this is only done in a sketchy way, to inspire you to create your own setup for @@ -127,9 +127,9 @@ we get the following json. } ``` -This is almost what we like to see. the `_module` value is not wanted. -so lets remove it with a sanitize function, and move the content path -in a different file called config.nix +This is almost what we want to see. the `_module` value is not needed. +So lets remove it with a sanitize function, and move the content path +to a different file called config.nix ```nix # file test3.nix @@ -159,7 +159,7 @@ in (sanitize result.config) ``` -in `config.nix` we can now focus on the configuration content. And it we write it +in `config.nix` we can now focus on the configuration content. And we write it just like we would write a NixOS module. ```nix @@ -215,12 +215,12 @@ or hiding complexity. ## a simple example -Let's make an example a none NixOS veteran can see -how you would start using this modules system. +Let's make an example so a none NixOS veteran can see +how to start using this modules system. ### hcloud.nix -The following file should show is a module that let's us create +The following file is a module that let's us create resource entries to create a [hcloud server](https://www.terraform.io/docs/providers/hcloud/r/server.html). But it has one parameter `additionalFileSize` @@ -344,12 +344,11 @@ $> nix-instantiate --eval --strict --json test3.nix --show-trace | jq } ``` -The output is quite like we expected it to be. +The output is like we expected it to be. -The `hcloud` parameter should be removed, but for now it I leave it here, +The `hcloud` parameter should be removed, but for now I will leave it here, to see the original configuration. -To make this work in terraform, you have to remove everything of course, -except `resource`. +To make this work in terraform, you have to remove everything except `resource`. #### with additionalFileSize @@ -415,7 +414,7 @@ properly removed from `resource.hcloud_server.test`. You could also create this very simple example with `variables`, `locals` and `count`. -But doing that you already reached the limits of +By doing that you already reached the limits of `HCL` but in Nix this is a very simple example. ## A more complex Example