Better VM autodetection

This commit is contained in:
Alex Davies 2024-05-14 08:39:54 -03:00
parent c3ebc2312b
commit 8409aec688
6 changed files with 75 additions and 4 deletions

View File

@ -97,6 +97,19 @@
./nixos/zerotier.nix
];
};
gwen = nixpkgs.lib.nixosSystem {
specialArgs = {
inherit inputs outputs;
hostname = "gwen";
mainUser = "gwen";
};
modules = [
./nixos/configuration.nix
./nixos/kde-desktop.nix
./nixos/family.nix
./nixos/zerotier.nix
];
};
};
# Standalone home-manager configuration entrypoint

View File

@ -1,6 +1,6 @@
# This is your system's configuration file.
# Use this to configure your system environment (it replaces /etc/nixos/configuration.nix)
{ inputs, outputs, lib, config, pkgs, hostname, specialArgs, ... }: {
{ inputs, outputs, lib, config, pkgs, hostname, specialArgs, options, ... }: {
# You can import other NixOS modules here
imports = [
# If you want to use modules your own flake exports (from modules/nixos):

17
nixos/family.nix Normal file
View File

@ -0,0 +1,17 @@
{ inputs, outputs, lib, config, pkgs, hostname, specialArgs, ... }: {
services.displayManager = {
autoLogin.enable = true;
autoLogin.user = "${specialArgs.mainUser}";
};
users.users = {
gwen = {
# You can set an initial password for your user.
# If you do, you can skip setting a root password by passing '--no-root-passwd' to nixos-install.
# Be sure to change it (using passwd) after rebooting!
isNormalUser = true;
extraGroups = [ "networkManager" ];
};
};
}

40
nixos/hardware/gwen.nix Normal file
View File

@ -0,0 +1,40 @@
# 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.
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[ (modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "xhci_pci" "nvme" "usb_storage" "sd_mod" "rtsx_pci_sdmmc" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/91d9a91c-9c69-4d82-85dc-42598b9ceaec";
fsType = "ext4";
};
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/BED6-71B3";
fsType = "vfat";
};
swapDevices =
[ { device = "/dev/disk/by-uuid/693adc19-c9d6-43a2-8e80-044f93a73af9"; }
];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.enp0s31f6.useDHCP = lib.mkDefault true;
# networking.interfaces.wlp0s20f3.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

View File

@ -13,7 +13,7 @@
services.fwupd.enable = true;
boot.plymouth = {
enable = false;
enable = true;
themePackages = with pkgs; [ (adi1090x-plymouth-themes.override {selected_themes = [ "rings" ]; }) ];
theme = "rings";
};

View File

@ -1,3 +1,5 @@
{ config, pkgs, lib, options, ... }:
let
privateZeroTierInterfaces = [ "ztmwri5sbj" ]; # ZT NET INTERFACE
in {
@ -17,6 +19,5 @@ in {
services.zerotierone.enable = true;
#Don't join zerotier if I'm testing in a VM
#if !(options.virtualisation ? qemu) then
services.zerotierone.joinNetworks = [ "e04fa485ed2a4dc4" ];
services.zerotierone.joinNetworks = lib.optionals (!options.virtualisation ? qemu) [ "e04fa485ed2a4dc4" ];
}