summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaiderd Jordan <daiderd@gmail.com>2020-10-18 17:02:45 +0200
committerDaiderd Jordan <daiderd@gmail.com>2020-10-21 18:30:57 +0200
commit362c04011b2d5ca81ffa060e7b8b00fccd4f7edf (patch)
tree478f047a4aed6394cce466b9c90dc680d18b60b4
parent1741ab18a64316a95d6ce21bde51b84753b32731 (diff)
readme flakes section
-rw-r--r--README.md46
1 files changed, 45 insertions, 1 deletions
diff --git a/README.md b/README.md
index 694c318..aa24cf9 100644
--- a/README.md
+++ b/README.md
@@ -61,6 +61,50 @@ Check out [modules/examples](https://github.com/LnL7/nix-darwin/tree/master/modu
}
```
+## Flakes (experimental)
+
+There is also preliminary support for building your configuration using a flake. This
+is mostly based on the flake support that was added to NixOS.
+
+A minimal example of using an existing configuration.nix:
+
+```nix
+{
+ description = "John's darwin system";
+
+ inputs = {
+ nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-20.09-darwin";
+ darwin.url = "github:lnl7/nix-darwin/master";
+ darwin.inputs.nixpkgs.follows = "nixpkgs";
+ };
+
+ outputs = { self, darwin, nixpkgs }: {
+ darwinConfigurations."Johns-MacBook" = darwin.lib.darwinSystem {
+ modules = [ ./configuration.nix ];
+ };
+ };
+}
+```
+
+Inputs from the flake can also be passed to `darwinSystem`, these inputs are then
+accessible as an argument, similar to pkgs and lib inside the configuration.
+
+```nix
+darwin.lib.darwinSystem {
+ modules = [ ... ];
+ inputs = { inherit darwin dotfiles nixpkgs; };
+}
+```
+
+Since the installer doesn't work with flakes out of the box yet nix-darwin will need to
+be to be bootstrapped using the installer or manually. Afterwards the flake based
+configuration can be built. The `hostname(1)` of your system will be used to decide
+which darwin configuration is applied if it's not specified explicitly in the flake ref.
+
+```sh
+darwin-rebuild switch --flake ~/.config/darwin
+```
+
## Manual Install
```bash
@@ -114,7 +158,7 @@ $
```
```
-$ darwin-option services.activate-system.enable ~/src/nix-darwin
+$ darwin-option services.activate-system.enable
Value:
true