mirror of
https://github.com/genebean/dots.git
synced 2026-03-27 09:27:44 -04:00
Create host/vm named smarthome
This commit is contained in:
parent
c74f5d4248
commit
eb83880671
5 changed files with 146 additions and 0 deletions
15
flake.nix
15
flake.nix
|
|
@ -122,6 +122,14 @@
|
|||
};
|
||||
overlays = [ nixpkgs-terraform.overlays.default ];
|
||||
};
|
||||
pkgs-unstable = import nixpkgs-unstable {
|
||||
inherit system;
|
||||
config = {
|
||||
allowUnfree = true;
|
||||
permittedInsecurePackages = [ "electron-21.4.4" ];
|
||||
};
|
||||
overlays = [ ];
|
||||
};
|
||||
} // additionalSpecialArgs;
|
||||
modules = [
|
||||
disko.nixosModules.disko
|
||||
|
|
@ -233,6 +241,13 @@
|
|||
];
|
||||
additionalSpecialArgs = {};
|
||||
};
|
||||
smarthome = nixosHostConfig {
|
||||
system = "x86_64-linux";
|
||||
hostname = "smarthome";
|
||||
username = "gene";
|
||||
additionalModules = [];
|
||||
additionalSpecialArgs = {};
|
||||
};
|
||||
}; # end nixosConfigurations
|
||||
|
||||
# Home Manager (only) users
|
||||
|
|
|
|||
7
modules/home-manager/hosts/smarthome/gene.nix
Normal file
7
modules/home-manager/hosts/smarthome/gene.nix
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
{ ... }: {
|
||||
home.stateVersion = "24.05";
|
||||
imports = [
|
||||
../../common/all-cli.nix
|
||||
../../common/all-linux.nix
|
||||
];
|
||||
}
|
||||
53
modules/hosts/nixos/smarthome/default.nix
Normal file
53
modules/hosts/nixos/smarthome/default.nix
Normal 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"
|
||||
];
|
||||
};
|
||||
}
|
||||
|
||||
56
modules/hosts/nixos/smarthome/disk-config.nix
Normal file
56
modules/hosts/nixos/smarthome/disk-config.nix
Normal 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"
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
15
modules/hosts/nixos/smarthome/hardware-configuration.nix
Normal file
15
modules/hosts/nixos/smarthome/hardware-configuration.nix
Normal 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";
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue