mirror of
https://codeberg.org/privacy1st/nix-git
synced 2024-12-23 02:36:05 +01:00
docs: add colmena eval
This commit is contained in:
parent
2a1f54b5d8
commit
9bc89a6dc4
25
NixOS.md
25
NixOS.md
@ -28,6 +28,7 @@ This document contains general notes about NixOS that are independent of my NixO
|
||||
* [NixOS configuration debugging](#nixos-configuration-debugging)
|
||||
* [Show Nix configuration](#show-nix-configuration)
|
||||
* [Evaluate NixOS configuration to JSON](#evaluate-nixos-configuration-to-json)
|
||||
* [Evaluate expressions in the context of a NixOS configuration managed with Colmena](#evaluate-expressions-in-the-context-of-a-nixos-configuration-managed-with-colmena)
|
||||
* [Evaluate expressions](#evaluate-expressions)
|
||||
* [Escape strings](#escape-strings)
|
||||
* [Run AppImages](#run-appimages)
|
||||
@ -674,6 +675,30 @@ import ./hosts/yodaTab/configuration.nix {
|
||||
|
||||
Then open `evaluated-config.json`.
|
||||
|
||||
## Evaluate expressions in the context of a NixOS configuration managed with Colmena
|
||||
|
||||
https://colmena.cli.rs/unstable/reference/cli.html#colmena-eval
|
||||
|
||||
Either specify a file containing the expression or add it as argument with `-E`.
|
||||
|
||||
```shell
|
||||
colmena eval -E '{ nodes, lib, pkgs, ... }: nodes.yodaTux.config.networking.hostName'
|
||||
```
|
||||
|
||||
```shell
|
||||
nix-shell -p jq
|
||||
colmena eval -E '{ nodes, lib, pkgs, ... }: nodes.yodaTux.config.environment.systemPackages' | jq
|
||||
```
|
||||
|
||||
```shell
|
||||
colmena eval -E '{ nodes, lib, pkgs, ... }: pkgs.linux'
|
||||
#=> "/nix/store/6l9b3dly45iv2rp17hk5c3wvawaq0viy-linux-6.6.46"
|
||||
```
|
||||
|
||||
```shell
|
||||
colmena eval -E '{ nodes, lib, pkgs, ... }: { imports = [ ./modules/nur-and-unstable.nix ]; pkgs.linux }'
|
||||
```
|
||||
|
||||
## Evaluate expressions
|
||||
|
||||
* https://discourse.nixos.org/t/eval-nix-expression-from-the-command-line/8993/6
|
||||
|
Loading…
Reference in New Issue
Block a user