commit cf14481b9001d24fdcb5178c8241b59b16d6d893
parent db975c4c8238cca7d83369e49702dc1fb8aca6df
Author: Katja (ctucx) <git@ctu.cx>
Date: Mon, 17 Mar 2025 10:49:24 +0100
parent db975c4c8238cca7d83369e49702dc1fb8aca6df
Author: Katja (ctucx) <git@ctu.cx>
Date: Mon, 17 Mar 2025 10:49:24 +0100
update `example.nix`, `README.md`
2 files changed, 4 insertions(+), 33 deletions(-)
diff --git a/README.md b/README.md @@ -78,11 +78,6 @@ You can build an example zone in `example.nix` by running ## Use ### Importing - -There are two ways to import `dns.nix`. - -#### As a flake - Add it as an input to your flake: ```nix @@ -99,31 +94,12 @@ Add it as an input to your flake: }; outputs = { self, nixpkgs, dns }: { - # Most functions from `dns.nix` are available in `dns.lib`. - # Functions that require `stdenv` (e.g. `writeZone`) are in - # `dns.util.<system>`. + # Functions from `dns.nix` are available in `dns.lib`. # ... }; } ``` -#### Importing directly (legacy) - -Always get the latest version from GitHub: - -```nix -let - dns = import (builtins.fetchTarball "https://github.com/kirelagin/dns.nix/archive/master.zip"); -in { - # ... -} -``` - -To make your setup more reproducible, you should pin the version used by specifying -a commit hash or using a submodule. This is all a little clumsy and nowadays it -is probably best to simply switch to flakes. - - ### In your NixOS configuration _There is a chance that in the future we will either integrate this into @@ -232,10 +208,6 @@ As another example, take a look at the `evalZone` function in `dns/default.nix`, which takes a name for a zone and a zone definition, defines a “fake” module similar to the one above, and then evaluates it. -`dns.utils` provides `writeZone`, which is a helper function that additionally -calls `toString` and writes the resulting string to a file. - - ## Contributing If you encounter any issues when using this library or have improvement ideas,
diff --git a/example.nix b/example.nix @@ -5,8 +5,7 @@ # let - dns = import ./.; - util = dns.util.${builtins.currentSystem}; + dns = builtins.getFlake (toString ./.); testZone = with dns.lib.combinators; { SOA = { @@ -62,6 +61,6 @@ let foo.subdomains.www.CNAME = [ "foo.test.com." ]; }; }; -in +in -util.writeZone "test.com" testZone +dns.lib.toString "test.com" testZone