diff --git a/flake.lock b/flake.lock index 75595b9..edda213 100644 --- a/flake.lock +++ b/flake.lock @@ -129,6 +129,22 @@ "type": "github" } }, + "flake-compat_3": { + "flake": false, + "locked": { + "lastModified": 1747046372, + "narHash": "sha256-CIVLLkVgvHYbgI2UpXvIIBJ12HWgX+fjA8Xf8PUmqCY=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "9100a0f413b0c601e0533d1d94ffd501ce2e7885", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, "flake-parts": { "inputs": { "nixpkgs-lib": [ @@ -189,6 +205,24 @@ "type": "github" } }, + "flake-utils_2": { + "inputs": { + "systems": "systems_4" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "gitignore": { "inputs": { "nixpkgs": [ @@ -536,6 +570,26 @@ "type": "github" } }, + "nix-minecraft": { + "inputs": { + "flake-compat": "flake-compat_3", + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1768357481, + "narHash": "sha256-LpOWVXsHx20x8eRIhn23Q0icmV3Z6ZeFpAPzEqldXFk=", + "owner": "Infinidoge", + "repo": "nix-minecraft", + "rev": "f888492aa1a1eeb0114cf78af40d44e8300e002e", + "type": "github" + }, + "original": { + "owner": "Infinidoge", + "repo": "nix-minecraft", + "type": "github" + } + }, "nix-vm-test": { "inputs": { "nixpkgs": [ @@ -640,6 +694,22 @@ } }, "nixpkgs": { + "locked": { + "lastModified": 1748929857, + "narHash": "sha256-lcZQ8RhsmhsK8u7LIFsJhsLh/pzR9yZ8yqpTzyGdj+Q=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "c2a03962b8e24e669fb37b7df10e7c79531ff1a4", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { "locked": { "lastModified": 1760423683, "narHash": "sha256-Tb+NYuJhWZieDZUxN6PgglB16yuqBYQeMJyYBGCXlt8=", @@ -662,7 +732,7 @@ "nixpkgs" ], "nuschtosSearch": "nuschtosSearch", - "systems": "systems_4" + "systems": "systems_5" }, "locked": { "lastModified": 1752010420, @@ -681,7 +751,7 @@ }, "nuschtosSearch": { "inputs": { - "flake-utils": "flake-utils", + "flake-utils": "flake-utils_2", "ixx": "ixx", "nixpkgs": [ "nixvim", @@ -732,9 +802,10 @@ "home-manager": "home-manager", "hyprland": "hyprland", "impermanence": "impermanence", + "nix-minecraft": "nix-minecraft", "nixos-anywhere": "nixos-anywhere", "nixos-hardware": "nixos-hardware", - "nixpkgs": "nixpkgs", + "nixpkgs": "nixpkgs_2", "nixvim": "nixvim", "rust-overlay": "rust-overlay", "sops-nix": "sops-nix" @@ -840,6 +911,21 @@ "type": "github" } }, + "systems_5": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "treefmt-nix": { "inputs": { "nixpkgs": [ diff --git a/flake.nix b/flake.nix index 5df9414..05e4020 100644 --- a/flake.nix +++ b/flake.nix @@ -42,6 +42,7 @@ url = "github:Mic92/sops-nix"; inputs.nixpkgs.follows = "nixpkgs"; }; + nix-minecraft.url = "github:Infinidoge/nix-minecraft"; }; outputs = { diff --git a/nixos/system/neuro/default.nix b/nixos/system/neuro/default.nix index efc5e7c..7f63e35 100644 --- a/nixos/system/neuro/default.nix +++ b/nixos/system/neuro/default.nix @@ -11,10 +11,39 @@ in self.lib.nixpkgs-lib.nixosSystem { pkgs = import inputs.nixpkgs { inherit system; - overlays = [ self.overlays.default ]; + overlays = [ + self.overlays.default + inputs.nix-minecraft.overlay + ]; + config.allowUnfreePredicate = pkg: builtins.elem (self.lib.nixpkgs-lib.getName pkg) [ + "minecraft-server" + "nvidia-x11" + + "cuda_nvcc" + "cuda_cudart" + "cuda_cuobjdump" + "cuda_cupti" + "cuda_nvdisasm" + "cuda_cccl" + "cuda_nvml_dev" + "cuda_nvrtc" + "cuda_nvtx" + "cuda_profiler_api" + + "libcusparse_lt" + "libcublas" + "libcufft" + "libcufile" + "libcurand" + "libcusolver" + "libnvjitlink" + "libcusparse" + "cudnn" + ]; }; modules = [ { networking.hostName = name; } (import ./${name}.nix { inherit flake self inputs; }) + inputs.nix-minecraft.nixosModules.minecraft-servers ]; } diff --git a/nixos/system/neuro/hardware.nix b/nixos/system/neuro/hardware.nix new file mode 100644 index 0000000..148c2d5 --- /dev/null +++ b/nixos/system/neuro/hardware.nix @@ -0,0 +1,10 @@ +{ ... }: +{ + services.xserver.videoDrivers = [ "nvidia" ]; + hardware.graphics.enable = true; + hardware.nvidia = { + open = false; + nvidiaSettings = false; + modesetting.enable = false; + }; +} diff --git a/nixos/system/neuro/minecraft.nix b/nixos/system/neuro/minecraft.nix new file mode 100644 index 0000000..6d9c192 --- /dev/null +++ b/nixos/system/neuro/minecraft.nix @@ -0,0 +1,25 @@ +{ + pkgs, + ... +}: +{ + services.minecraft-servers = { + enable = true; + eula = true; + openFirewall = true; + + servers.vanilla = { + enable = true; + jvmOpts = "-Xmx6G -Xms2G"; + package = pkgs.minecraftServers.vanilla-1_21_11; + + serverProperties = { + difficulty = "hard"; + online-mode = true; + view-distance = 32; + level-seed = "8306359138650378643"; + pause-when-empty-seconds = 0; + }; + }; + }; +} diff --git a/nixos/system/neuro/neuro.nix b/nixos/system/neuro/neuro.nix index 53a9d86..edc9f32 100644 --- a/nixos/system/neuro/neuro.nix +++ b/nixos/system/neuro/neuro.nix @@ -8,66 +8,62 @@ modulesPath, config, ... -}: { +}: let system = pkgs.system; in { imports = [ - (modulesPath + "/installer/cd-dvd/iso-image.nix") self.nixosModules.hectic inputs.sops-nix.nixosModules.sops + ./minecraft.nix + ./hardware.nix ]; users.users.root.openssh.authorizedKeys.keys = [ - ''ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEJZFglwpPMFLnQDOqi84nlMFktZSSu1GzUIafvClUaD'' + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIETMumAHP+htbRvbrmzVoeesbT0+WcH1Wz8htk+7Ik+6" + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEJZFglwpPMFLnQDOqi84nlMFktZSSu1GzUIafvClUaD" + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGj7u/JuY9RwjoxnmO2b+pwC8XbMn+QOy44UpuN0Y1do riquizu" ]; - boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; - boot.initrd.availableKernelModules = [ - "xhci_pci" - "ahci" - "nvme" - "usbhid" - "sd_mod" - ]; - boot.initrd.kernelModules = ["nvme"]; - - disko.devices = { - disk.master = { - device = lib.mkDefault "/dev/disk/by-id/nvme-eui.00000000000000000026b7686dfafe35"; - type = "disk"; - content = { - type = "gpt"; - partitions = { - ESP = { - size = "1G"; - type = "EF00"; - content = { - type = "filesystem"; - format = "vfat"; - mountpoint = "/boot"; - }; - }; - root = { - size = "100%"; - content = { - type = "filesystem"; - format = "ext4"; - mountpoint = "/"; - }; - }; - }; - }; - }; - }; + # disko.devices = { + # disk.master = { + # device = lib.mkDefault "/dev/disk/by-id/nvme-eui.00000000000000000026b7686dfafe35"; + # type = "disk"; + # content = { + # type = "gpt"; + # partitions = { + # ESP = { + # size = "1G"; + # type = "EF00"; + # content = { + # type = "filesystem"; + # format = "vfat"; + # mountpoint = "/boot"; + # }; + # }; + # root = { + # size = "100%"; + # content = { + # type = "filesystem"; + # format = "ext4"; + # mountpoint = "/"; + # }; + # }; + # }; + # }; + # }; + # }; networking = { networkmanager.enable = true; useDHCP = lib.mkDefault true; - interfaces.enp5s0.useDHCP = lib.mkDefault true; + interfaces.enp6s0 = { + useDHCP = lib.mkDefault true; + wakeOnLan.enable = true; + }; firewall = { enable = true; allowedTCPPorts = [ - 80 443 + 80 443 # HTTP, HTTPS ]; + allowedUDPPorts = [ 9 ]; # Wake on LAN }; }; @@ -83,4 +79,51 @@ age.sshKeyPaths = [ "/etc/ssh/ssh_host_ed25519_key" ]; defaultSopsFile = ../../../sus/neuro.yaml; }; + + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" "sr_mod" "ext4" ]; + boot.initrd.kernelModules = [ "nvme" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-label/NIXROOT"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-label/NIXBOOT"; + fsType = "vfat"; + options = [ "fmask=0022" "dmask=0022" ]; + }; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware = { + cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + }; + + swapDevices = [ ]; + + programs.tmux.enable = true; + + zramSwap.enable = true; + zramSwap.priority = 100; + zramSwap.memoryMax = null; + zramSwap.algorithm = lib.mkDefault "zstd"; + zramSwap.swapDevices = 1; + zramSwap.memoryPercent = lib.mkDefault 100; + + environment.systemPackages = with pkgs; [ + # (pkgs.python3.withPackages (ps: with ps; [ + # hectic.py3-openai-shap-e + # torchWithCuda torchvision pytorch3d + # fvcore iopath tqdm + # ])) + git + neovim + wget + ethtool + rsync + # docker + ]; } diff --git a/package/default.nix b/package/default.nix index 1d958ff..d6c480a 100644 --- a/package/default.nix +++ b/package/default.nix @@ -117,6 +117,7 @@ in { py3-modulegraph = pkgs.callPackage ./py3-modulegraph.nix {}; py3-swifter = pkgs.callPackage ./py3-swifter.nix {}; py3-aiogram-newsletter = pkgs.callPackage ./py3-swifter.nix {}; + py3-openai-shap-e = pkgs.callPackage ./py3-openai-shap-e.nix {}; nvim-alias = pkgs.callPackage ./nvim-alias.nix {}; bolt-unpack = pkgs.callPackage ./bolt-unpack.nix {}; nvim-pager = pkgs.callPackage ./nvim-pager.nix {}; diff --git a/package/py3-openai-shap-e.nix b/package/py3-openai-shap-e.nix new file mode 100644 index 0000000..d097dbe --- /dev/null +++ b/package/py3-openai-shap-e.nix @@ -0,0 +1,40 @@ +{ + lib, + python3Packages, + fetchFromGitHub, +}: python3Packages.buildPythonPackage rec { + pname = "shap-e"; + version = "1.0"; + + src = fetchFromGitHub { + inherit pname version; + owner = "openai"; + repo = "shap-e"; + rev = "50131012ee11c9d2617f3886c10f000d3c7a3b43"; + sha256 = "sha256-RN4dARvz5fzoAFtEOdHWDuMqchCBuoGjsBv/yeWWai0="; + }; + + propagatedBuildInputs = with python3Packages; [ + filelock + pillow + torch + fire + humanize + requests + tqdm + matplotlib + scikit-image + scipy + numpy + blobfile + clip + + # NOTE(yukkop): not declared in setup.py, but crash on runtime without that + ipywidgets + ]; + + meta = with lib; { + description = "Shape-e OpenAi model"; + platforms = platforms.all; + }; +}