Merge branch 'production' into archive

This commit is contained in:
2025-12-12 09:05:57 +08:00
20 changed files with 292 additions and 105 deletions

View File

@@ -183,7 +183,13 @@ in
{
addresses = inputs.lib.optionals (v.address != null) [{ inherit (v) address; }];
settings = { Ed25519PublicKey = publicKey.${v.jump}; IndirectData = true; };
subnets = [{ address = getAddress "tinc0.${n}"; weight = v.length; }];
subnets =
[{
address = getAddress "tinc0.${n}";
# 最短路径已经被提前计算出来了,这里将权重统一设置为零
# 如果分开设置,两个节点会因为对权重的描述不统一而拒绝连接
weight = 0;
}];
};})
(inputs.lib.filterAttrs (_: v: v != null) connection.${hostname})))
];

View File

@@ -40,7 +40,6 @@ inputs:
dnsmasq = { extraInterfaces = [ "enp3s0" ]; hosts."git.chn.moe" = "127.0.0.1"; };
};
beesd."/".hashTableSizeMB = 10 * 128;
nix-serve.hostname = "nix-store.nas.chn.moe";
postgresql.mountFrom = "ssd";
mariadb.mountFrom = "ssd";
rsshub = {};

View File

@@ -14,25 +14,17 @@ inputs:
vfat."/dev/disk/by-partlabel/pc-boot" = "/boot";
btrfs =
{
"/dev/mapper/root1" =
{
"/nix/nodatacow" = "/nix/nodatacow";
"/nix/persistent" = "/nix/persistent";
"/nix/rootfs" = "/nix/rootfs";
"/nix/swap" = "/nix/swap";
"/nix/rootfs/current" = "/";
};
"/dev/mapper/tf1"."/nix" = "/nix";
"/dev/mapper/root1" = { "/nix" = "/nix"; "/nix/rootfs/current" = "/"; };
"/dev/mapper/tf1"."/" = "/nix/tf";
};
};
luks.auto =
{
"/dev/disk/by-partlabel/pc-root1" = { mapper = "root1"; ssd = true; };
"/dev/disk/by-partlabel/pc-tf1" = { mapper = "tf1"; ssd = true; };
"/dev/disk/by-partlabel/pc-tf2" = { mapper = "tf2"; ssd = true; };
"/dev/disk/by-partlabel/pc-tf1".mapper = "tf1";
};
swap = [ "/nix/swap/swap" ];
resume = { device = "/dev/mapper/root1"; offset = 131605760; };
resume = { device = "/dev/mapper/root1"; offset = 228199020; };
};
grub.windowsEntries."08D3-10DE" = "Windows";
nix.marches =
@@ -77,8 +69,12 @@ inputs:
);
extraInterfaces = [ "wlo1" ];
};
nix-serve = {};
beesd = { "/".hashTableSizeMB = 2 * 128; "/nix".hashTableSizeMB = 128; };
harmonia.store = "/nix/tf";
beesd =
{
"/" = { hashTableSizeMB = 2 * 128; loadAverage = 4; };
"/nix/tf" = { hashTableSizeMB = 128; loadAverage = 4; };
};
slurm =
{
enable = true;
@@ -100,6 +96,7 @@ inputs:
mariadb.mountFrom = "nodatacow";
open-webui.ollamaHost = "127.0.0.1";
howdy = {};
waydroid = {};
};
bugs = [ "amdpstate" ];
packages = { mathematica = {}; vasp = {}; };
@@ -111,7 +108,7 @@ inputs:
services.udev.extraRules =
''
# CPU
SUBSYSTEM=="power_supply", KERNEL=="BAT0", ACTION=="*", RUN+="${inputs.pkgs.ryzenadj}/bin/ryzenadj --set-coall=0x0fff10"
SUBSYSTEM=="power_supply", KERNEL=="BAT0", ACTION=="*", RUN+="${inputs.pkgs.ryzenadj}/bin/ryzenadj --set-coall=0x0fff20"
'';
# 解决有时蓝牙不能使用的问题
boot.kernelParams = [ "mt7925e.disable_aspm=1" ];

