Create host/vm named smarthome

This commit is contained in:
Gene Liverman 2024-08-20 12:13:09 -04:00 committed by Gene Liverman
parent c74f5d4248
commit eb83880671
5 changed files with 146 additions and 0 deletions

View file

@ -0,0 +1,7 @@
{ ... }: {
home.stateVersion = "24.05";
imports = [
../../common/all-cli.nix
../../common/all-linux.nix
];
}

View file

@ -0,0 +1,53 @@
{ pkgs-unstable, username, ... }: {
imports = [ # Include the results of the hardware scan.
./disk-config.nix
./hardware-configuration.nix
../../../system/common/linux/restic.nix
];
system.stateVersion = "24.05";
boot.loader.grub.enable = true;
networking = {
firewall.allowedTCPPorts = [
22 # ssh
];
hostId = "aedb8615";
useDHCP = false;
networkmanager.enable = false;
useNetworkd = true;
interfaces.ens18.ipv4.addresses = [{
address = "192.168.22.23";
prefixLength = 24;
}];
};
services = {
esphome = {
enable = true;
package = pkgs-unstable.esphome;
address = "0.0.0.0";
openFirewall = true;
port = 6052;
};
qemuGuest.enable = true;
resolved.enable = true;
restic.backups.daily.paths = [
"/var/lib/esphome"
];
};
users.users.${username} = {
isNormalUser = true;
description = "Gene Liverman";
extraGroups = [ "wheel" ];
hashedPassword =
linger = true;
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBjigwV0KnnaTnFmKjjvnULa5X+hvsy2FAlu+lUUY59f gene@rainbow-planet"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIp42X5DZ713+bgbOO+GXROufUFdxWo7NjJbGQ285x3N gene.liverman@ltnglobal.com"
];
};
}

View file

@ -0,0 +1,56 @@
# Example to create a bios compatible gpt partition
{ lib, ... }:
{
disko.devices = {
disk.disk1 = {
device = lib.mkDefault "/dev/sda";
type = "disk";
content = {
type = "gpt";
partitions = {
boot = {
name = "boot";
size = "1M";
type = "EF02";
};
esp = {
name = "ESP";
size = "500M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
};
};
root = {
name = "root";
size = "100%";
content = {
type = "lvm_pv";
vg = "pool";
};
};
};
};
};
lvm_vg = {
pool = {
type = "lvm_vg";
lvs = {
root = {
size = "100%FREE";
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/";
mountOptions = [
"defaults"
];
};
};
};
};
};
};
}

View file

@ -0,0 +1,15 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ lib, modulesPath, ... }: {
imports = [
(modulesPath + "/profiles/qemu-guest.nix")
];
boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
}