From 1d7fd1569043356d9c64d81e8b40177e164f2017 Mon Sep 17 00:00:00 2001 From: malteneuss Date: Sun, 16 Jul 2023 21:34:50 +0200 Subject: [PATCH] Extend flake install section --- README.md | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 204a974..a238f82 100644 --- a/README.md +++ b/README.md @@ -199,13 +199,14 @@ To install the `agenix` binary: #### Install CLI via Flakes -You don't need to install it, +You can run the CLI tool ad-hoc without installing it: ```ShellSession nix run github:ryantm/agenix -- --help ``` -but, if you want to (change the system based on your system): +But you can also add it permanently into a [NixOS module](https://nixos.wiki/wiki/NixOS_modules) +(replace system "x86_64-linux" with your system): ```nix { @@ -213,6 +214,28 @@ but, if you want to (change the system based on your system): } ``` +e.g. inside your `flake.nix` file: + +```nix +{ + inputs.agenix.url = "github:ryantm/agenix"; + # ... + + outputs = { self, nixpkgs, agenix }: { + # change `yourhostname` to your actual hostname + nixosConfigurations.yourhostname = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + # ... + { + environment.systemPackages = [ agenix.packages.${system}.default ]; + } + ]; + }; + }; +} +``` + ## Tutorial