-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2385919
commit f616185
Showing
8 changed files
with
49 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ lib, writeShellScriptBin, ensure-user-is-root, iproute2, coreutils, gnugrep, nettools, gum }: | ||
|
||
let | ||
paths = lib.makeBinPath [ ensure-user-is-root iproute2 coreutils gnugrep nettools gum ]; | ||
in | ||
|
||
writeShellScriptBin "host-status" '' | ||
export PATH=${paths} | ||
set -efu -o pipefail | ||
msgs=() | ||
msgs+=("Network is up: $(if [ -n "$(ip -brief -color addr)" ]; then echo "yes"; else echo "no"; fi)") | ||
msgs+=("Local network addresses: $(ip -brief -color addr | grep -v "lo" | awk '{print $3}')") | ||
msgs+=("Multicast DNS: $(hostname).local") | ||
gum join --vertical "''${msgs[@]}" | ||
'' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,17 @@ | ||
{ inputs, modulesPath, pkgs, ... }: | ||
{ inputs, modulesPath, pkgs, lib, ... }: | ||
|
||
{ | ||
imports = [ | ||
"${modulesPath}/installer/cd-dvd/installation-cd-minimal.nix" | ||
inputs.nixos-images.nixosModules.image-installer | ||
]; | ||
nix.settings.experimental-features = "nix-command flakes"; | ||
programs.bash.interactiveShellInit = '' | ||
if [[ "$(tty)" =~ /dev/(tty1|hvc0|ttyS0)$ ]]; then | ||
systemctl restart systemd-vconsole-setup.service | ||
${pkgs.host-status}/bin/host-status --root-password | ||
fi | ||
''; | ||
services.openssh.enable = true; | ||
environment.systemPackages = with pkgs; [ fuse bottom ]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
{ config, ... }: | ||
{ config, lib, pkgs, ... }: | ||
|
||
{ | ||
config = { | ||
console.enable = true; | ||
console.earlySetup = true; | ||
console.keyMap = "uk"; | ||
console.font = lib.mkDefault "${pkgs.terminus_font}/share/consolefonts/ter-u22n.psf.gz"; | ||
console.colors = config.scheme.toList; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -97,6 +97,7 @@ with lib; | |
pinentry | ||
pinentry-curses | ||
collect-garbage | ||
host-status | ||
secrets-sync | ||
]; | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
_: | ||
{ pkgs, ... }: | ||
|
||
{ | ||
config = { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ lib, writeShellScriptBin, coreutils, busybox, gum }: | ||
|
||
let | ||
paths = lib.makeBinPath [ coreutils busybox gum ]; | ||
in | ||
|
||
writeShellScriptBin "host-status" '' | ||
export PATH=${paths} | ||
set -efu -o pipefail | ||
ld=$(ip -brief -color addr | awk '{print $3}' | grep -v "lo" | grep -v "127" | tr "\n" " ") | ||
msgs=() | ||
msgs+=("$(gum style --foreground=111 --align=center --margin="1 0" "NixOS")") | ||
user=$(whoami) | ||
if [ "$user" = "root" && -f /var/shared/root-password ]; then | ||
msgs+=("Root password: $(cat /var/shared/root-password)") | ||
fi | ||
msgs+=("Hostname: $(hostname)") | ||
msgs+=("Local addresses: $ld") | ||
msgs+=("Multicast DNS: $(hostname).local") | ||
gum style --border-foreground=111 --border normal "''${msgs[@]}" | ||
'' |