From 5a7b6dcc5bf800591b1439fd87991294f67e914d Mon Sep 17 00:00:00 2001 From: Lorde_soup Date: Tue, 21 Jan 2025 19:37:41 -0500 Subject: [PATCH] starting commit uwo --- flake.lock | 121 ++++++++ flake.nix | 33 +++ hosts/kiara/configuration.nix | 383 +++++++++++++++++++++++++ hosts/kiara/hardware-configuration.nix | 33 +++ hosts/kiara/vm.nix | 36 +++ mods/vm.nix | 40 +++ 6 files changed, 646 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 hosts/kiara/configuration.nix create mode 100644 hosts/kiara/hardware-configuration.nix create mode 100644 hosts/kiara/vm.nix create mode 100644 mods/vm.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..c25d0e0 --- /dev/null +++ b/flake.lock @@ -0,0 +1,121 @@ +{ + "nodes": { + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1733328505, + "narHash": "sha256-NeCCThCEP3eCl2l/+27kNNK7QrwZB1IJCrXfrbv5oqU=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1721135958, + "narHash": "sha256-H548rpPMsn25LDKn1PCFmPxmWlClJJGnvdzImHkqjuY=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "afd2021bedff2de92dfce0e257a3d03ae65c603d", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1721379653, + "narHash": "sha256-8MUgifkJ7lkZs3u99UDZMB4kbOxvMEXQZ31FO3SopZ0=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "1d9c2c9b3e71b9ee663d11c5d298727dace8d374", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1735471104, + "narHash": "sha256-0q9NGQySwDQc7RhAV2ukfnu7Gxa5/ybJ2ANT8DQrQrs=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "88195a94f390381c6afcdaa933c2f6ff93959cb4", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "home-manager": "home-manager", + "nixpkgs": "nixpkgs", + "spicetify-nix": "spicetify-nix", + "zen-browser": "zen-browser" + } + }, + "spicetify-nix": { + "inputs": { + "flake-compat": "flake-compat", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1737087380, + "narHash": "sha256-T3WB7rwWDT8cWrwLR7fRRZ1gkgbk3A3dzefEfuGdMxk=", + "owner": "Gerg-L", + "repo": "spicetify-nix", + "rev": "6510ffbf4e3f9116923632da1e63e9a959d8aa94", + "type": "github" + }, + "original": { + "owner": "Gerg-L", + "repo": "spicetify-nix", + "type": "github" + } + }, + "zen-browser": { + "inputs": { + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1736824652, + "narHash": "sha256-8J56ngRvKVvCxdY3iDtol/9UAJfwCh0k96DnyNchUCA=", + "owner": "0xc000022070", + "repo": "zen-browser-flake", + "rev": "a17923b5fd758700c67afdaae2a1d3123381f96b", + "type": "github" + }, + "original": { + "owner": "0xc000022070", + "repo": "zen-browser-flake", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..e5a4ba2 --- /dev/null +++ b/flake.nix @@ -0,0 +1,33 @@ +{ + description = "Nixos config flake"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + zen-browser = { + url = "github:0xc000022070/zen-browser-flake"; + }; + + spicetify-nix = { + url = "github:Gerg-L/spicetify-nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + }; + + + outputs = { self, nixpkgs, ... }@inputs: { + nixosConfigurations.default = nixpkgs.lib.nixosSystem { + specialArgs = {inherit inputs;}; + modules = [ + ./hosts/kiara/configuration.nix + inputs.home-manager.nixosModules.default + ]; + }; + }; +} diff --git a/hosts/kiara/configuration.nix b/hosts/kiara/configuration.nix new file mode 100644 index 0000000..ccc7b26 --- /dev/null +++ b/hosts/kiara/configuration.nix @@ -0,0 +1,383 @@ +# Edit this configuration file to define what should be installed on +# your system. Help is available in the configuration.nix(5) man page +# and in the NixOS manual (accessible by running ‘nixos-help’). + +{ config, pkgs, inputs, ... }: + +{ + imports = + [ # Include the results of the hardware scan. + ./hardware-configuration.nix + inputs.home-manager.nixosModules.default + ../../mods/vm.nix + inputs.spicetify-nix.nixosModules.default + ]; + + + + + + vm.enable = true; + + # Bootloader. + boot.loader.grub.enable = true; + boot.loader.grub.device = "/dev/sdb"; + boot.loader.grub.useOSProber = true; + + # IOMMU + boot.kernelParams = [ "intel_iommu=on" ]; + boot.kernelModules = [ "vfio_virqfd" "vfio_pci" "vfio_iommu_type1" "vfio" "v4l2loopback" ]; + boot.blacklistedKernelModules = [ "nvidia" "nouveau" ]; + boot.extraModprobeConfig = '' + options vfio-pci ids=10de:22bc,10de:2786 + options v4l2loopback exclusive_caps=1 + ''; + boot.extraModulePackages = [ pkgs.linuxPackages.v4l2loopback ]; + + + networking.hostName = "kiara"; # Define your hostname. + # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. + + # Configure network proxy if necessary + # networking.proxy.default = "http://user:password@proxy:port/"; + # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; + + # Enable networking + networking.networkmanager.enable = true; + #networking.nameservers = [ "1.1.1.1" "1.0.0.1" ]; + # networking.networkmanager.insertNameservers = [ "1.1.1.1" ]; + + #{ config, pkgs, lib, ... }:{ + # networking.firewall.checkReversePath = false; + #} + +# NFS client + + + fileSystems."/mnt/apricot" = { + device = "192.168.4.191:/mnt/apricot" ; + fsType = "nfs" ; + options = [ "x-systemd.automount" "noauto" ]; + }; + + fileSystems."/home" = { + device = "/dev/disk/by-uuid/6eb8bb12-0016-4a01-9c63-8d493487df51"; + fsType = "ext4"; + }; + + # Set your time zone. + time.timeZone = "America/New_York"; + + # Select internationalisation properties. + i18n.defaultLocale = "en_US.UTF-8"; + + i18n.extraLocaleSettings = { + LC_ADDRESS = "en_US.UTF-8"; + LC_IDENTIFICATION = "en_US.UTF-8"; + LC_MEASUREMENT = "en_US.UTF-8"; + LC_MONETARY = "en_US.UTF-8"; + LC_NAME = "en_US.UTF-8"; + LC_NUMERIC = "en_US.UTF-8"; + LC_PAPER = "en_US.UTF-8"; + LC_TELEPHONE = "en_US.UTF-8"; + LC_TIME = "en_US.UTF-8"; + }; + + # Enable the X11 windowing system. + services.xserver.enable = true; + + # Enable the GNOME Desktop Environment. + services.xserver.displayManager.gdm.enable = true; + # services.xserver.desktopManager.gnome.enable = true; + + # Configure keymap in X11 + #services.xserver = { + # layout = "us"; + # xkbVariant = ""; + #}; + + # Enable CUPS to print documents. + services.printing.enable = true; + + # Enable sound with pipewire. + hardware.pulseaudio.enable = false; + security.rtkit.enable = true; + services.pipewire = { + enable = true; + alsa.enable = true; + alsa.support32Bit = true; + pulse.enable = true; + wireplumber.enable = true; + # If you want to use JACK applications, uncomment this + #jack.enable = true; + }; + + # enable opencl on gpu + environment.variables = { + ROC_ENABLE_PRE_VEGA = "1"; + }; + + hardware.opengl.extraPackages = with pkgs; [ + rocmPackages.clr.icd + ]; + + + + + # Enable touchpad support (enabled default in most desktopManager). + # services.xserver.libinput.enable = true; + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users.takanashi = { + isNormalUser = true; + description = "takanashi"; + extraGroups = [ "networkmanager" "wheel" "docker" ]; + packages = with pkgs; [ + # thunderbird + ]; + }; + + # Install firefox. + #programs.firefox.enable = true; + + # Allow unfree packages + nixpkgs.config.allowUnfree = true; + + # Nix Flakes + + nix.settings.experimental-features = [ "nix-command" "flakes"]; + + # Home Manager + + # home-manager = { + # # also pass inputs to home-manager modules + # extraSpecialArgs = {inherit inputs;}; + # users = { + # "takanashi" = import ./home.nix; + # }; +# }; + + + + # spicetify-nix + + programs.spicetify = + let + spicePkgs = inputs.spicetify-nix.legacyPackages.${pkgs.system}; + in + { + enable = true; + + #enabledExtensions = with spicePkgs.extensions; [ + # adblock + # hidePodcasts + # shuffle # shuffle+ (special characters are sanitized out of extension names) + #]; + #enabledCustomApps = with spicePkgs.apps; [ + # newReleases + # ncsVisualizer + #]; + #enabledSnippets = with spicePkgs.snippets; [ + # rotatingCoverart + # pointer + #]; + + theme = spicePkgs.themes.comfy; + colorScheme = "hikari"; + }; + + + + + + + hardware.bluetooth.enable = true; # enables support for Bluetooth + hardware.bluetooth.powerOnBoot = true; # powers up the default Bluetooth controller on boot + + services.blueman.enable = true; + + hardware.enableAllFirmware = true; + + + + # List packages installed in system profile. To search, run: + # $ nix search wget + environment.systemPackages = with pkgs; [ + vim + firefox + neovim + wget + hyprland + xdg-desktop-portal-hyprland + alacritty + firefox + waybar + dunst + wofi + cinnamon.nemo + btop + hashcat + git + networkmanager + tauon + super-productivity + brave + calc + vesktop + hyprshot + wl-clipboard + yt-dlp + syncthing + brave + fastfetch + obsidian + krita + pavucontrol + ranger + lxqt.lxqt-policykit + # linux-wallpaperengine # bug with freeimage-unstable with like 7 CVEs wait for patch + libreoffice + pasystray + syncthing-tray + udiskie + nm-tray + # hyprpicker + wl-color-picker + dig + wireguard-go + wg-netmanager + wireguard-tools + motrix + zip + unzip + android-file-transfer + appimage-run + python3 + python311Packages.pip + pipes-rs + spicetify-cli + spotify + obs-studio + lsof + alsa-utils + bluez + bluez-tools + wireplumber + xivlauncher + kdePackages.gwenview + #hyprlock + mpv + p7zip + file + file-roller + lunar-client + teams-for-linux + kdenlive + ffmpeg + pciutils + kdePackages.partitionmanager + testdisk + kdePackages.filelight + spice + spice-gtk + spice-vdagent + exif + kdePackages.kleopatra + piper + libratbag + cmake + mesa + gnome-disk-utility + python312Packages.numpy + virtualenv + poetry + cheese + usbutils + v4l-utils + #vencord + kdePackages.okular + blueman + game-devices-udev-rules + looking-glass-client + inputs.zen-browser.packages."${system}".default + tree + ]; + + # Some programs need SUID wrappers, can be configured further or are + # started in user sessions. + # programs.mtr.enable = true; + # programs.gnupg.agent = { + # enable = true; + # enableSSHSupport = true; + # }; + + # List services that you want to enable: + services.flatpak.enable = true; + programs.hyprland.systemd.setPath.enable = true; + programs.hyprland.xwayland.enable = true; + programs.hyprland.enable = true; + hardware.opentabletdriver.enable = true; + hardware.opentabletdriver.daemon.enable = true; + services.spice-vdagentd.enable = true; + security.polkit.enable = true; + hardware.uinput.enable = true; + + ########################################### + # The Good ol we will fix it later corner # + ########################################### + + + #services.xserver.enable = true; + #services.xserver.displayManager.gdm.enable = true; + #services.xserver.desktopManager = { + # gnome.enable = true; + #}; + + + # Docker stuff + virtualisation.docker.enable = true; + # users.users.takanashi.extraGroups = [ "docker" ]; + + virtualisation.docker.rootless = { + enable = true; + setSocketVariable = true; + }; + + virtualisation.docker.daemon.settings = { + data-root = "/home/takanashi/docker"; + }; + + + ########################################### + # Enable the OpenSSH daemon. + # services.openssh.enable = true; + + # Open ports in the firewall. + # networking.firewall.allowedTCPPorts = [ ... ]; + # networking.firewall.allowedUDPPorts = [ ... ]; + # Or disable the firewall altogether. + # networking.firewall.enable = false; + + + + # Looking glass shms + systemd.tmpfiles.rules = [ + # "f /dev/shm/scream 0660 alex qemu-libvirtd -" + "f /dev/shm/looking-glass 0660 takanashi kvm -" + ]; + + + + + + + + # This value determines the NixOS release from which the default + # settings for stateful data, like file locations and database versions + # on your system were taken. It‘s perfectly fine and recommended to leave + # this value at the release version of the first install of this system. + # Before changing this value read the documentation for this option + # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). + system.stateVersion = "24.05"; # Did you read the comment? + +} diff --git a/hosts/kiara/hardware-configuration.nix b/hosts/kiara/hardware-configuration.nix new file mode 100644 index 0000000..94c5d86 --- /dev/null +++ b/hosts/kiara/hardware-configuration.nix @@ -0,0 +1,33 @@ +# 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" "ahci" "usb_storage" "usbhid" "uas" "sd_mod" "sr_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/0a16ae46-fd59-45c5-89c6-abe77494bcab"; + fsType = "ext4"; + }; + + 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.eno1.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp3s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/hosts/kiara/vm.nix b/hosts/kiara/vm.nix new file mode 100644 index 0000000..cc56ec3 --- /dev/null +++ b/hosts/kiara/vm.nix @@ -0,0 +1,36 @@ +{ config, lib, pkgs, ... }: + +{ + #config = lib.mkIf config.vm.enable { + # # Enable dconf (System Management Tool) + # programs.dconf.enable = true; + + # Add user to libvirtd group + users.users.takanashi.extraGroups = [ "libvirtd" ]; + +# Install necessary packages + environment.systemPackages = with pkgs; [ + virt-manager + virt-viewer + spice spice-gtk + spice-protocol + win-virtio + win-spice + gnome.adwaita-icon-theme + ]; + + # Manage the virtualisation services + virtualisation = { + libvirtd = { + enable = true; + qemu = { + swtpm.enable = true; + ovmf.enable = true; + ovmf.packages = [ pkgs.OVMFFull.fd ]; + }; + }; + spiceUSBRedirection.enable = true; + }; + services.spice-vdagentd.enable = true; +# }; +} diff --git a/mods/vm.nix b/mods/vm.nix new file mode 100644 index 0000000..f9080c1 --- /dev/null +++ b/mods/vm.nix @@ -0,0 +1,40 @@ +{ config, lib, pkgs, ... }: + +{ + options = { + vm.enable = lib.mkEnableOption "enables the vm mod" ; + }; + + config = lib.mkIf config.vm.enable { + # Enable dconf (System Management Tool) + programs.dconf.enable = true; + + # Add user to libvirtd group + users.users.takanashi.extraGroups = [ "libvirtd" ]; + + # Install necessary packages + environment.systemPackages = with pkgs; [ + virt-manager + virt-viewer + spice spice-gtk + spice-protocol + win-virtio + win-spice + gnome.adwaita-icon-theme + ]; + + # Manage the virtualisation services + virtualisation = { + libvirtd = { + enable = true; + qemu = { + swtpm.enable = true; + ovmf.enable = true; + ovmf.packages = [ pkgs.OVMFFull.fd ]; + }; + }; + spiceUSBRedirection.enable = true; + }; + services.spice-vdagentd.enable = true; + }; +}