mirror of
https://github.com/CHN-beta/nixos.git
synced 2026-01-12 04:19:22 +08:00
Compare commits
311 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 67217e164b | |||
| 4fa6352e27 | |||
| f32914efa7 | |||
| f94c5fe631 | |||
| 310bd3b2b7 | |||
| 62c798d73f | |||
| 6c0b4d5caa | |||
| 41fbbf3d52 | |||
| 63d5f339ea | |||
| 0470c1041c | |||
| 655e683b02 | |||
| 295153fa64 | |||
| 45a1c4520b | |||
| 7a152011f0 | |||
| 0d75fc01d4 | |||
| 89b04882c1 | |||
| 5dd03880c1 | |||
| aa026f332e | |||
| 2ef7d23a4e | |||
| d75e195136 | |||
| 0763319f0d | |||
| c7f7a46c2d | |||
| 49f5c72e90 | |||
| ffbdad9cd7 | |||
| a682c67fac | |||
| a618d4c1e7 | |||
| dff42c3ab7 | |||
| aade294318 | |||
| 56dce415c3 | |||
| 26896b20e0 | |||
| b5019a144e | |||
| 73dec27855 | |||
| 6168d570aa | |||
| 39beeb7519 | |||
| 652126a6f0 | |||
| 06dde69ced | |||
| e7e5bb9ba4 | |||
| 3a11512c53 | |||
| 3003f79c22 | |||
| cd5f61f5cc | |||
| 869e993cc2 | |||
| 18a1fa529c | |||
| b6b3d106c2 | |||
| d65b5a2768 | |||
| 37b9df52a5 | |||
| 933bf44edc | |||
| e5ae5a3980 | |||
| 57aeb9a12e | |||
| 7edb72b51f | |||
| 44eb056f49 | |||
| e408f9c488 | |||
| ffdd9e63c5 | |||
| 38f600277c | |||
| a293326f9d | |||
| afe2f17526 | |||
| 9d4c89cf17 | |||
| 13184ce627 | |||
| 513ca90a80 | |||
| 296487607b | |||
| fa4aec5641 | |||
| cdb6b37080 | |||
| 39af3963a5 | |||
| 8918a99d2c | |||
| a6ebc8e7cb | |||
| 13e5485863 | |||
| c03d217f73 | |||
| 536de32207 | |||
| 31ac9ee496 | |||
| 45812e5bc9 | |||
| 91a88141ad | |||
| f97e9325fa | |||
| d6928c035f | |||
| 7bc00c77a3 | |||
| 3e50d2b57b | |||
| 137f83ed38 | |||
| 97f6eed32c | |||
| db8d826825 | |||
| 0187a236bb | |||
| 51b9ca5023 | |||
| b46932524c | |||
| 41b2c08f48 | |||
| d6de265cbb | |||
| d1331c6b0c | |||
| dc7e408200 | |||
| 88e21a4d99 | |||
| 47ebaec698 | |||
| ae61dfb1d9 | |||
| f5bf3bff8f | |||
| 699c76ccc4 | |||
| 4bde656017 | |||
| 570befc1f5 | |||
| aa70bbe0e4 | |||
| bb5d5229a5 | |||
| 12e6b1e42e | |||
| aca32969c1 | |||
| 7a468bc611 | |||
| 113b5468d1 | |||
| 2e42bbabf2 | |||
| 4fe4a96807 | |||
| fba6519bc6 | |||
| 5348faf83b | |||
| 76b5c5dd16 | |||
| 21f3e095e6 | |||
| 9185cf65cb | |||
| 6e16e52064 | |||
| 245e4897c6 | |||
| 7c53d4c351 | |||
| 167ed596d8 | |||
| c5a318a918 | |||
| 5ca6cc05f3 | |||
| 247c1d945a | |||
| 2d45e5c9f5 | |||
| 2df2bfd0cf | |||
| bb558e5447 | |||
| 086281c6ad | |||
| a39966adab | |||
| f294f7e11b | |||
| 0d6d1f43e6 | |||
| 9b8a0ce08a | |||
| a6a629e657 | |||
| ae4774d118 | |||
| 8c6a25906d | |||
| a032f5b147 | |||
| a8d2014cf2 | |||
| 0abc2fb74e | |||
| c2d94b197c | |||
| fb9dc40813 | |||
| 77ce521f88 | |||
| aac97bbf09 | |||
| 4e72a44d4e | |||
| 946ff559c0 | |||
| 13d7bc7c66 | |||
| 7bac949a8e | |||
| fdbc7d0931 | |||
| 8fec364ae6 | |||
| 575b49c6cb | |||
| a35a65d54b | |||
| 3156219ae0 | |||
| d8c236a6e7 | |||
| ced74597d6 | |||
| 8a5cf1a721 | |||
| b19602c33f | |||
| d48e55e280 | |||
| 135df14fff | |||
| 52cd11dd2b | |||
| b9f287e089 | |||
| bffe5b809d | |||
| 4753943bbe | |||
| 2d91bd4ea0 | |||
| 8270fa73df | |||
| a1097b60e9 | |||
| f8aca249b8 | |||
| 1d581eb756 | |||
| 414685c95a | |||
| 745d7613b8 | |||
| 0d61d71fdb | |||
| 84bdee3f93 | |||
| 99e4e9da89 | |||
| 34a82e7a53 | |||
| ba270a2830 | |||
| 4c6f25118d | |||
| 42484394f1 | |||
| 24405876d1 | |||
| 0026ff0382 | |||
| a9eda967cf | |||
| 93c6869896 | |||
| 24f3d75f4b | |||
| bc7561ed10 | |||
| 2929d620a4 | |||
| 6de39f3eba | |||
| 21b4246800 | |||
| c9626a0c57 | |||
| 90cb6117aa | |||
| af98c9a312 | |||
| 1c1793dd62 | |||
| 9b5ccd0747 | |||
| ca299e0346 | |||
| 34e55061a2 | |||
| ec2540a628 | |||
| fef4d06de1 | |||
| 0e4f1d06a9 | |||
| 88a399769f | |||
| 56e14750fe | |||
| 30c5d93685 | |||
| a519d7426f | |||
| a89fe55896 | |||
| ed349970c2 | |||
| 5c9774e906 | |||
| 76414e846e | |||
| 00e693b7c8 | |||
| e6a5cd695e | |||
| e3c2861cf5 | |||
| 01eee80cd2 | |||
| 4d69011483 | |||
| 09cbc8cecd | |||
| 52c6f7b599 | |||
| 952735986d | |||
| 617759b885 | |||
| c9fed73dcb | |||
| 8bdef9e7f5 | |||
| ea4670fde6 | |||
| 4f26f648f0 | |||
| 959ca6c9b6 | |||
| babb01cd42 | |||
| 1ef3245e52 | |||
| 2f096af374 | |||
| af2f8ddb3e | |||
| 2723044b35 | |||
| 4a6d58e6a2 | |||
| 93d2999523 | |||
| 1ded318fed | |||
| be69db5925 | |||
| 5791b79245 | |||
| 094df77b5b | |||
| c9778ac500 | |||
| 3078090edf | |||
| 3767de3c2a | |||
| 6fc897d5b2 | |||
| 0575ba1cc4 | |||
| 96b58c16fe | |||
| 32e1004a2d | |||
| 85b4404e7a | |||
| f209baaa0f | |||
| 46583151f4 | |||
| 01b766e5ee | |||
| 6f5a077821 | |||
| bc244352b8 | |||
| 2be529f590 | |||
| 843abfbef9 | |||
| e376302c52 | |||
| af8426d40c | |||
| 428d12b7b9 | |||
| 47c77e8ce1 | |||
| 4a1f12adbb | |||
| fc0500c547 | |||
| 632e3baae9 | |||
| c36216802c | |||
| 98f6fef8fe | |||
| 721c34262b | |||
| b56f73d426 | |||
| c4355be79d | |||
| 21f822e5aa | |||
| 2e68c70773 | |||
| 153687806b | |||
| 35253cff0a | |||
| 91b92bd492 | |||
| 0198626002 | |||
| 173dd4a3d7 | |||
| 1854e294cf | |||
| b45a9c7a62 | |||
| 858f4c68aa | |||
| 37e6d70561 | |||
| f101038f4a | |||
| 412fac9692 | |||
| 4c7d17f001 | |||
| e8d80daee2 | |||
| 8aeb290d0f | |||
| 0f37c886a4 | |||
| 5940da526d | |||
| df2ac86e1a | |||
| 8bf7e2cb30 | |||
| 96f7056d16 | |||
| 5cc40727db | |||
| c4f8e5f61c | |||
| 03be19da5a | |||
| 7657fe3d14 | |||
| 9fee2a8e2a | |||
| db1e825cd6 | |||
| 670126ba0c | |||
| 92ddf86df1 | |||
| bd12de34b7 | |||
| a7b0906488 | |||
| 0ce31201a9 | |||
| 58d927b648 | |||
| 5efee599f7 | |||
| 2c833934e7 | |||
| c5dc456c35 | |||
| 7576726fbe | |||
| 6dfd6a8bf0 | |||
| eb68d8f8b1 | |||
| 46ae9f1aac | |||
| bb5aee5545 | |||
| a8833dac7f | |||
| d1b3f84cf3 | |||
| f813ffd053 | |||
| 00c99adca9 | |||
| ef58de9a1d | |||
| b9175a211f | |||
| 0cb7791b84 | |||
| 803af74404 | |||
| c5da42debd | |||
| e16f49b3f3 | |||
| f10c385f13 | |||
| f65ec24862 | |||
| 73261c3e3f | |||
| e50ad89bc2 | |||
| 5f4a79788d | |||
| 1360a3e9fa | |||
| d692bb8baf | |||
| dbcf7093aa | |||
| 7833f37588 | |||
| 673f241490 | |||
| a5be9adb53 | |||
| d6a1da17fb | |||
| 6e0e224530 | |||
| 1a007ab57f | |||
| da76976c3d | |||
| b46f928964 | |||
| 92fdc6c67d | |||
| 2534f35c4d | |||
| f9e376920c |
1
.gitattributes
vendored
1
.gitattributes
vendored
@@ -2,3 +2,4 @@
|
||||
*.icm filter=lfs diff=lfs merge=lfs -text
|
||||
*.jpg filter=lfs diff=lfs merge=lfs -text
|
||||
*.webp filter=lfs diff=lfs merge=lfs -text
|
||||
*.efi filter=lfs diff=lfs merge=lfs -text
|
||||
|
||||
12
.sops.yaml
12
.sops.yaml
@@ -1,6 +1,7 @@
|
||||
keys: # cat /etc/ssh/ssh_host_ed25519_key.pub | ssh-to-age
|
||||
- &chn age19ax6vm3pv8rph5tq3mmehd9sy9jk823tw8svsd790r0lkslycquqvlwz9m
|
||||
- &pc age1ffvr5pqd2lfj24e3fh53s92z6h76fda3du4y4k6r3yjumdwvpfgqzj033a
|
||||
- &vps4 age1yvrl4y0r6yzcxzzkgfwshlrtsjt8uuya6rfwks09pnft7esfcyvqmrtm5q
|
||||
- &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
|
||||
|
||||
4
blog/.gitignore
vendored
Normal file
4
blog/.gitignore
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
/themes
|
||||
/public
|
||||
/.hugo_build.lock
|
||||
/resources/_gen
|
||||
5
blog/archetypes/default.md
Normal file
5
blog/archetypes/default.md
Normal file
@@ -0,0 +1,5 @@
|
||||
+++
|
||||
title = '{{ replace .File.ContentBaseName "-" " " | title }}'
|
||||
date = {{ .Date }}
|
||||
draft = true
|
||||
+++
|
||||
6
blog/content/_index.md
Normal file
6
blog/content/_index.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
title: Introduction
|
||||
type: docs
|
||||
---
|
||||
|
||||
这里是主页
|
||||
7
blog/content/docs/example/_index.md
Normal file
7
blog/content/docs/example/_index.md
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
weight: 1
|
||||
bookFlatSection: true
|
||||
title: "Example Site"
|
||||
---
|
||||
|
||||
{{< callout emoji=":building_construction:" >}} 施工中 {{< /callout >}}
|
||||
5
blog/content/posts/_index.md
Normal file
5
blog/content/posts/_index.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
title: Blog
|
||||
---
|
||||
|
||||
我得在这里写点什么
|
||||
49
blog/content/posts/helloworld.md
Normal file
49
blog/content/posts/helloworld.md
Normal file
@@ -0,0 +1,49 @@
|
||||
---
|
||||
title: Helloworld
|
||||
date: 2024-08-24T20:13:59+08:00
|
||||
draft: false
|
||||
summary: 为什么不问问神奇海螺呢?
|
||||
math: true
|
||||
---
|
||||
|
||||
# 一级标题
|
||||
|
||||
## 二级标题
|
||||
|
||||
### 三级标题
|
||||
|
||||
hello world!
|
||||
|
||||
* 无序列表1
|
||||
* 无序列表2
|
||||
* 无序列表3
|
||||
|
||||
1. 有序列表1
|
||||
2. 有序列表2
|
||||
3. 有序列表3
|
||||
|
||||
> 这是一个引用
|
||||
> 写了两行
|
||||
|
||||
如果段与段之间
|
||||
没有空行
|
||||
会怎样?
|
||||
|
||||
```c++
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
int main() {
|
||||
cout << "Hello, World!" << endl;
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
|
||||
这是一个行内代码`printf("Hello, World!\n");`,和行内公式 $E=mc^2$。
|
||||
|
||||
$$
|
||||
\int_{-\infty}^{+\infty} e^{-x^2} \dd x = \sqrt{\pi}
|
||||
$$
|
||||
|
||||
**这是粗体文本**,*这是斜体文本*。
|
||||
|
||||
[这是一个链接](https://www.example.com)
|
||||
13
blog/default.nix
Normal file
13
blog/default.nix
Normal file
@@ -0,0 +1,13 @@
|
||||
{ stdenv, hextra, hugo }: stdenv.mkDerivation
|
||||
{
|
||||
name = "blog";
|
||||
src = ./.;
|
||||
nativeBuildInputs = [ hugo ];
|
||||
configurePhase =
|
||||
''
|
||||
mkdir themes
|
||||
ln -s ${hextra} themes/hextra
|
||||
'';
|
||||
buildPhase = "hugo";
|
||||
installPhase = "cp -r public $out";
|
||||
}
|
||||
144
blog/hugo.yaml
Normal file
144
blog/hugo.yaml
Normal file
@@ -0,0 +1,144 @@
|
||||
baseURL: https://blog.chn.moe/
|
||||
theme: hextra
|
||||
|
||||
enableRobotsTXT: true
|
||||
enableGitInfo: false
|
||||
enableEmoji: true
|
||||
hasCJKLanguage: true
|
||||
|
||||
# services:
|
||||
# googleAnalytics:
|
||||
# ID: G-MEASUREMENT_ID
|
||||
|
||||
outputs:
|
||||
home: [ html ]
|
||||
page: [ html ]
|
||||
section: [ html, rss ]
|
||||
|
||||
defaultContentLanguage: zh-cn
|
||||
languages:
|
||||
zh-cn:
|
||||
languageName: 简体中文
|
||||
languageCode: zh-CN
|
||||
weight: 1
|
||||
title: My New Hugo Site
|
||||
en:
|
||||
languageName: English
|
||||
weight: 2
|
||||
title: My New Hugo Site
|
||||
contentDir: content/en
|
||||
|
||||
# Needed for mermaid/katex shortcodes
|
||||
markup:
|
||||
goldmark:
|
||||
renderer:
|
||||
unsafe: true
|
||||
highlight:
|
||||
noClasses: false
|
||||
|
||||
enableInlineShortcodes: true
|
||||
|
||||
menu:
|
||||
main:
|
||||
- identifier: documentation
|
||||
name: Documentation
|
||||
pageRef: /docs
|
||||
weight: 1
|
||||
- identifier: blog
|
||||
name: Blog
|
||||
pageRef: /blog
|
||||
weight: 2
|
||||
- identifier: about
|
||||
name: About
|
||||
pageRef: /about
|
||||
weight: 3
|
||||
- name: Search
|
||||
weight: 4
|
||||
params:
|
||||
type: search
|
||||
- name: GitHub
|
||||
weight: 5
|
||||
url: "https://github.com/imfing/hextra"
|
||||
params:
|
||||
icon: github
|
||||
sidebar:
|
||||
- identifier: more
|
||||
name: More
|
||||
params:
|
||||
type: separator
|
||||
weight: 1
|
||||
- identifier: about
|
||||
name: "About"
|
||||
pageRef: "/about"
|
||||
weight: 2
|
||||
- identifier: hugoDocs
|
||||
name: "Hugo Docs ↗"
|
||||
url: "https://gohugo.io/documentation/"
|
||||
weight: 3
|
||||
|
||||
params:
|
||||
description: Modern, responsive, batteries-included Hugo theme for creating beautiful static websites.
|
||||
navbar:
|
||||
displayTitle: true
|
||||
displayLogo: true
|
||||
logo:
|
||||
path: images/logo.svg
|
||||
dark: images/logo-dark.svg
|
||||
# width: 40
|
||||
# height: 20
|
||||
# link: /
|
||||
width: wide
|
||||
page:
|
||||
# full (100%), wide (90rem), normal (1280px)
|
||||
width: normal
|
||||
theme:
|
||||
# light | dark | system
|
||||
default: system
|
||||
displayToggle: true
|
||||
footer:
|
||||
enable: true
|
||||
displayCopyright: true
|
||||
displayPoweredBy: true
|
||||
width: normal
|
||||
displayUpdatedDate: true
|
||||
dateFormat: "January 2, 2006"
|
||||
search:
|
||||
enable: true
|
||||
type: flexsearch
|
||||
flexsearch:
|
||||
# index page by: content | summary | heading | title
|
||||
index: content
|
||||
# full | forward | reverse | strict
|
||||
# https://github.com/nextapps-de/flexsearch/#tokenizer-prefix-search
|
||||
tokenize: forward
|
||||
editURL:
|
||||
enable: true
|
||||
base: "https://github.com/imfing/hextra/edit/main/exampleSite/content"
|
||||
blog:
|
||||
list:
|
||||
displayTags: true
|
||||
# date | lastmod | publishDate | title | weight
|
||||
sortBy: date
|
||||
sortOrder: desc # or "asc"
|
||||
highlight:
|
||||
copy:
|
||||
enable: true
|
||||
# hover | always
|
||||
display: hover
|
||||
comments:
|
||||
# TODO: enable cusdis
|
||||
enable: false
|
||||
type: giscus
|
||||
# https://giscus.app/
|
||||
giscus:
|
||||
repo: imfing/hextra
|
||||
repoId: R_kgDOJ9fJag
|
||||
category: General
|
||||
categoryId: DIC_kwDOJ9fJas4CY7gW
|
||||
# mapping: pathname
|
||||
# strict: 0
|
||||
# reactionsEnabled: 1
|
||||
# emitMetadata: 0
|
||||
# inputPosition: top
|
||||
# lang: en
|
||||
math: true
|
||||
@@ -10,12 +10,11 @@ inputs:
|
||||
{
|
||||
mount =
|
||||
{
|
||||
vfat."/dev/disk/by-uuid/13BC-F0C9" = "/boot/efi";
|
||||
vfat."/dev/disk/by-uuid/627D-1FAA" = "/boot";
|
||||
btrfs =
|
||||
{
|
||||
"/dev/disk/by-uuid/0e184f3b-af6c-4f5d-926a-2559f2dc3063"."/boot" = "/boot";
|
||||
"/dev/mapper/nix"."/nix" = "/nix";
|
||||
"/dev/mapper/root1" =
|
||||
"/dev/mapper/root3" =
|
||||
{
|
||||
"/nix/rootfs" = "/nix/rootfs";
|
||||
"/nix/persistent" = "/nix/persistent";
|
||||
@@ -30,8 +29,6 @@ inputs:
|
||||
enable = true;
|
||||
devices =
|
||||
{
|
||||
"/dev/disk/by-uuid/5cf1d19d-b4a5-4e67-8e10-f63f0d5bb649".mapper = "root1";
|
||||
"/dev/disk/by-uuid/aa684baf-fd8a-459c-99ba-11eb7636cb0d".mapper = "root2";
|
||||
"/dev/disk/by-uuid/a47f06e1-dc90-40a4-89ea-7c74226a5449".mapper = "root3";
|
||||
"/dev/disk/by-uuid/b3408fb5-68de-405b-9587-5e6fbd459ea2".mapper = "root4";
|
||||
"/dev/disk/by-uuid/a779198f-cce9-4c3d-a64a-9ec45f6f5495" = { mapper = "nix"; ssd = true; };
|
||||
@@ -39,10 +36,9 @@ inputs:
|
||||
delayedMount = [ "/" "/nix" ];
|
||||
};
|
||||
swap = [ "/nix/swap/swap" ];
|
||||
rollingRootfs.waitDevices = [ "/dev/mapper/root2" "/dev/mapper/root3" "/dev/mapper/root4" ];
|
||||
rollingRootfs.waitDevices = [ "/dev/mapper/root4" ];
|
||||
};
|
||||
initrd.sshd.enable = true;
|
||||
grub.installDevice = "efi";
|
||||
nixpkgs.march = "silvermont";
|
||||
nix.substituters = [ "https://cache.nixos.org/" "https://nix-store.chn.moe" ];
|
||||
networking = { hostname = "nas"; networkd = {}; };
|
||||
@@ -51,17 +47,14 @@ inputs:
|
||||
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 +62,7 @@ inputs:
|
||||
publicKey = "xCYRbZEaGloMk7Awr00UR3JcDJy4AzVp4QvGNoyEgFY=";
|
||||
wireguardIp = "192.168.83.4";
|
||||
};
|
||||
hpcstat = {};
|
||||
gitea = { enable = true; hostname = "git.nas.chn.moe"; ssh = { hostname = "office.chn.moe"; port = 5440; }; };
|
||||
};
|
||||
user.users = [ "chn" "xll" "zem" "yjq" "gb" ];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
BIN
devices/pc/bios/Bootx64.efi
LFS
Normal file
BIN
devices/pc/bios/Bootx64.efi
LFS
Normal file
Binary file not shown.
BIN
devices/pc/bios/DisplayEngine.efi
LFS
Normal file
BIN
devices/pc/bios/DisplayEngine.efi
LFS
Normal file
Binary file not shown.
BIN
devices/pc/bios/SetupBrowser.efi
LFS
Normal file
BIN
devices/pc/bios/SetupBrowser.efi
LFS
Normal file
Binary file not shown.
BIN
devices/pc/bios/UiApp.efi
LFS
Normal file
BIN
devices/pc/bios/UiApp.efi
LFS
Normal file
Binary file not shown.
@@ -10,29 +10,20 @@ inputs:
|
||||
{
|
||||
mount =
|
||||
{
|
||||
vfat."/dev/disk/by-uuid/E58F-416A" = "/boot/efi";
|
||||
btrfs =
|
||||
{
|
||||
"/dev/disk/by-uuid/066be4fd-8617-4fe1-9654-c133c2996d33"."/" = "/boot";
|
||||
"/dev/mapper/root" = { "/nix" = "/nix"; "/nix/rootfs/current" = "/"; };
|
||||
};
|
||||
vfat."/dev/disk/by-uuid/7A60-4232" = "/boot";
|
||||
btrfs."/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";
|
||||
rollingRootfs = {};
|
||||
};
|
||||
grub =
|
||||
{
|
||||
# TODO: install windows
|
||||
# windowsEntries = { "7317-1DB6" = "Windows"; "7321-FA9C" = "Windows for malware"; };
|
||||
installDevice = "efi";
|
||||
};
|
||||
grub.windowsEntries."7AF0-D2F2" = "Windows";
|
||||
nix =
|
||||
{
|
||||
marches =
|
||||
@@ -55,7 +46,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 = [ "hibernate-progress" "amdgpu" ];
|
||||
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;
|
||||
@@ -66,16 +63,15 @@ inputs:
|
||||
gpu =
|
||||
{
|
||||
type = "amd+nvidia";
|
||||
nvidia = { prime.busId = { amd = "6:0:0"; nvidia = "1:0:0"; }; dynamicBoost = true; driver = "beta"; };
|
||||
nvidia = { prime.busId = { amd = "5:0:0"; nvidia = "1:0:0"; }; dynamicBoost = true; driver = "latest"; };
|
||||
};
|
||||
legion = {};
|
||||
};
|
||||
packages.packageSet = "workstation";
|
||||
virtualization =
|
||||
{
|
||||
waydroid.enable = true;
|
||||
docker.enable = true;
|
||||
kvmHost = { enable = true; gui = true; autoSuspend = [ "win10" "hardconnect" ]; };
|
||||
kvmHost = { enable = true; gui = true; };
|
||||
nspawn = [ "arch" "ubuntu-22.04" "fedora" ];
|
||||
};
|
||||
services =
|
||||
@@ -139,11 +135,34 @@ inputs:
|
||||
memoryMB = 90112;
|
||||
gpus."4060" = 1;
|
||||
};
|
||||
xrdp = { enable = true; hostname = [ "pc.chn.moe" ]; };
|
||||
ollama = {};
|
||||
};
|
||||
bugs = [ "xmunet" "backlight" "amdpstate" "hibernate-mt7921e" "suspend-hibernate-no-platform" ];
|
||||
bugs = [ "xmunet" "backlight" "amdpstate" ];
|
||||
};
|
||||
boot.kernelParams = [ "acpi_osi=!" ''acpi_osi="Windows 2015"'' ];
|
||||
boot =
|
||||
{
|
||||
kernelParams = [ "acpi_osi=!" ''acpi_osi="Windows 2015"'' ];
|
||||
loader.grub =
|
||||
{
|
||||
extraFiles =
|
||||
{
|
||||
"DisplayEngine.efi" = ./bios/DisplayEngine.efi;
|
||||
"SetupBrowser.efi" = ./bios/SetupBrowser.efi;
|
||||
"UiApp.efi" = ./bios/UiApp.efi;
|
||||
"EFI/Boot/Bootx64.efi" = ./bios/Bootx64.efi;
|
||||
};
|
||||
extraEntries =
|
||||
''
|
||||
menuentry 'Advanced UEFI Firmware Settings' {
|
||||
insmod fat
|
||||
insmod chain
|
||||
chainloader @bootRoot@/EFI/Boot/Bootx64.efi
|
||||
}
|
||||
'';
|
||||
};
|
||||
};
|
||||
# 禁止鼠标等在睡眠时唤醒
|
||||
services.udev.extraRules = ''ACTION=="add", ATTR{power/wakeup}="disabled"'';
|
||||
networking.extraHosts = "74.211.99.69 mirism.one beta.mirism.one ng01.mirism.one";
|
||||
services.colord.enable = true;
|
||||
environment.persistence."/nix/archive" =
|
||||
@@ -151,7 +170,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 =
|
||||
{
|
||||
@@ -164,6 +183,11 @@ inputs:
|
||||
};
|
||||
system.nixos.tags = [ "nvidia" ];
|
||||
};
|
||||
zen.configuration =
|
||||
{
|
||||
nixos.system.kernel = { variant = inputs.lib.mkForce "zen"; patches = inputs.lib.mkForce []; };
|
||||
system.nixos.tags = [ "zen" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -10,13 +10,13 @@ inputs:
|
||||
{
|
||||
mount =
|
||||
{
|
||||
vfat."/dev/disk/by-uuid/CE84-E0D8" = "/boot/efi";
|
||||
# TODO: reparition
|
||||
vfat."/dev/disk/by-uuid/CE84-E0D8" = "/boot";
|
||||
btrfs."/dev/disk/by-uuid/61f51d93-d3e5-4028-a903-332fafbfd365" =
|
||||
{ "/nix/rootfs/current" = "/"; "/nix" = "/nix"; "/nix/boot" = "/boot"; };
|
||||
{ "/nix/rootfs/current" = "/"; "/nix" = "/nix"; };
|
||||
};
|
||||
rollingRootfs = {};
|
||||
};
|
||||
grub.installDevice = "efi";
|
||||
networking = { hostname = "pcarm"; networkd = {}; };
|
||||
nixpkgs.arch = "aarch64";
|
||||
kernel.variant = "nixos";
|
||||
|
||||
28
devices/pcvm/default.nix
Normal file
28
devices/pcvm/default.nix
Normal file
@@ -0,0 +1,28 @@
|
||||
inputs:
|
||||
{
|
||||
config =
|
||||
{
|
||||
nixos =
|
||||
{
|
||||
system =
|
||||
{
|
||||
fileSystems =
|
||||
{
|
||||
mount =
|
||||
{
|
||||
# TODO: reparition
|
||||
vfat."/dev/disk/by-uuid/AE90-1DD1" = "/boot";
|
||||
btrfs."/dev/mapper/root" = { "/nix" = "/nix"; "/nix/rootfs/current" = "/"; };
|
||||
};
|
||||
decrypt.auto."/dev/disk/by-uuid/a9e4a508-3f0b-492e-b932-e2019be28615" = { mapper = "root"; ssd = true; };
|
||||
rollingRootfs = {};
|
||||
};
|
||||
kernel.variant = "xanmod-latest";
|
||||
networking.hostname = "pcvm";
|
||||
initrd.sshd.enable = true;
|
||||
};
|
||||
hardware.cpus = [ "amd" ];
|
||||
services.sshd = {};
|
||||
};
|
||||
};
|
||||
}
|
||||
39
devices/pcvm/secrets.yaml
Normal file
39
devices/pcvm/secrets.yaml
Normal 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
|
||||
@@ -10,14 +10,14 @@ inputs:
|
||||
{
|
||||
mount =
|
||||
{
|
||||
vfat."/dev/disk/by-uuid/ABC6-6B3E" = "/boot/efi";
|
||||
# TODO: reparition
|
||||
vfat."/dev/disk/by-uuid/ABC6-6B3E" = "/boot";
|
||||
btrfs."/dev/disk/by-uuid/c459c6c0-23a6-4ef2-945a-0bfafa9a45b6" =
|
||||
{ "/nix/rootfs/current" = "/"; "/nix" = "/nix"; "/nix/boot" = "/boot"; };
|
||||
{ "/nix/rootfs/current" = "/"; "/nix" = "/nix"; };
|
||||
};
|
||||
swap = [ "/nix/swap/swap" ];
|
||||
rollingRootfs = {};
|
||||
};
|
||||
grub.installDevice = "efi";
|
||||
networking = { hostname = "pi3b"; networkd = {}; };
|
||||
nixpkgs.arch = "aarch64";
|
||||
kernel.variant = "nixos";
|
||||
|
||||
@@ -11,38 +11,40 @@ inputs:
|
||||
{
|
||||
mount =
|
||||
{
|
||||
vfat."/dev/disk/by-uuid/7179-9C69" = "/boot/efi";
|
||||
btrfs =
|
||||
{
|
||||
"/dev/disk/by-uuid/c6d35075-85fe-4129-aaa8-f436ab85ce43"."/boot" = "/boot";
|
||||
"/dev/mapper/root" = { "/nix" = "/nix"; "/nix/rootfs/current" = "/"; };
|
||||
};
|
||||
vfat."/dev/disk/by-uuid/4596-D670" = "/boot";
|
||||
btrfs."/dev/mapper/root1" = { "/nix" = "/nix"; "/nix/rootfs/current" = "/"; };
|
||||
};
|
||||
decrypt.auto =
|
||||
{
|
||||
"/dev/disk/by-uuid/4f7420f9-ea19-4713-b084-2ac8f0a963ac" = { mapper = "root"; ssd = true; };
|
||||
"/dev/disk/by-uuid/88bd9d44-928b-40a2-8f3d-6dcd257c4601" =
|
||||
{ mapper = "swap"; ssd = true; before = [ "root" ]; };
|
||||
"/dev/disk/by-uuid/eda0042b-ffd5-47d1-b828-4cf99d744c9f" = { mapper = "root1"; ssd = true; };
|
||||
"/dev/disk/by-uuid/41d83848-f3dd-4b2f-946f-de1d2ae1cbd4" = { mapper = "swap"; ssd = true; };
|
||||
};
|
||||
swap = [ "/dev/mapper/swap" ];
|
||||
resume = "/dev/mapper/swap";
|
||||
rollingRootfs = {};
|
||||
};
|
||||
nixpkgs.march = "skylake";
|
||||
grub.installDevice = "efi";
|
||||
nix = { substituters = [ "https://cache.nixos.org/" "https://nix-store.chn.moe" ]; githubToken.enable = true; };
|
||||
kernel = { variant = "xanmod-lts"; patches = [ "cjktty" "lantian" "surface" "hibernate-progress" ]; };
|
||||
kernel = { variant = "xanmod-lts"; patches = [ "surface" "hibernate-progress" ]; };
|
||||
networking.hostname = "surface";
|
||||
gui.enable = true;
|
||||
};
|
||||
hardware = { cpus = [ "intel" ]; gpu.type = "intel"; };
|
||||
packages.packageSet = "desktop-extra";
|
||||
virtualization = { docker.enable = true; waydroid.enable = true; };
|
||||
services =
|
||||
{
|
||||
snapper.enable = true;
|
||||
sshd = {};
|
||||
xray.client.enable = true;
|
||||
xray.client =
|
||||
{
|
||||
enable = true;
|
||||
dnsmasq.hosts = builtins.listToAttrs (builtins.map
|
||||
(name: { inherit name; value = "0.0.0.0"; })
|
||||
[
|
||||
"log-upload.mihoyo.com" "uspider.yuanshen.com" "ys-log-upload.mihoyo.com"
|
||||
"dispatchcnglobal.yuanshen.com"
|
||||
]);
|
||||
};
|
||||
firewall.trustedInterfaces = [ "virbr0" ];
|
||||
wireguard =
|
||||
{
|
||||
@@ -54,13 +56,13 @@ inputs:
|
||||
beesd.instances.root = { device = "/"; hashTableSizeMB = 512; };
|
||||
};
|
||||
bugs = [ "xmunet" "suspend-hibernate-no-platform" ];
|
||||
packages.vasp = null;
|
||||
};
|
||||
environment.systemPackages = with inputs.pkgs; [ maliit-keyboard maliit-framework ];
|
||||
powerManagement.resumeCommands = ''${inputs.pkgs.systemd}/bin/systemctl restart iptsd'';
|
||||
services.iptsd.config =
|
||||
{
|
||||
Touch = { DisableOnPalm = true; DisableOnStylus = true; Overshoot = 0.5; };
|
||||
Contacts = { Neutral = "Average"; NeutralValue = 100; };
|
||||
Contacts = { Neutral = "Average"; NeutralValue = 10; };
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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 =
|
||||
{
|
||||
@@ -32,6 +38,7 @@ inputs:
|
||||
sshd = {};
|
||||
fail2ban = {};
|
||||
beesd.instances.root = { device = "/"; hashTableSizeMB = 64; };
|
||||
xray.server = { serverName = "xserver.vps4.chn.moe"; userNumber = 4; };
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,58 +1,25 @@
|
||||
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]
|
||||
#ENC[AES256_GCM,data:d7cv,iv:RHzGIDLuuKejCTQ5YlNNITkCS3VoprsqH/kHckdpAv0=,tag:3cYw7uyUmXALo3v7SiqLJA==,type:comment]
|
||||
user0: ENC[AES256_GCM,data:o2wxpSzoqsPxs6grgYRLtPutMVwSqtzUWBrj7+7QuWWd1a1z,iv:2/5SxXq8Iw4J/LzBeclHbkrZXHitguip0WN+MINym8s=,tag:v/3oly53ORM9XAwbOzp06g==,type:str]
|
||||
#ENC[AES256_GCM,data:0nHZmEPPaw==,iv:BtOZ8/U0yg3fthHrwerNQX3+KD/H9+fcUylYGnZqiIM=,tag:DkFGSFfq//LmWfg6DGm1aA==,type:comment]
|
||||
user1: ENC[AES256_GCM,data:7ev7GuKLeJbPReMy0FnX02fLv5nNCpxdzfnQyAA+/IviwDMQ,iv:YbESsyIAiEAyvrHnj9A4lITX7NtRkuRhCrTv6hoG9Qs=,tag:8uledxLXqpXXLBh+cczm4g==,type:str]
|
||||
#ENC[AES256_GCM,data:3KN/1hzeR2I=,iv:iaqJJD6iURTUlIL8e8P7fsAzJYo+y3NGZXgWmPX+4ao=,tag:e8g/JgVrMrWJamUMpiv2pQ==,type:comment]
|
||||
user2: ENC[AES256_GCM,data:58PnLCwDayOYinsPCYPeMvuKiF7b4tZtbmEJFWEl+2Nu6HL2,iv:hSv3jCtkLm4rrm/4+ot10CBhobGwtnK5db5wR1S/XrU=,tag:SQbynYp8pDSqj4tAK6JBMQ==,type:str]
|
||||
#ENC[AES256_GCM,data:uTZDsA==,iv:6cxvQycfji/x+DW1CnO45r+yNTLwkhYkiJwDaSpUCwo=,tag:8pMw+sYeOyZBN1idHoM9+g==,type:comment]
|
||||
user3: ENC[AES256_GCM,data:WCVr0ylGm2SHtOGulb8TD/cI2xJXrbvY1d6+STXGxf0d0izb,iv:vhNshb38AVpwKCFRwUVruCQ0SxhHrOmwQ+IoQZeUj1k=,tag:OfdIjRrTAuVZBOEXTtnrQQ==,type:str]
|
||||
private-key: ENC[AES256_GCM,data:akNIeVp2bfKvnzlS6KLAdqAo7qsGfPatzCZpN1tNRLhRVXmJCcUDVSmVoA==,iv:2Rny8ioDJ2x+NR+n7/Aluv7JZ+Om3MuJKsXiwONYntg=,tag:a3xubIr7hpVjRiHjFL/q5Q==,type:str]
|
||||
acme:
|
||||
token: ENC[AES256_GCM,data:JBeN7SVxKGOe6er0eS7/v8YrXdv0nCK/KZc8Ygq0G7FIGu4hO662kg==,iv:rf59MgUCYlAA5h18wtdWoUyb2VPB13OPuJjz1VsI2dU=,tag:ViPrwduD8aWf8i8vmBG78A==,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]
|
||||
detectAuth:
|
||||
chn: ENC[AES256_GCM,data:lQHDpv8/Yl5/nycHoeTnCw==,iv:ernNxRpcTOSAllDpqRFVFg3qEw/slEEPPXDFq1AhNL0=,tag:2AVALUf9cDyOgCqI9wwgQQ==,type:str]
|
||||
led: ENC[AES256_GCM,data:zyCiiH21,iv:iEYyNClDsCpWE2oNjt2NqQZ88xOOlMr0yycjKTPdmlw=,tag:kQfbshXfTBA5PtUAgpgCcA==,type:str]
|
||||
chat: ENC[AES256_GCM,data:pXu0WPWmvUzvl2expDpQPqWwi1A4abg72npsaYXDXRcg6aVU0Ec+tgM2+uz2hT9rh3mNoBxadYXDc/zeOL1UCg==,iv:iln5UGGBK2s5pGS03PtolWTkx6KrnYBAWCFnI0V2Bag=,tag:EahTDoPIBkgWnp4MOoTCmw==,type:str]
|
||||
maxmind-license: ENC[AES256_GCM,data:8OioibcXQ9IZ0OQhJ/zHSBQjfdHzkoqwUx5zR8Zq0atNw6SSf7vKrg==,iv:z6WTI2yeqP0h7EqKG114nRQpFVJlNzZspgS6gIFtpt4=,tag:a0dBt9pXJnncBiSKt9dsAQ==,type:str]
|
||||
telegram:
|
||||
token: ENC[AES256_GCM,data:Si6yTh48HpA8OkkkvgHwtJYFhF8tW3oaQbldjwBc09QJxp9AoKgASMnZtbDZYA==,iv:GrNyZXjaZMviSjy/LGHHrYTr5PFvDkCXmT3MU4+SLpc=,tag:YifB1tKFLqsgXB/YLqYK4w==,type:str]
|
||||
chat: ENC[AES256_GCM,data:ydPky0W4ZWqn,iv:uWQrZDz2GCxiKRaijM89Npt0fQeSNHbQzDefkZCkUAE=,tag:OJQwV/889Vp2/4wjbN41JA==,type:str]
|
||||
sops:
|
||||
kms: []
|
||||
gcp_kms: []
|
||||
@@ -62,23 +29,23 @@ sops:
|
||||
- recipient: age19ax6vm3pv8rph5tq3mmehd9sy9jk823tw8svsd790r0lkslycquqvlwz9m
|
||||
enc: |
|
||||
-----BEGIN AGE ENCRYPTED FILE-----
|
||||
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSA1QXc4NzREZHlhMDV2WXlM
|
||||
a2I4d1pjWm9Xd2gzUDUwZ1ZSTkFGR1ZQNDJzCmJwcWFxRWNNVGxTNno2b1NxNktO
|
||||
aHhINXBjdmE3alFGYk9kUHZ1UzdJUk0KLS0tIFdKMDlvb1Z2Qi8xRjl0MXpKMDMz
|
||||
cVVNdDRDNmtHZlJEcVRXR1FLVkZrMWcKn2iTHH7/52fJNXcbDFbzOxNAaiQRA0nO
|
||||
we74EeNzcaaQwuEmBQPKxd/g7/kjhnHzTkoX3OneXMd/gBZMn2knXw==
|
||||
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBNamN1TytweDd3blJsR2ZH
|
||||
ZmlocFZjT3ZaUjlVbG1vVSt4a2s2SjJIaGtRCjRneDV6cHYwdGJOY1BDVS9DeDVC
|
||||
cDdNbUdtSGRHNU1yZFpPc1MzRS92ME0KLS0tIFpmamNmTFYrRGRqbTFVSzBhUlNa
|
||||
VllXdzZ3bEc3UFY0YjZRKzBUcGgyVkUKqI1ojiLbF87alAkEwyrm8wuW2fLbmj8d
|
||||
YBIpoDCZ7AwR5uHWQAtl7BWJV1zab+rA3zvaf2BsrVA1A+RWOtYT/Q==
|
||||
-----END AGE ENCRYPTED FILE-----
|
||||
- recipient: age164tyqklwhdm57tfm5u863mdt2xrzrrzac4py8a0j9y6kzqcjy9zsp073t6
|
||||
- recipient: age1yvrl4y0r6yzcxzzkgfwshlrtsjt8uuya6rfwks09pnft7esfcyvqmrtm5q
|
||||
enc: |
|
||||
-----BEGIN AGE ENCRYPTED FILE-----
|
||||
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBycEw1bXA4QUZkUzJ0Z3pM
|
||||
Z0xHam5SLzRGV21XYUtxTFh1VnhQUk1NbzAwCkU1Z3VTR1FtZ05GOWNDOENlZTgz
|
||||
SitzYXo2Q2VEaGtLTGE2UGRoUDkxN28KLS0tIHhRS2Y1cnQreC9Fc2FLdGR1ZXdJ
|
||||
ZXFTU3ZCaW1pTVh0RUJzdDdGdHlPYTgK2mlgcX2kEc8+2UDdBnhUm6IIuh8V6agW
|
||||
ooxH9OEPXUVI/4JcDo4v8ZUhAyU1ehLH0Ef7PJCChOZe2KZmWSNbhA==
|
||||
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBWWitsSnRVSzJDZG9ZSE5I
|
||||
bmt2NEFDanR3aFJyYVNnU1NlUldRb2RUVXhNClQrTkgzR1dPNWp3endZTUl5SmRs
|
||||
dEtkSWk4aWJEc2hhbWlXZkxpNGhacFUKLS0tIGZNSG43R0NKYmdFMzdXbmJjSExJ
|
||||
Ri9hM3NRTkM4Q1lDdmdPemEweEFBUmcKNLL5qH+JeFWX0GovkPFVVAnz+4tmfG6/
|
||||
1jN8YqbMIxf5/L8tauXPf0iIiHa6pUcjtDZPr/OEmeXebmF6Bh9u9Q==
|
||||
-----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-08-25T03:19:55Z"
|
||||
mac: ENC[AES256_GCM,data:v6yb7ZYcnPw/8SqEJnSWzmlE17PenjnBH2X8HZp+kIDXzNFyNvD19FcbCBZjwyjBLvN1ZF4M9FS7Y4+CvvMrN/4JcFufcY/V1NrOd8IZisfAT5N3WuopPee4IN9WEyPVOsbFnesZo6/wJKuqlV1UR8UZxCd3/wHXob9Lkz45cBw=,iv:XKIUiRfP0lj8V/Z1HbvhBankdcAjQqM8Way6TWjJJMY=,tag:PLYsVj6BmR132oWsxEKnfg==,type:str]
|
||||
pgp: []
|
||||
unencrypted_suffix: _unencrypted
|
||||
version: 3.8.1
|
||||
version: 3.9.0
|
||||
|
||||
@@ -30,13 +30,13 @@ inputs:
|
||||
nix.substituters = [ "https://cache.nixos.org/" "https://nix-store.chn.moe" ];
|
||||
initrd.sshd.enable = true;
|
||||
networking = { hostname = "vps6"; networkd = {}; };
|
||||
kernel.variant = "cachyos-server";
|
||||
# do not use cachyos kernel, beesd + cachyos kernel + heavy io = system freeze, not sure why
|
||||
};
|
||||
services =
|
||||
{
|
||||
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 =
|
||||
{
|
||||
@@ -53,14 +53,13 @@ inputs:
|
||||
(site: { name = "${site}.chn.moe"; value.upstream.address = "wireguard.vps7.chn.moe"; })
|
||||
[
|
||||
"xn--s8w913fdga" "misskey" "synapse" "syncv3.synapse" "matrix" "syncv3.matrix"
|
||||
"send" "kkmeeting" "api" "git" "grafana" "vikunja"
|
||||
"send" "kkmeeting" "api" "git" "grafana" "vikunja" "write" "blog"
|
||||
]));
|
||||
applications =
|
||||
{
|
||||
element.instances."element.chn.moe" = {};
|
||||
synapse-admin.instances."synapse-admin.chn.moe" = {};
|
||||
catalog.enable = true;
|
||||
blog.enable = true;
|
||||
main.enable = true;
|
||||
nekomia.enable = true;
|
||||
};
|
||||
@@ -80,6 +79,12 @@ inputs:
|
||||
};
|
||||
beesd.instances.root = { device = "/"; hashTableSizeMB = 64; };
|
||||
};
|
||||
user.users = [ "chn" "zqq" ];
|
||||
};
|
||||
specialisation.generic.configuration =
|
||||
{
|
||||
nixos.system.nixpkgs.march = inputs.lib.mkForce null;
|
||||
system.nixos.tags = [ "generic" ];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -26,11 +26,10 @@ 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 =
|
||||
{
|
||||
@@ -46,14 +45,14 @@ 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;
|
||||
send.enable = true;
|
||||
huginn.enable = true;
|
||||
fz-new-order = {};
|
||||
nginx.applications = { kkmeeting.enable = true; webdav.instances."webdav.chn.moe" = {}; };
|
||||
nginx.applications = { kkmeeting.enable = true; webdav.instances."webdav.chn.moe" = {}; blog = {}; };
|
||||
httpapi.enable = true;
|
||||
gitea = { enable = true; ssh = {}; };
|
||||
grafana.enable = true;
|
||||
@@ -69,7 +68,13 @@ inputs:
|
||||
vikunja.enable = true;
|
||||
chatgpt = {};
|
||||
xray.server = { serverName = "xserver.vps7.chn.moe"; userNumber = 4; };
|
||||
writefreely = {};
|
||||
};
|
||||
};
|
||||
specialisation.generic.configuration =
|
||||
{
|
||||
nixos.system.nixpkgs.march = inputs.lib.mkForce null;
|
||||
system.nixos.tags = [ "generic" ];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -54,11 +54,13 @@ synapse:
|
||||
signing-key: ENC[AES256_GCM,data:hzxxDbGp1L09O7+ueUSa5lJOY/QvF2zvHdpueEHjaPQEToQt9mr2loeTQHC7ObTegfLb9UHrI1jn4A==,iv:KngfahwYZZmDQ5LeOUPWptTMGAC8TZm1G0FWcrwCwsw=,tag:U9pW6/boBIpiswn67Ezrfw==,type:str]
|
||||
sliding-sync: ENC[AES256_GCM,data:BeA6g98IWDP6hnLFI77QqG6esDwB6j3OPzAv3eJxWoTajAsByHSgSYP1vHN5Iok6IgvSSmkf0/HiOJy1Ca8IIA==,iv:ca+t/rYwc/fAVUcz0JTmrRQCOcbDNscbnE8BpHkx/OE=,tag:eEfhUChUt4kRnO82XqRY4g==,type:str]
|
||||
vaultwarden:
|
||||
admin_token: ENC[AES256_GCM,data:muavuOY88Lm4rSEoCp4IIPp7Z+sqf36VwpnPgf+K6IwwFkUgYM1GO80ogReYWqqUM6ij1Yzl5D9ncUbq+aGTKQ==,iv:jA4MRJlz71CMmPnWjb2tGbbIoMkEsESUowhXDckKKMI=,tag:l0HaJmnU29YeFUxjOgN3Kg==,type:str]
|
||||
#ENC[AES256_GCM,data:yFDD8GHjZWHN/Yh53DseevKAhDVwrHX60e8sGZnF4BUsUuPA/4S2PRzj7CtlpFzUH3kb0i+HkLKRvbchg93U3as=,iv:JGG7daEKs0oMKTNVi9GS7PrXn/8rFtVkHknACsEQR+g=,tag:RSN6fojLsI4dcuPu2eTiWA==,type:comment]
|
||||
admin_token: ENC[AES256_GCM,data:OpjREmxJSRj+aGVoP8KKRE7ClNqRtaV8va4WLVmpl1AO6D0q/GapJvhORHQb5s5ZjIAgvWTz1w+fh050Q9sPwRsNUke3FIcyeNy7k0PHgnnVIdxnU1Vn9KMz/SovjQ0/qEQ7tArvW/EXtKfwnP9lsz9m94VBvA==,iv:9AvDqMa2PeQOSrP2th3YBgA2RxPl3oKZTyUzi/yjRTM=,tag:HYFTQDgWvBsHQk8IZxWkfw==,type:str]
|
||||
mariadb:
|
||||
photoprism: ENC[AES256_GCM,data:TF1SZVFnvzyE+7vrHYYUS4Juqhbiw9QcJx7p3Xj88xyBFcTqS1YjzAKs/9GQ1PuzdBrt6hXm/XtJILHiuktnSg==,iv:sd9sQEuIePL6LzUYbFtmdecJ57sMrkF0coalBf8KFqQ=,tag:P/knaKYTJ+aXu4l6IixISA==,type:str]
|
||||
freshrss: ENC[AES256_GCM,data:ydqCbj3UbsLC1e++p5ixb5Kpmk2BsYd0urcfw8T51Is5N1/gQ7P0zgR33AOteAxw2oj85WQZhxu3eAN7BCXV5A==,iv:1oiMo1wwFNXiTZLsf4UPZSJfKFIWLI3h947TC06CVy4=,tag:Otq1oeKBnWXhqNilfsywPQ==,type:str]
|
||||
huginn: ENC[AES256_GCM,data:1Tdg1WDwGgFSXdChgif8knWS24BIFYnmaiSjJXxs5uj/v/5fJ1alb4K4XHW/kFRjQbuAOFfJiJ9ogJ1KAyk17A==,iv:qLMaQpVaKrjP7g2lWzhaNLghxwiV4YJmyYY1hrpu5I8=,tag:566JCENvOxgwD7tM3aQBiw==,type:str]
|
||||
writefreely: ENC[AES256_GCM,data:+5jsON4SpeWKWZWlbn233XuQ/6HDzaS3XxUxDbUqAp8S/XGmn/QuFK2f375QJEiyZsnrIYkbN/CiOjdTw+nNzg==,iv:8mKqWegyxrT6908P5G0olVZzpP+BwpE7SYODEry7F3A=,tag:HeYoT0RFJGzX6DWcBQy7Jg==,type:str]
|
||||
photoprism:
|
||||
adminPassword: ENC[AES256_GCM,data:gB81joOfS8h05BNy2YmD/N0cpLPa/vAduDcQBeHiY/WkcnvqSXnXsOfnvbP74KQfoP4W35oFkfyGVPUBSB83tg==,iv:AkN2NoqMXVHQA9fHTTR7xbEapEqy/D61mHn7O23hyYk=,tag:WV+siDA3VnRkOYnP4Z9Qhw==,type:str]
|
||||
nextcloud:
|
||||
@@ -68,21 +70,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]
|
||||
@@ -119,6 +118,8 @@ xray-server:
|
||||
#ENC[AES256_GCM,data:j83rYg==,iv:3oEdAoVz7aMcezcy2chTO0LQTtKpTrJJoQZx3PC03BU=,tag:ABteEIyr2Y6MbGQhmrQySQ==,type:comment]
|
||||
user3: ENC[AES256_GCM,data:Uk0Ax9FVzmmYs+ggWy7z6FEkuj2tppGlvnQdoW6PDI1VA9oI,iv:wSxigXleRUalQR1/TzKfdUVrdyEUuq+Wg42gSv1QMAI=,tag:qn6nBWv6MlGhMarCfI13BA==,type:str]
|
||||
private-key: ENC[AES256_GCM,data:TarrinCFzWkB5zCc7i7f3B3tFfxrF+cGnrg4bw9CAGKWBazSJHCviY8Imw==,iv:azHdrc6AlgS9RPwGVsYRb8bBeC/askCdut1rnv9TA3I=,tag:AT2lLraKVgbp9GmlLJiI+w==,type:str]
|
||||
writefreely:
|
||||
chn: ENC[AES256_GCM,data:YvhPa69sVdiljm9Ix6yQh6YCEpFvC9iw5Yx72MBcGr7+swdbvWDAfMmGFY066mAPvhpwZX/IEivKvrS0t/OSnw==,iv:7s2yEb30YaCAtNeevbur0HL28nXHVIqmCx6Bngh+HWk=,tag:yx0JK8RNQMVcYLBSxNj+uw==,type:str]
|
||||
sops:
|
||||
kms: []
|
||||
gcp_kms: []
|
||||
@@ -143,8 +144,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-08-20T15:48:48Z"
|
||||
mac: ENC[AES256_GCM,data:buEby7ZmmEFARmRp3r7JwYdMck87u4c3TGkeF2pkc5ORnqIgwSH1XVSjlbK8vTBWz2FKXeQh9wkX3BMaam9dU873/yPBe54BnbZNggZ7jDDEpSTeddfTsM8mrka0xDO3CUHbwCsqYWFm4NLAbCfRPKhrjvSJVyEC85K3eO45Z6M=,iv:/7cOdSi6oiaaFRkSnR+1/XXapjlQdMgom31xrpIGXHk=,tag:XW4WX93bw45zPweblW4Dtg==,type:str]
|
||||
pgp: []
|
||||
unencrypted_suffix: _unencrypted
|
||||
version: 3.8.1
|
||||
version: 3.9.0
|
||||
|
||||
@@ -16,10 +16,25 @@ SLURM 是一个用来对任务排队的系统,轮到某个任务时,再调
|
||||
|
||||
## 常用命令
|
||||
|
||||
我做了一个 TUI 界面,用起来比较简单,大多情况下可以满足需求。命令为:
|
||||
|
||||
```bash
|
||||
sbatch-tui
|
||||
```
|
||||
|
||||
或
|
||||
|
||||
```bash
|
||||
sbatch
|
||||
```
|
||||
|
||||
如果需要在提交任务时指定更详细的细节,或者要编写脚本批量提交任务,则在 `sbatch` 后面加上参数,这时是直接调用来自 SLURM 的 `sbatch` 命令。
|
||||
常用的参数见下文。更详细的内容见 SLURM 的官方文档。
|
||||
|
||||
提交一个 VASP GPU 任务的例子:
|
||||
|
||||
```bash
|
||||
sbatch --gpus=1 --ntasks-per-gpu=1 --job-name="my great job" vasp-nvidia-640
|
||||
sbatch --gpus=1 --ntasks-per-gpu=1 --job-name="my great job" vasp-nvidia
|
||||
```
|
||||
|
||||
* `--gpus` 指定使用GPU 的情况:
|
||||
@@ -30,12 +45,12 @@ sbatch --gpus=1 --ntasks-per-gpu=1 --job-name="my great job" vasp-nvidia-640
|
||||
* `--ntasks-per-gpu=1` 对于 VASP 来说一定要写。
|
||||
* `--job-name=xxx` 指定任务的名字。可以简写为 `-J`。也可以不指定。
|
||||
* 默认情况下,一个 task 会搭配分配一个 CPU 核(一个线程),一般已经够用。如果一定要修改,用 `--cpus-per-task`。
|
||||
* `vasp-nvidia-640` 指调用 std 版本,要使用 gam 或 ncl 版本时,写为例如 `vasp-nvidia-640-gam`。
|
||||
* `vasp-nvidia` 指调用 std 版本,要使用 gam 或 ncl 版本时,写为例如 `vasp-nvidia-gam`。
|
||||
|
||||
提交一个 VASP CPU 任务的例子:
|
||||
|
||||
```bash
|
||||
sbatch --ntasks=4 --cpus-per-task=4 --hint=nomultithread --job-name="my great job" vasp-intel-640
|
||||
sbatch --ntasks=4 --cpus-per-task=4 --hint=nomultithread --job-name="my great job" vasp-intel
|
||||
```
|
||||
|
||||
* `--ntasks=4 --cpus-per-task=4` 指定使用占用多少核。
|
||||
@@ -45,7 +60,7 @@ sbatch --ntasks=4 --cpus-per-task=4 --hint=nomultithread --job-name="my great jo
|
||||
* 对于 xmupc2:`--ntasks=4 --cpus-per-task=10`。
|
||||
* `--hint=nomultithread` 记得写。
|
||||
* `--job-name=xxx` 指定任务的名字。可以简写为 `-J`。也可以不指定。
|
||||
* `vasp-intel-640` 指调用 std 版本,要使用 gam 或 ncl 版本时,写为例如 `vasp-intel-640-gam`。
|
||||
* `vasp-intel` 指调用 std 版本,要使用 gam 或 ncl 版本时,写为例如 `vasp-intel-gam`。
|
||||
|
||||
要把其它程序提交到队列里,也是类似的写法。请自行举一反三。
|
||||
|
||||
@@ -186,7 +201,6 @@ samba 就是 windows 共享文件夹的那个协议。
|
||||
|
||||
VASP 有很多很多个版本,具体来说:
|
||||
|
||||
* VASP 多个版本可以共存,但为了简单只安装了 6.4.0 版本。
|
||||
* VASP 可以用不同的编译器编译。目前安装的有:nvidia、intel。nvidia 使用 GPU 计算,intel 能用 CPU 计算。其它版本性能不佳,没有安装。
|
||||
* VASP 的 std/gam/ncl 版本有一点区别,一般用 std,只有一个 gamma 点的时候用 gam 会快一点,系统中存在方向不平行的磁矩时必须用 ncl。
|
||||
* 无论哪个版本,都集成了下面这些补丁:
|
||||
@@ -199,14 +213,14 @@ VASP 有很多很多个版本,具体来说:
|
||||
如何提交 VASP 到队列系统已经在上面介绍过了。下面的例子是,如果要直接运行一个任务的写法:
|
||||
|
||||
```bash
|
||||
vasp-nvidia-640-env mpirun -np 1 -x CUDA_DEVICE_ORDER=PCI_BUS_ID -x CUDA_VISIBLE_DEVICES=0 -x OMP_NUM_THREADS=4 vasp-std
|
||||
vasp-intel-640-env mpirun -n 2 -genv OMP_NUM_THREADS=4 vasp-std
|
||||
vasp-nvidia-env mpirun -np 1 -x CUDA_DEVICE_ORDER=PCI_BUS_ID -x CUDA_VISIBLE_DEVICES=0 -x OMP_NUM_THREADS=4 vasp-std
|
||||
vasp-intel-env mpirun -n 2 -genv OMP_NUM_THREADS=4 vasp-std
|
||||
```
|
||||
|
||||
其中 `CUDA_VISIBLE_DEVICES` 用于指定用哪几个显卡计算(多个显卡用逗号分隔)。
|
||||
要查看显卡的编号,可以用 `CUDA_DEVICE_ORDER=PCI_BUS_ID vasp-nvidia-640-env nvaccelinfo` 命令。
|
||||
要查看显卡的编号,可以用 `CUDA_DEVICE_ORDER=PCI_BUS_ID vasp-nvidia-env nvaccelinfo` 命令。
|
||||
|
||||
这里 `vasp-xxx-6.4.0` 命令的作用是,进入一个安装了对应版本的 VASP 的环境,实际上和 VASP 关系不大;
|
||||
这里 `vasp-xxx-env` 命令的作用是,进入一个安装了对应版本的 VASP 的环境,实际上和 VASP 关系不大;
|
||||
后面的 `mpirun xxx` 才是真的调用 VASP。
|
||||
所以实际上你也可以在这个环境里做别的事情,例如执行上面的 `nvaccelinfo` 命令。
|
||||
|
||||
|
||||
@@ -10,10 +10,11 @@ inputs:
|
||||
{
|
||||
mount =
|
||||
{
|
||||
vfat."/dev/disk/by-uuid/467C-02E3" = "/boot/efi";
|
||||
# TODO: reparition
|
||||
vfat."/dev/disk/by-uuid/467C-02E3" = "/boot";
|
||||
btrfs =
|
||||
{
|
||||
"/dev/disk/by-uuid/2f9060bc-09b5-4348-ad0f-3a43a91d158b" = { "/nix" = "/nix"; "/nix/boot" = "/boot"; };
|
||||
"/dev/disk/by-uuid/2f9060bc-09b5-4348-ad0f-3a43a91d158b"."/nix" = "/nix";
|
||||
"/dev/disk/by-uuid/a04a1fb0-e4ed-4c91-9846-2f9e716f6e12" =
|
||||
{
|
||||
"/nix/rootfs" = "/nix/rootfs";
|
||||
@@ -26,7 +27,6 @@ inputs:
|
||||
swap = [ "/nix/swap/swap" ];
|
||||
rollingRootfs = {};
|
||||
};
|
||||
grub.installDevice = "efi";
|
||||
nixpkgs =
|
||||
{
|
||||
march = "znver3";
|
||||
@@ -52,7 +52,6 @@ inputs:
|
||||
nix.remote.slave.enable = true;
|
||||
};
|
||||
hardware = { cpus = [ "amd" ]; gpu.type = "nvidia"; };
|
||||
packages.packageSet = "workstation";
|
||||
virtualization = { waydroid.enable = true; docker.enable = true; kvmHost = { enable = true; gui = true; }; };
|
||||
services =
|
||||
{
|
||||
@@ -88,9 +87,10 @@ inputs:
|
||||
shares = { home.path = "/home"; root.path = "/"; };
|
||||
};
|
||||
groupshare = {};
|
||||
hpcstat = {};
|
||||
};
|
||||
bugs = [ "xmunet" "amdpstate" ];
|
||||
user.users = [ "chn" "xll" "zem" "yjq" "gb" ];
|
||||
user.users = [ "chn" "xll" "zem" "yjq" "gb" "zqq" ];
|
||||
};
|
||||
services.hardware.bolt.enable = true;
|
||||
};
|
||||
|
||||
@@ -15,8 +15,15 @@ users:
|
||||
yjq: ENC[AES256_GCM,data:ua0DINHutjt2Pk+SfHRQRV99mT3Cnw6rRKO8VRIAlP0dY6QhK9wkNdyRYWYRBKVrWgyFQMGNFYAxIpymjF/X7mBOVI2sOHLgkw==,iv:PUZ6S0KICuqoSA2sDLxdL4gtAOQnQXOUY+5f3qDZgpc=,tag:f39P34vAUOrV23BsKkRarA==,type:str]
|
||||
#ENC[AES256_GCM,data:6qNjSdjck4Vz,iv:c/GNqCNgRgwgL+2f6Vumtjb/ub9WCBSy8R02NRCDqk8=,tag:b/tucJsHTjSfcK0vgHtE8A==,type:comment]
|
||||
gb: ENC[AES256_GCM,data:3eAKBiJoC1owCHTFd3Xq8vI8VK980evePc92xCXJJ21M9D1MdbwN8ySZ3Ovjk7VfQmEo8oRv1Ll1sftyrXYoeTHmJsNDxCpR6A==,iv:Ju/ERNuGrgO5kYlbvmkbLJkgiW3Elou34AsJTFITCUg=,tag:POVlxYh9kZ1BMSbt97IVOQ==,type:str]
|
||||
#ENC[AES256_GCM,data:oniighfvCNGWUwdhqg==,iv:RVUuZBqCd111QJ7MpgYBuP4fDCzm4NZAtbua9kXkrJM=,tag:21zF8E/3lBTDr54I9NKPVg==,type:comment]
|
||||
zqq: ENC[AES256_GCM,data:Vjbbs8xIlH3+of7+kLGFVp4bIizU8D5R1qRbCqP5FhzTadXA8KD9/uiYxtrV3oxYGwZ/RlLvriHMClob4ihyDF4U2t8Dc4eVqA==,iv:FjCftpfKPZYThiNOyNkhx9uNyWIsjC5sK5WWcaEBtiY=,tag:MTL490c2SeFGx3EhxEdvkA==,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 +48,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-08-21T09:56:03Z"
|
||||
mac: ENC[AES256_GCM,data:9+AR9Y6ik+BH1Spk62LSTU1NFQ8ID0YROF+yf8ss2RqhfP6/5+lsrNjGC7gnEEMYF8UWVtChUuljIK3Q4MtT64JhDWgp8tenbpkJnRFGylzEe37MYajdDY7nrPP7iPUPNvS1ndo6vp/yuEigBXVhCtpjMObj7zIdGnLbtz0sczA=,iv:gNb8gVp9adnlZsMM2afOlFe46Vy15ELmC9vGaaeaInY=,tag:rltLL3WSZytjEemgjCy6Ng==,type:str]
|
||||
pgp: []
|
||||
unencrypted_suffix: _unencrypted
|
||||
version: 3.8.1
|
||||
version: 3.9.0
|
||||
|
||||
39
devices/xmupc1/tunnel.md
Normal file
39
devices/xmupc1/tunnel.md
Normal file
@@ -0,0 +1,39 @@
|
||||
# 使用 SSH 隧道连接
|
||||
|
||||
在学校外且不使用厦大 VPN 时,无法直接连接到学校的服务器,可以通过下面的方法连接到:
|
||||
首先连接到 vps6.chn.moe。这个服务器在校外(洛杉矶),因此可以直接连接到。
|
||||
同时,它通过别的方式与学校的服务器保持着连接,利用这个保持着的连接,跳回到学校的服务器。
|
||||
|
||||
这个跳转的过程不需要手动操作,只需要将软件设置好即可。
|
||||
|
||||
## PuTTY
|
||||
|
||||
1. 首先设置一个名为 `vps6` 的会话。
|
||||
1. 在 Session 页,填入 `vps6.chn.moe` 作为 Host Name。
|
||||
2. 在 Connection -> SSH -> Auth -> Credentials 页,在 “Private key file for authentication“ 选择密钥文件。
|
||||
3. 在 Connection -> Data 页,在 “Auto-login username” 填写用户名。
|
||||
4. 回到 Session 页,在 “Saved Sessions” 填入 `vps6` 并点击 “Save” 保存配置。
|
||||
2. 再设置一个名为 `wireguard.xmupc1` 的会话。
|
||||
1. 在 Session 页,填入 `wireguard.xmupc1.chn.moe` 作为 Host Name。
|
||||
2. 在 Connection -> SSH -> Auth -> Credentials 页和 Connection -> Data 页,需要修改的设置与在 `vps6` 会话中相同。
|
||||
3. 在 Connection -> Proxy 页,设置 Proxy type 为 `SSH to proxy and use port forwarding`,Proxy hostname 为 `vps6`。
|
||||
4. 回到 Session 页,在 “Saved Sessions” 填入 `wireguard.xmupc1` 并点击 “Save” 保存配置。
|
||||
|
||||
之后双击双击 `wireguard.xmupc1` 会话即可连接到学校的服务器。
|
||||
|
||||
## WinSCP
|
||||
|
||||
1. 在登陆界面,点击 “新建站点”。
|
||||
1. 设置 “文件协议” 为 `SCP`,“主机名” 为 `wireguard.xmupc1.chn.moe`,并输入用户名。
|
||||
2. 然后点击右下角 “高级” 继续修改设置。
|
||||
3. 在 连接 -> 隧道 页,勾选 “通过 SSH 隧道进行连接”,主机名填写 `vps6.chn.moe`,选择密钥文件,并填写用户名。
|
||||
4. 在 SSH -> 验证 页,选择密钥文件。
|
||||
5. 点击 “确定”,再点击 “保存”。
|
||||
|
||||
## OpenSSH
|
||||
|
||||
下面是一个命令的示例:
|
||||
|
||||
```bash
|
||||
ssh -J username@vps6.chn.moe username@wireguard.xmupc1.chn.moe
|
||||
```
|
||||
@@ -10,17 +10,16 @@ inputs:
|
||||
{
|
||||
mount =
|
||||
{
|
||||
vfat."/dev/disk/by-uuid/23CA-F4C4" = "/boot/efi";
|
||||
vfat."/dev/disk/by-uuid/23CA-F4C4" = "/boot";
|
||||
btrfs =
|
||||
{
|
||||
"/dev/disk/by-uuid/d187e03c-a2b6-455b-931a-8d35b529edac" =
|
||||
{ "/nix/rootfs/current" = "/"; "/nix" = "/nix"; "/nix/boot" = "/boot"; };
|
||||
{ "/nix/rootfs/current" = "/"; "/nix" = "/nix"; };
|
||||
};
|
||||
};
|
||||
swap = [ "/nix/swap/swap" ];
|
||||
rollingRootfs = {};
|
||||
};
|
||||
grub.installDevice = "efi";
|
||||
nixpkgs =
|
||||
{
|
||||
march = "skylake";
|
||||
@@ -46,7 +45,6 @@ inputs:
|
||||
nix.remote.slave.enable = true;
|
||||
};
|
||||
hardware = { cpus = [ "intel" ]; gpu.type = "nvidia"; };
|
||||
packages.packageSet = "workstation";
|
||||
virtualization = { waydroid.enable = true; docker.enable = true; kvmHost = { enable = true; gui = true; }; };
|
||||
services =
|
||||
{
|
||||
@@ -75,7 +73,7 @@ inputs:
|
||||
groupshare = {};
|
||||
};
|
||||
bugs = [ "xmunet" ];
|
||||
user.users = [ "chn" "xll" "zem" "yjq" "gb" ];
|
||||
user.users = [ "chn" "xll" "zem" "yjq" "gb" "zqq" ];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -15,6 +15,8 @@ users:
|
||||
yjq: ENC[AES256_GCM,data:sGPQ0xALULREnhzl9g/V91M5osMglsSps6R4gYn5OZc/4xVC1phF3qajVN3YMOr7kKgkHbF2Rjm6/2vuK0k1iYZnFswUAmFlmw==,iv:5vG1hn7SlX6HCpas2BgxBSwWqLby8OCxcH3EKNvceIc=,tag:TVwFBAuosKnEOZecq1phXw==,type:str]
|
||||
#ENC[AES256_GCM,data:ALHxkRABA+ll,iv:r1IDiHLFcTdLID3q16zrLTavAwQfddC7bXMKcFZFveI=,tag:4Pd0/Q1BmH4gJjaM4hbqqQ==,type:comment]
|
||||
gb: ENC[AES256_GCM,data:z4CrtdmdLJJ0qZzr7qvihnluJQgjtciX56KdEmtemiRu0llEJk9qz6a23aJ7m40Sfc38elF1/LsvjOuBOC87+BVkKDCj76phag==,iv:WrFVxkr3snmqDXZx5kAYCLp7ixEIzxoT7El3rV7Ovqg=,tag:iExf2Y/HObHQrKMTRvqn7A==,type:str]
|
||||
#ENC[AES256_GCM,data:UoNCXbGIHDNsmyCJxw==,iv:uTNvqg4xm7E+yn8vFaaihbEGEhLTZ2FNFNCYzdgiDlU=,tag:4bRSZbx6FFzA6MiBYVu0qw==,type:comment]
|
||||
zqq: ENC[AES256_GCM,data:sfgufV++PfTrdeUBXZhmF1JoSpD8Nj+m0QKFrUMJG/pHb0AUagJEWEJwPsI+m91tZE0qxM271ks+WKqLElmyD4Ftw7ywWzTE0Q==,iv:R05QFUF+fvIHidWpHIR/D/e+UeciS5ehnx1kx+saCgM=,tag:3Awnd+pUQRxjjQ58SUX7Mg==,type:str]
|
||||
mariadb:
|
||||
slurm: ENC[AES256_GCM,data:9wLQ1zF/kDaiw0s3UaRpiHgmngU7u6hwyqpddSjev0+Z0v58Q2oiJtK8vn+2VlSxx5ACfqEFbzp0PZYAxd575w==,iv:q9JTkgDymOwkbZ/PaxRAAQrtO96QmGgZcQuLTFCMoS4=,tag:dwOHlOTgZqT/1jQ+oGf7UQ==,type:str]
|
||||
sops:
|
||||
@@ -41,8 +43,8 @@ sops:
|
||||
M0xoL1dQR0kvMWpzN0RMNWVCTFQxNFUKj9LPjBo5NGOrGYNvu8qZ13PLYjLEWllU
|
||||
LARzEn4XgkeHckouwvxZYMCx7WxmAruRWaOvnxTIczzSNP7wIrqnkA==
|
||||
-----END AGE ENCRYPTED FILE-----
|
||||
lastmodified: "2024-05-10T08:54:10Z"
|
||||
mac: ENC[AES256_GCM,data:4n7bAGzORwd6vHl/Cs5YT8VZaSdfvxUm6e+fw7PYC2ov8XoRlJKU/Bci8Sbwcy2H6OjbkdRYA61cB2wAjtEY1x9N/c6qvUAOjTvOtcXoQQex8d+aMnJsFfJQ70GHCZE+KRTmy1SAMn+N00Oy0FDisdQe/jIZuWyav5j62CKqLqc=,iv:YEhiXU2IgXy4A0ZLsNY7kFqXJM5RBHE4IZwlRoF8XMA=,tag:aVc0r2g1QkY42NP59p4m2w==,type:str]
|
||||
lastmodified: "2024-08-21T09:56:44Z"
|
||||
mac: ENC[AES256_GCM,data:COodLhpL5EA5g15lgimsuxs1vmqJrLDVgtjw+0FLKTq6E1pcQ+zJl+dD0b9u5fYy9BBf56TI8TLJahVPR0eGxbDFlHmx8M9GStlTqaOE3jRsDT8GsihdlvLokyVt8jEfAnaWESTIgfehVL2TrLlsMnIsoVHrzdlEhX5ATXA3QOg=,iv:U/EwFmYWOcxi7ItkR/+MT8gTu7UobH5pxS00qrH/yyU=,tag:RVMcx4X0IS9yvpHrF0owpg==,type:str]
|
||||
pgp: []
|
||||
unencrypted_suffix: _unencrypted
|
||||
version: 3.8.1
|
||||
version: 3.9.0
|
||||
|
||||
1256
flake.lock
generated
1256
flake.lock
generated
File diff suppressed because it is too large
Load Diff
183
flake.nix
183
flake.nix
@@ -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; };
|
||||
@@ -66,8 +61,12 @@
|
||||
kylin-virtual-keyboard = { url = "git+https://gitee.com/openkylin/kylin-virtual-keyboard.git"; flake = false; };
|
||||
cjktty = { url = "github:CHN-beta/cjktty-patches"; flake = false; };
|
||||
zxorm = { url = "github:CHN-beta/zxorm"; flake = false; };
|
||||
openxlsx = { url = "github:troldal/OpenXLSX"; flake = false; };
|
||||
openxlsx = { url = "github:troldal/OpenXLSX?rev=f85f7f1bd632094b5d78d4d1f575955fc3801886"; 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; };
|
||||
nc4nix = { url = "github:helsinki-systems/nc4nix"; flake = false; };
|
||||
hextra = { url = "github:imfing/hextra"; flake = false; };
|
||||
|
||||
# does not support lfs yet
|
||||
# nixos-wallpaper = { url = "git+https://git.chn.moe/chn/nixos-wallpaper.git"; flake = false; };
|
||||
@@ -75,43 +74,54 @@
|
||||
|
||||
outputs = inputs:
|
||||
let
|
||||
localLib = import ./local/lib inputs.nixpkgs.lib;
|
||||
localLib = import ./lib.nix inputs.nixpkgs.lib;
|
||||
devices = builtins.filter (dir: (builtins.readDir ./devices/${dir})."default.nix" or null == "regular" )
|
||||
(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 ];
|
||||
});
|
||||
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:
|
||||
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 ++ [ ./packages/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 =
|
||||
let
|
||||
range-v3 = pkgs.pkgsStatic.range-v3.overrideAttrs (prev:
|
||||
{
|
||||
name = system;
|
||||
value = inputs.self.outputs.nixosConfigurations.${system}.config.system.build.toplevel;
|
||||
})
|
||||
devices)
|
||||
);
|
||||
cmakeFlags = prev.cmakeFlags or []
|
||||
++ [ "-DRANGE_V3_DOCS=OFF" "-DRANGE_V3_TESTS=OFF" "-DRANGE_V3_EXAMPLES=OFF" ];
|
||||
doCheck = false;
|
||||
});
|
||||
tbb = pkgs.pkgsStatic.tbb_2021_11.overrideAttrs (prev: { cmakeFlags = prev.cmakeFlags or [] ++
|
||||
[ "-DTBB_TEST=OFF" ]; });
|
||||
biu = pkgs.pkgsStatic.localPackages.biu.override { inherit range-v3; };
|
||||
matplotplusplus = pkgs.pkgsStatic.localPackages.matplotplusplus.override { libtiff = null; };
|
||||
in pkgs.pkgsStatic.localPackages.ufo.override { inherit biu tbb matplotplusplus; };
|
||||
chn-bsub = pkgs.pkgsStatic.localPackages.chn-bsub;
|
||||
blog = pkgs.callPackage ./blog { inherit (inputs) hextra; };
|
||||
}
|
||||
// (builtins.listToAttrs (builtins.map
|
||||
(system:
|
||||
{
|
||||
name = system;
|
||||
value = inputs.self.outputs.nixosConfigurations.${system}.config.system.build.toplevel;
|
||||
})
|
||||
devices)
|
||||
);
|
||||
nixosConfigurations =
|
||||
(
|
||||
(builtins.listToAttrs (builtins.map
|
||||
@@ -126,7 +136,7 @@
|
||||
[
|
||||
(moduleInputs: { config.nixpkgs.overlays = [(prev: final:
|
||||
# replace pkgs with final to avoid infinite recursion
|
||||
{ localPackages = import ./local/pkgs (moduleInputs // { pkgs = final; }); })]; })
|
||||
{ localPackages = import ./packages (moduleInputs // { pkgs = final; }); })]; })
|
||||
./modules
|
||||
./devices/${system}
|
||||
];
|
||||
@@ -142,71 +152,56 @@
|
||||
[
|
||||
(moduleInputs: { config.nixpkgs.overlays = [(prev: final:
|
||||
# replace pkgs with final to avoid infinite recursion
|
||||
{ localPackages = import ./local/pkgs (moduleInputs // { pkgs = final; }); })]; })
|
||||
{ localPackages = import ./packages (moduleInputs // { pkgs = final; }); })]; })
|
||||
./modules
|
||||
./devices/pi3b
|
||||
];
|
||||
};
|
||||
}
|
||||
);
|
||||
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; }); };
|
||||
{ localPackages = (import ./packages { 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.override { stdenv = pkgs.gcc14Stdenv; }
|
||||
{
|
||||
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.override { stdenv = pkgs.gcc14Stdenv; }
|
||||
{
|
||||
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 =
|
||||
let inherit (pkgs) clang-tools_18; in let inherit (inputs.self.packages.x86_64-w64-mingw32) pkgs winjob;
|
||||
in pkgs.mkShell.override { stdenv = pkgs.gcc14Stdenv; }
|
||||
{
|
||||
inputsFrom = [ winjob ];
|
||||
packages = [ clang-tools_18 ];
|
||||
CMAKE_EXPORT_COMPILE_COMMANDS = "1";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
CompileFlags:
|
||||
Add: [ -Wall, -Wextra, -std=c++23 ]
|
||||
Compiler: g++
|
||||
@@ -1,37 +0,0 @@
|
||||
cmake_minimum_required(VERSION 3.14)
|
||||
project(biu LANGUAGES CXX)
|
||||
enable_testing()
|
||||
include(GNUInstallDirs)
|
||||
|
||||
option(BUILD_SHARED_LIBS "Build using shared libraries" ON)
|
||||
|
||||
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(magic_enum REQUIRED)
|
||||
find_package(fmt REQUIRED)
|
||||
find_package(Boost REQUIRED COMPONENTS headers iostreams)
|
||||
find_package(Eigen3 REQUIRED)
|
||||
find_package(range-v3 REQUIRED)
|
||||
find_path(NAMEOF_INCLUDE_DIR nameof.hpp REQUIRED)
|
||||
find_path(ZPP_BITS_INCLUDE_DIR zpp_bits.h 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)
|
||||
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})
|
||||
install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
||||
install(EXPORT biuTargets FILE biuTargets.cmake NAMESPACE biu:: DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/biu)
|
||||
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}")
|
||||
@@ -1,7 +0,0 @@
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/biuTargets.cmake")
|
||||
find_package(magic_enum REQUIRED)
|
||||
find_package(fmt REQUIRED)
|
||||
find_package(Boost REQUIRED COMPONENTS headers iostreams)
|
||||
find_package(Eigen3 REQUIRED)
|
||||
find_package(range-v3 REQUIRED)
|
||||
find_path(NAMEOF_INCLUDE_DIR nameof.hpp REQUIRED)
|
||||
@@ -1,11 +0,0 @@
|
||||
{
|
||||
stdenv, cmake,
|
||||
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 ];
|
||||
propagatedBuildInputs = buildInputs;
|
||||
nativeBuildInputs = [ cmake ];
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
# pragma once
|
||||
// # include <biu/atomic/atomic.tpp>
|
||||
// # include <biu/called_by.hpp>
|
||||
# include <biu/common.tpp>
|
||||
# include <biu/concepts.tpp>
|
||||
# include <biu/string.tpp>
|
||||
# include <biu/format.tpp>
|
||||
// # include <biu/logger.tpp>
|
||||
// # include <biu/smartref.tpp>
|
||||
|
||||
// # include <biu/eigen.hpp>
|
||||
@@ -1,41 +0,0 @@
|
||||
# pragma once
|
||||
# include <biu/logger.hpp>
|
||||
|
||||
namespace biu::detail_
|
||||
{
|
||||
template <DecayedType ValueType> class AtomicBase<ValueType, true>
|
||||
: public Logger::ObjectMonitor<Atomic<ValueType, true>>, protected AtomicBase<ValueType, false>
|
||||
{
|
||||
using DeepBase_ = AtomicBase<ValueType, false>;
|
||||
using DeepBase_::AtomicBase;
|
||||
public: class TimeoutException : public Logger::Exception<TimeoutException>
|
||||
{
|
||||
using Logger::Exception<TimeoutException>::Exception;
|
||||
};
|
||||
|
||||
protected: template
|
||||
<
|
||||
bool ReturnFunctionResult,
|
||||
typename ConditionFunction = std::nullptr_t, typename Duration = std::nullptr_t, bool Nothrow = false
|
||||
> static auto apply_
|
||||
(
|
||||
auto&& atomic, auto&& function,
|
||||
ConditionFunction&& condition_function = nullptr, Duration timeout = nullptr
|
||||
) -> DeepBase_::template ApplyReturnType_
|
||||
<decltype(function), decltype(atomic), ReturnFunctionResult, ConditionFunction, Duration, Nothrow>
|
||||
requires DeepBase_::template ApplyConstraint_
|
||||
<decltype(function), decltype(atomic), ConditionFunction, Duration>;
|
||||
|
||||
protected: template <bool Nothrow = false, typename Duration = std::nullptr_t> static auto wait_
|
||||
(auto&& atomic, auto&& condition_function, Duration timeout = nullptr)
|
||||
-> DeepBase_::template WaitReturnType_<decltype(atomic), decltype(condition_function), Duration, Nothrow>
|
||||
requires DeepBase_::template WaitConstraint_<decltype(condition_function), Duration>;
|
||||
|
||||
protected: template
|
||||
<bool Nothrow = false, typename ConditionFunction = std::nullptr_t, typename Duration = std::nullptr_t>
|
||||
static auto lock_
|
||||
(auto&& atomic, ConditionFunction&& condition_function = nullptr, Duration timeout = nullptr)
|
||||
-> DeepBase_::template LockReturnType_<decltype(atomic), Duration, Nothrow>
|
||||
requires DeepBase_::template LockConstraint_<ConditionFunction, Duration>;
|
||||
};
|
||||
}
|
||||
@@ -1,267 +0,0 @@
|
||||
# pragma once
|
||||
# include <mutex>
|
||||
# include <optional>
|
||||
# include <condition_variable>
|
||||
# include <cstddef>
|
||||
# include <experimental/memory>
|
||||
# include <biu/common.hpp>
|
||||
# include <biu/concepts.hpp>
|
||||
# include <biu/called_by.hpp>
|
||||
|
||||
namespace biu
|
||||
{
|
||||
template <DecayedType ValueType, bool UseLogger = true> class Atomic;
|
||||
namespace detail_
|
||||
{
|
||||
template <DecayedType ValueType, bool UseLogger> class AtomicBase;
|
||||
template <DecayedType ValueType> class AtomicBase<ValueType, false>
|
||||
{
|
||||
protected: mutable std::recursive_mutex Mutex_;
|
||||
protected: mutable std::condition_variable_any ConditionVariable_;
|
||||
protected: ValueType Value_;
|
||||
|
||||
AtomicBase() = default;
|
||||
AtomicBase(const ValueType& value);
|
||||
AtomicBase(ValueType&& value);
|
||||
|
||||
public: class TimeoutException : public std::exception
|
||||
{
|
||||
protected: std::string Message_;
|
||||
public: explicit TimeoutException(std::string message);
|
||||
public: const char* what() const noexcept override;
|
||||
};
|
||||
|
||||
// Apply a function to stored value.
|
||||
// Wait for some time (if provided) until condition funciton returns true (if provided)
|
||||
// before applying the function.
|
||||
protected: template
|
||||
<
|
||||
typename Function, typename Atomic,
|
||||
typename ConditionFunction = std::nullptr_t, typename Duration = std::nullptr_t
|
||||
>
|
||||
constexpr static bool ApplyConstraint_ =
|
||||
(
|
||||
(std::invocable<Function, MoveQualifiers<Atomic, ValueType>> && std::is_null_pointer_v<ConditionFunction>)
|
||||
|| (
|
||||
InvocableWithResult<ConditionFunction, bool, const ValueType&>
|
||||
&& (std::is_null_pointer_v<Duration> || SpecializationOf<Duration, std::chrono::duration>)
|
||||
)
|
||||
);
|
||||
protected: template
|
||||
<
|
||||
typename Function, typename Atomic, bool ReturnFunctionResult,
|
||||
typename ConditionFunction = std::nullptr_t, typename Duration = std::nullptr_t,
|
||||
bool Nothrow = false
|
||||
> using ApplyReturnType_ = std::conditional_t
|
||||
<
|
||||
Nothrow,
|
||||
std::conditional_t
|
||||
<
|
||||
ReturnFunctionResult && !std::is_void_v<std::invoke_result<Function, ValueType>>,
|
||||
std::optional<std::remove_cvref_t<FallbackIfNoTypeDeclared<std::invoke_result
|
||||
<Function, MoveQualifiers<Atomic, ValueType>, int>>>>,
|
||||
bool
|
||||
>,
|
||||
std::conditional_t
|
||||
<
|
||||
ReturnFunctionResult,
|
||||
std::invoke_result_t<Function, MoveQualifiers<Atomic, ValueType>>,
|
||||
Atomic&&
|
||||
>
|
||||
>;
|
||||
protected: template
|
||||
<
|
||||
bool ReturnFunctionResult,
|
||||
typename ConditionFunction = std::nullptr_t, typename Duration = std::nullptr_t,
|
||||
bool Nothrow = false
|
||||
> static auto apply_
|
||||
(
|
||||
auto&& atomic, auto&& function,
|
||||
ConditionFunction&& condition_function = nullptr, Duration timeout = nullptr
|
||||
) -> ApplyReturnType_
|
||||
<decltype(function), decltype(atomic), ReturnFunctionResult, ConditionFunction, Duration, Nothrow>
|
||||
requires ApplyConstraint_<decltype(function), decltype(atomic), ConditionFunction, Duration>;
|
||||
|
||||
// Wait until condition funciton returns true, with an optional timeout
|
||||
protected: template <typename ConditionFunction, typename Duration = std::nullptr_t>
|
||||
constexpr static bool WaitConstraint_
|
||||
= (InvocableWithResult<ConditionFunction, bool, const ValueType&>
|
||||
&& (std::is_null_pointer_v<Duration> || SpecializationOf<Duration, std::chrono::duration>));
|
||||
protected: template
|
||||
<typename Atomic, typename ConditionFunction, typename Duration = std::nullptr_t, bool Nothrow = false>
|
||||
using WaitReturnType_
|
||||
= std::conditional_t<Nothrow && !std::is_null_pointer_v<Duration>, bool, Atomic&&>;
|
||||
protected: template <bool Nothrow = false, typename Duration = std::nullptr_t> static auto wait_
|
||||
(auto&& atomic, auto&& condition_function, Duration timeout = nullptr)
|
||||
-> WaitReturnType_<decltype(atomic), decltype(condition_function), Duration, Nothrow>
|
||||
requires WaitConstraint_<decltype(condition_function), Duration>;
|
||||
|
||||
protected: template <typename ConditionFunction = std::nullptr_t, typename Duration = std::nullptr_t>
|
||||
constexpr static bool LockConstraint_
|
||||
= std::is_null_pointer_v<ConditionFunction> ||
|
||||
(
|
||||
InvocableWithResult<ConditionFunction, bool, const ValueType&>
|
||||
&& (std::is_null_pointer_v<Duration> || SpecializationOf<Duration, std::chrono::duration>)
|
||||
);
|
||||
protected: template <typename Atomic, typename Duration = std::nullptr_t, bool Nothrow = false>
|
||||
using LockReturnType_
|
||||
= std::conditional_t
|
||||
<
|
||||
Nothrow && !std::is_null_pointer_v<Duration>,
|
||||
std::optional<std::conditional_t
|
||||
<
|
||||
std::is_const_v<Atomic>,
|
||||
typename std::remove_reference_t<Atomic>::template Guard<true>,
|
||||
typename std::remove_reference_t<Atomic>::template Guard<false>
|
||||
>>,
|
||||
std::conditional_t
|
||||
<
|
||||
std::is_const_v<Atomic>,
|
||||
typename std::remove_reference_t<Atomic>::template Guard<true>,
|
||||
typename std::remove_reference_t<Atomic>::template Guard<false>
|
||||
>
|
||||
>;
|
||||
protected: template
|
||||
<bool Nothrow = false, typename ConditionFunction = std::nullptr_t, typename Duration = std::nullptr_t>
|
||||
static auto lock_
|
||||
(auto&& atomic, ConditionFunction&& condition_function = nullptr, Duration timeout = nullptr)
|
||||
-> LockReturnType_<decltype(atomic), Duration, Nothrow>
|
||||
requires LockConstraint_<ConditionFunction, Duration>;
|
||||
};
|
||||
}
|
||||
|
||||
// Thread safe wrapper of custom class
|
||||
template <DecayedType ValueType, bool UseLogger> class Atomic : public detail_::AtomicBase<ValueType, UseLogger>
|
||||
{
|
||||
public: Atomic() = default;
|
||||
public: Atomic(const ValueType& value);
|
||||
public: Atomic(ValueType&& value);
|
||||
public: template <bool OtherUseLogger> Atomic(const Atomic<ValueType, OtherUseLogger>& other);
|
||||
public: template <bool OtherUseLogger> Atomic(Atomic<ValueType, OtherUseLogger>&& other);
|
||||
public: Atomic<ValueType, UseLogger>& operator=(const ValueType& value);
|
||||
public: Atomic<ValueType, UseLogger>& operator=(ValueType&& value);
|
||||
public: template <bool OtherUseLogger>
|
||||
Atomic<ValueType, UseLogger>& operator=(const Atomic<ValueType, OtherUseLogger>& other);
|
||||
public: template <bool OtherUseLogger>
|
||||
Atomic<ValueType, UseLogger>& operator=(Atomic<ValueType, OtherUseLogger>&& other);
|
||||
public: ValueType get() const&;
|
||||
public: ValueType get() &&;
|
||||
public: operator ValueType() const&;
|
||||
public: operator ValueType() &&;
|
||||
|
||||
protected: using DeepBase_ = detail_::AtomicBase<ValueType, false>;
|
||||
|
||||
public: template <bool ReturnFunctionResult = false> auto apply(auto&& function) const&
|
||||
-> DeepBase_::template ApplyReturnType_<decltype(function), decltype(*this), ReturnFunctionResult>
|
||||
requires DeepBase_::template ApplyConstraint_<decltype(function), decltype(*this)>;
|
||||
public: template <bool ReturnFunctionResult = false> auto apply(auto&& function) &
|
||||
-> DeepBase_::template ApplyReturnType_<decltype(function), decltype(*this), ReturnFunctionResult>
|
||||
requires DeepBase_::template ApplyConstraint_<decltype(function), decltype(*this)>;
|
||||
public: template <bool ReturnFunctionResult = false> auto apply(auto&& function) &&
|
||||
-> DeepBase_::template ApplyReturnType_<decltype(function), decltype(*this), ReturnFunctionResult>
|
||||
requires DeepBase_::template ApplyConstraint_<decltype(function), decltype(*this)>;
|
||||
public: template <bool ReturnFunctionResult = false>
|
||||
auto apply(auto&& function, auto&& condition_function) const&
|
||||
-> DeepBase_::template ApplyReturnType_
|
||||
<decltype(function), decltype(*this), ReturnFunctionResult, decltype(condition_function)>
|
||||
requires DeepBase_::template ApplyConstraint_
|
||||
<decltype(function), decltype(*this), decltype(condition_function)>;
|
||||
public: template <bool ReturnFunctionResult = false> auto apply(auto&& function, auto&& condition_function) &
|
||||
-> DeepBase_::template ApplyReturnType_
|
||||
<decltype(function), decltype(*this), ReturnFunctionResult, decltype(condition_function)>
|
||||
requires DeepBase_::template ApplyConstraint_
|
||||
<decltype(function), decltype(*this), decltype(condition_function)>;
|
||||
public: template <bool ReturnFunctionResult = false> auto apply(auto&& function, auto&& condition_function) &&
|
||||
-> DeepBase_::template ApplyReturnType_
|
||||
<decltype(function), decltype(*this), ReturnFunctionResult, decltype(condition_function)>
|
||||
requires DeepBase_::template ApplyConstraint_
|
||||
<decltype(function), decltype(*this), decltype(condition_function)>;
|
||||
public: template <bool ReturnFunctionResult = false, bool Nothrow = false>
|
||||
auto apply(auto&& function, auto&& condition_function, auto timeout) const&
|
||||
-> DeepBase_::template ApplyReturnType_
|
||||
<
|
||||
decltype(function), decltype(*this), ReturnFunctionResult,
|
||||
decltype(condition_function), decltype(timeout), Nothrow
|
||||
> requires DeepBase_::template ApplyConstraint_
|
||||
<decltype(function), decltype(*this), decltype(condition_function), decltype(timeout)>;
|
||||
public: template <bool ReturnFunctionResult = false, bool Nothrow = false>
|
||||
auto apply(auto&& function, auto&& condition_function, auto timeout) &
|
||||
-> DeepBase_::template ApplyReturnType_
|
||||
<
|
||||
decltype(function), decltype(*this), ReturnFunctionResult,
|
||||
decltype(condition_function), decltype(timeout), Nothrow
|
||||
> requires DeepBase_::template ApplyConstraint_
|
||||
<decltype(function), decltype(*this), decltype(condition_function), decltype(timeout)>;
|
||||
public: template <bool ReturnFunctionResult = false, bool Nothrow = false>
|
||||
auto apply(auto&& function, auto&& condition_function, auto timeout) &&
|
||||
-> DeepBase_::template ApplyReturnType_
|
||||
<
|
||||
decltype(function), decltype(*this), ReturnFunctionResult,
|
||||
decltype(condition_function), decltype(timeout), Nothrow
|
||||
> requires DeepBase_::template ApplyConstraint_
|
||||
<decltype(function), decltype(*this), decltype(condition_function), decltype(timeout)>;
|
||||
|
||||
public: auto wait(auto&& condition_function) const&
|
||||
-> DeepBase_::template WaitReturnType_<decltype(*this), decltype(condition_function)>
|
||||
requires DeepBase_::template WaitConstraint_<decltype(condition_function)>;
|
||||
public: auto wait(auto&& condition_function) &
|
||||
-> DeepBase_::template WaitReturnType_<decltype(*this), decltype(condition_function)>
|
||||
requires DeepBase_::template WaitConstraint_<decltype(condition_function)>;
|
||||
public: auto wait(auto&& condition_function) &&
|
||||
-> DeepBase_::template WaitReturnType_<decltype(*this), decltype(condition_function)>
|
||||
requires DeepBase_::template WaitConstraint_<decltype(condition_function)>;
|
||||
public: template <bool Nothrow = false> auto wait(auto&& condition_function, auto timeout) const&
|
||||
-> DeepBase_::template WaitReturnType_
|
||||
<decltype(*this), decltype(condition_function), decltype(timeout), Nothrow>
|
||||
requires DeepBase_::template WaitConstraint_<decltype(condition_function), decltype(timeout)>;
|
||||
public: template <bool Nothrow = false> auto wait(auto&& condition_function, auto timeout) &
|
||||
-> DeepBase_::template WaitReturnType_
|
||||
<decltype(*this), decltype(condition_function), decltype(timeout), Nothrow>
|
||||
requires DeepBase_::template WaitConstraint_<decltype(condition_function), decltype(timeout)>;
|
||||
public: template <bool Nothrow = false> auto wait(auto&& condition_function, auto timeout) &&
|
||||
-> DeepBase_::template WaitReturnType_
|
||||
<decltype(*this), decltype(condition_function), decltype(timeout), Nothrow>
|
||||
requires DeepBase_::template WaitConstraint_<decltype(condition_function), decltype(timeout)>;
|
||||
|
||||
// Attain lock from outside when constructing, and release when destructing.
|
||||
// For non-const variant, When destructing, ConditionVariable_.notify_all() is called.
|
||||
public: template <bool Const> class Guard
|
||||
{
|
||||
protected: std::unique_lock<std::recursive_mutex> Lock_;
|
||||
protected: std::experimental::observer_ptr
|
||||
<std::conditional_t<Const, const Atomic<ValueType, UseLogger>, Atomic<ValueType, UseLogger>>> Value_;
|
||||
|
||||
public: template <bool OtherConst> Guard(const Guard<OtherConst>& other) requires (Const || !OtherConst);
|
||||
public: Guard
|
||||
(decltype(Lock_)&& lock, decltype(Value_) value, CalledBy<detail_::AtomicBase<ValueType, UseLogger>>);
|
||||
public: ~Guard();
|
||||
|
||||
public: std::conditional_t<Const, const ValueType&, ValueType&> operator*() const&;
|
||||
public: std::conditional_t<Const, const ValueType*, ValueType*> operator->() const&;
|
||||
public: std::conditional_t<Const, const ValueType&, ValueType&> value() const&;
|
||||
public: auto operator*() const&& = delete;
|
||||
public: auto operator->() const&& = delete;
|
||||
public: auto value() const&& = delete;
|
||||
};
|
||||
|
||||
public: auto lock() const& -> DeepBase_::template LockReturnType_<decltype(*this)>
|
||||
requires DeepBase_::template LockConstraint_<>;
|
||||
public: auto lock() & -> DeepBase_::template LockReturnType_<decltype(*this)>
|
||||
requires DeepBase_::template LockConstraint_<>;
|
||||
public: auto lock() const&& = delete;
|
||||
public: auto lock(auto&& condition_function) const&
|
||||
-> DeepBase_::template LockReturnType_<decltype(*this), decltype(condition_function)>
|
||||
requires DeepBase_::template LockConstraint_<decltype(condition_function)>;
|
||||
public: auto lock(auto&& condition_function) &
|
||||
-> DeepBase_::template LockReturnType_<decltype(*this), decltype(condition_function)>
|
||||
requires DeepBase_::template LockConstraint_<decltype(condition_function)>;
|
||||
public: auto lock(auto&& condition_function) const&& = delete;
|
||||
public: template <bool Nothrow = false> auto lock(auto&& condition_function, auto timeout) const&
|
||||
-> DeepBase_::template LockReturnType_<decltype(*this), decltype(timeout), Nothrow>
|
||||
requires DeepBase_::template LockConstraint_<decltype(condition_function), decltype(timeout)>;
|
||||
public: template <bool Nothrow = false> auto lock(auto&& condition_function, auto timeout) &
|
||||
-> DeepBase_::template LockReturnType_<decltype(*this), decltype(timeout), Nothrow>
|
||||
requires DeepBase_::template LockConstraint_<decltype(condition_function), decltype(timeout)>;
|
||||
public: template <bool Nothrow = false> auto lock(auto&& condition_function, auto timeout) const&& = delete;
|
||||
};
|
||||
}
|
||||
@@ -1,366 +0,0 @@
|
||||
# pragma once
|
||||
# include <biu/atomic/nolog.hpp>
|
||||
|
||||
namespace biu
|
||||
{
|
||||
template <DecayedType ValueType> detail_::AtomicBase<ValueType, false>::AtomicBase(const ValueType& value)
|
||||
: Value_{value} {}
|
||||
template <DecayedType ValueType> detail_::AtomicBase<ValueType, false>::AtomicBase(ValueType&& value)
|
||||
: Value_{std::move(value)} {}
|
||||
|
||||
template <DecayedType ValueType>
|
||||
detail_::AtomicBase<ValueType, false>::TimeoutException::TimeoutException(std::string)
|
||||
: Message_{"TimeoutException"} {}
|
||||
template <DecayedType ValueType>
|
||||
const char* detail_::AtomicBase<ValueType, false>::TimeoutException::what() const noexcept
|
||||
{return Message_.c_str();}
|
||||
|
||||
template <DecayedType ValueType>
|
||||
template <bool ReturnFunctionResult, typename ConditionFunction, typename Duration, bool Nothrow>
|
||||
auto detail_::AtomicBase<ValueType, false>::apply_
|
||||
(auto&& atomic, auto&& function, ConditionFunction&& condition_function, Duration timeout)
|
||||
-> ApplyReturnType_
|
||||
<decltype(function), decltype(atomic), ReturnFunctionResult, ConditionFunction, Duration, Nothrow>
|
||||
requires ApplyConstraint_<decltype(function), decltype(atomic), ConditionFunction, Duration>
|
||||
{
|
||||
std::unique_lock lock{atomic.Mutex_};
|
||||
|
||||
// try to meet the condition
|
||||
if constexpr (!std::is_null_pointer_v<ConditionFunction>)
|
||||
{
|
||||
if constexpr (std::is_null_pointer_v<Duration>)
|
||||
atomic.ConditionVariable_.wait(lock, [&]
|
||||
{return std::forward<ConditionFunction>(condition_function)(std::as_const(atomic.Value_));});
|
||||
else if (!atomic.ConditionVariable_.wait_for(lock, timeout, [&]
|
||||
{return std::forward<ConditionFunction>(condition_function)(std::as_const(atomic.Value_));}))
|
||||
{
|
||||
if constexpr (Nothrow)
|
||||
{
|
||||
if constexpr
|
||||
(ReturnFunctionResult && !std::is_void_v<std::invoke_result_t<decltype(function), ValueType>>)
|
||||
return std::nullopt;
|
||||
else return false;
|
||||
}
|
||||
else throw TimeoutException{};
|
||||
}
|
||||
}
|
||||
|
||||
// apply the function and return
|
||||
if constexpr (ReturnFunctionResult && !std::is_void_v<std::invoke_result_t<decltype(function), ValueType>>)
|
||||
{
|
||||
auto&& result = std::forward<decltype(function)>(function)
|
||||
(static_cast<MoveQualifiers<decltype(atomic), ValueType>&&>(atomic.Value_));
|
||||
if constexpr (!std::is_const_v<decltype(atomic)>) atomic.ConditionVariable_.notify_all();
|
||||
return std::forward<decltype(result)>(result);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::forward<decltype(function)>(function)
|
||||
(static_cast<MoveQualifiers<decltype(atomic), ValueType>&&>(atomic.Value_));
|
||||
if constexpr (!std::is_const_v<decltype(atomic)>) atomic.ConditionVariable_.notify_all();
|
||||
if constexpr (ReturnFunctionResult && std::is_void_v<std::invoke_result_t<decltype(function), ValueType>>)
|
||||
return;
|
||||
else return std::forward<decltype(atomic)>(atomic);
|
||||
}
|
||||
}
|
||||
|
||||
template <DecayedType ValueType> template <bool Nothrow, typename Duration>
|
||||
auto detail_::AtomicBase<ValueType, false>::wait_(auto&& atomic, auto&& condition_function, Duration timeout)
|
||||
-> WaitReturnType_<decltype(atomic), decltype(condition_function), Duration, Nothrow>
|
||||
requires WaitConstraint_<decltype(condition_function), Duration>
|
||||
{
|
||||
std::unique_lock lock{atomic.Mutex_};
|
||||
|
||||
if constexpr (std::is_null_pointer_v<Duration>)
|
||||
{
|
||||
atomic.ConditionVariable_.wait(lock, [&]
|
||||
{return std::forward<decltype(condition_function)>(condition_function)(std::as_const(atomic.Value_));});
|
||||
return std::forward<decltype(atomic)>(atomic);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!atomic.ConditionVariable_.wait_for(lock, timeout, [&]
|
||||
{return std::forward<decltype(condition_function)>(condition_function)(std::as_const(atomic.Value_));}))
|
||||
{
|
||||
if constexpr (Nothrow) return false;
|
||||
else throw TimeoutException{};
|
||||
}
|
||||
else
|
||||
{
|
||||
if constexpr (Nothrow) return true;
|
||||
else return std::forward<decltype(atomic)>(atomic);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <DecayedType ValueType> template <bool Nothrow, typename ConditionFunction, typename Duration>
|
||||
auto detail_::AtomicBase<ValueType, false>::lock_
|
||||
(auto&& atomic, ConditionFunction&& condition_function, Duration timeout)
|
||||
-> LockReturnType_<decltype(atomic), Duration, Nothrow> requires LockConstraint_<ConditionFunction, Duration>
|
||||
{
|
||||
if constexpr (std::is_null_pointer_v<ConditionFunction>)
|
||||
return {std::unique_lock{atomic.Mutex_}, std::experimental::make_observer(&atomic), {}};
|
||||
else if constexpr (std::is_null_pointer_v<Duration>)
|
||||
{
|
||||
std::unique_lock lock{atomic.Mutex_};
|
||||
atomic.ConditionVariable_.wait(lock, [&]
|
||||
{return std::forward<ConditionFunction>(condition_function)(std::as_const(atomic.Value_));});
|
||||
return {std::move(lock), std::experimental::make_observer(&atomic), {}};
|
||||
}
|
||||
else
|
||||
{
|
||||
std::unique_lock lock{atomic.Mutex_};
|
||||
if (!atomic.ConditionVariable_.wait_for(lock, timeout, [&]
|
||||
{return std::forward<ConditionFunction>(condition_function)(std::as_const(atomic.Value_));}))
|
||||
{
|
||||
if constexpr (Nothrow) return std::nullopt;
|
||||
else throw TimeoutException{};
|
||||
}
|
||||
else
|
||||
return {{std::move(lock), std::experimental::make_observer(&atomic), {}}};
|
||||
}
|
||||
}
|
||||
|
||||
template <DecayedType ValueType, bool UseLogger> Atomic<ValueType, UseLogger>::Atomic(const ValueType& value)
|
||||
: detail_::AtomicBase<ValueType, UseLogger>{value} {}
|
||||
template <DecayedType ValueType, bool UseLogger> Atomic<ValueType, UseLogger>::Atomic(ValueType&& value)
|
||||
: detail_::AtomicBase<ValueType, UseLogger>{std::move(value)} {}
|
||||
template <DecayedType ValueType, bool UseLogger> template <bool OtherUseLogger>
|
||||
Atomic<ValueType, UseLogger>::Atomic(const Atomic<ValueType, OtherUseLogger>& other)
|
||||
: detail_::AtomicBase<ValueType, UseLogger>{other} {}
|
||||
template <DecayedType ValueType, bool UseLogger> template <bool OtherUseLogger>
|
||||
Atomic<ValueType, UseLogger>::Atomic(Atomic<ValueType, OtherUseLogger>&& other)
|
||||
: detail_::AtomicBase<ValueType, UseLogger>{std::move(other)} {}
|
||||
template <DecayedType ValueType, bool UseLogger>
|
||||
Atomic<ValueType, UseLogger>& Atomic<ValueType, UseLogger>::operator=(const ValueType& value)
|
||||
{
|
||||
std::scoped_lock lock{DeepBase_::Mutex_};
|
||||
DeepBase_::Value_ = value;
|
||||
DeepBase_::ConditionVariable_.notify_all();
|
||||
return *this;
|
||||
}
|
||||
template <DecayedType ValueType, bool UseLogger>
|
||||
Atomic<ValueType, UseLogger>& Atomic<ValueType, UseLogger>::operator=(ValueType&& value)
|
||||
{
|
||||
std::scoped_lock lock{DeepBase_::Mutex_};
|
||||
DeepBase_::Value_ = std::move(value);
|
||||
DeepBase_::ConditionVariable_.notify_all();
|
||||
return *this;
|
||||
}
|
||||
template <DecayedType ValueType, bool UseLogger> template <bool OtherUseLogger>
|
||||
Atomic<ValueType, UseLogger>& operator=(const Atomic<ValueType, OtherUseLogger>& other)
|
||||
{
|
||||
std::scoped_lock lock{DeepBase_::Mutex_};
|
||||
DeepBase_::Value_ = value;
|
||||
DeepBase_::ConditionVariable_.notify_all();
|
||||
return *this;
|
||||
}
|
||||
template <DecayedType ValueType, bool UseLogger> template <bool OtherUseLogger>
|
||||
Atomic<ValueType, UseLogger>& operator=(Atomic<ValueType, OtherUseLogger>&& other)
|
||||
{
|
||||
std::scoped_lock lock{DeepBase_::Mutex_};
|
||||
DeepBase_::Value_ = std::move(value);
|
||||
DeepBase_::ConditionVariable_.notify_all();
|
||||
return *this;
|
||||
}
|
||||
template <DecayedType ValueType, bool UseLogger> ValueType Atomic<ValueType, UseLogger>::get() const&
|
||||
{
|
||||
std::scoped_lock lock{DeepBase_::Mutex_};
|
||||
return DeepBase_::Value_;
|
||||
}
|
||||
template <DecayedType ValueType, bool UseLogger> ValueType Atomic<ValueType, UseLogger>::get() &&
|
||||
{
|
||||
std::scoped_lock lock{DeepBase_::Mutex_};
|
||||
return std::move(DeepBase_::Value_);
|
||||
}
|
||||
template <DecayedType ValueType, bool UseLogger> Atomic<ValueType, UseLogger>::operator ValueType() const&
|
||||
{return get();}
|
||||
template <DecayedType ValueType, bool UseLogger> Atomic<ValueType, UseLogger>::operator ValueType() &&
|
||||
{return std::move(*this).get();}
|
||||
|
||||
template <DecayedType ValueType, bool UseLogger> template <bool ReturnFunctionResult>
|
||||
auto Atomic<ValueType, UseLogger>::apply(auto&& function) const&
|
||||
-> DeepBase_::template ApplyReturnType_<decltype(function), decltype(*this), ReturnFunctionResult>
|
||||
requires DeepBase_::template ApplyConstraint_<decltype(function), decltype(*this)>
|
||||
{return apply_<ReturnFunctionResult>(*this, std::forward<decltype(function)>(function));}
|
||||
template <DecayedType ValueType, bool UseLogger> template <bool ReturnFunctionResult>
|
||||
auto Atomic<ValueType, UseLogger>::apply(auto&& function) &
|
||||
-> DeepBase_::template ApplyReturnType_<decltype(function), decltype(*this), ReturnFunctionResult>
|
||||
requires DeepBase_::template ApplyConstraint_<decltype(function), decltype(*this)>
|
||||
{return apply_<ReturnFunctionResult>(*this, std::forward<decltype(function)>(function));}
|
||||
template <DecayedType ValueType, bool UseLogger> template <bool ReturnFunctionResult>
|
||||
auto Atomic<ValueType, UseLogger>::apply(auto&& function) &&
|
||||
-> DeepBase_::template ApplyReturnType_<decltype(function), decltype(*this), ReturnFunctionResult>
|
||||
requires DeepBase_::template ApplyConstraint_<decltype(function), decltype(*this)>
|
||||
{return apply_<ReturnFunctionResult>(std::move(*this), std::forward<decltype(function)>(function));}
|
||||
template <DecayedType ValueType, bool UseLogger> template <bool ReturnFunctionResult>
|
||||
auto Atomic<ValueType, UseLogger>::apply(auto&& function, auto&& condition_function) const&
|
||||
-> DeepBase_::template ApplyReturnType_
|
||||
<decltype(function), decltype(*this), ReturnFunctionResult, decltype(condition_function)>
|
||||
requires DeepBase_::template ApplyConstraint_<decltype(function), decltype(*this), decltype(condition_function)>
|
||||
{
|
||||
return apply_<ReturnFunctionResult>
|
||||
(
|
||||
*this, std::forward<decltype(function)>(function),
|
||||
std::forward<decltype(condition_function)>(condition_function)
|
||||
);
|
||||
}
|
||||
template <DecayedType ValueType, bool UseLogger> template <bool ReturnFunctionResult>
|
||||
auto Atomic<ValueType, UseLogger>::apply(auto&& function, auto&& condition_function) &
|
||||
-> DeepBase_::template ApplyReturnType_
|
||||
<decltype(function), decltype(*this), ReturnFunctionResult, decltype(condition_function)>
|
||||
requires DeepBase_::template ApplyConstraint_<decltype(function), decltype(*this), decltype(condition_function)>
|
||||
{
|
||||
return apply_<ReturnFunctionResult>
|
||||
(
|
||||
*this, std::forward<decltype(function)>(function),
|
||||
std::forward<decltype(condition_function)>(condition_function)
|
||||
);
|
||||
}
|
||||
template <DecayedType ValueType, bool UseLogger> template <bool ReturnFunctionResult>
|
||||
auto Atomic<ValueType, UseLogger>::apply(auto&& function, auto&& condition_function) &&
|
||||
-> DeepBase_::template ApplyReturnType_
|
||||
<decltype(function), decltype(*this), ReturnFunctionResult, decltype(condition_function)>
|
||||
requires DeepBase_::template ApplyConstraint_<decltype(function), decltype(*this), decltype(condition_function)>
|
||||
{
|
||||
return apply_<ReturnFunctionResult>
|
||||
(
|
||||
std::move(*this), std::forward<decltype(function)>(function),
|
||||
std::forward<decltype(condition_function)>(condition_function)
|
||||
);
|
||||
}
|
||||
template <DecayedType ValueType, bool UseLogger> template <bool ReturnFunctionResult, bool Nothrow>
|
||||
auto Atomic<ValueType, UseLogger>::apply(auto&& function, auto&& condition_function, auto timeout) const&
|
||||
-> DeepBase_::template ApplyReturnType_
|
||||
<
|
||||
decltype(function), decltype(*this), ReturnFunctionResult,
|
||||
decltype(condition_function), decltype(timeout), Nothrow
|
||||
> requires DeepBase_::template ApplyConstraint_
|
||||
<decltype(function), decltype(*this), decltype(condition_function), decltype(timeout)>
|
||||
{
|
||||
return apply_<ReturnFunctionResult, Nothrow>
|
||||
(
|
||||
*this, std::forward<decltype(function)>(function),
|
||||
std::forward<decltype(condition_function)>(condition_function), timeout
|
||||
);
|
||||
}
|
||||
template <DecayedType ValueType, bool UseLogger> template <bool ReturnFunctionResult, bool Nothrow>
|
||||
auto Atomic<ValueType, UseLogger>::apply(auto&& function, auto&& condition_function, auto timeout) &
|
||||
-> DeepBase_::template ApplyReturnType_
|
||||
<
|
||||
decltype(function), decltype(*this), ReturnFunctionResult,
|
||||
decltype(condition_function), decltype(timeout), Nothrow
|
||||
> requires DeepBase_::template ApplyConstraint_
|
||||
<decltype(function), decltype(*this), decltype(condition_function), decltype(timeout)>
|
||||
{
|
||||
return apply_<ReturnFunctionResult, Nothrow>
|
||||
(
|
||||
*this, std::forward<decltype(function)>(function),
|
||||
std::forward<decltype(condition_function)>(condition_function), timeout
|
||||
);
|
||||
}
|
||||
template <DecayedType ValueType, bool UseLogger> template <bool ReturnFunctionResult, bool Nothrow>
|
||||
auto Atomic<ValueType, UseLogger>::apply(auto&& function, auto&& condition_function, auto timeout) &&
|
||||
-> DeepBase_::template ApplyReturnType_
|
||||
<
|
||||
decltype(function), decltype(*this), ReturnFunctionResult,
|
||||
decltype(condition_function), decltype(timeout), Nothrow
|
||||
> requires DeepBase_::template ApplyConstraint_
|
||||
<decltype(function), decltype(*this), decltype(condition_function), decltype(timeout)>
|
||||
{
|
||||
return apply_<ReturnFunctionResult, Nothrow>
|
||||
(
|
||||
std::move(*this), std::forward<decltype(function)>(function),
|
||||
std::forward<decltype(condition_function)>(condition_function), timeout
|
||||
);
|
||||
}
|
||||
|
||||
template <DecayedType ValueType, bool UseLogger>
|
||||
auto Atomic<ValueType, UseLogger>::wait(auto&& condition_function) const&
|
||||
-> DeepBase_::template WaitReturnType_<decltype(*this), decltype(condition_function)>
|
||||
requires DeepBase_::template WaitConstraint_<decltype(condition_function)>
|
||||
{return wait_(*this, std::forward<decltype(condition_function)>(condition_function));}
|
||||
template <DecayedType ValueType, bool UseLogger>
|
||||
auto Atomic<ValueType, UseLogger>::wait(auto&& condition_function) &
|
||||
-> DeepBase_::template WaitReturnType_<decltype(*this), decltype(condition_function)>
|
||||
requires DeepBase_::template WaitConstraint_<decltype(condition_function)>
|
||||
{return wait_(*this, std::forward<decltype(condition_function)>(condition_function));}
|
||||
template <DecayedType ValueType, bool UseLogger>
|
||||
auto Atomic<ValueType, UseLogger>::wait(auto&& condition_function) &&
|
||||
-> DeepBase_::template WaitReturnType_<decltype(*this), decltype(condition_function)>
|
||||
requires DeepBase_::template WaitConstraint_<decltype(condition_function)>
|
||||
{return wait_(std::move(*this), std::forward<decltype(condition_function)>(condition_function));}
|
||||
template <DecayedType ValueType, bool UseLogger> template <bool Nothrow>
|
||||
auto Atomic<ValueType, UseLogger>::wait(auto&& condition_function, auto timeout) const&
|
||||
-> DeepBase_::template WaitReturnType_
|
||||
<decltype(*this), decltype(condition_function), decltype(timeout), Nothrow>
|
||||
requires DeepBase_::template WaitConstraint_<decltype(condition_function), decltype(timeout)>
|
||||
{return wait_<Nothrow>(*this, std::forward<decltype(condition_function)>(condition_function), timeout);}
|
||||
template <DecayedType ValueType, bool UseLogger> template <bool Nothrow>
|
||||
auto Atomic<ValueType, UseLogger>::wait(auto&& condition_function, auto timeout) &
|
||||
-> DeepBase_::template WaitReturnType_
|
||||
<decltype(*this), decltype(condition_function), decltype(timeout), Nothrow>
|
||||
requires DeepBase_::template WaitConstraint_<decltype(condition_function), decltype(timeout)>
|
||||
{return wait_<Nothrow>(*this, std::forward<decltype(condition_function)>(condition_function), timeout);}
|
||||
template <DecayedType ValueType, bool UseLogger> template <bool Nothrow>
|
||||
auto Atomic<ValueType, UseLogger>::wait(auto&& condition_function, auto timeout) &&
|
||||
-> DeepBase_::template WaitReturnType_
|
||||
<decltype(*this), decltype(condition_function), decltype(timeout), Nothrow>
|
||||
requires DeepBase_::template WaitConstraint_<decltype(condition_function), decltype(timeout)>
|
||||
{
|
||||
return wait_<Nothrow>
|
||||
(std::move(*this), std::forward<decltype(condition_function)>(condition_function), timeout);
|
||||
}
|
||||
|
||||
template <DecayedType ValueType, bool UseLogger> template <bool Const> template <bool OtherConst>
|
||||
Atomic<ValueType, UseLogger>::Guard<Const>::Guard(const Guard<OtherConst>& other)
|
||||
requires (Const || !OtherConst)
|
||||
: Lock_{other.Lock_}, Value_{other.Value_} {}
|
||||
template <DecayedType ValueType, bool UseLogger> template <bool Const>
|
||||
Atomic<ValueType, UseLogger>::Guard<Const>::Guard
|
||||
(decltype(Lock_)&& lock, decltype(Value_) value, CalledBy<detail_::AtomicBase<ValueType, UseLogger>>)
|
||||
: Lock_{std::move(lock)}, Value_{value} {}
|
||||
template <DecayedType ValueType, bool UseLogger> template <bool Const>
|
||||
Atomic<ValueType, UseLogger>::Guard<Const>::~Guard()
|
||||
{Value_->ConditionVariable_.notify_all();}
|
||||
|
||||
template <DecayedType ValueType, bool UseLogger> template <bool Const>
|
||||
std::conditional_t<Const, const ValueType&, ValueType&>
|
||||
Atomic<ValueType, UseLogger>::Guard<Const>::operator*() const&
|
||||
{return Value_->Value_;}
|
||||
template <DecayedType ValueType, bool UseLogger> template <bool Const>
|
||||
std::conditional_t<Const, const ValueType*, ValueType*>
|
||||
Atomic<ValueType, UseLogger>::Guard<Const>::operator->() const&
|
||||
{return &Value_->Value_;}
|
||||
template <DecayedType ValueType, bool UseLogger> template <bool Const>
|
||||
std::conditional_t<Const, const ValueType&, ValueType&>
|
||||
Atomic<ValueType, UseLogger>::Guard<Const>::value() const&
|
||||
{return Value_->Value_;}
|
||||
|
||||
template <DecayedType ValueType, bool UseLogger> auto Atomic<ValueType, UseLogger>::lock() const&
|
||||
-> DeepBase_::template LockReturnType_<decltype(*this)> requires DeepBase_::template LockConstraint_<>
|
||||
{return lock_(*this);}
|
||||
template <DecayedType ValueType, bool UseLogger> auto Atomic<ValueType, UseLogger>::lock() &
|
||||
-> DeepBase_::template LockReturnType_<decltype(*this)> requires DeepBase_::template LockConstraint_<>
|
||||
{return lock_(*this);}
|
||||
template <DecayedType ValueType, bool UseLogger>
|
||||
auto Atomic<ValueType, UseLogger>::lock(auto&& condition_function) const&
|
||||
-> DeepBase_::template LockReturnType_<decltype(*this), decltype(condition_function)>
|
||||
requires DeepBase_::template LockConstraint_<decltype(condition_function)>
|
||||
{return lock_(*this, condition_function);}
|
||||
template <DecayedType ValueType, bool UseLogger>
|
||||
auto Atomic<ValueType, UseLogger>::lock(auto&& condition_function) &
|
||||
-> DeepBase_::template LockReturnType_<decltype(*this), decltype(condition_function)>
|
||||
requires DeepBase_::template LockConstraint_<decltype(condition_function)>
|
||||
{return lock_(*this, condition_function);}
|
||||
template <DecayedType ValueType, bool UseLogger> template <bool Nothrow>
|
||||
auto Atomic<ValueType, UseLogger>::lock(auto&& condition_function, auto timeout) const&
|
||||
-> DeepBase_::template LockReturnType_<decltype(*this), decltype(timeout), Nothrow>
|
||||
requires DeepBase_::template LockConstraint_<decltype(condition_function), decltype(timeout)>
|
||||
{return lock_<Nothrow>(*this, condition_function, timeout);}
|
||||
template <DecayedType ValueType, bool UseLogger> template <bool Nothrow>
|
||||
auto Atomic<ValueType, UseLogger>::lock(auto&& condition_function, auto timeout) &
|
||||
-> DeepBase_::template LockReturnType_<decltype(*this), decltype(timeout), Nothrow>
|
||||
requires DeepBase_::template LockConstraint_<decltype(condition_function), decltype(timeout)>
|
||||
{return lock_<Nothrow>(*this, condition_function, timeout);}
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
# pragma once
|
||||
# include <vector>
|
||||
# include <span>
|
||||
# include <Eigen/Dense>
|
||||
# include <biu/concepts.hpp>
|
||||
|
||||
namespace biu
|
||||
{
|
||||
namespace detail_::eigen
|
||||
{
|
||||
// user-specified size of destination container: dynamic, unspecified(use default), or fixed
|
||||
constexpr std::size_t dynamicSize = std::dynamic_extent, unspecifiedSize = std::dynamic_extent - 1;
|
||||
static_assert(std::dynamic_extent == std::numeric_limits<std::size_t>::max());
|
||||
|
||||
// supported types of standard containers
|
||||
template <typename T, typename Scalar> struct SpecializationOfArrayHelper : std::false_type {};
|
||||
template <typename Scalar, std::size_t N>
|
||||
struct SpecializationOfArrayHelper<std::array<Scalar, N>, Scalar> : std::true_type {};
|
||||
template <typename Scalar, std::size_t N>
|
||||
struct SpecializationOfArrayHelper<std::array<Scalar, N>, void> : std::true_type {};
|
||||
template <typename T, typename Scalar = void> concept SpecializationOfArray =
|
||||
SpecializationOfArrayHelper<T, Scalar>::value;
|
||||
template <typename T, typename Scalar> concept StandardContainer =
|
||||
SpecializationOf<T, std::vector, Scalar> || SpecializationOfArray<T, Scalar>;
|
||||
|
||||
// helper operator| to specify the size of the destination container
|
||||
// usage: some_value | toEigen<Row, Col>
|
||||
template <std::size_t Row, std::size_t Col> struct ToEigenHelper {};
|
||||
template <std::size_t Row = unspecifiedSize, std::size_t Col = unspecifiedSize>
|
||||
inline constexpr ToEigenHelper<Row, Col> toEigen;
|
||||
// convert 1D standard container to Eigen::Vector
|
||||
// if no size is specified, convert std::vector to dynamic-size Eigen::Vector,
|
||||
// std::array to fixed-size Eigen::Vector;
|
||||
// if size is std::dynamic_extent, always convert to dynamic-size Eigen::Vector
|
||||
// if size is specified as a number, convert to fixed-size Eigen::Vector if specified size equals the size of the
|
||||
// input, otherwise throw an error
|
||||
template <template <int N> typename Callback, std::size_t ToSize> auto deduce_eigen_size(auto&& container);
|
||||
template <Arithmetic T, StandardContainer<T> From, std::size_t ToSize> auto operator|
|
||||
(const From&, const ToEigenHelper<ToSize, unspecifiedSize>&);
|
||||
// convert 2D standard container to Eigen::Matrix
|
||||
// the same rules as above apply
|
||||
// besides, all rows must have the same size, otherwise throw an error
|
||||
template
|
||||
<
|
||||
Arithmetic T, StandardContainer<T> FromPerRow, StandardContainer<FromPerRow> From,
|
||||
std::size_t ToRow, std::size_t ToCol
|
||||
>
|
||||
auto operator|(const From&, const ToEigenHelper<ToRow, ToCol>&);
|
||||
|
||||
// TODO: implement fromEigen
|
||||
}
|
||||
|
||||
inline namespace eigen { using detail_::eigen::toEigen; using detail_::eigen::operator|; }
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
# pragma once
|
||||
# include <biu/eigen.hpp>
|
||||
// TODO: fix biu::logger
|
||||
// # include <biu/logger.hpp>
|
||||
# include <range/v3/view.hpp>
|
||||
|
||||
namespace biu
|
||||
{
|
||||
namespace detail_::eigen
|
||||
{
|
||||
template <template <int N> typename Callback, std::size_t ToSize> auto deduce_eigen_size(auto&& from)
|
||||
{
|
||||
if constexpr (ToSize == dynamicSize)
|
||||
return Callback<Eigen::Dynamic>()(from.data(), from.size());
|
||||
else if constexpr (ToSize == unspecifiedSize)
|
||||
if constexpr (SpecializationOfArray<decltype(from)>)
|
||||
return Callback<from.size()>()(from.data());
|
||||
else
|
||||
return Callback<Eigen::Dynamic>()(from.data(), from.size());
|
||||
else
|
||||
if (from.size() != ToSize)
|
||||
// TODO: use biu::logger
|
||||
throw std::invalid_argument("biu::toEigen: size mismatch");
|
||||
else
|
||||
return Callback<ToSize>()(from.data());
|
||||
}
|
||||
// TODO: implement 2D case
|
||||
}
|
||||
}
|
||||
@@ -1,104 +0,0 @@
|
||||
# include <future>
|
||||
# include <utility>
|
||||
# include <cstdio>
|
||||
# include <biu.hpp>
|
||||
# include <boost/process.hpp>
|
||||
# include <boost/preprocessor.hpp>
|
||||
|
||||
namespace biu
|
||||
{
|
||||
std::regex literals::operator""_re(const char* str, std::size_t len) { return std::regex{str, len}; }
|
||||
namespace common
|
||||
{
|
||||
void block_forever() { std::promise<void>().get_future().wait(); std::unreachable(); }
|
||||
bool is_interactive() { return isatty(fileno(stdin)); }
|
||||
std::optional<std::string> env(std::string name)
|
||||
{
|
||||
if (auto value = std::getenv(name.c_str()); !value) return std::nullopt;
|
||||
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 <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;
|
||||
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()}, {}};
|
||||
}()
|
||||
};
|
||||
}
|
||||
}
|
||||
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>);
|
||||
BOOST_PP_FOR(0, BIU_EXEC_PRED, BIU_EXEC_OP, BIU_EXEC_MACRO)
|
||||
}
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
# include <tgbot/tgbot.h>
|
||||
# include <biu.hpp>
|
||||
|
||||
namespace biu
|
||||
{
|
||||
Atomic<std::optional<typename Logger::LoggerConfigType_>, false> Logger::LoggerConfig_;
|
||||
void Logger::init(std::experimental::observer_ptr<std::ostream> stream, Level level)
|
||||
{
|
||||
auto&& lock = LoggerConfig_.lock();
|
||||
lock->emplace(stream, nullptr, level);
|
||||
}
|
||||
void Logger::init(std::shared_ptr<std::ostream> stream, Level level)
|
||||
{
|
||||
auto&& lock = LoggerConfig_.lock();
|
||||
lock->emplace(std::experimental::make_observer(stream.get()), stream, level);
|
||||
}
|
||||
|
||||
Atomic<std::optional<std::pair<std::string, std::string>>, false> Logger::TelegramConfig_;
|
||||
void Logger::telegram_init(const std::string& token, const std::string& chat_id)
|
||||
{TelegramConfig_ = std::make_pair(token, chat_id);}
|
||||
void Logger::telegram_notify(const std::string& message)
|
||||
{
|
||||
if (auto&& lock = TelegramConfig_.lock(); *lock)
|
||||
{
|
||||
TgBot::Bot bot{lock.value()->first};
|
||||
bot.getApi().sendMessage(lock.value()->first, message);
|
||||
}
|
||||
}
|
||||
void Logger::telegram_notify_async(const std::string& message)
|
||||
{std::thread{Logger::telegram_notify, message}.detach();}
|
||||
|
||||
Atomic<std::multimap<const void*, std::string_view>, false> Logger::Objects_;
|
||||
|
||||
thread_local unsigned Logger::Guard::Indent_ = 0;
|
||||
Atomic<std::map<std::size_t, std::size_t>, false> Logger::Threads_;
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
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
|
||||
{ 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
|
||||
{
|
||||
inherit cppcoro nameof tgbot-cpp date;
|
||||
nghttp2 = inputs.pkgs.callPackage "${inputs.topInputs."nixpkgs-23.05"}/pkgs/development/libraries/nghttp2"
|
||||
{ enableAsioLib = true; stdenv = inputs.pkgs.gcc12Stdenv; };
|
||||
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 {};
|
||||
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; };
|
||||
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; };
|
||||
vasp = rec
|
||||
{
|
||||
src = inputs.pkgs.callPackage ./vasp/source.nix {};
|
||||
gnu = inputs.pkgs.callPackage ./vasp/gnu
|
||||
{
|
||||
inherit (inputs.pkgs.llvmPackages) openmp;
|
||||
inherit wannier90 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; };
|
||||
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" {};
|
||||
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
|
||||
{ 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; };
|
||||
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; };
|
||||
|
||||
fromYaml = content: builtins.fromJSON (builtins.readFile
|
||||
(inputs.pkgs.runCommand "toJSON" {}
|
||||
"${inputs.pkgs.remarshal}/bin/yaml2json ${builtins.toFile "content.yaml" content} $out"));
|
||||
}
|
||||
@@ -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
|
||||
'';
|
||||
}
|
||||
@@ -1,214 +1 @@
|
||||
# 设置 SSH agent forwarding
|
||||
|
||||
为了区分登陆 jykang@hpc.xmu.edu.cn 时使用的密钥,并分密钥统计使用情况,需要启用一项名为“SSH agent forwarding”的功能。
|
||||
接下来的内容将带领您在 Windows 系统上配置 SSH agent forwarding。
|
||||
|
||||
> [!NOTE]
|
||||
> 在 Linux 上的配置方法放在了文章末尾。大多数用户不需要阅读。
|
||||
|
||||
要启用“SSH agent forwarding”,需要下面三个步骤:
|
||||
1. 启动 Pageant 并添加密钥。 **这一步骤每次登陆前都需要执行。**
|
||||
2. 配置 PuTTY,使 PuTTY 在每次登陆时不直接使用密钥,而是利用 Pageant 完成认证。这一步骤只需要执行一次。
|
||||
3. 配置 WinSCP,使 WinSCP 在每次登陆时不直接使用密钥,而是利用 Pageant 完成认证。这一步骤只需要执行一次。
|
||||
|
||||
接下来将分别说明这三个步骤。
|
||||
|
||||
## Pageant:
|
||||
|
||||
1. 找到 Pageant 程序。Pageant 会随着 PuTTY 一起安装,一般来说您可以直接在开始菜单中搜索 “pageant” 找到它,也可以在 PuTTY 的安装目录中找到它。
|
||||
2. 启动 Pageant。启动后可能没有任何反应,也可能有一个黑框闪过,这是正常的。只要右下角的系统托盘中出现了 pageant 的图标就可以了。
|
||||
|
||||

|
||||
|
||||
3. 双击 Pageant 图标,打开 Pageant 窗口。选择 “Add Key”,然后选择您的密钥文件。
|
||||
|
||||

|
||||
|
||||
4. 在使用服务器期间保持 Pageant 启动(可以关闭 Pageant 的窗口,但不要在系统托盘中右键退出)。
|
||||
5. 使用完毕后,在系统托盘中右键退出 Pageant。
|
||||
|
||||
> [!NOTE]
|
||||
> 无论是使用 WinSCP 还是 PuTTY,每次使用前,都需要如此启动 Pageant 并添加密钥。
|
||||
|
||||
> [!TIP]
|
||||
> 如果您觉得每次打开 Pageant 都要手动添加密钥很麻烦,并且熟悉 Windows 命令行的使用,
|
||||
> 可以编写一个批处理文件(将下方代码用记事本保存,然后将扩展名从 `.txt` 改为 `.bat`),每次双击该文件即可启动 Pageant 并自动添加密钥:
|
||||
>
|
||||
> `"C:\ProgramData\chocolatey\bin\PAGEANT.EXE" "Z:\.ssh\id_rsa.ppk"`
|
||||
>
|
||||
> 其中第一个引号内为 Pageant 的路径,第二个引号内为您的密钥文件的路径。也可以将该批处理文件放入开机启动项中,使得 Pageant 在开机时自动启动。
|
||||
>
|
||||
> 因为每个人的密钥文件以及 Pageant 的路径都可能不同,所以这里无法提供通用的批处理文件。
|
||||
|
||||
## PuTTY:
|
||||
|
||||
1. 在 Connection -> SSH -> Auth,勾选“Attempt authentication using Pageant”和“Allow agent forwarding”。
|
||||
|
||||

|
||||
|
||||
2. 在 Connection -> SSH -> Auth -> Credentials,清空 “Private key file for authentication”,然后保存。
|
||||
|
||||

|
||||
|
||||
3. (选做但推荐)在 Connection -> Data 中,将 “Auto-login username” 设置为 `jykang`,这样每次登陆时就不需要手动输入用户名了。
|
||||
|
||||
## WinSCP:
|
||||
|
||||
1. 在 SSH -> Authentication,勾选 “使用 Pageant 进行认证”,勾选 “允许代理转发”,清空 “密钥文件”,然后保存。
|
||||
|
||||

|
||||
|
||||
2. (选做)如果您需要通过 WinSCP 打开 PuTTY 的话,需要在 WinSCP 主界面 -> 工具 -> 选项 -> 集成 -> 应用程序路径中,
|
||||
在原来的基础上增加 `-A` 参数。
|
||||
|
||||

|
||||
|
||||
> [!TIP]
|
||||
> 如果 WinSCP 不让你直接修改那个字符串,就把它复制到记事本里修改,然后再复制回去。
|
||||
|
||||
至此,您已经成功配置了 SSH agent forwarding。
|
||||
之后使用 PuTTY 登陆 `jykang@hpc.xmu.edu.cn` 时,会收到包含了您的名字的提示(如图所示),表明您已经成功启用了 SSH agent forwarding。
|
||||
|
||||

|
||||
|
||||
> [!NOTE]
|
||||
> 无论是 PuTTY 还是 WinSCP,改完设置后都记得保存。
|
||||
|
||||
> [!IMPORTANT]
|
||||
> 如果您确认已经按照教程设置好了却仍然不能连接,可以尝试将 WinSCP 和 PuTTY 都更新到最新。
|
||||
>
|
||||
> 我测试使用的版本是:PuTTY 0.78 和 WinSCP 6.3.3。
|
||||
|
||||
---
|
||||
|
||||
# 其它内容
|
||||
|
||||
接下来的内容不是使用 jykang@hpc.xmu.edu.cn 的必需内容,不须要阅读。
|
||||
如果您按照上面的步骤配置 SSH agent forwarding 失败,那么请再次仔细阅读上面的内容,**接下来的内容对您没有帮助**。
|
||||
|
||||
接下来的内容包括:
|
||||
* 解释为什么不转发 agent 就无法区分不同密钥。
|
||||
* 介绍一些可能有用的附加功能,例如区分使用同一个密钥的不同用户,以及如何设置任务进度微信通知。
|
||||
|
||||
## 为什么不转发 agent 就无法区分不同密钥?
|
||||
|
||||
如果你好奇为什么不使用 Pageant 就无法区分使用不同密钥的登陆:
|
||||
|
||||
SSH 连接并不是直接由 jykang 用户处理的,
|
||||
而是由一个名为 `sshd` 的程序处理,它通常以 `root` 用户的身份运行。
|
||||
在完成认证后,`sshd` 会将 Windows 电脑发来的信息解密后转发给以 `jykang` 用户运行的进程,
|
||||
并将以 `jykang` 用户运行的进程的输出加密后发回给 Windows 电脑。
|
||||
我们只能控制 `jykang` 用户运行的进程,但这里拿不到任何关于密钥的信息。
|
||||
|
||||
```mermaid
|
||||
flowchart TB
|
||||
subgraph "Run on windows"
|
||||
A[(密钥文件)] -.->|从硬盘读取| B["SSH client (putty, WinSCP, etc.)"]
|
||||
end
|
||||
subgraph "Run on hpc by root"
|
||||
C["SSH server (sshd)"]
|
||||
end
|
||||
B <--> |"认证信息 & 加密的数据"| C
|
||||
subgraph "Run on hpc by <b>jykang</b>"
|
||||
D["Other programs (bash, VASP, etc.)"]
|
||||
end
|
||||
C <--> |"解密后的数据(不包含密钥信息)"| D
|
||||
```
|
||||
|
||||
Pageant 程序就是所谓的“SSH agent”。“SSH agent forwarding” 就是将到 Pageant 的连接通过已经建立的 SSH 连接转发给远程服务器,
|
||||
使得远程服务器可以与 Pageant 通信,进而读取密钥信息。
|
||||
“SSH agent forwarding” 典型的用途是在远程服务器上使用本地的密钥再次登陆其他服务器,而不是为了区分使用不同密钥的登陆。
|
||||
|
||||
```mermaid
|
||||
flowchart TB
|
||||
subgraph "Run on windows"
|
||||
A[(密钥文件)] -.->|从硬盘读取| E["SSH agent (pageant)"]
|
||||
E <-->|认证信息| B["SSH client (putty, WinSCP, etc.)"]
|
||||
end
|
||||
subgraph "Run on hpc by root"
|
||||
C["SSH server (sshd)"]
|
||||
end
|
||||
B <--> |"认证信息 & 加密的数据"| C
|
||||
subgraph "Run on hpc by <b>jykang</b>"
|
||||
D["Other programs (bash, VASP, etc.)"]
|
||||
end
|
||||
C <--> |"解密后的数据(不包含密钥信息)"| D
|
||||
E <-...-> |"通过已经建立的 SSH 连接转发密钥信息"| D
|
||||
```
|
||||
|
||||
事实上,linux 的管理(统计用户使用的资源,等)非常依赖于不同的用户,即用高权限的用户去管理低权限的用户。
|
||||
大家都使用同一个账户的情况下,很多管理的功能没有现成的解决方案(要自己手写代码、思考如何设计),甚至完全无法实现。
|
||||
整这个东西真的挺麻烦的。我也嫌麻烦(而且我要做的事情比大多数用户多得多)。要不是康老师一定要我做,我才不会做。
|
||||
如果你嫌这些麻烦,与其埋怨我,不如去建议自己的导师去自己申请一个账号用。
|
||||
|
||||
## 设置子账户:
|
||||
|
||||
一个老师拿到密钥后,可能会将它分发给多个不同的学生。
|
||||
如果希望区分不同学生的使用情况,可以修改 `TERM` 变量,加上 `hpcstat_subaccount:your_name:` 前缀,
|
||||
以此来进一步区分使用同一个密钥的不同用户。
|
||||
|
||||
对于 PuTTY 来说,`TERM` 变量在 Connection -> Data -> Ternimal-type string 中修改。
|
||||
例如,如果原本的 `TERM` 变量是 `xterm`,那么修改后的 `TERM` 变量可以是 `hpcstat_subaccount:chn:xterm`。
|
||||
`TERM` 变量只在交互式登陆时有效,因此无法在 WinSCP 中使用。
|
||||
|
||||
如果设置了这个参数,那么会额外统计不同子账户的使用情况(登陆次数、投递的任务、占用的核时,等)。
|
||||
是否设置这个参数都不影响按密钥统计的功能(即,按照密钥统计的核时,是所有使用这个密钥的用户的总和,无论是否设置了这个参数)。
|
||||
|
||||
同时,子账户的统计结果也仅供参考,事实上这个统计结果很容易造假
|
||||
(如果 A 和 B 都使用同一个密钥登陆,那么显然 B 可以在 TERM 中填入 A 的名字以假装自己是 A,把自己用的核时都算到 A 头上)。
|
||||
|
||||
> [!CAUTION]
|
||||
> 如果 `TERM` 变量的格式设置得不正确,PuTTY 登陆后一些程序会无法正常工作,因此尝试时应该仔细且小心。
|
||||
|
||||
## PuTTY 登陆时自动跳转:
|
||||
|
||||
如果您希望在登陆时自动跳转到自己的目录下,可以在 `TERM` 中再增加以下前缀:`chn_cd:your_path:`。
|
||||
|
||||
例如,将 `TERM` 变量修改为 `chn_cd:linwei/chn:xterm`,那么使用 PuTTY 登陆后会自动跳转到 `linwei/chn` 目录下。
|
||||
|
||||
如果同时使用了 `hpcstat_subaccount` 和 `chn_cd`,那么 `hpcstat_subaccount` 必须在 `chn_cd` 之后,
|
||||
例如 `chn_cd:linwei/chn:hpcstat_subaccount:chn:xterm`。
|
||||
|
||||
## 任务进度微信通知:
|
||||
|
||||
用微信打开下面的链接:
|
||||
|
||||
```
|
||||
https://wxpusher.zjiecode.com/wxuser/?type=1&id=75864#/follow
|
||||
```
|
||||
|
||||
您应该会被引导去关注一个公众号(WxPusher 消息推送平台)。关注这个公众号之后会收到一条包含 UID 的消息。
|
||||
然后把下面的信息发给我:
|
||||
* 您的 UID
|
||||
* 您使用的密钥的指纹(用 PuTTY 登陆时会提示)
|
||||
* 如果使用了子账户(在 `TERM` 中设置了 `hpcstat_subaccount`),还需要告诉我您设置的子账户名
|
||||
|
||||
之后您投递的任务有新进度(例如,开始运行、运行结束)时就会通过这个公众号收到通知。
|
||||
|
||||
需要注意的是,这个 UID 会被明文写到 jykang 上的文件里。
|
||||
也就是说存在这样的风险:有权限登陆 jykang 的人都有权限通过这个公众号给您发消息。
|
||||
|
||||
## 在 Linux 上配置 SSH agent forwarding
|
||||
|
||||
1. 使用以下命令将 `.ppk` 的私钥部分拆分出来:
|
||||
|
||||
```bash
|
||||
puttygen id_rsa.ppk -O private-openssh -o ./id_rsa
|
||||
```
|
||||
|
||||
确保 `id_rsa` 的权限为 `600`。
|
||||
|
||||
2. 在 `~/.ssh/config` 中添加以下内容:
|
||||
|
||||
```
|
||||
Host jykang
|
||||
AddKeysToAgent yes
|
||||
ForwardAgent yes
|
||||
IdentityFile ~/path/to/id_rsa
|
||||
```
|
||||
|
||||
然后就可以正常使用了,例如:
|
||||
|
||||
```bash
|
||||
ssh jykang
|
||||
```
|
||||
Moved to [../../../../packages/hpcstat/doc/setup.md](../../../../packages/hpcstat/doc/setup.md)
|
||||
|
||||
Binary file not shown.
@@ -1,18 +0,0 @@
|
||||
{
|
||||
stdenv, src, cmake, pkg-config, substituteAll,
|
||||
gnuplot, libjpeg, libtiff, zlib, libpng, lapack, blas, fftw, opencv, nodesoup, cimg, glfw, libGL, python3, glad
|
||||
}: stdenv.mkDerivation
|
||||
{
|
||||
name = "matplotplusplus";
|
||||
inherit src;
|
||||
cmakeFlags =
|
||||
[
|
||||
"-DBUILD_SHARED_LIBS=ON" "-DMATPLOTPP_BUILD_SHARED_LIBS=ON" "-DMATPLOTPP_BUILD_EXAMPLES=OFF"
|
||||
"-DMATPLOTPP_WITH_SYSTEM_NODESOUP=ON" "-DMATPLOTPP_WITH_SYSTEM_CIMG=ON"
|
||||
"-DMATPLOTPP_BUILD_EXPERIMENTAL_OPENGL_BACKEND=ON" "-DGLAD_REPRODUCIBLE=ON"
|
||||
];
|
||||
buildInputs = [ gnuplot libjpeg libtiff zlib libpng lapack blas fftw opencv nodesoup cimg glfw libGL glad ];
|
||||
nativeBuildInputs = [ cmake pkg-config python3 ];
|
||||
propagatedBuildInputs = [ libGL glad glfw ];
|
||||
propagatedNativeBuildInputs = [ python3 ];
|
||||
}
|
||||
@@ -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==";
|
||||
};
|
||||
};
|
||||
});
|
||||
})
|
||||
@@ -1,125 +0,0 @@
|
||||
# include <filesystem>
|
||||
# include <ftxui/component/component.hpp>
|
||||
# include <ftxui/component/component_options.hpp>
|
||||
# include <ftxui/component/screen_interactive.hpp>
|
||||
# include <boost/algorithm/string.hpp>
|
||||
# include <range/v3/view.hpp>
|
||||
# include <sbatch-tui/device.hpp>
|
||||
# include <biu.hpp>
|
||||
|
||||
using namespace biu::literals;
|
||||
|
||||
int main()
|
||||
{
|
||||
// 需要绑定到界面上的变量
|
||||
struct
|
||||
{
|
||||
int vasp_version_selected = 0;
|
||||
std::vector<std::string> vasp_version_entries = { "std", "gam", "ncl" };
|
||||
int device_selected = 0;
|
||||
std::vector<std::string> device_entries = []
|
||||
{
|
||||
std::vector<std::string> devices(Device.GpuIds.size() + 2);
|
||||
for (std::size_t i = 0; i < Device.GpuIds.size(); ++i)
|
||||
devices[i + 1] = Device.GpuIds[i];
|
||||
devices[0] = "any single GPU";
|
||||
devices.back() = "CPU";
|
||||
return devices;
|
||||
}();
|
||||
std::string user_command;
|
||||
std::string submit_command;
|
||||
} state;
|
||||
|
||||
// 为组件增加标题栏和分割线
|
||||
auto with_title = [](std::string title)
|
||||
{
|
||||
return [title](ftxui::Element element)
|
||||
{
|
||||
return ftxui::vbox
|
||||
(ftxui::text(title) | ftxui::bgcolor(ftxui::Color::Blue), element, ftxui::separatorLight());
|
||||
};
|
||||
};
|
||||
// 为组件增加空白以填充界面
|
||||
auto with_padding = [](ftxui::Element element) -> ftxui::Element
|
||||
{
|
||||
auto empty = ftxui::emptyElement() | ftxui::flex_grow;
|
||||
return ftxui::vbox(empty, ftxui::hbox(empty, element | ftxui::center, empty), empty);
|
||||
};
|
||||
|
||||
// 构建界面
|
||||
auto screen = ftxui::ScreenInteractive::Fullscreen();
|
||||
auto request_interface = ftxui::Container::Vertical
|
||||
({
|
||||
ftxui::Menu(&state.vasp_version_entries, &state.vasp_version_selected)
|
||||
| with_title("Select VASP version:"),
|
||||
ftxui::Menu(&state.device_entries, &state.device_selected)
|
||||
| with_title("Select device:"),
|
||||
ftxui::Container::Horizontal
|
||||
({
|
||||
ftxui::Button("Continue",
|
||||
[&]{ state.user_command = "continue"; screen.ExitLoopClosure()(); }),
|
||||
ftxui::Button("Quit",
|
||||
[&]{ state.user_command = "quit"; screen.ExitLoopClosure()(); })
|
||||
})
|
||||
}) | ftxui::borderHeavy | with_padding;
|
||||
auto confirm_interface = ftxui::Container::Vertical
|
||||
({
|
||||
ftxui::Input(&state.submit_command, "", ftxui::InputOption{.multiline = true})
|
||||
| with_title("Double check & modify submit command:"),
|
||||
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::borderHeavy | with_padding;
|
||||
|
||||
// 实际投递任务
|
||||
auto submit = [](std::string submit_command)
|
||||
{
|
||||
// replace \n with space
|
||||
boost::replace_all(submit_command, "\n", " ");
|
||||
biu::exec<{.DirectStdout = true, .DirectStderr = true, .SearchPath = true}>
|
||||
("sh", { "-c", submit_command });
|
||||
};
|
||||
|
||||
// 进入事件循环
|
||||
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");
|
||||
else if (state.device_selected < 0 || state.device_selected >= state.device_entries.size())
|
||||
throw std::runtime_error("device_selected is out of range");
|
||||
else if (state.device_selected == 0) state.submit_command =
|
||||
"sbatch --ntasks=1\n--gpus=1\n--job-name='{}'\n--output=output.txt\nvasp-nvidia-{}"_f
|
||||
(std::filesystem::current_path().filename().string(), state.vasp_version_entries[state.vasp_version_selected]);
|
||||
else if (state.device_selected == state.device_entries.size() - 1) state.submit_command =
|
||||
"sbatch --ntasks={}\n--cpus-per-task={}\n--hint=nomultithread\n--job-name='{}'\n--output=output.txt"
|
||||
"\nvasp-intel-{}"_f
|
||||
(
|
||||
Device.CpuMpiThreads, Device.CpuOpenmpThreads, std::filesystem::current_path().filename().string(),
|
||||
state.vasp_version_entries[state.vasp_version_selected]
|
||||
);
|
||||
else state.submit_command =
|
||||
"sbatch --ntasks=1\n--gpus={}:1\n--job-name='{}'\n--output=output.txt\nvasp-nvidia-{}"_f
|
||||
(
|
||||
state.device_entries[state.device_selected], std::filesystem::current_path().filename().string(),
|
||||
state.vasp_version_entries[state.vasp_version_selected]
|
||||
);
|
||||
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.submit_command);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
stdenv, cmake, pkg-config,
|
||||
yaml-cpp, eigen, fmt, concurrencpp, highfive, tbb, glad, matplotplusplus, biu, zpp-bits
|
||||
}: stdenv.mkDerivation
|
||||
{
|
||||
name = "ufo";
|
||||
src = ./.;
|
||||
buildInputs = [ yaml-cpp eigen fmt concurrencpp highfive tbb glad matplotplusplus biu zpp-bits ];
|
||||
nativeBuildInputs = [ cmake pkg-config ];
|
||||
}
|
||||
@@ -1,141 +0,0 @@
|
||||
# pragma once
|
||||
# include <iostream>
|
||||
# include <array>
|
||||
# include <numbers>
|
||||
# include <numeric>
|
||||
# include <fstream>
|
||||
# include <optional>
|
||||
# include <array>
|
||||
# include <utility>
|
||||
# include <execution>
|
||||
# include <syncstream>
|
||||
# include <any>
|
||||
# include <map>
|
||||
# include <vector>
|
||||
# include <span>
|
||||
# include <yaml-cpp/yaml.h>
|
||||
# include <Eigen/Dense>
|
||||
# include <concurrencpp/concurrencpp.h>
|
||||
# include <fmt/format.h>
|
||||
# include <fmt/std.h>
|
||||
# include <fmt/ranges.h>
|
||||
# include <highfive/H5File.hpp>
|
||||
# include <zpp_bits.h>
|
||||
# include <matplot/matplot.h>
|
||||
# include <matplot/backend/opengl.h>
|
||||
|
||||
// 在相位中, 约定为使用 $\exp (2 \pi i \vec{q} \cdot \vec{r})$ 来表示原子的运动状态
|
||||
// (而不是 $\exp (-2 \pi i \vec{q} \cdot \vec{r})$)
|
||||
// 一些书定义的倒格矢中包含了 $2 \pi$ 的部分, 我们这里约定不包含这部分.
|
||||
// 也就是说, 正格子与倒格子的转置相乘, 得到单位矩阵.
|
||||
|
||||
namespace Eigen
|
||||
{
|
||||
constexpr inline auto serialize(auto & archive, Eigen::Matrix3d& matrix)
|
||||
{ return archive(std::span(matrix.data(), matrix.size())); }
|
||||
constexpr inline auto serialize(auto & archive, const Eigen::Matrix3d& matrix)
|
||||
{ return archive(std::span(matrix.data(), matrix.size())); }
|
||||
constexpr inline auto serialize(auto & archive, Eigen::Vector3d& vector)
|
||||
{ return archive(std::span(vector.data(), vector.size())); }
|
||||
constexpr inline auto serialize(auto & archive, const Eigen::Vector3d& vector)
|
||||
{ return archive(std::span(vector.data(), vector.size())); }
|
||||
}
|
||||
|
||||
namespace ufo
|
||||
{
|
||||
using namespace std::literals;
|
||||
struct PhonopyComplex { double r, i; };
|
||||
inline HighFive::CompoundType create_compound_complex()
|
||||
{ return {{ "r", HighFive::AtomicType<double>{}}, {"i", HighFive::AtomicType<double>{}}}; }
|
||||
|
||||
namespace detail_
|
||||
{
|
||||
template <typename T> struct SpecializationOfBitsMembersHelper : std::false_type {};
|
||||
template <std::size_t N> struct SpecializationOfBitsMembersHelper<zpp::bits::members<N>> : std::true_type {};
|
||||
}
|
||||
template <typename T> concept ZppSerializable
|
||||
= requires() { detail_::SpecializationOfBitsMembersHelper<T>::value == true; };
|
||||
|
||||
class Solver
|
||||
{
|
||||
public:
|
||||
virtual Solver& operator()() = 0;
|
||||
virtual ~Solver() = default;
|
||||
|
||||
static concurrencpp::generator<std::pair<Eigen::Vector<unsigned, 3>, unsigned>>
|
||||
triplet_sequence(Eigen::Vector<unsigned, 3> range);
|
||||
|
||||
template <ZppSerializable T> inline static void zpp_write(const T& object, std::string filename)
|
||||
{
|
||||
auto [data, out] = zpp::bits::data_out();
|
||||
out(object).or_throw();
|
||||
static_assert(sizeof(char) == sizeof(std::byte));
|
||||
std::ofstream file(filename, std::ios::binary | std::ios::out);
|
||||
file.exceptions(std::ios::badbit | std::ios::failbit);
|
||||
file.write(reinterpret_cast<const char*>(data.data()), data.size());
|
||||
}
|
||||
template <ZppSerializable T> inline static T zpp_read(std::string filename)
|
||||
{
|
||||
auto input = std::ifstream(filename, std::ios::binary | std::ios::in);
|
||||
input.exceptions(std::ios::badbit | std::ios::failbit);
|
||||
static_assert(sizeof(std::byte) == sizeof(char));
|
||||
std::vector<std::byte> data;
|
||||
{
|
||||
std::vector<char> string(std::istreambuf_iterator<char>(input), {});
|
||||
data.assign
|
||||
(
|
||||
reinterpret_cast<std::byte*>(string.data()),
|
||||
reinterpret_cast<std::byte*>(string.data() + string.size())
|
||||
);
|
||||
}
|
||||
auto in = zpp::bits::in(data);
|
||||
T output;
|
||||
in(output).or_throw();
|
||||
return output;
|
||||
}
|
||||
|
||||
class Hdf5file
|
||||
{
|
||||
public:
|
||||
inline Hdf5file& open_for_read(std::string filename)
|
||||
{
|
||||
File_ = HighFive::File(filename, HighFive::File::ReadOnly);
|
||||
return *this;
|
||||
}
|
||||
inline Hdf5file& open_for_write(std::string filename)
|
||||
{
|
||||
File_ = HighFive::File(filename, HighFive::File::ReadWrite | HighFive::File::Create
|
||||
| HighFive::File::Truncate);
|
||||
return *this;
|
||||
}
|
||||
template <typename T> inline Hdf5file& read(T& object, std::string name)
|
||||
{
|
||||
object = File_->getDataSet(name).read<std::remove_cvref_t<decltype(object)>>();
|
||||
return *this;
|
||||
}
|
||||
template <typename T> inline Hdf5file& write(const T& object, std::string name)
|
||||
{
|
||||
File_->createDataSet(name, object);
|
||||
return *this;
|
||||
}
|
||||
protected:
|
||||
std::optional<HighFive::File> File_;
|
||||
};
|
||||
|
||||
struct DataFile
|
||||
{
|
||||
std::string Filename;
|
||||
std::string Format;
|
||||
std::map<std::string, std::any> ExtraParameters;
|
||||
inline DataFile() = default;
|
||||
DataFile
|
||||
(
|
||||
YAML::Node node, std::set<std::string> supported_format,
|
||||
std::string config_file, bool allow_same_as_config_file = false
|
||||
);
|
||||
};
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
HIGHFIVE_REGISTER_TYPE(ufo::PhonopyComplex, ufo::create_compound_complex)
|
||||
@@ -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
|
||||
'';
|
||||
}
|
||||
@@ -14,6 +14,7 @@ inputs:
|
||||
topInputs.impermanence.nixosModules.impermanence
|
||||
topInputs.nix-flatpak.nixosModules.nix-flatpak
|
||||
topInputs.chaotic.nixosModules.default
|
||||
{ config.chaotic.nyx.overlay.onTopOf = "user-pkgs"; }
|
||||
topInputs.catppuccin.nixosModules.catppuccin
|
||||
(inputs:
|
||||
{
|
||||
@@ -29,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;
|
||||
})
|
||||
@@ -38,7 +37,6 @@ inputs:
|
||||
home-manager.sharedModules =
|
||||
[
|
||||
topInputs.plasma-manager.homeManagerModules.plasma-manager
|
||||
topInputs.nix-doom-emacs.hmModule
|
||||
topInputs.catppuccin.homeManagerModules.catppuccin
|
||||
];
|
||||
};
|
||||
|
||||
26
modules/hardware/cpus.nix
Normal file
26
modules/hardware/cpus.nix
Normal file
@@ -0,0 +1,26 @@
|
||||
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);
|
||||
};
|
||||
environment.systemPackages =
|
||||
let packages = with inputs.pkgs; { intel = []; amd = [ zenmonitor ]; };
|
||||
in builtins.concatLists (builtins.map (cpu: packages.${cpu}) cpus);
|
||||
};
|
||||
}
|
||||
@@ -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
|
||||
[
|
||||
@@ -40,33 +39,8 @@ inputs:
|
||||
{
|
||||
hardware.pulseaudio.enable = false;
|
||||
services.pipewire = { enable = true; alsa = { enable = true; support32Bit = true; }; pulse.enable = true; };
|
||||
sound.enable = true;
|
||||
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);
|
||||
};
|
||||
}
|
||||
)
|
||||
];
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ inputs:
|
||||
mode = mkOption { type = types.enum [ "offload" "sync" ]; default = "offload"; };
|
||||
busId = mkOption { type = types.attrsOf types.nonEmptyStr; default = {}; };
|
||||
};
|
||||
driver = mkOption { type = types.enum [ "production" "beta" ]; default = "production"; };
|
||||
driver = mkOption { type = types.enum [ "production" "latest" "beta" ]; default = "production"; };
|
||||
};
|
||||
};
|
||||
config = let inherit (inputs.config.nixos.hardware) gpu; in inputs.lib.mkIf (gpu.type != null) (inputs.lib.mkMerge
|
||||
@@ -34,28 +34,23 @@ inputs:
|
||||
let modules =
|
||||
{
|
||||
intel = [ "i915" ];
|
||||
nvidia = [ "nvidia" "nvidia_drm" "nvidia_modeset" ]; # nvidia-uvm should not be loaded
|
||||
amd = [ "amdgpu" ];
|
||||
nvidia = []; # early loading breaks resume from hibernation
|
||||
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)
|
||||
{
|
||||
@@ -63,21 +58,27 @@ inputs:
|
||||
powerManagement.enable = true;
|
||||
dynamicBoost.enable = inputs.lib.mkIf gpu.nvidia.dynamicBoost true;
|
||||
nvidiaSettings = true;
|
||||
forceFullCompositionPipeline = true;
|
||||
package = inputs.config.boot.kernelPackages.nvidiaPackages.${gpu.nvidia.driver};
|
||||
open = true; # TODO: remove when 560 is stable
|
||||
prime.allowExternalGpu = 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" ];
|
||||
};
|
||||
environment.variables.VDPAU_DRIVER = inputs.lib.mkIf (builtins.elem "intel" gpus) "va_gl";
|
||||
boot.blacklistedKernelModules = [ "nouveau" ];
|
||||
environment.variables =
|
||||
if builtins.elem "nvidia" gpus then { VDPAU_DRIVER = "nvidia"; }
|
||||
else if builtins.elem "intel" gpus then { VDPAU_DRIVER = "va_gl"; }
|
||||
else {};
|
||||
services.xserver.videoDrivers =
|
||||
let driver = { intel = "modesetting"; amd = "amdgpu"; nvidia = "nvidia"; };
|
||||
in builtins.map (gpu: driver.${gpu}) gpus;
|
||||
nixos.packages.packages._packages =
|
||||
let packages = with inputs.pkgs;
|
||||
{
|
||||
intel = [ intel-gpu-tools ];
|
||||
nvidia = [ nvtopPackages.full ];
|
||||
amd = [];
|
||||
};
|
||||
in builtins.concatLists (builtins.map (gpu: packages.${gpu}) gpus);
|
||||
}
|
||||
)
|
||||
# nvidia prime offload
|
||||
@@ -95,5 +96,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; };
|
||||
};}
|
||||
)
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
inputs:
|
||||
{
|
||||
config = inputs.lib.mkIf (builtins.elem "desktop-extra" inputs.config.nixos.packages._packageSets)
|
||||
options.nixos.packages.chromium = let inherit (inputs.lib) mkOption types; in mkOption
|
||||
{
|
||||
type = types.nullOr (types.submodule {});
|
||||
default = if inputs.config.nixos.system.gui.enable then {} else null;
|
||||
};
|
||||
config = let inherit (inputs.config.nixos.packages) chromium; in inputs.lib.mkIf (chromium != null)
|
||||
{
|
||||
programs.chromium = { enable = true; extraOpts.PasswordManagerEnabled = false; };
|
||||
};
|
||||
|
||||
@@ -1,47 +1,21 @@
|
||||
inputs:
|
||||
{
|
||||
imports = inputs.localLib.findModules ./.;
|
||||
options.nixos.packages =
|
||||
let
|
||||
inherit (inputs.lib) mkOption types;
|
||||
packageSets =
|
||||
[
|
||||
# no gui, only used for specific purpose
|
||||
"server"
|
||||
"server-extra"
|
||||
# gui, for daily use, but not install large programs such as matlab
|
||||
"desktop"
|
||||
"desktop-extra"
|
||||
# nearly everything
|
||||
"workstation"
|
||||
];
|
||||
in
|
||||
{
|
||||
packageSet = mkOption
|
||||
{
|
||||
type = types.enum packageSets;
|
||||
default = if inputs.config.nixos.system.gui.enable then "desktop" else "server";
|
||||
};
|
||||
extraPackages = mkOption { type = types.listOf types.unspecified; default = []; };
|
||||
excludePackages = mkOption { type = types.listOf types.unspecified; default = []; };
|
||||
extraPythonPackages = mkOption { type = types.listOf types.unspecified; default = []; };
|
||||
excludePythonPackages = mkOption { type = types.listOf types.unspecified; default = []; };
|
||||
extraPrebuildPackages = mkOption { type = types.listOf types.unspecified; default = []; };
|
||||
excludePrebuildPackages = mkOption { type = types.listOf types.unspecified; default = []; };
|
||||
_packageSets = mkOption
|
||||
{
|
||||
type = types.listOf types.nonEmptyStr;
|
||||
readOnly = true;
|
||||
default = builtins.genList (i: builtins.elemAt packageSets i)
|
||||
((inputs.localLib.findIndex inputs.config.nixos.packages.packageSet packageSets) + 1);
|
||||
};
|
||||
_packages = mkOption { type = types.listOf types.unspecified; default = []; };
|
||||
_pythonPackages = mkOption { type = types.listOf types.unspecified; default = []; };
|
||||
_prebuildPackages = mkOption { type = types.listOf types.unspecified; default = []; };
|
||||
};
|
||||
options.nixos.packages.packages = let inherit (inputs.lib) mkOption types; in
|
||||
{
|
||||
extraPackages = mkOption { type = types.listOf types.unspecified; default = []; };
|
||||
excludePackages = mkOption { type = types.listOf types.unspecified; default = []; };
|
||||
extraPythonPackages = mkOption { type = types.listOf types.unspecified; default = []; };
|
||||
excludePythonPackages = mkOption { type = types.listOf types.unspecified; default = []; };
|
||||
extraPrebuildPackages = mkOption { type = types.listOf types.unspecified; default = []; };
|
||||
excludePrebuildPackages = mkOption { type = types.listOf types.unspecified; default = []; };
|
||||
_packages = mkOption { type = types.listOf types.unspecified; default = []; };
|
||||
_pythonPackages = mkOption { type = types.listOf types.unspecified; default = []; };
|
||||
_prebuildPackages = mkOption { type = types.listOf types.unspecified; default = []; };
|
||||
};
|
||||
config =
|
||||
{
|
||||
environment.systemPackages = let inherit (inputs.lib.lists) subtractLists; in with inputs.config.nixos.packages;
|
||||
environment.systemPackages = with inputs.config.nixos.packages.packages;
|
||||
(inputs.lib.lists.subtractLists excludePackages (_packages ++ extraPackages))
|
||||
++ [
|
||||
(inputs.pkgs.python3.withPackages (pythonPackages:
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
inputs:
|
||||
{
|
||||
config = inputs.lib.mkIf (builtins.elem "desktop-extra" inputs.config.nixos.packages._packageSets)
|
||||
{
|
||||
nixos =
|
||||
{
|
||||
packages = with inputs.pkgs;
|
||||
{
|
||||
_packages =
|
||||
[
|
||||
# system management
|
||||
btrfs-assistant snapper-gui kdePackages.qtstyleplugin-kvantum ventoy-full cpu-x # etcher
|
||||
# password and key management
|
||||
yubikey-manager yubikey-manager-qt yubikey-personalization yubikey-personalization-gui bitwarden
|
||||
# download
|
||||
qbittorrent nur-xddxdd.baidupcs-go wgetpaste
|
||||
# development
|
||||
scrcpy weston cage openbox krita
|
||||
# media
|
||||
spotify yesplaymusic simplescreenrecorder imagemagick gimp netease-cloud-music-gtk vlc obs-studio
|
||||
waifu2x-converter-cpp inkscape blender
|
||||
# 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
|
||||
nix-prefetch-docker
|
||||
# instant messager
|
||||
element-desktop telegram-desktop discord fluffychat zoom-us signal-desktop slack nur-linyinfeng.wemeet
|
||||
# browser
|
||||
google-chrome
|
||||
# office
|
||||
crow-translate zotero pandoc ydict libreoffice-qt texstudio poppler_utils pdftk gnuplot pdfchain hdfview
|
||||
texliveFull
|
||||
# math, physics and chemistry
|
||||
octaveFull root ovito localPackages.vesta localPackages.vaspkit localPackages.v-sim
|
||||
]
|
||||
++ (builtins.filter (p: !((p.meta.broken or false) || (builtins.elem p.pname or null [ "falkon" ])))
|
||||
(builtins.filter inputs.lib.isDerivation (builtins.attrValues kdePackages.kdeGear)));
|
||||
};
|
||||
};
|
||||
programs.kdeconnect.enable = true;
|
||||
};
|
||||
}
|
||||
@@ -1,49 +1,135 @@
|
||||
inputs:
|
||||
{
|
||||
config = inputs.lib.mkIf (builtins.elem "desktop" inputs.config.nixos.packages._packageSets)
|
||||
options.nixos.packages.desktop = let inherit (inputs.lib) mkOption types; in mkOption
|
||||
{
|
||||
type = types.nullOr (types.submodule {});
|
||||
default = if inputs.config.nixos.system.gui.enable then {} else null;
|
||||
};
|
||||
config = let inherit (inputs.config.nixos.packages) desktop; in inputs.lib.mkIf (desktop != null)
|
||||
{
|
||||
nixos =
|
||||
{
|
||||
packages._packages = with inputs.pkgs;
|
||||
[
|
||||
# system management
|
||||
gparted wayland-utils clinfo glxinfo vulkan-tools dracut
|
||||
(
|
||||
writeShellScriptBin "xclip"
|
||||
''
|
||||
#!${bash}/bin/bash
|
||||
if [ "$XDG_SESSION_TYPE" = "x11" ]; then
|
||||
exec ${xclip}/bin/xclip -sel clip "$@"
|
||||
else
|
||||
exec ${wl-clipboard-x11}/bin/xclip "$@"
|
||||
fi
|
||||
''
|
||||
)
|
||||
# color management
|
||||
argyllcms xcalib
|
||||
# networking
|
||||
remmina putty mtr-gui
|
||||
# media
|
||||
mpv nomacs
|
||||
# themes
|
||||
tela-circle-icon-theme 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"; })
|
||||
# terminal
|
||||
warp-terminal
|
||||
# development
|
||||
adb-sync
|
||||
# desktop sharing
|
||||
rustdesk-flutter
|
||||
];
|
||||
packages.packages =
|
||||
{
|
||||
_packages = with inputs.pkgs;
|
||||
[
|
||||
# system management
|
||||
# TODO: module should add yubikey-touch-detector into path
|
||||
gparted wayland-utils clinfo glxinfo vulkan-tools dracut yubikey-touch-detector btrfs-assistant snapper-gui
|
||||
kdePackages.qtstyleplugin-kvantum ventoy-full cpu-x inputs.pkgs."pkgs-23.11".etcher wl-mirror
|
||||
(
|
||||
writeShellScriptBin "xclip"
|
||||
''
|
||||
#!${bash}/bin/bash
|
||||
if [ "$XDG_SESSION_TYPE" = "x11" ]; then
|
||||
exec ${xclip}/bin/xclip -sel clip "$@"
|
||||
else
|
||||
exec ${wl-clipboard-x11}/bin/xclip "$@"
|
||||
fi
|
||||
''
|
||||
)
|
||||
# color management
|
||||
argyllcms xcalib
|
||||
# networking
|
||||
remmina putty mtr-gui
|
||||
# media
|
||||
mpv nomacs spotify yesplaymusic simplescreenrecorder imagemagick gimp netease-cloud-music-gtk vlc obs-studio
|
||||
waifu2x-converter-cpp inkscape blender whalebird paraview
|
||||
# themes
|
||||
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
|
||||
adb-sync scrcpy weston cage openbox krita jetbrains.clion android-studio dbeaver-bin cling fprettify
|
||||
aircrack-ng
|
||||
# desktop sharing
|
||||
rustdesk-flutter
|
||||
# password and key management
|
||||
yubikey-manager yubikey-manager-qt yubikey-personalization yubikey-personalization-gui bitwarden electrum
|
||||
jabref
|
||||
john crunch hashcat
|
||||
# download
|
||||
qbittorrent nur-xddxdd.baidupcs-go wgetpaste onedrive onedrivegui rclone
|
||||
# editor
|
||||
typora appflowy notion-app-enhanced joplin-desktop standardnotes logseq
|
||||
# news
|
||||
fluent-reader rssguard newsflash newsboat
|
||||
# nix tools
|
||||
nixpkgs-fmt appimage-run nixd nix-serve node2nix nix-prefetch-github prefetch-npm-deps nix-prefetch-docker
|
||||
nix-template nil pnpm-lock-export bundix
|
||||
# instant messager
|
||||
element-desktop telegram-desktop discord fluffychat zoom-us signal-desktop slack nur-linyinfeng.wemeet
|
||||
cinny-desktop nheko # qq nur-xddxdd.wechat-uos
|
||||
# browser
|
||||
google-chrome tor-browser microsoft-edge
|
||||
# office
|
||||
crow-translate zotero pandoc ydict libreoffice-qt texstudio poppler_utils pdftk gnuplot pdfchain hdfview
|
||||
davinci-resolve
|
||||
texliveFull
|
||||
# math, physics and chemistry
|
||||
octaveFull root ovito localPackages.vesta localPackages.vaspkit localPackages.v-sim
|
||||
(mathematica.overrideAttrs (prev: { postInstall = prev.postInstall or "" + "ln -s ${src} $out/src"; }))
|
||||
(quantum-espresso.override { stdenv = gcc14Stdenv; gfortran = gfortran14; }) jmol mpi
|
||||
# virtualization
|
||||
# TODO: broken on python 3.12: playonlinux
|
||||
wineWowPackages.stagingFull virt-viewer bottles genymotion
|
||||
# media
|
||||
nur-xddxdd.svp
|
||||
# for kdenlive auto subtitle
|
||||
openai-whisper
|
||||
]
|
||||
++ (builtins.filter (p: !((p.meta.broken or false) || (builtins.elem p.pname or null [ "falkon" "kalzium" ])))
|
||||
(builtins.filter inputs.lib.isDerivation (builtins.attrValues kdePackages.kdeGear)));
|
||||
# TODO: fix it
|
||||
# ++ inputs.lib.optional (inputs.config.nixos.system.nixpkgs.march != null) localPackages.mumax;
|
||||
_pythonPackages = [(pythonPackages: with pythonPackages;
|
||||
[
|
||||
phonopy scipy scikit-learn jupyterlab autograd # localPackages.pix2tex
|
||||
# TODO: broken on python 3.12: tensorflow keras
|
||||
])];
|
||||
};
|
||||
user.sharedModules =
|
||||
[{
|
||||
config.programs =
|
||||
{
|
||||
plasma =
|
||||
{
|
||||
enable = true;
|
||||
configFile =
|
||||
{
|
||||
plasma-localerc = { Formats.LANG.value = "en_US.UTF-8"; Translations.LANGUAGE.value = "zh_CN"; };
|
||||
baloofilerc."Basic Settings".Indexing-Enabled.value = false;
|
||||
};
|
||||
powerdevil =
|
||||
let config =
|
||||
{
|
||||
autoSuspend.action = "nothing";
|
||||
dimDisplay.enable = false;
|
||||
powerButtonAction = "turnOffScreen";
|
||||
turnOffDisplay.idleTimeout = "never";
|
||||
whenLaptopLidClosed = "turnOffScreen";
|
||||
};
|
||||
in { AC = config; battery = config; lowBattery = config; };
|
||||
};
|
||||
obs-studio =
|
||||
{
|
||||
enable = true;
|
||||
plugins = with inputs.pkgs.obs-studio-plugins; [ wlrobs obs-vaapi obs-nvfbc droidcam-obs obs-vkcapture ];
|
||||
};
|
||||
};
|
||||
}];
|
||||
};
|
||||
programs =
|
||||
{
|
||||
adb.enable = true;
|
||||
wireshark = { enable = true; package = inputs.pkgs.wireshark; };
|
||||
yubikey-touch-detector.enable = true;
|
||||
kdeconnect.enable = true;
|
||||
anime-game-launcher = { enable = true; package = inputs.pkgs.anime-game-launcher; };
|
||||
honkers-railway-launcher = { enable = true; package = inputs.pkgs.honkers-railway-launcher; };
|
||||
sleepy-launcher = { enable = true; package = inputs.pkgs.sleepy-launcher; };
|
||||
};
|
||||
nixpkgs.overlays = [(final: prev:
|
||||
{
|
||||
@@ -51,20 +137,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;
|
||||
};
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
inputs:
|
||||
{
|
||||
config = inputs.lib.mkIf (builtins.elem "desktop" inputs.config.nixos.packages._packageSets)
|
||||
options.nixos.packages.firefox = let inherit (inputs.lib) mkOption types; in mkOption
|
||||
{
|
||||
type = types.nullOr (types.submodule {});
|
||||
default = if inputs.config.nixos.system.gui.enable then {} else null;
|
||||
};
|
||||
config = let inherit (inputs.config.nixos.packages) firefox; in inputs.lib.mkIf (firefox != null)
|
||||
{
|
||||
# still enable global firefox, to install language packs
|
||||
programs.firefox =
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
inputs:
|
||||
{
|
||||
config = inputs.lib.mkIf (builtins.elem "desktop-extra" inputs.config.nixos.packages._packageSets)
|
||||
options.nixos.packages.flatpak = let inherit (inputs.lib) mkOption types; in mkOption
|
||||
{
|
||||
services.flatpak =
|
||||
{
|
||||
enable = true;
|
||||
uninstallUnmanaged = true;
|
||||
};
|
||||
type = types.nullOr (types.submodule {});
|
||||
default = if inputs.config.nixos.system.gui.enable then {} else null;
|
||||
};
|
||||
config = let inherit (inputs.config.nixos.packages) flatpak; in inputs.lib.mkIf (flatpak != null)
|
||||
{
|
||||
services.flatpak = { enable = true; uninstallUnmanaged = true; };
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
inputs:
|
||||
{
|
||||
config = inputs.lib.mkIf (builtins.elem "server" inputs.config.nixos.packages._packageSets)
|
||||
options.nixos.packages.git = let inherit (inputs.lib) mkOption types; in mkOption
|
||||
{ type = types.nullOr (types.submodule {}); default = {}; };
|
||||
config = let inherit (inputs.config.nixos.packages) git; in inputs.lib.mkIf (git != null)
|
||||
{
|
||||
programs.git =
|
||||
{
|
||||
@@ -11,7 +13,10 @@ inputs:
|
||||
{
|
||||
init.defaultBranch = "main";
|
||||
core.quotepath = false;
|
||||
lfs.ssh.automultiplex = false; # 避免 lfs 一直要求触摸 yubikey
|
||||
receive.denyCurrentBranch = "warn"; # 允许 push 到非 bare 的仓库
|
||||
};
|
||||
};
|
||||
nixos.packages.packages._packages = [ inputs.pkgs.localPackages.git-lfs-transfer ]; # make pure ssh lfs work
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
inputs:
|
||||
{
|
||||
config = inputs.lib.mkIf (builtins.elem "server" inputs.config.nixos.packages._packageSets)
|
||||
options.nixos.packages.gpg = let inherit (inputs.lib) mkOption types; in mkOption
|
||||
{ type = types.nullOr (types.submodule {}); default = {}; };
|
||||
config = let inherit (inputs.config.nixos.packages) gpg; in inputs.lib.mkIf (gpg != null)
|
||||
{
|
||||
programs.gnupg.agent.enable = true;
|
||||
};
|
||||
|
||||
@@ -1,18 +0,0 @@
|
||||
inputs:
|
||||
{
|
||||
config = inputs.lib.mkIf (builtins.elem "desktop" inputs.config.nixos.packages._packageSets)
|
||||
{
|
||||
nixos.user.sharedModules =
|
||||
[{
|
||||
config.programs.plasma =
|
||||
{
|
||||
enable = true;
|
||||
configFile =
|
||||
{
|
||||
plasma-localerc = { Formats.LANG.value = "en_US.UTF-8"; Translations.LANGUAGE.value = "zh_CN"; };
|
||||
baloofilerc."Basic Settings".Indexing-Enabled.value = false;
|
||||
};
|
||||
};
|
||||
}];
|
||||
};
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
inputs:
|
||||
{
|
||||
config = inputs.lib.mkIf (builtins.elem "server-extra" inputs.config.nixos.packages._packageSets)
|
||||
{
|
||||
nixos =
|
||||
{
|
||||
packages = with inputs.pkgs;
|
||||
{
|
||||
_packages =
|
||||
[
|
||||
# shell
|
||||
ksh
|
||||
# basic tools
|
||||
neofetch
|
||||
# office
|
||||
todo-txt-cli pdfgrep ffmpeg-full
|
||||
# development
|
||||
hexo-cli gh nix-init
|
||||
]
|
||||
++ (with inputs.config.boot.kernelPackages; [ cpupower usbip ])
|
||||
++ (inputs.lib.optional (inputs.config.nixos.system.nixpkgs.arch == "x86_64") rar);
|
||||
_pythonPackages = [(pythonPackages: with pythonPackages;
|
||||
[
|
||||
openai python-telegram-bot fastapi pypdf2 pandas matplotlib plotly gunicorn redis jinja2
|
||||
certifi charset-normalizer idna orjson psycopg2 inquirerpy requests tqdm pydbus
|
||||
])];
|
||||
};
|
||||
};
|
||||
programs =
|
||||
{
|
||||
yazi.enable = true;
|
||||
mosh.enable = true;
|
||||
};
|
||||
services.fwupd.enable = true;
|
||||
};
|
||||
}
|
||||
@@ -1,41 +1,53 @@
|
||||
inputs:
|
||||
{
|
||||
config = inputs.lib.mkIf (builtins.elem "server" inputs.config.nixos.packages._packageSets)
|
||||
options.nixos.packages.server = let inherit (inputs.lib) mkOption types; in mkOption
|
||||
{ type = types.nullOr (types.submodule {}); default = {}; };
|
||||
config = let inherit (inputs.config.nixos.packages) server; in inputs.lib.mkIf (server != null)
|
||||
{
|
||||
nixos.packages._packages = with inputs.pkgs;
|
||||
[
|
||||
# basic tools
|
||||
beep dos2unix gnugrep pv tmux screen parallel tldr cowsay jq zellij ipfetch localPackages.pslist
|
||||
fastfetch reptyr nushellFull duc
|
||||
# lsxx
|
||||
pciutils usbutils lshw util-linux lsof dmidecode lm_sensors
|
||||
# top
|
||||
iotop iftop htop btop powertop s-tui
|
||||
# editor
|
||||
nano bat
|
||||
# downloader
|
||||
wget aria2 curl yt-dlp
|
||||
# file manager
|
||||
tree eza trash-cli lsd broot file xdg-ninja mlocate
|
||||
# compress
|
||||
pigz upx unzip zip lzip p7zip
|
||||
# file system management
|
||||
sshfs e2fsprogs duperemove compsize exfatprogs
|
||||
# disk management
|
||||
smartmontools hdparm
|
||||
# encryption and authentication
|
||||
apacheHttpd openssl ssh-to-age gnupg age sops pam_u2f yubico-piv-tool
|
||||
# networking
|
||||
ipset iptables iproute2 dig nettools traceroute tcping-go whois tcpdump nmap inetutils wireguard-tools
|
||||
# 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
|
||||
# stupid things
|
||||
toilet lolcat
|
||||
]
|
||||
++ (with inputs.config.boot.kernelPackages; [ cpupower usbip ])
|
||||
++ (inputs.lib.optional (inputs.config.nixos.system.nixpkgs.arch == "x86_64") rar);
|
||||
nixos.packages.packages =
|
||||
{
|
||||
_packages = with inputs.pkgs;
|
||||
[
|
||||
# basic tools
|
||||
beep dos2unix gnugrep pv tmux screen parallel tldr cowsay jq zellij ipfetch localPackages.pslist
|
||||
fastfetch reptyr nushell duc ncdu progress libva-utils ksh neofetch
|
||||
# lsxx
|
||||
pciutils usbutils lshw util-linux lsof dmidecode lm_sensors
|
||||
# top
|
||||
iotop iftop htop btop powertop s-tui
|
||||
# editor
|
||||
nano bat
|
||||
# downloader
|
||||
wget aria2 curl yt-dlp ffsend
|
||||
# file manager
|
||||
tree eza trash-cli lsd broot file xdg-ninja mlocate
|
||||
# compress
|
||||
pigz upx unzip zip lzip p7zip
|
||||
# file system management
|
||||
sshfs e2fsprogs duperemove compsize exfatprogs
|
||||
# disk management
|
||||
smartmontools hdparm
|
||||
# encryption and authentication
|
||||
apacheHttpd openssl ssh-to-age gnupg age sops pam_u2f yubico-piv-tool
|
||||
# networking
|
||||
ipset iptables iproute2 dig nettools traceroute tcping-go whois tcpdump nmap inetutils wireguard-tools
|
||||
# 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 rr hexo-cli gh nix-init hugo
|
||||
# stupid things
|
||||
toilet lolcat
|
||||
# office
|
||||
todo-txt-cli pdfgrep ffmpeg-full
|
||||
]
|
||||
++ (with inputs.config.boot.kernelPackages; [ cpupower usbip ])
|
||||
++ (inputs.lib.optional (inputs.config.nixos.system.nixpkgs.arch == "x86_64") rar);
|
||||
_pythonPackages = [(pythonPackages: with pythonPackages;
|
||||
[
|
||||
openai python-telegram-bot fastapi pypdf2 pandas matplotlib plotly gunicorn redis jinja2
|
||||
certifi charset-normalizer idna orjson psycopg2 inquirerpy requests tqdm pydbus
|
||||
])];
|
||||
};
|
||||
programs =
|
||||
{
|
||||
nix-index-database.comma.enable = true;
|
||||
@@ -43,8 +55,14 @@ inputs:
|
||||
command-not-found.enable = false;
|
||||
autojump.enable = true;
|
||||
direnv = { enable = true; nix-direnv.enable = true; };
|
||||
mosh.enable = true;
|
||||
yazi.enable = true;
|
||||
};
|
||||
services =
|
||||
{
|
||||
udev.packages = with inputs.pkgs; [ yubikey-personalization libfido2 ];
|
||||
fwupd.enable = true;
|
||||
};
|
||||
services.udev.packages = with inputs.pkgs; [ yubikey-personalization libfido2 ];
|
||||
home-manager = { useGlobalPkgs = true; useUserPackages = true; };
|
||||
};
|
||||
}
|
||||
|
||||
150
modules/packages/ssh.nix
Normal file
150
modules/packages/ssh.nix
Normal file
@@ -0,0 +1,150 @@
|
||||
inputs:
|
||||
{
|
||||
options.nixos.packages.ssh = let inherit (inputs.lib) mkOption types; in mkOption
|
||||
{ type = types.nullOr (types.submodule {}); default = {}; };
|
||||
config = let inherit (inputs.config.nixos.packages) ssh; in inputs.lib.mkIf (ssh != null)
|
||||
{
|
||||
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";
|
||||
hostnames = [ "vps6.chn.moe" "wireguard.vps6.chn.moe" "74.211.99.69" "192.168.83.1" ];
|
||||
};
|
||||
"initrd.vps6" =
|
||||
{
|
||||
ed25519 = "AAAAC3NzaC1lZDI1NTE5AAAAIB4DKB/zzUYco5ap6k9+UxeO04LL12eGvkmQstnYxgnS";
|
||||
hostnames = [ "initrd.vps6.chn.moe" "74.211.99.69" ];
|
||||
};
|
||||
vps7 =
|
||||
{
|
||||
ed25519 = "AAAAC3NzaC1lZDI1NTE5AAAAIF5XkdilejDAlg5hZZD0oq69k8fQpe9hIJylTo/aLRgY";
|
||||
hostnames = [ "vps7.chn.moe" "wireguard.vps7.chn.moe" "ssh.git.chn.moe" "95.111.228.40" "192.168.83.2" ];
|
||||
};
|
||||
"initrd.vps7" =
|
||||
{
|
||||
ed25519 = "AAAAC3NzaC1lZDI1NTE5AAAAIGZyQpdQmEZw3nLERFmk2tS1gpSvXwW0Eish9UfhrRxC";
|
||||
hostnames = [ "initrd.vps7.chn.moe" "95.111.228.40" ];
|
||||
};
|
||||
nas =
|
||||
{
|
||||
ed25519 = "AAAAC3NzaC1lZDI1NTE5AAAAIIktNbEcDMKlibXg54u7QOLt0755qB/P4vfjwca8xY6V";
|
||||
hostnames = [ "wireguard.nas.chn.moe" "192.168.1.2" "192.168.83.4" ];
|
||||
};
|
||||
"initrd.nas" =
|
||||
{
|
||||
ed25519 = "AAAAC3NzaC1lZDI1NTE5AAAAIAoMu0HEaFQsnlJL0L6isnkNZdRq0OiDXyaX3+fl3NjT";
|
||||
hostnames = [ "initrd.nas.chn.moe" "192.168.1.2" ];
|
||||
};
|
||||
surface =
|
||||
{
|
||||
ed25519 = "AAAAC3NzaC1lZDI1NTE5AAAAIFdm3DcfHdcLP0oSpVrWwIZ/b9lZuakBSPwCFz2BdTJ7";
|
||||
hostnames = [ "192.168.1.4" "wireguard.surface.chn.moe" "192.168.83.5" ];
|
||||
};
|
||||
pc =
|
||||
{
|
||||
ed25519 = "AAAAC3NzaC1lZDI1NTE5AAAAIMSfREi19OSwQnhdsE8wiNwGSFFJwNGN0M5gN+sdrrLJ";
|
||||
hostnames = [ "wireguard.pc.chn.moe" "[office.chn.moe]:3673" "192.168.1.105" "192.168.83.3" ];
|
||||
};
|
||||
hpc =
|
||||
{
|
||||
ed25519 = "AAAAC3NzaC1lZDI1NTE5AAAAIDVpsQW3kZt5alHC6mZhay3ZEe2fRGziG4YJWCv2nn/O";
|
||||
hostnames = [ "hpc.xmu.edu.cn" ];
|
||||
};
|
||||
github =
|
||||
{
|
||||
ed25519 = "AAAAC3NzaC1lZDI1NTE5AAAAIOMqqnkVzrm0SdG6UOoqKLsabgH5C9okWi0dh2l9GKJl";
|
||||
hostnames = [ "github.com" ];
|
||||
};
|
||||
xmupc1 =
|
||||
{
|
||||
ed25519 = "AAAAC3NzaC1lZDI1NTE5AAAAINTvfywkKRwMrVp73HfHTfjhac2Tn9qX/lRjLr09ycHp";
|
||||
hostnames = [ "[office.chn.moe]:6007" "[xmupc1.chn.moe]:6007" "wireguard.xmupc1.chn.moe" "192.168.83.6" ];
|
||||
};
|
||||
xmupc2 =
|
||||
{
|
||||
ed25519 = "AAAAC3NzaC1lZDI1NTE5AAAAIJZ/+divGnDr0x+UlknA84Tfu6TPD+zBGmxWZY4Z38P6";
|
||||
hostnames = [ "[xmupc2.chn.moe]:6394" "wireguard.xmupc2.chn.moe" "192.168.83.7" ];
|
||||
};
|
||||
};
|
||||
in builtins.listToAttrs (builtins.map
|
||||
(server:
|
||||
{
|
||||
inherit (server) name;
|
||||
value =
|
||||
{
|
||||
publicKey = "ssh-ed25519 ${server.value.ed25519}";
|
||||
hostNames = server.value.hostnames;
|
||||
};
|
||||
})
|
||||
(inputs.localLib.attrsToList servers));
|
||||
programs.ssh =
|
||||
{
|
||||
startAgent = true;
|
||||
enableAskPassword = true;
|
||||
askPassword = "${inputs.pkgs.systemd}/bin/systemd-ask-password";
|
||||
extraConfig = "AddKeysToAgent yes";
|
||||
};
|
||||
environment.sessionVariables.SSH_ASKPASS_REQUIRE = "prefer";
|
||||
nixos.user.sharedModules =
|
||||
[(hmInputs: {
|
||||
config.programs.ssh =
|
||||
{
|
||||
enable = true;
|
||||
controlMaster = "auto";
|
||||
controlPersist = "1m";
|
||||
compression = true;
|
||||
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; }; })
|
||||
[ "wireguard.pc" "wireguard.surface" "wireguard.xmupc1" "wireguard.xmupc2" ])
|
||||
++ (builtins.map
|
||||
(host:
|
||||
{
|
||||
name = host;
|
||||
value =
|
||||
{
|
||||
host = host;
|
||||
hostname = "hpc.xmu.edu.cn";
|
||||
user = host;
|
||||
setEnv.TERM = "chn_unset_ls_colors:xterm-256color";
|
||||
};
|
||||
})
|
||||
[ "wlin" "hwang" ])
|
||||
)
|
||||
// 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 =
|
||||
{
|
||||
host = "jykang";
|
||||
hostname = "hpc.xmu.edu.cn";
|
||||
user = "jykang";
|
||||
forwardAgent = true;
|
||||
extraOptions.AddKeysToAgent = "yes";
|
||||
};
|
||||
"wireguard.jykang" = jykang // { host = "internal.jykang"; proxyJump = "wireguard.xmupc1"; };
|
||||
};
|
||||
};
|
||||
})];
|
||||
};
|
||||
}
|
||||
@@ -1,166 +0,0 @@
|
||||
inputs:
|
||||
{
|
||||
config = inputs.lib.mkIf (builtins.elem "server" inputs.config.nixos.packages._packageSets)
|
||||
{
|
||||
services.openssh.knownHosts =
|
||||
let
|
||||
servers =
|
||||
{
|
||||
vps6 =
|
||||
{
|
||||
ed25519 = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIO5ZcvyRyOnUCuRtqrM/Qf+AdUe3a5bhbnfyhw2FSLDZ";
|
||||
hostnames = [ "vps6.chn.moe" "wireguard.vps6.chn.moe" "74.211.99.69" "192.168.83.1" ];
|
||||
};
|
||||
"initrd.vps6" =
|
||||
{
|
||||
ed25519 = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIB4DKB/zzUYco5ap6k9+UxeO04LL12eGvkmQstnYxgnS";
|
||||
hostnames = [ "initrd.vps6.chn.moe" "74.211.99.69" ];
|
||||
};
|
||||
vps7 =
|
||||
{
|
||||
ed25519 = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIF5XkdilejDAlg5hZZD0oq69k8fQpe9hIJylTo/aLRgY";
|
||||
hostnames = [ "vps7.chn.moe" "wireguard.vps7.chn.moe" "ssh.git.chn.moe" "95.111.228.40" "192.168.83.2" ];
|
||||
};
|
||||
"initrd.vps7" =
|
||||
{
|
||||
ed25519 = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGZyQpdQmEZw3nLERFmk2tS1gpSvXwW0Eish9UfhrRxC";
|
||||
hostnames = [ "initrd.vps7.chn.moe" "95.111.228.40" ];
|
||||
};
|
||||
nas =
|
||||
{
|
||||
ed25519 = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIktNbEcDMKlibXg54u7QOLt0755qB/P4vfjwca8xY6V";
|
||||
hostnames = [ "wireguard.nas.chn.moe" "[office.chn.moe]:5440" "192.168.1.185" "192.168.83.4" ];
|
||||
};
|
||||
"initrd.nas" =
|
||||
{
|
||||
ed25519 = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIAoMu0HEaFQsnlJL0L6isnkNZdRq0OiDXyaX3+fl3NjT";
|
||||
hostnames = [ "initrd.nas.chn.moe" "[office.chn.moe]:5440" "192.168.1.185" ];
|
||||
};
|
||||
surface =
|
||||
{
|
||||
ed25519 = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFdm3DcfHdcLP0oSpVrWwIZ/b9lZuakBSPwCFz2BdTJ7";
|
||||
hostnames = [ "192.168.1.166" "wireguard.surface.chn.moe" "192.168.83.5" ];
|
||||
};
|
||||
pc =
|
||||
{
|
||||
ed25519 = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMSfREi19OSwQnhdsE8wiNwGSFFJwNGN0M5gN+sdrrLJ";
|
||||
hostnames = [ "wireguard.pc.chn.moe" "[office.chn.moe]:3673" "192.168.1.105" "192.168.83.3" ];
|
||||
};
|
||||
hpc =
|
||||
{
|
||||
ed25519 = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDVpsQW3kZt5alHC6mZhay3ZEe2fRGziG4YJWCv2nn/O";
|
||||
hostnames = [ "hpc.xmu.edu.cn" ];
|
||||
};
|
||||
github =
|
||||
{
|
||||
ed25519 = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOMqqnkVzrm0SdG6UOoqKLsabgH5C9okWi0dh2l9GKJl";
|
||||
hostnames = [ "github.com" ];
|
||||
};
|
||||
xmupc1 =
|
||||
{
|
||||
ed25519 = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINTvfywkKRwMrVp73HfHTfjhac2Tn9qX/lRjLr09ycHp";
|
||||
hostnames = [ "[office.chn.moe]:6007" "[xmupc1.chn.moe]:6007" "wireguard.xmupc1.chn.moe" "192.168.83.6" ];
|
||||
};
|
||||
xmupc2 =
|
||||
{
|
||||
ed25519 = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJZ/+divGnDr0x+UlknA84Tfu6TPD+zBGmxWZY4Z38P6";
|
||||
hostnames = [ "[xmupc2.chn.moe]:6394" "wireguard.xmupc2.chn.moe" "192.168.83.7" ];
|
||||
};
|
||||
};
|
||||
in builtins.listToAttrs (builtins.concatLists (builtins.map
|
||||
(server:
|
||||
(
|
||||
if builtins.pathExists ./ssh/${server.name}_rsa.pub then
|
||||
[{
|
||||
name = "${server.name}-rsa";
|
||||
value =
|
||||
{
|
||||
publicKey = builtins.readFile ./ssh/${server.name}_rsa.pub;
|
||||
hostNames = server.value.hostnames;
|
||||
};
|
||||
}]
|
||||
else []
|
||||
)
|
||||
++ (
|
||||
if builtins.pathExists ./ssh/${server.name}_ecdsa.pub then
|
||||
[{
|
||||
name = "${server.name}-ecdsa";
|
||||
value =
|
||||
{
|
||||
publicKey = builtins.readFile ./ssh/${server.name}_ecdsa.pub;
|
||||
hostNames = server.value.hostnames;
|
||||
};
|
||||
}]
|
||||
else []
|
||||
)
|
||||
++ (
|
||||
if server.value ? ed25519 then
|
||||
[{
|
||||
name = "${server.name}-ed25519";
|
||||
value =
|
||||
{
|
||||
publicKey = server.value.ed25519;
|
||||
hostNames = server.value.hostnames;
|
||||
};
|
||||
}]
|
||||
else []
|
||||
))
|
||||
(inputs.localLib.attrsToList servers)));
|
||||
programs.ssh =
|
||||
{
|
||||
startAgent = true;
|
||||
enableAskPassword = true;
|
||||
askPassword = "${inputs.pkgs.systemd}/bin/systemd-ask-password";
|
||||
extraConfig = "AddKeysToAgent yes";
|
||||
};
|
||||
environment.sessionVariables.SSH_ASKPASS_REQUIRE = "prefer";
|
||||
nixos.user.sharedModules =
|
||||
[(hmInputs: {
|
||||
config.programs.ssh =
|
||||
{
|
||||
enable = true;
|
||||
controlMaster = "auto";
|
||||
controlPersist = "1m";
|
||||
compression = true;
|
||||
matchBlocks = builtins.listToAttrs
|
||||
(
|
||||
(builtins.map
|
||||
(host: { name = host; value = { inherit host; hostname = "${host}.chn.moe"; }; })
|
||||
[
|
||||
"vps6" "wireguard.vps6" "vps7" "wireguard.vps7" "wireguard.pc" "wireguard.nas" "wireguard.surface"
|
||||
"wireguard.xmupc1" "wireguard.xmupc2"
|
||||
])
|
||||
++ (builtins.map
|
||||
(host:
|
||||
{
|
||||
name = host;
|
||||
value =
|
||||
{
|
||||
host = host;
|
||||
hostname = "hpc.xmu.edu.cn";
|
||||
user = host;
|
||||
setEnv.TERM = "chn_unset_ls_colors:xterm-256color";
|
||||
};
|
||||
})
|
||||
[ "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"; };
|
||||
gitea = { host = "gitea"; hostname = "ssh.git.chn.moe"; };
|
||||
jykang =
|
||||
{
|
||||
host = "jykang";
|
||||
hostname = "hpc.xmu.edu.cn";
|
||||
user = "jykang";
|
||||
forwardAgent = true;
|
||||
extraOptions.AddKeysToAgent = "yes";
|
||||
};
|
||||
};
|
||||
};
|
||||
})];
|
||||
};
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEmKSENjQEezOmxkZMy7opKgwFB9nkt5YRrYMjNuG5N87uRgg6CLrbo5wAdT/y6v0mKV0U2w0WZ2YB/++Tpockg=
|
||||
@@ -1 +0,0 @@
|
||||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCj7ndNxQowgcQnjshcLrqPEiiphnt+VTTvDP6mHBL9j1aNUkY4Ue1gvwnGLVlOhGeYrnZaMgRK6+PKCUXaDbC7qtbW8gIkhL7aGCsOr/C56SJMy/BCZfxd1nWzAOxSDPgVsmerOBYfNqltV9/hWCqBywINIR+5dIg6JTJ72pcEpEjcYgXkE2YEFXV1JHnsKgbLWNlhScqb2UmyRkQyytRLtL+38TGxkxCflmO+5Z8CSSNY7GidjMIZ7Q4zMjA2n1nGrlTDkzwDCsw+wqFPGQA179cnfGWOWRVruj16z6XyvxvjJwbz0wQZ75XK5tKSb7FNyeIEs4TT4jk+S4dhPeAUC5y+bDYirYgM4GC7uEnztnZyaVWQ7B381AK4Qdrwt51ZqExKbQpTUNn+EjqoTwvqNj4kqx5QUCI0ThS/YkOxJCXmPUWZbhjpCg56i+2aB6CmK2JGhn57K5mj0MNdBXA4/WnwH6XoPWJzK5Nyu2zB3nAZp+S5hpQs+p1vN1/wsjk=
|
||||
@@ -1 +0,0 @@
|
||||
ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBDkkl7A9kWWBoi4b5g6Vus70ja1KhPfcZZjeU1/QbYdN8PRRw/hsGklrhefslKRbym/TMFS0ko0g5WUi9G5vbGw=
|
||||
@@ -1 +0,0 @@
|
||||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDgs8MvV2nczjGMZ548tuAhgvCEd4uHu0VhLDSwQG7Nh/UR4Pgc5T9Nf7Vfwg96Lah/pwD5my4RaWis6bLMmlkYyDBKFBOsGYQUe5J5XfZdxk8pz+7L0Hq6gPfAZAdNlUiuFVKsvkE+NF42NgJyXSYQicPbu5LQiFwZGXlW20+LO8uBQ1y1xabKVpg8XGwordduL99VepwEzeLK/st+UVfW+mKgxkf9TuxvD2fuYIDZM7y2rXqcjf4/6OXA5kACsYK1MgZSFxgO/m6+1uCC1qBDseMTA3D+Tsjf9VtcqUE9dMd/dJ/uuILHJ0+oIqkykTCecPLgJY3Vh8rAtln/lbId
|
||||
@@ -1 +0,0 @@
|
||||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC0+xafJMnOGCHv6OLljaq8iJ3ZBaIezv7AJ9rVWJXFg/QJRYBwct35c4zaVom7If8F+Ss+BTLMp33HZ8gLpoat6LkjARjy65Ycog3NOnEposX2JjZEYXDbovxEmcJkDXAIVmnaBUi3r22z4UI8OqsHPeRXj017O0yQrQQYEAw/IO/tSNQZt2k8JHxAX50UTqGFdgkriO1fYHBocq48m0nn3sXrMuM3yBe5zy3NngOHxMn7UxjECmAElsuu/nu1x083pRnv5NSa+JxDGJ+S6Zhj3nGGNwZesa51I4cJjsYLxgmO/NxL1J86bDp6HhK9C9799ruG60pGTw6HcvbKTgx7klUgn4936wsy7qukWqp53MvqrLSJkRb/HHU9zZqvzcjbwet+Iv1OAAok5QC88j7Jgenk3nbZw4BNFd2r/8rOZuXheDnMKOa61dXxnvoAO3Euk0RPdZqW1slT/DDyD/kB6TPY7yOywNURNnrwzfSsmravKi6bGA5t2Ehhpf2LETM=
|
||||
@@ -1 +0,0 @@
|
||||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDOyU7VvusseL2tDp7JkIXKGxRGQNHpYWVAPraUj17Xls7Z9e7HO6+GBiGP+bB9tZbzsoTNGHdXg8VaJmf98QAhhg0FcUb6IvWmfmPWzQ0MC8L+USqdDpaH7s9SOZF/yveNYCR5GOMmFdSW4OPVYIOrjPltDIe5S1SN2nOXvjxbLmuoMjg+5U4F0ii0ZaCRuMVDskeift+Amxe7iRnSzeDbECd0rJhaUb8gf3shz0Hp9lRUMej7cJH8LLP3m0s3Vk+kasKntz18MpJ6/3n+fR2aK75qkcq9FZaFA4tSIabh9eKoxlRCy7g8Qj6nNStW+ys/a1UYBFgAoTyE7e47o3dpcxR5oMLbeDwhOstWL0YOjEH1K5Wyj3eEOT71C6kuQBPcCJQ9q9hknRpW0mWe9Q6qaAzTgE9LLssijr/yTfYQk7zKEyo0i4f6buOfmyYZfnzfnCB3LiJKa98TVEEzrKYHIO44LwIkNf/YHOMDknzjYpav6HfDy+AebRHZFYhGax1YP/tP0Ve/FSq5rh6Vwuqa/zyfFUPZmZVf+EYXK7DdyuBhEZhBEu6QrjY60NRMTMLpnUZMcZXRAz9byMpAGcCYQv6gjU99ps8AkRjZNkn+FpAtDGT+oJxixQwyZMSxZ+ZuzkZGyBMeMplZXMMLICGZ2LRAgT0bxXLZUxHJBLwwnw==
|
||||
@@ -1 +0,0 @@
|
||||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDJAyDl52UVGFPTV/rXFERrXAMY5qZ3g+tpg9HOGdw86G4Nr8Xp/cTxZjF4kSfIkSrGblAV9Lm4US0fW3pGOQu5qQrSAENxqHxdlEyzt7izyF2CklDUeTjs3KHOIZMvSli4z014NPcswBbjwB9Lyrw0fCQ9P1vYkrUHEzL2SMxdack1EQPcMF4MxblDqc+eQhdMCkKE8T1Cb1ZqxeLVMPn9CwjG18JoxL+/xs+MjcsSXYWcoqYTfgfhguMbh0D4Eo32MHS/IzRSxnOHJxhG5xYePcyBlb/CxQuYA+RTqKNE85j7GcL2oEmeZ1b++/9qFT9grwVh+UOBRO2xiMzKDF24nXPJ+eLyd6Z/3swGT4rTVDnrXV5eZUkWLHN093IdLJCTtPVrKV9OxEKr5sU2W0edpirNrlGq7/MYkJX9EbQctDFA69XfQkZlGK9xGutqSgEaVlY54fS0Due+NDrNBPfMKJ9MTmFDOY+NYn05El2rMD39OKbGbCR5ASwSSBlcQeE=
|
||||
@@ -1 +0,0 @@
|
||||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDYiP+ELuG5KTmafVjBkY0ZSggJg+mDkvZpF8d7NljMst0YwKWV3IgHnkAGXdTd7jlRgm9HH6oc8rP2R6Q8EJmfr+xcL1IQIWKuYAoddHlpe2Ds4EE74xbgm5Elf7FpdYNHUH9XyVmMmIhVSpLw2N10jUhvYqw+h+xC2nObEKZuBOt/lqrTGbC/EMv3+sDv0ApBh8lKt2yfjt88pnAj1LKPANDgIYSyQOllHQWeUY/eD/5Qc9XWR3uWclslVaxriRmEA0sNZlOFCeRIyDbYpSzQBdcnojkwt7Z5kjhaqGlT9g00fdiqO0OMaeY/G8ki3QxqjONqTEDqK+DpEZFO6jyZARcY6ki0ANc0AO4qosEC3gEbAvVwyPwDFtyDggMTHlTzaw8iakMGSDEk10zKaUOgZYLzC2yCWYYQS5mae9wC1gkXIGD51/laeq2E7NpM+nha6kp9weLVyvwf0DLfwsiP+0qlCLrxBLTSRa0HQ+BnQMi4r16Ss7YJwLf/oXrbOVk=
|
||||
@@ -1 +0,0 @@
|
||||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDFwb7qi9/DvhpMvu43LRlTEC+3kPAA0KNeyk4FT4HlpRE/yxMxN6tgrP9vcx2c6TMfkRwIJKDcBuVVtKOVx+SDZo+nQBxpSz73v1qSmqlsy8D4gCk0a7cLgStb3Cvh0UZjJ5nVnxjzqY2CFnpnKYGmxL+a3qTj1KYPuA2wSsxkYVcHUfDj/uTtEDdRPaNTACsUxe1a57T/Tsjp+321+zKldYreozaABEBsexf9Z34+3vZvyQcfDB3QuxlBRPJBLik80QllpNpE1bqol8swoGEPbl/Ac7tNy+GtlwTG9SH1povmoT9K+8tjJaG2pD+z+vvgZQtJQh+aczYmEBJRZp3ksw1JH4eGqTWG/SDat9Isnx2NDhJe12b9izniDciuBScNySAazIDPidsCMUYjc9kgWdSOiODOtodj5IB+KazFVJgfpmzPv97LHVdjvR74usrgbFw2mYCw2YEiL3xjDYpQGmXSNklsQLwJiBe59oyS4QNpNYQzYD9StjgRIdvtmiM=
|
||||
@@ -1 +0,0 @@
|
||||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDVbOvoFVaGkqYzIWsmMFlpkE+TDAONOWWaJBQ0K4fiOLy7uh02b/jYNZrbllPDP+Gq+ikYEJnJX2ceDsh9mLtJTznBQXgJOMUZDYy0enu7hYLKMmRTgJntzHjMbZENMhP+I3N9JnQ1PQz7lICg1xkEBQm2CESYCCjo0rJKYplPH1bo02myEazKlKTn6tu40ysrYOoJO8+jwbUDqtWATjSZtgYojuh6dbIoK3O+Ntgwl4W0NqXEqXYXTWpU0qKOqAsP/9F9WJ5d1wVNNbvmcAJ26dkYaiPCNgW4MGTucAgoxM6IPVVj9U+OEZLoCPsqAGCT02vH5MoDNTmGaSv0DjuYOzz5C+jAhMCznXFXCI4bfawvuda/WwGIniB5iKNSBZt3XxYyUw4YBcVCNiWUt9bIgEvnR4E8HYHdjNrbQ0Z58L6DcPSySLQer7C658Vo/nRUlBq6lIWYhcdjxHHkP9iFtuFW1HmoUKkuaLl+uiflrSppX9wt8eaPwGgGIHkLwgc=
|
||||
@@ -1 +0,0 @@
|
||||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCa7ZRmIAtuGd58MQXnJnPqmad+6u8JiBKb7+xEfMmVdeVtJ5lEfXCkZ0vbSMxnGZCLL3eVxdejaGToLw+ArEJ1cl6KzZdsdGy1wATFtJj4oYHtZ/MXg+qulNR4nQ6DGWfGR7FEXjZNaJfVuLBFBmUlsbotBdhaAJzw5+nnIxY5d86nfqzsYstMqB/1ZHLRTV9h/jp8XNgnUu1BR/oVk4eMvzTUbr42LedeB1anLnI0+ycAzol/XMpsUNuRLVhYhMbg9rpyoZF1WMBTjG2Jnv9JtCpJlnZaOjzh3eD8PBuyZtGyya7QxVkhH4ULUMNnuyi8E0IOJwdN4cQi61fa7rLtsYfUrN2w0nI/WRLiBxiuPbvq4tKeHi8DpM/MrUbZONY2eFo4CaX9sxYN6U65jDfsbK3x6Za0HhVt8zcPLGgESm4Y6O8YTQrdbpL1ifNFX2Y9B++FQw2iRoqa6U0Wrs6SfVQFp1RqnqSl6fLOCixl16PpHWqRilweKbg3uIMEqEc=
|
||||
@@ -1,6 +1,11 @@
|
||||
inputs:
|
||||
{
|
||||
config = inputs.lib.mkIf (builtins.elem "desktop-extra" inputs.config.nixos.packages._packageSets)
|
||||
options.nixos.packages.steam = let inherit (inputs.lib) mkOption types; in mkOption
|
||||
{
|
||||
type = types.nullOr (types.submodule {});
|
||||
default = if inputs.config.nixos.system.gui.enable then {} else null;
|
||||
};
|
||||
config = let inherit (inputs.config.nixos.packages) steam; in inputs.lib.mkIf (steam != null)
|
||||
{
|
||||
programs.steam =
|
||||
{
|
||||
@@ -15,6 +20,12 @@ inputs:
|
||||
'';
|
||||
});
|
||||
});
|
||||
extraPackages = [ inputs.pkgs.openssl_1_1 ];
|
||||
extraCompatPackages = [ inputs.pkgs.proton-ge-bin ];
|
||||
remotePlay.openFirewall = true;
|
||||
protontricks.enable = true;
|
||||
localNetworkGameTransfers.openFirewall = true;
|
||||
dedicatedServer.openFirewall = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,7 +1,14 @@
|
||||
inputs:
|
||||
{
|
||||
config = inputs.lib.mkIf (builtins.elem "workstation" inputs.config.nixos.packages._packageSets)
|
||||
options.nixos.packages.vasp = let inherit (inputs.lib) mkOption types; in mkOption
|
||||
{
|
||||
nixos.packages._packages = with inputs.pkgs.localPackages.vasp; [ intel nvidia vtstscripts ];
|
||||
type = types.nullOr (types.submodule {});
|
||||
default = if inputs.config.nixos.system.gui.enable then {} else null;
|
||||
};
|
||||
# TODO: add more options to correctly configure VASP
|
||||
config = let inherit (inputs.config.nixos.packages) vasp; in inputs.lib.mkIf (vasp != null)
|
||||
{
|
||||
nixos.packages.packages._packages = inputs.lib.optionals (inputs.config.nixos.system.nixpkgs.march != null)
|
||||
(with inputs.pkgs.localPackages.vasp; [ intel nvidia vtstscripts ]);
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
inputs:
|
||||
{
|
||||
config = inputs.lib.mkIf (builtins.elem "server" inputs.config.nixos.packages._packageSets)
|
||||
options.nixos.packages.vim = let inherit (inputs.lib) mkOption types; in mkOption
|
||||
{ type = types.nullOr (types.submodule {}); default = {}; };
|
||||
config = let inherit (inputs.config.nixos.packages) vim; in inputs.lib.mkIf (vim != null)
|
||||
{
|
||||
nixos.user.sharedModules =
|
||||
[{
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
inputs:
|
||||
{
|
||||
config = inputs.lib.mkIf (builtins.elem "desktop" inputs.config.nixos.packages._packageSets)
|
||||
options.nixos.packages.vscode = let inherit (inputs.lib) mkOption types; in mkOption
|
||||
{
|
||||
nixos.packages = with inputs.pkgs;
|
||||
type = types.nullOr (types.submodule {});
|
||||
default = if inputs.config.nixos.system.gui.enable then {} else null;
|
||||
};
|
||||
config = let inherit (inputs.config.nixos.packages) vscode; in inputs.lib.mkIf (vscode != null)
|
||||
{
|
||||
nixos.packages.packages = with inputs.pkgs;
|
||||
{
|
||||
_packages =
|
||||
[(
|
||||
@@ -21,7 +26,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 ])
|
||||
@@ -58,6 +63,8 @@ inputs:
|
||||
yutengjing.open-in-external-app
|
||||
# ChatGPT-like plugin
|
||||
codeium.codeium
|
||||
# git graph
|
||||
mhutchie.git-graph
|
||||
];
|
||||
}
|
||||
)];
|
||||
|
||||
@@ -1,61 +0,0 @@
|
||||
inputs:
|
||||
{
|
||||
config = inputs.lib.mkIf (builtins.elem "workstation" inputs.config.nixos.packages._packageSets)
|
||||
{
|
||||
nixos =
|
||||
{
|
||||
packages = with inputs.pkgs;
|
||||
{
|
||||
_packages =
|
||||
[
|
||||
# password and key management
|
||||
electrum jabref
|
||||
# system management
|
||||
wl-mirror nvtopPackages.full
|
||||
# nix tools
|
||||
nix-template nil pnpm-lock-export bundix
|
||||
# instant messager
|
||||
cinny-desktop nheko # qq nur-xddxdd.wechat-uos
|
||||
# development
|
||||
jetbrains.clion android-studio dbeaver-bin cling fprettify aircrack-ng
|
||||
# install per project
|
||||
# clang-tools_16 ccls
|
||||
# media
|
||||
nur-xddxdd.svp
|
||||
# virtualization
|
||||
wineWowPackages.stagingFull virt-viewer bottles # wine64
|
||||
# text editor
|
||||
appflowy notion-app-enhanced joplin-desktop standardnotes logseq
|
||||
# math, physics and chemistry
|
||||
(mathematica.overrideAttrs (prev: { postInstall = prev.postInstall or "" + "ln -s ${src} $out/src"; }))
|
||||
paraview jmol mpi # quantum-espresso # localPackages.mumax
|
||||
# encryption and password management
|
||||
john crunch hashcat
|
||||
# container and vm
|
||||
genymotion davinci-resolve playonlinux
|
||||
# browser
|
||||
microsoft-edge tor-browser
|
||||
# news
|
||||
rssguard newsflash newsboat
|
||||
];
|
||||
_pythonPackages = [(pythonPackages: with pythonPackages;
|
||||
[
|
||||
phonopy tensorflow keras scipy scikit-learn jupyterlab autograd # localPackages.pix2tex
|
||||
])];
|
||||
};
|
||||
user.sharedModules =
|
||||
[{
|
||||
config.programs.obs-studio =
|
||||
{
|
||||
enable = true;
|
||||
plugins = with inputs.pkgs.obs-studio-plugins; [ wlrobs obs-vaapi obs-nvfbc droidcam-obs obs-vkcapture ];
|
||||
};
|
||||
}];
|
||||
};
|
||||
programs =
|
||||
{
|
||||
anime-game-launcher = { enable = true; package = inputs.pkgs.anime-game-launcher; };
|
||||
honkers-railway-launcher = { enable = true; package = inputs.pkgs.honkers-railway-launcher; };
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
inputs:
|
||||
{
|
||||
config = inputs.lib.mkIf (builtins.elem "server" inputs.config.nixos.packages._packageSets)
|
||||
options.nixos.packages.zsh = let inherit (inputs.lib) mkOption types; in mkOption
|
||||
{ type = types.nullOr (types.submodule {}); default = {}; };
|
||||
config = let inherit (inputs.config.nixos.packages) zsh; in inputs.lib.mkIf (zsh != null)
|
||||
{
|
||||
nixos.user.sharedModules = [(home-inputs: { config.programs =
|
||||
{
|
||||
@@ -37,11 +39,7 @@ inputs:
|
||||
name = "powerlevel10k";
|
||||
src = "${inputs.pkgs.zsh-powerlevel10k}/share/zsh-powerlevel10k";
|
||||
}
|
||||
{
|
||||
file = "p10k.zsh";
|
||||
name = "powerlevel10k-config";
|
||||
src = ./p10k-config;
|
||||
}
|
||||
{ file = "p10k.zsh"; name = "powerlevel10k-config"; src = ./p10k-config; }
|
||||
{
|
||||
name = "zsh-lsd";
|
||||
src = inputs.pkgs.fetchFromGitHub
|
||||
@@ -71,10 +69,7 @@ inputs:
|
||||
autosuggestions.enable = true;
|
||||
enableCompletion = true;
|
||||
ohMyZsh =
|
||||
{
|
||||
enable = true;
|
||||
plugins = [ "git" "colored-man-pages" "extract" "history-substring-search" "autojump" ];
|
||||
};
|
||||
{ enable = true; plugins = [ "git" "colored-man-pages" "extract" "history-substring-search" "autojump" ]; };
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
];
|
||||
};
|
||||
})
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
inputs:
|
||||
{
|
||||
options.nixos.services.fz-new-order = let inherit (inputs.lib) mkOption types; in mkOption
|
||||
{
|
||||
type = types.nullOr (types.submodule {});
|
||||
default = null;
|
||||
};
|
||||
{ type = types.nullOr (types.submodule {}); default = null; };
|
||||
config = let inherit (inputs.config.nixos.services) fz-new-order; in inputs.lib.mkIf (fz-new-order != null)
|
||||
{
|
||||
users =
|
||||
@@ -72,7 +69,7 @@ inputs:
|
||||
"Z /var/lib/fz-new-order - fz-new-order fz-new-order"
|
||||
];
|
||||
};
|
||||
sops = let userNum = 6; configNum = 2; in
|
||||
sops = let userNum = 5; configNum = 2; in
|
||||
{
|
||||
templates."fz-new-order/config.json" =
|
||||
{
|
||||
@@ -80,7 +77,6 @@ inputs:
|
||||
group = inputs.config.users.users."fz-new-order".group;
|
||||
content = let placeholder = inputs.config.sops.placeholder; in builtins.toJSON
|
||||
{
|
||||
manager = placeholder."fz-new-order/manager";
|
||||
token = placeholder."fz-new-order/token";
|
||||
uids = builtins.map (j: placeholder."fz-new-order/uids/user${builtins.toString j}")
|
||||
(builtins.genList (n: n) userNum);
|
||||
@@ -92,7 +88,7 @@ inputs:
|
||||
};
|
||||
};
|
||||
secrets =
|
||||
{ "fz-new-order/manager" = {}; "fz-new-order/token" = {}; }
|
||||
{ "fz-new-order/token" = {}; }
|
||||
// (builtins.listToAttrs (builtins.map
|
||||
(i: { name = "fz-new-order/uids/user${toString i}"; value = {}; })
|
||||
(builtins.genList (n: n) userNum)))
|
||||
|
||||
@@ -48,7 +48,7 @@ std::string urlencode(std::string s)
|
||||
void oneshot
|
||||
(
|
||||
const std::string& username, const std::string& password, const std::string& comment,
|
||||
const std::set<std::string>& wxuser, const std::set<std::string>& manager, const std::string& token
|
||||
const std::set<std::string>& wxuser, const std::string& token
|
||||
)
|
||||
{
|
||||
httplib::Client fzclient("http://scmv9.fengzhansy.com:8882");
|
||||
@@ -152,16 +152,6 @@ void oneshot
|
||||
for (const auto& order : order_list)
|
||||
if (!order_old.contains(order.first))
|
||||
{
|
||||
for (const auto& user : manager)
|
||||
{
|
||||
auto path = fmt::format
|
||||
(
|
||||
"/api/send/message/?appToken={}&content={}&uid={}",
|
||||
token, urlencode(fmt::format("push {}", order.first)), user
|
||||
);
|
||||
auto wxresult = wxclient.Get(path.c_str());
|
||||
}
|
||||
|
||||
auto body = fmt::format
|
||||
(
|
||||
"method=dgate&rand=1234&op=scmmgr_pcggl&nv%5B%5D=opmode&nv%5B%5D=ddsp_qry&nv%5B%5D=bill&nv%5B%5D={}",
|
||||
@@ -248,7 +238,7 @@ int main(int argc, char** argv)
|
||||
oneshot
|
||||
(
|
||||
config["username"].asString(), config["password"].asString(), config["comment"].asString(),
|
||||
uids, { configs["manager"].asString() }, configs["token"].asString()
|
||||
uids, configs["token"].asString()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -19,11 +19,6 @@ inputs:
|
||||
services.gitea =
|
||||
{
|
||||
enable = true;
|
||||
package = inputs.pkgs.gitea.overrideAttrs { src = builtins.fetchurl
|
||||
{
|
||||
url = "https://dl.gitea.com/gitea/1.22.0-rc1/gitea-src-1.22.0-rc1.tar.gz";
|
||||
sha256 = "1h7kjzk7zck7j2advcxc0gsmv3qkwmhcnqi9zl7ypiffy40p6l9y";
|
||||
};};
|
||||
lfs.enable = true;
|
||||
mailerPasswordFile = inputs.config.sops.secrets."gitea/mail".path;
|
||||
database =
|
||||
|
||||
@@ -77,7 +77,7 @@ inputs:
|
||||
{
|
||||
finishjob = "*-*-* *:*:00";
|
||||
backupdb = "*-*-* *:00/10:00";
|
||||
diskstat = "*-*-* 03:00:00";
|
||||
diskstat = "*-*-* 03/12:00:00";
|
||||
};
|
||||
in
|
||||
{
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user