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
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- uses: DeterminateSystems/magic-nix-cache-action@v13
- uses: actions/checkout@v4
- run: sed -i 's@# den.outPath@den.outPath@' templates/noflake/with-inputs.nix
- run: cd templates/noflake && nix-build -A flake.nixosConfigurations.igloo.config.system.build.toplevel
- run: cd templates/noflake && nix-build -A nixosConfigurations.igloo.config.system.build.toplevel
template:
needs: [non-draft]
strategy:
Expand Down
11 changes: 7 additions & 4 deletions templates/noflake/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@ It configures a NixOS host with one user.

Try it with:

```shell
nixos-rebuild build --file . -A nixosConfigurations.igloo
```
nix-build -A flake.nixosConfigurations.igloo.config.system.build.toplevel
```

NOTE: Currently Den needs a top-level attribute where to place configurations,
by default it is the `flake` attribute, even if Den uses no flake-parts at all.
or

```shell
nix-build -A nixosConfigurations.igloo.config.system.build.toplevel
```
12 changes: 4 additions & 8 deletions templates/noflake/default.nix
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
let

modules =
{ inputs, ... }:
{
imports = [ (inputs.import-tree ./modules) ];
};

outputs =
inputs:
(inputs.nixpkgs.lib.evalModules {
modules = [ modules ];
modules = [ (inputs.import-tree ./modules) ];
specialArgs = {
inherit inputs;
inherit (inputs) self;
};
}).config;

in
import ./with-inputs.nix outputs
# Den outputs configurations at flake top-level attr
# even when it does not depend on flakes or flake-parts.
(import ./with-inputs.nix outputs).flake
11 changes: 11 additions & 0 deletions templates/noflake/modules/compat.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{ inputs, lib, ... }:
{
# we can import this flakeModule even if we dont have flake-parts as input!
imports = [ inputs.den.flakeModule ];

# NOTE: Currently Den needs a top-level attribute where to place configurations,
# by default it is the `flake` attribute, even if Den uses no flake-parts at all.
options.flake = lib.mkOption {
type = lib.types.submodule { freeformType = lib.types.anything; };
};
}
44 changes: 35 additions & 9 deletions templates/noflake/modules/den.nix
Original file line number Diff line number Diff line change
@@ -1,12 +1,38 @@
{ inputs, lib, ... }:
{ inputs, ... }:
{
# we can import this flakeModule even if we dont
# have flake-parts as input!
imports = [ inputs.den.flakeModule ];

# for flake.nixosConfigurations output.
# create a freeform option for it
options.flake = lib.mkOption {
type = lib.types.submodule { freeformType = lib.types.anything; };
# tux user on igloo host.
den.hosts.x86_64-linux.igloo.users.tux = { };

# host aspect
den.aspects.igloo = {
nixos =
{ pkgs, ... }:
{
# remove these for a real bootable host
boot.loader.grub.enable = false;
fileSystems."/".device = "/dev/fake";
passthru = { };

environment.systemPackages = [
pkgs.vim
];
};
};

# user aspect
den.aspects.tux = {
# user configures the host it lives in
nixos = {
# hipster-tux uses nix-maid instead of home-manager.
imports = [ inputs.nix-maid.nixosModules.default ];

users.users.tux = {
isNormalUser = true;
maid.file.home.".gitconfig".text = ''
[user]
name=Tux
'';
};
};
};
}
38 changes: 0 additions & 38 deletions templates/noflake/modules/hosts.nix

This file was deleted.

Loading