Created
November 3, 2023 21:35
-
-
Save K900/c0788e4708c189635e0bb471f3fa86af 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
{ | |
imports = [ ./users.nix ]; | |
x.users.alice.editor = "hx"; | |
x.users.bob.editor = "vi"; | |
x.users.clive.editor = "code"; | |
boot.loader.grub.enable = false; | |
fileSystems."/" = { device = "/dev/sda1"; }; | |
} |
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
❯ nix-build '<nixpkgs/nixos>' -I nixos-config=example.nix | |
trace: warning: system.stateVersion is not set, defaulting to 23.11. Read why this matters on https://nixos.org/manual/nixos/stable/options.html#opt-system.stateVersion. | |
trace: warning: I am alice and my editor is hx | |
trace: warning: I am bob and my editor is vi | |
trace: warning: I am clive and my editor is code |
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
{ config, lib, ... }: | |
let | |
userOptions = { | |
options = { | |
editor = lib.mkOption { | |
type = lib.types.str; | |
}; | |
}; | |
}; | |
in | |
{ | |
options = { | |
x.users = lib.mkOption { | |
type = lib.types.attrsOf (lib.types.submoduleWith { | |
modules = [ userOptions ]; | |
}); | |
}; | |
}; | |
config.warnings = lib.mapAttrsToList (name: cfg: "I am ${name} and my editor is ${cfg.editor}") config.x.users; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment