add boot vars, and pass name arg

This commit is contained in:
asyncnomi 2025-07-18 02:05:41 +02:00
parent 6447202f7f
commit b153246f90
7 changed files with 279 additions and 21 deletions

View file

@ -2,6 +2,7 @@
{
# Import dependencies
imports = [
./commons/boot.nix
./commons/basics.nix
./commons/ssh.nix
./commons/sudo.nix

View file

@ -1,19 +1,29 @@
{ pkgs, ... }:
{
nix.settings.experimental-features = [ "nix-command" "flakes" ];
options.hostName = lib.mkOption {
type = lib.types.str;
default = "you-forgot-to-give-me-a-name-you-moron";
description = "hostName";
};
# Global packages
environment.systemPackages = with pkgs; [
#(callPackage "${builtins.fetchTarball {url = "https://github.com/ryantm/agenix/archive/main.tar.gz"; sha256 = "103slb8xy5sb68zxjjbb9d0svq8xz751a7yrg6vrz5rh4374bzgl";}}/pkgs/agenix.nix" {})
bmon
tcpdump
htop
conntrack-tools
mtr
dig
molly-guard
fastfetch
];
config = {
hostName = "awendap";
nix.settings.experimental-features = [ "nix-command" "flakes" ];
# Global packages
environment.systemPackages = with pkgs; [
bmon
tcpdump
htop
conntrack-tools
mtr
dig
molly-guard
fastfetch
curl
wget
];
};
}

11
shared/commons/boot.nix Normal file
View file

@ -0,0 +1,11 @@
{ ... }:
let
# Import nodes
nodes = import ./../../nodes.nix;
myNode = nodes."${config.hostName}";
in
{
boot.loader.grub.enable = true;
boot.loader.grub.device = myNode.grubDevice;
}

View file

@ -17,6 +17,8 @@ let
route6 = if supportsIPv6 myNode then [{ Gateway = myNode.gIp6; }] else [];
in
{
networking.hostName = config.hostName;
systemd.network.enable = true;
networking.useNetworkd = true;
networking.useDHCP = false;