mirror of
https://github.com/CHN-beta/nixos.git
synced 2026-01-12 05:20:42 +08:00
Compare commits
56 Commits
next
...
0cbeb830b9
| Author | SHA1 | Date | |
|---|---|---|---|
| 0cbeb830b9 | |||
| c480e681c1 | |||
| 4adc1be9a2 | |||
| 93b1e4f146 | |||
| b71484eca4 | |||
| 3c37a9288c | |||
| 2532d3cf70 | |||
| 1e65495897 | |||
| f2a9d285f3 | |||
| ef8f516ab3 | |||
| d8b96a32e8 | |||
| 085fde23ba | |||
| 5de71b4f6d | |||
| 682fb5d0a4 | |||
| a4ebf16124 | |||
| 03e89c43d2 | |||
| e8786d4ace | |||
| 7b479a158b | |||
| 3e3e62838b | |||
| 0ac3e0f4bc | |||
| ef99027542 | |||
| c86ebb17f4 | |||
| 6eb1609f3e | |||
| b6dd4555a6 | |||
| 93dc607cb5 | |||
| f653471c23 | |||
| 0416427642 | |||
| 9595bed7c0 | |||
| e2556f3a04 | |||
| f5e70e16b2 | |||
| ebc05b9911 | |||
| 6efc29a7a4 | |||
| c0c8bc3704 | |||
| 73a1490fed | |||
| 1bb6e550d8 | |||
| c9bd7b48d7 | |||
| d1d27ce194 | |||
| 3f46eb23de | |||
| 4cb983ce32 | |||
| 87c6d0fab4 | |||
| e5f7e1650e | |||
| d92b202b8e | |||
| 4c3cb5fe5f | |||
| 2147ba2f2d | |||
| 58b1c596db | |||
| 2e278b2dba | |||
| 72067d23c5 | |||
| 94670e9cbe | |||
| 3ab4ecb5d2 | |||
| 63c647ceba | |||
| fb7e9156d0 | |||
| f2e2f34cbf | |||
| 7d09abee57 | |||
| e2921059f8 | |||
| acd2845377 | |||
| b1546505a5 |
6
.gitmodules
vendored
Normal file
6
.gitmodules
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
[submodule "nixpkgs"]
|
||||
path = nixpkgs
|
||||
url = https://github.com/CHN-beta/nixpkgs.git
|
||||
[submodule "packages/ufo"]
|
||||
path = packages/ufo
|
||||
url = https://git.chn.moe/chn/ufo.git
|
||||
@@ -24,3 +24,9 @@ An overlay is provided through `outputs.overlays.default`, you could use it in y
|
||||
}
|
||||
```
|
||||
|
||||
## TODO
|
||||
|
||||
* Write this readme file. Something have been outdate.
|
||||
* Servers in XMU should use vps9 to run proxy.
|
||||
* Allow to specify oneapiArch and nvhpcArch per package.
|
||||
* Update document. Something is outdate.
|
||||
|
||||
@@ -23,6 +23,7 @@ inputs:
|
||||
"/nix/remote/wlin" = "/data/gpfs01/wlin/.nix";
|
||||
};
|
||||
};
|
||||
nfs."nas.ts.chn.moe:/" = { mountPoint = "/nix/remote/nas"; mountBeforeSwitch = false; };
|
||||
};
|
||||
luks.auto =
|
||||
{
|
||||
@@ -114,10 +115,17 @@ inputs:
|
||||
services.colord.enable = true;
|
||||
services.udev.extraRules =
|
||||
''
|
||||
# 禁止鼠标等在睡眠时唤醒
|
||||
ACTION=="add", ATTR{power/wakeup}="disabled"
|
||||
# CPU降压
|
||||
SUBSYSTEM=="power_supply", KERNEL=="BAT0", ACTION=="*", RUN+="${inputs.pkgs.ryzenadj}/bin/ryzenadj --set-coall=0x0fff40"
|
||||
'';
|
||||
# 解决有时蓝牙不能使用的问题
|
||||
boot.kernelParams = [ "mt7925e.disable_aspm=1" ];
|
||||
boot.kernelParams =
|
||||
[
|
||||
# 解决有时蓝牙不能使用的问题
|
||||
"mt7925e.disable_aspm=1"
|
||||
# 插拔电源和扩展坞不要唤醒电脑
|
||||
"acpi.ec_no_wakeup=1"
|
||||
];
|
||||
};
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@ inputs:
|
||||
vfat."/dev/disk/by-partlabel/${clusterName}-${nodeName}-boot" = "/boot";
|
||||
btrfs."/dev/disk/by-partlabel/${clusterName}-${nodeName}-root1" =
|
||||
{ "/nix" = "/nix"; "/nix/rootfs/current" = "/"; };
|
||||
nfs."nas.ts.chn.moe:/" = { mountPoint = "/nix/remote/nas"; neededForBoot = false; };
|
||||
};
|
||||
nixpkgs.cuda.capabilities =
|
||||
[
|
||||
|
||||
9
devices/wlin/bsub.nix
Normal file
9
devices/wlin/bsub.nix
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
normal = [ 4 4 20 ];
|
||||
normal_1day = [ 4 7 28 ];
|
||||
normal_1week = [ 4 7 28 ];
|
||||
normal_2week = [ 6 8 48 ];
|
||||
normal_1day_new = [ 4 6 24 ];
|
||||
ocean_530_1day = [ 4 6 24 ];
|
||||
ocean6226R_1day = [ 4 8 32 ];
|
||||
}
|
||||
@@ -1,3 +1,6 @@
|
||||
# sudo nix build --store 'local?store=/data/gpfs01/wlin/.nix/store&state=/data/gpfs01/wlin/.nix/state&log=/data/gpfs01/wlin/.nix/log' .#wlin
|
||||
# sudo nix-store --store 'local?store=/data/gpfs01/wlin/.nix/store&state=/data/gpfs01/wlin/.nix/state&log=/data/gpfs01/wlin/.nix/log' -qR ./result | grep -Fxv -f <(ssh wlin find .nix/store -maxdepth 1 -exec realpath '{}' '\;') | sudo xargs nix-store --store 'local?store=/data/gpfs01/wlin/.nix/store&state=/data/gpfs01/wlin/.nix/state&log=/data/gpfs01/wlin/.nix/log' --export | pv > wlin.nar
|
||||
# cat wlin.nar | nix-store --import
|
||||
{ inputs, localLib }:
|
||||
let
|
||||
pkgs = import inputs.nixpkgs (localLib.buildNixpkgsConfig
|
||||
@@ -5,11 +8,18 @@ let
|
||||
inputs = { inherit (inputs.nixpkgs) lib; topInputs = inputs; };
|
||||
nixpkgs = { march = "haswell"; nixRoot = "/data/gpfs01/wlin/.nix"; nixos = false; };
|
||||
});
|
||||
python = pkgs.python3.withPackages (ps: with ps; [ phonopy ]);
|
||||
chn-bsub = pkgs.localPackages.chn-bsub.override
|
||||
(prev: { bsubConfig = builtins.toFile "bsub.yaml" (builtins.toJSON (import ./bsub.nix)); });
|
||||
wlin = pkgs.symlinkJoin
|
||||
{
|
||||
name = "wlin";
|
||||
paths = with pkgs; [ gnuplot localPackages.vaspkit pv ];
|
||||
paths = with pkgs;
|
||||
[
|
||||
gnuplot localPackages.vaspkit pv python localPackages.vasp.intel chn-bsub hwloc
|
||||
lsd glibc glibc.bin
|
||||
];
|
||||
postBuild = "echo ${inputs.self.rev or "dirty"} > $out/.version";
|
||||
passthru = { inherit pkgs; archive = pkgs.closureInfo { rootPaths = [ wlin.drvPath ]; }; };
|
||||
passthru = { inherit pkgs chn-bsub; archive = pkgs.closureInfo { rootPaths = [ wlin.drvPath ]; }; };
|
||||
};
|
||||
in wlin
|
||||
|
||||
@@ -1,12 +1,3 @@
|
||||
# .bash_profile
|
||||
|
||||
# Get the aliases and functions
|
||||
if [ -f ~/.bashrc ]; then
|
||||
. ~/.bashrc
|
||||
fi
|
||||
|
||||
# User specific environment and startup programs
|
||||
|
||||
PATH=$PATH:$HOME/bin
|
||||
|
||||
export PATH
|
||||
|
||||
@@ -1,43 +1,10 @@
|
||||
# .bashrc
|
||||
|
||||
# Source global definitions
|
||||
if [ -f /etc/bashrc ]; then
|
||||
. /etc/bashrc
|
||||
fi
|
||||
|
||||
export PATH=$PATH:/data/gpfs01/wlin/bin
|
||||
|
||||
# User specific aliases and functions
|
||||
export PATH=/data/gpfs01/wlin/bin/vaspkit.1.4.1/bin:${PATH}
|
||||
#export PATH=~/bin:/data/gpfs01/wlin/opt/mpich_ifort/bin:$PATH
|
||||
#export LD_LIBRARY_PATH=/data/gpfs01/wlin/opt/mpich_ifort/lib:$LD_LIBRARY_PATH
|
||||
#export PATH=~/bin:/data/gpfs01/wlin/opt/mpich/bin:$PATH
|
||||
#export LD_LIBRARY_PATH=/data/gpfs01/wlin/opt/mpich/lib:$LD_LIBRARY_PATH
|
||||
export P4_RSHCOMMAND=ssh
|
||||
shopt -s cdspell
|
||||
export HISTCONTROL=ignoredups
|
||||
#shopt -s histappend
|
||||
PROMPT_COMMAND='history -a'
|
||||
export C3_RSH="ssh -x"
|
||||
export OMP_NUM_THREADS=1
|
||||
export MKL_NUM_THREADS=1
|
||||
alias grep='grep --color'
|
||||
USER_IP=`who -u am i 2>/dev/null| awk '{print $NF}'|sed -e 's/[()]//g'`
|
||||
|
||||
export HISTTIMEFORMAT="%Y-%m-%d %H:%M:%S `whoami`@${USER_IP}: "
|
||||
export HISTFILESIZE=1000000
|
||||
export PROMPT_COMMAND="history -a; history -r; $PROMPT_COMMAND"
|
||||
shopt -s histappend
|
||||
# Auto add env parameter $PROMPT_COMMAND when use non-Linux tty login by ssh.
|
||||
if [ "$SSH_CONNECTION" != '' -a "$TERM" != 'linux' ]; then
|
||||
declare -a HOSTIP
|
||||
HOSTIP=`echo $SSH_CONNECTION |awk '{print $3}'`
|
||||
export PROMPT_COMMAND='echo -ne "\033]0;${USER}@$HOSTIP:[${HOSTNAME%%.*}]:${PWD/#$HOME/~} \007"'
|
||||
if [ -z "${BASHRC_SOURCED-}" ]; then
|
||||
export PATH=$HOME/.nix/state/gcroots/current/bin:$HOME/bin:$PATH
|
||||
ulimit -s unlimited
|
||||
export HISTFILESIZE=1000000
|
||||
export BASHRC_SOURCED=1
|
||||
fi
|
||||
ulimit -s unlimited
|
||||
export PYTHONPATH=/data/gpfs01/wlin/bin/VaspBandUnfolding-master:${PYTHONPATH}
|
||||
|
||||
# vsts, see https://theory.cm.utexas.edu/vtsttools/scripts.html
|
||||
export PATH=$PATH:/data/gpfs01/wlin/yjj/vtstscripts-1022
|
||||
export PERL5LIB=/data/gpfs01/wlin/yjj/vtstscripts-1022
|
||||
|
||||
|
||||
2
devices/wlin/files/.config/nix/nix.conf
Normal file
2
devices/wlin/files/.config/nix/nix.conf
Normal file
@@ -0,0 +1,2 @@
|
||||
store = local?store=/data/gpfs01/wlin/.nix/store&state=/data/gpfs01/wlin/.nix/state&log=/data/gpfs01/wlin/.nix/log
|
||||
experimental-features = flakes nix-command
|
||||
78
flake.lock
generated
78
flake.lock
generated
@@ -100,11 +100,11 @@
|
||||
"cachyos-kernel": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1766083376,
|
||||
"narHash": "sha256-eh914fO4gYD8aCuUrMlPBRsxwwa2+qc9HCuAhrG6G9c=",
|
||||
"lastModified": 1767371066,
|
||||
"narHash": "sha256-ztxcryN0uX2WhFYoOZLXClqaFwfC8EAVCKaA2M++ROU=",
|
||||
"owner": "CachyOS",
|
||||
"repo": "linux-cachyos",
|
||||
"rev": "9d369789361623b8a3b842a71adccb19b24ba16f",
|
||||
"rev": "f280ea9c30ca7a39cf8f6995efb553ff9b8cb384",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -116,11 +116,11 @@
|
||||
"cachyos-kernel-patches": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1766080842,
|
||||
"narHash": "sha256-LezfhAfTdfhvjiHSWe258SMUIs+cP8SHT8BiPou0A4w=",
|
||||
"lastModified": 1767369270,
|
||||
"narHash": "sha256-Jne9XlgFlyuJIf9F6QoAObLo2/AXYbaGqNFqCdRdDmY=",
|
||||
"owner": "CachyOS",
|
||||
"repo": "kernel-patches",
|
||||
"rev": "e266fbc7f36273ebbc62a9bffda02e3882eb8f6c",
|
||||
"rev": "15a034b093aee9b935f7c6c08ea5312e187c9ac7",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -364,11 +364,11 @@
|
||||
"flake-compat_2": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1765121682,
|
||||
"narHash": "sha256-4VBOP18BFeiPkyhy9o4ssBNQEvfvv1kXkasAYd0+rrA=",
|
||||
"lastModified": 1767039857,
|
||||
"narHash": "sha256-vNpUSpF5Nuw8xvDLj2KCwwksIbjua2LZCqhV1LNRDns=",
|
||||
"owner": "NixOS",
|
||||
"repo": "flake-compat",
|
||||
"rev": "65f23138d8d09a92e30f1e5c87611b23ef451bf3",
|
||||
"rev": "5edf11c44bc78a0d334f6334cdaf7d60d732daab",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -665,6 +665,23 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"linux-asus": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1767457777,
|
||||
"narHash": "sha256-DCKTOfkJ0d1IkSwcSq0r/j45BvkBDcqXVmJAVYRFHSU=",
|
||||
"owner": "CHN-beta",
|
||||
"repo": "linux-g14",
|
||||
"rev": "c02087ae1c3f9d24bdcf2b4b277ce0b4c9fd767c",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "CHN-beta",
|
||||
"ref": "6.18",
|
||||
"repo": "linux-g14",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"mac-style": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
@@ -865,11 +882,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1766317927,
|
||||
"narHash": "sha256-8bpmKA1+G8r8uB8YesjmvSS8w+0dhB+SYdmpGWYlXAE=",
|
||||
"lastModified": 1767529782,
|
||||
"narHash": "sha256-Wz8j5qfkxX+QQa/arHqWGYZuBfLTq/cJVDCEIBzEV9o=",
|
||||
"owner": "CHN-beta",
|
||||
"repo": "nix-cachyos-kernel",
|
||||
"rev": "ae6243bbaac9c0eff212bfb45eff5620dfe383a5",
|
||||
"rev": "7d65b67594d1422ecd2a9f4cbfcce8fca67067f4",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -1144,19 +1161,14 @@
|
||||
},
|
||||
"nixpkgs_3": {
|
||||
"locked": {
|
||||
"lastModified": 1766317807,
|
||||
"narHash": "sha256-HQeHsIrRFllgpmUlhMH+F8cxp/zeODTziEHai2Ryebw=",
|
||||
"owner": "CHN-beta",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "201f7c1ac0c7c455ad0a6660c037f49821160c3b",
|
||||
"type": "github"
|
||||
"path": "nixpkgs",
|
||||
"type": "path"
|
||||
},
|
||||
"original": {
|
||||
"owner": "CHN-beta",
|
||||
"ref": "nixos-25.11",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
"path": "nixpkgs",
|
||||
"type": "path"
|
||||
},
|
||||
"parent": []
|
||||
},
|
||||
"nixvirt": {
|
||||
"inputs": {
|
||||
@@ -1442,6 +1454,7 @@
|
||||
"home-manager": "home-manager",
|
||||
"impermanence": "impermanence",
|
||||
"lepton": "lepton",
|
||||
"linux-asus": "linux-asus",
|
||||
"mac-style": "mac-style",
|
||||
"matplotplusplus": "matplotplusplus",
|
||||
"mirism-old": "mirism-old",
|
||||
@@ -1478,7 +1491,6 @@
|
||||
"sticker": "sticker",
|
||||
"stickerpicker": "stickerpicker",
|
||||
"tgbot-cpp": "tgbot-cpp",
|
||||
"ufo": "ufo",
|
||||
"v-sim": "v-sim",
|
||||
"vaspberry": "vaspberry",
|
||||
"winapps": "winapps",
|
||||
@@ -1764,24 +1776,6 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"ufo": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1762315512,
|
||||
"lfs": true,
|
||||
"narHash": "sha256-tTVQrXhnfFdrRwYJ60mpGdlbvUOE6egAxtqD0d80Crw=",
|
||||
"ref": "refs/heads/main",
|
||||
"rev": "dc6b431bf92db5ba22aac745a90e058528d9b5e3",
|
||||
"revCount": 85,
|
||||
"type": "git",
|
||||
"url": "https://git.chn.moe/chn/ufo.git"
|
||||
},
|
||||
"original": {
|
||||
"lfs": true,
|
||||
"type": "git",
|
||||
"url": "https://git.chn.moe/chn/ufo.git"
|
||||
}
|
||||
},
|
||||
"v-sim": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
|
||||
inputs =
|
||||
{
|
||||
nixpkgs.url = "github:CHN-beta/nixpkgs/nixos-25.11";
|
||||
self.submodules = true;
|
||||
nixpkgs.url = ./nixpkgs;
|
||||
nixpkgs-2505.url = "github:CHN-beta/nixpkgs/nixos-25.05";
|
||||
nixpkgs-2411.url = "github:CHN-beta/nixpkgs/nixos-24.11";
|
||||
nixpkgs-2311.url = "github:CHN-beta/nixpkgs/nixos-23.11";
|
||||
@@ -53,7 +54,6 @@
|
||||
pocketfft = { url = "github:mreineck/pocketfft"; flake = false; };
|
||||
blog = { url = "git+https://git.chn.moe/chn/blog-public.git?lfs=1"; flake = false; };
|
||||
vaspberry = { url = "github:Infant83/VASPBERRY"; flake = false; };
|
||||
ufo = { url = "git+https://git.chn.moe/chn/ufo.git?lfs=1"; flake = false; };
|
||||
stickerpicker = { url = "github:maunium/stickerpicker"; flake = false; };
|
||||
fancy-motd = { url = "github:CHN-beta/fancy-motd"; flake = false; };
|
||||
mac-style = { url = "github:SergioRibera/s4rchiso-plymouth-theme?lfs=1"; flake = false; };
|
||||
@@ -65,6 +65,7 @@
|
||||
mirism-old = { url = "github:CHN-beta/mirism-old-public"; flake = false; };
|
||||
sqlgen = { url = "git+https://github.com/getml/sqlgen?submodules=1"; flake = false; };
|
||||
reflectcpp = { url = "git+https://github.com/getml/reflect-cpp?submodules=1"; flake = false; };
|
||||
linux-asus = { url = "github:CHN-beta/linux-g14/6.18"; flake = false; };
|
||||
};
|
||||
|
||||
outputs = inputs: let localLib = import ./flake/lib inputs.nixpkgs.lib; in
|
||||
|
||||
@@ -1,64 +1,64 @@
|
||||
{ inputs }: let inherit (inputs.self.nixosConfigurations.pc) pkgs; in
|
||||
{
|
||||
biu = pkgs.mkShell.override { stdenv = pkgs.clang18Stdenv; }
|
||||
biu = pkgs.mkShell
|
||||
{
|
||||
inputsFrom = [ pkgs.localPackages.biu ];
|
||||
packages = [ pkgs.llvmPackages_18.clang-tools ];
|
||||
packages = [ pkgs.llvmPackages.clang-tools ];
|
||||
CMAKE_EXPORT_COMPILE_COMMANDS = "1";
|
||||
hardeningDisable = [ "all" ];
|
||||
};
|
||||
hpcstat = pkgs.mkShell.override { stdenv = pkgs.gcc14Stdenv; }
|
||||
hpcstat = pkgs.mkShell
|
||||
{
|
||||
inputsFrom = [ (pkgs.localPackages.hpcstat.override { version = null; }) ];
|
||||
packages = [ pkgs.llvmPackages_18.clang-tools ];
|
||||
packages = [ pkgs.llvmPackages.clang-tools ];
|
||||
CMAKE_EXPORT_COMPILE_COMMANDS = "1";
|
||||
hardeningDisable = [ "all" ];
|
||||
};
|
||||
sbatch-tui = pkgs.mkShell.override { stdenv = pkgs.clang18Stdenv; }
|
||||
sbatch-tui = pkgs.mkShell
|
||||
{
|
||||
inputsFrom = [ pkgs.localPackages.sbatch-tui ];
|
||||
packages = [ pkgs.llvmPackages_18.clang-tools ];
|
||||
packages = [ pkgs.llvmPackages.clang-tools ];
|
||||
CMAKE_EXPORT_COMPILE_COMMANDS = "1";
|
||||
hardeningDisable = [ "all" ];
|
||||
};
|
||||
ufo = pkgs.mkShell.override { stdenv = pkgs.clang18Stdenv; }
|
||||
ufo = pkgs.mkShell
|
||||
{
|
||||
inputsFrom = [ pkgs.localPackages.ufo ];
|
||||
packages = [ pkgs.llvmPackages_18.clang-tools ];
|
||||
packages = [ pkgs.llvmPackages.clang-tools ];
|
||||
CMAKE_EXPORT_COMPILE_COMMANDS = "1";
|
||||
hardeningDisable = [ "all" ];
|
||||
};
|
||||
chn-bsub = pkgs.mkShell
|
||||
{
|
||||
inputsFrom = [ pkgs.localPackages.chn-bsub ];
|
||||
packages = [ pkgs.llvmPackages_18.clang-tools ];
|
||||
packages = [ pkgs.llvmPackages.clang-tools ];
|
||||
CMAKE_EXPORT_COMPILE_COMMANDS = "1";
|
||||
};
|
||||
info = pkgs.mkShell.override { stdenv = pkgs.clang18Stdenv; }
|
||||
info = pkgs.mkShell
|
||||
{
|
||||
inputsFrom = [ pkgs.localPackages.info ];
|
||||
packages = [ pkgs.llvmPackages_18.clang-tools ];
|
||||
packages = [ pkgs.llvmPackages.clang-tools ];
|
||||
CMAKE_EXPORT_COMPILE_COMMANDS = "1";
|
||||
hardeningDisable = [ "all" ];
|
||||
};
|
||||
vm = pkgs.mkShell.override { stdenv = pkgs.clang18Stdenv; }
|
||||
vm = pkgs.mkShell
|
||||
{
|
||||
inputsFrom = [ pkgs.localPackages.vm ];
|
||||
packages = [ pkgs.llvmPackages_18.clang-tools ];
|
||||
packages = [ pkgs.llvmPackages.clang-tools ];
|
||||
CMAKE_EXPORT_COMPILE_COMMANDS = "1";
|
||||
hardeningDisable = [ "all" ];
|
||||
};
|
||||
xinli = pkgs.mkShell.override { stdenv = pkgs.clang18Stdenv; }
|
||||
xinli = pkgs.mkShell
|
||||
{
|
||||
inputsFrom = [ pkgs.localPackages.xinli ];
|
||||
packages = [ pkgs.llvmPackages_18.clang-tools ];
|
||||
packages = [ pkgs.llvmPackages.clang-tools ];
|
||||
CMAKE_EXPORT_COMPILE_COMMANDS = "1";
|
||||
hardeningDisable = [ "all" ];
|
||||
};
|
||||
missgram = pkgs.mkShell.override { stdenv = pkgs.clang18Stdenv; }
|
||||
missgram = pkgs.mkShell
|
||||
{
|
||||
inputsFrom = [ pkgs.localPackages.missgram ];
|
||||
packages = [ pkgs.llvmPackages_18.clang-tools ];
|
||||
packages = [ pkgs.llvmPackages.clang-tools ];
|
||||
CMAKE_EXPORT_COMPILE_COMMANDS = "1";
|
||||
hardeningDisable = [ "all" ];
|
||||
};
|
||||
|
||||
@@ -45,6 +45,7 @@ let
|
||||
"409test" = "192.168.1.5";
|
||||
};
|
||||
tinc = import ./tinc.nix;
|
||||
tailscale = import ./tailscale.nix;
|
||||
in
|
||||
{
|
||||
"" =
|
||||
@@ -82,3 +83,6 @@ in
|
||||
// lib.mapAttrs'
|
||||
(n: v: lib.nameValuePair "tinc0.${n}" { type = "A"; value = "192.168.85.${builtins.toString v}"; })
|
||||
tinc
|
||||
// lib.mapAttrs'
|
||||
(n: v: lib.nameValuePair "${n}.ts" { type = "A"; value = "100.97.101.${builtins.toString v}"; })
|
||||
tailscale
|
||||
|
||||
10
flake/dns/config/tailscale.nix
Normal file
10
flake/dns/config/tailscale.nix
Normal file
@@ -0,0 +1,10 @@
|
||||
{
|
||||
vps4 = 7;
|
||||
vps6 = 2;
|
||||
vps9 = 6;
|
||||
pc = 1;
|
||||
nas = 3;
|
||||
srv2-node0 = 4;
|
||||
srv2-node1 = 5;
|
||||
srv2-node2 = 8;
|
||||
}
|
||||
76
flake/lib/buildNixpkgsConfig/btop.patch
Normal file
76
flake/lib/buildNixpkgsConfig/btop.patch
Normal file
@@ -0,0 +1,76 @@
|
||||
diff --git a/src/btop_config.cpp b/src/btop_config.cpp
|
||||
index eaaa577..3074a08 100644
|
||||
--- a/src/btop_config.cpp
|
||||
+++ b/src/btop_config.cpp
|
||||
@@ -234,6 +234,7 @@ namespace Config {
|
||||
{"custom_gpu_name4", "#* Custom gpu4 model name, empty string to disable."},
|
||||
{"custom_gpu_name5", "#* Custom gpu5 model name, empty string to disable."},
|
||||
#endif
|
||||
+ {"btrfs_group_subvolumes", "#* Show only the first subvolume of a btrfs filesystem."},
|
||||
};
|
||||
|
||||
std::unordered_map<std::string_view, string> strings = {
|
||||
@@ -336,6 +337,7 @@ namespace Config {
|
||||
#endif
|
||||
{"terminal_sync", true},
|
||||
- {"save_config_on_exit", true}
|
||||
+ {"save_config_on_exit", true},
|
||||
+ {"btrfs_group_subvolumes", false},
|
||||
};
|
||||
std::unordered_map<std::string_view, bool> boolsTmp;
|
||||
|
||||
diff --git a/src/btop_menu.cpp b/src/btop_menu.cpp
|
||||
index 75ec31c..cfaec39 100644
|
||||
--- a/src/btop_menu.cpp
|
||||
+++ b/src/btop_menu.cpp
|
||||
@@ -724,6 +724,15 @@ namespace Menu {
|
||||
"kernel as used memory.",
|
||||
"",
|
||||
"True or False."},
|
||||
+ {
|
||||
+ "btrfs_group_subvolumes",
|
||||
+ "(Linux) Show only first BTRFS subvolume.",
|
||||
+ "",
|
||||
+ "Set to true to only show the first BTRFS",
|
||||
+ "subvolume mounted per disk.",
|
||||
+ "",
|
||||
+ "True or False.",
|
||||
+ }
|
||||
},
|
||||
{
|
||||
{"graph_symbol_net",
|
||||
diff --git a/src/linux/btop_collect.cpp b/src/linux/btop_collect.cpp
|
||||
index eebaa50..37d5745 100644
|
||||
--- a/src/linux/btop_collect.cpp
|
||||
+++ b/src/linux/btop_collect.cpp
|
||||
@@ -2117,6 +2117,7 @@ namespace Mem {
|
||||
auto use_fstab = Config::getB("use_fstab");
|
||||
auto only_physical = Config::getB("only_physical");
|
||||
auto zfs_hide_datasets = Config::getB("zfs_hide_datasets");
|
||||
+ auto btrfs_group_subvolumes = Config::getB("btrfs_group_subvolumes");
|
||||
auto& disks = mem.disks;
|
||||
static std::unordered_map<string, future<pair<disk_info, int>>> disks_stats_promises;
|
||||
ifstream diskread;
|
||||
@@ -2177,6 +2178,7 @@ namespace Mem {
|
||||
vector<string> found;
|
||||
found.reserve(last_found.size());
|
||||
string dev, mountpoint, fstype;
|
||||
+ std::unordered_set<string> found_btrfs_subvolumes;
|
||||
while (not diskread.eof()) {
|
||||
std::error_code ec;
|
||||
diskread >> dev >> mountpoint >> fstype;
|
||||
@@ -2198,6 +2200,14 @@ namespace Mem {
|
||||
size_t zfs_dataset_name_start = 0;
|
||||
if (fstype == "zfs" && (zfs_dataset_name_start = dev.find('/')) != std::string::npos && zfs_hide_datasets) continue;
|
||||
|
||||
+ //? skip BtrFS subvolumes
|
||||
+ if (btrfs_group_subvolumes and fstype == "btrfs") {
|
||||
+ string devname = fs::canonical(dev, ec).filename();
|
||||
+ if (!found_btrfs_subvolumes.insert(devname).second) {
|
||||
+ continue;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
if ((not use_fstab and not only_physical)
|
||||
or (use_fstab and v_contains(fstab, mountpoint))
|
||||
or (not use_fstab and only_physical and v_contains(fstypes, fstype))) {
|
||||
@@ -72,6 +72,13 @@ 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 ]; });
|
||||
btop = prev.btop.overrideAttrs (prev: { patches = prev.patches or [] ++ [ ./btop.patch ]; });
|
||||
prrte = prev.prrte.overrideAttrs (prev:
|
||||
{
|
||||
configureFlags = prev.configureFlags or [] ++ [ "--with-lsf" ];
|
||||
buildInputs = prev.buildInputs or [] ++ [ final.localPackages.lsf final.libnsl ];
|
||||
});
|
||||
cpptrace = prev.cpptrace.overrideAttrs (prev: { doCheck = !final.stdenv.hostPlatform.isStatic; });
|
||||
}
|
||||
// (
|
||||
let
|
||||
@@ -136,7 +143,7 @@ in platformConfig //
|
||||
assimp = prev.assimp.override { stdenv = final.genericPackages.stdenv; };
|
||||
xen = prev.xen.overrideAttrs (prev: { patches = prev.patches or [] ++ [ ./xen.patch ]; });
|
||||
lib2geom = prev.lib2geom.overrideAttrs (prev: { doCheck = false; });
|
||||
libreoffice-qt6-still = prev.libreoffice-qt6-still.override (prev:
|
||||
libreoffice-fresh = prev.libreoffice-fresh.override (prev:
|
||||
{ unwrapped = prev.unwrapped.overrideAttrs (prev: { postPatch = prev.postPatch or "" +
|
||||
''
|
||||
sed -i '/CPPUNIT_TEST.testDubiousArrayFormulasFODS/d' sc/qa/unit/functions_array.cxx
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{ inputs, localLib }:
|
||||
let
|
||||
singles = [ "nas" "pc" "vps4" "vps6" "vps9" "r2s" ];
|
||||
singles = [ "nas" "pc" "vps4" "vps6" "vps9" ];
|
||||
cluster = { srv1 = 3; srv2 = 3; };
|
||||
deviceModules = builtins.listToAttrs
|
||||
(
|
||||
|
||||
@@ -12,9 +12,7 @@
|
||||
duc = pkgs.pkgsStatic.duc.override { enableCairo = false; cairo = null; pango = null; };
|
||||
glaze = pkgs.pkgs-2411.pkgsStatic.glaze.overrideAttrs
|
||||
(prev: { cmakeFlags = prev.cmakeFlags ++ [ "-Dglaze_ENABLE_FUZZING=OFF" ]; });
|
||||
# pkgsStatic.clangStdenv have a bug
|
||||
# https://github.com/NixOS/nixpkgs/issues/177129
|
||||
biu = pkgs.pkgsStatic.localPackages.biu.override { stdenv = pkgs.pkgsStatic.gcc14Stdenv; inherit glaze; };
|
||||
biu = pkgs.pkgsStatic.localPackages.biu.override { inherit glaze; };
|
||||
in pkgs.pkgsStatic.localPackages.hpcstat.override
|
||||
{
|
||||
inherit openssh duc biu;
|
||||
@@ -44,14 +42,17 @@
|
||||
tokenPath = inputs.self.nixosConfigurations.pc.config.nixos.system.sops.secrets."acme/token".path;
|
||||
octodns = pkgs.octodns.withProviders (_: with pkgs.octodns-providers; [ cloudflare ]);
|
||||
};
|
||||
archive = pkgs.writeText "archive" (builtins.concatStringsSep "\n" (builtins.concatLists
|
||||
[
|
||||
(inputs.nixpkgs.lib.mapAttrsToList
|
||||
(_: v: (v.extendModules { modules = [{ config.system.includeBuildDependencies = true; }]; })
|
||||
.config.system.build.toplevel)
|
||||
inputs.self.outputs.nixosConfigurations)
|
||||
[ src ]
|
||||
(builtins.attrValues inputs)
|
||||
]));
|
||||
archive =
|
||||
let
|
||||
systemWithBuildDeps = system:
|
||||
(system.extendModules { modules = [{ config.system.includeBuildDependencies = true; }]; })
|
||||
.config.system.build.toplevel;
|
||||
systems = inputs.nixpkgs.lib.mapAttrs (_: v: systemWithBuildDeps v) inputs.self.outputs.nixosConfigurations;
|
||||
inputListFile = pkgs.writeText "input-list"
|
||||
(builtins.concatStringsSep "\n" (builtins.attrValues inputs));
|
||||
archive = pkgs.writeText "archive" (builtins.concatStringsSep "\n"
|
||||
((builtins.attrValues systems) ++ [ src inputListFile ]));
|
||||
in
|
||||
archive // { passthru = archive.passthru // systems // { inherit src; inputs = inputListFile; }; };
|
||||
}
|
||||
// (builtins.mapAttrs (_: v: v.config.system.build.toplevel) inputs.self.outputs.nixosConfigurations)
|
||||
|
||||
@@ -211,4 +211,13 @@
|
||||
structuredExtraConfig = { BTRFS_ALLOCATOR_HINTS = lib.kernel.yes; BTRFS_READ_POLICIES = lib.kernel.yes; };
|
||||
};
|
||||
};
|
||||
# download include from /opt/ibm/lsfsuite/lsf/10.1/include into lsf/include
|
||||
# download lib from /opt/ibm/lsfsuite/lsf/10.1/linux2.6-glibc2.3-x86_64/lib into lsf/lib and only preserve .so
|
||||
lsf = pkgs.requireFile
|
||||
{
|
||||
name = "lsf";
|
||||
sha256 = "0rij4xx705yj1vr5jd31hb8izmb35vkrdql0850qc5cn30jnkf4l";
|
||||
hashMode = "recursive";
|
||||
message = "lsf not found.";
|
||||
};
|
||||
}
|
||||
|
||||
19
modules/packages/btop.nix
Normal file
19
modules/packages/btop.nix
Normal file
@@ -0,0 +1,19 @@
|
||||
{ lib, pkgs, config, ... }:
|
||||
{
|
||||
options.nixos.packages.btop = lib.mkOption { type = lib.types.nullOr (lib.types.submodule {}); default = {}; };
|
||||
config = let inherit (config.nixos.packages) btop; in lib.mkIf (btop != null)
|
||||
{
|
||||
nixos =
|
||||
{
|
||||
packages.packages._packages = [ pkgs.btop ];
|
||||
user.sharedModules =
|
||||
[{
|
||||
config.programs.btop =
|
||||
{
|
||||
enable = true;
|
||||
settings.btrfs_group_subvolumes = true;
|
||||
};
|
||||
}];
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -54,7 +54,7 @@ inputs:
|
||||
google-chrome tor-browser
|
||||
# office
|
||||
crow-translate zotero pandoc texliveFull poppler-utils pdftk pdfchain kdePackages.kruler kdePackages.okular
|
||||
ydict texstudio panoply pspp libreoffice-qt6-still ocrmypdf typst # paperwork
|
||||
ydict texstudio panoply pspp libreoffice-fresh ocrmypdf typst # paperwork
|
||||
# required by ltex-plus.vscode-ltex-plus
|
||||
ltex-ls ltex-ls-plus
|
||||
# matplot++ needs old gnuplot
|
||||
|
||||
@@ -10,11 +10,11 @@ inputs:
|
||||
[
|
||||
# basic tools
|
||||
beep dos2unix gnugrep pv tmux screen parallel tldr cowsay jq yq ipfetch localPackages.pslist
|
||||
fastfetch reptyr duc ncdu progress libva-utils ksh neofetch dateutils glib
|
||||
fastfetch reptyr duc ncdu progress libva-utils ksh neofetch dateutils glib cryptsetup
|
||||
# lsxx
|
||||
pciutils usbutils lshw util-linux lsof dmidecode lm_sensors hwloc acpica-tools ethtool
|
||||
# top
|
||||
iotop iftop htop btop powertop s-tui
|
||||
iotop iftop htop powertop s-tui
|
||||
# editor
|
||||
nano bat
|
||||
# downloader
|
||||
|
||||
@@ -47,7 +47,6 @@ inputs:
|
||||
host = host;
|
||||
hostname = "hpc.xmu.edu.cn";
|
||||
user = host;
|
||||
setEnv.TERM = "chn_unset_ls_colors:xterm-256color";
|
||||
};
|
||||
})
|
||||
[ "wlin" "hwang" ])
|
||||
|
||||
@@ -473,7 +473,7 @@
|
||||
# Don't show Git status in prompt for repositories whose workdir matches this pattern.
|
||||
# For example, if set to '~', the Git repository at $HOME/.git will be ignored.
|
||||
# Multiple patterns can be combined with '|': '~(|/foo)|/bar/baz/*'.
|
||||
typeset -g POWERLEVEL9K_VCS_DISABLED_WORKDIR_PATTERN='~'
|
||||
typeset -g POWERLEVEL9K_VCS_DISABLED_WORKDIR_PATTERN='~|/nix/remote/*'
|
||||
|
||||
# Disable the default Git status formatting.
|
||||
typeset -g POWERLEVEL9K_VCS_DISABLE_GITSTATUS_FORMATTING=true
|
||||
|
||||
@@ -57,16 +57,21 @@ inputs:
|
||||
"cron.gc_lfs" = { ENABLED = true; SCHEDULE = "@monthly"; NUMBER_TO_CHECK_PER_REPO = 0; };
|
||||
};
|
||||
};
|
||||
anubis.instances.gitea.settings =
|
||||
{
|
||||
OG_PASSTHROUGH = true;
|
||||
TARGET = "http://127.0.0.1:3002";
|
||||
BIND_NETWORK = "tcp";
|
||||
BIND = "127.0.0.1:3003";
|
||||
WEBMASTER_EMAIL = "chn@chn.moe";
|
||||
SERVE_ROBOTS_TXT = true;
|
||||
METRICS_BIND = "/run/anubis/anubis-gitea/anubis-metrics.sock";
|
||||
};
|
||||
# prevent AI web crawlers
|
||||
# https://her.esy.fun/posts/0031-how-i-protect-my-forgejo-instance-from-ai-web-crawlers/index.html
|
||||
nginx.virtualHosts."https:${gitea.hostname}".locations."/".extraConfigPre =
|
||||
''
|
||||
if ($http_user_agent ~* "git/|git-lfs/") {
|
||||
set $bypass_cookie 1;
|
||||
}
|
||||
if ($cookie_Yogsototh_opens_the_door = "1") {
|
||||
set $bypass_cookie 1;
|
||||
}
|
||||
if ($bypass_cookie != 1) {
|
||||
add_header Content-Type text/html always;
|
||||
return 418 '<script>document.cookie = "Yogsototh_opens_the_door=1; Path=/;"; window.location.reload();</script>';
|
||||
}
|
||||
'';
|
||||
};
|
||||
nixos =
|
||||
{
|
||||
@@ -78,7 +83,7 @@ inputs:
|
||||
};
|
||||
services =
|
||||
{
|
||||
nginx.https.${gitea.hostname}.location."/".proxy.upstream = "http://127.0.0.1:3003";
|
||||
nginx.https.${gitea.hostname}.location."/".proxy.upstream = "http://127.0.0.1:3002";
|
||||
postgresql.instances.gitea = {};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
inputs:
|
||||
{ lib, config, pkgs, ... }:
|
||||
{
|
||||
options.nixos.system.fileSystems.mount.nfs = let inherit (inputs.lib) mkOption types; in mkOption
|
||||
options.nixos.system.fileSystems.mount.nfs = let inherit (lib) mkOption types; in mkOption
|
||||
{
|
||||
type = types.attrsOf (types.oneOf
|
||||
[
|
||||
@@ -8,50 +8,54 @@ inputs:
|
||||
(types.submodule (submoduleInputs: { options =
|
||||
{
|
||||
mountPoint = mkOption { type = types.nonEmptyStr; };
|
||||
neededForBoot = mkOption { type = types.bool; default = true; };
|
||||
mountBeforeSwitch = mkOption { type = types.bool; default = true; };
|
||||
readOnly = mkOption { type = types.bool; default = !submoduleInputs.config.mountBeforeSwitch; };
|
||||
};}))
|
||||
]);
|
||||
default = {};
|
||||
};
|
||||
config =
|
||||
let inherit (inputs.config.nixos.system.fileSystems.mount) nfs;
|
||||
in inputs.lib.mkIf (nfs != {}) (inputs.lib.mkMerge
|
||||
config = let inherit (config.nixos.system.fileSystems.mount) nfs; in lib.mkIf (nfs != {}) (lib.mkMerge
|
||||
[
|
||||
{
|
||||
fileSystems = builtins.listToAttrs (builtins.map
|
||||
(device:
|
||||
fileSystems = lib.mapAttrs'
|
||||
(n: v: lib.nameValuePair (v.mountPoint or v)
|
||||
{
|
||||
name = device.value.mountPoint or device.value;
|
||||
value =
|
||||
{
|
||||
device = device.name;
|
||||
fsType = "nfs4";
|
||||
neededForBoot = device.value.neededForBoot or true;
|
||||
options = builtins.concatLists
|
||||
device = n;
|
||||
fsType = "nfs4";
|
||||
neededForBoot = v.mountBeforeSwitch or true;
|
||||
options = builtins.concatLists
|
||||
[
|
||||
[
|
||||
[
|
||||
"actimeo=1" # sync every seconds
|
||||
"noatime"
|
||||
"x-gvfs-hide" # hide in file managers (e.g. dolphin)
|
||||
]
|
||||
# when try to mount at startup, wait 15 minutes before giving up
|
||||
(inputs.lib.optionals (device.value.neededForBoot or true)
|
||||
[ "retry=15" "x-systemd.device-timeout=15min" ])
|
||||
(inputs.lib.optionals (!(device.value.neededForBoot or true))
|
||||
[ "bg" "x-systemd.requires=network-online.target" "x-systemd.after=network-online.target" ])
|
||||
];
|
||||
};
|
||||
"actimeo=1" # sync every seconds
|
||||
"noatime"
|
||||
"x-gvfs-hide" # hide in file managers (e.g. dolphin)
|
||||
]
|
||||
# when try to mount at startup, wait 15 minutes before giving up
|
||||
(lib.optionals (v.mountBeforeSwitch or true) [ "retry=15" "x-systemd.device-timeout=15min" ])
|
||||
(lib.optionals (!(v.mountBeforeSwitch or true))
|
||||
[ "bg" "x-systemd.requires=network-online.target" "x-systemd.after=network-online.target" ])
|
||||
(lib.optionals (v.readOnly or false) [ "ro" ])
|
||||
];
|
||||
})
|
||||
(inputs.localLib.attrsToList nfs));
|
||||
nfs;
|
||||
systemd.mounts = builtins.map
|
||||
(mount:
|
||||
{
|
||||
where = mount.value.mountPoint or mount.value;
|
||||
what = mount.name;
|
||||
overrideStrategy = "asDropin";
|
||||
mountConfig.ForceUnmount = true;
|
||||
})
|
||||
(builtins.filter (mount: mount.value.readOnly or false) (lib.attrsToList nfs));
|
||||
services.rpcbind.enable = true;
|
||||
}
|
||||
(inputs.lib.mkIf (builtins.any (mount: mount.neededForBoot or true) (builtins.attrValues nfs))
|
||||
(lib.mkIf (builtins.any (mount: mount.mountBeforeSwitch or true) (builtins.attrValues nfs))
|
||||
{
|
||||
boot.initrd.systemd.extraBin =
|
||||
{
|
||||
"ifconfig" = "${inputs.pkgs.nettools}/bin/ifconfig";
|
||||
"mount.nfs" = "${inputs.pkgs.nfs-utils}/bin/mount.nfs";
|
||||
"mount.nfs4" = "${inputs.pkgs.nfs-utils}/bin/mount.nfs4";
|
||||
"ifconfig" = "${pkgs.nettools}/bin/ifconfig";
|
||||
"mount.nfs" = "${pkgs.nfs-utils}/bin/mount.nfs";
|
||||
"mount.nfs4" = "${pkgs.nfs-utils}/bin/mount.nfs4";
|
||||
};
|
||||
nixos.system.initrd.network = {};
|
||||
})
|
||||
|
||||
@@ -39,6 +39,7 @@ inputs:
|
||||
};
|
||||
xdg.portal.extraPortals = (builtins.map (p: inputs.pkgs."xdg-desktop-portal-${p}") [ "gtk" "wlr" "gnome" ]);
|
||||
qt = { enable = true; platformTheme = "qt5ct"; };
|
||||
gtk.iconCache.enable = true;
|
||||
i18n.inputMethod =
|
||||
{
|
||||
enable = true;
|
||||
@@ -76,9 +77,10 @@ inputs:
|
||||
"Mod+Ctrl+C".action.spawn = [ "sh" "-c" "${xsel} -ob | ${wl-copy}" ];
|
||||
"Mod+Ctrl+V".action.spawn = [ "sh" "-c" "${wl-paste} -n | ${xsel} -ib" ];
|
||||
"Mod+S".action.screenshot = {};
|
||||
"Mod+F".action.set-column-width= "100%";
|
||||
"Mod+R".action.switch-preset-column-width = {};
|
||||
"Mod+T".action.expand-column-to-available-width = {};
|
||||
"Mod+F".action.switch-preset-column-width = {};
|
||||
"Mod+T".action.spawn = [ "ghostty" ];
|
||||
"Mod+B".action.spawn = [ "firefox" ];
|
||||
"Mod+Escape".action.power-off-monitors = {};
|
||||
};
|
||||
outputs =
|
||||
{
|
||||
@@ -91,11 +93,17 @@ inputs:
|
||||
mode = { width = 3840; height = 2160; refresh = 160.; };
|
||||
};
|
||||
};
|
||||
input = { touchpad.dwt = true; keyboard.numlock = true; };
|
||||
input =
|
||||
{
|
||||
touchpad.dwt = true;
|
||||
keyboard.numlock = true;
|
||||
power-key-handling.enable = false;
|
||||
focus-follows-mouse = { enable = true; max-scroll-amount="10%"; };
|
||||
};
|
||||
layout =
|
||||
{
|
||||
default-column-width.proportion = 0.5;
|
||||
preset-column-widths = [ { proportion = 0.33333; } { proportion = 0.5; } { proportion = 0.66667; } ];
|
||||
preset-column-widths = [ { proportion = 0.5; } { proportion = 1.; } ];
|
||||
};
|
||||
spawn-at-startup =
|
||||
[
|
||||
|
||||
@@ -67,6 +67,41 @@ inputs:
|
||||
patches =
|
||||
{
|
||||
btrfs = [(inputs.topInputs.self.src.btrfs.${version} // { name = "btrfs"; })];
|
||||
asus = builtins.map
|
||||
(file:
|
||||
{
|
||||
name = "asus-${file}";
|
||||
patch = "${inputs.topInputs.linux-asus}/${file}";
|
||||
})
|
||||
[
|
||||
# copy from PKGBUILD
|
||||
"0001-platform-x86-asus-wmi-export-symbols-used-for-read-w.patch"
|
||||
"0002-platform-x86-asus-armoury-move-existing-tunings-to-a.patch"
|
||||
"0003-platform-x86-asus-armoury-add-panel_hd_mode-attribut.patch"
|
||||
"0004-platform-x86-asus-armoury-add-apu-mem-control-suppor.patch"
|
||||
"0005-platform-x86-asus-armoury-add-screen-auto-brightness.patch"
|
||||
"0006-platform-x86-asus-wmi-deprecate-bios-features.patch"
|
||||
"0007-platform-x86-asus-wmi-rename-ASUS_WMI_DEVID_PPT_FPPT.patch"
|
||||
"0008-platform-x86-asus-armoury-add-ppt_-and-nv_-tuning-kn.patch"
|
||||
"0001-platform-x86-asus-armoury-Fix-error-code-in-mini_led.patch"
|
||||
"0002-platform-x86-asus-armoury-fix-mini-led-mode-show.patch"
|
||||
"0003-platform-x86-asus-armoury-add-support-for-FA507UV.patch"
|
||||
"0001-platform-x86-asus-armoury-fix-only-DC-tunables-being.patch"
|
||||
"PATCH-v10-00-11-HID-asus-Fix-ASUS-ROG-Laptop-s-Keyboard-backlight-handling.patch"
|
||||
"PATCH-v10-00-11-HID-asus-Fix-ASUS-ROG-Laptop-s-Keyboard-backlight-handling-id1-id2-pr_err.patch"
|
||||
"0001-platform-x86-asus-wmi-fix-initializing-TUFs-keyboard.patch"
|
||||
"0002-platform-x86-asus-armoury-add-keyboard-control-firmw.patch"
|
||||
"0001-acpi-proc-idle-skip-dummy-wait.patch"
|
||||
"PATCH-v5-00-11-Improvements-to-S5-power-consumption.patch"
|
||||
"PATCH-asus-wmi-fixup-screenpad-brightness.patch"
|
||||
"asus-patch-series.patch"
|
||||
"0070-acpi-x86-s2idle-Add-ability-to-configure-wakeup-by-A.patch"
|
||||
"0040-workaround_hardware_decoding_amdgpu.patch"
|
||||
"0081-amdgpu-adjust_plane_init_off_by_one.patch"
|
||||
"0084-enable-steam-deck-hdr.patch"
|
||||
"sys-kernel_arch-sources-g14_files-0047-asus-nb-wmi-Add-tablet_mode_sw-lid-flip.patch"
|
||||
"sys-kernel_arch-sources-g14_files-0048-asus-nb-wmi-fix-tablet_mode_sw_int.patch"
|
||||
];
|
||||
};
|
||||
in builtins.concatLists (builtins.map (name: patches.${name}) kernel.patches);
|
||||
};
|
||||
|
||||
@@ -3,7 +3,11 @@ inputs:
|
||||
config =
|
||||
{
|
||||
# only preserve the last 7 days of logs
|
||||
services.journald.extraConfig = "MaxRetentionSec=7d";
|
||||
services =
|
||||
{
|
||||
journald.extraConfig = "MaxRetentionSec=7d";
|
||||
logind.settings.Login.HandleLidSwitch = "ignore";
|
||||
};
|
||||
systemd =
|
||||
{
|
||||
settings.Manager =
|
||||
|
||||
@@ -13,6 +13,7 @@ inputs:
|
||||
xmuhk = { host = "xmuhk"; hostname = "10.26.14.64"; user = "xmuhk"; };
|
||||
xmuhk2 = { host = "xmuhk2"; hostname = "183.233.219.132"; user = "xmuhk"; port = 62022; };
|
||||
jykang.setEnv.TERM = "chn_unset_ls_colors:chn_cd:linwei/chn:xterm-256color";
|
||||
wlin.setEnv.TERM = "xterm-256color";
|
||||
"tinc0.jykang" = jykang;
|
||||
};
|
||||
extraConfig = inputs.lib.mkIf inputs.config.nixos.model.private
|
||||
|
||||
1
nixpkgs
Submodule
1
nixpkgs
Submodule
Submodule nixpkgs added at d8ca282fc0
@@ -13,8 +13,7 @@ endif()
|
||||
|
||||
find_package(magic_enum REQUIRED)
|
||||
find_package(fmt REQUIRED)
|
||||
find_package(Boost REQUIRED COMPONENTS headers iostreams filesystem system process stacktrace_from_exception
|
||||
stacktrace_backtrace)
|
||||
find_package(Boost REQUIRED COMPONENTS headers iostreams filesystem system process)
|
||||
find_package(range-v3 REQUIRED)
|
||||
find_path(NAMEOF_INCLUDE_DIR nameof.hpp REQUIRED)
|
||||
find_package(Eigen3 REQUIRED)
|
||||
@@ -22,13 +21,14 @@ set(HIGHFIVE_FIND_HDF5 Off)
|
||||
find_package(HighFive REQUIRED)
|
||||
find_path(ZPP_BITS_INCLUDE_DIR zpp_bits.h REQUIRED)
|
||||
find_package(TgBot REQUIRED)
|
||||
find_path(LIBBACKTRACE_INCLUDE_DIR backtrace.h REQUIRED)
|
||||
find_library(LIBBACKTRACE_LIBRARY NAMES backtrace REQUIRED)
|
||||
find_package(HDF5 REQUIRED)
|
||||
find_package(concurrencpp REQUIRED)
|
||||
find_path(POCKETFFT_INCLUDE_DIR pocketfft.h REQUIRED)
|
||||
find_package(yaml-cpp REQUIRED)
|
||||
find_package(glaze REQUIRED)
|
||||
find_package(cpptrace REQUIRED)
|
||||
# on static build, cpptrace requires zlib
|
||||
find_library(ZLIB_LIBRARY NAMES z REQUIRED)
|
||||
|
||||
add_library(biu src/common.cpp src/hdf5.cpp src/string.cpp)
|
||||
target_include_directories(biu PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
@@ -36,7 +36,7 @@ target_include_directories(biu PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_D
|
||||
${LIBBACKTRACE_INCLUDE_DIR} ${POCKETFFT_INCLUDE_DIR})
|
||||
target_link_libraries(biu PUBLIC magic_enum::magic_enum fmt::fmt Boost::headers Boost::iostreams Boost::filesystem
|
||||
range-v3::range-v3 Eigen3::Eigen HighFive TgBot::TgBot ${LIBBACKTRACE_LIBRARY} hdf5::hdf5 concurrencpp::concurrencpp
|
||||
yaml-cpp::yaml-cpp glaze::glaze Boost::process Boost::stacktrace_from_exception Boost::stacktrace_backtrace)
|
||||
yaml-cpp::yaml-cpp glaze::glaze Boost::process cpptrace::cpptrace ${ZLIB_LIBRARY})
|
||||
target_compile_features(biu PUBLIC cxx_std_23)
|
||||
target_compile_options(biu PUBLIC -Wno-gnu-string-literal-operator-template)
|
||||
install(TARGETS biu EXPORT biuTargets LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
|
||||
@@ -1,18 +1,16 @@
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/biuTargets.cmake")
|
||||
find_package(magic_enum REQUIRED)
|
||||
find_package(fmt REQUIRED)
|
||||
find_package(Boost REQUIRED COMPONENTS headers iostreams filesystem system process stacktrace_from_exception
|
||||
stacktrace_backtrace)
|
||||
find_package(Boost REQUIRED COMPONENTS headers iostreams filesystem system process)
|
||||
find_package(range-v3 REQUIRED)
|
||||
find_path(NAMEOF_INCLUDE_DIR nameof.hpp REQUIRED)
|
||||
find_package(Eigen3 REQUIRED)
|
||||
find_package(HighFive REQUIRED)
|
||||
find_path(ZPP_BITS_INCLUDE_DIR zpp_bits.h REQUIRED)
|
||||
find_package(TgBot REQUIRED)
|
||||
find_path(LIBBACKTRACE_INCLUDE_DIR backtrace.h REQUIRED)
|
||||
find_library(LIBBACKTRACE_LIBRARY NAMES backtrace REQUIRED)
|
||||
find_package(HDF5 REQUIRED)
|
||||
find_package(concurrencpp REQUIRED)
|
||||
find_path(POCKETFFT_INCLUDE_DIR pocketfft.h REQUIRED)
|
||||
find_package(yaml-cpp REQUIRED)
|
||||
find_package(glaze REQUIRED)
|
||||
find_package(cpptrace REQUIRED)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
stdenv, cmake, lib,
|
||||
magic-enum, fmt, boost, eigen, range-v3, nameof, zpp-bits, highfive, tgbot-cpp, libbacktrace, hdf5, concurrencpp,
|
||||
pocketfft, yaml-cpp, glaze
|
||||
pocketfft, yaml-cpp, glaze, cpptrace
|
||||
}: stdenv.mkDerivation rec
|
||||
{
|
||||
name = "biu";
|
||||
@@ -10,6 +10,7 @@
|
||||
[
|
||||
magic-enum fmt boost range-v3 nameof zpp-bits eigen libbacktrace hdf5
|
||||
concurrencpp pocketfft yaml-cpp glaze (highfive.override { inherit boost; }) (tgbot-cpp.override { inherit boost; })
|
||||
cpptrace
|
||||
];
|
||||
propagatedBuildInputs = buildInputs;
|
||||
nativeBuildInputs = [ cmake ];
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
# pragma once
|
||||
# include <map>
|
||||
# define BOOST_STACKTRACE_USE_BACKTRACE
|
||||
# include <boost/stacktrace.hpp>
|
||||
# include <biu/atomic.hpp>
|
||||
|
||||
namespace biu
|
||||
@@ -53,15 +51,6 @@ namespace biu
|
||||
// List of objects that is being monitored by ObjectMonitor, {address, type}
|
||||
protected: static Atomic<std::multimap<const void*, std::string_view>> Objects_;
|
||||
|
||||
public: template <typename FinalException> class Exception : public std::exception
|
||||
{
|
||||
protected: const std::string Message_;
|
||||
protected: const boost::stacktrace::stacktrace Stacktrace_;
|
||||
|
||||
public: explicit Exception(const std::string& message);
|
||||
public: const char* what() const noexcept final {return Message_.c_str();}
|
||||
};
|
||||
|
||||
public: template <typename Function> static void try_exec(Function&& function);
|
||||
|
||||
// Monitor the start and end of a function, as well as corresponding thread.
|
||||
@@ -94,12 +83,6 @@ namespace biu
|
||||
public: [[gnu::always_inline]] inline void error(const std::string& message) const;
|
||||
public: [[gnu::always_inline]] inline void info(const std::string& message) const;
|
||||
public: [[gnu::always_inline]] inline void debug(const std::string& message) const;
|
||||
|
||||
public: [[gnu::always_inline]] inline void print_exception
|
||||
(
|
||||
std::optional<std::pair<std::string, std::string>> type_and_message,
|
||||
const boost::stacktrace::stacktrace& stacktrace
|
||||
) const;
|
||||
};
|
||||
friend class Guard;
|
||||
|
||||
|
||||
@@ -5,6 +5,8 @@
|
||||
# include <biu/common.hpp>
|
||||
# include <biu/format.hpp>
|
||||
# include <boost/exception/diagnostic_information.hpp>
|
||||
# include <cpptrace/cpptrace.hpp>
|
||||
# include <cpptrace/from_current.hpp>
|
||||
|
||||
namespace biu
|
||||
{
|
||||
@@ -63,13 +65,6 @@ namespace biu
|
||||
}
|
||||
inline Atomic<std::multimap<const void*, std::string_view>> Logger::Objects_;
|
||||
|
||||
template <typename FinalException> Logger::Exception<FinalException>::Exception(const std::string& message)
|
||||
{
|
||||
Logger::Guard log(message);
|
||||
log.print_exception
|
||||
(std::pair<std::string, std::string>(nameof::nameof_full_type<FinalException>(), message), Stacktrace_);
|
||||
}
|
||||
|
||||
template <typename Function> inline void Logger::try_exec(Function&& function)
|
||||
{
|
||||
Logger::Guard log;
|
||||
@@ -77,8 +72,12 @@ namespace biu
|
||||
catch (...)
|
||||
{
|
||||
log.error(boost::current_exception_diagnostic_information());
|
||||
log.print_exception
|
||||
(std::nullopt, boost::stacktrace::stacktrace::from_current_exception());
|
||||
if (auto&& lock = LoggerConfig_.lock(); lock->Level >= Logger::Level::Error)
|
||||
{
|
||||
static_assert(std::same_as<std::size_t, std::uint64_t>);
|
||||
cpptrace::from_current_exception().print(*lock->Stream);
|
||||
*lock->Stream << std::flush;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,13 +123,13 @@ namespace biu
|
||||
{
|
||||
static_assert(std::same_as<std::size_t, std::uint64_t>);
|
||||
auto time = std::chrono::time_point_cast<std::chrono::milliseconds>(std::chrono::system_clock::now());
|
||||
boost::stacktrace::stacktrace stack;
|
||||
auto frame = cpptrace::stacktrace::current(0, 1).frames[0];
|
||||
# ifdef BIU_LOGGER_SOURCE_ROOT
|
||||
auto source_root = std::string_view(BIU_LOGGER_SOURCE_ROOT "/");
|
||||
auto source_file = stack[0].source_file().starts_with(source_root) ?
|
||||
stack[0].source_file().substr(source_root.size()) : stack[0].source_file();
|
||||
auto source_file = frame.filename.starts_with(source_root) ?
|
||||
frame.filename.substr(source_root.size()) : frame.filename;
|
||||
# else
|
||||
auto source_file = stack[0].source_file();
|
||||
auto source_file = frame.filename;
|
||||
# endif
|
||||
*lock->Stream << "[ {:%T} {:02x} {:02} ] {} (at {}:{} {} )\n"_f
|
||||
(
|
||||
@@ -139,8 +138,8 @@ namespace biu
|
||||
Indent_,
|
||||
message,
|
||||
source_file.empty() ? "??"s : source_file,
|
||||
stack[0].source_line() == 0 ? "??"s : "{}"_f(stack[0].source_line()),
|
||||
stack[0].name()
|
||||
frame.line.has_value() ? "{}"_f(frame.line.value()) : "??"s,
|
||||
frame.symbol
|
||||
) << std::flush;
|
||||
}
|
||||
}
|
||||
@@ -154,26 +153,5 @@ namespace biu
|
||||
return std::forward<T>(value);
|
||||
}
|
||||
|
||||
inline void Logger::Guard::print_exception
|
||||
(
|
||||
std::optional<std::pair<std::string, std::string>> type_and_message,
|
||||
const boost::stacktrace::stacktrace& stacktrace
|
||||
) const
|
||||
{
|
||||
if (type_and_message) log<Level::Error>("{}: {}"_f(type_and_message->first, type_and_message->second));
|
||||
if (auto&& lock = LoggerConfig_.lock(); lock->Level >= Logger::Level::Error)
|
||||
{
|
||||
static_assert(std::same_as<std::size_t, std::uint64_t>);
|
||||
for (auto frame : stacktrace)
|
||||
*lock->Stream << "\tfrom {}:{} {}\n"_f
|
||||
(
|
||||
frame.source_file().empty() ? "??"s : frame.source_file(),
|
||||
frame.source_line() == 0 ? "??"s : "{}"_f(frame.source_line()),
|
||||
frame.name()
|
||||
);
|
||||
*lock->Stream << std::flush;
|
||||
}
|
||||
}
|
||||
|
||||
inline Atomic<std::map<std::size_t, std::size_t>> Logger::Threads_;
|
||||
}
|
||||
|
||||
1
packages/chn-bsub/.envrc
Normal file
1
packages/chn-bsub/.envrc
Normal file
@@ -0,0 +1 @@
|
||||
use flake .#chn-bsub
|
||||
@@ -10,14 +10,14 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
||||
endif()
|
||||
|
||||
find_package(ftxui REQUIRED)
|
||||
find_package(Boost REQUIRED COMPONENTS filesystem iostreams)
|
||||
find_package(range-v3 REQUIRED)
|
||||
find_package(biu REQUIRED)
|
||||
|
||||
add_executable(chn-bsub src/main.cpp)
|
||||
target_compile_features(chn-bsub PUBLIC cxx_std_23)
|
||||
target_link_libraries(chn-bsub PRIVATE fmt::fmt ftxui::screen ftxui::dom ftxui::component Boost::filesystem
|
||||
range-v3::range-v3 biu::biu)
|
||||
target_link_libraries(chn-bsub PRIVATE ftxui::screen ftxui::dom ftxui::component biu::biu)
|
||||
if(BSUB_CONFIG)
|
||||
target_compile_definitions(chn-bsub PRIVATE BSUB_CONFIG="${BSUB_CONFIG}")
|
||||
endif()
|
||||
|
||||
install(TARGETS chn-bsub RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
|
||||
|
||||
2
packages/chn-bsub/bsub.yaml
Normal file
2
packages/chn-bsub/bsub.yaml
Normal file
@@ -0,0 +1,2 @@
|
||||
normal: [ 4, 4, 20 ]
|
||||
normal_1day: [ 4, 7, 28 ]
|
||||
@@ -1,8 +1,10 @@
|
||||
{ stdenv, lib, cmake, pkg-config, ftxui, biu }: stdenv.mkDerivation
|
||||
{ stdenv, cmake, pkg-config, ftxui, biu, bsubConfig ? null, lib }: stdenv.mkDerivation
|
||||
{
|
||||
name = "chn-bsub";
|
||||
src = ./.;
|
||||
buildInputs = [ ftxui biu ];
|
||||
nativeBuildInputs = [ cmake pkg-config ];
|
||||
postInstall = "ln -s chn-bsub $out/bin/chn_bsub";
|
||||
cmakeFlags = lib.optional (bsubConfig != null) [ "-DBSUB_CONFIG=${bsubConfig}" ];
|
||||
passthru = { inherit bsubConfig; };
|
||||
}
|
||||
|
||||
@@ -1,202 +1,177 @@
|
||||
# include <map>
|
||||
# include <filesystem>
|
||||
# include <biu.hpp>
|
||||
# include <ftxui/component/component.hpp>
|
||||
# include <ftxui/component/component_options.hpp>
|
||||
# include <ftxui/component/screen_interactive.hpp>
|
||||
# include <boost/process.hpp>
|
||||
# include <boost/algorithm/string.hpp>
|
||||
# include <biu.hpp>
|
||||
|
||||
# ifndef BSUB_CONFIG
|
||||
# define BSUB_CONFIG "./bsub.yaml"
|
||||
# endif
|
||||
|
||||
using namespace biu::literals;
|
||||
|
||||
int main()
|
||||
{
|
||||
// 需要绑定到界面上的变量
|
||||
struct
|
||||
{
|
||||
std::array<int, 3> vasp_version_selected = {0, 0, 0};
|
||||
std::vector<std::string> vasp_version_entries_level1 = {"640", "631"};
|
||||
std::map<std::string, std::vector<std::string>> vasp_version_entries_level2 =
|
||||
biu::Logger::Guard log;
|
||||
enum class UserCommandType { Continue, Back, Quit };
|
||||
enum class InterfaceType { Request, Confirm };
|
||||
struct
|
||||
{
|
||||
std::optional<UserCommandType> UserCommand;
|
||||
std::string SubmitCommand;
|
||||
InterfaceType CurrentInterface = InterfaceType::Request;
|
||||
int VaspSelected = 0;
|
||||
std::vector<std::string> VaspEntries = { "std", "gam", "ncl" };
|
||||
int QueueSelected = 0;
|
||||
std::vector<std::string> QueueEntries;
|
||||
std::string JobName = []
|
||||
{
|
||||
{"640", {"(default)", "fixc", "optcell_vtst_wannier90", "shmem", "vtst"}},
|
||||
{"631", {"shmem"}}
|
||||
};
|
||||
std::vector<std::string> vasp_version_entries_level3 = {"std", "gam", "ncl"};
|
||||
|
||||
int queue_selected = 0;
|
||||
std::vector<std::string> queue_entries =
|
||||
{
|
||||
"normal_1day", "normal_1week", "normal",
|
||||
"normal_1day_new", "ocean_530_1day", "ocean6226R_1day"
|
||||
};
|
||||
std::map<std::string, std::size_t> max_cores =
|
||||
{
|
||||
{"normal_1day", 28}, {"normal_1week", 28}, {"normal", 20},
|
||||
{"normal_1day_new", 24}, {"ocean_530_1day", 24}, {"ocean6226R_1day", 32}
|
||||
};
|
||||
std::string ncores = "";
|
||||
std::string job_name = []
|
||||
{
|
||||
// /data/gpfs01/jykang/linwei/chn/lammps-SiC
|
||||
// /data/gpfs01/wlin/chn/lammps-SiC
|
||||
std::vector<std::string> paths;
|
||||
boost::split(paths, std::filesystem::current_path().string(),
|
||||
boost::is_any_of("/"));
|
||||
if (paths.size() < 7)
|
||||
return "my-great-job"s;
|
||||
else
|
||||
return paths[5] + "_" + paths.back();
|
||||
boost::split(paths, std::filesystem::current_path().string(), boost::is_any_of("/"));
|
||||
if (paths.size() < 6) return "my-great-job"s;
|
||||
else return paths[4] + "_" + paths.back();
|
||||
}();
|
||||
std::string bsub = "";
|
||||
std::string user_command = "";
|
||||
} state;
|
||||
std::string OutputFile = "output.txt";
|
||||
} State;
|
||||
std::map<std::string, std::array<int, 3>> QueueConfig =
|
||||
YAML::LoadFile(BSUB_CONFIG).as<decltype(QueueConfig)>();
|
||||
State.QueueEntries = QueueConfig
|
||||
| ranges::views::transform([](auto const& item) { return item.first; })
|
||||
| ranges::to_vector;
|
||||
|
||||
// 为组件增加标题栏
|
||||
auto component_with_title = [](std::string title, ftxui::Component component)
|
||||
{
|
||||
return ftxui::Renderer(component, [title, component]
|
||||
{
|
||||
return ftxui::vbox
|
||||
({
|
||||
ftxui::text(title) | ftxui::bgcolor(ftxui::Color::Blue),
|
||||
component->Render(),
|
||||
ftxui::separator()
|
||||
});
|
||||
});
|
||||
};
|
||||
// 为组件增加标题栏
|
||||
auto with_title = [](std::string title, ftxui::Color bgcolor = ftxui::Color::Blue)
|
||||
{
|
||||
return [=](ftxui::Element element)
|
||||
{ return ftxui::vbox(ftxui::text(title) | ftxui::bgcolor(bgcolor), element); };
|
||||
};
|
||||
// 为组件增加下边框
|
||||
auto with_bottom = [](ftxui::Element element)
|
||||
{ return ftxui::vbox(element, ftxui::separatorLight()); };
|
||||
// 为组件增加比较粗的下边框
|
||||
auto with_bottom_heavy = [](ftxui::Element element)
|
||||
{ return ftxui::vbox(element, ftxui::separatorHeavy()); };
|
||||
// 在组件左边增加小标题
|
||||
auto with_subtitle = [](std::string title)
|
||||
{ return [title](ftxui::Element element) { return ftxui::hbox(ftxui::text(title), element); }; };
|
||||
// 带标题的文本输入框
|
||||
auto input = [with_subtitle](std::string* content, std::string title)
|
||||
{
|
||||
return ftxui::Input(content) | ftxui::underlined
|
||||
| ftxui::size(ftxui::WIDTH, ftxui::GREATER_THAN, 3)
|
||||
| ftxui::size(ftxui::HEIGHT, ftxui::EQUAL, 1)
|
||||
| with_subtitle(title);
|
||||
};
|
||||
// 在组件左边增加分割线
|
||||
auto with_separator = [](ftxui::Element element)
|
||||
{ return ftxui::hbox(ftxui::separatorLight(), element); };
|
||||
// 为组件增加空白以填充界面
|
||||
auto with_padding = [](ftxui::Element element)
|
||||
{
|
||||
auto empty = ftxui::emptyElement() | ftxui::flex_grow;
|
||||
return ftxui::vbox(empty, ftxui::hbox(empty, element | ftxui::center, empty), empty);
|
||||
};
|
||||
// 转义字符
|
||||
auto escape = [](std::string str)
|
||||
{
|
||||
return str | ranges::views::transform([](char c)
|
||||
{
|
||||
// only the following characters need to be escaped: $ ` \ " newline * @ space tab
|
||||
if (std::set{'$', '`', '\\', '\"', '\n', '*', '@', ' ', '\t'}.contains(c))
|
||||
return '\\' + std::string(1, c);
|
||||
else return std::string(1, c);
|
||||
}) | ranges::views::join("") | ranges::to<std::string>;
|
||||
};
|
||||
|
||||
// 构建界面, 需要至少 25 行 47 列
|
||||
auto screen = ftxui::ScreenInteractive::Fullscreen();
|
||||
auto request_interface = [&state, &screen, &component_with_title]
|
||||
{
|
||||
auto vasp_version_level1 = ftxui::Menu
|
||||
(&state.vasp_version_entries_level1, &state.vasp_version_selected[0])
|
||||
| ftxui::size(ftxui::WIDTH, ftxui::EQUAL, 8);
|
||||
std::vector<ftxui::Component> vasp_version_level2_children;
|
||||
for (auto& i : state.vasp_version_entries_level1)
|
||||
vasp_version_level2_children.push_back(ftxui::Menu
|
||||
(
|
||||
&state.vasp_version_entries_level2[i],
|
||||
&state.vasp_version_selected[1]
|
||||
));
|
||||
auto vasp_version_level2 = ftxui::Container::Tab
|
||||
(
|
||||
vasp_version_level2_children,
|
||||
&state.vasp_version_selected[0]
|
||||
) | ftxui::size(ftxui::WIDTH, ftxui::EQUAL, 27);
|
||||
auto vasp_version_level3 = ftxui::Menu
|
||||
(&state.vasp_version_entries_level3, &state.vasp_version_selected[2])
|
||||
| ftxui::size(ftxui::WIDTH, ftxui::EQUAL, 8);
|
||||
auto vasp_version = component_with_title("Select vasp version:",
|
||||
ftxui::Container::Horizontal
|
||||
({vasp_version_level1, vasp_version_level2, vasp_version_level3})
|
||||
| ftxui::size(ftxui::HEIGHT, ftxui::EQUAL, 5));
|
||||
auto queue = component_with_title("Select queue:",
|
||||
ftxui::Menu(&state.queue_entries, &state.queue_selected)
|
||||
| ftxui::size(ftxui::HEIGHT, ftxui::EQUAL, 6));
|
||||
auto ncores = component_with_title("Input cores you want to use:",
|
||||
ftxui::Input(&state.ncores, "(leave blank to use all cores)"))
|
||||
| ftxui::size(ftxui::HEIGHT, ftxui::EQUAL, 3);
|
||||
auto job_name = component_with_title("Job name:",
|
||||
ftxui::Input(&state.job_name, ""))
|
||||
| ftxui::size(ftxui::HEIGHT, ftxui::EQUAL, 3);
|
||||
auto continue_button = ftxui::Button("Continue",
|
||||
[&]{state.user_command = "continue"; screen.ExitLoopClosure()();});
|
||||
auto quit_button = ftxui::Button("Quit",
|
||||
[&]{state.user_command = "quit"; screen.ExitLoopClosure()();});
|
||||
return ftxui::Container::Vertical
|
||||
// 构建界面
|
||||
auto Screen = ftxui::ScreenInteractive::Fullscreen();
|
||||
auto key_event_handler = [&](ftxui::Event event)
|
||||
{
|
||||
if (event == ftxui::Event::Return)
|
||||
{ State.UserCommand = UserCommandType::Continue; Screen.ExitLoopClosure()(); return true; }
|
||||
else return false;
|
||||
};
|
||||
auto InterfaceRequest = ftxui::Container::Vertical
|
||||
({
|
||||
ftxui::Container::Horizontal
|
||||
({
|
||||
vasp_version, queue, ncores, job_name,
|
||||
ftxui::Container::Horizontal({continue_button, quit_button})
|
||||
}) | ftxui::borderHeavy
|
||||
| ftxui::size(ftxui::WIDTH, ftxui::EQUAL, 47)
|
||||
| ftxui::size(ftxui::HEIGHT, ftxui::EQUAL, 24);
|
||||
}();
|
||||
auto confirm_interface = [&state, &screen, &component_with_title]
|
||||
{
|
||||
ftxui::InputOption input_option;
|
||||
input_option.multiline = true;
|
||||
return ftxui::Container::Vertical
|
||||
ftxui::Menu(&State.VaspEntries, &State.VaspSelected) | with_title("VASP variant:"),
|
||||
ftxui::Menu(&State.QueueEntries, &State.QueueSelected)
|
||||
| with_title("Queue:") | with_separator
|
||||
}) | with_bottom_heavy,
|
||||
input(&State.JobName, "Job name: "),
|
||||
input(&State.OutputFile, "Output file: "),
|
||||
// 操作按钮
|
||||
ftxui::Container::Horizontal
|
||||
({
|
||||
component_with_title
|
||||
(
|
||||
"Double check & modify submit command:",
|
||||
ftxui::Input(&state.bsub, "", input_option)
|
||||
)
|
||||
| ftxui::size(ftxui::HEIGHT, ftxui::EQUAL, 7),
|
||||
ftxui::Container::Horizontal
|
||||
({
|
||||
ftxui::Button("Submit",
|
||||
[&]{state.user_command = "submit"; screen.ExitLoopClosure()();}),
|
||||
ftxui::Button("Quit",
|
||||
[&]{state.user_command = "quit"; screen.ExitLoopClosure()();}),
|
||||
ftxui::Button("Back",
|
||||
[&]{state.user_command = "back"; screen.ExitLoopClosure()();})
|
||||
}),
|
||||
ftxui::Renderer([]{return ftxui::vbox
|
||||
({
|
||||
ftxui::separator(),
|
||||
ftxui::text("Source code:"),
|
||||
ftxui::text("https://github.com/CHN-beta/chn_bsub.git"),
|
||||
ftxui::text("Star & PR are welcome!"),
|
||||
});})
|
||||
}) | ftxui::borderHeavy
|
||||
| ftxui::size(ftxui::WIDTH, ftxui::EQUAL, 47)
|
||||
| ftxui::size(ftxui::HEIGHT, ftxui::EQUAL, 14);
|
||||
}();
|
||||
ftxui::Button("Continue (Enter)",
|
||||
[&]{ State.UserCommand = UserCommandType::Continue; Screen.ExitLoopClosure()(); }),
|
||||
ftxui::Button("Quit",
|
||||
[&]{ State.UserCommand = UserCommandType::Quit; Screen.ExitLoopClosure()(); })
|
||||
}),
|
||||
}) | ftxui::borderHeavy | with_padding | ftxui::CatchEvent(key_event_handler);
|
||||
auto InterfaceConfirm = ftxui::Container::Vertical
|
||||
({
|
||||
ftxui::Input(&State.SubmitCommand, "", ftxui::InputOption{.multiline = true})
|
||||
| with_title("Double check & modify submit command:") | with_bottom_heavy,
|
||||
ftxui::Container::Horizontal
|
||||
({
|
||||
ftxui::Button("Submit (Enter)",
|
||||
[&]{State.UserCommand = UserCommandType::Continue; Screen.ExitLoopClosure()();}),
|
||||
ftxui::Button("Back",
|
||||
[&]{State.UserCommand = UserCommandType::Back; Screen.ExitLoopClosure()();}),
|
||||
ftxui::Button("Quit",
|
||||
[&]{State.UserCommand = UserCommandType::Quit; Screen.ExitLoopClosure()();})
|
||||
})
|
||||
}) | ftxui::borderHeavy | with_padding | ftxui::CatchEvent(key_event_handler);
|
||||
|
||||
// 实际投递任务
|
||||
auto submit = [](std::string bsub)
|
||||
{
|
||||
// replace \n with space
|
||||
boost::replace_all(bsub, "\n", " ");
|
||||
auto process = boost::process::child
|
||||
(
|
||||
boost::process::search_path("sh"), "-c", bsub,
|
||||
boost::process::std_in.close(),
|
||||
boost::process::std_out > stdout,
|
||||
boost::process::std_err > stderr
|
||||
);
|
||||
process.wait();
|
||||
};
|
||||
|
||||
// 进入事件循环
|
||||
while (true)
|
||||
{
|
||||
screen.Loop(request_interface);
|
||||
if (state.user_command == "quit")
|
||||
return EXIT_FAILURE;
|
||||
else if (state.user_command != "continue")
|
||||
throw std::runtime_error("user_command is not recognized");
|
||||
state.bsub = fmt::format
|
||||
(
|
||||
"bsub -J '{}'\n-q {}\n-n {}\n-R 'span[hosts=1]'\n-o 'output.txt'\nchn_vasp.sh {}",
|
||||
state.job_name,
|
||||
state.queue_entries[state.queue_selected],
|
||||
state.ncores.empty() ? state.max_cores[state.queue_entries[state.queue_selected]] :
|
||||
std::stoi(state.ncores),
|
||||
[&]
|
||||
{
|
||||
auto version_level1 = state.vasp_version_entries_level1[state.vasp_version_selected[0]];
|
||||
auto version_level2 = state.vasp_version_entries_level2[version_level1]
|
||||
[state.vasp_version_selected[1]];
|
||||
auto version_level3 = state.vasp_version_entries_level3[state.vasp_version_selected[2]];
|
||||
return fmt::format
|
||||
(
|
||||
"{}{}_{}",
|
||||
version_level1,
|
||||
version_level2 == "(default)" ? ""s : "_" + version_level2,
|
||||
version_level3
|
||||
);
|
||||
}()
|
||||
);
|
||||
screen.Loop(confirm_interface);
|
||||
if (state.user_command == "quit")
|
||||
return EXIT_FAILURE;
|
||||
else if (state.user_command == "back")
|
||||
continue;
|
||||
else if (state.user_command != "submit")
|
||||
throw std::runtime_error("user_command is not recognized");
|
||||
submit(state.bsub);
|
||||
break;
|
||||
}
|
||||
// 进入事件循环
|
||||
while (true)
|
||||
{
|
||||
if (State.CurrentInterface == InterfaceType::Request)
|
||||
{
|
||||
State.UserCommand.reset();
|
||||
Screen.Loop(InterfaceRequest);
|
||||
if (State.UserCommand == UserCommandType::Quit) return 0;
|
||||
else if (State.UserCommand == UserCommandType::Continue)
|
||||
{
|
||||
State.CurrentInterface = InterfaceType::Confirm;
|
||||
State.SubmitCommand = [&]
|
||||
{
|
||||
auto [nproc, nthr, ncpu] = QueueConfig.at(State.QueueEntries[State.QueueSelected]);
|
||||
auto args = std::vector<std::string>
|
||||
{
|
||||
"bsub",
|
||||
"-J {} -o {}"_f(escape(State.JobName), escape(State.OutputFile)),
|
||||
"-q {} -n {} -R 'span[hosts=1]'"_f(escape(State.QueueEntries[State.QueueSelected]), ncpu),
|
||||
"vasp-intel mpirun -n {} -x OMP_NUM_THREADS={} vasp-{}"_f
|
||||
(nproc, nthr, State.VaspEntries[State.VaspSelected])
|
||||
};
|
||||
return args | ranges::views::join(" \\\n ") | ranges::to<std::string>;
|
||||
}();
|
||||
}
|
||||
else if (!State.UserCommand) return EXIT_FAILURE;
|
||||
else std::unreachable();
|
||||
}
|
||||
else if (State.CurrentInterface == InterfaceType::Confirm)
|
||||
{
|
||||
State.UserCommand.reset();
|
||||
Screen.Loop(InterfaceConfirm);
|
||||
if (State.UserCommand == UserCommandType::Quit) return 0;
|
||||
else if (State.UserCommand == UserCommandType::Back) { State.CurrentInterface = InterfaceType::Request; }
|
||||
else if (State.UserCommand == UserCommandType::Continue)
|
||||
{
|
||||
// 提交任务
|
||||
log.debug("submit command: {}"_f(State.SubmitCommand));
|
||||
// -c 对 \\n 的处理与通常情况下不同,我们需要用 -s 然后将命令通过标准输入传入
|
||||
biu::exec<{.SearchPath = true, .Stdin = biu::IoType::String}>
|
||||
({.Program = "sh", .Args = { "-s"}, .Stdin = State.SubmitCommand});
|
||||
break;
|
||||
}
|
||||
else if (!State.UserCommand) return EXIT_FAILURE;
|
||||
else std::unreachable();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,11 +14,7 @@ inputs: rec
|
||||
};
|
||||
v-sim = inputs.pkgs.callPackage ./v-sim.nix { src = inputs.topInputs.v-sim; };
|
||||
concurrencpp = inputs.pkgs.callPackage ./concurrencpp.nix { src = inputs.topInputs.concurrencpp; };
|
||||
matplotplusplus = inputs.pkgs.callPackage ./matplotplusplus.nix
|
||||
{
|
||||
src = inputs.topInputs.matplotplusplus;
|
||||
stdenv = inputs.pkgs.clang18Stdenv;
|
||||
};
|
||||
matplotplusplus = inputs.pkgs.callPackage ./matplotplusplus.nix { src = inputs.topInputs.matplotplusplus; };
|
||||
zpp-bits = inputs.pkgs.callPackage ./zpp-bits.nix { src = inputs.topInputs.zpp-bits; };
|
||||
nameof = inputs.pkgs.callPackage ./nameof.nix { src = inputs.topInputs.nameof; };
|
||||
pslist = inputs.pkgs.callPackage ./pslist.nix { src = inputs.topInputs.self.src.pslist; };
|
||||
@@ -67,9 +63,7 @@ inputs: rec
|
||||
inherit nameof zpp-bits tgbot-cpp concurrencpp pocketfft;
|
||||
# TODO: report glaze bug to upstream
|
||||
inherit (inputs.pkgs.pkgs-2411) glaze;
|
||||
stdenv = inputs.pkgs.clang18Stdenv;
|
||||
boost = (inputs.pkgs.boost188.override { extraB2Args = [ "boost.stacktrace.backtrace=on" ]; }).overrideAttrs
|
||||
(prev: { buildInputs = prev.buildInputs ++ [(inputs.pkgs.libbacktrace.override { enableStatic = true; })]; });
|
||||
boost = inputs.pkgs.boost188;
|
||||
fmt = inputs.pkgs.fmt_11.overrideAttrs (prev: { patches = prev.patches or [] ++ [ ./biu/fmt.patch ]; });
|
||||
};
|
||||
hpcstat = inputs.pkgs.callPackage ./hpcstat
|
||||
@@ -77,13 +71,8 @@ inputs: rec
|
||||
openxlsx = inputs.pkgs.callPackage ./openxlsx.nix { src = inputs.topInputs.openxlsx; };
|
||||
sqlite-orm = inputs.pkgs.callPackage ./sqlite-orm.nix { src = inputs.topInputs.sqlite-orm; };
|
||||
mkPnpmPackage = inputs.pkgs.callPackage ./mkPnpmPackage.nix {};
|
||||
sbatch-tui = inputs.pkgs.callPackage ./sbatch-tui { inherit biu; stdenv = inputs.pkgs.clang18Stdenv; };
|
||||
ufo = inputs.pkgs.callPackage inputs.topInputs.ufo
|
||||
{
|
||||
inherit biu matplotplusplus;
|
||||
tbb = inputs.pkgs.tbb_2022;
|
||||
stdenv = inputs.pkgs.clang18Stdenv;
|
||||
};
|
||||
sbatch-tui = inputs.pkgs.callPackage ./sbatch-tui { inherit biu; };
|
||||
ufo = inputs.pkgs.callPackage ./ufo { inherit biu matplotplusplus; tbb = inputs.pkgs.tbb_2022; };
|
||||
chn-bsub = inputs.pkgs.callPackage ./chn-bsub { inherit biu; };
|
||||
py4vasp = inputs.pkgs.python3Packages.callPackage ./py4vasp.nix { src = inputs.topInputs.py4vasp; };
|
||||
pocketfft = inputs.pkgs.callPackage ./pocketfft.nix { src = inputs.topInputs.pocketfft; };
|
||||
@@ -112,14 +101,14 @@ inputs: rec
|
||||
];
|
||||
};
|
||||
stickerpicker = inputs.pkgs.python3Packages.callPackage ./stickerpicker.nix { src = inputs.topInputs.stickerpicker; };
|
||||
info = inputs.pkgs.callPackage ./info { inherit biu; stdenv = inputs.pkgs.clang18Stdenv; };
|
||||
info = inputs.pkgs.callPackage ./info { inherit biu; };
|
||||
blog = inputs.pkgs.callPackage inputs.topInputs.blog
|
||||
{
|
||||
inherit (inputs.topInputs) hextra;
|
||||
buildProxy = inputs.pkgs.lib.mkBuildproxy ./blog-buildproxy.nix;
|
||||
};
|
||||
phono3py = inputs.pkgs.python3Packages.callPackage ./phono3py.nix { src = inputs.topInputs.phono3py; };
|
||||
vm = inputs.pkgs.callPackage ./vm { inherit biu; stdenv = inputs.pkgs.clang18Stdenv; };
|
||||
vm = inputs.pkgs.callPackage ./vm { inherit biu; };
|
||||
oneapiPackages = inputs.pkgs.lib.makeScope inputs.pkgs.newScope (final:
|
||||
{
|
||||
stdenv = inputs.pkgs.callPackage ./oneapi/stdenv.nix { src = inputs.topInputs.self.src.oneapi; inherit gccFull; };
|
||||
@@ -137,16 +126,17 @@ inputs: rec
|
||||
speedtest = inputs.pkgs.callPackage ./speedtest.nix { src = inputs.topInputs.speedtest; };
|
||||
atat = inputs.pkgs.callPackage ./atat.nix { src = inputs.topInputs.self.src.atat; };
|
||||
atomkit = inputs.pkgs.callPackage ./atomkit.nix { src = inputs.topInputs.self.src.atomkit; };
|
||||
xinli = inputs.pkgs.callPackage ./xinli { inherit biu; stdenv = inputs.pkgs.clang18Stdenv; };
|
||||
xinli = inputs.pkgs.callPackage ./xinli { inherit biu; };
|
||||
pybinding = inputs.pkgs.pkgs-2411.python310Packages.callPackage ./pybinding
|
||||
{
|
||||
src = inputs.topInputs.pybinding;
|
||||
buildProxy = inputs.pkgs.lib.mkBuildproxy ./pybinding/proxy.nix;
|
||||
};
|
||||
brokenaxes = inputs.pkgs.python3Packages.callPackage ./brokenaxes.nix { src = inputs.topInputs.brokenaxes; };
|
||||
missgram = inputs.pkgs.callPackage ./missgram { inherit biu sqlgen; stdenv = inputs.pkgs.clang18Stdenv; };
|
||||
missgram = inputs.pkgs.callPackage ./missgram { inherit biu sqlgen; };
|
||||
sqlgen = inputs.pkgs.callPackage ./sqlgen.nix { src = inputs.topInputs.sqlgen; inherit reflectcpp; };
|
||||
reflectcpp = inputs.pkgs.callPackage ./reflectcpp.nix { src = inputs.topInputs.reflectcpp; };
|
||||
lsf = inputs.pkgs.callPackage ./lsf.nix { src = inputs.topInputs.self.src.lsf; };
|
||||
|
||||
fromYaml = content: builtins.fromJSON (builtins.readFile
|
||||
(inputs.pkgs.runCommand "toJSON" {}
|
||||
|
||||
18
packages/lsf.nix
Normal file
18
packages/lsf.nix
Normal file
@@ -0,0 +1,18 @@
|
||||
{ stdenv, src, autoPatchelfHook, libz }: stdenv.mkDerivation rec
|
||||
{
|
||||
name = "lsf";
|
||||
inherit src;
|
||||
dontConfigure = true;
|
||||
dontBuild = true;
|
||||
buildInputs = [ stdenv.cc.cc libz ];
|
||||
nativeBuildInputs = [ autoPatchelfHook ];
|
||||
autoPatchelfIgnoreMissingDeps = [ "libnvidia-ml.so.1" ];
|
||||
installPhase =
|
||||
''
|
||||
runHook preInstall
|
||||
mkdir -p $out
|
||||
cp -r * $out
|
||||
rm $out/lib/{hwloc_nvml,sec_ego_kerberos,sec_ego_gsskrb,sec_ego_pam_default}.so
|
||||
runHook postInstall
|
||||
'';
|
||||
}
|
||||
@@ -61,7 +61,7 @@ int main()
|
||||
std::string text;
|
||||
std::optional<std::uint32_t> reply_id;
|
||||
// 如果是转发,则直接写链接
|
||||
if (!content.body.note->text)
|
||||
if (!content.body.note->text && content.body.note->renote)
|
||||
text = "转发了[帖子]({}/notes/{})"_f(content.server, content.body.note->id);
|
||||
// 否则(引用或普通帖子)
|
||||
else
|
||||
|
||||
@@ -5,6 +5,7 @@ std::optional<std::int32_t> missgram::tg_send
|
||||
(std::string text, std::optional<std::int32_t> replyId, std::vector<File> files)
|
||||
{
|
||||
using namespace biu::literals;
|
||||
biu::Logger::Guard log;
|
||||
|
||||
// 整理要发送的信息
|
||||
TgBot::Bot bot(config.TelegramBotToken);
|
||||
|
||||
1
packages/ufo
Submodule
1
packages/ufo
Submodule
Submodule packages/ufo added at 19736049c9
@@ -1,44 +1,46 @@
|
||||
{ stdenv, src, writeShellScriptBin, lib, rsync, which, wannier90, hdf5, mpi, mkl }:
|
||||
let vasp = stdenv.mkDerivation
|
||||
{
|
||||
name = "vasp-intel";
|
||||
src = src.vasp;
|
||||
patches = [ ../vtst.patch ];
|
||||
configurePhase =
|
||||
{ stdenv, src, writeShellScriptBin, lib, rsync, which, wannier90, hdf5, mpi, mkl, prrte }:
|
||||
let
|
||||
vasp = stdenv.mkDerivation
|
||||
{
|
||||
name = "vasp-intel";
|
||||
src = src.vasp;
|
||||
patches = [ ../vtst.patch ];
|
||||
configurePhase =
|
||||
''
|
||||
cp ${./makefile.include} makefile.include
|
||||
chmod +w makefile.include
|
||||
cp ${../constr_cell_relax.F} src/constr_cell_relax.F
|
||||
cp -r ${src.vtst.patch}/vtstcode6.4.3/* src
|
||||
chmod -R +w src
|
||||
'';
|
||||
buildInputs = [ hdf5 wannier90 mkl ];
|
||||
nativeBuildInputs = [ rsync which mpi ];
|
||||
installPhase =
|
||||
''
|
||||
mkdir -p $out/bin
|
||||
for i in std gam ncl; do cp bin/vasp_$i $out/bin/vasp-$i; done
|
||||
'';
|
||||
# NIX_DEBUG = "7";
|
||||
enableParallelBuilding = true;
|
||||
env = { DEPS = "1"; MKLROOT = mkl; OMPI_F90 = "ifx"; };
|
||||
};
|
||||
wrapper = writeShellScriptBin "vasp-intel"
|
||||
''
|
||||
cp ${./makefile.include} makefile.include
|
||||
chmod +w makefile.include
|
||||
cp ${../constr_cell_relax.F} src/constr_cell_relax.F
|
||||
cp -r ${src.vtst.patch}/vtstcode6.4.3/* src
|
||||
chmod -R +w src
|
||||
'';
|
||||
buildInputs = [ hdf5 wannier90 mkl ];
|
||||
nativeBuildInputs = [ rsync which mpi ];
|
||||
installPhase =
|
||||
''
|
||||
mkdir -p $out/bin
|
||||
for i in std gam ncl; do cp bin/vasp_$i $out/bin/vasp-$i; done
|
||||
'';
|
||||
# NIX_DEBUG = "7";
|
||||
enableParallelBuilding = true;
|
||||
env = { DEPS = "1"; MKLROOT = mkl; OMPI_F90 = "ifx"; };
|
||||
};
|
||||
in writeShellScriptBin "vasp-intel"
|
||||
''
|
||||
export PATH=${vasp}/bin:${mpi}/bin''${PATH:+:$PATH}
|
||||
export PATH=${vasp}/bin:${mpi}/bin:${mpi.dev}/bin:${prrte}/bin:${prrte.dev}/bin''${PATH:+:$PATH}
|
||||
|
||||
# set OMP_NUM_THREADS if SLURM_CPUS_PER_TASK is set
|
||||
if [ -z "$OMP_NUM_THREADS" ] && [ -n "$SLURM_CPUS_PER_TASK" ]; then
|
||||
export OMP_NUM_THREADS=$SLURM_CPUS_PER_TASK
|
||||
fi
|
||||
# set OMP_NUM_THREADS to 1 if not set
|
||||
if [ -z "$OMP_NUM_THREADS" ]; then
|
||||
export OMP_NUM_THREADS=1
|
||||
fi
|
||||
# set OMP_STACKSIZE to 512M if not set
|
||||
if [ -z "$OMP_STACKSIZE" ]; then
|
||||
export OMP_STACKSIZE=512m
|
||||
fi
|
||||
# set OMP_NUM_THREADS if SLURM_CPUS_PER_TASK is set
|
||||
if [ -z "$OMP_NUM_THREADS" ] && [ -n "$SLURM_CPUS_PER_TASK" ]; then
|
||||
export OMP_NUM_THREADS=$SLURM_CPUS_PER_TASK
|
||||
fi
|
||||
# set OMP_NUM_THREADS to 1 if not set
|
||||
if [ -z "$OMP_NUM_THREADS" ]; then
|
||||
export OMP_NUM_THREADS=1
|
||||
fi
|
||||
# set OMP_STACKSIZE to 512M if not set
|
||||
if [ -z "$OMP_STACKSIZE" ]; then
|
||||
export OMP_STACKSIZE=512m
|
||||
fi
|
||||
|
||||
exec "$@"
|
||||
''
|
||||
exec "$@"
|
||||
'';
|
||||
in wrapper // { passthru = wrapper.passthru // { inherit mpi; }; }
|
||||
|
||||
Reference in New Issue
Block a user