Last active
March 12, 2016 02:44
-
-
Save cleverca22/612292017df5d24397ac to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let | |
ugly = { laptop = ./laptop.nix; desktop = ./desktop.nix; }; | |
in | |
{ | |
imports = [ ugly.${config.network.hostName} ]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[clever@amd-nixos:~]$ nix-repl | |
Welcome to Nix version 1.11.2. Type :? for help. | |
nix-repl> :l <nixpkgs> | |
Added 6072 variables. | |
nix-repl> configs = { laptop = "foo"; desktop = "bar"; } | |
nix-repl> configs | |
{ desktop = "bar"; laptop = "foo"; } | |
nix-repl> hostname = "laptop" | |
nix-repl> hostname | |
"laptop" | |
nix-repl> lib.attrByPath [hostname] {} configs | |
"foo" | |
nix-repl> configs.${hostname} | |
"foo" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment