diff options
| -rw-r--r-- | derivations/flash-attn/default.nix | 75 | ||||
| -rw-r--r-- | derivations/flash-attn/flake.lock | 27 | ||||
| -rw-r--r-- | derivations/flash-attn/flake.nix | 27 | ||||
| -rw-r--r-- | derivations/flash-attn/nvidia.nix | 24 | ||||
| -rw-r--r-- | flake.lock | 416 | ||||
| -rw-r--r-- | hosts/base.nix | 15 | ||||
| -rw-r--r-- | hosts/cloud/span/configuration.nix | 2 | ||||
| -rw-r--r-- | hosts/cloud/span/nginx.nix | 13 | ||||
| -rw-r--r-- | hosts/dev.nix | 18 | ||||
| -rw-r--r-- | hosts/local/gui.nix | 9 | ||||
| -rw-r--r-- | hosts/local/i3.nix | 13 | ||||
| -rw-r--r-- | hosts/local/master/configuration.nix | 39 | ||||
| -rw-r--r-- | hosts/local/master/keyboard.nix | 6 | ||||
| -rw-r--r-- | hosts/local/nvidia.nix | 9 | ||||
| -rw-r--r-- | hosts/pkgs.nix | 10 | ||||
| -rw-r--r-- | hosts/unfree.nix | 1 |
16 files changed, 538 insertions, 166 deletions
diff --git a/derivations/flash-attn/default.nix b/derivations/flash-attn/default.nix new file mode 100644 index 0000000..5cadaff --- /dev/null +++ b/derivations/flash-attn/default.nix @@ -0,0 +1,75 @@ +{ + lib, + python3Packages, + fetchFromGitHub, + symlinkJoin, + pkgs, +}: let + inherit (python3Packages.torch) cudaCapabilities cudaPackages; + inherit (cudaPackages) backendStdenv; + + nvidia = pkgs.callPackage ./nvidia.nix {}; +in + python3Packages.buildPythonPackage rec { + inherit (nvidia) BUILD_CUDA_EXT CUDA_VERSION preBuild; + pname = "flash-attn"; + version = "2.8.2"; + pyproject = true; + + src = fetchFromGitHub { + owner = "Dao-AILab"; + repo = "flash-attention"; + rev = "v${version}"; + hash = "sha256-iHxfDh+rGanhymP5F7g8rQcQUlP0oXliVF+y+ur/iJ0="; + fetchSubmodules = true; + }; + + preConfigure = '' + export CC=${lib.getExe' backendStdenv.cc "cc"} + export CXX=${lib.getExe' backendStdenv.cc "c++"} + export TORCH_CUDA_ARCH_LIST="${lib.concatStringsSep ";" cudaCapabilities}" + export FORCE_CUDA=1 + ''; + + build-tools = with python3Packages; [ + setuptools + wheel + ]; + + nativeBuildInputs = with pkgs; [ + git + which + ninja + ]; + + env.CUDA_HOME = symlinkJoin { + name = "cuda-redist"; + paths = buildInputs; + }; + + buildInputs = with cudaPackages; [ + cuda_cudart # cuda_runtime_api.h + libcusparse # cusparse.h + cuda_cccl # nv/target + libcublas # cublas_v2.h + libcusolver # cusolverDn.h + libcurand # curand_kernel.h + cuda_nvcc + ]; + + dependencies = with python3Packages; [ + torch + psutil + ninja + einops + packaging + ]; + + pythonImportsCheck = ["flash_attn"]; + + meta = with lib; { + description = "Fast and memory-efficient exact attention"; + homepage = "https://github.com/Dao-AILab/flash-attention"; + license = licenses.bsd3; + }; + } diff --git a/derivations/flash-attn/flake.lock b/derivations/flash-attn/flake.lock new file mode 100644 index 0000000..80b4b37 --- /dev/null +++ b/derivations/flash-attn/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1758035966, + "narHash": "sha256-qqIJ3yxPiB0ZQTT9//nFGQYn8X/PBoJbofA7hRKZnmE=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "8d4ddb19d03c65a36ad8d189d001dc32ffb0306b", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/derivations/flash-attn/flake.nix b/derivations/flash-attn/flake.nix new file mode 100644 index 0000000..0e09fdf --- /dev/null +++ b/derivations/flash-attn/flake.nix @@ -0,0 +1,27 @@ +# https://github.com/BatteredBunny/nix-ai-stuff/tree/main +{ + description = "Gemini CLI flake"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + }; + + outputs = { + self, + nixpkgs, + }: let + system = "x86_64-linux"; + pkgs = import nixpkgs { + system = system; + config = { + allowUnfree = true; + cudaSupport = true; + }; + }; + in { + packages.${system}.default = pkgs.callPackage ./default.nix { + # inherit (pkgs) lib python3Packages fetchFromGitHub symlinkJoin; + # pkgs = pkgs; + }; + }; +} diff --git a/derivations/flash-attn/nvidia.nix b/derivations/flash-attn/nvidia.nix new file mode 100644 index 0000000..7b83e84 --- /dev/null +++ b/derivations/flash-attn/nvidia.nix @@ -0,0 +1,24 @@ +{ + symlinkJoin, + cudaPackages, + pkgs, + cudaCapabilities ? pkgs.cudaPackages.flags.cudaCapabilities, + lib, +}: { + BUILD_CUDA_EXT = "1"; + + CUDA_HOME = symlinkJoin { + name = "cuda-redist"; + paths = with cudaPackages; [ + cuda_cudart # cuda_runtime.h + cuda_nvcc + ]; + }; + + CUDA_VERSION = cudaPackages.cudaMajorMinorVersion; + + preBuild = '' + export PATH=${pkgs.gcc13Stdenv.cc}/bin:$PATH + export TORCH_CUDA_ARCH_LIST="${lib.concatStringsSep ";" cudaCapabilities}" + ''; +} @@ -1,5 +1,53 @@ { "nodes": { + "agenix": { + "inputs": { + "agenix": "agenix_2", + "crane": "crane", + "flake-utils": "flake-utils", + "nixpkgs": [ + "nixpkgs" + ], + "rust-overlay": "rust-overlay" + }, + "locked": { + "lastModified": 1744897914, + "narHash": "sha256-GIVU92o2TZBnKQXTb76zpQbWR4zjU2rFqWKNIIpXnqA=", + "owner": "yaxitech", + "repo": "ragenix", + "rev": "40f2e17ecaeab4d78ec323e96a04548c0aaa5223", + "type": "github" + }, + "original": { + "owner": "yaxitech", + "repo": "ragenix", + "type": "github" + } + }, + "agenix_2": { + "inputs": { + "darwin": "darwin", + "home-manager": "home-manager", + "nixpkgs": [ + "agenix", + "nixpkgs" + ], + "systems": "systems" + }, + "locked": { + "lastModified": 1736955230, + "narHash": "sha256-uenf8fv2eG5bKM8C/UvFaiJMZ4IpUFaQxk9OH5t/1gA=", + "owner": "ryantm", + "repo": "agenix", + "rev": "e600439ec4c273cf11e06fe4d9d906fb98fa097c", + "type": "github" + }, + "original": { + "owner": "ryantm", + "repo": "agenix", + "type": "github" + } + }, "blobs": { "flake": false, "locked": { @@ -50,6 +98,21 @@ }, "crane": { "locked": { + "lastModified": 1741481578, + "narHash": "sha256-JBTSyJFQdO3V8cgcL08VaBUByEU6P5kXbTJN6R0PFQo=", + "owner": "ipetkov", + "repo": "crane", + "rev": "bb1c9567c43e4434f54e9481eb4b8e8e0d50f0b5", + "type": "github" + }, + "original": { + "owner": "ipetkov", + "repo": "crane", + "type": "github" + } + }, + "crane_2": { + "locked": { "lastModified": 1754269165, "narHash": "sha256-0tcS8FHd4QjbCVoxN9jI+PjHgA4vc/IjkUSp+N3zy0U=", "owner": "ipetkov", @@ -63,6 +126,29 @@ "type": "github" } }, + "darwin": { + "inputs": { + "nixpkgs": [ + "agenix", + "agenix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1700795494, + "narHash": "sha256-gzGLZSiOhf155FW7262kdHo2YDeugp3VuIFb4/GGng0=", + "owner": "lnl7", + "repo": "nix-darwin", + "rev": "4b9b83d5a92e8c1fbfd8eb27eda375908c11ec4d", + "type": "github" + }, + "original": { + "owner": "lnl7", + "ref": "master", + "repo": "nix-darwin", + "type": "github" + } + }, "devenv": { "inputs": { "cachix": "cachix", @@ -73,11 +159,11 @@ "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1760394278, - "narHash": "sha256-AibI6iJtlD+y532sLIitI1xZ5G6PEw+qsJ2o8vflma4=", + "lastModified": 1760890764, + "narHash": "sha256-hCO8y2iJwlVTx6UKUpFY3doqHG5W0znV00mCAneX+FE=", "owner": "cachix", "repo": "devenv", - "rev": "d786b5f55ad14a7078057779e7bf016e38311e66", + "rev": "8bd9769602d769d427450f64fbd02c80871a186c", "type": "github" }, "original": { @@ -93,11 +179,11 @@ ] }, "locked": { - "lastModified": 1758287904, - "narHash": "sha256-IGmaEf3Do8o5Cwp1kXBN1wQmZwQN3NLfq5t4nHtVtcU=", + "lastModified": 1760701190, + "narHash": "sha256-y7UhnWlER8r776JsySqsbTUh2Txf7K30smfHlqdaIQw=", "owner": "nix-community", "repo": "disko", - "rev": "67ff9807dd148e704baadbd4fd783b54282ca627", + "rev": "3a9450b26e69dcb6f8de6e2b07b3fc1c288d85f5", "type": "github" }, "original": { @@ -243,11 +329,11 @@ "nixpkgs-lib": "nixpkgs-lib" }, "locked": { - "lastModified": 1759362264, - "narHash": "sha256-wfG0S7pltlYyZTM+qqlhJ7GMw2fTF4mLKCIVhLii/4M=", + "lastModified": 1760813311, + "narHash": "sha256-lbHQ7FXGzt6/IygWvJ1lCq+Txcut3xYYd6VIpF1ojkg=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "758cf7296bee11f1706a574c77d072b8a7baa881", + "rev": "4e627ac2e1b8f1de7f5090064242de9a259dbbc8", "type": "github" }, "original": { @@ -282,11 +368,11 @@ "nixpkgs-lib": "nixpkgs-lib_2" }, "locked": { - "lastModified": 1759362264, - "narHash": "sha256-wfG0S7pltlYyZTM+qqlhJ7GMw2fTF4mLKCIVhLii/4M=", + "lastModified": 1760813311, + "narHash": "sha256-lbHQ7FXGzt6/IygWvJ1lCq+Txcut3xYYd6VIpF1ojkg=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "758cf7296bee11f1706a574c77d072b8a7baa881", + "rev": "4e627ac2e1b8f1de7f5090064242de9a259dbbc8", "type": "github" }, "original": { @@ -318,7 +404,7 @@ }, "flake-utils": { "inputs": { - "systems": "systems" + "systems": "systems_2" }, "locked": { "lastModified": 1731533236, @@ -336,7 +422,7 @@ }, "flake-utils_2": { "inputs": { - "systems": "systems_2" + "systems": "systems_3" }, "locked": { "lastModified": 1731533236, @@ -353,12 +439,15 @@ } }, "flake-utils_3": { + "inputs": { + "systems": "systems_4" + }, "locked": { - "lastModified": 1638122382, - "narHash": "sha256-sQzZzAbvKEqN9s0bzWuYmRaA03v40gaJ4+iL1LXjaeI=", + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", "owner": "numtide", "repo": "flake-utils", - "rev": "74f7e4319258e287b0f9cb95426c9853b282730b", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", "type": "github" }, "original": { @@ -368,15 +457,12 @@ } }, "flake-utils_4": { - "inputs": { - "systems": "systems_3" - }, "locked": { - "lastModified": 1701680307, - "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", + "lastModified": 1638122382, + "narHash": "sha256-sQzZzAbvKEqN9s0bzWuYmRaA03v40gaJ4+iL1LXjaeI=", "owner": "numtide", "repo": "flake-utils", - "rev": "4022d587cbbfd70fe950c1e2083a02621806a725", + "rev": "74f7e4319258e287b0f9cb95426c9853b282730b", "type": "github" }, "original": { @@ -387,14 +473,14 @@ }, "flake-utils_5": { "inputs": { - "systems": "systems_4" + "systems": "systems_5" }, "locked": { - "lastModified": 1731533236, - "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "lastModified": 1701680307, + "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", "owner": "numtide", "repo": "flake-utils", - "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "rev": "4022d587cbbfd70fe950c1e2083a02621806a725", "type": "github" }, "original": { @@ -405,7 +491,7 @@ }, "flake-utils_6": { "inputs": { - "systems": "systems_5" + "systems": "systems_6" }, "locked": { "lastModified": 1731533236, @@ -428,7 +514,7 @@ ] }, "locked": { - "lastModified": 1753566056, + "lastModified": 1753566031, "narHash": "sha256-ypEepJDaIjQx2Ou813++x5c1Kt11DR8vAWITBlmlgKU=", "path": "/home/y/nixconf/derivations/gemini", "type": "path" @@ -471,11 +557,11 @@ "nixpkgs": "nixpkgs_2" }, "locked": { - "lastModified": 1760392170, - "narHash": "sha256-WftxJgr2MeDDFK47fQKywzC72L2jRc/PWcyGdjaDzkw=", + "lastModified": 1760663237, + "narHash": "sha256-BflA6U4AM1bzuRMR8QqzPXqh8sWVCNDzOdsxXEguJIc=", "owner": "cachix", "repo": "git-hooks.nix", - "rev": "46d55f0aeb1d567a78223e69729734f3dca25a85", + "rev": "ca5b894d3e3e151ffc1db040b6ce4dcc75d31c37", "type": "github" }, "original": { @@ -622,14 +708,14 @@ "helix": { "inputs": { "nixpkgs": "nixpkgs_3", - "rust-overlay": "rust-overlay" + "rust-overlay": "rust-overlay_2" }, "locked": { - "lastModified": 1760446779, - "narHash": "sha256-UzJHuqTgfwtnh34zbGq6NUe5i8wv3wg6B9njykBAddc=", + "lastModified": 1760832569, + "narHash": "sha256-wg925OdUZdhjJub5XfpBTWQ3EOJYH7JnaBWHfh849J4=", "owner": "helix-editor", "repo": "helix", - "rev": "6e07bcc04dd5a0bb5ae04677823a5b3821f622c5", + "rev": "97aee4950fd9a08a78415cd8992354ae5cf3aaf0", "type": "github" }, "original": { @@ -638,6 +724,28 @@ "type": "github" } }, + "home-manager": { + "inputs": { + "nixpkgs": [ + "agenix", + "agenix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1703113217, + "narHash": "sha256-7ulcXOk63TIT2lVDSExj7XzFx09LpdSAPtvgtM7yQPE=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "3bfaacf46133c037bb356193bd2f1765d9dc82c1", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, "homix": { "inputs": { "nixpkgs": "nixpkgs_4" @@ -673,17 +781,15 @@ }, "kmonad": { "inputs": { - "nixpkgs": [ - "nixpkgs" - ] + "nixpkgs": "nixpkgs_5" }, "locked": { "dir": "nix", - "lastModified": 1759056911, - "narHash": "sha256-as91wURxvgfgdrym+gN6W0H1DLlA7IhHlt0ALwbjmxQ=", + "lastModified": 1760515095, + "narHash": "sha256-6MD0hkLbVjH8ncegL1cBLUmw9cwIJJBBXVBr8i4j3Ps=", "owner": "kmonad", "repo": "kmonad", - "rev": "5a763290de4aa8de90d132f11c33327a14856b91", + "rev": "646b05994b9f0f62cd9458d8356fdae5061951ea", "type": "github" }, "original": { @@ -695,12 +801,12 @@ }, "lanzaboote": { "inputs": { - "crane": "crane", + "crane": "crane_2", "flake-compat": "flake-compat_3", "flake-parts": "flake-parts_3", - "nixpkgs": "nixpkgs_5", + "nixpkgs": "nixpkgs_6", "pre-commit-hooks-nix": "pre-commit-hooks-nix", - "rust-overlay": "rust-overlay_2" + "rust-overlay": "rust-overlay_3" }, "locked": { "lastModified": 1756744479, @@ -718,7 +824,7 @@ }, "lib-aggregate": { "inputs": { - "flake-utils": "flake-utils_5", + "flake-utils": "flake-utils_6", "nixpkgs-lib": "nixpkgs-lib_3" }, "locked": { @@ -737,16 +843,16 @@ }, "microvm": { "inputs": { - "flake-utils": "flake-utils_2", - "nixpkgs": "nixpkgs_6", + "flake-utils": "flake-utils_3", + "nixpkgs": "nixpkgs_7", "spectrum": "spectrum" }, "locked": { - "lastModified": 1760236243, - "narHash": "sha256-u2HvURFrR6UnPbCltTOWQBvX6N8XSpCE5m0p4c8UOKA=", + "lastModified": 1760574296, + "narHash": "sha256-S3gIp6Wd9vQ2RYDxcbHM2CIYgDtogbwzSdu38WABKaQ=", "owner": "astro", "repo": "microvm.nix", - "rev": "67c23f6fc72e78cc4b8e46b8b9b1d3982d27bee4", + "rev": "42628f7c61b02d385ce2cb1f66f9be333ac20140", "type": "github" }, "original": { @@ -802,11 +908,11 @@ ] }, "locked": { - "lastModified": 1760338583, - "narHash": "sha256-IGwy02SH5K2hzIFrKMRsCmyvwOwWxrcquiv4DbKL1S4=", + "lastModified": 1760721282, + "narHash": "sha256-aAHphQbU9t/b2RRy2Eb8oMv+I08isXv2KUGFAFn7nCo=", "owner": "lnl7", "repo": "nix-darwin", - "rev": "9a9ab01072f78823ca627ae5e895e40d493c3ecf", + "rev": "c3211fcd0c56c11ff110d346d4487b18f7365168", "type": "github" }, "original": { @@ -818,14 +924,14 @@ "nix-gaming": { "inputs": { "flake-parts": "flake-parts_4", - "nixpkgs": "nixpkgs_7" + "nixpkgs": "nixpkgs_8" }, "locked": { - "lastModified": 1760406533, - "narHash": "sha256-ViYpiGv0w+TXpBCFXPXWlEP3dVNHeGgvpsKDbQMY6UE=", + "lastModified": 1760839259, + "narHash": "sha256-9KYm1Oh3jB2Xf0LiFxIBFgOuqRN4FNW4PKfrxXDV418=", "owner": "fufexan", "repo": "nix-gaming", - "rev": "f8f51dd445f7b0dbb3429a3e31994bb0f2908010", + "rev": "6aa0613ecf363840e011006b05aefa094b78b053", "type": "github" }, "original": { @@ -866,7 +972,7 @@ }, "nixos-cn": { "inputs": { - "flake-utils": "flake-utils_3", + "flake-utils": "flake-utils_4", "nixpkgs": [ "nixpkgs" ] @@ -970,9 +1076,9 @@ }, "nixos-rk3588": { "inputs": { - "flake-utils": "flake-utils_4", + "flake-utils": "flake-utils_5", "nixos-generators": "nixos-generators_2", - "nixpkgs": "nixpkgs_8", + "nixpkgs": "nixpkgs_9", "pre-commit-hooks": "pre-commit-hooks" }, "locked": { @@ -992,14 +1098,14 @@ "nixos-wsl": { "inputs": { "flake-compat": "flake-compat_5", - "nixpkgs": "nixpkgs_9" + "nixpkgs": "nixpkgs_10" }, "locked": { - "lastModified": 1760441980, - "narHash": "sha256-HLO1uUa1DJWT6bXD+RigrSthZmxY6JHlbn+zhMizzBo=", + "lastModified": 1760536587, + "narHash": "sha256-wfWqt+igns/VazjPLkyb4Z/wpn4v+XIjUeI3xY/1ENg=", "owner": "nix-community", "repo": "NixOS-WSL", - "rev": "3534ac7ff39683da15dbf3adb2a950841a6d58d4", + "rev": "f98ee1de1fa36eca63c67b600f5d617e184e82ea", "type": "github" }, "original": { @@ -1043,11 +1149,11 @@ }, "nixpkgs-darwin": { "locked": { - "lastModified": 1760309387, - "narHash": "sha256-e0lvQ7+B1Y8zjykYHAj9tBv10ggLqK0nmxwvMU3J0Eo=", + "lastModified": 1760794584, + "narHash": "sha256-6IKtYFTwVORisw6DkhUXo6VHscpIBvuCcSUmquFYoG8=", "owner": "nixos", "repo": "nixpkgs", - "rev": "6cd95994a9c8f7c6f8c1f1161be94119afdcb305", + "rev": "434ace593ed7defee962d36793bfa17ebd4555ce", "type": "github" }, "original": { @@ -1120,11 +1226,11 @@ }, "nixpkgs-stable": { "locked": { - "lastModified": 1760139962, - "narHash": "sha256-4xggC56Rub3WInz5eD7EZWXuLXpNvJiUPahGtMkwtuc=", + "lastModified": 1760725957, + "narHash": "sha256-tdoIhL/NlER290HfSjOkgi4jfmjeqmqrzgnmiMtGepE=", "owner": "nixos", "repo": "nixpkgs", - "rev": "7e297ddff44a3cc93673bb38d0374df8d0ad73e4", + "rev": "81b927b14b7b3988334d5282ef9cba802e193fe1", "type": "github" }, "original": { @@ -1136,14 +1242,14 @@ }, "nixpkgs-unfree": { "inputs": { - "nixpkgs": "nixpkgs_11" + "nixpkgs": "nixpkgs_12" }, "locked": { - "lastModified": 1760192498, - "narHash": "sha256-rZPILU0OSwJcRYrSfBrOWxkVobCw8JDOF5QErUMyiLY=", + "lastModified": 1760624622, + "narHash": "sha256-46hcvFR35pO20unutRtW6zMFMqWWs/sdkJhxbpNgLUQ=", "owner": "numtide", "repo": "nixpkgs-unfree", - "rev": "6c227e849106cc42fb033e62b4f642e3448f8b69", + "rev": "20715f574d65864d5f8a4634978dc2f971d0ce33", "type": "github" }, "original": { @@ -1162,11 +1268,11 @@ ] }, "locked": { - "lastModified": 1760407932, - "narHash": "sha256-zmsb21trMZ2N1OQoVa9h0PVjSRbYME3CkfV7vRF34vE=", + "lastModified": 1760706459, + "narHash": "sha256-fX8jI4nSckpBemnmk5jFcaGxXSnNWBUw2840OTamxYI=", "owner": "nix-community", "repo": "nixpkgs-wayland", - "rev": "ed8e74536c2d3f460a3590925b0e1c65754a9c40", + "rev": "900a3dcea87f5bc937da5675217686dd71cccc55", "type": "github" }, "original": { @@ -1177,11 +1283,27 @@ }, "nixpkgs_10": { "locked": { - "lastModified": 1760284886, - "narHash": "sha256-TK9Kr0BYBQ/1P5kAsnNQhmWWKgmZXwUQr4ZMjCzWf2c=", + "lastModified": 1759733170, + "narHash": "sha256-TXnlsVb5Z8HXZ6mZoeOAIwxmvGHp1g4Dw89eLvIwKVI=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "8913c168d1c56dc49a7718685968f38752171c3b", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_11": { + "locked": { + "lastModified": 1760524057, + "narHash": "sha256-EVAqOteLBFmd7pKkb0+FIUyzTF61VKi7YmvP1tw4nEw=", "owner": "nixos", "repo": "nixpkgs", - "rev": "cf3f5c4def3c7b5f1fc012b3d839575dbe552d43", + "rev": "544961dfcce86422ba200ed9a0b00dd4b1486ec5", "type": "github" }, "original": { @@ -1191,13 +1313,13 @@ "type": "github" } }, - "nixpkgs_11": { + "nixpkgs_12": { "locked": { - "lastModified": 1760038930, - "narHash": "sha256-Oncbh0UmHjSlxO7ErQDM3KM0A5/Znfofj2BSzlHLeVw=", + "lastModified": 1760524057, + "narHash": "sha256-EVAqOteLBFmd7pKkb0+FIUyzTF61VKi7YmvP1tw4nEw=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "0b4defa2584313f3b781240b29d61f6f9f7e0df3", + "rev": "544961dfcce86422ba200ed9a0b00dd4b1486ec5", "type": "github" }, "original": { @@ -1205,13 +1327,13 @@ "type": "indirect" } }, - "nixpkgs_12": { + "nixpkgs_13": { "locked": { - "lastModified": 1760284886, - "narHash": "sha256-TK9Kr0BYBQ/1P5kAsnNQhmWWKgmZXwUQr4ZMjCzWf2c=", + "lastModified": 1760524057, + "narHash": "sha256-EVAqOteLBFmd7pKkb0+FIUyzTF61VKi7YmvP1tw4nEw=", "owner": "nixos", "repo": "nixpkgs", - "rev": "cf3f5c4def3c7b5f1fc012b3d839575dbe552d43", + "rev": "544961dfcce86422ba200ed9a0b00dd4b1486ec5", "type": "github" }, "original": { @@ -1271,6 +1393,22 @@ }, "nixpkgs_5": { "locked": { + "lastModified": 1744157173, + "narHash": "sha256-bWSjxDwq7iVePrhmA7tY2dyMWHuNJo8knkO4y+q4ZkY=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "6a39c6e495eefabc935d8ddf66aa45d85b85fa3f", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_6": { + "locked": { "lastModified": 1754243818, "narHash": "sha256-sEPw2W01UPf0xNGnMGNZIaE1XHkk7O+lLLetYEXVZHk=", "owner": "NixOS", @@ -1285,7 +1423,7 @@ "type": "github" } }, - "nixpkgs_6": { + "nixpkgs_7": { "locked": { "lastModified": 1759381078, "narHash": "sha256-gTrEEp5gEspIcCOx9PD8kMaF1iEmfBcTbO0Jag2QhQs=", @@ -1301,13 +1439,13 @@ "type": "github" } }, - "nixpkgs_7": { + "nixpkgs_8": { "locked": { - "lastModified": 1760103332, - "narHash": "sha256-BMsGVfKl4Q80Pr9T1AkCRljO1bpwCmY8rTBVj8XGuhA=", + "lastModified": 1760596604, + "narHash": "sha256-J/i5K6AAz/y5dBePHQOuzC7MbhyTOKsd/GLezSbEFiM=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "870493f9a8cb0b074ae5b411b2f232015db19a65", + "rev": "3cbe716e2346710d6e1f7c559363d14e11c32a43", "type": "github" }, "original": { @@ -1317,7 +1455,7 @@ "type": "github" } }, - "nixpkgs_8": { + "nixpkgs_9": { "locked": { "lastModified": 1729256560, "narHash": "sha256-/uilDXvCIEs3C9l73JTACm4quuHUsIHcns1c+cHUJwA=", @@ -1333,33 +1471,17 @@ "type": "github" } }, - "nixpkgs_9": { - "locked": { - "lastModified": 1759733170, - "narHash": "sha256-TXnlsVb5Z8HXZ6mZoeOAIwxmvGHp1g4Dw89eLvIwKVI=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "8913c168d1c56dc49a7718685968f38752171c3b", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, "nur": { "inputs": { "flake-parts": "flake-parts_5", - "nixpkgs": "nixpkgs_12" + "nixpkgs": "nixpkgs_13" }, "locked": { - "lastModified": 1760443374, - "narHash": "sha256-zrCb/Ck+8Li9fhNbAr8eP2+X3qUwqnmSuoacD+x4Msc=", + "lastModified": 1760901178, + "narHash": "sha256-Aigo3XUHrJDsbwlT6sptlSiqIbubPnCbi4+K8mNRTTQ=", "owner": "nix-community", "repo": "NUR", - "rev": "c41298dba5d86cca70bf285662760e186c59b70f", + "rev": "f767ba32a14c42ce78da68cbbe0b410168f14096", "type": "github" }, "original": { @@ -1370,18 +1492,16 @@ }, "openai-codex": { "inputs": { - "flake-utils": "flake-utils_6", "nixpkgs": [ "nixpkgs" - ], - "rust-overlay": "rust-overlay_3" + ] }, "locked": { - "lastModified": 1760431640, - "narHash": "sha256-Cb/DKkZaQ6IJ2huaXqSK4XNpv85sEIUr+oYvCqn7g/w=", + "lastModified": 1760850833, + "narHash": "sha256-XqCx+9nafjYx7+84IXhuCGMk0wGfxsECBWblDcZTd3o=", "owner": "openai", "repo": "codex", - "rev": "5346cc422dd053717c6f22ab20ffbd0aa5c6594b", + "rev": "4f46360aa493b04eae12045ac8c34a4e42441734", "type": "github" }, "original": { @@ -1467,10 +1587,11 @@ }, "root": { "inputs": { + "agenix": "agenix", "devenv": "devenv", "disko": "disko", "flake-parts": "flake-parts_2", - "flake-utils": "flake-utils", + "flake-utils": "flake-utils_2", "gemini-cli": "gemini-cli", "git-hooks": "git-hooks_2", "helix": "helix", @@ -1487,7 +1608,7 @@ "nixos-mailserver": "nixos-mailserver", "nixos-rk3588": "nixos-rk3588", "nixos-wsl": "nixos-wsl", - "nixpkgs": "nixpkgs_10", + "nixpkgs": "nixpkgs_11", "nixpkgs-darwin": "nixpkgs-darwin", "nixpkgs-old": "nixpkgs-old", "nixpkgs-stable": "nixpkgs-stable", @@ -1506,16 +1627,16 @@ "rust-overlay": { "inputs": { "nixpkgs": [ - "helix", + "agenix", "nixpkgs" ] }, "locked": { - "lastModified": 1759631821, - "narHash": "sha256-V8A1L0FaU/aSXZ1QNJScxC12uP4hANeRBgI4YdhHeRM=", + "lastModified": 1741400194, + "narHash": "sha256-tEpgT+q5KlGjHSm8MnINgTPErEl8YDzX3Eps8PVc09g=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "1d7cbdaad90f8a5255a89a6eddd8af24dc89cafe", + "rev": "16b6045a232fea0e9e4c69e55a6e269607dd8e3f", "type": "github" }, "original": { @@ -1527,16 +1648,16 @@ "rust-overlay_2": { "inputs": { "nixpkgs": [ - "lanzaboote", + "helix", "nixpkgs" ] }, "locked": { - "lastModified": 1754189623, - "narHash": "sha256-fstu5eb30UYwsxow0aQqkzxNxGn80UZjyehQVNVHuBk=", + "lastModified": 1759631821, + "narHash": "sha256-V8A1L0FaU/aSXZ1QNJScxC12uP4hANeRBgI4YdhHeRM=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "c582ff7f0d8a7ea689ae836dfb1773f1814f472a", + "rev": "1d7cbdaad90f8a5255a89a6eddd8af24dc89cafe", "type": "github" }, "original": { @@ -1548,16 +1669,16 @@ "rust-overlay_3": { "inputs": { "nixpkgs": [ - "openai-codex", + "lanzaboote", "nixpkgs" ] }, "locked": { - "lastModified": 1746844454, - "narHash": "sha256-GcUWDQUDRYrD34ol90KGUpjbVcOfUNbv0s955jPecko=", + "lastModified": 1754189623, + "narHash": "sha256-fstu5eb30UYwsxow0aQqkzxNxGn80UZjyehQVNVHuBk=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "be092436d4c0c303b654e4007453b69c0e33009e", + "rev": "c582ff7f0d8a7ea689ae836dfb1773f1814f472a", "type": "github" }, "original": { @@ -1657,6 +1778,21 @@ "type": "github" } }, + "systems_6": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "waybar": { "inputs": { "flake-compat": "flake-compat_7", @@ -1665,11 +1801,11 @@ ] }, "locked": { - "lastModified": 1759654584, - "narHash": "sha256-ttmz2FOvDXNgvOMBXwvYY91yfc1v6n+LOfXCj56QdLo=", + "lastModified": 1760873938, + "narHash": "sha256-oKmQUUqprJNFZfSNFtYu9pOmLXMkP7M51kF1lX8WPp4=", "owner": "alexays", "repo": "waybar", - "rev": "559079e9a6afda77754afaf7c8d3f588c1d6206d", + "rev": "84ec25bbebef8a9ce0720675214a078808e73c39", "type": "github" }, "original": { @@ -1685,7 +1821,7 @@ ] }, "locked": { - "lastModified": 1741246078, + "lastModified": 1740186345, "narHash": "sha256-Qox5x+FI4OhCs/7T/v4hZlR9Rm7ZfpXP7ISy+OrHCyw=", "path": "/home/y/nixconf/derivations/windsurf", "type": "path" @@ -1717,7 +1853,7 @@ ] }, "locked": { - "lastModified": 1747476774, + "lastModified": 1740469068, "narHash": "sha256-uoitiN9zrv9QaGf8mKIXhRxXtsNi6MupZVK+Zy3jOoA=", "path": "/home/y/nixconf/derivations/yek", "type": "path" diff --git a/hosts/base.nix b/hosts/base.nix index 31bed5a..054a967 100644 --- a/hosts/base.nix +++ b/hosts/base.nix @@ -25,20 +25,31 @@ settings = { substituters = [ "https://cache.nixos.org" - "https://cuda-maintainers.cachix.org" + "https://polwex.cachix.org" "https://nix-community.cachix.org" "https://nix-gaming.cachix.org" ]; trusted-public-keys = [ "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" + "polwex.cachix.org-1:6Qk8lW0wZ9omwmURpPQUEDUHAb6Nsb+f+pdH2hppBZY=" "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" - "cuda-maintainers.cachix.org-1:0dq3bujKpuEPMCX6U4WylrUDZ9JyUG0VpVZa7CNfq5E=" "nix-gaming.cachix.org-1:nbjlureqMbRAxR1gJ/f3hxemL9svXaZF/Ees8vCUUs4=" ]; + keep-outputs = true; keep-derivations = true; trusted-users = ["root" "y"]; + max-jobs = 2; + cores = 16; }; + # buildMachines = [{ + # hostName = "builder.lan"; + # system = "x86_64-linux"; + # protocol = "ssh"; + # supportedFeatures = ["kvm" "big-parallel" "cuda"]; + + # }]; + # distributedBuilds = true; }; programs.nh = { enable = true; diff --git a/hosts/cloud/span/configuration.nix b/hosts/cloud/span/configuration.nix index d887d37..28c0748 100644 --- a/hosts/cloud/span/configuration.nix +++ b/hosts/cloud/span/configuration.nix @@ -11,9 +11,9 @@ ../../base.nix ./hardware-configuration.nix ./users.nix - ./mail.nix ../packages.nix ./nginx.nix + ./mail.nix ]; # Bootloader. diff --git a/hosts/cloud/span/nginx.nix b/hosts/cloud/span/nginx.nix index 9bfa8ea..1079c7d 100644 --- a/hosts/cloud/span/nginx.nix +++ b/hosts/cloud/span/nginx.nix @@ -36,6 +36,19 @@ ''; }; }; + virtualHosts."uuu.spandrell.ch" = { + enableACME = true; + forceSSL = true; + locations."/" = { + proxyPass = "http://127.0.0.1:8080"; + proxyWebsockets = true; # needed if you need to use WebSocket + extraConfig = '' + limit_req zone=blog burst=20 nodelay; + proxy_set_header Host $Host; + proxy_set_header Forwarded for=$remote_addr; + ''; + }; + }; virtualHosts."s3.spandrell.ch" = { extraConfig = '' client_max_body_size 128M; diff --git a/hosts/dev.nix b/hosts/dev.nix new file mode 100644 index 0000000..ef6c761 --- /dev/null +++ b/hosts/dev.nix @@ -0,0 +1,18 @@ +{ + inputs, + pkgs, + lib, + config, + ... +}: { + # https://nixos.wiki/wiki/CCache + + programs.ccache = { + enable = true; + }; + nix.settings.extra-sandbox-paths = [config.programs.ccache.cacheDir]; + + # environment.systemPackages = with pkgs; + # [ + # ]; +} diff --git a/hosts/local/gui.nix b/hosts/local/gui.nix index 81f97b1..26adeb1 100644 --- a/hosts/local/gui.nix +++ b/hosts/local/gui.nix @@ -41,7 +41,7 @@ # easyeffects # audio, cool stuff # games! - # ryujinx + ryubing #ryujinx wineWowPackages.staging dosbox siyuan @@ -51,8 +51,9 @@ # chat signal-desktop telegram-desktop - # llms - lmstudio - cherry-studio + electrum + # xdg whatever bs + glib # gio + desktop-file-utils ]; } diff --git a/hosts/local/i3.nix b/hosts/local/i3.nix index b9e67a7..d49a9d6 100644 --- a/hosts/local/i3.nix +++ b/hosts/local/i3.nix @@ -1,4 +1,13 @@ -{pkgs, ...}: { +{ + inputs, + pkgs, + ... +}: let + old-pkgs = import inputs.nixpkgs-old { + system = pkgs.system; + config.allowUnfree = true; + }; +in { environment.pathsToLink = ["/libexec"]; services.xserver = { xkb.options = "compose:ralt"; @@ -23,6 +32,7 @@ ]; }; }; + # Boot to terminal services.displayManager = { defaultSession = "none+i3"; @@ -42,6 +52,7 @@ vSync = true; }; environment.systemPackages = with pkgs; [ + old-pkgs.vivaldi #notifications dunst polybar diff --git a/hosts/local/master/configuration.nix b/hosts/local/master/configuration.nix index 2a3cc8a..cad65c8 100644 --- a/hosts/local/master/configuration.nix +++ b/hosts/local/master/configuration.nix @@ -6,10 +6,6 @@ inputs, ... }: let - old-pkgs = import inputs.nixpkgs-old { - system = pkgs.system; - config.allowUnfree = true; - }; in { imports = [ # Include the results of the hardware scan. @@ -39,6 +35,8 @@ in { networking = { hostName = "master"; # Define your hostname. }; + environment.etc."X11/xorg.conf.d/20-nvidia.conf".source = ./xorg.conf; + services.xserver.displayManager.xserverArgs = ["-config ${./xorg.conf}"]; # Set your time zone. time.timeZone = "Asia/Bangkok"; @@ -52,6 +50,16 @@ in { services.tailscale = { enable = true; }; + #services.meilisearch = { + # enable = true; + #}; + + zramSwap = { + enable = true; + memoryPercent = 100; + algorithm = "zstd"; + # memoryPercent = 30; + }; # This value determines the NixOS release from which the default # settings for stateful data, like file locations and database versions @@ -61,15 +69,6 @@ in { # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). # # - environment.systemPackages = [ - old-pkgs.vivaldi - # for AI IDE shit - # pkgs.nodejs - # pkgs.python312 - # pkgs.openrgb-with-all-plugins - ]; - environment.etc."X11/xorg.conf.d/20-nvidia.conf".source = ./xorg.conf; - services.xserver.displayManager.xserverArgs = ["-config ${./xorg.conf}"]; system.stateVersion = "23.11"; # Did you read the comment? #debugging segfaults @@ -116,4 +115,18 @@ in { # }; # }; # }; + # stop fucking crashing + + systemd.services.nix-daemon.serviceConfig = { + MemoryHigh = "22G"; # throttle above this + MemoryMax = "28G"; # hard kill above this + # optional niceties: + CPUWeight = 50; + IOWeight = 50; + TasksMax = 4096; + # Let systemd-oomd preferentially kill these if needed: + ManagedOOMMemoryPressure = "kill"; + ManagedOOMMemoryPressureLimit = "50%"; + }; + systemd.oomd.enable = true; } diff --git a/hosts/local/master/keyboard.nix b/hosts/local/master/keyboard.nix index f148d74..6cdcd98 100644 --- a/hosts/local/master/keyboard.nix +++ b/hosts/local/master/keyboard.nix @@ -1,8 +1,8 @@ {pkgs, ...}: { - services.logind.extraConfig = '' + services.logind.settings.Login = { # don’t shutdown when power button is short-pressed - HandlePowerKey=ignore - ''; + HandlePowerKey = "ignore"; + }; # config file keeps getting rewritten but I don't know by who i18n.inputMethod = { diff --git a/hosts/local/nvidia.nix b/hosts/local/nvidia.nix index ed505c6..b8b335a 100644 --- a/hosts/local/nvidia.nix +++ b/hosts/local/nvidia.nix @@ -27,9 +27,18 @@ in { nix.settings.substituters = [ "https://cuda-maintainers.cachix.org" + "https://nix-community.cachix.org" + "https://huggingface.cachix.org" + + "https://nix-ai-stuff.cachix.org" + "https://ai.cachix.org" ]; nix.settings.trusted-public-keys = [ + "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" "cuda-maintainers.cachix.org-1:0dq3bujKpuEPMCX6U4WylrUDZ9JyUG0VpVZa7CNfq5E=" + "huggingface.cachix.org-1:ynTPbLS0W8ofXd9fDjk1KvoFky9K2jhxe6r4nXAkc/o=" + "nix-ai-stuff.cachix.org-1:WlUGeVCs26w9xF0/rjyg32PujDqbVMlSHufpj1fqix8=" + "ai.cachix.org-1:N9dzRK+alWwoKXQlnn0H6aUx0lU/mspIoz8hMvGvbbc=" ]; services.xserver = { diff --git a/hosts/pkgs.nix b/hosts/pkgs.nix index 06a7f38..436851a 100644 --- a/hosts/pkgs.nix +++ b/hosts/pkgs.nix @@ -18,6 +18,8 @@ # terminal basics htop + btop + nvitop rlwrap bat gitAndTools.gitFull @@ -53,9 +55,10 @@ #nixfmt direnv nix-direnv - devenv + # devenv devbox - # inputs.devenv.packages.${pkgs.system}.default + inputs.devenv.packages.${pkgs.system}.default + bun # scraping python312Packages.yt-dlp # markdown lsp @@ -76,6 +79,9 @@ ast-grep diffsitter # inputs.gemini-cli.packages.x86_64-linux.default + # + # ai + lmstudio ] ++ lib.optionals pkgs.stdenv.isLinux [ # linuxKernel.packages.linux_latest_libre.cpupower diff --git a/hosts/unfree.nix b/hosts/unfree.nix index 5a140a4..30c4a62 100644 --- a/hosts/unfree.nix +++ b/hosts/unfree.nix @@ -43,4 +43,5 @@ dedicatedServer.openFirewall = true; # Open ports in the firewall for Source Dedicated Server }; # systemd.extraConfig = "DefaultlimitNOFILE=524288"; + systemd.settings.Manager = {DefaultlimitNOFILE = 524288;}; } |
