Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions templates/bogus/flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions templates/default/flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

39 changes: 30 additions & 9 deletions templates/default/modules/aspects/alice.nix
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,
Copy link

Copilot AI Nov 16, 2025

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'.

Suggested change
# for more complex or re-usable ones, define on their own modules,
# for more complex or re-usable ones, define in their own modules,

Copilot uses AI. Check for mistakes.
# 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 =
Expand All @@ -16,8 +19,14 @@
};
in
[
# from local bindings.
customEmacs
<eg/autologin>
# from the aspect tree, cooper example is defined bellow
Copy link

Copilot AI Nov 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected spelling of 'bellow' to 'below'.

Suggested change
# from the aspect tree, cooper example is defined bellow
# from the aspect tree, cooper example is defined below

Copilot uses AI. Check for mistakes.
den.aspects.cooper
den.aspects.setHost
# from the `eg` namespace.
eg.autologin
# den included batteries that provide common configs.
<den/primary-user> # alice is admin always.
(<den/user-shell> "fish") # default user shell
];
Expand All @@ -26,10 +35,7 @@
nixos =
{ pkgs, ... }:
{
users.users.alice = {
description = "Alice Cooper";
packages = [ pkgs.vim ];
};
users.users.alice.packages = [ pkgs.vim ];
};

# Alice home-manager.
Expand All @@ -46,4 +52,19 @@
nixos.programs.nh.enable = host.name == "igloo";
};
};

# This is a context-aware aspect, that emits configurations
# **anytime** at least the `user` data is in context.
# read more at https://vic.github.io/den/context-aware.html
den.aspects.cooper =
{ user, ... }:
{
nixos.users.users.${user.userName}.description = "Alice Cooper";
};

den.aspects.setHost =
{ host, ... }:
{
networking.hostName = host.hostName;
};
}
6 changes: 3 additions & 3 deletions templates/examples/flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

47 changes: 47 additions & 0 deletions templates/examples/modules/_example/ci/top-level-parametric.nix
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"
);
};

}