Compare commits

...

153 Commits

Author SHA1 Message Date
chn
9531f60b05 archive 2024-07-26 17:30:51 +08:00
chn
e0e9ae9ad3 try some 2024-07-26 15:35:36 +08:00
chn
599776b33d 暂存 2024-07-25 21:43:14 +08:00
chn
bb558e5447 add mingwW64Static 2024-07-25 18:21:34 +08:00
chn
086281c6ad localPackages.winjob: try to fix unix socket binding 2024-07-25 18:13:42 +08:00
chn
a39966adab devices.nas: add nat 2024-07-25 15:40:19 +08:00
chn
f294f7e11b devices.nas: fix kvm network 2024-07-25 14:33:09 +08:00
chn
0d6d1f43e6 localPackages.winjob: 尝试 grpc 2024-07-25 14:31:29 +08:00
chn
9b8a0ce08a devices.nas: enable docker and kvm 2024-07-24 22:59:20 +08:00
chn
a6a629e657 devices.nas: enable xrdp 2024-07-24 22:58:10 +08:00
chn
ae4774d118 localPackages.winjob: implement read owner of file on Windows 2024-07-24 21:27:13 +08:00
chn
8c6a25906d services.meilisearch: fix 2024-07-24 13:19:35 +08:00
chn
a032f5b147 devices.nas: remove unused services 2024-07-24 13:15:01 +08:00
chn
a8d2014cf2 Revert "devices: remove surface"
This reverts commit 7bac949a8e.
2024-07-24 09:19:26 +08:00
chn
0abc2fb74e move nas to home 2024-07-24 09:15:17 +08:00
chn
c2d94b197c system.nixpkgs: fix c-blosc build 2024-07-23 21:53:46 +08:00
chn
fb9dc40813 devices.pc: remove root2 2024-07-23 17:48:53 +08:00
chn
77ce521f88 devices.nas: use desktop-fat package set 2024-07-22 21:48:03 +08:00
chn
aac97bbf09 packages.server: add rr 2024-07-22 11:40:22 +08:00
chn
4e72a44d4e devices.nas: move hpcstat to xmupc1 2024-07-22 10:35:14 +08:00
chn
946ff559c0 update aagl 2024-07-20 09:14:56 +08:00
chn
13d7bc7c66 services.beesd & xray: lower log level 2024-07-20 09:00:50 +08:00
chn
7bac949a8e devices: remove surface 2024-07-20 08:54:02 +08:00
chn
fdbc7d0931 packages: move some packages from workstation to desktop-extra 2024-07-20 08:54:02 +08:00
chn
8fec364ae6 Revert "devices.pc.beesd: set loadAverage to 8"
This reverts commit 3d05e92553cde8b48020bd79549558334059409b.
2024-07-20 08:54:02 +08:00
chn
575b49c6cb packages.git: fix 2024-07-20 08:54:02 +08:00
chn
a35a65d54b devices.surface: change wallpaper 2024-07-20 08:54:02 +08:00
chn
3156219ae0 packages.git: workaround for lfs ssh multiplexing 2024-07-20 08:54:02 +08:00
chn
d8c236a6e7 localPackages.git-lfs-transfer: init 2024-07-20 08:54:02 +08:00
chn
ced74597d6 fix yubikey-touch-detector 2024-07-20 08:54:02 +08:00
chn
8a5cf1a721 devices.pc.beesd: set loadAverage to 8 2024-07-20 08:54:02 +08:00
chn
b19602c33f deivces.pc: remove linwei-stuff and lammps-SiC 2024-07-20 08:54:02 +08:00
chn
d48e55e280 services.ollama: init 2024-07-20 08:53:56 +08:00
chn
135df14fff services.fz-new-order: remove manager 2024-07-11 21:58:28 +08:00
chn
52cd11dd2b 整理打包 2024-07-11 19:31:59 +08:00
chn
b9f287e089 add note 2024-07-11 16:18:33 +08:00
chn
bffe5b809d disable ccache for cuda 2024-07-10 07:33:14 +08:00
chn
4753943bbe Merge branch 'production' into next 2024-07-09 23:49:16 +08:00
chn
2d91bd4ea0 system.gui: try to fix kde 2024-07-09 23:38:30 +08:00
chn
8270fa73df add todo 2024-07-09 20:43:47 +08:00
chn
a1097b60e9 user.chn.plasma.theme: disable kinetic scrolling 2024-07-09 20:21:28 +08:00
chn
f8aca249b8 add todo 2024-07-09 19:49:52 +08:00
chn
1d581eb756 fix ccache 2024-07-09 17:30:26 +08:00
chn
414685c95a system.nixpkgs: enable ccache for chromium 2024-07-08 23:48:22 +08:00
chn
745d7613b8 system.nix: remove some nix daemon resource limit 2024-07-08 21:18:34 +08:00
chn
0d61d71fdb fix dev 2024-07-08 21:17:39 +08:00
chn
84bdee3f93 system.nixpkgs: disable contentAddressedByDefault 2024-07-07 23:28:18 +08:00
chn
99e4e9da89 fix u2f 2024-07-07 15:42:26 +08:00
chn
34a82e7a53 devices.xmupc2: add archive directories 2024-07-07 14:56:04 +08:00
chn
ba270a2830 add todo 2024-07-06 10:37:45 +08:00
chn
4c6f25118d Revert "devices.pc: disable native build"
This reverts commit 0026ff0382.
2024-07-06 10:31:05 +08:00
chn
42484394f1 system.nixpkgs: enable content-addressed store only on native 2024-07-06 09:12:38 +08:00
chn
24405876d1 fix build 2024-07-05 20:26:16 +08:00
chn
0026ff0382 devices.pc: disable native build 2024-07-05 20:08:21 +08:00
chn
a9eda967cf update everything 2024-07-05 20:04:35 +08:00
chn
93c6869896 try to fix amdgpu 2024-07-05 18:59:50 +08:00
chn
24f3d75f4b devices.pc: add archive dir 2024-07-05 16:17:57 +08:00
chn
bc7561ed10 localPackages.misskey: fix 2024-07-05 15:17:57 +08:00
chn
2929d620a4 fix build 2024-07-05 09:29:55 +08:00
chn
6de39f3eba Merge branch 'production' into next 2024-07-04 22:50:46 +08:00
chn
21b4246800 localPackages.sbatch: fix 2024-07-04 17:44:01 +08:00
chn
c9626a0c57 packages.ssh: add vps4 2024-07-04 17:35:53 +08:00
chn
90cb6117aa init winjob 2024-07-04 17:28:39 +08:00
chn
af98c9a312 localPackages.biu: giveup support for win32
localPackages.winjob: init
2024-07-04 14:07:12 +08:00
chn
1c1793dd62 devices.vps4: enable znver2 optimization 2024-07-04 13:24:38 +08:00
chn
9b5ccd0747 fix initrd ssh 2024-07-04 11:02:47 +08:00
chn
ca299e0346 try to setup winjob develop env 2024-07-03 22:22:14 +08:00
chn
34e55061a2 localPackages.hpcstat: 删除重复依赖 2024-07-03 16:59:55 +08:00
chn
ec2540a628 localPackages.hpcstat: ssh command add time limit 2024-07-03 16:17:38 +08:00
chn
fef4d06de1 localPackages.biu: exec allow set time limit 2024-07-03 16:06:38 +08:00
chn
0e4f1d06a9 localPackages.hpcstat: add lock only when connect to db 2024-07-03 16:03:24 +08:00
chn
88a399769f localPackages.biu: exec allow set time limit 2024-07-03 14:54:06 +08:00
chn
56e14750fe fix 2024-07-03 13:48:37 +08:00
chn
30c5d93685 update everything 2024-07-03 13:42:15 +08:00
chn
a519d7426f update aagl 2024-07-03 12:53:43 +08:00
chn
a89fe55896 system.initrd: fix network 2024-07-03 11:52:57 +08:00
chn
ed349970c2 devices.pcvm: fix 2024-07-03 10:03:04 +08:00
chn
5c9774e906 system.initrd: Enable sulogin on boot failure 2024-07-03 09:58:40 +08:00
chn
76414e846e add pcvm 2024-07-03 07:49:52 +08:00
chn
00e693b7c8 devices.pc: remove nvidia workaround 2024-07-02 13:25:01 +08:00
chn
e6a5cd695e fix initrd ssh and ssh cve 2024-07-02 13:24:01 +08:00
chn
e3c2861cf5 devices.pc: use xanmod by default 2024-07-01 02:41:09 +08:00
chn
01eee80cd2 devices.vps6.xray: add user 2024-06-30 18:44:25 +08:00
chn
4d69011483 devices.pc: Add a second root partition 2024-06-30 10:34:01 +08:00
chn
09cbc8cecd 整理flake 2024-06-29 21:39:16 +08:00
chn
52c6f7b599 remove fluent-kde 2024-06-29 19:00:35 +08:00
chn
952735986d remove win11os-kde 2024-06-29 18:59:42 +08:00
chn
617759b885 remove emacs 2024-06-29 18:58:03 +08:00
chn
c9fed73dcb remove deploy-rs 2024-06-29 18:56:38 +08:00
chn
8bdef9e7f5 devices.pc: add some workaround 2024-06-28 22:51:02 +08:00
chn
ea4670fde6 devices.surface: fix iptsd 2024-06-28 18:56:20 +08:00
chn
4f26f648f0 Revert "devices.surface: remove iptsd config"
This reverts commit 959ca6c9b6.
2024-06-28 18:52:27 +08:00
chn
959ca6c9b6 devices.surface: remove iptsd config 2024-06-28 18:08:40 +08:00
chn
babb01cd42 packages.desktop: remove catppuccin-gtk 2024-06-28 17:06:26 +08:00
chn
1ef3245e52 users.chn: set catppuccin 2024-06-28 16:52:56 +08:00
chn
2f096af374 packages.desktop: add catppuccino theme 2024-06-28 16:25:35 +08:00
chn
af2f8ddb3e services.gitea: fix 2024-06-28 12:51:20 +08:00
chn
2723044b35 write setup script 2024-06-27 19:03:37 +08:00
chn
4a6d58e6a2 devices.vps4: set secrets 2024-06-27 17:40:52 +08:00
chn
93d2999523 fix whalebird 2024-06-27 16:36:12 +08:00
chn
1ded318fed devices.pc: some workaround 2024-06-26 22:02:22 +08:00
chn
be69db5925 update chaotic 2024-06-26 21:19:17 +08:00
chn
5791b79245 temp 2024-06-26 21:08:46 +08:00
chn
094df77b5b packages.desktop-extra: add whalebird 2024-06-26 15:22:13 +08:00
chn
c9778ac500 use breeze theme 2024-06-26 15:11:48 +08:00
chn
3078090edf remove unused themes 2024-06-26 15:01:21 +08:00
chn
3767de3c2a devices.pc: change wifi card 2024-06-26 14:53:27 +08:00
chn
6fc897d5b2 packages.desktop: add whitesur theme 2024-06-26 14:44:42 +08:00
chn
0575ba1cc4 update nixos-hardware 2024-06-26 09:58:53 +08:00
chn
96b58c16fe Revert "user.chn: switch theme to Fluent"
This reverts commit f209baaa0f.
2024-06-25 17:32:29 +08:00
chn
32e1004a2d Revert "system: do not auto mount ipfs"
This reverts commit 85b4404e7a.
2024-06-25 17:32:01 +08:00
chn
85b4404e7a system: do not auto mount ipfs 2024-06-25 17:12:22 +08:00
chn
f209baaa0f user.chn: switch theme to Fluent 2024-06-25 14:31:55 +08:00
chn
46583151f4 devices.pc: disable xrdp 2024-06-25 14:13:13 +08:00
chn
01b766e5ee devices.vps4: setup 2024-06-25 14:03:58 +08:00
chn
6f5a077821 devices.vps6/vps7: add generic specialisation 2024-06-25 09:34:09 +08:00
chn
bc244352b8 devices.vps7: switch to znver2 2024-06-25 06:55:40 +08:00
chn
2be529f590 services.xray: fix 2024-06-24 23:32:31 +08:00
chn
843abfbef9 resolve warnings 2024-06-24 10:48:36 +08:00
chn
e376302c52 hardware.cpus: split config 2024-06-24 10:23:59 +08:00
chn
af8426d40c Merge branch 'production' into next 2024-06-23 19:56:41 +08:00
chn
428d12b7b9 system: enable kubo 2024-06-23 19:41:33 +08:00
chn
47c77e8ce1 system.nixpkgs: fix build 2024-06-23 12:16:01 +08:00
chn
4a1f12adbb packages.vscode: fix plugins 2024-06-23 11:37:49 +08:00
chn
fc0500c547 system.nixpkgs: add electron_28 to permittedInsecurePackages 2024-06-23 11:36:04 +08:00
chn
632e3baae9 system.nixpkgs: remove old electron 2024-06-23 11:35:19 +08:00
chn
c36216802c remove nixpkgs-unstable 2024-06-23 11:33:51 +08:00
chn
98f6fef8fe packages.desktop: remove kwin explicit-sync patch 2024-06-23 11:31:29 +08:00
chn
721c34262b fix build 2024-06-22 18:03:44 +08:00
chn
b56f73d426 update nixpkgs 2024-06-22 16:17:43 +08:00
chn
c4355be79d system.nixpkgs: enable contentAddressedByDefault 2024-06-22 16:12:08 +08:00
chn
21f822e5aa system.nix: enable ca-derivations 2024-06-22 16:04:24 +08:00
chn
2e68c70773 update everything 2024-06-22 16:03:30 +08:00
chn
153687806b packages.ssh: add internal.jykang 2024-06-20 21:00:09 +08:00
chn
35253cff0a localPackages.biu: add serialize test 2024-06-19 20:06:12 +08:00
chn
91b92bd492 localPackages.hpcstat: fix 2024-06-19 11:25:08 +08:00
chn
0198626002 Merge branch 'temp' into production 2024-06-19 11:05:42 +08:00
chn
173dd4a3d7 localPackages.hpcstat: export job detail to excel 2024-06-19 11:05:27 +08:00
chn
1854e294cf modules.user.chn: add new key 2024-06-18 21:52:50 +08:00
chn
b45a9c7a62 packages.ssh: fix forwardX11 2024-06-18 21:49:51 +08:00
chn
858f4c68aa devices.vps6: xray add user 2024-06-18 19:57:32 +08:00
chn
37e6d70561 packages.server: enable mosh 2024-06-18 17:37:43 +08:00
chn
f101038f4a devices.vps7: set beesd loadAverage to 4 2024-06-18 16:01:14 +08:00
chn
412fac9692 services.redis: unset systemd start timeout 2024-06-18 16:01:08 +08:00
chn
4c7d17f001 Revert "devices.vps7: use default kernel"
This reverts commit db1e825cd6.
2024-06-18 09:51:09 +08:00
chn
e8d80daee2 services.huginn: update 2024-06-18 09:49:56 +08:00
chn
8aeb290d0f localPackages.hpcstat: sort before export 2024-06-18 01:23:00 +08:00
chn
0f37c886a4 localPackages.hpcstat: fix export 2024-06-18 01:08:50 +08:00
chn
5940da526d localPackages.hpcstat: 不导出 hpcstat 的登陆次数 2024-06-18 01:02:58 +08:00
chn
df2ac86e1a localPackages.hpcstat: export markdown instead of excel 2024-06-18 00:57:41 +08:00
chn
8bf7e2cb30 add note 2024-06-17 22:43:49 +08:00
chn
96f7056d16 devices.pc: add xanmod specialization 2024-06-17 10:14:51 +08:00
chn
5cc40727db localPackages.chn-bsub: init 2024-06-16 16:10:52 +08:00
128 changed files with 1989 additions and 1837 deletions

View File

@@ -1,6 +1,7 @@
keys: # cat /etc/ssh/ssh_host_ed25519_key.pub | ssh-to-age
- &chn age19ax6vm3pv8rph5tq3mmehd9sy9jk823tw8svsd790r0lkslycquqvlwz9m
- &pc age1ffvr5pqd2lfj24e3fh53s92z6h76fda3du4y4k6r3yjumdwvpfgqzj033a
- &vps4 age1nnd6u8l20julg4jz4l6kw5gmj6h2tsngpm7n8dx59umgw2s66y4shq6jv4
- &vps6 age164tyqklwhdm57tfm5u863mdt2xrzrrzac4py8a0j9y6kzqcjy9zsp073t6
- &vps7 age137x7csalutwvfygvvzpemlsywvdxj3j4z93a50z2sjx03w6zau8q3r5902
- &surface age1ck5vzs0xqx0jplmuksrkh45xwmkm2t05m2wyq5k2w2mnkmn79fxs6tvl3l
@@ -8,12 +9,18 @@ keys: # cat /etc/ssh/ssh_host_ed25519_key.pub | ssh-to-age
- &xmupc1 age1hnarptkze0ujpp05dqr8uma04cxg9zqcx68qgpks5uf5l6rpk5gqhh8wxg
- &xmupc2 age1l4stuz0vr7gs7pqwjrmezam44702jp2vmqaqyxw0l0r42kf9updq4dfhrw
- &pi3b age1yjgswvexp0x0de0sw4u6hamruzeluxccmx2enxazl6pwhhsr2s9qlxdemq
- &pcvm age1jmu4jym0e0xkq5shx2g7ef4xzre94vaxy2n4fcn0kp94dtlupdxqkzyyp7
creation_rules:
- path_regex: devices/pc/.*$
key_groups:
- age:
- *chn
- *pc
- path_regex: devices/vps4/.*$
key_groups:
- age:
- *chn
- *vps4
- path_regex: devices/vps6/.*$
key_groups:
- age:
@@ -49,3 +56,8 @@ creation_rules:
- age:
- *chn
- *pi3b
- path_regex: devices/pcvm/.*$
key_groups:
- age:
- *chn
- *pcvm

View File

@@ -46,22 +46,20 @@ inputs:
nixpkgs.march = "silvermont";
nix.substituters = [ "https://cache.nixos.org/" "https://nix-store.chn.moe" ];
networking = { hostname = "nas"; networkd = {}; };
gui = { enable = true; preferred = false; };
};
hardware = { cpus = [ "intel" ]; gpu.type = "intel"; };
services =
{
snapper.enable = true;
samba = { enable = true; hostsAllowed = "192.168. 127."; shares = { home.path = "/home"; root.path = "/"; }; };
sshd = {};
xray.client = { enable = true; dnsmasq.hosts."git.nas.chn.moe" = "127.0.0.1"; };
groupshare = {};
smartd.enable = true;
beesd.instances =
{
root = { device = "/"; hashTableSizeMB = 4096; threads = 4; };
nix = { device = "/nix"; hashTableSizeMB = 128; };
};
nginx = { enable = true; applications.webdav.instances."local.webdav.chn.moe" = {}; };
wireguard =
{
enable = true;
@@ -69,10 +67,18 @@ inputs:
publicKey = "xCYRbZEaGloMk7Awr00UR3JcDJy4AzVp4QvGNoyEgFY=";
wireguardIp = "192.168.83.4";
};
hpcstat = {};
gitea = { enable = true; hostname = "git.nas.chn.moe"; ssh = { hostname = "office.chn.moe"; port = 5440; }; };
xrdp = { enable = true; hostname = [ "nas.chn.moe" ]; };
firewall.trustedInterfaces = [ "virbr0" ];
};
user.users = [ "chn" "xll" "zem" "yjq" "gb" ];
packages.packageSet = "desktop-extra";
virtualization = { docker.enable = true; kvmHost = { enable = true; gui = true; }; };
};
networking.nat =
{
enable = true;
internalInterfaces = [ "enp3s0" ];
externalInterface = "virbr0";
forwardPorts = [{ sourcePort = 515; proto = "tcp"; destination = "192.168.122.166:515"; }];
};
};
}

View File

@@ -2,26 +2,8 @@ xray-client:
uuid: ENC[AES256_GCM,data:97aX07G5FPumdWcDxnYOs6fRgljXWuwyNXGg1d7zdbUUfNnb,iv:+wAC/DZXsg+evYFA4DMfLw5Ut3ExQl1RgZ/2AsNQDpo=,tag:ebD77muITHof+FQMydWobg==,type:str]
acme:
token: ENC[AES256_GCM,data:OrYgBRU1VPpkpDzYMFHINfPSHsXEKABdZOcgiAiBJKcreBoaSVHUvg==,iv:XIeZPJhzmUi5ZHKBCYN5UA9HWH1K+26SvcIWVrHAYDA=,tag:3F93syLBZjcHwnRRkUEjlw==,type:str]
users:
xll: ENC[AES256_GCM,data:XLSsz6fZ23PPaJS1Y5C3FAOks3wzb2f+Pv8TgyKrDBfMeoLk1M37A00OGJ2wsYxkuR0JV6Uoh+hhRpTUjOQnmLfQrBxPxxP8DA==,iv:jxEZX/flxxduM1sdrYfGHfMtFMYduMg0Lr6hY1pkAPg=,tag:CYy0y1e2S2Txz1OSh+XDHA==,type:str]
zem: ENC[AES256_GCM,data:VCVLfGO9a06XhAOBciFf1u7A5jaQikAt2wZf+dCAi1BglXpM6Hof1yAunadYOwLOBFgGlP19kX53CBBlZtaqZFL2GRDzXP0woQ==,iv:AFYtHCCkzNrllN/fjQ8GKYs2TyV3uj3BsU5n1tBQAmM=,tag:5dP7c5N4yG2NS4T+Vg0Zpg==,type:str]
yjq: ENC[AES256_GCM,data:yn6eGrySCxlRsFioaE2p1qlTHkIGC9l64+edjuDvt232xc+iFeD03EYfuulyr0GxYFwnlAwtaJnyMi5eOrSd1W6HeV3Canzdbw==,iv:qTc6vA8uQza8CB+BvffEN9GqHkiwNM4h9RkqQR14ylk=,tag:UZ2GYCJLjcWLuVXlscLviw==,type:str]
gb: ENC[AES256_GCM,data:jIR3EVdATYUgWmW4J8RdURJRmDBC84t0S/c2EzWwtFMtjgKlqg52fIfQ66i7RnIYRAoF+s4Ex0aLSejWgzQ69NA/AF0AIS7Y/Q==,iv:mvTCTP0E74QlvM8TcY4o49G5kNGs5HFx3YUrj6mCrwM=,tag:LXfIOyAB10XuHA6Cg7LBeQ==,type:str]
nginx:
detectAuth:
chn: ENC[AES256_GCM,data:44vsExbVhO3gnD4Gme92eQ==,iv:LyDvZebs1sDL1/hZQiZdHoPBm4hXtBy56jR73zSH6Aw=,tag:w5xPHnK9XOSS0+97q8b5gQ==,type:str]
maxmind-license: ENC[AES256_GCM,data:JbAnFQiDcJGwvb89sG2ro77nwwOWcDnqVcA902jwb2zzZci7PpXROw==,iv:eifkWK0oN73Ekn3oWzy6XbYK2GU+4tlnLPJ+96WOWJY=,tag:35ulsshxtUfOsSQOLgAt0g==,type:str]
wireguard:
privateKey: ENC[AES256_GCM,data:VPlB4wSbWqSYw3rYRwfAMa39xrPcPZfz7sV2Cq3rmOhifnUPwggxnA+51do=,iv:utnyrB6Yfe5O94Oq4HDVFm/lQ9ZBoyvUT68r2G2PdwA=,tag:snm01vA+z2yKK8d2i5i2ig==,type:str]
telegram:
token: ENC[AES256_GCM,data:NK9Eq3jUaMVNyPyqiXEkrc4m81c2CBg3p9TjpD8TQgKRYs2uxT9lsSrLMi02Rw==,iv:N2mjY9n7QuLD2PG4gNl79c933GTCCfw35XxluiLSuOA=,tag:ZLreEQoV+O0yhHw0CM00aQ==,type:str]
chat: ENC[AES256_GCM,data:XJi6HftAygFH,iv:ea2m41/YXp0VyxR9U84xMCHdknZBhP2QUiX6zsipaFc=,tag:+/Y2bvUwrQsLVGUZp0Imwg==,type:str]
hpcstat:
key: ENC[AES256_GCM,data:3bMieouWGMEw8eu6z55TX66NAGiF/O5dRtnDTjDtNC3fmR4PTn+FreMZuA9+AjTPUm2GsS9esC6tULIzh+qTflnSrxqtTdKAbfqY6o8pPPpDJ9WWm4f/g3x8PnvlsyQDYCZ0MYKYg3cc6n60moCzv1WWlVsT8QUMTXQL3yb36vVzo4ELea4Gf2UkpfYKX89gFDtJK78srh7rj8rwoDiBs1qVUUnIBABUDLxoyC3Rym5yevrCJeFD+8AlIAIaMc62Kslw0lCCKKSaXGsFpppFYFwUTedi595eISEr4tIuPXVd4EECQchsYg+tInphIXebp/5rzXQM37yQEymImNRiMcxDWGR0B8Nq9XO+I5T8VOIb6xXCtvEeY2Z8nPfmUn9UHfvYzqFv3it5TCcd9J4SeBa2LVW8+YCIO/KitznL49O5SGAJUONIkcwMUhUuXQUFe/vnc+g8+yqB5ltCZtHWCOY2pCdmQpBRaZq55fcde5FNhxt3J8zCbu++oIn+ERSHadMIGMuGgGqzG6XDQJZN,iv:cbPCnNi2gX1gZIdcQd7HR3c/JEsWj3nv+x+OQ0bDs40=,tag:olrGr6t2Si39wl/1rR81ig==,type:str]
postgresql:
gitea: ENC[AES256_GCM,data:qssnsnlaEKwEnLbnpX+XDs7JK/2DdK1cxD6U2NddpCPnwfOinP2cuc1HLnteWQfYZXTuYM3VOXDEXQB9CexILA==,iv:+TVoTuqmxIsTlNPngMBBWgIvP5EQD5ROHZI4u0mSJGE=,tag:6X8hewc5a6C6nbuD5WozCQ==,type:str]
mail:
bot: ENC[AES256_GCM,data:ugfBeRM4Ks7j+V4lLOqHrA==,iv:QwXeSrfw+TTN5N42DaaA7YgpaIJX/E+kTv9p6eWSxEk=,tag:fLUDBhsvCbOiYqhq9TCzmw==,type:str]
sops:
kms: []
gcp_kms: []
@@ -46,8 +28,8 @@ sops:
by9Rd0U0bzNiK21BQTNxN1RuQ09DQVkKJmSlzV5ppEkZFljsS17ZWmoI++fz4tJh
kTdoAStG1zsKASHyZTsmdm3RBDO3qV1KhQC2gC7d4EiwNZngxOOZJg==
-----END AGE ENCRYPTED FILE-----
lastmodified: "2024-05-10T08:52:02Z"
mac: ENC[AES256_GCM,data:gKEZ0bxn+xCu7wPRCRpacErzqdajw4zNalUwZvldUP+Ygdq6KOMgjxvm3hy7GIBlhK2MLgps3X3sjdrUW1A7Tx5wiPtrqddVo5qiubZcuWqNO4SSoM2x/VxtHbKcZQMaNdIHXx3TUFjQ0tcsMuDBNNUZ192JJUDE/DaDyxTklq4=,iv:sZ98srsM68h59R9HHeh7gXdUBN2JtoWx+PhU1nsHgk0=,tag:N7211a4Jrp6AdPKhQCz65g==,type:str]
lastmodified: "2024-07-24T05:14:57Z"
mac: ENC[AES256_GCM,data:9xKBuoVeotcZfiqsKg+iXxOc5BV9kGVvR5f9Anu6DauBceYIBxgeVCDU3dRUPz67MkOK/n2w9+gLchQxUyK8G4ECRTESL+GKpZslNVThb2j6vswLXNBHqsQCoQBlYOiKw5ZM1gpdYJPni8qpsdGvTwc5JkW+FH6v1BdZWaUhc3U=,iv:SyLiMXsQhS+8FFlSMXiD9ETD+mIsz6mePXnJzBODK5g=,tag:YpiU58lJ5Nb78EMyEmJdbw==,type:str]
pgp: []
unencrypted_suffix: _unencrypted
version: 3.8.1

View File

@@ -14,14 +14,14 @@ inputs:
btrfs =
{
"/dev/disk/by-uuid/066be4fd-8617-4fe1-9654-c133c2996d33"."/" = "/boot";
"/dev/mapper/root" = { "/nix" = "/nix"; "/nix/rootfs/current" = "/"; };
"/dev/mapper/root1" = { "/nix" = "/nix"; "/nix/rootfs/current" = "/"; };
};
};
decrypt.auto =
{
"/dev/disk/by-uuid/4c73288c-bcd8-4a7e-b683-693f9eed2d81" = { mapper = "root"; ssd = true; };
"/dev/disk/by-uuid/4c73288c-bcd8-4a7e-b683-693f9eed2d81" = { mapper = "root1"; ssd = true; };
"/dev/disk/by-uuid/4be45329-a054-4c20-8965-8c5b7ee6b35d" =
{ mapper = "swap"; ssd = true; before = [ "root" ]; };
{ mapper = "swap"; ssd = true; before = [ "root1" ]; };
};
swap = [ "/dev/mapper/swap" ];
resume = "/dev/mapper/swap";
@@ -55,7 +55,13 @@ inputs:
};
nixpkgs =
{ march = "znver4"; cuda = { enable = true; capabilities = [ "8.9" ]; forwardCompat = false; }; };
kernel = { variant = "cachyos"; patches = [ "cjktty" "hibernate-progress" ]; };
kernel =
{
variant = "xanmod-latest";
patches = [ "cjktty" "hibernate-progress" ];
modules.modprobeConfig =
[ "options iwlwifi power_save=0" "options iwlmvm power_scheme=1" "options iwlwifi uapsd_disable=1" ];
};
networking.hostname = "pc";
sysctl.laptop-mode = 5;
gui.enable = true;
@@ -139,16 +145,14 @@ inputs:
memoryMB = 90112;
gpus."4060" = 1;
};
xrdp = { enable = true; hostname = [ "pc.chn.moe" ]; };
ollama = {};
};
bugs = [ "xmunet" "backlight" "amdpstate" ];
};
boot.kernelParams =
[
"acpi_osi=!" ''acpi_osi="Windows 2015"''
"mt7921e.disable_aspm=y" # 避免休眠恢复后无wifi
"amdgpu.sg_display=0" # 混合模式下避免外接屏幕闪烁,和内置外接屏幕延迟
"acpi.ec_no_wakeup" # 睡眠时避免开盖唤醒
"amdgpu.sg_display=0" # 混合模式下避免外接屏幕闪烁,和内置外接屏幕延迟
];
# 禁止鼠标等在睡眠时唤醒
services.udev.extraRules = ''ACTION=="add", ATTR{power/wakeup}="disabled"'';
@@ -159,7 +163,7 @@ inputs:
hideMounts = true;
users.chn.directories = builtins.map
(dir: { directory = "repo/${dir}"; user = "chn"; group = "chn"; mode = "0755"; })
[ "lammps-SiC" "BPD-paper" "kurumi-asmr" "linwei-stuff" "BPD-paper-old" ];
[ "BPD-paper" "kurumi-asmr" "BPD-paper-old" "SiC-20240705" ];
};
specialisation =
{
@@ -172,6 +176,11 @@ inputs:
};
system.nixos.tags = [ "nvidia" ];
};
cachyos.configuration =
{
nixos.system.kernel.variant = inputs.lib.mkForce "cachyos";
system.nixos.tags = [ "cachyos" ];
};
};
};
}

33
devices/pcvm/default.nix Normal file
View File

@@ -0,0 +1,33 @@
inputs:
{
config =
{
nixos =
{
system =
{
fileSystems =
{
mount =
{
vfat."/dev/disk/by-uuid/AE90-1DD1" = "/boot/efi";
btrfs =
{
"/dev/disk/by-uuid/5a043ec5-7b47-4b0d-ad89-8c3ce5650fcd"."/" = "/boot";
"/dev/mapper/root" = { "/nix" = "/nix"; "/nix/rootfs/current" = "/"; };
};
};
decrypt.auto."/dev/disk/by-uuid/a9e4a508-3f0b-492e-b932-e2019be28615" = { mapper = "root"; ssd = true; };
rollingRootfs = {};
};
grub.installDevice = "efi";
kernel.variant = "xanmod-latest";
networking.hostname = "pcvm";
initrd.sshd.enable = true;
};
hardware.cpus = [ "amd" ];
packages.packageSet = "server";
services.sshd = {};
};
};
}

39
devices/pcvm/secrets.yaml Normal file
View File

@@ -0,0 +1,39 @@
hello: ENC[AES256_GCM,data:7xCy5PqPVdUNIdzqaGQLsPA88mAfRt6T57LjFDwOaTlhdejLPrBdyN4=,iv:dM0QWDpylPjnbtdNrjV8LHISNi/U718+xooFm0qTcbI=,tag:d5HbLG7yF3QRz7nP+4aeiA==,type:str]
example_key: ENC[AES256_GCM,data:K5SD4k9jL5r4ZSUwNQ==,iv:mJrZshT0PKmT7OJE/ZBUWzq1Gc6xXymFbypxwQtQJq8=,tag:I4+AyMh+AVpmWa1fdIJpyA==,type:str]
#ENC[AES256_GCM,data:vHj6+kNand8d1AzgXTaOMQ==,iv:j6b3SDqzVgY8U/puEm9UcpJYGK84gF/YIXzRbG0radQ=,tag:yzfXKHReJ0++3fhk2ztbBA==,type:comment]
example_array:
- ENC[AES256_GCM,data:vRjjfVSy8g5mBZVM/oU=,iv:C+HE4Q157eNhEmcDJSMJINfMgztf6XfELCjotg8q3XU=,tag:JSQDItdYbCCs65tmbeR6tg==,type:str]
- ENC[AES256_GCM,data:xzfN6WiT8r8YcWtS+H4=,iv:btlOvqrn0pITT3rCTIjgS2b5TrfNKym0yPEnE7bJDqg=,tag:Wf40b8zBhrv452OKodkU+w==,type:str]
example_number: ENC[AES256_GCM,data:akqZ12u1wl4Zww==,iv:hS3NBWI7o6dZLtsIsoVHYdtyqpUmbQrpMHPhRRzEd18=,tag:1voFm4LuupWJMGP3xd0k4A==,type:float]
example_booleans:
- ENC[AES256_GCM,data:wWEU8w==,iv:rf8uwo+sP9YFyPmoxROVVmrx+q6Yr0PIOWznM96w9XY=,tag:nVJdD1Z7U8zVRBxs8gLvQQ==,type:bool]
- ENC[AES256_GCM,data:gVe51tg=,iv:eOJ2TOWStHpckNyYx2UdLcipshFpjcWtEids5c+Q8bs=,tag:0iSjlC/TgNfl7ZtXmttgaQ==,type:bool]
sops:
kms: []
gcp_kms: []
azure_kv: []
hc_vault: []
age:
- recipient: age19ax6vm3pv8rph5tq3mmehd9sy9jk823tw8svsd790r0lkslycquqvlwz9m
enc: |
-----BEGIN AGE ENCRYPTED FILE-----
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSAyTGliaUlvOVlxejZhSDZi
YU96S0VPOE5Ldk56WlJjTzBSRm9oYnBoQ0NBCnhJWmg3KzUrT1VyemRiSWtQeklS
UFFFTjdod0g1d1EvYWJoOElJSjIrWTgKLS0tIDlaQnJOMTZRUms4am1mQjV5MzFJ
QlhKL1ltY2lGZGU0clhIRTRsSW5BOTgK4gKbhvF1bV/YdKOxzqrecHPDAKPOd81V
YnWgLpP6h+zycx80iqwsfqiQJdPyDrfhB43ksn2oxsX0qXtLI9j9TQ==
-----END AGE ENCRYPTED FILE-----
- recipient: age1jmu4jym0e0xkq5shx2g7ef4xzre94vaxy2n4fcn0kp94dtlupdxqkzyyp7
enc: |
-----BEGIN AGE ENCRYPTED FILE-----
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSAzRU1IRXZkbFQ4elgydTlv
VlRVKzJIWDVCZk5xaTd0Y2JXS2l0Mi85Zm1jCnNkS0NETm5SaG9WUE9Mb3RtbE5B
YTRmWHNXTk9hZHNBT0FxT1RNNnFMNEkKLS0tIGRWNWpLcDVtOEdGZHFPT3paeVo2
QWsreTlaVW5Bd2lZb3JZeTdjcG9WQlEKy3p4QnjPrJtfaueLKBzMz7VZ9QfrTer1
lEP8mInFprR65LtpoKabsTWQwkzURzB/OdbKSYG2o6Rlqy9L3d5eBw==
-----END AGE ENCRYPTED FILE-----
lastmodified: "2024-07-02T23:46:35Z"
mac: ENC[AES256_GCM,data:OncqYSgPSoge5Nw6eh0A4cm0KXSQhmSpGIu5WSv38LdMto5fNLIK2VRIwaXfq9nyf10bxNN7xSADj2GPhMiwlHM8nIQXtxdlWsZfEOc/qOWM8nz+9DPKtKGD6RZcDLDRhNTDxzPXGWIuY1tDKQpUlt/iDlymSskcqSrdTfBqCGk=,iv:NesxRr6FXXApE8aafnAV3x6hwCoAxoEly/QkcyAQ8Pw=,tag:3o37dr4vKLqEENIdj8RHXw==,type:str]
pgp: []
unencrypted_suffix: _unencrypted
version: 3.8.1

View File

@@ -60,7 +60,7 @@ inputs:
services.iptsd.config =
{
Touch = { DisableOnPalm = true; DisableOnStylus = true; Overshoot = 0.5; };
Contacts = { Neutral = "Average"; NeutralValue = 100; };
Contacts = { Neutral = "Average"; NeutralValue = 10; };
};
};
}

View File

@@ -12,19 +12,25 @@ inputs:
{
btrfs =
{
"/dev/disk/by-uuid/24577c0e-d56b-45ba-8b36-95a848228600"."/boot" = "/boot";
"/dev/disk/by-uuid/403fe853-8648-4c16-b2b5-3dfa88aee351"."/boot" = "/boot";
"/dev/mapper/root" = { "/nix" = "/nix"; "/nix/rootfs/current" = "/"; };
};
};
decrypt.manual =
{
enable = true;
devices."/dev/disk/by-uuid/bf7646f9-496c-484e-ada0-30335da57068" = { mapper = "root"; ssd = true; };
delayedMount = [ "/" ];
};
swap = [ "/nix/swap/swap" ];
rollingRootfs = {};
};
grub.installDevice = "/dev/disk/by-path/pci-0000:00:05.0-scsi-0:0:0:0";
grub.installDevice = "/dev/disk/by-path/pci-0000:00:04.0";
nixpkgs.march = "znver2";
nix.substituters = [ "https://cache.nixos.org/" "https://nix-store.chn.moe" ];
initrd.sshd.enable = true;
networking = { hostname = "vps4"; networkd = {}; };
kernel.variant = "cachyos-server";
kernel.variant = "xanmod-latest";
};
services =
{

View File

@@ -1,58 +1,13 @@
acme:
cloudflare.ini: ENC[AES256_GCM,data:X1v1QuOZemIuxldd1bzIvbUsq+8HMGLh91zUB+fnrxaW40z0OQh9L1rF/0Nj3gmUmgT4KEV7nkHFYYpZBp4/Kyc=,iv:fQmbhx9wV3l+DVPaBrAyJbTCsS3q3s5F9Go1F7pZ2pQ=,tag:P4vuruX460YSOUsx6zGHXQ==,type:str]
frp:
token: ENC[AES256_GCM,data:T8b1ku4HNCNSJ+33QgIt1GILFA4wTu3Qd0rDqHPVgdqsGo0R90k0u8z+dElSO7q9PapTqUbZ,iv:hwnMu6JxfYLgw4TyhujX5dI2IAytgZh+Bexhgta6ATQ=,tag:lqgwvXlS/jGPxasmk5Vh3w==,type:str]
xray-server:
clients:
#ENC[AES256_GCM,data:DXEC,iv:SZ1AhmK6fWQ/HGDk97kDUcRN84zQMp99eiz4SpRhig8=,tag:Fkdf28ZvB8XKCxSYdjuuHw==,type:comment]
user0: ENC[AES256_GCM,data:rJ00sfe/oJSry6Ixn4Bn+p41syqsOrdWv6fRGVCwPvn/unMY,iv:htTvFMvhIRkORA/gIU8J7CgA+tOncYQWh7sUh+F6XDs=,tag:VrSJBD7ti9WtSLHoWjMClw==,type:str]
#ENC[AES256_GCM,data:OVgDU+zqcQ==,iv:8KuEqBuL5Ca6pUOFFA+vySJx/h3BhGAAC0CgnxiW46o=,tag:TY1MajSSy2RjKVI2SSAAFw==,type:comment]
user1: ENC[AES256_GCM,data:S3IHO9FcVHTJOsRxjSohM9MgnrEwLdDpFU+efLkQaXT2jNJG,iv:KOesvPzjDfm1EDLFiegbk0wgjp7di5mUwUuuY2hwvOQ=,tag:ZsYyUyyEhO5S3weCw/gPMw==,type:str]
#ENC[AES256_GCM,data:OQOPobpbbhajgA==,iv:4jG3bHKzWcR+JnvSlJsc0Qlv5kywqVN5UE96J31CP7Q=,tag:P+jJkRxPu99tLXyO5k6dRA==,type:comment]
user2: ENC[AES256_GCM,data:e7ITe2ZouKr8dXT7SYATyzbzHaVeu6AKt1OcQKk3U0nsQgoa,iv:UbOOuojy6OAFEH8lGhKe5Hs+2K6FX5MZ8Br9AB007gs=,tag:5XeB4YngzTcHZvCpXe/ZXA==,type:str]
#ENC[AES256_GCM,data:93BxR0AEdQ==,iv:rf69GWpuxYt7fu1Fyv55pynuQDhi+TA5CwZK3cc3yBo=,tag:/hLy6atNMxLw6G3/qgMM4g==,type:comment]
user3: ENC[AES256_GCM,data:r+6jXaIj4HJoYLnJcnjJB+WEZlGaoSy/ktc1Aw77hFtNrrGp,iv:P+YUKns1yaOZokH5WkDB0jssGyHg3ncc54tF1PyA7Oc=,tag:/pxMEr7l4ye5EDAOsllxJA==,type:str]
#ENC[AES256_GCM,data:4gqZh391hg==,iv:No22DrD6EBs2FA4/qH8msWEjs20fc+ZpEeZep+HIv+c=,tag:aHrYNbI83POI4PRj1nd+Yw==,type:comment]
user4: ENC[AES256_GCM,data:ujiml/r4aFiKOkSJkaD/KE8rKuBtLSnpZREBH3vRJUzDT0QM,iv:a3VFlXpMLNFihvFa7gloANtHmBLg4szTL5LTm8E2kNs=,tag:W9KZ1GAVx9IBKfda7Zedng==,type:str]
#ENC[AES256_GCM,data:PTYBkBHs16U=,iv:qr3u7OveM1CmTBIf9gZK4fTRuLCpcZCwf8jmnd1L3Co=,tag:w3O41NG7yCwCVqPGh/6SXA==,type:comment]
user5: ENC[AES256_GCM,data:iDuLRb4dhLUOjpamioMwoTYrn7Cy+Ln4SaedVXkwVD05rjJ0,iv:AqzBBvLpJuIJCUJq0IyDcHrlqb0e84nQC0c94Rj85uw=,tag:0xou1i/iwAxGngO74OIMXg==,type:str]
#ENC[AES256_GCM,data:D5xiJW0Oyg==,iv:9a/6myiT9Crf/fff6ZkXj/obW2k95cABUNqQdPmcwcc=,tag:chs8BA8YtVkM9m3Ey9ETlA==,type:comment]
user6: ENC[AES256_GCM,data:YzLlf37SxKmU1/QA7gUIJsGid3KZNoAGOew8xR7cmw5l8ZmX,iv:SfKubo2jfjtxKn9odDiokMEZyPFfYZ/wwyYtBrgvgmM=,tag:+hxwIU5uBhzQyrKX4r3oiw==,type:str]
#ENC[AES256_GCM,data:8FxApg==,iv:vPa5p3QVHAvw+ECusWGqx1ugTcHh42CVFDQcMhG59wM=,tag:lHiZtydcYFBQiXnWh8pCrw==,type:comment]
user7: ENC[AES256_GCM,data:H/jje9ONEY6XuBXTZmTVGIcWUgGSMf5OB1NNRPtqGCgRP1ei,iv:xew+0BkRqz3nfOoBXTPbBv5hRczy/3tgYSKq432q4iw=,tag:da2ljcffiCVJCsMZaNPZyQ==,type:str]
#ENC[AES256_GCM,data:QdaYYH3RGJ4qIg==,iv:79NBTEKCPtgVVv3G7wg+vdoLOWxc+bdqT1lF4HJpTC8=,tag:8mRFGjy7lBrdyGyX9vaSOQ==,type:comment]
user8: ENC[AES256_GCM,data:H1gPtqF8vryD0rVH7HYzpMuZ3lufOBYczKwaTr4PidQtTyQK,iv:wh7NwFc/1ogNrnTTpm5L9dBqDVkvWiIsJZelR2mtR4Q=,tag:oEFdMFZJ9UYhsSVdefJ4rg==,type:str]
#ENC[AES256_GCM,data:aYWIiLxs1UvupQ==,iv:AisokHuAzD5B6fEF6ak8WfAe151CM3a8MsaWC4uJPnw=,tag:cdk5S4n9ulyWrqsD+jcqYg==,type:comment]
user9: ENC[AES256_GCM,data:HVK9KvGfOcwn1joc3VrkjBjE6hrxQPOBD5RTtQUgBPepToh6,iv:VK9aQ64L/GajpledBxC8PNB1BdNYEqwcdL3GKttgxvs=,tag:O/piztCYBARtAFxTMNXGaA==,type:str]
#ENC[AES256_GCM,data:b839t/OihMOmz0gIcTo43r2MIw==,iv:8kaAFG7DhFOoitcvbFaAvE1NUSLFrFhy1KiMrqs4r/c=,tag:G4vSADa52ZfN5y5ytoFJoQ==,type:comment]
user10: ENC[AES256_GCM,data:xjVkr/wy7OxRuNZKfQagfNxdVxTEyQP1ZhnR6jHy2gjBQ0RD,iv:G6iOBCHOqlvfEENY/ega/TUm81wgT2OOdZKZ6bPfg9o=,tag:p8AMa3bGsIl0hWQ09lSzgA==,type:str]
#ENC[AES256_GCM,data:+s3MMeNU5Q==,iv:CUrg+nNxCpJFbHQmMNXmSE+JcZK6Dfu8cGwtznx3CFY=,tag:G5CYMtao+hz3hs0fPVPmcw==,type:comment]
user11: ENC[AES256_GCM,data:BIZ2zRgGv5/9AexiZZvu+m4A62YUWtAkjWWMu89GteqpWMBq,iv:13IJcDf18LjoxJk7uoKnuFZT6Ihxrxsy7DBaAaiFqus=,tag:RN7wj+uPneCkqNlMRyYrXw==,type:str]
#ENC[AES256_GCM,data:spyQkQIHwg==,iv:7+0DUK95MPH7lpr+GMbbLu4/5yA11/4gTuLhQKlStfE=,tag:G/gIXML8UhYoCi9FfoTvSA==,type:comment]
user12: ENC[AES256_GCM,data:FAF9lXOzXW9CrZgnQ1a2+E8snZj2+JHqP5Gny92k09o/Wzga,iv:/qZuAtFmUQE7A9lMzJUoCvGx+3Sv9Ioh2ahch3puaC4=,tag:urwbLwGkSX3e85NCjyPhhg==,type:str]
#ENC[AES256_GCM,data:HueqiREBet2bxQ==,iv:WCjTAGg2gXgBSvY3zc/YyB/1X0XjvphPduVXLsjOwH8=,tag:wC+On6lyyYQ1Dt/BHDvONw==,type:comment]
user13: ENC[AES256_GCM,data:ExbnvWDIBqga5+k2mpoT8AKBOXAvUNMjBTPXUKrmtWzz4l+L,iv:UI7CvSx2FHYGf6BEHS4e3iwHZZWkl2Zt5xg2WdKbLvY=,tag:ad0c7YW2Bxo+Dn+BoSZ0Ng==,type:str]
#ENC[AES256_GCM,data:R8lN5T0=,iv:FXLf8Vtjg+PkwNhxXWDViMKqwn7tFMaPhio9zhnudZw=,tag:34gxRH+P9lmkUxlOPKcYMg==,type:comment]
user14: ENC[AES256_GCM,data:dgNPPlJD5JOFPbKhlvlRHBLmUNKeDm/JAiawUVpBE7H07Box,iv:w+t9BkqYvlxVKr+x0MwtBz0/YSR/7z1OnZLIoPdW4gc=,tag:CR3GLbaO0jSQgA2HuwzRqg==,type:str]
telegram:
token: ENC[AES256_GCM,data:xsJoGgQ8pLeZqA2alGKkCyrvnjY6rVF5TlXn4GWDrStFBl65XXzwVY/9ZZthYQ==,iv:qTLfpRUyuIGFM668URfknhSRtx3WEHp/WTGzGUPuFd4=,tag:p8mF0tM+t02g7v2EQZN3Vg==,type:str]
chat: ENC[AES256_GCM,data:X1JxFQw0bPCu,iv:hf+TOSH2p9RdnXDFKxTpSRzxDLdJyzNHVV8MfOQuGWY=,tag:iiWw9IFiBGOOyOSl9Jj2wQ==,type:str]
private-key: ENC[AES256_GCM,data:ts/LRGFAsYqvGvkvlxUI42IW1a8cGsSkpZhMDd3QVceRKvhPb1SRDaXoSw==,iv:6xX9xFIFUNlLBZ6CPBOz9JbHpvC4+QG9ZaCZcWdl12c=,tag:DYIa+QTV8vyl1l7OKKykTw==,type:str]
nginx:
#ENC[AES256_GCM,data:85LrqdTMIhSa,iv:mIQPYz8VPd5AxeMCQEdTGMD0Iqa5QEAa5+8JVFaj3JM=,tag:TcZd7S3WRPpEV9lHI1fzbw==,type:comment]
#ENC[AES256_GCM,data:rVTLpe3uIQ5LArPnEY8N8kjtHq8kZddbqR+nyUaia72Y7PWEfHzy6wgx3Q==,iv:AZEufH3zfVL0XbUh3CQZGYcx6zIMFV4tF+jHf73IplU=,tag:B/UbtQh5dGrctNih2uoO8w==,type:comment]
#ENC[AES256_GCM,data:InzwjKl3R4SJSXTz5u1Pt0kf2HYEtKfSkJO0cbPhhXADNp2/Tn0nwQJFy9EzpMvK9mw8+l5LadbY0tIwmTVvV5yxUQo78HcgXWInfp/zJ+GG1L/RQOHck74lEA==,iv:UBMRYPd0loOQBs3mNyndiKPu72aRA8HbOKWDfUWPQg8=,tag:t/ONqdwpWcbo/2vy5TOjlA==,type:comment]
#ENC[AES256_GCM,data:HTinhnsAbVujUOuLIVT/CkvdtTN9Nk7wZKZ5SyrPC+vZ/cB9E10FffMYLQ==,iv:Clby9A7MIUSknNFkzKuWEDL0yUW/ctd6KShCIEYrDZA=,tag:CJKORoXrspDjRmaSHUnlqw==,type:comment]
#ENC[AES256_GCM,data:cwAb68VgebTwCCeAFUbOG0CUAuggfRnLNv9NWldJN+E9NY4WKxs12Nz7yX/vtelcqqJ2TOUL78uAR88Nzavv7VtCTZRivWjRG6GvAUyRdv8lAZo=,iv:PScTSTCuVnsoZlvyTVL+ZgqqEm4m2/fUqWzPwE+PvuY=,tag:1jeRsHqgMheXbcnhRicsnw==,type:comment]
#ENC[AES256_GCM,data:V5XRrTvyeezkcJqw1/BhhZz5K/egpl+PtNwjAGELjWRp7IqDfRsInxBKEg==,iv:LdOTkL22HvaNbiUi6hG8o0ownfZ22OKFGxCuGPqG8xU=,tag:/06I/mLzBlgS489iuwFTuw==,type:comment]
#ENC[AES256_GCM,data:i9PXzaO1od7HimP/6vxYfh30SxFbdXRDcnXujH3VrvngFcWaVcXgigncp3cboi6RoERSZ6yakxviVyEBIS4v0qRfombj2UtJg8N3Kg==,iv:aohIMhAYfZhlGDrcEvi+Qc16nF8ZgrPUGhWj/7nl8Fs=,tag:o70qsk/2cAbZgbVBwfl3Ew==,type:comment]
maxmind-license: ENC[AES256_GCM,data:sESU6uK9EYLido9/0sXO2Zw1SjuKmxPh4r3giJcaG7068gn1kByjsA==,iv:htnFgnLrH35zSvmlRAdoRDLFIpKroKO5dW9TNK9soUc=,tag:6pJuc54SrKP5n0kJJ7fGyA==,type:str]
send:
redis-password: ENC[AES256_GCM,data:6zVKw9AmKwSWvHUZhzy0F2KcJW96uFoZY/N1Zq8ilUJOLZeX,iv:viwLIgJz9v8oadr8784OgETbEsxzGsJvVoxmOwWEFxo=,tag:XEYFnoCGwlnrkqaUbgeH+Q==,type:str]
coturn:
auth-secret: ENC[AES256_GCM,data:50KqO4GQ1ERbCnK4IjYu6aywT+IPMtVlTzh/TE4MwWApU4pO9yqz25ENGUAKRLi4p+Ecug+Rn3InRl1b+q6bAQ==,iv:SgHkHvHg/+yA1Z5E9effgCnZMVXv5amGNUsVKErai54=,tag:PoYLV9Xr0IXXsA39n7wiTQ==,type:str]
wireguard:
privateKey: ENC[AES256_GCM,data:4DKPPqQkjb33rQzFIz863A2arDRQA9AivWFBaWTf0xXDX4hWvJFiIlJQfvE=,iv:0R2TH3CMxHgwVjojzjE2Gnp8SXonmBDLWF7hB33NiX0=,tag:vgtV8JkuCdspleN/SvgIqQ==,type:str]
hello: ENC[AES256_GCM,data:mX0hKnLdaujfHSyIikkannf8DDo+r7R0,iv:my9nYiaburkWHQLsNetqD3dYVwsEkJhC7hoh0XagoOk=,tag:D7uhoFGMrTWT3K4LNMFcUA==,type:str]
example_key: ENC[AES256_GCM,data:ezHOG8aSXYlosn7ymQ==,iv:NLm785UMihcL1K/M4u7k+P2XftyLlIxtQGPmMLc+rs8=,tag:h9xk+do8pYzxYzUaKKb1PQ==,type:str]
#ENC[AES256_GCM,data:pgOf9IVK9ijocRr0uEO0ZA==,iv:aQ2dvfAVhkFWtcDM4VeJQa+NN6kw9IlvidL/usoP/lE=,tag:49iS4s1EfQK5VhlF9nqWRQ==,type:comment]
example_array:
- ENC[AES256_GCM,data:W8QJiOY6ofqE+XRodK0=,iv:KQ/mYY4N/YA9LhZvJtPJPqRVQq4ob/xa8JSQY06Vm4M=,tag:7NQgidSCjER//ru3AXgLzQ==,type:str]
- ENC[AES256_GCM,data:nNML0iYEFdW4S5rJVHM=,iv:LQ1/E/7FExXB16Ur4b59XAUlWSFPub6LQBaFCY+a2lE=,tag:LqPymQ7k5ZsS8d9Z09xJuA==,type:str]
example_number: ENC[AES256_GCM,data:UiALks+CeKFusw==,iv:8gQ0aB+9YHXKVDX7moqdQmNJLGDNGfo+glezE39xXgQ=,tag:sJG+DJNzCtx+l4bBgQTtCQ==,type:float]
example_booleans:
- ENC[AES256_GCM,data:n3cV5g==,iv:z2p5oh8BhEMvwwIDaO8aM8VfxmsR6Z7473pd348tsmU=,tag:oSYsNuk6vY21Nepy8Hkb7g==,type:bool]
- ENC[AES256_GCM,data:ns3chHI=,iv:db8M/qF03VKaT/8Q4NqfCdI1zAU9H8JWZFqnzwI7QvI=,tag:FdgUanhezouVdv+9a9/gxQ==,type:bool]
sops:
kms: []
gcp_kms: []
@@ -62,23 +17,23 @@ sops:
- recipient: age19ax6vm3pv8rph5tq3mmehd9sy9jk823tw8svsd790r0lkslycquqvlwz9m
enc: |
-----BEGIN AGE ENCRYPTED FILE-----
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSA1QXc4NzREZHlhMDV2WXlM
a2I4d1pjWm9Xd2gzUDUwZ1ZSTkFGR1ZQNDJzCmJwcWFxRWNNVGxTNno2b1NxNktO
aHhINXBjdmE3alFGYk9kUHZ1UzdJUk0KLS0tIFdKMDlvb1Z2Qi8xRjl0MXpKMDMz
cVVNdDRDNmtHZlJEcVRXR1FLVkZrMWcKn2iTHH7/52fJNXcbDFbzOxNAaiQRA0nO
we74EeNzcaaQwuEmBQPKxd/g7/kjhnHzTkoX3OneXMd/gBZMn2knXw==
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBIaE9nWEZFaE51alYyTUgr
RVBKZ1MvNitBdGpMWURIUkhCTlF6Y1hueVFjCnp2Q0JVL0t2UEZrSmxMbFVwZ0k5
QVZDdXNjWmg0S3BIaXF0NDBHOThiMDAKLS0tIDBpenAyTE51MWVkaHFvTFhzNmVV
WnlKUFZWNWtaYUpPZkplSm04Q3RFb00Kghj7jLLcLpc8njNyxPj6JWZbBRn2Ou9j
FJLfCGLePuJPmdBBN4AGHmtrkfw/SMZJ50DXhKSJSxM91zuJSqFV1g==
-----END AGE ENCRYPTED FILE-----
- recipient: age164tyqklwhdm57tfm5u863mdt2xrzrrzac4py8a0j9y6kzqcjy9zsp073t6
- recipient: age1nnd6u8l20julg4jz4l6kw5gmj6h2tsngpm7n8dx59umgw2s66y4shq6jv4
enc: |
-----BEGIN AGE ENCRYPTED FILE-----
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBycEw1bXA4QUZkUzJ0Z3pM
Z0xHam5SLzRGV21XYUtxTFh1VnhQUk1NbzAwCkU1Z3VTR1FtZ05GOWNDOENlZTgz
SitzYXo2Q2VEaGtLTGE2UGRoUDkxN28KLS0tIHhRS2Y1cnQreC9Fc2FLdGR1ZXdJ
ZXFTU3ZCaW1pTVh0RUJzdDdGdHlPYTgK2mlgcX2kEc8+2UDdBnhUm6IIuh8V6agW
ooxH9OEPXUVI/4JcDo4v8ZUhAyU1ehLH0Ef7PJCChOZe2KZmWSNbhA==
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSAzYkJ1NllUR1pMaUdmZ3Z6
OEVLWC9nZHNxNWJSZ3VZUVZ3eWlLNWN5V24wClZ3dTh3SVNRS0Z4TFJrNDJBVnJj
aDhYNTdSV2JmUVNXR1ZkN1BOdzZzRHcKLS0tIFNhUGIxRVM5MFdvUWZWOG5kYlFM
RjZtLzY5b00vMExFSU1xZEl0NFJQQlEK4yUe3V0u6A3niES0Nq28rRYZ1fTEL0Fh
RBGZNCute1SShrLZPgNr/lFAc6d8DH6N0IuDKcjguuWtyHY/LFYuYw==
-----END AGE ENCRYPTED FILE-----
lastmodified: "2024-03-28T10:31:05Z"
mac: ENC[AES256_GCM,data:6Z+ltjbvQaYhDPoiCN7ajQeWcp6vj3TIcUXUm/r/tZU4mIOvfxA7hxW971b76bYPTeVwgp7ZB9qQy9emDHV9i+aSyJpTPKQHRRz5J+T+NJhTP/IL3R3VmG89ssC6NH8FSk0S487JkPd8tNz+G6bvwFCPRxRLNj1pXX0Dp6tgwIw=,iv:xLw2iX1ODAbJCTJ8fEvG7SdZ1GnGwADIckH8DibVM2Y=,tag:TTzlHdcyIQr/92ZHmViRXQ==,type:str]
lastmodified: "2024-06-27T09:40:19Z"
mac: ENC[AES256_GCM,data:ZdocsIbkzcWsTia7s98T5hjM5HDyBc1a0pwAb3IEFAom9Q0LjOs02BjsBKQT9Z+eMU+Ugkaz+kgP4hwYbcUuAbiVChU6sLMxUPwQDE8E7sJINZvJzth4Kl5SF4qz9fEuY8ZTP1hHc/HC6fSfWm+zH8n755aBjrzdIUvPV0Qv3xI=,iv:SSjyvgMSgZsoKHspRrNJpkmRTDdFqQlJGLUybyMcXbg=,tag:EBLpGZLNwDZxsWwh7Eva7w==,type:str]
pgp: []
unencrypted_suffix: _unencrypted
version: 3.8.1

View File

@@ -36,7 +36,7 @@ inputs:
{
snapper.enable = true;
sshd = {};
xray.server = { serverName = "vps6.xserver.chn.moe"; userNumber = 18; };
xray.server = { serverName = "vps6.xserver.chn.moe"; userNumber = 20; };
frpServer = { enable = true; serverName = "frp.chn.moe"; };
nginx =
{
@@ -81,5 +81,10 @@ inputs:
beesd.instances.root = { device = "/"; hashTableSizeMB = 64; };
};
};
specialisation.generic.configuration =
{
nixos.system.nixpkgs.march = inputs.lib.mkForce null;
system.nixos.tags = [ "generic" ];
};
};
}

View File

@@ -40,6 +40,10 @@ xray-server:
user16: ENC[AES256_GCM,data:fo6KJXlPDn7+FmxjEJQo9d79rDYemLFx6LanYZcJpKJR7Gxq,iv:yEUKPNZ9idrSqyVO9fhksP/7bjPMT/LzNK2VSq503/c=,tag:M87D44SIo9JzDB3ZyKu7fA==,type:str]
#ENC[AES256_GCM,data:/Kec+CdtnT11EA==,iv:DnmbWfgriaE6XAnMqq2UXhHhN+Rd/3YRodKVUCJo6p4=,tag:NimqZpbslKxwzoljaZqEdw==,type:comment]
user17: ENC[AES256_GCM,data:gQInIcNFxJuCSsMDGq4yTp5JdMMmJRy1tY3PGLoLuuIXWV0a,iv:ya4n9Z7T9/bxeHqi5QqwJprEzDMsT6X0BuEXRS67wWk=,tag:RcjQfAHv8uc3PgN5c4bySA==,type:str]
#ENC[AES256_GCM,data:h7E4P6BiGjktYg==,iv:DhkK3NNppBqo3sXt9U7kbgfaBPYcSEX2hu6VOAesDiE=,tag:XoVbZklwCmU1EBhv0ujcSw==,type:comment]
user18: ENC[AES256_GCM,data:dssxPEv8srXydunolaaDAYYo+BOXhp2PoqidOWH3z6NYBpyB,iv:WCLcMMwQJiHZBwreQpaOZp2saXvjBwgYUqSf7HQhMgA=,tag:5jsAVcgAgO+7JhBINz6tzQ==,type:str]
#ENC[AES256_GCM,data:qGsMmWrUIzVdHw==,iv:DXayEA5zquwOzm+TqECYNHM98r0WSzcP3gA8zkzdPy4=,tag:OKTx12RqP9VxJQOnrBLkmw==,type:comment]
user19: ENC[AES256_GCM,data:+Mh15DR9xvFAwks86iuHEA9FpObKWTSuVOEzUDpBUS/h0hOz,iv:zYIkic2bibvwCBpomnJ9465mda1rbm3RERBZY9twXuc=,tag:bwdL6DAGgkGYhYFI2C4A+A==,type:str]
private-key: ENC[AES256_GCM,data:ts/LRGFAsYqvGvkvlxUI42IW1a8cGsSkpZhMDd3QVceRKvhPb1SRDaXoSw==,iv:6xX9xFIFUNlLBZ6CPBOz9JbHpvC4+QG9ZaCZcWdl12c=,tag:DYIa+QTV8vyl1l7OKKykTw==,type:str]
nginx:
#ENC[AES256_GCM,data:85LrqdTMIhSa,iv:mIQPYz8VPd5AxeMCQEdTGMD0Iqa5QEAa5+8JVFaj3JM=,tag:TcZd7S3WRPpEV9lHI1fzbw==,type:comment]
@@ -83,8 +87,8 @@ sops:
ZXFTU3ZCaW1pTVh0RUJzdDdGdHlPYTgK2mlgcX2kEc8+2UDdBnhUm6IIuh8V6agW
ooxH9OEPXUVI/4JcDo4v8ZUhAyU1ehLH0Ef7PJCChOZe2KZmWSNbhA==
-----END AGE ENCRYPTED FILE-----
lastmodified: "2024-05-25T09:01:19Z"
mac: ENC[AES256_GCM,data:xYK5VTYHwryDcH0fhnezn5aYQ+XAPAJ7PIrL1ygKw3F/rAwRQlWk0/zmqypmpqbPX4mAJKzDfgoTNh8iUtF8ehmfOS+7OPUTuKVRvPI39HfcJbRN3/oOdN40AXSa5cZjgKrAGdhWvwyw0WdDMkRfwJztAR5Jj0dKzZ5THW+5zSs=,iv:Y5UUe1I95ltiVcUPBUcmIpnKHFfAlQmcF8ZlxZht1i4=,tag:3mA/epV254+P7WkkuhDOqg==,type:str]
lastmodified: "2024-06-30T10:43:57Z"
mac: ENC[AES256_GCM,data:Mg/DZghIkaWM5KEjk5zg3S0L5qPa8/rkc2ooSjA1ewzbDhTKls2tzv7fQqLx2WQtcJiKkoVx22UkiL0AzBwJdCr3473vx93ajTVK9HNu3jqXmuzSiv2iVS21EX9tyBNiL6uWlVAtlVfMMs69PEUF+EJIYY5TkVVPaQjzEebwo5w=,iv:tFON7RVSnNNHo5U4dRuMGDhH5iPGShW9uoda+apiIjI=,tag:3nG/u7vaChFBHoDsLLb23w==,type:str]
pgp: []
unencrypted_suffix: _unencrypted
version: 3.8.1

View File

