From a8c56008cf2302287f38a2d20edeef469e34e5ba Mon Sep 17 00:00:00 2001 From: Zoe Roux Date: Fri, 27 Jun 2025 13:52:18 +0000 Subject: [PATCH] Add vm setup --- hosts/fuhen/hardware-configuration.nix | 2 + hosts/virtual/hardware-configuration.nix | 56 ++++++++++++++++++++++++ modules/cli/tools/git.nix | 12 +++-- modules/gui/default.nix | 17 ++++--- modules/gui/home.nix | 36 ++++++++------- 5 files changed, 97 insertions(+), 26 deletions(-) create mode 100644 hosts/virtual/hardware-configuration.nix diff --git a/hosts/fuhen/hardware-configuration.nix b/hosts/fuhen/hardware-configuration.nix index 61095e4..8887592 100644 --- a/hosts/fuhen/hardware-configuration.nix +++ b/hosts/fuhen/hardware-configuration.nix @@ -78,5 +78,7 @@ ]; }; + git.useRsa = true; + system.stateVersion = "22.11"; } diff --git a/hosts/virtual/hardware-configuration.nix b/hosts/virtual/hardware-configuration.nix new file mode 100644 index 0000000..cae288f --- /dev/null +++ b/hosts/virtual/hardware-configuration.nix @@ -0,0 +1,56 @@ +# 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 + "/profiles/qemu-guest.nix") + ]; + + boot.initrd.availableKernelModules = [ "xhci_pci" "virtio_pci" "usbhid" "usb_storage" "sr_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = { + device = "none"; + fsType = "tmpfs"; + options = ["size=8G" "mode=755"]; + }; + + fileSystems."/tmp" = { + device = "none"; + fsType = "tmpfs"; + options = ["size=32G" "mode=755"]; + }; + + fileSystems."/nix" = + { device = "/dev/disk/by-label/virtual"; + fsType = "ext4"; + }; + + + fileSystems."/boot" = + { device = "/dev/disk/by-label/boot"; + fsType = "vfat"; + }; + + swapDevices = [ ]; + + # 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..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.enp0s1.useDHCP = lib.mkDefault true; + + environment.systemPackages = with pkgs; [ kdePackages.konsole ]; + + services.spice-vdagentd.enable = true; + services.spice-autorandr.enable = true; + + nixpkgs.hostPlatform = lib.mkDefault "aarch64-linux"; + + system.stateVersion = "25.05"; +} diff --git a/modules/cli/tools/git.nix b/modules/cli/tools/git.nix index 8682628..f313388 100644 --- a/modules/cli/tools/git.nix +++ b/modules/cli/tools/git.nix @@ -1,10 +1,16 @@ -{ - programs.git = { +{config, lib, ...}: { + options.git = { + useRsa = lib.mkEnableOption "Use rsa instead of ed25519"; + }; + config.programs.git = { enable = true; ignores = [".envrc"]; signing = { signByDefault = true; - key = "~/.ssh/id_rsa.pub"; + key = + if config.git.useRsa + then "~/.ssh/id_rsa.pub" + else "~/.ssh/id_ed25519.pub"; }; # maintenance = { # enable = false; diff --git a/modules/gui/default.nix b/modules/gui/default.nix index 0b211e6..c243735 100644 --- a/modules/gui/default.nix +++ b/modules/gui/default.nix @@ -1,9 +1,14 @@ -{pkgs, ...}: { - environment.systemPackages = with pkgs; [ - wineWowPackages.stable - wineWowPackages.waylandFull - winetricks - ]; +{ + pkgs, + lib, + ... +}: { + environment.systemPackages = with pkgs; + lib.optionals pkgs.stdenv.isx86_64 [ + wineWowPackages.stable + wineWowPackages.waylandFull + winetricks + ]; hardware.steam-hardware.enable = true; services.flatpak.enable = true; diff --git a/modules/gui/home.nix b/modules/gui/home.nix index 26a53ad..677ef9c 100644 --- a/modules/gui/home.nix +++ b/modules/gui/home.nix @@ -1,5 +1,6 @@ { config, + lib, pkgs, zen-browser, ... @@ -16,23 +17,24 @@ in { ./gtk.nix ]; - home.packages = with pkgs; [ - google-chrome - firefox - zen-browser.packages.${pkgs.system}.default - vesktop - mpv - xdg-utils - zathura - libreoffice - qbittorrent - youtube-music - wl-clipboard - wlr-randr - alsa-utils - playerctl - postman - ]; + home.packages = with pkgs; + [ + firefox + zen-browser.packages.${pkgs.system}.default + vesktop + mpv + xdg-utils + zathura + libreoffice + qbittorrent + youtube-music + wl-clipboard + wlr-randr + alsa-utils + playerctl + postman + ] + ++ lib.optionals pkgs.stdenv.isx86_64 [google-chrome]; home.sessionVariables = rec { # TODO: add an `uwsm app run --` or something here (for example clicking on a link on discord opens the browser on discord's slice instead of the browser's slice.