-
-
Notifications
You must be signed in to change notification settings - Fork 8
Test top-level contextual aspects. #93
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,11 +1,14 @@ | ||||||
| { den, ... }: | ||||||
| { den, eg, ... }: | ||||||
| { | ||||||
| den.aspects.alice = { | ||||||
| # You can include other aspects, in this case some | ||||||
| # den included batteries that provide common configs. | ||||||
|
|
||||||
| # Alice can include other aspects. | ||||||
| # For small, private one-shot aspects, use let-bindings like here. | ||||||
| # for more complex or re-usable ones, define on their own modules, | ||||||
| # as part of any aspect-subtree. | ||||||
| includes = | ||||||
| let | ||||||
| # deadnix: skip # demo: enable <> on lexical scope | ||||||
| # deadnix: skip # not required, showcasing angle-brackets syntax. | ||||||
| inherit (den.lib) __findFile; | ||||||
|
|
||||||
| customEmacs.homeManager = | ||||||
|
|
@@ -16,8 +19,14 @@ | |||||
| }; | ||||||
| in | ||||||
| [ | ||||||
| # from local bindings. | ||||||
| customEmacs | ||||||
| <eg/autologin> | ||||||
| # from the aspect tree, cooper example is defined bellow | ||||||
|
||||||
| # from the aspect tree, cooper example is defined bellow | |
| # from the aspect tree, cooper example is defined below |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| # it is possible for top-level aspects directly under | ||
| # den.aspects to take a context argument. | ||
| { den, lib, ... }: | ||
| let | ||
| # A module to test that toplevel had context. | ||
| topLevel = name: { | ||
| config.tops = name; | ||
| options.tops = lib.mkOption { type = lib.types.str; }; | ||
| }; | ||
| in | ||
| { | ||
|
|
||
| den.aspects.toplevel-user = | ||
| { user, ... }: | ||
| { | ||
| nixos.imports = [ (topLevel user.name) ]; | ||
| }; | ||
|
|
||
| den.aspects.toplevel-host = | ||
| { host, ... }: | ||
| { | ||
| homeManager.imports = [ (topLevel host.name) ]; | ||
| }; | ||
|
|
||
| den.aspects.alice.includes = [ | ||
| den.aspects.toplevel-host | ||
| den.aspects.toplevel-user | ||
| ]; | ||
|
|
||
| perSystem = | ||
| { | ||
| checkCond, | ||
| alice-at-rockhopper, | ||
| rockhopper, | ||
| ... | ||
| }: | ||
| { | ||
| checks.alice-toplevel-user = checkCond "alice toplevel param aspect" ( | ||
| rockhopper.config.tops == "alice" | ||
| ); | ||
|
|
||
| checks.alice-toplevel-host = checkCond "alice toplevel param aspect" ( | ||
| alice-at-rockhopper.tops == "rockhopper" | ||
| ); | ||
| }; | ||
|
|
||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Grammatical error: 'define on' should be 'define in' or 'define them in'.