@@ -26,10 +26,11 @@ inputs:
rollingRootfs = {};
};
grub.installDevice = "/dev/disk/by-path/pci-0000:00:05.0-scsi-0:0:0:0";
nixpkgs.march = "broadwell";
nixpkgs.march = "znver2";
nix.substituters = [ "https://cache.nixos.org/" "https://nix-store.chn.moe" ];
initrd.sshd.enable = true;
networking = { hostname = "vps7"; networkd = {}; };
kernel.variant = "cachyos-server";
};
services =
{
@@ -45,7 +46,7 @@ inputs:
matrix = { port = 8009; redisPort = 6380; slidingSyncPort = 9001; };
};
vaultwarden.enable = true;
beesd.instances.root = { device = "/"; hashTableSizeMB = 1024; };
beesd.instances.root = { device = "/"; hashTableSizeMB = 1024; loadAverage = 4; };
photoprism.enable = true;
nextcloud = {};
freshrss.enable = true;
@@ -70,5 +71,10 @@ inputs:
xray.server = { serverName = "xserver.vps7.chn.moe"; userNumber = 4; };
};
};
specialisation.generic.configuration =
{
nixos.system.nixpkgs.march = inputs.lib.mkForce null;
system.nixos.tags = [ "generic" ];
};
};
}

View File

@@ -68,21 +68,18 @@ freshrss:
huginn:
invitationCode: ENC[AES256_GCM,data:+m2AabRzUiCFy3MAKTB8d1IE05WHTcmZ,iv:ccdIPHl9N+bvPR/QCwZUwZOfWTeW6gWhhBjOpL85JRg=,tag:Ir2085K04XUGkAuoCG+7VQ==,type:str]
fz-new-order:
manager: ENC[AES256_GCM,data:qZc5U3SZQPWzcKVjN2+A2qWNae4GItcjvEQFgkThvIQ=,iv:fJpiUlViiUg1ea/zGhgedQG7TeTbeb9dPviYoiUBLqI=,tag:6T7rgJflsjgK++28SgsLtg==,type:str]
token: ENC[AES256_GCM,data:qhwWRflJbW1QMOhiPfbTIrEdQJyVtfZ1QycCgstdKD1Nh40=,iv:GvZ8MJig64l34jkvuJbMMjyNaPT5yz0/pFCc6KEPTvA=,tag:cMXo/6F9thl8k2iAhT507Q==,type:str]
uids:
#ENC[AES256_GCM,data:WJszzA==,iv:KvyEnUu69+L5ZxNbRmjtP2R+8lHKgdlMN0WuvDbYgE4=,tag:LP2FJ2HXWZJmTdvXpHflVQ==,type:comment]
user0: ENC[AES256_GCM,data:Qw18Ht6qXo3n7DD9NgNB+3IRbCmKuvJQiK5UBsg/FC8=,iv:TeeTcR0tnRrniySqKrsKfOfr2JO7+kqS3iETdCFX5ZA=,tag:rRo2yNku9JWxmILWBS/Wyw==,type:str]
#ENC[AES256_GCM,data:O3DOE3jFCg==,iv:9shUoHCLXsJPKHELlyWdreouEcyOqhsfVI2KaqwC4CU=,tag:tYKVv+/DuesSijZwWGdrig==,type:comment]
user1: ENC[AES256_GCM,data:vY4qTPNqdFp2H348jAgvwKktywdVVvQK/lR2NgRE4Ho=,iv:DrweeSEJ5ETomIkRtkcVboiQindzBoxvxjlSmrQIfI8=,tag:sMz1ITHkDclBc4OY91dMGg==,type:str]
user0: ENC[AES256_GCM,data:2sieulGmi7mCYrJH24djrrmHArrFbOHZ9wUuKvY4f2k=,iv:lb5ODFOeQQ+D9HZnMw48n/DGRB7L51U4frBVcPx1mvk=,tag:MwZua6u+G478uGOwtGu4fQ==,type:str]
#ENC[AES256_GCM,data:yeA9zF8Tug==,iv:VZuWLZnt1RBmkBWudKVvgJkYfqxIj/umEHVCfR6IG3k=,tag:1kj7HyjVT59n05VYJ1uP+w==,type:comment]
user2: ENC[AES256_GCM,data:7hlq1FEauGcKkStREDbxA3tOA5NmFo9AbXiOPUt+kZ4=,iv:urOP3ENSviWRKDIWGc1P5PkEtkoBSCSYlgGqJQznp8s=,tag:NNKCW5bFPY7t/PC7dsSJwg==,type:str]
user1: ENC[AES256_GCM,data:Aw0ydspmf+PXKU27Pdzn4q/nY4sxXCADL1WGB7vm3eo=,iv:uTmVvGlW1HfdvoNbupSw3GyShsWTGVCoNrvVJ5BPUy0=,tag:k9KIoCWM6bSprwR8dmN+Hg==,type:str]
#ENC[AES256_GCM,data:4G7DyLVVgQ==,iv:Ht/exln1QtL2BxjCaOTIXHRPDiSFYP4zIa7VaeMCuhE=,tag:btVLXf+WS/YgzRFbVFoAfQ==,type:comment]
user3: ENC[AES256_GCM,data:nBTbmp9OP14ayVBz1UGC5g76txfUwxL2NPQCKGxsQyw=,iv:2B8ISdT+8WpfeiU9peKoMlpwcRoGZVh11VyAnS9IKP4=,tag:uBMxqrPlb6TaftnAMqodKw==,type:str]
user2: ENC[AES256_GCM,data:P5gmhaQ+VOWVOjTrsx34zUS8dsqIkzCwOImIE8TIfUc=,iv:IoJIUcNJmaBTyr0Ut6R7BN/UqyK8p4HtiwbXUl171pE=,tag:k99PGSL1cEALTmFVWH1uSg==,type:str]
#ENC[AES256_GCM,data:TGrZBuCRgQ==,iv:9IOJ3Bkw9udS/y93TTtZ9o79aDq3Bb+DMEogJG77iqA=,tag:S/XcPX1f89IyfZnMoR9s/A==,type:comment]
user4: ENC[AES256_GCM,data:LVendDEBlPUCkXPfgbYf2X0EgJsAdLKjAudXeAgy2Is=,iv:bR0emkQa6OHUP1ucgAvJU0eEop0gp+3rwDB5XJhh4+s=,tag:YZsW9Yyr+ey9AbTO3ucWDg==,type:str]
user3: ENC[AES256_GCM,data:cAzf2X20rtQYyz1rLK6b4jo8utuUOdUHVYfCWdfPTDY=,iv:L5cg7aNdfnLTH2dKl4bWCqaujJ9tIvBJrJIoDIaBLwk=,tag:9Al6Wig4lz1my6hgozSsIA==,type:str]
#ENC[AES256_GCM,data:b4iJ73sUoQ==,iv:A2hmi7lCR15E5jVR8E71GQuHgF4TdjDuQadXOtBon6k=,tag:eopTJdjN16u7PtpZdhKymQ==,type:comment]
user5: ENC[AES256_GCM,data:wG4awLnfB4B0qLWG6Aj+OslLMnViPjIzicfB4ZzkZPA=,iv:b9C1IDmZTMV0RYXqkM/Y3khZeSQEOISrQyPjhQe3WKM=,tag:cRMtLNU6TCwTQG4UVhvTng==,type:str]
user4: ENC[AES256_GCM,data:nUJ0lPuFOUVGCtq0IRSh5dAkAna7hoow1YOtFEgSoZc=,iv:D8phoZxdbQ2/Zaeq8498eRb0a7SZD5WnVdKv+u2pBak=,tag:Obu01n34JjyAVnF0f3uKzg==,type:str]
config0:
username: ENC[AES256_GCM,data:p8+q8u1A,iv:9s52kS5yLB4vQuGVXNtA4amZqT3eHTTybsbsQZRiFnk=,tag:7SA4SEzMHpP9H/rwoE+UJQ==,type:str]
password: ENC[AES256_GCM,data:58+gFodT,iv:ohZlT1BwnzCYv84xHgFsLRkiPMpE8lB8QVHwr0QtDWc=,tag:XF047RnXs6IbKsTnsm0D6g==,type:str]
@@ -143,8 +140,8 @@ sops:
SnFHS1Z0SXUzTFdEd29KTy9DU3Y3R0UKfhh+rUmWDrf+UGjclP57dHipPLFoXSqy
HdelmfV6q4/c7ppx2E+oZw3VNgoZCsrxxzYZfwxHJiZb+5vkE0D8iA==
-----END AGE ENCRYPTED FILE-----
lastmodified: "2024-06-08T09:15:52Z"
mac: ENC[AES256_GCM,data:EY6sFc4EcTuxPgIZQ51HFZZZf+khb7mkNEvb6U12kCtoJAEo+i83uszwBZCo/QWw6VCCt9c//9y0mNH4FjZPJAxweJHcRtanyTXa5jdyv12qINUceYe7Uhcb7JuiiEns9DEbrr3UeAKfbPC+N5mD/2trzht0E8hqnFlWU/fysz8=,iv:saymdP4nFveEWx0JrBR2bW8SUl6xCJKhYqw+CsrfRG8=,tag:CHGvJAO8hpSMNdU2YE2OGw==,type:str]
lastmodified: "2024-07-11T13:55:38Z"
mac: ENC[AES256_GCM,data:5mYdz+1v6LZBW2TiM6CROaU6TUtFemOvbqJUQfqO3Lr8UnDM9AdH/fD//xDYNR1T1tMhBJf04Jchle7jRl45HKCzuyOGFOABu2m25nJeJGGDTSVDaRUUgCcmN4NQ0h1ep9gmZM9u2g5KLdmenXqcVD2tVgWNLykHtEZ/MyyEPC4=,iv:te1/rjBWhBIvJol51S4hehI4gxr3nsTH+YhmINDfy0U=,tag:mGXzGi309B1er8atMJta3g==,type:str]
pgp: []
unencrypted_suffix: _unencrypted
version: 3.8.1

View File

@@ -88,6 +88,7 @@ inputs:
shares = { home.path = "/home"; root.path = "/"; };
};
groupshare = {};
hpcstat = {};
};
bugs = [ "xmunet" "amdpstate" ];
user.users = [ "chn" "xll" "zem" "yjq" "gb" ];

View File

@@ -17,6 +17,11 @@ users:
gb: ENC[AES256_GCM,data:3eAKBiJoC1owCHTFd3Xq8vI8VK980evePc92xCXJJ21M9D1MdbwN8ySZ3Ovjk7VfQmEo8oRv1Ll1sftyrXYoeTHmJsNDxCpR6A==,iv:Ju/ERNuGrgO5kYlbvmkbLJkgiW3Elou34AsJTFITCUg=,tag:POVlxYh9kZ1BMSbt97IVOQ==,type:str]
mariadb:
slurm: ENC[AES256_GCM,data:qQMD8SKNmxb3PdScXNqppF9zkX7dV5i7rvljvZuhiI5zLnu77qYCHBW6ymh0mrY14N9NjxmQZhZWX/H8TvBlcg==,iv:J5N3LjCYW3QmuEkMBpl7qvPFW1Z9ZoPLkj45jKcIW9U=,tag:Tl+ld07+lVkmzt7f/f2MqQ==,type:str]
hpcstat:
key: ENC[AES256_GCM,data:POK329h/joF7WdSBwSE1EkYH/pZ9X+wiTKcVWLZjmh7gM9d7HONbN/PqsYNFTHJVR0GgysqpLEcPN2OFGs/SSeH86o04cAdjAVznKZgt1Q34QGYy6b+io15P3lbmK0kTKmeGt5qEhGkBh6BVBoSyqbKAknvUqJ17ZkL17kyRaKffm3Zais7keEJCFdyRF6oSz2kl2CvEmKNWPWDdO9EpgqgYlm9mwu95/k9Hx5eyUjiFpxc3fdFTESGbe0ZYAqKQ0eLFfLLorQp0pAzxCbbxIzZEgyxjzkICXKa1n7Zz6h1ON2Rsqq0Q4hEYJdWGLtvOH/VLVxvNWjW4Er6i3lWGhZRiDDrxLErQGONI+X7QqbneFCnMCZGln3pAfNtOr+KX58ij/egyzmb7bKZrARqnm+X+/I/L0+VS1PfDdLP53GaX7mfKYpcH6z7O2F/zjpuXQTV8njs64YlvgyYXsCaghEUBzehsruwRsBEkTIb4R2AlqItpbesMnNNUJ4Cr/B7Bw6O+gHeJ+oK4ZPBYbgso,iv:B2eWjydl8m8nbcPw2fZfxCnj57utWM9ABj2eJ1pRKWQ=,tag:5W9ZwVSJvm1KvZnf/E5Tug==,type:str]
telegram:
token: ENC[AES256_GCM,data:Mu7guAFUu+UoHvo/h1blcI6Kg3mvng6zNc/HKXuCdf73ujziK0mXwPcf7t7d/w==,iv:BkA4d0OJ4lTD7csZJQHcDnYe7SYcFbwRVYOQAWOQ2lQ=,tag:GuJ4z5pe2znTY3xNT2WF+w==,type:str]
chat: ENC[AES256_GCM,data:OC8ElUPmfsVL,iv:WgZMJP2ugZbqZyihdNtL1xMH8u9VpLNzO8DGpDL4w4k=,tag:u4cKABikuMUbCIm5zCnk6A==,type:str]
sops:
kms: []
gcp_kms: []
@@ -41,8 +46,8 @@ sops:
ZDNHUjE2QVlCV3p0NHdKYW5IMHVBZzQKkZtfyvfroOntg3yRjMw4jQHiQj8eaB2h
IeIHfW4y01mmVT2ofbtB0xYpjcl4gtUlQ8X3tn5iJ9P8gcVo0G598A==
-----END AGE ENCRYPTED FILE-----
lastmodified: "2024-05-10T08:53:57Z"
mac: ENC[AES256_GCM,data:ImxIE0d7cEpudUKGs9zHCMFKlHYwFfztLWe5ZMWOrQxr7/uRxfCsiIvuU1nRri0jx2x8J6EFAG1BdrF4KRSeW5sIB9Tlk7X1TJ69zSdLhhnIuPl+rSyovoIkMQAJ0Wvyvlgimh1VQyaBkPsjnGk/dga1N0+gIlmiwFKY5uTpaaA=,iv:fo6S9fIDxnp7VWYYWH613U6bxIlDBZaNObkRR3AdgEc=,tag:ZRIMHkWRsf75K3Tg3Xv5xw==,type:str]
lastmodified: "2024-07-22T02:35:09Z"
mac: ENC[AES256_GCM,data:Gr4933UL8jZatR1osg29K/fGKJn/k7yZ2orPJOm0WMgs2bka8uGa5dIEJDTveKKJGk+iItXDUtsxM9C+0FwmrdSgrshg2LIjN8Nw0Mg9YjGjl3BXYH9ushN39+h+Ig5Q1nL7iJF5QF7bPULeFw0jO+6XJhCO/+LGa+DMzw+SyRM=,iv:4/Bev1xBXGRtkJooBqAz+y5vuIqkpLgvNIgBfoidW9M=,tag:/aDiuZROEY5NF4bT5YGURg==,type:str]
pgp: []
unencrypted_suffix: _unencrypted
version: 3.8.1

View File

@@ -77,5 +77,12 @@ inputs:
bugs = [ "xmunet" ];
user.users = [ "chn" "xll" "zem" "yjq" "gb" ];
};
environment.persistence."/nix/archive" =
{
hideMounts = true;
users.chn.directories = builtins.map
(dir: { directory = "repo/${dir}"; user = "chn"; group = "chn"; mode = "0755"; })
[ "lammps-SiC" "linwei-stuff" ];
};
};
}

1206
flake.lock generated

File diff suppressed because it is too large Load Diff

171
flake.nix
View File

@@ -3,31 +3,28 @@
inputs =
{
nixpkgs.url = "github:CHN-beta/nixpkgs/nixos-24.05";
nixpkgs-unstable.url = "github:CHN-beta/nixpkgs/nixos-unstable";
nixpkgs.url = "github:CHN-beta/nixpkgs/nixos-unstable";
"nixpkgs-23.11".url = "github:CHN-beta/nixpkgs/nixos-23.11";
"nixpkgs-23.05".url = "github:CHN-beta/nixpkgs/nixos-23.05";
"nixpkgs-22.11".url = "github:NixOS/nixpkgs/nixos-22.11";
"nixpkgs-22.05".url = "github:NixOS/nixpkgs/nixos-22.05";
home-manager = { url = "github:nix-community/home-manager/release-24.05"; inputs.nixpkgs.follows = "nixpkgs"; };
home-manager = { url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; };
sops-nix =
{
url = "github:Mic92/sops-nix";
inputs = { nixpkgs.follows = "nixpkgs"; nixpkgs-stable.follows = "nixpkgs"; };
};
aagl = { url = "github:ezKEa/aagl-gtk-on-nix/release-24.05"; inputs.nixpkgs.follows = "nixpkgs"; };
nix-index-database = { url = "github:Mic92/nix-index-database"; inputs.nixpkgs.follows = "nixpkgs-unstable"; };
aagl = { url = "github:ezKEa/aagl-gtk-on-nix"; inputs.nixpkgs.follows = "nixpkgs"; };
nix-index-database = { url = "github:Mic92/nix-index-database"; inputs.nixpkgs.follows = "nixpkgs"; };
nur-xddxdd = { url = "github:xddxdd/nur-packages"; inputs.nixpkgs.follows = "nixpkgs"; };
nix-vscode-extensions = { url = "github:nix-community/nix-vscode-extensions"; inputs.nixpkgs.follows = "nixpkgs"; };
impermanence.url = "github:nix-community/impermanence";
qchem = { url = "github:Nix-QChem/NixOS-QChem/master"; inputs.nixpkgs.follows = "nixpkgs"; };
deploy-rs = { url = "github:serokell/deploy-rs"; inputs.nixpkgs.follows = "nixpkgs"; };
plasma-manager =
{
url = "github:pjones/plasma-manager";
inputs = { nixpkgs.follows = "nixpkgs"; home-manager.follows = "home-manager"; };
};
nix-doom-emacs = { url = "github:nix-community/nix-doom-emacs"; inputs.nixpkgs.follows = "nixpkgs"; };
nur-linyinfeng = { url = "github:linyinfeng/nur-packages"; inputs.nixpkgs.follows = "nixpkgs"; };
nixos-hardware.url = "github:CHN-beta/nixos-hardware";
envfs = { url = "github:Mic92/envfs"; inputs.nixpkgs.follows = "nixpkgs"; };
@@ -54,8 +51,6 @@
nodesoup = { url = "github:olvb/nodesoup"; flake = false; };
tgbot-cpp = { url = "github:reo7sp/tgbot-cpp"; flake = false; };
v-sim = { url = "gitlab:l_sim/v_sim"; flake = false; };
win11os-kde = { url = "github:yeyushengfan258/Win11OS-kde"; flake = false; };
fluent-kde = { url = "github:vinceliuice/Fluent-kde"; flake = false; };
rycee = { url = "gitlab:rycee/nur-expressions"; flake = false; };
blurred-wallpaper = { url = "github:bouteillerAlan/blurredwallpaper"; flake = false; };
slate = { url = "github:TheBigWazz/Slate"; flake = false; };
@@ -68,6 +63,8 @@
zxorm = { url = "github:CHN-beta/zxorm"; flake = false; };
openxlsx = { url = "github:troldal/OpenXLSX"; flake = false; };
sqlite-orm = { url = "github:fnc12/sqlite_orm"; flake = false; };
sockpp = { url = "github:fpagliughi/sockpp"; flake = false; };
git-lfs-transfer = { url = "github:charmbracelet/git-lfs-transfer"; flake = false; };
# does not support lfs yet
# nixos-wallpaper = { url = "git+https://git.chn.moe/chn/nixos-wallpaper.git"; flake = false; };
@@ -80,38 +77,49 @@
(builtins.attrNames (builtins.readDir ./devices));
in
{
packages.x86_64-linux =
let pkgs = (import inputs.nixpkgs
packages.x86_64-linux = rec
{
pkgs = (import inputs.nixpkgs
{
system = "x86_64-linux";
config.allowUnfree = true;
overlays = [ inputs.self.overlays.default ];
crossOverlays = [(final: prev:
{
boost = (prev.boost.override { zstd = null; }).overrideAttrs (prev:
{ patches = prev.patches or [] ++ [ ./local/pkgs/winjob/boost.patch ]; });
magic-enum = prev.magic-enum.overrideAttrs (prev: { cmakeFlags = prev.cmakeFlags ++
[ "-DMAGIC_ENUM_OPT_BUILD_EXAMPLES=OFF" "-DMAGIC_ENUM_OPT_BUILD_TESTS=OFF" ]; });
range-v3 = prev.range-v3.overrideAttrs (prev: { cmakeFlags = prev.cmakeFlags ++
[ "-DRANGE_V3_DOCS=OFF" "-DRANGE_V3_TESTS=OFF" "-DRANGE_V3_EXAMPLES=OFF" ]; });
abseil-cpp = prev.abseil-cpp.overrideAttrs (prev: { buildInputs = prev.buildInputs ++
[ final.windows.pthreads ]; });
})];
});
in
{
default = inputs.nixpkgs.legacyPackages.x86_64-linux.writeText "systems"
(builtins.concatStringsSep "\n" (builtins.map
(system: builtins.toString inputs.self.outputs.nixosConfigurations.${system}.config.system.build.toplevel)
devices));
hpcstat =
let
openssh = (pkgs.pkgsStatic.openssh.override { withLdns = false; etcDir = null; }).overrideAttrs
(prev: { doCheck = false; patches = prev.patches ++ [ ./local/pkgs/hpcstat/openssh.patch ];});
duc = pkgs.pkgsStatic.duc.override { enableCairo = false; cairo = null; pango = null; };
in pkgs.pkgsStatic.localPackages.hpcstat.override
{ inherit openssh duc; standalone = true; version = inputs.self.rev or "dirty"; };
ufo = pkgs.pkgsStatic.localPackages.ufo.override { version = inputs.self.rev or "dirty"; };
nixpkgs = pkgs;
}
// (
builtins.listToAttrs (builtins.map
(system:
{
name = system;
value = inputs.self.outputs.nixosConfigurations.${system}.config.system.build.toplevel;
})
devices)
);
default = inputs.nixpkgs.legacyPackages.x86_64-linux.writeText "systems"
(builtins.concatStringsSep "\n" (builtins.map
(system: builtins.toString inputs.self.outputs.nixosConfigurations.${system}.config.system.build.toplevel)
devices));
hpcstat =
let
openssh = (pkgs.pkgsStatic.openssh.override { withLdns = false; etcDir = null; }).overrideAttrs
(prev: { doCheck = false; patches = prev.patches ++ [ ./local/pkgs/hpcstat/openssh.patch ];});
duc = pkgs.pkgsStatic.duc.override { enableCairo = false; cairo = null; pango = null; };
in pkgs.pkgsStatic.localPackages.hpcstat.override
{ inherit openssh duc; standalone = true; version = inputs.self.rev or "dirty"; };
ufo = pkgs.pkgsStatic.localPackages.ufo.override { version = inputs.self.rev or "dirty"; };
chn-bsub = pkgs.pkgsStatic.localPackages.chn-bsub;
winjob = pkgs.pkgsCross.mingwW64Static.localPackages.winjob;
}
// (
builtins.listToAttrs (builtins.map
(system:
{
name = system;
value = inputs.self.outputs.nixosConfigurations.${system}.config.system.build.toplevel;
})
devices)
);
nixosConfigurations =
(
(builtins.listToAttrs (builtins.map
@@ -149,64 +157,47 @@
};
}
);
deploy =
{
sshUser = "root";
user = "root";
fastConnection = true;
autoRollback = false;
magicRollback = false;
nodes = builtins.listToAttrs (builtins.map
(node:
{
name = node;
value =
{
hostname = node;
profiles.system.path = inputs.self.nixosConfigurations.${node}.pkgs.deploy-rs.lib.activate.nixos
inputs.self.nixosConfigurations.${node};
};
})
[ "vps6" "vps7" "nas" "surface" "xmupc1" "xmupc2" "pi3b" ]
);
};
checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks inputs.self.deploy) inputs.deploy-rs.lib;
overlays.default = final: prev:
{ localPackages = (import ./local/pkgs { inherit (inputs) lib; pkgs = final; topInputs = inputs; }); };
config = { archive = false; branch = "production"; };
devShells.x86_64-linux =
let pkgs = (import inputs.nixpkgs
devShells.x86_64-linux = let inherit (inputs.self.packages.x86_64-linux) pkgs; in
{
biu = pkgs.mkShell
{
system = "x86_64-linux";
config.allowUnfree = true;
overlays = [ inputs.self.overlays.default ];
});
in
{
biu = pkgs.mkShell
{
inputsFrom = with pkgs.localPackages; [ biu ];
buildInputs = [ pkgs.clang-tools_18 ];
CMAKE_EXPORT_COMPILE_COMMANDS = "1";
};
hpcstat = pkgs.mkShell
{
inputsFrom = [ (inputs.self.packages.x86_64-linux.hpcstat.override { version = null; }) ];
packages = [ pkgs.clang-tools_18 ];
CMAKE_EXPORT_COMPILE_COMMANDS = "1";
};
sbatch-tui = pkgs.mkShell
{
inputsFrom = with pkgs.localPackages; [ sbatch-tui ];
buildInputs = [ pkgs.clang-tools_18 ];
CMAKE_EXPORT_COMPILE_COMMANDS = "1";
};
ufo = pkgs.mkShell
{
inputsFrom = [ (inputs.self.packages.x86_64-linux.ufo.override { version = null; }) ];
packages = [ pkgs.clang-tools_18 ];
CMAKE_EXPORT_COMPILE_COMMANDS = "1";
};
inputsFrom = [ pkgs.localPackages.biu ];
packages = [ pkgs.clang-tools_18 ];
CMAKE_EXPORT_COMPILE_COMMANDS = "1";
};
hpcstat = pkgs.mkShell.override { stdenv = pkgs.gcc14Stdenv; }
{
inputsFrom = [ (inputs.self.packages.x86_64-linux.hpcstat.override { version = null; }) ];
packages = [ pkgs.clang-tools_18 ];
CMAKE_EXPORT_COMPILE_COMMANDS = "1";
};
sbatch-tui = pkgs.mkShell
{
inputsFrom = [ pkgs.localPackages.sbatch-tui ];
packages = [ pkgs.clang-tools_18 ];
CMAKE_EXPORT_COMPILE_COMMANDS = "1";
};
ufo = pkgs.mkShell
{
inputsFrom = [ (inputs.self.packages.x86_64-linux.ufo.override { version = null; }) ];
packages = [ pkgs.clang-tools_18 ];
CMAKE_EXPORT_COMPILE_COMMANDS = "1";
};
chn-bsub = pkgs.mkShell
{
inputsFrom = [ pkgs.localPackages.chn-bsub ];
packages = [ pkgs.clang-tools_18 ];
CMAKE_EXPORT_COMPILE_COMMANDS = "1";
};
winjob = pkgs.mkShell
{
inputsFrom = [ pkgs.pkgsCross.mingwW64Static.winjob ];
packages = [ pkgs.clang-tools_18 ];
CMAKE_EXPORT_COMPILE_COMMANDS = "1";
};
};
};
}

View File

@@ -1,3 +1,3 @@
CompileFlags:
Add: [ -Wall, -Wextra, -std=c++23 ]
Compiler: g++
Compiler: g++

View File

@@ -13,18 +13,17 @@ endif()
find_package(magic_enum REQUIRED)
find_package(fmt REQUIRED)
find_package(Boost REQUIRED COMPONENTS headers iostreams)
find_package(Eigen3 REQUIRED)
find_package(Boost REQUIRED COMPONENTS headers iostreams filesystem)
find_package(range-v3 REQUIRED)
find_path(NAMEOF_INCLUDE_DIR nameof.hpp REQUIRED)
find_path(ZPP_BITS_INCLUDE_DIR zpp_bits.h REQUIRED)
find_package(Eigen3 REQUIRED)
add_library(biu src/common.cpp)
target_include_directories(biu PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}> ${NAMEOF_INCLUDE_DIR} ${ZPP_BITS_INCLUDE_DIR})
target_link_libraries(biu PUBLIC magic_enum::magic_enum fmt::fmt Boost::headers Boost::iostreams Eigen3::Eigen
range-v3::range-v3)
set_property(TARGET biu PROPERTY CXX_STANDARD 23 CXX_STANDARD_REQUIRED ON CXX_EXTENSIONS OFF)
target_link_libraries(biu PUBLIC magic_enum::magic_enum fmt::fmt Boost::headers Boost::iostreams Boost::filesystem
range-v3::range-v3 Eigen3::Eigen)
set_property(TARGET biu PROPERTY CXX_STANDARD 23 CXX_STANDARD_REQUIRED ON)
install(TARGETS biu EXPORT biuTargets LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
@@ -35,3 +34,14 @@ install(FILES biuConfig.cmake DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/biu)
get_property(ImportedTargets DIRECTORY "${CMAKE_SOURCE_DIR}" PROPERTY IMPORTED_TARGETS)
message("Imported targets: ${ImportedTargets}")
message("List of compile features: ${CMAKE_CXX_COMPILE_FEATURES}")
include(CTest)
add_executable(test-serialize test/serialize.cpp)
target_link_libraries(test-serialize PRIVATE biu)
set_property(TARGET test-serialize PROPERTY CXX_STANDARD 23 CXX_STANDARD_REQUIRED ON)
add_test(NAME test-serialize COMMAND test-serialize)
add_executable(test-process test/process.cpp)
target_link_libraries(test-process PRIVATE biu)
set_property(TARGET test-process PROPERTY CXX_STANDARD 23 CXX_STANDARD_REQUIRED ON)
add_test(NAME test-process COMMAND test-process)

View File

@@ -1,11 +1,12 @@
{
stdenv, cmake,
stdenv, cmake, lib,
magic-enum, fmt, boost, eigen, range-v3, nameof, zpp-bits
}: stdenv.mkDerivation rec
{
name = "biu";
src = ./.;
buildInputs = [ magic-enum fmt boost eigen range-v3 nameof zpp-bits ];
buildInputs = [ magic-enum fmt boost range-v3 nameof zpp-bits eigen ];
propagatedBuildInputs = buildInputs;
nativeBuildInputs = [ cmake ];
doCheck = true;
}

View File

@@ -72,27 +72,24 @@ namespace biu
namespace detail_
{
template <bool DirectStdout, bool DirectStderr> struct ExecResult
struct ExecMode { bool DirectStdin = false, DirectStdout = false, DirectStderr = false, SearchPath = false; };
template <ExecMode Mode> struct ExecResult
{
int ExitCode;
std::conditional_t<DirectStdout, Empty, std::string> Stdout;
std::conditional_t<DirectStderr, Empty, std::string> Stderr;
std::conditional_t<Mode.DirectStdout, Empty, std::string> Stdout;
std::conditional_t<Mode.DirectStderr, Empty, std::string> Stderr;
operator bool() const;
};
struct ExecInput { bool DirectStdin = false, DirectStdout = false, DirectStderr = false, SearchPath = false; };
template <ExecMode Mode> struct ExecInput
{
std::conditional_t<Mode.SearchPath, std::string, std::filesystem::path> Program;
std::vector<std::string> Args;
std::conditional_t<Mode.DirectStdin, Empty, std::string> Stdin = {};
std::map<std::string, std::string> ExtraEnv = {};
std::optional<std::chrono::milliseconds> Timeout;
};
}
template <detail_::ExecInput Input = {}> requires (!Input.DirectStdin)
detail_::ExecResult<Input.DirectStdout, Input.DirectStderr> exec
(
std::conditional_t<Input.SearchPath, std::string, std::filesystem::path> program, std::vector<std::string> args,
std::optional<std::string> stdin_string = {}, std::map<std::string, std::string> extra_env = {}
);
template <detail_::ExecInput Input = {}> requires (Input.DirectStdin)
detail_::ExecResult<Input.DirectStdout, Input.DirectStderr> exec
(
std::conditional_t<Input.SearchPath, std::string, std::filesystem::path> program, std::vector<std::string> args,
std::map<std::string, std::string> extra_env = {}
);
template <detail_::ExecMode Mode = {}> detail_::ExecResult<Mode> exec(detail_::ExecInput<Mode> input);
static_assert(sizeof(char) == sizeof(std::byte));
template <typename Char = std::byte, typename T> requires (std::same_as<Char, std::byte>)

View File

@@ -18,87 +18,54 @@ namespace biu
else return value;
}
template <bool DirectStdout, bool DirectStderr>
detail_::ExecResult<DirectStdout, DirectStderr>::operator bool() const
{ return ExitCode == 0; }
# define BIU_EXECRESULT_PRED(r, state) BOOST_PP_NOT_EQUAL(state, 4)
# define BIU_EXECRESULT_OP(r, state) BOOST_PP_INC(state)
# define BIU_EXECRESULT_MACRO(r, state) \
template detail_::ExecResult<(state & 1) != 0, (state & 2) != 0>::operator bool() const;
BOOST_PP_FOR(0, BIU_EXECRESULT_PRED, BIU_EXECRESULT_OP, BIU_EXECRESULT_MACRO)
namespace detail_
template <detail_::ExecMode Mode> detail_::ExecResult<Mode>::operator bool() const { return ExitCode == 0; }
template <detail_::ExecMode Mode> detail_::ExecResult<Mode> exec(detail_::ExecInput<Mode> input)
{
template <ExecInput Input>
detail_::ExecResult<Input.DirectStdout, Input.DirectStderr> exec
(
std::conditional_t<Input.SearchPath, std::string, std::filesystem::path> program, std::vector<std::string> args,
std::optional<std::string> stdin_string, std::map<std::string, std::string> extra_env
)
namespace bp = boost::process;
// decide input/output format, prepare environment, seach actual program
bp::ipstream stdout_stream, stderr_stream;
bp::opstream input_stream;
auto&& stdin_format = [&]
{ if constexpr (Mode.DirectStdin) return bp::std_in < stdin; else return bp::std_in < input_stream; }();
auto&& stdout_format = [&]
{ if constexpr (Mode.DirectStdout) return bp::std_out > stdout; else return bp::std_out > stdout_stream; }();
auto&& stderr_format = [&]
{ if constexpr (Mode.DirectStderr) return bp::std_err > stderr; else return bp::std_err > stderr_stream; }();
auto&& actual_program = [&]
{
namespace bp = boost::process;
bp::ipstream stdout_stream, stderr_stream;
bp::opstream input_stream;
auto&& stdout_format = [&]
{ if constexpr (Input.DirectStdout) return bp::std_out > stdout; else return bp::std_out > stdout_stream; }();
auto&& stderr_format = [&]
{ if constexpr (Input.DirectStderr) return bp::std_err > stderr; else return bp::std_err > stderr_stream; }();
auto&& actual_program =
[&]{ if constexpr (Input.SearchPath) return bp::search_path(program); else return program.string(); }();
std::unique_ptr<bp::child> process;
bp::environment env = boost::this_process::environment();
for (const auto& [key, value] : extra_env) env[key] = value;
process = [&]
{
if constexpr (Input.DirectStdin) return std::make_unique<bp::child>
(actual_program, bp::args(args), stdout_format, stderr_format, bp::std_in < stdin, env);
else if (stdin_string) return std::make_unique<bp::child>
(actual_program, bp::args(args), stdout_format, stderr_format, bp::std_in < input_stream, env);
else return std::make_unique<bp::child>
(actual_program, bp::args(args), stdout_format, stderr_format, bp::std_in < bp::null, env);
}();
if (stdin_string) { input_stream << *stdin_string; input_stream.pipe().close(); }
process->wait();
return
{
.ExitCode = process->exit_code(),
.Stdout = [&]
{
if constexpr (Input.DirectStdout) return Empty{};
else return std::string{std::istreambuf_iterator<char>{stdout_stream.rdbuf()}, {}};
}(),
.Stderr = [&]
{
if constexpr (Input.DirectStderr) return Empty{};
else return std::string{std::istreambuf_iterator<char>{stderr_stream.rdbuf()}, {}};
}()
};
}
if constexpr (Mode.SearchPath) return bp::search_path(input.Program);
else return input.Program.string();
}();
bp::environment env = boost::this_process::environment();
for (const auto& [key, value] : input.ExtraEnv) env[key] = value;
// start
auto process = bp::child
(actual_program, bp::args(input.Args), stdout_format, stderr_format, stdin_format, env);
if constexpr (!Mode.DirectStdin) { input_stream << input.Stdin; input_stream.pipe().close(); }
// wait for exit
if (input.Timeout) { if (!process.wait_for(*input.Timeout)) process.terminate(); }
else process.wait();
// collect output
detail_::ExecResult<Mode> result;
result.ExitCode = process.exit_code();
if constexpr (!Mode.DirectStdout) result.Stdout = {std::istreambuf_iterator<char>{stdout_stream.rdbuf()}, {}};
if constexpr (!Mode.DirectStderr) result.Stderr = {std::istreambuf_iterator<char>{stderr_stream.rdbuf()}, {}};
return result;
}
template <detail_::ExecInput Input> requires (!Input.DirectStdin)
detail_::ExecResult<Input.DirectStdout, Input.DirectStderr> exec
(
std::conditional_t<Input.SearchPath, std::string, std::filesystem::path> program, std::vector<std::string> args,
std::optional<std::string> stdin_string, std::map<std::string, std::string> extra_env
)
{ return detail_::exec<Input>(program, args, stdin_string, extra_env); }
template <detail_::ExecInput Input> requires (Input.DirectStdin)
detail_::ExecResult<Input.DirectStdout, Input.DirectStderr> exec
(
std::conditional_t<Input.SearchPath, std::string, std::filesystem::path> program, std::vector<std::string> args,
std::map<std::string, std::string> extra_env
)
{ return detail_::exec<Input>(program, args, {}, extra_env); }
# define BIU_EXEC_PRED(r, state) BOOST_PP_NOT_EQUAL(state, 8)
# define BIU_EXEC_OP(r, state) BOOST_PP_INC(state)
# define BIU_EXEC_MACRO(r, state) \
template detail_::ExecResult<(state & 1) != 0, (state & 2) != 0> \
exec<{false, (state & 1) != 0, (state & 2) != 0, (state & 4) != 0}> \
(std::conditional_t<(state & 4) != 0, std::string, std::filesystem::path>, std::vector<std::string>, \
std::optional<std::string>, std::map<std::string, std::string>); \
template detail_::ExecResult<(state & 1) != 0, (state & 2) != 0> \
exec<{true, (state & 1) != 0, (state & 2) != 0, (state & 4) != 0}> \
(std::conditional_t<(state & 4) != 0, std::string, std::filesystem::path>, std::vector<std::string>, \
std::map<std::string, std::string>);
# define BIU_EXEC_PRED(r, i) BOOST_PP_NOT_EQUAL(i, 16)
# define BIU_EXEC_OP(r, i) BOOST_PP_INC(i)
# define BIU_EXEC_MACRO(r, i) \
namespace detail_ \
{ constexpr ExecMode ExecMode##i {(i & 1) != 0, (i & 2) != 0, (i & 4) != 0, (i & 8) != 0}; } \
template detail_::ExecResult<detail_::ExecMode##i>::operator bool() const; \
template detail_::ExecResult<detail_::ExecMode##i> \
exec<detail_::ExecMode##i>(detail_::ExecInput<detail_::ExecMode##i>);
BOOST_PP_FOR(0, BIU_EXEC_PRED, BIU_EXEC_OP, BIU_EXEC_MACRO)
}
}

View File

@@ -0,0 +1,9 @@
# include <biu.hpp>
int main()
{
using namespace biu::literals;
auto result = biu::exec<{.SearchPath = true}>({.Program = "sleep", .Args = {"10"}, .Timeout = 3s});
std::cout << "{}\n"_f(result.ExitCode);
assert(!result);
}

View File

@@ -0,0 +1,17 @@
# include <biu.hpp>
int main()
{
struct student
{
int number;
std::string name;
std::vector<std::optional<double>> grade;
using serialize = zpp::bits::members<3>;
auto operator<=>(const student&) const = default;
};
student bob{ 123, "Bob", { 3.5, std::nullopt, 4.0 } };
auto serialized_bob = biu::serialize(bob);
auto bob2 = biu::deserialize<student>(serialized_bob);
assert(bob == bob2);
}

View File

@@ -0,0 +1,26 @@
cmake_minimum_required(VERSION 3.14)
project(chn-bsub VERSION 0.0.0 LANGUAGES CXX)
enable_testing()
include(GNUInstallDirs)
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message("Setting build type to 'Release' as none was specified.")
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
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)
install(TARGETS chn-bsub RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
get_property(ImportedTargets DIRECTORY "${CMAKE_SOURCE_DIR}" PROPERTY IMPORTED_TARGETS)
message("Imported targets: ${ImportedTargets}")
message("List of compile features: ${CMAKE_CXX_COMPILE_FEATURES}")

View File

@@ -0,0 +1,12 @@
{
stdenv, lib, sbatchConfig ? null, substituteAll, runCommand,
cmake, pkg-config, ftxui, biu
}:
stdenv.mkDerivation
{
name = "chn-bsub";
src = ./.;
buildInputs = [ ftxui biu ];
nativeBuildInputs = [ cmake pkg-config ];
postInstall = "ln -s chn-bsub $out/bin/chn_bsub";
}

View File

@@ -0,0 +1,202 @@
# include <map>
# include <filesystem>
# 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>
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 =
{
{"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
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();
}();
std::string bsub = "";
std::string user_command = "";
} state;
// 为组件增加标题栏
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()
});
});
};
// 构建界面, 需要至少 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
({
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
({
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);
}();
// 实际投递任务
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;
}
}

View File

