diff --git a/.gitignore b/.gitignore index d90015c..ee74d74 100644 --- a/.gitignore +++ b/.gitignore @@ -16,3 +16,6 @@ devenv.local.yaml # ide .vscode/settings.json + +# nix +result diff --git a/configuration.nix b/configuration.nix index dab15d9..c65d8bc 100644 --- a/configuration.nix +++ b/configuration.nix @@ -89,18 +89,6 @@ extraOptions = "!include ${config.age.secrets."github/token.ro.age".path}"; }; - boot = { - loader = { - systemd-boot.enable = true; - efi.canTouchEfiVariables = false; - }; - kernelPackages = pkgs.linuxPackages_latest; - extraModulePackages = with config.boot.kernelPackages; [ - v4l2loopback - # amneziawg - ]; - }; - networking = { hostName = "testenv"; nameservers = [ "10.20.0.1" ]; @@ -204,16 +192,13 @@ xdotool tree hyperfine - unrar - unzip - xarchiver nmap ]; }; programs = { gnome-terminal.enable = true; - thunar.enable = true; # TODO: replace + # thunar.enable = true; # TODO: replace winbox = { enable = true; package = pkgs.winbox4; diff --git a/custom/modules/default.nix b/custom/modules/default.nix new file mode 100644 index 0000000..1c2f431 --- /dev/null +++ b/custom/modules/default.nix @@ -0,0 +1,13 @@ +{ + pkgs, + lib, + kernel-src, + ... +}: + +let + linuxMainline = import ./kernel.nix { inherit pkgs lib kernel-src; }; +in +{ + boot.kernelPackages = pkgs.linuxPackagesFor linuxMainline; +} diff --git a/custom/modules/kernel.nix b/custom/modules/kernel.nix new file mode 100644 index 0000000..d37e611 --- /dev/null +++ b/custom/modules/kernel.nix @@ -0,0 +1,131 @@ +{ + pkgs, + lib, + kernel-src, + structuredExtraConfig ? { }, + kernelPatches ? [ ], + extraConfig ? "", + sccacheDir ? "/var/cache/sccache", + enforceSccache ? true, +}: + +let + makefile = builtins.readFile "${kernel-src}/Makefile"; + lines = lib.splitString "\n" makefile; + + get = + name: + let + line = lib.findFirst ( + l: lib.hasPrefix "${name} =" (lib.strings.trim l) + ) (throw "Makefile missing ${name}") lines; + in + lib.strings.trim (lib.removePrefix "${name} =" (lib.strings.trim line)); + + V = get "VERSION"; + P = get "PATCHLEVEL"; + S = get "SUBLEVEL"; + E = get "EXTRAVERSION"; + + kver = "${V}.${P}.${S}${E}"; +in +pkgs.callPackage ( + { buildLinux, ... }@args: + let + llvm = pkgs.llvmPackages_latest; + + # buildLinux uses common-flags.nix which sets CC to the *unwrapped* compiler: + # CC=${lib.getExe stdenv.cc.cc} + # and appends extraMakeFlags at the end. :contentReference[oaicite:1]{index=1} + realClang = lib.getExe llvm.clang-unwrapped; + + # Host tools are built with buildPackages.stdenv.cc (see common-flags HOSTCC). :contentReference[oaicite:2]{index=2} + buildPkgs = args.buildPackages or pkgs.buildPackages; + realHostCC = lib.getExe' buildPkgs.stdenv.cc "${buildPkgs.stdenv.cc.targetPrefix}cc"; + realHostCXX = lib.getExe' buildPkgs.stdenv.cc "${buildPkgs.stdenv.cc.targetPrefix}c++"; + + clangSccache = pkgs.writeShellScriptBin "clang" '' + set -euo pipefail + : "''${SCCACHE_ENFORCE_MARKER:?SCCACHE_ENFORCE_MARKER is not set}" + : > "''${SCCACHE_ENFORCE_MARKER}" + export SCCACHE_DIR=${lib.escapeShellArg sccacheDir} + exec ${pkgs.sccache}/bin/sccache ${realClang} "$@" + ''; + + hostccSccache = pkgs.writeShellScriptBin "cc" '' + set -euo pipefail + : "''${SCCACHE_ENFORCE_MARKER:?SCCACHE_ENFORCE_MARKER is not set}" + : > "''${SCCACHE_ENFORCE_MARKER}" + export SCCACHE_DIR=${lib.escapeShellArg sccacheDir} + exec ${pkgs.sccache}/bin/sccache ${realHostCC} "$@" + ''; + + hostcxxSccache = pkgs.writeShellScriptBin "c++" '' + set -euo pipefail + : "''${SCCACHE_ENFORCE_MARKER:?SCCACHE_ENFORCE_MARKER is not set}" + : > "''${SCCACHE_ENFORCE_MARKER}" + export SCCACHE_DIR=${lib.escapeShellArg sccacheDir} + exec ${pkgs.sccache}/bin/sccache ${realHostCXX} "$@" + ''; + + structuredExtraConfig' = + (with lib.kernel; { + LTO_CLANG_THIN = yes; + # LTO_CLANG_FULL = no; + # LTO_NONE = no; + }) + // structuredExtraConfig; + in + buildLinux ( + args + // { + inherit kernelPatches extraConfig; + + version = kver; + modDirVersion = kver; + src = kernel-src; + + stdenv = llvm.stdenv; + + extraMakeFlags = + (args.extraMakeFlags or [ ]) + ++ [ + "LLVM=1" + "LLVM_IAS=1" + ] + ++ lib.optionals enforceSccache [ + "CC=${lib.getExe clangSccache}" + "HOSTCC=${lib.getExe hostccSccache}" + "HOSTCXX=${lib.getExe hostcxxSccache}" + ]; + + # Enforce that the wrappers were actually invoked at least once. + # sccache is a compiler wrapper; this is the contract we’re enforcing. :contentReference[oaicite:4]{index=4} + preBuild = + (args.preBuild or "") + + lib.optionalString enforceSccache '' + export SCCACHE_ENFORCE_MARKER="$NIX_BUILD_TOP/.sccache-used" + rm -f "$SCCACHE_ENFORCE_MARKER" + ${pkgs.sccache}/bin/sccache --start-server || true + ${pkgs.sccache}/bin/sccache --zero-stats || true + ''; + + postBuild = + (args.postBuild or "") + + lib.optionalString enforceSccache '' + if [ ! -e "$SCCACHE_ENFORCE_MARKER" ]; then + echo "FATAL: sccache enforcement failed: compiler wrappers were not invoked." + echo "This means buildLinux did not use your CC/HOSTCC overrides." + exit 1 + fi + ${pkgs.sccache}/bin/sccache --show-stats --stats-format text || true + ''; + + structuredExtraConfig = structuredExtraConfig'; + + ignoreConfigErrors = true; + + extraMeta.branch = "${V}.${P}"; + } + ) +) { } diff --git a/custom/override.nix b/custom/override.nix index 49fbd95..e906059 100644 --- a/custom/override.nix +++ b/custom/override.nix @@ -1,26 +1,98 @@ final: prev: { + # ccacheWrapper = prev.ccacheWrapper.override { + # extraConfig = '' + # export CCACHE_COMPRESS=1 + # export CCACHE_SLOPPINESS=random_seed,time_macros + # export CCACHE_COMPILERCHECK=content + # export CCACHE_DIR="/home/thek0tyara/Documents/cache/ccache/" + # export CCACHE_UMASK=007 + # if [ ! -d "$CCACHE_DIR" ]; then + # echo "=====" + # echo "Directory '$CCACHE_DIR' does not exist" + # echo "Please create it with:" + # echo " sudo mkdir -m0770 '$CCACHE_DIR'" + # echo " sudo chown root:nixbld '$CCACHE_DIR'" + # echo "=====" + # exit 1 + # fi + # if [ ! -w "$CCACHE_DIR" ]; then + # echo "=====" + # echo "Directory '$CCACHE_DIR' is not accessible for user $(whoami)" + # echo "Please verify its access permissions" + # echo "=====" + # exit 1 + # fi + # ''; + # }; + # xdg-desktop-portal-cosmic = prev.xdg-desktop-portal-cosmic.overrideAttrs (old: { + # postPatch = (old.postPatch or "") + '' + # unitDir="$out/lib/systemd/user" + # ln -sfn org.freedesktop.impl.portal.desktop.cosmic.service \ + # "$unitDir/xdg-desktop-portal-cosmic.service" + # ''; + # }); + # codex = prev.codex.overrideAttrs ( + # old: + # let + # version = "0.111.0"; + # src = prev.fetchFromGitHub { + # owner = "openai"; + # repo = "codex"; + # tag = "rust-v${version}"; + # hash = "sha256-hdR70BhiMg9G/ibLCeHnRSY3PcGZDv0vnqBCbzSRD6I="; + # }; + # in + # { + # cargoDeps = old.cargoDeps.overrideAttrs (_: { + # inherit src; + # name = "codex-${version}-vendor.tar.gz"; + # sourceRoot = "${src.name}/codex-rs"; + # outputHash = "sha256-FR0GQenZ6CFhHUdi3FnuwIsqo0argAJo5STBwlGCsdg="; + # outputHashMode = "recursive"; + # }); + # } + # ); + codex = prev.codex.overrideAttrs ( + old: + let + version = "0.111.0"; + src = prev.fetchFromGitHub { + owner = "openai"; + repo = "codex"; + tag = "rust-v${version}"; + hash = "sha256-hdR70BhiMg9G/ibLCeHnRSY3PcGZDv0vnqBCbzSRD6I="; + }; + in + { + inherit version src; + sourceRoot = "${src.name}/codex-rs"; + + cargoDeps = prev.rustPlatform.fetchCargoVendor { + inherit src; + sourceRoot = "${src.name}/codex-rs"; + hash = "sha256-h+TIwNz+A6aYcMACWl//LiavABITZxwYa4CvawR/0RQ="; + }; + + buildInputs = (old.buildInputs or [ ]) ++ [ prev.libcap ]; + + preBuild = (old.preBuild or "") + '' + export CARGO_PROFILE_RELEASE_LTO=thin + export CARGO_PROFILE_RELEASE_CODEGEN_UNITS=8 + ''; + } + ); llama-cpp = prev.llama-cpp.overrideAttrs (old: rec { - version = "8018"; + version = "8124"; src = prev.fetchFromGitHub { owner = "ggml-org"; repo = "llama.cpp"; tag = "b${version}"; - hash = "sha256-V60fAIZHVse3mD4Q7LodL2UxspdZorDDsSqlB/lMyGE="; + hash = old.src.hash; }; # nativeBuildInputs = old.nativeBuildInputs ++ [ prev.pkgs.curl ]; }); pythonPackagesExtensions = prev.pythonPackagesExtensions ++ [ (pyFinal: pyPrev: { - sseclient-py = pyPrev.sseclient-py.overridePythonAttrs (old: rec { - format = "pyproject"; - nativeBuildInputs = (old.nativeBuildInputs or []) ++ (with pyPrev; [ - hatchling - #pypaBuildHook - #pypaInstallHook - ]); - doCheck = false; - }); - haystack-ai = pyPrev.haystack-ai.overridePythonAttrs (old: rec { version = "2.24.1"; @@ -47,6 +119,17 @@ final: prev: { broken = false; }; }); + sseclient-py = pyPrev.sseclient-py.overridePythonAttrs (old: rec { + format = "pyproject"; + nativeBuildInputs = + (old.nativeBuildInputs or [ ]) + ++ (with pyPrev; [ + hatchling + #pypaBuildHook + #pypaInstallHook + ]); + doCheck = false; + }); }) ]; winetricks = prev.winetricks.overrideAttrs ( diff --git a/devenv.lock b/devenv.lock index 987f72f..8ded817 100644 --- a/devenv.lock +++ b/devenv.lock @@ -3,10 +3,11 @@ "devenv": { "locked": { "dir": "src/modules", - "lastModified": 1771066302, + "lastModified": 1772909021, + "narHash": "sha256-XardsHAeueL09beWx7Z6g0Rb8GZyg5cYz4wqpOkAhcw=", "owner": "cachix", "repo": "devenv", - "rev": "1b355dec9bddbaddbe4966d6fc30d7aa3af8575b", + "rev": "ff810b7556261e3034f3a8f7006acdb7ff9b26b2", "type": "github" }, "original": { @@ -16,71 +17,16 @@ "type": "github" } }, - "flake-compat": { - "flake": false, - "locked": { - "lastModified": 1767039857, - "owner": "NixOS", - "repo": "flake-compat", - "rev": "5edf11c44bc78a0d334f6334cdaf7d60d732daab", - "type": "github" - }, - "original": { - "owner": "NixOS", - "repo": "flake-compat", - "type": "github" - } - }, - "git-hooks": { - "inputs": { - "flake-compat": "flake-compat", - "gitignore": "gitignore", - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1770726378, - "owner": "cachix", - "repo": "git-hooks.nix", - "rev": "5eaaedde414f6eb1aea8b8525c466dc37bba95ae", - "type": "github" - }, - "original": { - "owner": "cachix", - "repo": "git-hooks.nix", - "type": "github" - } - }, - "gitignore": { - "inputs": { - "nixpkgs": [ - "git-hooks", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1762808025, - "owner": "hercules-ci", - "repo": "gitignore.nix", - "rev": "cb5e3fdca1de58ccbc3ef53de65bd372b48f567c", - "type": "github" - }, - "original": { - "owner": "hercules-ci", - "repo": "gitignore.nix", - "type": "github" - } - }, "nixpkgs": { "inputs": { "nixpkgs-src": "nixpkgs-src" }, "locked": { - "lastModified": 1770434727, + "lastModified": 1772749504, + "narHash": "sha256-eqtQIz0alxkQPym+Zh/33gdDjkkch9o6eHnMPnXFXN0=", "owner": "cachix", "repo": "devenv-nixpkgs", - "rev": "8430f16a39c27bdeef236f1eeb56f0b51b33d348", + "rev": "08543693199362c1fddb8f52126030d0d374ba2e", "type": "github" }, "original": { @@ -93,11 +39,11 @@ "nixpkgs-src": { "flake": false, "locked": { - "lastModified": 1769922788, - "narHash": "sha256-H3AfG4ObMDTkTJYkd8cz1/RbY9LatN5Mk4UF48VuSXc=", + "lastModified": 1772173633, + "narHash": "sha256-MOH58F4AIbCkh6qlQcwMycyk5SWvsqnS/TCfnqDlpj4=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "207d15f1a6603226e1e223dc79ac29c7846da32e", + "rev": "c0f3d81a7ddbc2b1332be0d8481a672b4f6004d6", "type": "github" }, "original": { @@ -110,14 +56,10 @@ "root": { "inputs": { "devenv": "devenv", - "git-hooks": "git-hooks", - "nixpkgs": "nixpkgs", - "pre-commit-hooks": [ - "git-hooks" - ] + "nixpkgs": "nixpkgs" } } }, "root": "root", "version": 7 -} +} \ No newline at end of file diff --git a/devenv.nix b/devenv.nix index 561165f..957a409 100644 --- a/devenv.nix +++ b/devenv.nix @@ -17,7 +17,7 @@ nix flake check ''; build.exec = '' - nixos-rebuild switch --sudo --flake '.#' + nixos-rebuild switch --sudo --flake '.#' $@ ''; }; diff --git a/flake.lock b/flake.lock index c10dab8..dbc26c7 100644 --- a/flake.lock +++ b/flake.lock @@ -27,11 +27,11 @@ "systems": "systems_5" }, "locked": { - "lastModified": 1736955230, - "narHash": "sha256-uenf8fv2eG5bKM8C/UvFaiJMZ4IpUFaQxk9OH5t/1gA=", + "lastModified": 1761656077, + "narHash": "sha256-lsNWuj4Z+pE7s0bd2OKicOFq9bK86JE0ZGeKJbNqb94=", "owner": "ryantm", "repo": "agenix", - "rev": "e600439ec4c273cf11e06fe4d9d906fb98fa097c", + "rev": "9ba0d85de3eaa7afeab493fed622008b6e4924f5", "type": "github" }, "original": { @@ -94,11 +94,11 @@ }, "crane_3": { "locked": { - "lastModified": 1741481578, - "narHash": "sha256-JBTSyJFQdO3V8cgcL08VaBUByEU6P5kXbTJN6R0PFQo=", + "lastModified": 1760924934, + "narHash": "sha256-tuuqY5aU7cUkR71sO2TraVKK2boYrdW3gCSXUkF4i44=", "owner": "ipetkov", "repo": "crane", - "rev": "bb1c9567c43e4434f54e9481eb4b8e8e0d50f0b5", + "rev": "c6b4d5308293d0d04fcfeee92705017537cad02f", "type": "github" }, "original": { @@ -116,11 +116,11 @@ ] }, "locked": { - "lastModified": 1700795494, - "narHash": "sha256-gzGLZSiOhf155FW7262kdHo2YDeugp3VuIFb4/GGng0=", + "lastModified": 1744478979, + "narHash": "sha256-dyN+teG9G82G+m+PX/aSAagkC+vUv0SgUw3XkPhQodQ=", "owner": "lnl7", "repo": "nix-darwin", - "rev": "4b9b83d5a92e8c1fbfd8eb27eda375908c11ec4d", + "rev": "43975d782b418ebf4969e9ccba82466728c2851b", "type": "github" }, "original": { @@ -297,6 +297,24 @@ "type": "github" } }, + "flake-utils_2": { + "inputs": { + "systems": "systems_7" + }, + "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" + } + }, "git-hooks": { "inputs": { "flake-compat": "flake-compat", @@ -395,11 +413,11 @@ ] }, "locked": { - "lastModified": 1772218752, - "narHash": "sha256-G8nArvOTZXU8DRvrzAdz3Elcj6kA/vMtvY9mrGLATtA=", + "lastModified": 1772845525, + "narHash": "sha256-Dp5Ir2u4jJDGCgeMRviHvEQDe+U37hMxp6RSNOoMMPc=", "owner": "nix-community", "repo": "home-manager", - "rev": "f3a30376bb9eb2f6f61816be7d6ed954b6d2a3b9", + "rev": "27b93804fbef1544cb07718d3f0a451f4c4cd6c0", "type": "github" }, "original": { @@ -438,11 +456,11 @@ ] }, "locked": { - "lastModified": 1703113217, - "narHash": "sha256-7ulcXOk63TIT2lVDSExj7XzFx09LpdSAPtvgtM7yQPE=", + "lastModified": 1745494811, + "narHash": "sha256-YZCh2o9Ua1n9uCvrvi5pRxtuVNml8X2a03qIFfRKpFs=", "owner": "nix-community", "repo": "home-manager", - "rev": "3bfaacf46133c037bb356193bd2f1765d9dc82c1", + "rev": "abfad3d2958c9e6300a883bd443512c55dfeb1be", "type": "github" }, "original": { @@ -481,6 +499,24 @@ "type": "github" } }, + "kernel-src": { + "flake": false, + "locked": { + "lastModified": 1772838933, + "narHash": "sha256-77MlrOVBethsi2wbq0eQx+m6AzNoBWCD8b82B1yUX04=", + "ref": "drm-tip", + "rev": "fce8d7fb2107068c269b868d51aba5f9cf85998a", + "shallow": true, + "type": "git", + "url": "https://gitlab.freedesktop.org/drm/tip.git" + }, + "original": { + "ref": "drm-tip", + "shallow": true, + "type": "git", + "url": "https://gitlab.freedesktop.org/drm/tip.git" + } + }, "lanzaboote": { "inputs": { "crane": "crane", @@ -537,11 +573,11 @@ "xwayland-satellite-unstable": "xwayland-satellite-unstable" }, "locked": { - "lastModified": 1772211154, - "narHash": "sha256-BdXKcWd1LE+APzyaJ/xszDXcA5KKPenjNyC5VOd3x4E=", + "lastModified": 1772884214, + "narHash": "sha256-nl1U1E9Kk9ZmxWdqcwBuFaljxknbrwq8/bY+utQSajk=", "owner": "sodiboo", "repo": "niri-flake", - "rev": "599b3f8d4215470dd50066119c81007b2670b6e1", + "rev": "3fc5b3670ef77356173ca5f1fa5015e01204bc33", "type": "github" }, "original": { @@ -570,11 +606,11 @@ "niri-unstable": { "flake": false, "locked": { - "lastModified": 1772207631, - "narHash": "sha256-Jkkg+KqshFO3CbTszVVpkKN2AOObYz+wMsM3ONo1z5g=", + "lastModified": 1772873827, + "narHash": "sha256-T1igKylw0ZX8+yws4dWbkrSc+hZ1bmsM+Tjs4lxMYgo=", "owner": "YaLTeR", "repo": "niri", - "rev": "e708f546153f74acf33eb183b3b2992587a701e5", + "rev": "8f75d171b6017ed34043b1255ec4ffc374bf6ab0", "type": "github" }, "original": { @@ -583,6 +619,22 @@ "type": "github" } }, + "nix-flatpak": { + "locked": { + "lastModified": 1767983141, + "narHash": "sha256-7ZCulYUD9RmJIDULTRkGLSW1faMpDlPKcbWJLYHoXcs=", + "owner": "gmodena", + "repo": "nix-flatpak", + "rev": "440818969ac2cbd77bfe025e884d0aa528991374", + "type": "github" + }, + "original": { + "owner": "gmodena", + "ref": "latest", + "repo": "nix-flatpak", + "type": "github" + } + }, "nix-index-database": { "inputs": { "nixpkgs": [ @@ -590,11 +642,11 @@ ] }, "locked": { - "lastModified": 1771734689, - "narHash": "sha256-/phvMgr1yutyAMjKnZlxkVplzxHiz60i4rc+gKzpwhg=", + "lastModified": 1772341813, + "narHash": "sha256-/PQ0ubBCMj/MVCWEI/XMStn55a8dIKsvztj4ZVLvUrQ=", "owner": "nix-community", "repo": "nix-index-database", - "rev": "8f590b832326ab9699444f3a48240595954a4b10", + "rev": "a2051ff239ce2e8a0148fa7a152903d9a78e854f", "type": "github" }, "original": { @@ -636,11 +688,11 @@ }, "nixpkgs-stable": { "locked": { - "lastModified": 1772047000, - "narHash": "sha256-7DaQVv4R97cii/Qdfy4tmDZMB2xxtyIvNGSwXBBhSmo=", + "lastModified": 1772822230, + "narHash": "sha256-yf3iYLGbGVlIthlQIk5/4/EQDZNNEmuqKZkQssMljuw=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "1267bb4920d0fc06ea916734c11b0bf004bbe17e", + "rev": "71caefce12ba78d84fe618cf61644dce01cf3a96", "type": "github" }, "original": { @@ -681,11 +733,11 @@ }, "nixpkgs_4": { "locked": { - "lastModified": 1771848320, - "narHash": "sha256-0MAd+0mun3K/Ns8JATeHT1sX28faLII5hVLq0L3BdZU=", + "lastModified": 1772773019, + "narHash": "sha256-E1bxHxNKfDoQUuvriG71+f+s/NT0qWkImXsYZNFFfCs=", "owner": "nixos", "repo": "nixpkgs", - "rev": "2fc6539b481e1d2569f25f8799236694180c0993", + "rev": "aca4d95fce4914b3892661bcb80b8087293536c6", "type": "github" }, "original": { @@ -697,11 +749,11 @@ }, "nixpkgs_5": { "locked": { - "lastModified": 1741379970, - "narHash": "sha256-Wh7esNh7G24qYleLvgOSY/7HlDUzWaL/n4qzlBePpiw=", + "lastModified": 1761672384, + "narHash": "sha256-o9KF3DJL7g7iYMZq9SWgfS1BFlNbsm6xplRjVlOCkXI=", "owner": "nixos", "repo": "nixpkgs", - "rev": "36fd87baa9083f34f7f5027900b62ee6d09b1f2f", + "rev": "08dacfca559e1d7da38f3cf05f1f45ee9bfd213c", "type": "github" }, "original": { @@ -790,16 +842,15 @@ "rust-overlay": "rust-overlay_3" }, "locked": { - "lastModified": 1741508717, - "narHash": "sha256-iQf1WdNxaApOFHIx4RLMRZ4f8g+8Xp0Z1/E/Mz2rLxY=", + "lastModified": 1761832913, + "narHash": "sha256-VCNVjjuRvrKPiYYwqhE3BAKIaReiKXGpxGp27lZ0MFM=", "owner": "yaxitech", "repo": "ragenix", - "rev": "2a2bea99d74927e54adf53cbf113219def67d5c9", + "rev": "83bccfdea758241999f32869fb6b36f7ac72f1ac", "type": "github" }, "original": { "owner": "yaxitech", - "ref": "2025.03.09", "repo": "ragenix", "type": "github" } @@ -809,11 +860,14 @@ "dw-proton": "dw-proton", "home-manager": "home-manager", "intel-hw": "intel-hw", + "kernel-src": "kernel-src", "mypkgs": "mypkgs", "niri-flake": "niri-flake", + "nix-flatpak": "nix-flatpak", "nix-index-database": "nix-index-database", "nixpkgs": "nixpkgs_4", - "ragenix": "ragenix" + "ragenix": "ragenix", + "sccache": "sccache" } }, "rust-analyzer-src": { @@ -885,11 +939,11 @@ ] }, "locked": { - "lastModified": 1741400194, - "narHash": "sha256-tEpgT+q5KlGjHSm8MnINgTPErEl8YDzX3Eps8PVc09g=", + "lastModified": 1761791894, + "narHash": "sha256-myRIDh+PxaREz+z9LzbqBJF+SnTFJwkthKDX9zMyddY=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "16b6045a232fea0e9e4c69e55a6e269607dd8e3f", + "rev": "59c45eb69d9222a4362673141e00ff77842cd219", "type": "github" }, "original": { @@ -898,6 +952,27 @@ "type": "github" } }, + "sccache": { + "inputs": { + "flake-utils": "flake-utils_2", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1772751120, + "narHash": "sha256-4cBOTPXv6Pkqa6qL1SH3UZTShciQWpyKJy3c3cQEU8I=", + "owner": "mozilla", + "repo": "sccache", + "rev": "2b65ac80ed3a3ff63c41711d65ae10106a163a09", + "type": "github" + }, + "original": { + "owner": "mozilla", + "repo": "sccache", + "type": "github" + } + }, "systems": { "locked": { "lastModified": 1681028828, @@ -988,6 +1063,21 @@ "type": "github" } }, + "systems_7": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "templates": { "inputs": { "nixpkgs": "nixpkgs_3" @@ -1128,11 +1218,11 @@ "xwayland-satellite-unstable": { "flake": false, "locked": { - "lastModified": 1771787042, - "narHash": "sha256-7bM6Y4KldhKnfopSALF8XALxcX7ehkomXH9sPl4MXp0=", + "lastModified": 1772429643, + "narHash": "sha256-M+bAeCCcjBnVk6w/4dIVvXvpJwOKnXjwi/lDbaN6Yws=", "owner": "Supreeeme", "repo": "xwayland-satellite", - "rev": "33c344fee50504089a447a8fef5878cf4f6215fc", + "rev": "10f985b84cdbcc3bbf35b3e7e43d1b2a84fa9ce2", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 30309d9..85ce8b7 100644 --- a/flake.nix +++ b/flake.nix @@ -5,7 +5,7 @@ url = "git+https://git.sys-con.ru/thek0tyara/nixpkgs-extension.git"; inputs.nixpkgs.follows = "nixpkgs"; }; - ragenix.url = "github:yaxitech/ragenix/2025.03.09"; + ragenix.url = "github:yaxitech/ragenix"; home-manager = { url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; @@ -20,7 +20,16 @@ }; dw-proton.url = "github:imaviso/dwproton-flake"; intel-hw.url = "github:MordragT/nixos"; - # + nix-flatpak.url = "github:gmodena/nix-flatpak/latest"; + kernel-src = { + # url = "git+https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git?ref=master"; + url = "git+https://gitlab.freedesktop.org/drm/tip.git?shallow=1&ref=drm-tip"; + flake = false; + }; + sccache = { + url = "github:mozilla/sccache"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; outputs = inputs@{ @@ -31,24 +40,37 @@ nix-index-database, niri-flake, intel-hw, + nix-flatpak, + kernel-src, + sccache, ... }: let system = "x86_64-linux"; - # pkgs = nixpkgs.legacyPackages.${system}; + # pkgs = nixpkgs.${system}.packages; + pkgs = nixpkgs { + inherit system; + overlays = [ sccache.overlays.default ]; + }; in { nixosConfigurations.testenv = nixpkgs.lib.nixosSystem { inherit system; - specialArgs = { inherit inputs; }; + specialArgs = { + inherit inputs; + kernel-src = inputs.kernel-src; + }; modules = [ + # ./custom/modules ragenix.nixosModules.default niri-flake.nixosModules.niri nix-index-database.nixosModules.default + nix-flatpak.nixosModules.nix-flatpak ( { pkgs, pkgdefault, + config, ... }: { @@ -61,13 +83,6 @@ (import ./custom/override.nix) niri-flake.overlays.niri ]; - # boot.kernelPatches = [ - # { - # name = "name"; - # patch = null; - # extraConfig = ""; - # } - # ]; hardware = { graphics = { @@ -96,8 +111,36 @@ "root" "thek0tyara" ]; + extra-sandbox-paths = [ + "/var/cache/sccache" + ]; download-buffer-size = 160000000; }; + systemd.tmpfiles.rules = [ + # setgid, чтобы файлы/папки сохраняли группу nixbld + "d /var/cache/sccache 2770 root nixbld - -" + ]; + boot = { + loader = { + systemd-boot.enable = true; + efi.canTouchEfiVariables = false; + }; + # kernelPackages = pkgs.linuxPackages_testing; + extraModulePackages = with config.boot.kernelPackages; [ + v4l2loopback + # amneziawg + ]; + # kernelPatches = [ + # { + # name = "7.0-rc fixup"; + # extraConfig = '' + # ''; + # } + # ]; + }; + # nixpkgs.config.permittedInsecurePackages = [ + # "olm-3.2.16" + # ]; age = { secrets = { # "wg/syscon0.key".file = ./secrets/wg/syscon0.key.age; @@ -116,7 +159,8 @@ LLAMA_CACHE = "/home/thek0tyara/Downloads/llm"; - CCACHE_DIR = "/mnt/HDD_A_DATA/ccache"; + # CCACHE_DIR = "/mnt/HDD_A_DATA/ccache"; + # SCCACHE_DIR = "/home/thek0tyara/Documents/cache/sccache"; # LLVM = "1"; # UV_CACHE_DIR = ""; @@ -125,7 +169,7 @@ }; systemPackages = with pkgs; [ ### compiler - ccache + # ccache sccache (pkgdefault inputs.ragenix) devenv @@ -168,6 +212,10 @@ command = "/run/current-system/sw/bin/nix"; options = [ "NOPASSWD" ]; } + { + command = "/run/current-system/sw/bin/nixos-rebuild"; + options = [ "NOPASSWD" ]; + } ]; groups = [ "wheel" ]; } @@ -175,10 +223,16 @@ }; }; programs = { - ccache.enable = true; + # ccache = { + # enable = true; + # cacheDir = "/home/thek0tyara/Documents/cache/ccache/"; + # packageNames = [ + # # "linux" + # ]; + # }; niri = { enable = true; - package = pkgs.niri-stable; + package = pkgs.niri; }; nix-ld = { enable = true; @@ -207,6 +261,7 @@ enable = true; defaultSession = "niri"; }; + flatpak.enable = true; locate.enable = true; pipewire = { enable = true; diff --git a/home.nix b/home.nix index 6a516e8..f3b1eca 100644 --- a/home.nix +++ b/home.nix @@ -8,6 +8,7 @@ { imports = [ ./custom/hm + inputs.nix-flatpak.homeManagerModules.nix-flatpak ]; gtk = { @@ -52,13 +53,25 @@ arch-install-scripts kdocker # tray the untrayable xwayland-satellite - xdg-desktop-portal-gtk - xdg-desktop-portal-wlr winboat xfce4-taskmanager + xdg-desktop-portal-cosmic + file + + ### file management + cosmic-files + lxqt.lxqt-archiver + unrar + unzip + p7zip ### development # idea-community-bin + sccache + + ### visuals + gnome-themes-extra + papirus-icon-theme ### vlc @@ -67,20 +80,22 @@ tor-browser iperf sshuttle - - lmstudio - + nautilus ### social # fluffychat ### gaming winetricks - wine + wineWow64Packages.full heroic vintagestory prismlauncher + ### neural networks + dsearch + lmstudio + # kdePackages.kdenlive (python313.withPackages ( py: with py; [ @@ -149,7 +164,25 @@ "image/png" = "swayimg.desktop"; "image/webp" = "swayimg.desktop"; - "application/zip" = "xarchiver.desktop"; + "application/zip" = "lxqt-archiver.desktop"; + }; + }; + portal = { + enable = true; + extraPortals = with pkgs; [ + xdg-desktop-portal-gtk + xdg-desktop-portal-wlr + xdg-desktop-portal-gnome + xdg-desktop-portal-cosmic + ]; + config = { + common = { + default = [ + "gtk" + ]; + "org.freedesktop.impl.portal.FileChooser" = "gnome"; + "org.freedesktop.impl.portal.ScreenCast" = "gnome"; + }; }; }; configFile."obsidian/.keep".text = ""; @@ -187,6 +220,11 @@ }; }; services = { + flatpak = { + packages = [ + "org.vinegarhq.Sober" + ]; + }; mako.enable = true; ollama = { # enable = true; @@ -199,6 +237,7 @@ OLLAMA_KV_CACHE_TYPE = "q8_0"; # OLLAMA_CONTEXT_LENGTH = "16000"; OLLAMA_MODELS = "/home/thek0tyara/Downloads/llm/ollama"; + XDG_DATA_DIRS = "empty"; }; }; podman = { @@ -397,6 +436,14 @@ ### default aria2.enable = true; btop.enable = true; + codex = { + enable = true; + settings = { + model = "gpt-5.4"; + approval_policy = "on-request"; + model_reasoning_effort = "medium"; + }; + }; # command-not-found.enable = true; direnv = { enable = true; @@ -428,7 +475,7 @@ sudo nix-store --optimise ''; xdg-fix = '' - systemctl --user restart xdg-desktop-portal xdg-desktop-portal-gtk xdg-desktop-portal-wlr xdg-desktop-portal-gnome + systemctl --user restart 'xdg-desktop-portal*' ''; }; }; @@ -550,7 +597,11 @@ "--always-new-process" ]; "Mod+R".action.spawn = "fuzzel"; - "Mod+Shift+L".action.spawn = "swaylock --color 030303"; + "Mod+Shift+L".action.spawn = [ + "swaylock" + "--color" + "030303" + ]; "Scroll_Lock" = { # toggle microphone @@ -804,7 +855,7 @@ # ''; }; zed-editor = { - enable = true; + # enable = true; themes = { "name" = "Ayu Dark"; };