Skip to content

Commit a15388c

Browse files
committed
docs: document nixos installation
1 parent 2842bdc commit a15388c

File tree

1 file changed

+50
-0
lines changed

1 file changed

+50
-0
lines changed

README.md

+50
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,56 @@ Then run Alejandra with:
155155
$ alejandra --help
156156
```
157157

158+
### NixOS installation
159+
160+
- Nix with [Flakes](https://nixos.wiki/wiki/Flakes):
161+
162+
```nix
163+
{
164+
inputs = {
165+
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
166+
167+
alejandra.url = "github:kamadorueda/alejandra/0.7.0";
168+
alejandra.inputs.nixpkgs.follows = "nixpkgs";
169+
};
170+
171+
outputs = {alejandra, nixpkgs, ...}: {
172+
nixosConfigurations = {
173+
example = nixpkgs.lib.nixosSystem rec {
174+
# We support: aarch64-linux, aarch64-linux, x86_64-darwin, x86_64-linux
175+
system = "x86_64-linux";
176+
177+
modules = [
178+
{
179+
environment.systemPackages = [alejandra.defaultPackage.${system}];
180+
}
181+
# Import your other modules here
182+
# ./path/to/my/module.nix
183+
# ...
184+
];
185+
};
186+
};
187+
};
188+
}
189+
```
190+
191+
- Nix stable:
192+
193+
```nix
194+
let
195+
alejandra =
196+
(import (builtins.fetchTarball {
197+
url = "https://github.com/kamadorueda/alejandra/tarball/0.7.0";
198+
sha256 = "0kqkwi4j1d0n334jl3q6x70ga8jqmqpv514zsbfca2a86c7qs6cf";
199+
}))
200+
# Pick one from: aarch64-linux, aarch64-linux, x86_64-darwin, x86_64-linux
201+
.x86_64-linux
202+
.outPath;
203+
in {
204+
environment.systemPackages = [alejandra];
205+
}
206+
```
207+
158208
## Do I need to configure anything?
159209

160210
- No.

0 commit comments

Comments
 (0)