View File

@@ -87,7 +87,7 @@ inputs:
};
xray.client.xray.serverName = "xserver2.vps9.chn.moe";
};
packages = { vasp = {}; desktop = {}; lumerical = {}; };
packages = { vasp = {}; lumerical = {}; };
user.users =
[
# 组内

132
flake.lock generated
View File

@@ -175,6 +175,21 @@
"type": "github"
}
},
"crane": {
"locked": {
"lastModified": 1763938834,
"narHash": "sha256-j8iB0Yr4zAvQLueCZ5abxfk6fnG/SJ5JnGUziETjwfg=",
"owner": "ipetkov",
"repo": "crane",
"rev": "d9e753122e51cee64eb8d2dddfe11148f339f5a2",
"type": "github"
},
"original": {
"owner": "ipetkov",
"repo": "crane",
"type": "github"
}
},
"dankmaterialshell": {
"inputs": {
"dgop": "dgop",
@@ -356,7 +371,7 @@
"flake-parts": {
"inputs": {
"nixpkgs-lib": [
"nur-linyinfeng",
"harmonia",
"nixpkgs"
]
},
@@ -375,6 +390,27 @@
}
},
"flake-parts_2": {
"inputs": {
"nixpkgs-lib": [
"nur-linyinfeng",
"nixpkgs"
]
},
"locked": {
"lastModified": 1763759067,
"narHash": "sha256-LlLt2Jo/gMNYAwOgdRQBrsRoOz7BPRkzvNaI/fzXi2Q=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "2cccadc7357c0ba201788ae99c4dfa90728ef5e0",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "flake-parts",
"type": "github"
}
},
"flake-parts_3": {
"inputs": {
"nixpkgs-lib": "nixpkgs-lib"
},
@@ -464,6 +500,28 @@
"type": "github"
}
},
"harmonia": {
"inputs": {
"crane": "crane",
"flake-parts": "flake-parts",
"nix": "nix",
"nixpkgs": "nixpkgs_2",
"treefmt-nix": "treefmt-nix"
},
"locked": {
"lastModified": 1765044966,
"narHash": "sha256-stn5uyhgEpNxvIr3nTkqbIf4CedMf0+IjkOAO2MNhIg=",
"owner": "nix-community",
"repo": "harmonia",
"rev": "27bef83e88aea6fab6d70f073977133804540334",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "harmonia",
"type": "github"
}
},
"hextra": {
"flake": false,
"locked": {
@@ -726,6 +784,22 @@
"type": "github"
}
},
"nix": {
"flake": false,
"locked": {
"lastModified": 1764972171,
"narHash": "sha256-rZf5zbxu0eCz3Lb4IrelWNuegoQHUjCguuJzcyPFvt0=",
"owner": "nixos",
"repo": "nix",
"rev": "0db70b8184c1037a606d9cbd6c277c78f7adf647",
"type": "github"
},
"original": {
"owner": "nixos",
"repo": "nix",
"type": "github"
}
},
"nix-flatpak": {
"locked": {
"lastModified": 1754777568,
@@ -973,11 +1047,27 @@
},
"nixpkgs_2": {
"locked": {
"lastModified": 1764896285,
"narHash": "sha256-FN8wHTKO859sBo9nEWeydMo9UT+wAGKAggqHVm5G7Zo=",
"lastModified": 1764426117,
"narHash": "sha256-rTslB7dCKLKCCDg4/6OJ+ZFmU7ctNAKeyYZ4VBnU/TQ=",
"owner": "Mic92",
"repo": "nixpkgs",
"rev": "65037cffdb986acb08035988674765b6cf0f34e7",
"type": "github"
},
"original": {
"owner": "Mic92",
"ref": "harmonia-coverage",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_3": {
"locked": {
"lastModified": 1765182534,
"narHash": "sha256-Q8E/X54vKA239UlIfbJKbDvVIVRqgywuOzzm+PyEU3E=",
"owner": "CHN-beta",
"repo": "nixpkgs",
"rev": "8b8f5bb428ae1cc036edae1fe75b874f747ed2ba",
"rev": "fd8739ccac94000960aad56f5ac1a55fca7b251e",
"type": "github"
},
"original": {
@@ -1027,14 +1117,14 @@
"inputs": {
"devshell": "devshell",
"flake-compat": "flake-compat_2",
"flake-parts": "flake-parts",
"flake-parts": "flake-parts_2",
"flake-utils": "flake-utils",
"nixos-stable": "nixos-stable",
"nixpkgs": [
"nixpkgs"
],
"nvfetcher": "nvfetcher",
"treefmt-nix": "treefmt-nix"
"treefmt-nix": "treefmt-nix_2"
},
"locked": {
"lastModified": 1764853090,
@@ -1053,13 +1143,13 @@
"nur-xddxdd": {
"inputs": {
"devshell": "devshell_2",
"flake-parts": "flake-parts_2",
"flake-parts": "flake-parts_3",
"nix-index-database": "nix-index-database_2",
"nixpkgs": [
"nixpkgs"
],
"pre-commit-hooks-nix": "pre-commit-hooks-nix",
"treefmt-nix": "treefmt-nix_2"
"treefmt-nix": "treefmt-nix_3"
},
"locked": {
"lastModified": 1764843512,
@@ -1226,6 +1316,7 @@
"dankmaterialshell": "dankmaterialshell",
"date": "date",
"fancy-motd": "fancy-motd",
"harmonia": "harmonia",
"hextra": "hextra",
"home-manager": "home-manager",
"impermanence": "impermanence",
@@ -1242,7 +1333,7 @@
"nix-index-database": "nix-index-database",
"nix4vscode": "nix4vscode",
"nixos-wallpaper": "nixos-wallpaper",
"nixpkgs": "nixpkgs_2",
"nixpkgs": "nixpkgs_3",
"nixpkgs-2305": "nixpkgs-2305",
"nixpkgs-2311": "nixpkgs-2311",
"nixpkgs-2411": "nixpkgs-2411",
@@ -1491,6 +1582,27 @@
}
},
"treefmt-nix": {
"inputs": {
"nixpkgs": [
"harmonia",
"nixpkgs"
]
},
"locked": {
"lastModified": 1761311587,
"narHash": "sha256-Msq86cR5SjozQGCnC6H8C+0cD4rnx91BPltZ9KK613Y=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "2eddae033e4e74bf581c2d1dfa101f9033dbd2dc",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "treefmt-nix",
"type": "github"
}
},
"treefmt-nix_2": {
"inputs": {
"nixpkgs": [
"nur-linyinfeng",
@@ -1511,7 +1623,7 @@
"type": "github"
}
},
"treefmt-nix_2": {
"treefmt-nix_3": {
"inputs": {
"nixpkgs": [
"nur-xddxdd",

View File

@@ -29,6 +29,7 @@
niri = { url = "github:sodiboo/niri-flake"; inputs.nixpkgs.follows = "nixpkgs"; };
nix4vscode = { url = "github:nix-community/nix4vscode"; inputs.nixpkgs.follows = "nixpkgs"; };
dankmaterialshell = { url = "github:AvengeMedia/DankMaterialShell"; inputs.nixpkgs.follows = "nixpkgs"; };
harmonia.url = "github:nix-community/harmonia";
misskey = { url = "git+https://github.com/CHN-beta/misskey?submodules=1"; flake = false; };
rsshub = { url = "github:DIYgod/RSSHub"; flake = false; };

View File

@@ -18,7 +18,7 @@ let
srv1-node0 = [ "srv1" ];
srv2-node0 = [ "srv2" ];
"pc.ts" = [ "nix-store" "chat" ];
"nas.ts" = [ "nix-store.nas" "ssh.git" ];
"nas.ts" = [ "ssh.git" ];
autoroute = [ "" "matrix" ];
vps9 =
[

View File

@@ -73,6 +73,10 @@ in platformConfig //
google-chrome = prev.google-chrome.override (prev:
{ commandLineArgs = prev.commandLineArgs or "" + " --disable-features=GlobalShortcutsPortal"; });
xray = prev.xray.overrideAttrs (prev: { patches = prev.patches or [] ++ [ ./xray.patch ]; });
linux-firmware = prev.linux-firmware.overrideAttrs (prev: { patchPhase = prev.patchPhase or "" +
''
cp ${./gc_11_5_1_mes_2.bin} amdgpu/gc_11_5_1_mes_2.bin
''; });
}
// (
let

Binary file not shown.

View File

@@ -14,6 +14,7 @@ inputs: let inherit (inputs) topInputs; in
topInputs.nixvirt.nixosModules.default
topInputs.niri.nixosModules.niri
{ config.niri-flake.cache.enable = false; }
topInputs.harmonia.nixosModules.harmonia
{ config.home-manager.sharedModules =
[
topInputs.catppuccin.homeModules.catppuccin

View File

@@ -37,7 +37,7 @@ inputs:
# TODO: import from nixos-hardware instead
# enableHybridCodec is only needed for some old intel gpus (Atom, Nxxx, etc)
intel = [ intel-vaapi-driver libvdpau-va-gl intel-media-driver ];
nvidia = [ vaapiVdpau ];
nvidia = [ libva-vdpau-driver ];
amd = [];
};
in packages.${gpu.type};

View File

@@ -0,0 +1,41 @@
inputs:
{
options.nixos.services.harmonia = let inherit (inputs.lib) mkOption types; in mkOption
{
type = types.nullOr (types.submodule { options =
{
hostname = mkOption { type = types.nonEmptyStr; default = "nix-store.chn.moe"; };
store = mkOption { type = types.nullOr types.nonEmptyStr; default = null; };
};});
default = null;
};
config = let inherit (inputs.config.nixos.services) harmonia; in inputs.lib.mkIf (harmonia != null)
{
services.harmonia-dev =
{
package = inputs.options.services.harmonia-dev.package.default.overrideAttrs
(prev: { patches = prev.patches or [] ++ [ ./harmonia.patch ]; });
cache =
{
enable = true;
signKeyPaths = [ inputs.config.nixos.system.sops.secrets."store/signingKey".path ];
settings = inputs.lib.mkIf (harmonia.store != null)
{
virtual_nix_store = "/nix/store";
real_nix_store = "${harmonia.store}/nix/store";
daemon_store = "/nix/store";
};
};
daemon =
{
enable = true;
dbPath = inputs.lib.mkIf (harmonia.store != null) "${harmonia.store}/nix/var/nix/db/db.sqlite";
};
};
nixos =
{
system.sops.secrets."store/signingKey" = {};
services.nginx.https.${harmonia.hostname}.location."/".proxy.upstream = "http://127.0.0.1:5000";
};
};
}

View File

@@ -0,0 +1,45 @@
From 310e2b2c6583710c52531785f1245d9621284310 Mon Sep 17 00:00:00 2001
From: Jack O'Sullivan <jackos1998@gmail.com>
Date: Sat, 6 Dec 2025 14:50:23 +0000
Subject: [PATCH] Expose `daemon_store` in cache as config option
---
harmonia-cache/src/config.rs | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/harmonia-cache/src/config.rs b/harmonia-cache/src/config.rs
index a683d78a..5dd9f801 100644
--- a/harmonia-cache/src/config.rs
+++ b/harmonia-cache/src/config.rs
@@ -68,6 +68,8 @@ pub(crate) struct Config {
#[serde(default = "default_daemon_socket")]
pub(crate) daemon_socket: PathBuf,
+ #[serde(default)]
+ pub(crate) daemon_store: Option<PathBuf>,
#[serde(skip, default)]
pub(crate) secret_keys: Vec<SecretKey>,
@@ -152,13 +154,19 @@ pub(crate) fn load(pool_metrics: Option<Arc<PoolMetrics>>) -> Result<Config> {
.as_encoded_bytes()
.to_vec()
});
- // For daemon communication, use real_nix_store if set (chroot mode),
+ // For daemon communication, use daemon_store, then real_nix_store if set (chroot mode),
// otherwise use the virtual store path
let daemon_store_dir = settings
- .real_nix_store
+ .daemon_store
.as_ref()
.map(|p| p.as_os_str().as_encoded_bytes().to_vec())
- .unwrap_or_else(|| virtual_store_dir.clone());
+ .unwrap_or_else(|| {
+ settings
+ .real_nix_store
+ .as_ref()
+ .map(|p| p.as_os_str().as_encoded_bytes().to_vec())
+ .unwrap_or_else(|| virtual_store_dir.clone())
+ });
settings.store = Store::new(
virtual_store_dir,
daemon_store_dir,

View File

@@ -1,29 +0,0 @@
inputs:
{
options.nixos.services.nix-serve = let inherit (inputs.lib) mkOption types; in mkOption
{
type = types.nullOr (types.submodule { options =
{
hostname = mkOption { type = types.nonEmptyStr; default = "nix-store.chn.moe"; };
};});
default = null;
};
config = let inherit (inputs.config.nixos.services) nix-serve; in inputs.lib.mkIf (nix-serve != null)
{
services.nix-serve =
{
enable = true;
package = inputs.pkgs.nix-serve-ng;
openFirewall = true;
secretKeyFile = inputs.config.nixos.system.sops.secrets."store/signingKey".path;
# curl -L cache.nixos.org/nix-cache-info
# use this cache after official one
extraParams = "--priority 50";
};
nixos =
{
system.sops.secrets."store/signingKey" = {};
services.nginx.https.${nix-serve.hostname}.location."/".proxy.upstream = "http://127.0.0.1:5000";
};
};
}

View File

@@ -54,18 +54,8 @@ inputs:
{
slurm =
{
package = (inputs.pkgs.slurm.override { enableX11 = false; enableNVML = false; }).overrideAttrs
(prev:
let
inherit (inputs.config.nixos.system.nixpkgs) cuda;
inherit (inputs.pkgs.cudaPackages) cuda_nvml_dev;
additionalInputs = inputs.lib.optionals (cuda != null) [ cuda_nvml_dev cuda_nvml_dev.lib ];
additionalFlags = inputs.lib.optional (cuda != null) "-L${cuda_nvml_dev.lib}/lib/stubs";
in
package = inputs.pkgs.slurm.overrideAttrs (prev:
{
buildInputs = prev.buildInputs or [] ++ additionalInputs;
LDFLAGS = prev.LDFLAGS or [] ++ additionalFlags;
nativeBuildInputs = prev.nativeBuildInputs ++ [ inputs.pkgs.wrapGAppsHook3 ];
postInstall =
''
pushd contribs/pmi2
@@ -75,8 +65,7 @@ inputs:
make install
popd
'' + prev.postInstall;
}
);
});
client.enable = true;
nodeName = builtins.map
(node:

View File

@@ -58,7 +58,16 @@ inputs:
{
stateVersion = "25.05";
configurationRevision = inputs.topInputs.self.rev or "dirty";
nixos = { versionSuffix = inputs.lib.mkForce ""; tags = [ inputs.topInputs.self.config.branch ]; };
nixos =
{
versionSuffix = inputs.lib.mkForce "";
tags = let inherit (inputs.topInputs) self; in
[
self.config.branch
(builtins.substring 2 6 self.lastModifiedDate)
(builtins.substring 0 6 self.rev or "dirty")
];
};
};
chaotic.nyx.cache.enable = false;
};

View File

@@ -74,6 +74,11 @@ inputs:
niri.settings =
{
binds =
let
xsel = "${inputs.pkgs.xsel}/bin/xsel";
wl-copy = "${inputs.pkgs.wl-clipboard}/bin/wl-copy";
wl-paste = "${inputs.pkgs.wl-clipboard}/bin/wl-paste";
in
{
"Mod+WheelScrollDown" = { action.focus-column-right = {}; cooldown-ms = 50; };
"Mod+WheelScrollUp" = { action.focus-column-left = {}; cooldown-ms = 50; };
@@ -82,13 +87,21 @@ inputs:
"Mod+MouseMiddle".action.close-window = {};
"Mod+L".action.spawn = [ "dms" "ipc" "lock" "lock" ];
"Mod+W".action.move-workspace-to-monitor-next = {};
"Mod+Ctrl+C".action.spawn = [ "sh" "-c" "${xsel} -ob | ${wl-copy}" ];
"Mod+Ctrl+V".action.spawn = [ "sh" "-c" "${wl-paste} -n | ${xsel} -ib" ];
};
outputs =
{
"Tianma Microelectronics Ltd. TL134ADXP03 Unknown" = { scale = 1; position = { x = 0; y = 0; }; };
"Xiaomi Corporation Mi Monitor 0x00000001" = { scale = 1; position = { x = 0; y = -2160; }; };
"Tianma Microelectronics Ltd. TL134ADXP03 Unknown" =
{ scale = 1; position = { x = 0; y = 0; }; mode = { width = 2560; height = 1600; refresh = 180.; }; };
"Xiaomi Corporation Mi Monitor 0x00000001" =
{
scale = 1;
position = { x = 0; y = -2160; };
mode = { width = 3840; height = 2160; refresh = 160.; };
};
input.touchpad.dwt = true;
};
input = { touchpad.dwt = true; keyboard.numlock = true; };
};
};
};

View File

@@ -40,7 +40,7 @@ inputs:
keep-outputs = false;
connect-timeout = 5;
# https://cache.nixos.org 已经自带
substituters = [ "https://nix-store.chn.moe" "https://nix-store.nas.chn.moe" ];
substituters = [ "https://nix-store.chn.moe" ];
build-dir = "/var/cache/nix";
};
}

View File

@@ -6,16 +6,15 @@ buildGoModule
inherit src;
vendorHash = null;
buildInputs = with cudaPackages; [ libcufft libcurand cuda_cudart cuda_nvcc ];
nativeBuildInputs = [ cudaPackages.cuda_nvcc makeWrapper ];
nativeBuildInputs = [ cudaPackages.cuda_nvcc makeWrapper cudaPackages.autoAddCudaCompatRunpath ];
env =
{
CUDA_CC = builtins.concatStringsSep " " cudaCapabilities;
NIX_LDFLAGS = "-L${cudaPackages.cuda_cudart}/lib/stubs";
};
doCheck = false;
postInstall =
''
rm $out/bin/{doc,test}
for i in $out/bin/*; do
if [ -f $i ]; then
wrapProgram $i --prefix LD_LIBRARY_PATH ":" "/run/opengl-driver/lib"
fi
done
'';
}

View File

@@ -1,6 +1,6 @@
{
src, stdenv, autoPatchelfHook, wrapCCWith, config, overrideCC, makeSetupHook, writeScript, overrideInStdenv,
gcc, glibc, libz, zstd, libxml2, flock, numactl, ncurses, openssl, gmp,
gcc, glibc, libz, zstd, libxml2_13, flock, numactl, ncurses, openssl, gmp,
libxcrypt-legacy, libfabric, rdma-core, xorg, bash
}:
let
@@ -9,7 +9,7 @@ let
pname = "nvhpc";
inherit (src) src version;
buildInputs =
[ libz libxml2 zstd numactl ncurses openssl gmp libxcrypt-legacy libfabric rdma-core xorg.libpciaccess ];
[ libz libxml2_13 zstd numactl ncurses openssl gmp libxcrypt-legacy libfabric rdma-core xorg.libpciaccess ];
nativeBuildInputs = [ autoPatchelfHook flock ];
langFortran = true;
dontConfigure = true;