This commit is contained in:
TheK0tYaRa 2026-03-05 17:58:47 +02:00
parent 44561593a0
commit dbde18d4a2
7 changed files with 210 additions and 96 deletions

View file

@ -30,7 +30,7 @@ in
pkgs.callPackage (
{ buildLinux, ... }@args:
let
llvm = pkgs.llvmPackages_latest;
# llvm = pkgs.llvmPackages_latest;
structuredExtraConfig' =
(with lib.kernel; {
@ -45,21 +45,24 @@ pkgs.callPackage (
// {
inherit kernelPatches extraConfig;
stdenv = llvm.stdenv;
stdenv = pkgs.llvmPackages_latest.stdenv;
version = kver;
modDirVersion = kver;
src = kernel-src;
nativeBuildInputs = (args.nativeBuildInputs or [ ]) ++ [
llvm.clang
llvm.lld
llvm.llvm
];
# nativeBuildInputs = (args.nativeBuildInputs or [ ]) ++ [
# llvm.clang
# llvm.lld
# llvm.llvm
# ];
makeFlags = (args.makeFlags or [ ]) ++ [
"LLVM=1"
"LLVM_IAS=1"
"CC=${pkgs.ccache}/bin/ccache clang"
"HOSTCC=${pkgs.ccache}/bin/ccache clang"
];
structuredExtraConfig = structuredExtraConfig';

View file

@ -3,9 +3,8 @@
let
cfg = config.programs.ccache;
in
{
if false then {
config = lib.mkIf cfg.enable {
# ccache должен быть виден из sandbox
nix.settings.extra-sandbox-paths = [ cfg.cacheDir ];
nixpkgs.overlays = [
@ -35,19 +34,31 @@ in
#!${prev.bash}/bin/bash
set -euo pipefail
# Kernel probes compiler via: $CC -E -P -x c -
# Bypass ccache + filesystem touching for preprocess-only probes.
for arg in "$@"; do
if [ "$arg" = "-E" ]; then
exec __REAL__ "$@"
fi
done
# base cache dir from NixOS module
base='${cfg.cacheDir}'
# prefer pname (no version), fallback to name, and strip "-<digit>..." if present
pkg="${pname:-${name:-unknown}}"
pkg="${pkg%%-[0-9]*}"
pkg="''${pname-}"
if [ -z "$pkg" ]; then pkg="''${name-unknown}"; fi
pkg="''${pkg%%-[0-9]*}"
mkdir -p "$base/$pkg"
# If cache dir isn't writable/mounted in sandbox yet, don't break compiler detection.
if ! mkdir -p "$base/$pkg" 2>/dev/null; then
exec __REAL__ "$@"
fi
export CCACHE_DIR="$base/$pkg"
export CCACHE_UMASK=007
# improves hit rate for repeated local rebuilds
export CCACHE_BASEDIR="${NIX_BUILD_TOP:-/build}"
export CCACHE_BASEDIR="''${NIX_BUILD_TOP:-/build}"
export CCACHE_COMPRESS=1
export CCACHE_SLOPPINESS=random_seed,time_macros
@ -88,4 +99,4 @@ in
})
];
};
}
} else {}

View file

@ -1,28 +1,36 @@
final: prev: {
ccacheWrapper = prev.ccacheWrapper.override {
extraConfig = ''
export CCACHE_COMPRESS=1
export CCACHE_SLOPPINESS=random_seed,time_macros
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
'';
};
# 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"
# '';
# });
llama-cpp = prev.llama-cpp.overrideAttrs (old: rec {
version = "8124";
src = prev.fetchFromGitHub {

View file

@ -17,7 +17,7 @@
nix flake check
'';
build.exec = ''
nixos-rebuild switch --sudo --flake '.#' $@
sudo nixos-rebuild switch --flake '.#' $@
'';
};

130
flake.lock generated
View file

@ -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": 1772569491,
"narHash": "sha256-bdr6ueeXO1Xg91sFkuvaysYF0mVdwHBpdyhTjBEWv+s=",
"lastModified": 1772633327,
"narHash": "sha256-jl+DJB2DUx7EbWLRng+6HNWW/1/VQOnf0NsQB4PlA7I=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "924e61f5c2aeab38504028078d7091077744ab17",
"rev": "5a75730e6f21ee624cbf86f4915c6e7489c74acc",
"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": {
@ -484,10 +502,10 @@
"kernel-src": {
"flake": false,
"locked": {
"lastModified": 1772558248,
"narHash": "sha256-xv9+ldZjWEMJZVPTi5w7O4SDOI0lz5NcWvjgQGE1HCg=",
"lastModified": 1772720557,
"narHash": "sha256-lfOprDbqvgOqHzLuhsiuXdHk20qQJ9b8t97zOkTBxu4=",
"ref": "drm-tip",
"rev": "cfc20c776480fda8c1b0517b187bb71ec0781cd4",
"rev": "9565ad1c312903452467b9f685c59e2f47f512e5",
"shallow": true,
"type": "git",
"url": "https://gitlab.freedesktop.org/drm/tip.git"
@ -555,11 +573,11 @@
"xwayland-satellite-unstable": "xwayland-satellite-unstable"
},
"locked": {
"lastModified": 1772572827,
"narHash": "sha256-d91kXM4t1G0KQ/MB0LTP514IslsDu6ZBt4HQE7hVvzs=",
"lastModified": 1772698812,
"narHash": "sha256-7+K/VaZ7TXUeUGSYshg8wC3UsRZHB+M4x6r38Q1B79c=",
"owner": "sodiboo",
"repo": "niri-flake",
"rev": "7592181859ad2ab12913bbede47b45481b2b2938",
"rev": "5641625ef950f024e3e0e3f38bb91f876290c0be",
"type": "github"
},
"original": {
@ -670,11 +688,11 @@
},
"nixpkgs-stable": {
"locked": {
"lastModified": 1772465433,
"narHash": "sha256-ywy9troNEfpgh0Ee+zaV1UTgU8kYBVKtvPSxh6clYGU=",
"lastModified": 1772598333,
"narHash": "sha256-YaHht/C35INEX3DeJQNWjNaTcPjYmBwwjFJ2jdtr+5U=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "c581273b8d5bdf1c6ce7e0a54da9841e6a763913",
"rev": "fabb8c9deee281e50b1065002c9828f2cf7b2239",
"type": "github"
},
"original": {
@ -715,11 +733,11 @@
},
"nixpkgs_4": {
"locked": {
"lastModified": 1772542754,
"narHash": "sha256-WGV2hy+VIeQsYXpsLjdr4GvHv5eECMISX1zKLTedhdg=",
"lastModified": 1772624091,
"narHash": "sha256-QKyJ0QGWBn6r0invrMAK8dmJoBYWoOWy7lN+UHzW1jc=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "8c809a146a140c5c8806f13399592dbcb1bb5dc4",
"rev": "80bdc1e5ce51f56b19791b52b2901187931f5353",
"type": "github"
},
"original": {
@ -731,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": {
@ -824,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"
}
@ -849,7 +866,8 @@
"nix-flatpak": "nix-flatpak",
"nix-index-database": "nix-index-database",
"nixpkgs": "nixpkgs_4",
"ragenix": "ragenix"
"ragenix": "ragenix",
"sccache": "sccache"
}
},
"rust-analyzer-src": {
@ -921,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": {
@ -934,6 +952,27 @@
"type": "github"
}
},
"sccache": {
"inputs": {
"flake-utils": "flake-utils_2",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1772653484,
"narHash": "sha256-kHwbXkMrlKxo261U0oamF4YXGuUBbwexa8BWYErgKv0=",
"owner": "mozilla",
"repo": "sccache",
"rev": "30ed851a2b56ff3d754117895c76dbd8d10bbf13",
"type": "github"
},
"original": {
"owner": "mozilla",
"repo": "sccache",
"type": "github"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
@ -1024,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"

View file

@ -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";
@ -26,6 +26,10 @@
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@{
@ -38,11 +42,26 @@
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 ];
};
#
# sccacheWrapper = pkgs.writeShellScriptBin "clang-sccache" ''
# export SCCACHE_DIR=/var/cache/sccache
# exec ${pkgs.sccache}/bin/sccache ${pkgs.llvmPackages_latest.clang}/bin/clang "$@"
# '';
# stdenvSccache = pkgs.overrideCC pkgs.llvmPackages_latest.stdenv (
# pkgs.llvmPackages_latest.clang.override {
# cc = sccacheWrapper;
# }
# );
in
{
nixosConfigurations.testenv = nixpkgs.lib.nixosSystem {
@ -52,8 +71,8 @@
kernel-src = inputs.kernel-src;
};
modules = [
./custom/modules
./custom/modules/llvm-ccache-stdenv.nix
# ./custom/modules
# ./custom/modules/llvm-ccache-stdenv.nix
ragenix.nixosModules.default
niri-flake.nixosModules.niri
nix-index-database.nixosModules.default
@ -145,7 +164,7 @@
LLAMA_CACHE = "/home/thek0tyara/Downloads/llm";
CCACHE_DIR = "/mnt/HDD_A_DATA/ccache";
# CCACHE_DIR = "/mnt/HDD_A_DATA/ccache";
# LLVM = "1";
# UV_CACHE_DIR = "";
@ -154,7 +173,7 @@
};
systemPackages = with pkgs; [
### compiler
ccache
# ccache
sccache
(pkgdefault inputs.ragenix)
devenv
@ -197,6 +216,10 @@
command = "/run/current-system/sw/bin/nix";
options = [ "NOPASSWD" ];
}
{
command = "/run/current-system/sw/bin/nixos-rebuild";
options = [ "NOPASSWD" ];
}
];
groups = [ "wheel" ];
}
@ -204,16 +227,16 @@
};
};
programs = {
ccache = {
enable = true;
ccacheDir = "/home/thek0tyara/Documents/cache/ccache/";
packageNames = [
# "linux"
];
};
# 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;

View file

@ -55,6 +55,7 @@
xwayland-satellite
winboat
xfce4-taskmanager
xdg-desktop-portal-cosmic
### file management
cosmic-files
@ -66,6 +67,10 @@
### development
# idea-community-bin
### visuals
gnome-themes-extra
papirus-icon-theme
###
vlc
jq
@ -73,8 +78,7 @@
tor-browser
iperf
sshuttle
lmstudio
nautilus
### social
# fluffychat
@ -86,6 +90,10 @@
vintagestory
prismlauncher
### neural networks
dsearch
lmstudio
# kdePackages.kdenlive
(python313.withPackages (
py: with py; [
@ -162,10 +170,17 @@
extraPortals = with pkgs; [
xdg-desktop-portal-gtk
xdg-desktop-portal-wlr
xdg-desktop-portal-gnome
# xdg-desktop-portal-gnome
xdg-desktop-portal-cosmic
];
config = {
common.default = "*";
common = {
default = [
"gtk"
];
"org.freedesktop.impl.portal.FileChooser" = "gnome";
# "org.freedesktop.impl.portal.ScreenCast" = "gnome";
};
};
};
configFile."obsidian/.keep".text = "";
@ -450,7 +465,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*'
'';
};
};