Last active
November 4, 2023 19:56
-
-
Save txtyash/4d0aadd3d10a35866ef93fbc046fb038 to your computer and use it in GitHub Desktop.
submodules
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
{ | |
lib, | |
config, | |
... | |
}: { | |
imports = [./options.nix ./yash]; | |
config.profiles.yash.editor = "nvim"; | |
# Generate this: users.users.yash.description = "Yash Shinde"; | |
# using the line below | |
config.profiles.yash.description = "Yash Shinde"; | |
# This gives users.users.yash.description = "Yash Shinde". | |
# WHY DOES THIS WORK????? | |
config.users.users = | |
lib.mapAttrs ( | |
name: values: { | |
description = values.description; | |
} | |
) | |
config.profiles; | |
config.warnings = lib.mapAttrsToList (name: cfg: "I am ${name} and my editor is ${cfg.editor}") config.profiles; | |
} |
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 | |
settings = { | |
options = { | |
editor = lib.mkOption { | |
type = lib.types.str; | |
}; | |
description = lib.mkOption { | |
type = lib.types.str; | |
}; | |
}; | |
}; | |
in { | |
options = { | |
profiles = lib.mkOption { | |
type = lib.types.attrsOf (lib.types.submoduleWith { | |
modules = [settings]; | |
}); | |
}; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment