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
32 changes: 32 additions & 0 deletions modules/aspects/provides/tty-autologin.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
let
description = ''
Enables automatic tty login given a username.

This battery must be included in a Host aspect.

den.aspects.my-laptop.includes = [ (den._.tty-autologin "root") ];
'';

# From https://discourse.nixos.org/t/autologin-for-single-tty/49427/2
tty-autologin-module =
username:
{ pkgs, config, ... }:
{
systemd.services."getty@tty1" = {
overrideStrategy = "asDropin";
serviceConfig.ExecStart = [
""
"@${pkgs.util-linux}/sbin/agetty agetty --login-program ${config.services.getty.loginProgram} --autologin ${username} --noclear --keep-baud %I 115200,38400,9600 $TERM"
];
};
};

__functor = _self: username: {
nixos = tty-autologin-module username;
};
in
{
den.provides.tty-autologin = {
inherit description __functor;
};
}
12 changes: 8 additions & 4 deletions templates/default/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,14 @@ Steps you can follow after cloning this template:
nix flake update den
```

- Run checks to test everything works.
- Edit [modules/hosts.nix](modules/hosts.nix)

- Run the VM

We recommend to use a VM develop cycle so you can play with the system before applying to your hardware.

See [modules/vm.nix](modules/vm.nix)

```console
nix flake check
nix run .#vm
```

- Edit [modules/hosts.nix](modules/hosts.nix)
16 changes: 12 additions & 4 deletions templates/default/modules/vm.nix
Original file line number Diff line number Diff line change
@@ -1,16 +1,24 @@
# enables `nix run .#vm`. it is very useful to have a VM
# you can edit your config and launch the VM to test stuff
# instead of having to reboot each time.
{ inputs, ... }:
{ inputs, den, ... }:
{

# USER TODO: remove this tty-autologin used for the VM
den.aspects.igloo.includes = [ (den.provides.tty-autologin "tux") ];

perSystem =
{ pkgs, ... }:
{
packages.vm = pkgs.writeShellApplication {
name = "vm";
text = ''
${inputs.self.nixosConfigurations.igloo.config.system.build.vm}/bin/run-igloo-vm "$@"
'';
text =
let
host = inputs.self.nixosConfigurations.igloo.config;
in
''
${host.system.build.vm}/bin/run-${host.networking.hostName}-vm "$@"
'';
};
};
}