@@ -1,32 +1,24 @@
inputs: rec
{
typora = inputs.pkgs.callPackage ./typora {};
vesta = inputs.pkgs.callPackage ./vesta {};
rsshub = inputs.pkgs.callPackage ./rsshub.nix
{
inherit mkPnpmPackage;
src = inputs.topInputs.rsshub;
nodejs = nodejs-with-pnpm9.override { nodejs = inputs.pkgs.nodejs_22; };
};
misskey = inputs.pkgs.callPackage ./misskey.nix
{ inherit mkPnpmPackage; src = inputs.topInputs.misskey; nodejs = nodejs-with-pnpm9; };
mk-meili-mgn = inputs.pkgs.callPackage ./mk-meili-mgn {};
vaspkit = inputs.pkgs.callPackage ./vaspkit { inherit (inputs.localLib) attrsToList; };
v-sim = inputs.pkgs.callPackage ./v-sim { src = inputs.topInputs.v-sim; };
concurrencpp = inputs.pkgs.callPackage ./concurrencpp { src = inputs.topInputs.concurrencpp; };
eigengdb = inputs.pkgs.python3Packages.callPackage ./eigengdb {};
nodesoup = inputs.pkgs.callPackage ./nodesoup { src = inputs.topInputs.nodesoup; };
matplotplusplus = inputs.pkgs.callPackage ./matplotplusplus
vesta = inputs.pkgs.callPackage ./vesta.nix {};
rsshub = inputs.pkgs.callPackage ./rsshub.nix { inherit mkPnpmPackage; src = inputs.topInputs.rsshub; };
misskey = inputs.pkgs.callPackage ./misskey.nix { inherit mkPnpmPackage; src = inputs.topInputs.misskey; };
mk-meili-mgn = inputs.pkgs.callPackage ./mk-meili-mgn.nix {};
vaspkit = inputs.pkgs.callPackage ./vaspkit.nix { inherit (inputs.localLib) attrsToList; };
v-sim = inputs.pkgs.callPackage ./v-sim.nix { src = inputs.topInputs.v-sim; };
concurrencpp = inputs.pkgs.callPackage ./concurrencpp.nix { src = inputs.topInputs.concurrencpp; };
eigengdb = inputs.pkgs.python3Packages.callPackage ./eigengdb.nix {};
nodesoup = inputs.pkgs.callPackage ./nodesoup.nix { src = inputs.topInputs.nodesoup; };
matplotplusplus = inputs.pkgs.callPackage ./matplotplusplus.nix
{ inherit nodesoup glad; src = inputs.topInputs.matplotplusplus; };
zpp-bits = inputs.pkgs.callPackage ./zpp-bits { src = inputs.topInputs.zpp-bits; };
eigen = inputs.pkgs.callPackage ./eigen { src = inputs.topInputs.eigen; };
nameof = inputs.pkgs.callPackage ./nameof { src = inputs.topInputs.nameof; };
pslist = inputs.pkgs.callPackage ./pslist {};
glad = inputs.pkgs.callPackage ./glad {};
chromiumos-touch-keyboard = inputs.pkgs.callPackage ./chromiumos-touch-keyboard {};
yoga-support = inputs.pkgs.callPackage ./yoga-support {};
tgbot-cpp = inputs.pkgs.callPackage ./tgbot-cpp { src = inputs.topInputs.tgbot-cpp; };
mirism = inputs.pkgs.callPackage ./mirism
zpp-bits = inputs.pkgs.callPackage ./zpp-bits.nix { src = inputs.topInputs.zpp-bits; };
eigen = inputs.pkgs.callPackage ./eigen.nix { src = inputs.topInputs.eigen; };
nameof = inputs.pkgs.callPackage ./nameof.nix { src = inputs.topInputs.nameof; };
pslist = inputs.pkgs.callPackage ./pslist.nix {};
glad = inputs.pkgs.callPackage ./glad.nix {};
yoga-support = inputs.pkgs.callPackage ./yoga-support.nix {};
tgbot-cpp = inputs.pkgs.callPackage ./tgbot-cpp.nix { src = inputs.topInputs.tgbot-cpp; };
mirism = inputs.pkgs.callPackage ./mirism.nix
{
inherit cppcoro nameof tgbot-cpp date;
nghttp2 = inputs.pkgs.callPackage "${inputs.topInputs."nixpkgs-23.05"}/pkgs/development/libraries/nghttp2"
@@ -34,53 +26,53 @@ inputs: rec
stdenv = inputs.pkgs.gcc12Stdenv;
};
cppcoro = inputs.pkgs.callPackage ./cppcoro { src = inputs.topInputs.cppcoro; };
date = inputs.pkgs.callPackage ./date { src = inputs.topInputs.date; };
esbonio = inputs.pkgs.python3Packages.callPackage ./esbonio {};
date = inputs.pkgs.callPackage ./date.nix { src = inputs.topInputs.date; };
esbonio = inputs.pkgs.python3Packages.callPackage ./esbonio.nix {};
pix2tex = inputs.pkgs.python3Packages.callPackage ./pix2tex {};
pyreadline3 = inputs.pkgs.python3Packages.callPackage ./pyreadline3 {};
torchdata = inputs.pkgs.python3Packages.callPackage ./torchdata {};
torchtext = inputs.pkgs.python3Packages.callPackage ./torchtext { inherit torchdata; };
win11os-kde = inputs.pkgs.callPackage ./win11os-kde { src = inputs.topInputs.win11os-kde; };
fluent-kde = inputs.pkgs.callPackage ./fluent-kde { src = inputs.topInputs.fluent-kde; };
pyreadline3 = inputs.pkgs.python3Packages.callPackage ./pyreadline3.nix {};
torchdata = inputs.pkgs.python3Packages.callPackage ./torchdata.nix {};
torchtext = inputs.pkgs.python3Packages.callPackage ./torchtext.nix { inherit torchdata; };
blurred-wallpaper = inputs.pkgs.callPackage ./blurred-wallpaper.nix { src = inputs.topInputs.blurred-wallpaper; };
slate = inputs.pkgs.callPackage ./slate { src = inputs.topInputs.slate; };
nvhpc = inputs.pkgs.callPackage ./nvhpc {};
lmod = inputs.pkgs.callPackage ./lmod { src = inputs.topInputs.lmod; };
slate = inputs.pkgs.callPackage ./slate.nix { src = inputs.topInputs.slate; };
nvhpc = inputs.pkgs.callPackage ./nvhpc.nix {};
lmod = inputs.pkgs.callPackage ./lmod.nix { src = inputs.topInputs.lmod; };
vasp = rec
{
src = inputs.pkgs.callPackage ./vasp/source.nix {};
gnu = inputs.pkgs.callPackage ./vasp/gnu
{
inherit (inputs.pkgs.llvmPackages) openmp;
inherit wannier90 src;
inherit src;
hdf5 = inputs.pkgs.hdf5.override { mpiSupport = true; fortranSupport = true; cppSupport = false; };
};
nvidia = inputs.pkgs.callPackage ./vasp/nvidia
{ inherit lmod nvhpc wannier90 vtst src; hdf5 = hdf5-nvhpc; };
{ inherit lmod nvhpc vtst src; hdf5 = hdf5-nvhpc; };
intel = inputs.pkgs.callPackage ./vasp/intel
{ inherit lmod oneapi wannier90 vtst src; hdf5 = hdf5-oneapi; };
wannier90 = inputs.pkgs.callPackage
"${inputs.topInputs.nixpkgs-unstable}/pkgs/by-name/wa/wannier90/package.nix" {};
{ inherit lmod oneapi vtst src; hdf5 = hdf5-oneapi; };
hdf5-nvhpc = inputs.pkgs.callPackage ./vasp/hdf5-nvhpc { inherit lmod nvhpc; inherit (inputs.pkgs.hdf5) src; };
hdf5-oneapi = inputs.pkgs.callPackage ./vasp/hdf5-oneapi { inherit lmod oneapi; inherit (inputs.pkgs.hdf5) src; };
vtst = (inputs.pkgs.callPackage ./vasp/vtst.nix {});
vtstscripts = inputs.pkgs.callPackage ./vasp/vtstscripts.nix {};
};
# TODO: use other people packaged hpc version
oneapi = inputs.pkgs.callPackage ./oneapi {};
mumax = inputs.pkgs.callPackage ./mumax { src = inputs.topInputs.mumax; };
kylin-virtual-keyboard = inputs.pkgs.libsForQt5.callPackage ./kylin-virtual-keyboard
oneapi = inputs.pkgs.callPackage ./oneapi.nix {};
mumax = inputs.pkgs.callPackage ./mumax.nix { src = inputs.topInputs.mumax; };
kylin-virtual-keyboard = inputs.pkgs.libsForQt5.callPackage ./kylin-virtual-keyboard.nix
{ src = inputs.topInputs.kylin-virtual-keyboard; };
biu = inputs.pkgs.callPackage ./biu { inherit nameof zpp-bits; };
zxorm = inputs.pkgs.callPackage ./zxorm { src = inputs.topInputs.zxorm; };
hpcstat = inputs.pkgs.callPackage ./hpcstat { inherit nameof sqlite-orm zpp-bits date openxlsx biu; };
openxlsx = inputs.pkgs.callPackage ./openxlsx { src = inputs.topInputs.openxlsx; };
sqlite-orm = inputs.pkgs.callPackage ./sqlite-orm { src = inputs.topInputs.sqlite-orm; };
zxorm = inputs.pkgs.callPackage ./zxorm.nix { src = inputs.topInputs.zxorm; };
hpcstat = inputs.pkgs.callPackage ./hpcstat
{ inherit sqlite-orm date biu openxlsx; stdenv = inputs.pkgs.gcc14Stdenv; };
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 {};
nodejs-with-pnpm9 = inputs.pkgs.callPackage ./nodejs-with-pnpm9.nix {};
sbatch-tui = inputs.pkgs.callPackage ./sbatch-tui { inherit biu; };
ufo = inputs.pkgs.callPackage ./ufo
{ inherit concurrencpp biu glad matplotplusplus zpp-bits; tbb = inputs.pkgs.tbb_2021_11; };
chn-bsub = inputs.pkgs.callPackage ./chn-bsub { inherit biu; };
winjob = inputs.pkgs.callPackage ./winjob {};
sockpp = inputs.pkgs.callPackage ./sockpp.nix { src = inputs.topInputs.sockpp; };
git-lfs-transfer = inputs.pkgs.callPackage ./git-lfs-transfer.nix { src = inputs.topInputs.git-lfs-transfer; };
fromYaml = content: builtins.fromJSON (builtins.readFile
(inputs.pkgs.runCommand "toJSON" {}

View File

@@ -1,22 +0,0 @@
{ lib, stdenv, src }: stdenv.mkDerivation
{
name = "fluent-kde";
inherit src;
installPhase =
''
mkdir -p $out/share/aurorae/themes
cp -r $src/aurorae/* $out/share/aurorae/themes
mkdir -p $out/share/color-schemes
cp -r $src/color-schemes/*.colors $out/share/color-schemes
mkdir -p $out/share/Kvantum
cp -r $src/Kvantum/Fluent* $out/share/Kvantum
mkdir -p $out/share/plasma/desktoptheme
cp -r $src/plasma/desktoptheme/* $out/share/plasma/desktoptheme
mkdir -p $out/share/plasma/layout-templates
cp -r $src/plasma/layout-templates/* $out/share/plasma/layout-templates
mkdir -p $out/share/plasma/look-and-feel
cp -r $src/plasma/look-and-feel/com.github.vinceliuice.Fluent* $out/share/plasma/look-and-feel
mkdir -p $out/share/wallpapers
cp -r $src/wallpaper/* $out/share/wallpapers
'';
}

View File

@@ -0,0 +1,6 @@
{ buildGoModule, src }: buildGoModule
{
name = "git-lfs-transfer";
inherit src;
vendorHash = "sha256-9S1CIcUbGvmS/XlZZwNqG/ePYO3HNZnkQvbp/m/CmEY=";
}

View File

@@ -1,3 +1,3 @@
CompileFlags:
Add: [ -Wall, -Wextra, -std=c++23 ]
Add: [ -Wall, -Wextra, -std=c++26 ]
Compiler: g++

View File

@@ -1,4 +1,5 @@
cmake_minimum_required(VERSION 3.14)
# cmake_minimum_required(VERSION 3.30)
cmake_minimum_required(VERSION 3.29)
project(hpcstat VERSION 0.0.0 LANGUAGES CXX)
enable_testing()
include(GNUInstallDirs)
@@ -14,22 +15,21 @@ set(HPCSTAT_VERSION "unknown" CACHE STRING "Version of the hpcstat")
find_package(Boost REQUIRED COMPONENTS headers filesystem)
find_package(SqliteOrm REQUIRED)
find_package(nlohmann_json REQUIRED)
find_path(ZPP_BITS_INCLUDE_DIR zpp_bits.h REQUIRED)
find_package(range-v3 REQUIRED)
find_path(NAMEOF_INCLUDE_DIR nameof.hpp REQUIRED)
find_package(date REQUIRED)
find_package(OpenXLSX REQUIRED)
find_package(httplib REQUIRED)
find_package(termcolor REQUIRED)
find_package(biu REQUIRED)
find_package(OpenXLSX REQUIRED)
add_executable(hpcstat src/main.cpp src/env.cpp src/keys.cpp src/ssh.cpp src/sql.cpp src/lfs.cpp src/common.cpp
src/push.cpp src/disk.cpp)
target_compile_features(hpcstat PRIVATE cxx_std_23)
target_include_directories(hpcstat PRIVATE ${PROJECT_SOURCE_DIR}/include ${ZPP_BITS_INCLUDE_DIR})
# target_compile_features(hpcstat PRIVATE cxx_std_26)
target_compile_options(hpcstat PRIVATE "-std=c++26")
target_include_directories(hpcstat PRIVATE ${PROJECT_SOURCE_DIR}/include)
target_link_libraries(hpcstat PRIVATE Boost::headers Boost::filesystem sqlite_orm::sqlite_orm
nlohmann_json::nlohmann_json range-v3::range-v3 date::date date::date-tz OpenXLSX::OpenXLSX httplib::httplib
termcolor::termcolor biu::biu)
nlohmann_json::nlohmann_json range-v3::range-v3 date::date date::date-tz httplib::httplib
termcolor::termcolor biu::biu OpenXLSX::OpenXLSX)
target_compile_definitions(hpcstat PRIVATE HPCSTAT_VERSION="${HPCSTAT_VERSION}")
install(TARGETS hpcstat RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})

View File

@@ -1,13 +1,12 @@
{
stdenv, cmake, pkg-config, standalone ? false, version ? null, makeWrapper, lib,
boost, fmt, sqlite-orm, nlohmann_json, zpp-bits, range-v3, nameof, openssh, sqlite, date, openxlsx, httplib, openssl,
termcolor, duc, biu
sqlite-orm, nlohmann_json, range-v3, openssh, sqlite, date, httplib, openssl, openxlsx, termcolor, duc, biu
}: stdenv.mkDerivation
{
name = "hpcstat";
src = ./.;
buildInputs =
[ boost fmt sqlite-orm nlohmann_json zpp-bits range-v3 nameof sqlite date openxlsx httplib termcolor openssl biu ];
[ sqlite-orm nlohmann_json range-v3 sqlite date httplib termcolor openssl biu openxlsx ];
nativeBuildInputs = [ cmake pkg-config makeWrapper ];
cmakeFlags = lib.optionals (version != null) [ "-DHPCSTAT_VERSION=${version}" ];
postInstall =

View File

@@ -15,7 +15,6 @@
# include <date/date.h>
# include <date/tz.h>
# include <boost/interprocess/sync/file_lock.hpp>
# include <zpp_bits.h>
# include <biu.hpp>
namespace hpcstat

View File

@@ -62,7 +62,7 @@ namespace hpcstat::sql
// 三个字符串分别是序列化后的数据,签名,指纹
std::optional<std::vector<std::tuple<std::string, std::string, std::string>>>
verify(std::string old_db, std::string new_db);
// 将某个月份的数据导出到文件
// 将某个月份的数据导出
bool export_data(long start_time, long end_time, std::string filename);
// 检查任务状态,返回有变化的任务 id、名称、现在的状态、提交时的 key、subaccount
// 如果没有找到提交时的信息,则忽略这个任务

View File

@@ -31,11 +31,11 @@ namespace hpcstat::disk
else if
(
auto result = biu::exec<{.DirectStdout = true, .DirectStderr = true}>
(
({
// duc index -d ./duc.db -p ~
"{}/duc"_f(*ducbindir),
{ "index", "-d", "{}/duc.db"_f(*datadir), "-p", *homedir }
);
});
!result
)
{ std::cerr << "failed to index\n"; return false; }
@@ -57,14 +57,14 @@ namespace hpcstat::disk
if
(
auto result = biu::exec
(
({
// duc ls -d ./duc.db -b -D /data/gpfs01/jykang/linwei/xxx
"{}/duc"_f(*ducbindir),
{
"ls", "-d", "{}/duc.db"_f(*datadir), "-b", "-D",
"{}{}{}"_f(*homedir, path ? "/" : "", path.value_or(""))
}
);
});
!result
)
{ std::cerr << "failed to ls {}\n"_f(path); return {}; }
@@ -90,7 +90,7 @@ namespace hpcstat::disk
(
// duc info -d ./duc.db
auto result = biu::exec
("{}/duc"_f(*ducbindir), { "info", "-d", "{}/duc.db"_f(*datadir) });
({"{}/duc"_f(*ducbindir), { "info", "-d", "{}/duc.db"_f(*datadir) }});
!result
)
{ std::cerr << "failed to get duc info\n"; return {}; }

View File

@@ -27,7 +27,7 @@ namespace hpcstat::lfs
}
else break;
}
if (auto result = biu::exec(*bsub, args); !result) return std::nullopt;
if (auto result = biu::exec({*bsub, args}); !result) return std::nullopt;
else
{
// Job <462270> is submitted to queue <normal_1day>.
@@ -45,10 +45,11 @@ namespace hpcstat::lfs
if
(
auto result = biu::exec<{.SearchPath = true}>
(
"bjobs", { "-a", "-o", "jobid submit_time stat cpu_used job_name", "-json" },
{}, { { "LSB_DISPLAY_YEAR", "Y" } }
);
({
.Program="bjobs",
.Args={ "-a", "-o", "jobid submit_time stat cpu_used job_name", "-json" },
.ExtraEnv={ { "LSB_DISPLAY_YEAR", "Y" } }
});
!result
)
return std::nullopt;
@@ -79,7 +80,11 @@ namespace hpcstat::lfs
}
std::optional<std::string> bjobs_detail(unsigned jobid)
{
if (auto result = biu::exec<{.SearchPath = true}>("bjobs", { "-l", "{}"_f(jobid) }); !result)
if
(
auto result = biu::exec<{.SearchPath = true}>({"bjobs", { "-l", "{}"_f(jobid) }});
!result
)
return std::nullopt;
else return result.Stdout;
}

View File

@@ -7,7 +7,6 @@
# include <hpcstat/disk.hpp>
# include <range/v3/view.hpp>
# include <boost/exception/diagnostic_information.hpp>
# include <boost/filesystem.hpp>
# include <termcolor/termcolor.hpp>
int main(int argc, const char** argv)
@@ -16,10 +15,6 @@ int main(int argc, const char** argv)
using namespace std::literals;
try
{
auto lockfile = (boost::filesystem::temp_directory_path() / "hpcstat.lock").string();
std::ofstream{lockfile};
boost::interprocess::file_lock lock(lockfile.c_str());
std::vector<std::string> args(argv, argv + argc);
if (args.size() == 1)
@@ -27,11 +22,7 @@ int main(int argc, const char** argv)
std::cout << "Usage: hpcstat initdb|login|logout|submitjob|finishjob|verify|export|version|diskstat\n";
return 1;
}
else if (args[1] == "initdb")
{
lock.lock();
if (!sql::initdb()) { std::cerr << "Failed to initialize database\n"; return 1; }
}
else if (args[1] == "initdb") { if (!sql::initdb()) { std::cerr << "Failed to initialize database\n"; return 1; } }
else if (args[1] == "login")
{
if (env::interactive()) std::cout << "Communicating with the agent..." << std::flush;
@@ -50,7 +41,6 @@ int main(int argc, const char** argv)
auto signature = ssh::sign(biu::serialize<char>(data), *fp);
if (!signature) return 1;
data.Signature = *signature;
lock.lock();
sql::writedb(data);
if (env::interactive())
{
@@ -88,7 +78,7 @@ int main(int argc, const char** argv)
{
if (auto session_id = env::env("XDG_SESSION_ID", true); !session_id)
return 1;
else { lock.lock(); sql::writedb(sql::LogoutData{ .Time = now(), .SessionId = *session_id }); }
else sql::writedb(sql::LogoutData{ .Time = now(), .SessionId = *session_id });
}
else if (args[1] == "submitjob")
{
@@ -111,14 +101,12 @@ int main(int argc, const char** argv)
auto signature = ssh::sign(biu::serialize<char>(data), *fp);
if (!signature) return 1;
data.Signature = *signature;
lock.lock();
sql::writedb(data);
std::cout << "Job <{}> was submitted to <{}> by <{}>.\n"_f(bsub->first, bsub->second, Keys[*fp].Username);
}
}
else if (args[1] == "finishjob")
{
lock.lock();
if (auto fp = ssh::fingerprint(); !fp) return 1;
else if (auto session = env::env("XDG_SESSION_ID", true); !session)
return 1;
@@ -166,13 +154,10 @@ int main(int argc, const char** argv)
auto begin = sys_seconds(sys_days(month(month_n) / 1 / year_n)).time_since_epoch().count();
auto end = sys_seconds(sys_days(month(month_n) / 1 / year_n + months(1)))
.time_since_epoch().count();
lock.lock();
if (!sql::export_data(begin, end, "hpcstat-{}-{}.xlsx"_f(year_n, month_n)))
return 1;
if (!sql::export_data(begin, end, "{}{}.xlsx"_f(year_n, month_n))) return 1;
}
else if (args[1] == "push")
{
lock.lock();
if (auto jobs = sql::check_job_status(); !jobs) return 1;
else if (!push::push(*jobs)) return 1;
}

View File

@@ -8,14 +8,16 @@
# define SQLITE_ORM_OPTIONAL_SUPPORTED
# include <sqlite_orm/sqlite_orm.h>
# include <OpenXLSX.hpp>
# include <boost/filesystem.hpp>
namespace hpcstat::sql
{
auto connect(std::optional<std::string> dbfile = std::nullopt)
auto connect(std::optional<std::string> dbfile = std::nullopt, bool need_lock = true)
{
auto conn = [&]() { return std::make_optional(sqlite_orm::make_storage
// a function to actually connecto to db
auto conn = [](std::string dbfile) { return std::make_optional(sqlite_orm::make_storage
(
*dbfile,
dbfile,
sqlite_orm::make_table
(
"login",
@@ -70,31 +72,52 @@ namespace hpcstat::sql
sqlite_orm::make_column("status", &CheckJobData::Status)
)
));};
// a class to take care of lock
struct conn_with_lock
{
// lock should be declared before conn, so that it will be destructed after conn
boost::interprocess::file_lock lock;
decltype(conn(std::declval<std::string>())) connection;
};
// set default db path
if (!dbfile)
{
if (auto datadir = env::env("HPCSTAT_DATADIR", true); !datadir)
return decltype(conn())();
return conn_with_lock{};
else dbfile = std::filesystem::path(*datadir) / "hpcstat.db";
}
auto result = conn();
if (!result) std::cerr << "Failed to connect to database.\n";
else result->busy_timeout(10000);
return result;
// set file lock
auto lockfile = (boost::filesystem::temp_directory_path() / "hpcstat.lock").string();
std::ofstream{lockfile}; // create file
boost::interprocess::file_lock lock(lockfile.c_str());
if (need_lock) lock.lock();
// try to connect
if (auto result = conn(*dbfile); !result)
{ std::cerr << "Failed to connect to database.\n"; return conn_with_lock{}; }
else
{
result->busy_timeout(10000);
return conn_with_lock{std::move(lock), std::move(result)};
}
}
bool initdb()
{
if (auto conn = connect(); !conn) return false;
if (auto [lock, conn] = connect(); !conn) return false;
else { conn->sync_schema(); return true; }
}
bool writedb(auto value)
{ if (auto conn = connect(); !conn) return false; else { conn->insert(value); return true; } }
{ if (auto [lock, conn] = connect(); !conn) return false; else { conn->insert(value); return true; } }
template bool writedb(LoginData);
template bool writedb(LogoutData);
template bool writedb(SubmitJobData);
template bool writedb(FinishJobData);
std::optional<std::set<unsigned>> finishjob_remove_existed(std::map<unsigned, std::string> jobid_submit_time)
{
if (auto conn = connect(); !conn) return std::nullopt;
if (auto [lock, conn] = connect(); !conn) return std::nullopt;
else
{
auto all_job = jobid_submit_time | ranges::views::keys | ranges::to<std::vector<unsigned>>;
@@ -110,7 +133,8 @@ namespace hpcstat::sql
std::optional<std::vector<std::tuple<std::string, std::string, std::string>>>
verify(std::string old_db, std::string new_db)
{
auto old_conn = connect(old_db), new_conn = connect(new_db);
auto [_, old_conn] = connect(old_db);
auto [_, new_conn] = connect(new_db);
if (!old_conn || !new_conn) { std::cerr << "Failed to connect to database.\n"; return std::nullopt; }
else
{
@@ -153,7 +177,8 @@ namespace hpcstat::sql
}
}
// search corresponding job in submit table
std::optional<SubmitJobData> search_job_in_submit(auto connection, unsigned job_id, std::string submit_time)
std::optional<SubmitJobData> search_job_in_submit
(auto connection, unsigned job_id, std::string submit_time)
{
std::optional<SubmitJobData> result;
long submit_date = [&]
@@ -185,27 +210,28 @@ namespace hpcstat::sql
}
bool export_data(long start_time, long end_time, std::string filename)
{
if (auto conn = connect(); !conn) return false;
if (auto [lock, conn] = connect(); !conn) return false;
else
{
struct StatResult
// 对于一个账户的总计
struct StatAccount
{
double CpuTime = 0;
unsigned LoginInteractive = 0, LoginNonInteractive = 0, SubmitJob = 0, FinishJobSuccess = 0,
FinishJobFailed = 0;
StatResult& operator+=(const StatResult& rhs)
{
CpuTime += rhs.CpuTime;
LoginInteractive += rhs.LoginInteractive;
LoginNonInteractive += rhs.LoginNonInteractive;
SubmitJob += rhs.SubmitJob;
FinishJobSuccess += rhs.FinishJobSuccess;
FinishJobFailed += rhs.FinishJobFailed;
return *this;
}
unsigned LoginInteractive = 0, LoginNonInteractive = 0, FinishJobSuccess = 0, FinishJobFailed = 0;
};
// Key SubAccount -> StatResult
std::map<std::pair<std::string, std::optional<std::string>>, StatResult> stat;
// Key SubAccount -> StatAccount
std::map<std::pair<std::string, std::string>, StatAccount> stat_subaccount;
// Key -> StatAccount
std::map<std::optional<std::string>, StatAccount> stat_account;
// 每一个任务
struct StatJob
{
unsigned JobId;
std::optional<std::string> Key, SubmitDir, JobCommand;
std::string JobResult, SubmitTime, JobDetail;
double CpuTime;
};
std::vector<StatJob> stat_job;
// CpuTime & FinishJobSuccess & FinishJobFailed
for
(
@@ -213,14 +239,37 @@ namespace hpcstat::sql
(sqlite_orm::between(&FinishJobData::Time, start_time, end_time)))
)
{
auto job_in_submit = search_job_in_submit
(conn, it.JobId, it.SubmitTime);
std::pair<std::string, std::optional<std::string>> key;
if (!job_in_submit) key = { "", {} };
else key = std::make_pair(job_in_submit->Key, job_in_submit->Subaccount);
stat[key].CpuTime += it.CpuTime / 3600;
if (it.JobResult == "DONE") stat[key].FinishJobSuccess++;
else stat[key].FinishJobFailed++;
stat_job.push_back
({
.JobId = it.JobId, .JobResult = it.JobResult, .SubmitTime = it.SubmitTime, .JobDetail = it.JobDetail,
.CpuTime = it.CpuTime / 3600
});
if (auto job_in_submit = search_job_in_submit
(conn, it.JobId, it.SubmitTime))
{
{
auto& _ = stat_job.back();
_.Key = job_in_submit->Key;
_.SubmitDir = job_in_submit->SubmitDir;
_.JobCommand = job_in_submit->JobCommand;
}
stat_account[job_in_submit->Key].CpuTime += it.CpuTime / 3600;
if (it.JobResult == "DONE") stat_account[job_in_submit->Key].FinishJobSuccess++;
else stat_account[job_in_submit->Key].FinishJobFailed++;
if (job_in_submit->Subaccount)
{
stat_subaccount[{job_in_submit->Key, *job_in_submit->Subaccount}].CpuTime += it.CpuTime / 3600;
if (it.JobResult == "DONE")
stat_subaccount[{job_in_submit->Key, *job_in_submit->Subaccount}].FinishJobSuccess++;
else stat_subaccount[{job_in_submit->Key, *job_in_submit->Subaccount}].FinishJobFailed++;
}
}
else
{
stat_account[std::nullopt].CpuTime += it.CpuTime / 3600;
if (it.JobResult == "DONE") stat_account[std::nullopt].FinishJobSuccess++;
else stat_account[std::nullopt].FinishJobFailed++;
}
}
// LoginInteractive & LoginNonInteractive
for
@@ -229,61 +278,58 @@ namespace hpcstat::sql
(sqlite_orm::between(&LoginData::Time, start_time, end_time)))
)
{
auto key = std::make_pair(it.Key, it.Subaccount);
if (it.Interactive) stat[key].LoginInteractive++; else stat[key].LoginNonInteractive++;
if (Keys[it.Key].Username == "hpcstat") continue;
if (it.Interactive) stat_account[it.Key].LoginInteractive++; else stat_account[it.Key].LoginNonInteractive++;
if (it.Subaccount)
{
if (it.Interactive) stat_subaccount[{it.Key, *it.Subaccount}].LoginInteractive++;
else stat_subaccount[{it.Key, *it.Subaccount}].LoginNonInteractive++;
}
}
// SubmitJob
for
(
auto& it : conn->get_all<SubmitJobData>(sqlite_orm::where
(sqlite_orm::between(&SubmitJobData::Time, start_time, end_time)))
)
stat[{it.Key,it.Subaccount }].SubmitJob++;
// add all result with subaccount into result without subaccount
std::map<std::string, StatResult> stat_without_subaccount;
for (auto& [key, value] : stat) stat_without_subaccount[key.first] += value;
// remove all result without subaccount
std::erase_if(stat, [](auto& it) { return !it.first.second; });
// write to excel
// export to markdown
std::cout << "| 账号 | 使用核时 | 登陆次数(总计/交互式/非交互式) | 完成任务(总计/成功/失败) | SSH密钥编号::指纹 |\n";
std::cout << "| :--: | :--: | :--: | :--: | :--: |\n";
std::vector<std::pair<std::optional<std::string>, StatAccount>> stat_account_vector
(stat_account.begin(), stat_account.end());
auto compare = [](auto& a, auto& b)
{
if (a.first)
{ if (b.first) return Keys[*a.first].PubkeyFilename < Keys[*b.first].PubkeyFilename; else return true; }
else return false;
};
std::sort(stat_account_vector.begin(), stat_account_vector.end(), compare);
for (auto& [key, stat] : stat_account_vector)
std::cout << "| {} | {:.2f} | {}/{}/{} | {}/{}/{} | `{}` |\n"_f
(
key ? Keys[*key].Username : "(unknown)", stat.CpuTime,
stat.LoginInteractive + stat.LoginNonInteractive, stat.LoginInteractive, stat.LoginNonInteractive,
stat.FinishJobSuccess + stat.FinishJobFailed, stat.FinishJobSuccess, stat.FinishJobFailed,
key ? "{}::SHA256:{}"_f(Keys[*key].PubkeyFilename, *key) : "(unknown)"
);
for (auto& [key_subaccount, stat] : stat_subaccount)
std::cout << "| {}::{} | {:.2f} | {} | {} | {} | {} | `{}::{}` |\n"_f
(
Keys[key_subaccount.first].Username, key_subaccount.second, stat.CpuTime,
stat.LoginInteractive, stat.LoginNonInteractive, stat.FinishJobSuccess, stat.FinishJobFailed,
Keys[key_subaccount.first].PubkeyFilename, key_subaccount.first
);
// export to excel
OpenXLSX::XLDocument doc;
doc.create(filename);
doc.workbook().addWorksheet("Statistics");
auto wks1 = doc.workbook().worksheet("Statistics");
auto wks1 = doc.workbook().worksheet("Sheet1");
wks1.row(1).values() = std::vector<std::string>
{
"Username", "FingerPrint", "CpuTime", "LoginInteractive", "LoginNonInteractive",
"SubmitJob", "FinishJobSuccess", "FinishJobFailed"
"用户", "任务ID", "结果", "核时", "提交时间", "提交时当前目录", "提交命令",
"详情"
};
for
(
auto [row, it] = std::tuple(2, stat_without_subaccount.begin());
it != stat_without_subaccount.end();
it++, row++
)
for (auto [row, it] = std::tuple(2, stat_job.begin()); it != stat_job.end(); it++, row++)
wks1.row(row).values() = std::vector<std::string>
{
Keys.contains(it->first) ? Keys[it->first].Username : "(unknown)", it->first,
"{:.2f}"_f(it->second.CpuTime), "{}"_f(it->second.LoginInteractive),
"{}"_f(it->second.LoginNonInteractive), "{}"_f(it->second.SubmitJob),
"{}"_f(it->second.FinishJobSuccess), "{}"_f(it->second.FinishJobFailed)
Keys.contains(*it->Key) ? Keys[*it->Key].Username : "(unknown)",
"{}"_f(it->JobId), it->JobResult, "{:.2f}"_f(it->CpuTime), it->SubmitTime,
it->SubmitDir.value_or("(unknown)"), it->JobCommand.value_or("(unknown)"),
it->JobDetail
};
doc.workbook().addWorksheet("StatisticsWithSubAccount");
auto wks2 = doc.workbook().worksheet("StatisticsWithSubAccount");
wks2.row(1).values() = std::vector<std::string>
{
"Username::SubAccount", "CpuTime", "LoginInteractive", "LoginNonInteractive",
"SubmitJob", "FinishJobSuccess", "FinishJobFailed"
};
for (auto [row, it] = std::tuple(2, stat.begin()); it != stat.end(); it++, row++)
wks2.row(row).values() = std::vector<std::string>
{
(Keys.contains(it->first.first) ? Keys[it->first.first].Username : "(unknown)")
+ "::" + *it->first.second,
"{:.2f}"_f(it->second.CpuTime), "{}"_f(it->second.LoginInteractive),
"{}"_f(it->second.LoginNonInteractive), "{}"_f(it->second.SubmitJob),
"{}"_f(it->second.FinishJobSuccess), "{}"_f(it->second.FinishJobFailed)
};
doc.workbook().deleteSheet("Sheet1");
doc.save();
return true;
}
@@ -291,7 +337,7 @@ namespace hpcstat::sql
std::optional<std::map<unsigned, std::tuple<std::string, std::string, std::string, std::optional<std::string>>>>
check_job_status()
{
if (auto conn = connect(); !conn) return std::nullopt;
if (auto [lock, conn] = connect(); !conn) return std::nullopt;
else if (auto jobs_current = lfs::bjobs_list(); !jobs_current) return std::nullopt;
else
{

View File

@@ -12,7 +12,8 @@ namespace hpcstat::ssh
return std::nullopt;
else if
(
auto output = biu::exec(std::filesystem::path(*sshbindir) / "ssh-add", { "-l" });
auto output = biu::exec
({.Program=std::filesystem::path(*sshbindir) / "ssh-add", .Args{ "-l" }, .Timeout=10s});
!output
)
{ std::cerr << "Failed to get ssh fingerprints\n"; return std::nullopt; }
@@ -41,14 +42,15 @@ namespace hpcstat::ssh
else if
(
auto output = biu::exec
(
std::filesystem::path(*sshbindir) / "ssh-keygen",
{
({
.Program=std::filesystem::path(*sshbindir) / "ssh-keygen",
.Args={
"-Y", "sign", "-q", "-f", "{}/keys/{}"_f(*sharedir, Keys[fingerprint].PubkeyFilename),
"-n", "hpcstat@chn.moe", "-"
},
message
);
.Stdin=message,
.Timeout=10s
});
!output
)
{ std::cerr << "Failed to sign message: {}\n"_f(message); return {}; }
@@ -68,15 +70,16 @@ namespace hpcstat::ssh
auto signaturefile = tempdir / "signature";
std::ofstream(signaturefile) << signature;
auto result = biu::exec
(
std::filesystem::path(*sshbindir) / "ssh-keygen",
{
({
.Program=std::filesystem::path(*sshbindir) / "ssh-keygen",
.Args={
"-Y", "verify",
"-f", "{}/keys/{}"_f(*sharedir, Keys[fingerprint].PubkeyFilename),
"-n", "hpcstat@chn.moe", "-s", signaturefile.string()
},
message
);
.Stdin=message,
.Timeout=10s
});
std::filesystem::remove_all(tempdir.string());
return result;
}

View File

@@ -1,11 +1,11 @@
{
lib, mkPnpmPackage, nodejs, writeShellScript,
bash, cypress, vips, src
lib, mkPnpmPackage, nodejs, writeShellScript, src,
bash, cypress, vips, python3
}: (mkPnpmPackage.override { inherit nodejs; })
{
inherit src;
extraIntegritySha256."https://github.com/aiscript-dev/aiscript-languageserver/releases/download/0.1.6/aiscript-dev-aiscript-languageserver-0.1.6.tgz" = "0092d5r67bhf4xkvrdn4a2rm1drjzy7b5sw8mi7hp4pqvpc20ylr";
extraNativeBuildInputs = [ bash nodejs.pkgs.typescript nodejs.pkgs.gulp ];
extraNativeBuildInputs = [ bash nodejs.pkgs.typescript nodejs.pkgs.gulp python3 ];
extraAttrs =
{
CYPRESS_INSTALL_BINARY = "0";

View File

@@ -1,15 +0,0 @@
{ nodejs, fetchurl }: nodejs.overrideAttrs (prev:
{
passthru.pkgs = prev.passthru.pkgs.extend (final: prev:
{
pnpm = prev.pnpm.override
{
version = "9.1.0";
src = fetchurl
{
url = "https://registry.npmjs.org/pnpm/-/pnpm-9.1.0.tgz";
sha512 = "Z/WHmRapKT5c8FnCOFPVcb6vT3U8cH9AyyK+1fsVeMaq07bEEHzLO6CzW+AD62IaFkcayDbIe+tT+dVLtGEnJA==";
};
};
});
})

View File

@@ -115,8 +115,7 @@ int main()
{
// replace \n with space
boost::replace_all(submit_command, "\n", " ");
biu::exec<{.DirectStdout = true, .DirectStderr = true, .SearchPath = true}>
("sh", { "-c", submit_command });
biu::exec<{.DirectStdout = true, .DirectStderr = true, .SearchPath = true}>({"sh", { "-c", submit_command }});
};
// 进入事件循环

7
local/pkgs/sockpp.nix Normal file
View File

@@ -0,0 +1,7 @@
{ stdenv, src, cmake, pkg-config }: stdenv.mkDerivation
{
name = "sockpp";
inherit src;
nativeBuildInputs = [ cmake pkg-config ];
buildInputs = [];
}

View File

@@ -1,20 +0,0 @@
{ lib, stdenv, src }: stdenv.mkDerivation
{
name = "win11os-kde";
inherit src;
installPhase =
''
mkdir -p $out/share/aurorae/themes
cp -r $src/aurorae/* $out/share/aurorae/themes
mkdir -p $out/share/color-schemes
cp -r $src/color-schemes/*.colors $out/share/color-schemes
mkdir -p $out/share/Kvantum
cp -r $src/Kvantum/* $out/share/Kvantum
mkdir -p $out/share/plasma/desktoptheme
cp -r $src/plasma/desktoptheme/* $out/share/plasma/desktoptheme
mkdir -p $out/share/plasma/look-and-feel
cp -r $src/plasma/look-and-feel/* $out/share/plasma/look-and-feel
mkdir -p $out/share/wallpapers
cp -r $src/wallpaper/* $out/share/wallpapers
'';
}

View File

@@ -0,0 +1,3 @@
CompileFlags:
Add: [ -Wall, -Wextra, -std=c++26 ]
Compiler: g++

1
local/pkgs/winjob/.envrc Normal file
View File

@@ -0,0 +1 @@
use flake .#winjob

View File

@@ -0,0 +1,36 @@
# cmake_minimum_required(VERSION 3.30)
cmake_minimum_required(VERSION 3.29)
project(winjob VERSION 0.0.0 LANGUAGES CXX)
enable_testing()
include(GNUInstallDirs)
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message("Setting build type to 'Release' as none was specified.")
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif()
set(WINJOB_VERSION "unknown" CACHE STRING "Version of the winjob")
find_package(Boost REQUIRED COMPONENTS headers filesystem)
find_package(nlohmann_json REQUIRED)
add_executable(winjob src/winjob.cpp src/windows.cpp)
target_compile_features(winjob PRIVATE cxx_std_23)
target_include_directories(winjob PRIVATE ${PROJECT_SOURCE_DIR}/include)
target_link_libraries(winjob PRIVATE Boost::headers Boost::filesystem ws2_32 wsock32)
target_compile_definitions(winjob PRIVATE winjob_VERSION="${winjob_VERSION}")
add_executable(winjobd src/winjobd.cpp src/windows.cpp)
target_compile_features(winjob PRIVATE cxx_std_23)
target_compile_options(winjobd PRIVATE -fpermissive)
target_include_directories(winjobd PRIVATE ${PROJECT_SOURCE_DIR}/include)
target_link_libraries(winjobd PRIVATE Boost::headers Boost::filesystem ws2_32 wsock32)
target_compile_definitions(winjobd PRIVATE winjob_VERSION="${winjob_VERSION}")
install(TARGETS winjob RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
install(TARGETS winjobd RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
get_property(ImportedTargets DIRECTORY "${CMAKE_SOURCE_DIR}" PROPERTY IMPORTED_TARGETS)
message("Imported targets: ${ImportedTargets}")
message("List of compile features: ${CMAKE_CXX_COMPILE_FEATURES}")

View File

@@ -0,0 +1,12 @@
diff --color -ur a/boost/process/v2/detail/impl/utf8.ipp b/boost/process/v2/detail/impl/utf8.ipp
--- a/boost/process/v2/detail/impl/utf8.ipp 2024-07-26 15:50:15.844632780 +0800
+++ b/boost/process/v2/detail/impl/utf8.ipp 2024-07-26 15:50:09.036567016 +0800
@@ -11,7 +11,7 @@
#include <boost/process/v2/error.hpp>
#if defined(BOOST_PROCESS_V2_WINDOWS)
-#include <Windows.h>
+#include <windows.h>
#endif
BOOST_PROCESS_V2_BEGIN_NAMESPACE

View File

@@ -0,0 +1,11 @@
{
stdenv, cmake, pkg-config, version ? null, lib,
boost, nlohmann_json
}: stdenv.mkDerivation
{
name = "winjob";
src = ./.;
buildInputs = [ boost nlohmann_json ];
nativeBuildInputs = [ cmake pkg-config ];
cmakeFlags = lib.optionals (version != null) [ "-DWINJOB_VERSION=${version}" ];
}

View File

@@ -0,0 +1,9 @@
# include <optional>
# include <string>
# include <utility>
namespace winjob
{
std::optional<std::pair<std::wstring, std::wstring>> get_owner(std::wstring file_name);
bool set_permission(std::wstring fileName);
}

View File

@@ -0,0 +1,13 @@
REM run as admin
set "params=%*"
cd /d "%~dp0" && ( if exist "%temp%\getadmin.vbs" del "%temp%\getadmin.vbs" ) && fsutil dirty query %systemdrive% 1>nul 2>nul || ( echo Set UAC = CreateObject^("Shell.Application"^) : UAC.ShellExecute "cmd.exe", "/c cd ""%~sdp0"" && %~s0 %params%", "", "runas", 1 >> "%temp%\getadmin.vbs" && "%temp%\getadmin.vbs" && exit /B )
REM copy files
if not exist "C:\Program Files\winjob" mkdir "C:\Program Files\winjob"
copy winjob.exe "C:\Program Files\winjob\winjob.exe"
copy winjobd.exe "C:\Program Files\winjob\winjobd.exe"
REM create task scheduler
schtasks /create /tn "winjob" /tr "C:\Program Files\winjob\winjobd.exe" /sc onstart /ru system /f
pause

View File

@@ -0,0 +1,105 @@
# include <winjob/windows.hpp>
# include <windows.h>
# include <tchar.h>
# include <accctrl.h>
# include <aclapi.h>
namespace winjob
{
std::optional<std::pair<std::wstring, std::wstring>> get_owner(std::wstring file_name)
{
DWORD dwRtnCode = 0;
PSID pSidOwner = NULL;
BOOL bRtnBool = TRUE;
LPWSTR AcctName = NULL;
LPWSTR DomainName = NULL;
DWORD dwAcctName = 1, dwDomainName = 1;
SID_NAME_USE eUse = SidTypeUnknown;
HANDLE hFile;
PSECURITY_DESCRIPTOR pSD = NULL;
// Get the handle of the file object.
hFile = CreateFileW
(file_name.c_str(), GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
// Check GetLastError for CreateFile error code.
if (hFile == INVALID_HANDLE_VALUE) return {};
// Get the owner SID of the file.
dwRtnCode = GetSecurityInfo(hFile, SE_FILE_OBJECT, OWNER_SECURITY_INFORMATION, &pSidOwner, NULL, NULL, NULL, &pSD);
// Check GetLastError for GetSecurityInfo error condition.
if (dwRtnCode != ERROR_SUCCESS) return {};
// First call to LookupAccountSid to get the buffer sizes.
bRtnBool = LookupAccountSidW
(NULL, pSidOwner, AcctName, (LPDWORD)&dwAcctName, DomainName, (LPDWORD)&dwDomainName, &eUse);
// Reallocate memory for the buffers.
AcctName = (LPWSTR)GlobalAlloc(GMEM_FIXED, dwAcctName * sizeof(wchar_t));
// Check GetLastError for GlobalAlloc error condition.
if (AcctName == NULL) return {};
DomainName = (LPWSTR)GlobalAlloc(GMEM_FIXED, dwDomainName * sizeof(wchar_t));
// Check GetLastError for GlobalAlloc error condition.
if (DomainName == NULL) return {};
// Second call to LookupAccountSid to get the account name.
bRtnBool = LookupAccountSidW
(NULL, pSidOwner, AcctName, (LPDWORD)&dwAcctName, DomainName, (LPDWORD)&dwDomainName, &eUse);
// Check GetLastError for LookupAccountSid error condition.
if (bRtnBool == FALSE) return {};
return std::make_pair(std::wstring(DomainName), std::wstring(AcctName));
}
bool set_permission(std::wstring fileName)
{
// Define the SID for the Users group
PSID pUsersSID = NULL;
SID_IDENTIFIER_AUTHORITY SIDAuthNT = SECURITY_NT_AUTHORITY;
if (!AllocateAndInitializeSid(&SIDAuthNT, 2, SECURITY_BUILTIN_DOMAIN_RID, DOMAIN_ALIAS_RID_USERS,
0, 0, 0, 0, 0, 0, &pUsersSID))
return false;
// Initialize an EXPLICIT_ACCESS structure for an ACE
EXPLICIT_ACCESS ea;
ZeroMemory(&ea, sizeof(EXPLICIT_ACCESS));
ea.grfAccessPermissions = GENERIC_WRITE;
ea.grfAccessMode = SET_ACCESS;
ea.grfInheritance = NO_INHERITANCE;
ea.Trustee.TrusteeForm = TRUSTEE_IS_SID;
ea.Trustee.TrusteeType = TRUSTEE_IS_GROUP;
ea.Trustee.ptstrName = (LPTSTR)pUsersSID;
// Create a new ACL that contains the new ACE
PACL pACL = NULL;
DWORD dwRes = SetEntriesInAcl(1, &ea, NULL, &pACL);
if (ERROR_SUCCESS != dwRes) { FreeSid(pUsersSID); return false; }
// Initialize a security descriptor
PSECURITY_DESCRIPTOR pSD = (PSECURITY_DESCRIPTOR)LocalAlloc(LPTR, SECURITY_DESCRIPTOR_MIN_LENGTH);
if (NULL == pSD) { FreeSid(pUsersSID); LocalFree(pACL); return false; }
if (!InitializeSecurityDescriptor(pSD, SECURITY_DESCRIPTOR_REVISION))
{ FreeSid(pUsersSID); LocalFree(pACL); LocalFree(pSD); return false; }
// Add the ACL to the security descriptor
if (!SetSecurityDescriptorDacl(pSD, TRUE, pACL, FALSE))
{ FreeSid(pUsersSID); LocalFree(pACL); LocalFree(pSD); return false; }
// Change the security attributes
SECURITY_ATTRIBUTES sa;
sa.nLength = sizeof(SECURITY_ATTRIBUTES);
sa.lpSecurityDescriptor = pSD;
sa.bInheritHandle = FALSE;
if (!SetFileSecurityW(fileName.c_str(), DACL_SECURITY_INFORMATION, pSD))
{ FreeSid(pUsersSID); LocalFree(pACL); LocalFree(pSD); return false; }
else { FreeSid(pUsersSID); LocalFree(pACL); LocalFree(pSD); return true; }
}
}

View File

@@ -0,0 +1,24 @@
# include <boost/asio.hpp>
# include <fstream>
int main()
{
std::ofstream test(R"(C:\Users\chn\Desktop\test.txt)");
// boost::asio::io_context io_context;
// boost::asio::local::stream_protocol::endpoint ep(R"(C:\ProgramData\winjob\winjobd.sock)");
// // send a message to the server
// boost::asio::local::stream_protocol::socket socket(io_context);
// socket.connect(ep);
// std::string message;
// std::getline(std::cin, message);
// message += '\n';
// boost::asio::write(socket, boost::asio::buffer(message));
// // receive a message from the server
// boost::asio::streambuf buf;
// boost::asio::read_until(socket, buf, '\n');
// std::istream is(&buf);
// std::string line;
// std::getline(is, line);
// std::cout << "Received: " << line << '\n';
return 0;
}

View File

@@ -0,0 +1,70 @@
# include <winjob/windows.hpp>
# include <boost/asio.hpp>
# include <boost/process/v2/windows/with_logon_launcher.hpp>
# include <boost/process/v2/process.hpp>
# include <iostream>
# include <filesystem>
# include <fstream>
# include <windows.h>
using namespace std::literals;
int main()
{
// clear temp files
std::filesystem::create_directories(LR"(C:\ProgramData\winjob)");
if (std::filesystem::exists(LR"(C:\ProgramData\winjob\winjobd.sock)"))
std::filesystem::remove(LR"(C:\ProgramData\winjob\winjobd.sock)");
if (std::filesystem::exists(LR"(C:\ProgramData\winjob\auth)"))
std::filesystem::remove(LR"(C:\ProgramData\winjob\auth)");
std::filesystem::create_directories(LR"(C:\ProgramData\winjob\auth)");
winjob::set_permission(LR"(C:\ProgramData\winjob\auth)");
// log file
std::ofstream log(LR"(C:\ProgramData\winjob\log.txt)", std::ios::app);
auto user = winjob::get_owner(LR"(C:\Users\chn\Desktop\winjob.exe)");
if (!user)
{
log << "Failed to get owner\n" << std::flush;
return 1;
}
if (user)
{
log << "Owner: " << user->first << "\\" << user->second << '\n' << std::flush;
auto launcher = boost::process::v2::windows::with_logon_launcher(user->second, L"", user->first,
LOGON_WITH_PROFILE);
boost::asio::io_context ctx;
boost::process::v2::error_code ec;
std::wstring program = LR"(C:\Users\chn\Desktop\winjob.exe)";
auto process = launcher(ctx, ec, program, std::vector<std::wstring>{});
}
boost::asio::io_context io_context;
boost::asio::local::stream_protocol::endpoint ep(R"(C:\ProgramData\winjob\winjobd.sock)");
boost::asio::local::stream_protocol::acceptor acceptor(io_context, ep, false);
winjob::set_permission(LR"(C:\ProgramData\winjob\winjobd.sock)");
std::function<void(const boost::system::error_code&, boost::asio::local::stream_protocol::socket)> func =
[&](const boost::system::error_code& ec, boost::asio::local::stream_protocol::socket socket)
{
if (ec)
{
log << "Failed to accept connection\n" << std::flush;
return;
}
log << "Accepted connection\n" << std::flush;
boost::asio::streambuf buf;
boost::asio::read_until(socket, buf, '\n');
std::istream is(&buf);
std::string line;
std::getline(is, line);
log << "Received: " << line << '\n' << std::flush;
// write a message to the client
std::string message = "thanks for the message\n";
boost::asio::write(socket, boost::asio::buffer(message));
acceptor.async_accept(func);
};
acceptor.async_accept(func);
io_context.run();
}

View File

@@ -30,8 +30,6 @@ inputs:
nix-vscode-extensions = topInputs.nix-vscode-extensions.extensions."${prev.system}";
nur-xddxdd = topInputs.nur-xddxdd.overlays.default final prev;
nur-linyinfeng = (topInputs.nur-linyinfeng.overlays.default final prev).linyinfeng;
deploy-rs =
{ inherit (prev) deploy-rs; inherit ((topInputs.deploy-rs.overlay final prev).deploy-rs) lib; };
firefox-addons = (import "${topInputs.rycee}" { inherit (prev) pkgs; }).firefox-addons;
inherit (import topInputs.gricad { pkgs = final; }) intel-oneapi intel-oneapi-2022;
})
@@ -39,7 +37,6 @@ inputs:
home-manager.sharedModules =
[
topInputs.plasma-manager.homeManagerModules.plasma-manager
topInputs.nix-doom-emacs.hmModule
topInputs.catppuccin.homeManagerModules.catppuccin
];
};

29
modules/hardware/cpus.nix Normal file
View File

@@ -0,0 +1,29 @@
inputs:
{
options.nixos.hardware.cpus = let inherit (inputs.lib) mkOption types; in mkOption
{ type = types.listOf (types.enum [ "intel" "amd" ]); default = []; };
config = let inherit (inputs.config.nixos.hardware) cpus; in inputs.lib.mkIf (cpus != [])
{
hardware.cpu = builtins.listToAttrs
(builtins.map (name: { inherit name; value = { updateMicrocode = true; }; }) cpus);
boot =
{
initrd.availableKernelModules =
let modules =
{
intel =
[
"intel_cstate" "aesni_intel" "intel_cstate" "intel_uncore" "intel_uncore_frequency" "intel_powerclamp"
];
amd = [];
};
in builtins.concatLists (builtins.map (cpu: modules.${cpu}) cpus);
kernelParams =
let params = { intel = [ "intel_iommu=off" ]; amd = [ "amd_iommu=fullflush" ]; };
in builtins.concatLists (builtins.map (cpu: params.${cpu}) cpus);
};
environment.systemPackages =
let packages = with inputs.pkgs; { intel = []; amd = [ zenmonitor ]; };
in builtins.concatLists (builtins.map (cpu: packages.${cpu}) cpus);
};
}

View File

@@ -11,7 +11,6 @@ inputs:
joystick = mkOption { type = types.nullOr (types.submodule {}); inherit default; };
printer = mkOption { type = types.nullOr (types.submodule {}); inherit default; };
sound = mkOption { type = types.nullOr (types.submodule {}); inherit default; };
cpus = mkOption { type = types.listOf (types.enum [ "intel" "amd" ]); default = []; };
};
config = let inherit (inputs.config.nixos) hardware; in inputs.lib.mkMerge
[
@@ -44,29 +43,5 @@ inputs:
security.rtkit.enable = true;
}
)
# cpus
(
inputs.lib.mkIf (hardware.cpus != [])
{
hardware.cpu = builtins.listToAttrs
(map (name: { inherit name; value = { updateMicrocode = true; }; }) hardware.cpus);
boot =
{
initrd.availableKernelModules =
let modules =
{
intel =
[
"intel_cstate" "aesni_intel" "intel_cstate" "intel_uncore" "intel_uncore_frequency" "intel_powerclamp"
];
amd = [];
};
in builtins.concatLists (map (cpu: modules.${cpu}) hardware.cpus);
kernelParams =
let params = { intel = [ "intel_iommu=off" ]; amd = [ "amd_iommu=fullflush" ]; };
in builtins.concatLists (map (cpu: params.${cpu}) hardware.cpus);
};
}
)
];
}

View File

@@ -35,27 +35,22 @@ inputs:
{
intel = [ "i915" ];
nvidia = [ "nvidia" "nvidia_drm" "nvidia_modeset" ]; # nvidia-uvm should not be loaded
amd = [ "amdgpu" ];
amd = [];
};
in builtins.concatLists (builtins.map (gpu: modules.${gpu}) gpus);
hardware =
{
opengl =
graphics =
{
enable = true;
driSupport = true;
driSupport32Bit = true;
extraPackages =
let packages = with inputs.pkgs;
{
intel = [ intel-vaapi-driver libvdpau-va-gl intel-media-driver ];
nvidia = [ vaapiVdpau ];
amd = [ amdvlk rocmPackages.clr rocmPackages.clr.icd ];
amd = [];
};
in builtins.concatLists (builtins.map (gpu: packages.${gpu}) gpus);
extraPackages32 =
let packages = { intel = []; nvidia = []; amd = [ inputs.pkgs.driversi686Linux.amdvlk ]; };
in builtins.concatLists (builtins.map (gpu: packages.${gpu}) gpus);
};
nvidia = inputs.lib.mkIf (builtins.elem "nvidia" gpus)
{
@@ -72,12 +67,7 @@ inputs:
open = inputs.lib.mkIf (gpu.nvidia.driver == "beta") true;
};
};
boot =
{
kernelParams = inputs.lib.mkIf (builtins.elem "amd" gpus)
[ "radeon.cik_support=0" "amdgpu.cik_support=1" "radeon.si_support=0" "amdgpu.si_support=1" ];
blacklistedKernelModules = [ "nouveau" ];
};
boot.blacklistedKernelModules = [ "nouveau" ];
environment.variables.VDPAU_DRIVER = inputs.lib.mkIf (builtins.elem "intel" gpus) "va_gl";
services.xserver.videoDrivers =
let driver = { intel = "modesetting"; amd = "amdgpu"; nvidia = "nvidia"; };
@@ -99,5 +89,15 @@ inputs:
powerManagement.finegrained = inputs.lib.mkIf (gpu.nvidia.prime.mode == "offload") true;
};}
)
# amdgpu
(
inputs.lib.mkIf (inputs.lib.strings.hasPrefix "amd" gpu.type) { hardware.amdgpu =
{
opencl.enable = true;
legacySupport.enable = true;
initrd.enable = true;
amdvlk = { enable = true; support32Bit.enable = true; supportExperimental.enable = true; };
};}
)
]);
}

View File

@@ -19,18 +19,18 @@ inputs:
scrcpy weston cage openbox krita
# media
spotify yesplaymusic simplescreenrecorder imagemagick gimp netease-cloud-music-gtk vlc obs-studio
waifu2x-converter-cpp inkscape blender
waifu2x-converter-cpp inkscape blender whalebird paraview
# editor
typora
# news
fluent-reader
# nix tools
deploy-rs.deploy-rs nixpkgs-fmt appimage-run nixd nix-serve node2nix nix-prefetch-github prefetch-npm-deps
nixpkgs-fmt appimage-run nixd nix-serve node2nix nix-prefetch-github prefetch-npm-deps
nix-prefetch-docker
# instant messager
element-desktop telegram-desktop discord fluffychat zoom-us signal-desktop slack nur-linyinfeng.wemeet
# browser
google-chrome
google-chrome tor-browser
# office
crow-translate zotero pandoc ydict libreoffice-qt texstudio poppler_utils pdftk gnuplot pdfchain hdfview
texliveFull

View File

@@ -7,7 +7,8 @@ inputs:
packages._packages = with inputs.pkgs;
[
# system management
gparted wayland-utils clinfo glxinfo vulkan-tools dracut
# TODO: module should add yubikey-touch-detector into path
gparted wayland-utils clinfo glxinfo vulkan-tools dracut yubikey-touch-detector
(
writeShellScriptBin "xclip"
''
@@ -26,12 +27,9 @@ inputs:
# media
mpv nomacs
# themes
localPackages.win11os-kde localPackages.fluent-kde localPackages.blurred-wallpaper
localPackages.slate utterly-nord-plasma utterly-round-plasma-style catppuccin catppuccin-sddm
catppuccin-cursors catppuccinifier-gui catppuccinifier-cli catppuccin-plymouth
(catppuccin-kde.override { flavour = [ "latte" ]; })
(catppuccin-gtk.override { variant = "latte"; })
(tela-circle-icon-theme.override { allColorVariants = true; })
catppuccin catppuccin-sddm catppuccin-cursors catppuccinifier-gui catppuccinifier-cli catppuccin-plymouth
(catppuccin-kde.override { flavour = [ "latte" ]; }) (catppuccin-kvantum.override { variant = "latte"; })
localPackages.slate localPackages.blurred-wallpaper tela-circle-icon-theme
# terminal
warp-terminal
# development
@@ -52,20 +50,6 @@ inputs:
{
patches = (if (attrs ? patches) then attrs.patches else []) ++ [ ./telegram.patch ];
});
kdePackages = prev.kdePackages.overrideScope (final: prev:
{
kwin = prev.kwin.overrideAttrs (prev: { patches = prev.patches ++
[
{
"6.0.5" = inputs.pkgs.fetchurl
{
url = "https://aur.archlinux.org/cgit/aur.git/plain/explicit-sync.patch?h=kwin-explicit-sync"
+ "&id=b6fb7e1b8651365af426cfc7be0d03b9615fdd3a";
sha256 = "1zcksalmkf0mifmv0zl5awy1ch3fvfkkknxqk4mqg0vk1bbpjh2b";
};
}.${prev.version}
]; });
});
})];
services.pcscd.enable = true;
};

View File

@@ -11,7 +11,10 @@ inputs:
{
init.defaultBranch = "main";
core.quotepath = false;
lfs.ssh.automultiplex = false; # 避免 lfs 一直要求触摸 yubikey
receive.denyCurrentBranch = "warn"; # 允许 push 到非 bare 的仓库
};
};
nixos.packages._packages = [ inputs.pkgs.localPackages.git-lfs-transfer ]; # make pure ssh lfs work
};
}

View File

@@ -26,11 +26,7 @@ inputs:
])];
};
};
programs =
{
yazi.enable = true;
mosh.enable = true;
};
programs.yazi.enable = true;
services.fwupd.enable = true;
};
}

View File

@@ -6,7 +6,7 @@ inputs:
[
# basic tools
beep dos2unix gnugrep pv tmux screen parallel tldr cowsay jq zellij ipfetch localPackages.pslist
fastfetch reptyr nushellFull duc ncdu progress
fastfetch reptyr nushell duc ncdu progress
# lsxx
pciutils usbutils lshw util-linux lsof dmidecode lm_sensors
# top
@@ -30,7 +30,7 @@ inputs:
# nix tools
nix-output-monitor nix-tree ssh-to-age (callPackage "${inputs.topInputs.nix-fast-build}" {}) nix-inspect
# development
gdb try inputs.topInputs.plasma-manager.packages.${inputs.pkgs.system}.rc2nix
gdb try inputs.topInputs.plasma-manager.packages.${inputs.pkgs.system}.rc2nix rr
# stupid things
toilet lolcat
]
@@ -43,6 +43,7 @@ inputs:
command-not-found.enable = false;
autojump.enable = true;
direnv = { enable = true; nix-direnv.enable = true; };
mosh.enable = true;
};
services.udev.packages = with inputs.pkgs; [ yubikey-personalization libfido2 ];
home-manager = { useGlobalPkgs = true; useUserPackages = true; };

View File

@@ -5,6 +5,16 @@ inputs:
services.openssh.knownHosts =
let servers =
{
vps4 =
{
ed25519 = "AAAAC3NzaC1lZDI1NTE5AAAAIF7Y0tjt1XLPjqJ8HEB26W9jVfJafRQ3pv5AbPaxEc/Z";
hostnames = [ "vps4.chn.moe" "104.234.37.61" ];
};
"initrd.vps4" =
{
ed25519 = "AAAAC3NzaC1lZDI1NTE5AAAAIJkOPTFvX9f+Fn/KHOIvUgoRiJfq02T42lVGQhpMUGJq";
hostnames = [ "initrd.vps4.chn.moe" "104.234.37.61" ];
};
vps6 =
{
ed25519 = "AAAAC3NzaC1lZDI1NTE5AAAAIO5ZcvyRyOnUCuRtqrM/Qf+AdUe3a5bhbnfyhw2FSLDZ";
@@ -28,12 +38,12 @@ inputs:
nas =
{
ed25519 = "AAAAC3NzaC1lZDI1NTE5AAAAIIktNbEcDMKlibXg54u7QOLt0755qB/P4vfjwca8xY6V";
hostnames = [ "wireguard.nas.chn.moe" "[office.chn.moe]:5440" "192.168.1.185" "192.168.83.4" ];
hostnames = [ "wireguard.nas.chn.moe" "192.168.1.2" "192.168.83.4" ];
};
"initrd.nas" =
{
ed25519 = "AAAAC3NzaC1lZDI1NTE5AAAAIAoMu0HEaFQsnlJL0L6isnkNZdRq0OiDXyaX3+fl3NjT";
hostnames = [ "initrd.nas.chn.moe" "[office.chn.moe]:5440" "192.168.1.185" ];
hostnames = [ "initrd.nas.chn.moe" "192.168.1.2" ];
};
surface =
{
@@ -96,11 +106,11 @@ inputs:
matchBlocks = builtins.listToAttrs
(
(builtins.map
(host: { name = host; value = { inherit host; hostname = "${host}.chn.moe"; }; })
[ "vps4" "vps6" "wireguard.vps6" "vps7" "wireguard.vps7" "wireguard.nas" ])
++ (builtins.map
(host: { name = host; value = { inherit host; hostname = "${host}.chn.moe"; forwardX11 = true; }; })
[
"vps6" "wireguard.vps6" "vps7" "wireguard.vps7" "wireguard.pc" "wireguard.nas" "wireguard.surface"
"wireguard.xmupc1" "wireguard.xmupc2"
])
[ "wireguard.pc" "wireguard.surface" "wireguard.xmupc1" "wireguard.xmupc2" ])
++ (builtins.map
(host:
{
@@ -115,12 +125,12 @@ inputs:
})
[ "wlin" "hwang" ])
)
// {
xmupc1 = { host = "xmupc1"; hostname = "xmupc1.chn.moe"; port = 6007; };
xmupc2 = { host = "xmupc2"; hostname = "xmupc2.chn.moe"; port = 6394; };
nas = { host = "nas"; hostname = "office.chn.moe"; port = 5440; };
pc = { host = "pc"; hostname = "office.chn.moe"; port = 3673; };
surface = { host = "surface"; hostname = "192.168.1.166"; };
// rec {
xmupc1 = { host = "xmupc1"; hostname = "xmupc1.chn.moe"; port = 6007; forwardX11 = true; };
xmupc2 = { host = "xmupc2"; hostname = "xmupc2.chn.moe"; port = 6394; forwardX11 = true; };
nas = { host = "nas"; hostname = "192.168.1.2"; forwardX11 = true; };
pc = { host = "pc"; hostname = "192.168.1.3"; forwardX11 = true; };
surface = { host = "surface"; hostname = "192.168.1.4"; forwardX11 = true; };
gitea = { host = "gitea"; hostname = "ssh.git.chn.moe"; };
jykang =
{
@@ -130,6 +140,7 @@ inputs:
forwardAgent = true;
extraOptions.AddKeysToAgent = "yes";
};
"wireguard.jykang" = jykang // { host = "internal.jykang"; proxyJump = "wireguard.xmupc1"; };
};
};
})];

View File

@@ -2,6 +2,7 @@ inputs:
{
config = inputs.lib.mkIf (builtins.elem "workstation" inputs.config.nixos.packages._packageSets)
{
nixos.packages._packages = with inputs.pkgs.localPackages.vasp; [ intel nvidia vtstscripts ];
nixos.packages._packages = inputs.lib.optionals (inputs.config.nixos.system.nixpkgs.march != null)
(with inputs.pkgs.localPackages.vasp; [ intel nvidia vtstscripts ]);
};
}

View File

@@ -21,7 +21,7 @@ inputs:
++ (builtins.attrNames vscode-extensions)
)));
in with extensions;
(with equinusocio; [ vsc-community-material-theme vsc-material-theme-icons ])
(with equinusocio; [ vsc-material-theme vsc-material-theme-icons ])
++ (with github; [ copilot copilot-chat github-vscode-theme ])
++ (with intellsmi; [ comment-translate deepl-translate ])
++ (with ms-python; [ isort python vscode-pylance ])

View File

@@ -29,16 +29,16 @@ inputs:
# math, physics and chemistry
(mathematica.overrideAttrs (prev: { postInstall = prev.postInstall or "" + "ln -s ${src} $out/src"; }))
(quantum-espresso.override { stdenv = gcc14Stdenv; gfortran = gfortran14; })
paraview jmol mpi localPackages.mumax
jmol mpi
# encryption and password management
john crunch hashcat
# container and vm
genymotion davinci-resolve playonlinux
# browser
microsoft-edge tor-browser
microsoft-edge
# news
rssguard newsflash newsboat
];
] ++ inputs.lib.optional (inputs.config.nixos.system.nixpkgs.march != null) localPackages.mumax;
_pythonPackages = [(pythonPackages: with pythonPackages;
[
phonopy tensorflow keras scipy scikit-learn jupyterlab autograd # localPackages.pix2tex

View File

@@ -41,6 +41,7 @@ inputs:
"--thread-count" "${builtins.toString instance.value.threads or 1}"
"--loadavg-target" "${builtins.toString instance.value.loadAverage or 1}"
"--scan-mode" "3"
"--verbose" "6"
];
};
})

Some files were not shown because too many files have changed in this diff Show More