From 608cc71fe51ee0a349d3893cc51b275697804428 Mon Sep 17 00:00:00 2001 From: Random936 Date: Wed, 29 Jan 2025 15:08:56 -0800 Subject: [PATCH] Added AI VM to dotfiles config --- config/ai.nix | 47 +++++++++++++++++++++++++++++++++++++++++++++++ flake.lock | 18 +++++++++--------- flake.nix | 16 ++++++++++++++++ hardware/ai.nix | 37 +++++++++++++++++++++++++++++++++++++ 4 files changed, 109 insertions(+), 9 deletions(-) create mode 100644 config/ai.nix create mode 100644 hardware/ai.nix diff --git a/config/ai.nix b/config/ai.nix new file mode 100644 index 0000000..7b4656e --- /dev/null +++ b/config/ai.nix @@ -0,0 +1,47 @@ +{ config, pkgs, inputs, lib, ... }: { + + imports = [ + ../hardware/ai.nix + ./headless.nix + (import ./networking.nix { + hostname = "mindforge"; + ip_address = "192.168.100.45"; + open_ports = [ ]; + inherit lib; + }) + ]; + + users.users.mindforge = import ./user.nix; + + # Setup drivers for NVIDIA GPU + services.xserver = { + enable = false; + videoDrivers = [ "nvidia" ]; + }; + + hardware = { + nvidia = { + open = false; + modesetting.enable = true; + powerManagement.enable = false; + powerManagement.finegrained = false; + nvidiaSettings = true; + }; + + graphics = { + enable = true; + enable32Bit = true; + }; + }; + + services.open-webui = { + enable = true; + host = "0.0.0.0"; + openFirewall = true; + }; + + services.ollama = { + enable = true; + acceleration = "cuda"; + }; +} diff --git a/flake.lock b/flake.lock index 9ee5c3a..193ffc7 100644 --- a/flake.lock +++ b/flake.lock @@ -7,11 +7,11 @@ ] }, "locked": { - "lastModified": 1736066484, - "narHash": "sha256-uTstP36WaFrw+TEHb8nLF14hFPzQBOhmIxzioHCDaL8=", + "lastModified": 1738188574, + "narHash": "sha256-I1gh2Ho565SDmbonmzj7sWbEgTXYyERmMT5KwuuaSDo=", "owner": "nix-community", "repo": "home-manager", - "rev": "5ad12b6ea06b84e48f6b677957c74f32d47bdee0", + "rev": "6aa38ffdf77fb4250f5d832fd5a09eb99226fba7", "type": "github" }, "original": { @@ -28,11 +28,11 @@ ] }, "locked": { - "lastModified": 1736085891, - "narHash": "sha256-bTl9fcUo767VaSx4Q5kFhwiDpFQhBKna7lNbGsqCQiA=", + "lastModified": 1738033138, + "narHash": "sha256-qlIM8A3bdL9c6PexhpS+QyZLO9y/8a3V75HVyJgDE5Q=", "owner": "LnL7", "repo": "nix-darwin", - "rev": "ba9b3173b0f642ada42b78fb9dfc37ca82266f6c", + "rev": "349a74c66c596ef97ee97b4d80a3ca61227b6120", "type": "github" }, "original": { @@ -43,11 +43,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1735834308, - "narHash": "sha256-dklw3AXr3OGO4/XT1Tu3Xz9n/we8GctZZ75ZWVqAVhk=", + "lastModified": 1738021509, + "narHash": "sha256-JNUiceGsr7cVBUQxLBF1ILCe99E0qLxsVuet6GsZUuw=", "owner": "nixos", "repo": "nixpkgs", - "rev": "6df24922a1400241dae323af55f30e4318a6ca65", + "rev": "9db269672dbdbb519e0bd3ea24f01506c135e46f", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 9567558..25ae4d7 100644 --- a/flake.nix +++ b/flake.nix @@ -51,6 +51,14 @@ ]; }; + nixosConfigurations."mindforge" = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + specialArgs = { inherit inputs; }; + modules = [ + ./config/ai.nix + ]; + }; + # Home-Manager Configurations @@ -86,6 +94,14 @@ ]; }; + homeConfigurations.mindforge = home-manager.lib.homeManagerConfiguration { + pkgs = nixpkgs.legacyPackages."x86_64-linux"; + extraSpecialArgs.user = "mindforge"; + modules = [ + ./home/headless-nixos.nix + ]; + }; + # Darwin Configuration diff --git a/hardware/ai.nix b/hardware/ai.nix new file mode 100644 index 0000000..75833fd --- /dev/null +++ b/hardware/ai.nix @@ -0,0 +1,37 @@ +# 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 = [ "uhci_hcd" "ehci_pci" "ahci" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/b98eb7bb-f58c-4862-a234-1d72c9ff1187"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/3D03-9579"; + fsType = "vfat"; + options = [ "fmask=0022" "dmask=0022" ]; + }; + + 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.enp6s18.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; +}