Modular, context-aware and aspect-oriented dendritic Nix configurations. Discussions: https://oeiuwq.zulipchat.com/join/nqp26cd4kngon6mo3ncgnuap/ den.oeiuwq.com
configurations den dendritic nix aspect oriented

feat(provides): new tty-autologin battery used for vm. (#155)

authored by oeiuwq.com and committed by

GitHub 06f82a1b f840a81d

+52 -8
+32
modules/aspects/provides/tty-autologin.nix
··· 1 + let 2 + description = '' 3 + Enables automatic tty login given a username. 4 + 5 + This battery must be included in a Host aspect. 6 + 7 + den.aspects.my-laptop.includes = [ (den._.tty-autologin "root") ]; 8 + ''; 9 + 10 + # From https://discourse.nixos.org/t/autologin-for-single-tty/49427/2 11 + tty-autologin-module = 12 + username: 13 + { pkgs, config, ... }: 14 + { 15 + systemd.services."getty@tty1" = { 16 + overrideStrategy = "asDropin"; 17 + serviceConfig.ExecStart = [ 18 + "" 19 + "@${pkgs.util-linux}/sbin/agetty agetty --login-program ${config.services.getty.loginProgram} --autologin ${username} --noclear --keep-baud %I 115200,38400,9600 $TERM" 20 + ]; 21 + }; 22 + }; 23 + 24 + __functor = _self: username: { 25 + nixos = tty-autologin-module username; 26 + }; 27 + in 28 + { 29 + den.provides.tty-autologin = { 30 + inherit description __functor; 31 + }; 32 + }
+8 -4
templates/default/README.md
··· 10 10 nix flake update den 11 11 ``` 12 12 13 - - Run checks to test everything works. 13 + - Edit [modules/hosts.nix](modules/hosts.nix) 14 + 15 + - Run the VM 16 + 17 + We recommend to use a VM develop cycle so you can play with the system before applying to your hardware. 18 + 19 + See [modules/vm.nix](modules/vm.nix) 14 20 15 21 ```console 16 - nix flake check 22 + nix run .#vm 17 23 ``` 18 - 19 - - Edit [modules/hosts.nix](modules/hosts.nix)
+12 -4
templates/default/modules/vm.nix
··· 1 1 # enables `nix run .#vm`. it is very useful to have a VM 2 2 # you can edit your config and launch the VM to test stuff 3 3 # instead of having to reboot each time. 4 - { inputs, ... }: 4 + { inputs, den, ... }: 5 5 { 6 + 7 + # USER TODO: remove this tty-autologin used for the VM 8 + den.aspects.igloo.includes = [ (den.provides.tty-autologin "tux") ]; 9 + 6 10 perSystem = 7 11 { pkgs, ... }: 8 12 { 9 13 packages.vm = pkgs.writeShellApplication { 10 14 name = "vm"; 11 - text = '' 12 - ${inputs.self.nixosConfigurations.igloo.config.system.build.vm}/bin/run-igloo-vm "$@" 13 - ''; 15 + text = 16 + let 17 + host = inputs.self.nixosConfigurations.igloo.config; 18 + in 19 + '' 20 + ${host.system.build.vm}/bin/run-${host.networking.hostName}-vm "$@" 21 + ''; 14 22 }; 15 23 }; 16 24 }