Compare commits

..

1 Commits

Author SHA1 Message Date
chn
8f6bb9f6db test bindmount 2024-11-10 22:19:12 +08:00
94 changed files with 1706 additions and 1094 deletions

1
.gitignore vendored
View File

@@ -6,4 +6,3 @@ build
.vscode
.cache
.ccls-cache
archive

View File

@@ -1,13 +1,14 @@
keys: # cat /etc/ssh/ssh_host_ed25519_key.pub | ssh-to-age
- &chn age19ax6vm3pv8rph5tq3mmehd9sy9jk823tw8svsd790r0lkslycquqvlwz9m
- &pc age1ffvr5pqd2lfj24e3fh53s92z6h76fda3du4y4k6r3yjumdwvpfgqzj033a
- &vps4 age1yvrl4y0r6yzcxzzkgfwshlrtsjt8uuya6rfwks09pnft7esfcyvqmrtm5q
- &vps6 age164tyqklwhdm57tfm5u863mdt2xrzrrzac4py8a0j9y6kzqcjy9zsp073t6
- &vps7 age137x7csalutwvfygvvzpemlsywvdxj3j4z93a50z2sjx03w6zau8q3r5902
- &surface age1ck5vzs0xqx0jplmuksrkh45xwmkm2t05m2wyq5k2w2mnkmn79fxs6tvl3l
- &nas age19lhcwk37jmvn6z0v4dpdfh0k4u23f76twdjknc0p7atktf37rd7s4t4wj3
- &xmupc1 age1hnarptkze0ujpp05dqr8uma04cxg9zqcx68qgpks5uf5l6rpk5gqhh8wxg
- &xmupc2 age1l4stuz0vr7gs7pqwjrmezam44702jp2vmqaqyxw0l0r42kf9updq4dfhrw
- &pi3b age1yjgswvexp0x0de0sw4u6hamruzeluxccmx2enxazl6pwhhsr2s9qlxdemq
- &one age1m7nrxfw22wvp7pj8y9pdl745w95x89uu8dzl9ppsaazweqf2lqms5yshsp
- &srv1-node0 age1nzetyehldf3gl6pr6mu5d2cv387p8wjqn6wfpll7a3sl8us6n38s0ds633
- &srv1-node1 age1wj33xt8nj7rhnsenepsf6k3lmq5vk4wn84jwr55qy9cwu05xn5cspg3h7t
- &srv1-node2 age16e7ykphshal6qhwfvat698hl48s8yr0jvzh27ecdyfh5uk7t9u6s753jgy
@@ -18,6 +19,11 @@ creation_rules:
- age:
- *chn
- *pc
- path_regex: devices/vps4/.*$
key_groups:
- age:
- *chn
- *vps4
- path_regex: devices/vps6/.*$
key_groups:
- age:
@@ -33,6 +39,11 @@ creation_rules:
- age:
- *chn
- *nas
- path_regex: devices/surface/.*$
key_groups:
- age:
- *chn
- *surface
- path_regex: devices/xmupc1/.*$
key_groups:
- age:
@@ -48,11 +59,6 @@ creation_rules:
- age:
- *chn
- *pi3b
- path_regex: devices/one/.*$
key_groups:
- age:
- *chn
- *one
- path_regex: devices/srv1/node0/.*$
key_groups:
- age:

View File

@@ -37,9 +37,6 @@ fi
if [ -z "${BASHRC_SOURCED-}" ]; then
export PATH=$HPCSTAT_SSH_BINDIR:$PATH:$HOME/bin:$HOME/linwei/chn/software/scripts
export BASHRC_SOURCED=1
if [ "${HPCSTAT_SUBACCOUNT}" == "lyj" ]; then
export PATH=$HOME/wuyaping/lyj/bin:$PATH
fi
fi
[ -n "$CHN_LS_USE_COLOR" ] && alias ls="ls --color=auto"

View File

@@ -8,7 +8,6 @@ ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMRpyIU8ZuYTa0LvsVHmJZ1FA7Lbp4PObjkwo+UcpCP8
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGRZp8xp9hVO7e/6eflQsnFZj853IRVywc97cTevnWbg hjp@xmupc1
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGwUhEAFHjkbUfOf0ng8I80YbKisbSeY4lq/byinV7lh wm
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIF5bg5cayOLfnfUBJz8LeyaYfP41s9pIqUgXn6w9xtvR lly
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBoDGk9HYphkngx2Ix/vef2ZntdVNK1kbS9pY8+TzI41 yxf
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCmJoiGO5YD3lbbIOJ99Al2xxm6QS9q+dTCTtlALjYI5f9ICGZJT8PEGlV9BBNCRQdgb3i2LBzQi90Tq1oG6/PcTV3Mto2TawLz5+2+ym29eIq1QIhVTLmZskK815FpawWqxY6+xpGU3vP1WjrFBbhGtl+CCaN+P2TWNkrR8FjG2144hdAlFfEEqfQC+TXbsyJCYoExuxGDJo8ae0JGbz9w1A1UbjnHwKnoxvirTFEbw9IHJIcTdUwuQKOrwydboCOqeaHt74+BnnCOZhpYqMDacrknHITN4GfFFzbs6FsE8NAwFk6yvkNXXzoe60iveNXtCIYuWjG517LQgHAC5BdaPgqzYNg+eqSul72e+jjRs+KDioNqvprw+TcBBO1lXZ2VQFyWyAdV2Foyaz3Wk5qYlOpX/9JLEp6H3cU0XCFR25FdXmjQ4oXN1QEe+2akV8MQ9cWhFhDcbY8Q1EiMWpBVC1xbt4FwE8VCTByZOZsQ0wPVe/vkjANOo+brS3tsR18= 00@xmuhpc
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCxcIWDQxVyIRqCGR4uWtrh4tLc025+q6du2GVsox8IzmBFkjNY8Au5GIMP5BKRstxFdg3f/wam8krckUN9rv5+OHB9U8HGz77Xs0FktqRVNMaDPdptePZQJ9A9eW3kkFDfQnORJtiVcEWfUBS3pi0QFOHylnG27YyC/Vjx9tjvtJWKsQEVTFJbFHPdi+G7lHTpqIGx+/a2JN9O6uVujXXYvjSVXsd+CWB9VMZMvYCIz2Ecb6RqR3brj4FhRRl8zyCj+J4ACYFdGWL98fTab2uPHbpVeKrefFFA43JOD/4zwBx/uw7MAQAq0GunTV3FpBfIAQHWgftf2fSlbz20oPjCwdYn9ZuGJOBUroryex7AKZmnSYM3biLHcctQfZtxqVPEU3W/62MUsI/kZb9RcF24JRksMoS2XWTiv2HFf5ijQGLXXOjqiTlGncwiKf65DwkDBsSxzgbXk5Uo86viq6UITFXPx/RytU+SUiN4Wb7wcBTjt/+tyQd1uqc7+3DCDXk= 01@xmuhpc

View File

@@ -1,50 +0,0 @@
inputs:
{
config =
{
nixos =
{
model = { type = "desktop"; private = true; };
system =
{
fileSystems =
{
mount =
{
vfat."/dev/disk/by-partlabel/one-boot" = "/boot";
btrfs."/dev/mapper/root" = { "/nix" = "/nix"; "/nix/rootfs/current" = "/"; };
};
luks.auto."/dev/disk/by-partlabel/one-root" = { mapper = "root"; ssd = true; };
swap = [ "/nix/swap/swap" ];
resume = { device = "/dev/mapper/root"; offset = 728784; };
rollingRootfs = {};
};
nixpkgs.march = "tigerlake";
};
hardware = { cpus = [ "intel" ]; gpu.type = "intel"; };
services =
{
snapper.enable = true;
xray.client.enable = true;
smartd.enable = true;
beesd.instances.root = { device = "/"; hashTableSizeMB = 512; };
wireguard =
{
enable = true;
peers = [ "vps6" ];
publicKey = "Hey9V9lleafneEJwTLPaTV11wbzCQF34Cnhr0w2ihDQ=";
wireguardIp = "192.168.83.5";
};
sshd = {};
};
bugs = [ "xmunet" ];
};
boot.kernelParams = [ "acpi_osi=!" ''acpi_osi="Windows 2015"'' ];
security =
{
pam.services.kde.rules.auth.pass =
{ modulePath = "pam_succeed_if.so"; args = [ "user" "=" "chn" ]; control = "sufficient"; order = 0; };
sudo.wheelNeedsPassword = false;
};
};
}

View File

@@ -1,40 +0,0 @@
xray-client:
uuid: ENC[AES256_GCM,data:GmfSlDQjO4aBq3u50jnFjOR9VxamYHzokUrO9IpIGuBx0j8e,iv:++O2wBUCnHDPowRgtxPQJQePXP2Cda74WXQvlKHbHNw=,tag:XDWhiXwT718RgrBw7L5yzw==,type:str]
acme:
token: ENC[AES256_GCM,data:+zy72VDj8hs1GH7E1U04WhiGq0xkIPGC8pHbAYR70OK5E6EOdkQwKA==,iv:oYNSrOH3pLhltYw2NX1d4s6jiUgMssWiIK//62i0ptQ=,tag:C5ekSVjmwSEphsTZ/DLcsg==,type:str]
nginx:
maxmind-license: ENC[AES256_GCM,data:/x9HJWh4Kpp5xy4TfuC/bP4Z/gMOFgAalz91cewHj1/tPxFe5R/nQA==,iv:K696zu685ydzwFMKIrqz1GiYLMKGM1dLNDWdhH4U0L8=,tag:nFwqXc7RPIYcQxVIu6GWgw==,type:str]
wireguard:
privateKey: ENC[AES256_GCM,data:NgA5rHB6GwqiNSx1mhxObywuiZWq5qpcNrlpk6HaD9hzQoL0j1IrrgMCqkU=,iv:ZZUlSJeQPN2/JxjhR08FdEZl3gCFuNpJ3M93C6JovHs=,tag:rCtWHOYCmgZKF1lRlIAReA==,type:str]
github:
token: ENC[AES256_GCM,data:rGiseVhDBU+rNcz92QXHeqAQ4lC7l5dba8d7rGUIIoEcpBVGwGh/5w==,iv:lf4aMBAQxI140qJsMLqHpI3dKRw6HiV20cyn0WFWbT8=,tag:w1P9MrqgUAmPzVWkIFs1jg==,type:str]
age: ENC[AES256_GCM,data:5QX7wYQpbKSX88bAWSRqi8Y3Pmwb1KZ6LYrHURs7N2VHjbXOaSM9lm1GRrUjUHQE/r2CUku3TnMphczBMb0qLxSliay7QB2W0+o=,iv:qCTpul0ESBN7NWznBR8546A+Is7x7+Su4yHDX1b+FNY=,tag:aVU7B5lygQrBh5l260jJLQ==,type:str]
sops:
kms: []
gcp_kms: []
azure_kv: []
hc_vault: []
age:
- recipient: age19ax6vm3pv8rph5tq3mmehd9sy9jk823tw8svsd790r0lkslycquqvlwz9m
enc: |
-----BEGIN AGE ENCRYPTED FILE-----
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBsOUJWMm5xT040cEoxQit5
ZnhhQWVyWjlnejhzQlEvVVg3ZGVJb05iL1hjCnF5bzFTUTZFYkNQR0k5U0xmOW1t
TXhsRHFIeVBBSXc1UURON2M4MDlTMEUKLS0tIGdSbTdZdmdjY0dmNjkrRjd0VkhK
eWV6SDJqT1B2MEp1MURkV0E4S3Z0Zm8KX9lEjG4u2QRe1zH+13rbedCWl1B7vvl8
2iMHj1qQ4JkCeq83llEH5IuDXKYnKKXSi8l3nU/l6Aw6yx/KHDFK/g==
-----END AGE ENCRYPTED FILE-----
- recipient: age1m7nrxfw22wvp7pj8y9pdl745w95x89uu8dzl9ppsaazweqf2lqms5yshsp
enc: |
-----BEGIN AGE ENCRYPTED FILE-----
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSA2K3VKTVJqMTl2cWxUZHhM
OVg5ZjN0VGNpVXQ5M1FKZHloZ0ZnWTZ2ZWowCjJIYTlhRU8wd1JienlUTHIwWXYw
eFY1d2MxeStBd013VmszbTUzTkF6U2cKLS0tIDdDNXp4OTdQRjN0MGdIOS9oSldU
ZW5PT3VYZWhDMkZUeHViZE41eUhna2sKc8J8mJ8ge9KMb5p6Xi/vRIIXZMEj6Ih+
LjLKsgDfMbqNqKaQXSvC3tbvI/dDoiStyCsf4rkTY9QOkyEI80MtXg==
-----END AGE ENCRYPTED FILE-----
lastmodified: "2024-12-09T13:35:05Z"
mac: ENC[AES256_GCM,data:2ILRlQddIKvJubKth/y7+UndarVUv2VQNZmaSbMc/m35qY5nln6Oy32TmCASS5EX+wWXwb/8waWlniPrDQLKdB2vE8PdqQQiYbHgmUQU7bauG8jLPNag47CNhTLMd6C1xymWS42Ie56pi0eNazCXoxIApNBXGtM/ITtBjCMDBHE=,iv:6NLogRo0ibBR+gTb52yAY9l6zrrWdC97whHe0c2tV54=,tag:CNwvVwEBbckgjUG54BhXjQ==,type:str]
pgp: []
unencrypted_suffix: _unencrypted
version: 3.9.1

View File

@@ -4,7 +4,7 @@ inputs:
{
nixos =
{
model = { type = "desktop"; private = true; };
model.type = "desktop";
system =
{
fileSystems =
@@ -38,19 +38,17 @@ inputs:
"broadwell"
# FXSR HLE LZCNT PREFETCHW RDRND SAHF SGX XSAVE
"skylake" "cascadelake"
# SAHF FXSR XSAVE RDRND LZCNT HLE PREFETCHW SGX MOVDIRI MOVDIR64B AVX512VP2INTERSECT KEYLOCKER
"tigerlake"
# AVX-VNNI CLDEMOTE GFNI-SSE HRESET KL LZCNT MOVDIR64B MOVDIRI PCONFIG PREFETCHW PTWRITE RDRND
# SERIALIZE SGX WAITPKG WIDEKL XSAVE XSAVEOPT
"alderlake"
];
githubToken.enable = true;
};
nixpkgs =
{ march = "znver4"; cuda = { enable = true; capabilities = [ "8.9" ]; forwardCompat = false; }; };
kernel =
{
# TODO: switch to cachyos-lts
variant = "xanmod-latest";
variant = "cachyos";
patches = [ "hibernate-progress" ];
modules.modprobeConfig =
[ "options iwlwifi power_save=0" "options iwlmvm power_scheme=1" "options iwlwifi uapsd_disable=1" ];
@@ -60,11 +58,7 @@ inputs:
hardware =
{
cpus = [ "amd" ];
gpu =
{
type = "amd+nvidia";
nvidia = { dynamicBoost = true; driver = "beta"; prime.busId = { amd = "6:0:0"; nvidia = "1:0:0"; }; };
};
gpu = { type = "nvidia"; nvidia = { dynamicBoost = true; driver = "latest"; }; };
legion = {};
};
virtualization =
@@ -98,7 +92,10 @@ inputs:
[ "mirism.one" "beta.mirism.one" "ng01.mirism.one" "initrd.vps6.chn.moe" ])
++ (builtins.map
(name: { inherit name; value = "0.0.0.0"; })
[ "log-upload.mihoyo.com" "uspider.yuanshen.com" "ys-log-upload.mihoyo.com" ])
[
"log-upload.mihoyo.com" "uspider.yuanshen.com" "ys-log-upload.mihoyo.com"
"dispatchcnglobal.yuanshen.com"
])
++ [{ name = "4006024680.com"; value = "192.168.199.1"; }]
);
};
@@ -121,7 +118,7 @@ inputs:
publicKey = "l1gFSDCeBxyf/BipXNvoEvVvLqPgdil84nmr5q6+EEw=";
wireguardIp = "192.168.83.3";
};
gamemode = { enable = true; drmDevice = 1; };
gamemode = { enable = true; drmDevice = 0; };
slurm =
{
enable = true;
@@ -142,35 +139,28 @@ inputs:
keyd = {};
};
bugs = [ "xmunet" "backlight" "amdpstate" ];
packages = { android-studio = {}; mathematica = {}; };
};
boot.loader.grub =
boot =
{
extraFiles =
kernelParams = [ "acpi_osi=!" ''acpi_osi="Windows 2015"'' ];
loader.grub =
{
"DisplayEngine.efi" = ./bios/DisplayEngine.efi;
"SetupBrowser.efi" = ./bios/SetupBrowser.efi;
"UiApp.efi" = ./bios/UiApp.efi;
"EFI/Boot/Bootx64.efi" = ./bios/Bootx64.efi;
"nixos.iso" = inputs.topInputs.self.src.iso;
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
}
'';
};
extraEntries =
''
menuentry 'Advanced UEFI Firmware Settings' {
insmod fat
insmod chain
chainloader @bootRoot@/EFI/Boot/Bootx64.efi
}
menuentry 'Live ISO' {
set iso_path=@bootRoot@/nixos.iso
export iso_path
search --set=root --file "$iso_path"
loopback loop "$iso_path"
root=(loop)
configfile /boot/grub/loopback.cfg
loopback --delete loop
}
'';
};
# 禁止鼠标等在睡眠时唤醒
services.udev.extraRules = ''ACTION=="add", ATTR{power/wakeup}="disabled"'';
@@ -178,5 +168,30 @@ inputs:
users.users.qemu-libvirtd.extraGroups = [ "disk" ];
networking.extraHosts = "74.211.99.69 mirism.one beta.mirism.one ng01.mirism.one";
services.colord.enable = true;
environment.persistence."/nix/archive" =
{
hideMounts = true;
users.chn.directories = builtins.map
(dir: { directory = "repo/${dir}"; user = "chn"; group = "chn"; mode = "0755"; })
[ "BPD-paper" "kurumi-asmr" "BPD-paper-old" "SiC-20240705" ];
};
specialisation =
{
hybrid.configuration =
{
nixos =
{
hardware.gpu =
{ type = inputs.lib.mkForce "amd+nvidia"; nvidia.prime.busId = { amd = "6:0:0"; nvidia = "1:0:0"; }; };
services.gamemode.drmDevice = inputs.lib.mkForce 1;
};
system.nixos.tags = [ "hybrid" ];
};
xanmod.configuration =
{
nixos.system.kernel.variant = inputs.lib.mkForce "xanmod-latest";
system.nixos.tags = [ "xanmod" ];
};
};
};
}

View File

@@ -26,8 +26,6 @@ age: ENC[AES256_GCM,data:EPjip4/tz50e+blPko9NpzDamLRO6BVy64kDnGAhUJJ/bMw6V9Of8Rz
user:
#ENC[AES256_GCM,data:a4mHxr7bn7BV,iv:FYQk3yv3XgxNO9CnrQefo3WqhO0Sf8Mihfp+Iw4AcWM=,tag:jebxvG+xUidghf5dOlvDYA==,type:comment]
zzn: ENC[AES256_GCM,data:xBSve41JclBYQULPN7yV/1Eyo3u+CHAewVetKHwjvl6Te0kk/+aLx6gs8EpOJGmVaiSAdt6F2ayHXUD8RXXpJIOnnEHk88kqbw==,iv:XPxMLvlVtaZvpWnau5Jwlj/5ty5Zyw4F44ix5G64Z84=,tag:uJfWb0PCebdMtxXMfueULQ==,type:str]
wechat2tg:
token: ENC[AES256_GCM,data:PrZWR8WiZ7grkpTLqMxwbnkwZttl7n0e1lc1mdHJiFUWq/PqG2wNBC27C58jMg==,iv:02XHhfpN8YPix0REbJDnsBbvCwifbdwBwfuJ2glbvjo=,tag:6aWNqBfwulsjMbl+D6L9vw==,type:str]
sops:
kms: []
gcp_kms: []
@@ -52,8 +50,8 @@ sops:
OUlxNjdQaXdXMkZ6bnV1ek4yZ2dpbkEKpKGOAxo5Eef2jtGrg4iSzmGCeg+vTgvu
+K8b+O19MIkGMDBm6UbYUPtc/7eqoEZRiTUzNMTmfkLVS4ul5zou9A==
-----END AGE ENCRYPTED FILE-----
lastmodified: "2024-12-10T04:14:38Z"
mac: ENC[AES256_GCM,data:WLaeLyNQgw7DuRL/mAPRyHPR+i4YuYhf8TT5/5e6Hg14Fs2uvewHB7d2RLefRAg5IlCFerKioNuaAVDK079wCS95OjK5pAuq4rXIcodYSF7wD/yHfdsGp3ptr68rkdurcN1iSw4Xw+gkUjjq3irQYqtTQNGde4ez4O8KEe2tnHo=,iv:o+0siRY3emKZEDCuqya4A29h6F3oNSKGOjEshCXE+UM=,tag:77x58NANaAOsjxFKwuBmvQ==,type:str]
lastmodified: "2024-09-04T01:39:48Z"
mac: ENC[AES256_GCM,data:VkpF9zTWRLMriukAif6lfp8uy6+IcPDYUnXCQ5XLUtSstEyUoaVBjn+VVAoKkLX3MnyR6gyiYVWDDJmXrsyNoQpjRVQR0yu0p6p7sB3voGKiNxhw5qGwZj4IIXnHFWvktgWiawCiUkmSTUUHxe0XjAh7AWxjGqgAs/oyWGq/YfE=,iv:IQbJAhW/y18s57CAwRPeypQreBqQb0KkJAgIZ90QXJU=,tag:a0AB3l83j31Ex6PH9ziHRg==,type:str]
pgp: []
unencrypted_suffix: _unencrypted
version: 3.9.1
version: 3.9.0

View File

@@ -0,0 +1,66 @@
inputs:
{
imports = inputs.localLib.mkModules [ inputs.topInputs.nixos-hardware.nixosModules.microsoft-surface-pro-intel ];
config =
{
nixos =
{
model.type = "desktop";
system =
{
fileSystems =
{
mount =
{
vfat."/dev/disk/by-uuid/4596-D670" = "/boot";
btrfs."/dev/mapper/root1" = { "/nix" = "/nix"; "/nix/rootfs/current" = "/"; };
};
luks.auto =
{
"/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";
nix = { substituters = [ "https://nix-store.chn.moe?priority=100" ]; githubToken.enable = true; };
kernel = { variant = "xanmod-latest"; patches = [ "surface" "hibernate-progress" ]; };
};
hardware = { cpus = [ "intel" ]; gpu.type = "intel"; };
services =
{
snapper.enable = true;
sshd = {};
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"
]);
};
wireguard =
{
enable = true;
peers = [ "vps6" ];
publicKey = "j7qEeODVMH31afKUQAmKRGLuqg8Bxd0dIPbo17LHqAo=";
wireguardIp = "192.168.83.5";
};
beesd.instances.root = { device = "/"; hashTableSizeMB = 512; };
waydroid = {};
docker = {};
};
bugs = [ "xmunet" "suspend-hibernate-no-platform" ];
};
powerManagement.resumeCommands = ''${inputs.pkgs.systemd}/bin/systemctl restart iptsd'';
services.iptsd.config =
{
Touchscreen = { DisableOnPalm = true; DisableOnStylus = true; Overshoot = 0.5; };
Contacts = { Neutral = "Average"; NeutralValue = 10; };
};
};
}

View File

@@ -0,0 +1,36 @@
xray-client:
uuid: ENC[AES256_GCM,data:WEBAH3PQM5ahNpH/kvTtcjcJ2GllmmRlBR2oclG6AimGenSg,iv:TMp0WTOe9fuELSZoVGenl5XSZUFoiYUBEMWMn4NFv1g=,tag:GJTE0EELcZkrnGAKLYer1g==,type:str]
wireguard:
privateKey: ENC[AES256_GCM,data:P/tyZHaEAahZUBF22dJEZb6mACm/wmUunPDG0vS7SNW3sWbzxRSut0haR/g=,iv:8VMv5iotmDrYDLiszcOvJHkD8l6uE+SboPSILr6KuzU=,tag:U/FIBhvghwDTvFtUWEqr4g==,type:str]
github:
token: ENC[AES256_GCM,data:SyqrpFfy+y7syReWs0Bi23651ew41Us8aqjImBTzkDanOtWQgIYC6g==,iv:H3Y/TuP3VvZv6MlRAdLOY0CiNUeoqGZRNg0s58ZSkQ8=,tag:rSf4E8Whvue/LZ+VlSqDDQ==,type:str]
age: ENC[AES256_GCM,data:KEaMrk9eldR6oCqNqSpwhbJKj+JrN1KBkDL5p9itaszGf4tnDRidcleCQi1Ae17osYXIEh4+OxX/d6RKb9TP6JMLJe0iq6c9sC8=,iv:ztiP2Vz4AFZkd8ZG7xYlqYrV3JZYvmX07Ez6GtJ6yp0=,tag:PS8oSkkrrpgYYVfjbTtkaQ==,type:str]
sops:
kms: []
gcp_kms: []
azure_kv: []
hc_vault: []
age:
- recipient: age19ax6vm3pv8rph5tq3mmehd9sy9jk823tw8svsd790r0lkslycquqvlwz9m
enc: |
-----BEGIN AGE ENCRYPTED FILE-----
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBzV1pvWkVGSFg5TVAvRlhu
TnFnMEszcDRWWHlQanAyRkRpQWdqQkdhTzFvCjBqUG4xNFBiRnlSeTNQSmdkVkdD
UlVCQjRFVExuZHdrSnViajZGZ3c2dWsKLS0tIHlQYU5VeGpEQzllMmxLSnJZZzZx
N1R3Mkhxa0dOVlJiU0V2OEZVVzZVMFkKae3c1axl22uxh9wMygAHs6q1WA5ImOS8
uzKSthWSqtC7DMqgUFaaSjBYM2TN3l402syx71xVFyyAmCcGZbbJcg==
-----END AGE ENCRYPTED FILE-----
- recipient: age1ck5vzs0xqx0jplmuksrkh45xwmkm2t05m2wyq5k2w2mnkmn79fxs6tvl3l
enc: |
-----BEGIN AGE ENCRYPTED FILE-----
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBCSHJVRGIwQUFpVER5SWxq
YjJOT0lXN3dFOFpjMFlWV3JCbmZFN0hnNEJBClpQUEczK2RWTGlVTmJRbVZaUC8y
bEFrL1RjTTNlYVNnRVRBZlRjaTlnUEEKLS0tIE5GM01pTGFFcWVVSWEvUHE3Z08r
a2xybTRFUFZZN20zajZJTVNwVEpGcEEKglmFMk7z1q5IlZ+lZf9M0HtknmvcYt/P
2/z5e8wLN1Hy0Zsbv0yIL/NmqwxAOGJOdzz7ElJszk/Y4kUr9aRasg==
-----END AGE ENCRYPTED FILE-----
lastmodified: "2024-09-01T15:22:09Z"
mac: ENC[AES256_GCM,data:Br2+miNeZI41QyTXdhJ5Mdwq5no/d4kJgESwiltcRZV/Pax8R+GFeLDg/AQFoh1fLHU6bTX45SN0wnIrIeCnkoXV0U2RiT7bdtBaDrGxqnFvjMVE0VaUrj9bpagta13tahsEfI17cyUq4BqwS4BXx60RXvbvs9jZ5/dfpYunGsc=,iv:FfWYfS40XcFgF8lEYK4IHypLzz7svFxPL+WuudQm3oA=,tag:0KDBdf7w6BdcQ8Qt3k1isg==,type:str]
pgp: []
unencrypted_suffix: _unencrypted
version: 3.9.0

44
devices/vps4/default.nix Normal file
View File

@@ -0,0 +1,44 @@
inputs:
{
config =
{
nixos =
{
system =
{
fileSystems =
{
mount =
{
btrfs =
{
"/dev/disk/by-uuid/403fe853-8648-4c16-b2b5-3dfa88aee351"."/boot" = "/boot";
"/dev/mapper/root" = { "/nix" = "/nix"; "/nix/rootfs/current" = "/"; };
};
};
luks.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:04.0";
nixpkgs.march = "znver2";
nix.substituters = [ "https://nix-store.chn.moe?priority=100" ];
initrd.sshd = {};
networking = {};
};
services =
{
snapper.enable = true;
sshd = {};
fail2ban = {};
beesd.instances.root = { device = "/"; hashTableSizeMB = 64; };
xray.server = { serverName = "xserver.vps4.chn.moe"; userNumber = 4; };
};
};
};
}

51
devices/vps4/secrets.yaml Normal file
View File

@@ -0,0 +1,51 @@
xray-server:
clients:
#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:
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: []
azure_kv: []
hc_vault: []
age:
- recipient: age19ax6vm3pv8rph5tq3mmehd9sy9jk823tw8svsd790r0lkslycquqvlwz9m
enc: |
-----BEGIN AGE ENCRYPTED FILE-----
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBNamN1TytweDd3blJsR2ZH
ZmlocFZjT3ZaUjlVbG1vVSt4a2s2SjJIaGtRCjRneDV6cHYwdGJOY1BDVS9DeDVC
cDdNbUdtSGRHNU1yZFpPc1MzRS92ME0KLS0tIFpmamNmTFYrRGRqbTFVSzBhUlNa
VllXdzZ3bEc3UFY0YjZRKzBUcGgyVkUKqI1ojiLbF87alAkEwyrm8wuW2fLbmj8d
YBIpoDCZ7AwR5uHWQAtl7BWJV1zab+rA3zvaf2BsrVA1A+RWOtYT/Q==
-----END AGE ENCRYPTED FILE-----
- recipient: age1yvrl4y0r6yzcxzzkgfwshlrtsjt8uuya6rfwks09pnft7esfcyvqmrtm5q
enc: |
-----BEGIN AGE ENCRYPTED FILE-----
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBWWitsSnRVSzJDZG9ZSE5I
bmt2NEFDanR3aFJyYVNnU1NlUldRb2RUVXhNClQrTkgzR1dPNWp3endZTUl5SmRs
dEtkSWk4aWJEc2hhbWlXZkxpNGhacFUKLS0tIGZNSG43R0NKYmdFMzdXbmJjSExJ
Ri9hM3NRTkM4Q1lDdmdPemEweEFBUmcKNLL5qH+JeFWX0GovkPFVVAnz+4tmfG6/
1jN8YqbMIxf5/L8tauXPf0iIiHa6pUcjtDZPr/OEmeXebmF6Bh9u9Q==
-----END AGE ENCRYPTED FILE-----
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.9.0

View File

@@ -68,7 +68,6 @@ inputs:
main.enable = true;
nekomia.enable = true;
blog = {};
sticker = {};
};
};
coturn = {};
@@ -78,7 +77,7 @@ inputs:
wireguard =
{
enable = true;
peers = [ "pc" "nas" "one" "vps7" "xmupc1" "xmupc2" "pi3b" "srv1-node0" ];
peers = [ "pc" "nas" "vps7" "surface" "xmupc1" "xmupc2" "pi3b" "srv1-node0" ];
publicKey = "AVOsYUKQQCvo3ctst3vNi8XSVWo1Wh15066aHh+KpF4=";
wireguardIp = "192.168.83.1";
listenIp = "74.211.99.69";

View File

@@ -14,7 +14,7 @@ xray-server:
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:AzzKMw==,iv:Z73ISOLhPWP40wTy8PucY3KaB9nS7WQECK3tZFYC1ao=,tag:KJuiCODhHyDl5bXInUSI5g==,type:comment]
#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]
@@ -91,8 +91,8 @@ sops:
ZXFTU3ZCaW1pTVh0RUJzdDdGdHlPYTgK2mlgcX2kEc8+2UDdBnhUm6IIuh8V6agW
ooxH9OEPXUVI/4JcDo4v8ZUhAyU1ehLH0Ef7PJCChOZe2KZmWSNbhA==
-----END AGE ENCRYPTED FILE-----
lastmodified: "2024-12-09T04:05:38Z"
mac: ENC[AES256_GCM,data:ViclEjB/F9dS2fdtKPlegQPdPY9GeHW6AqnBcf18RlG9V+jnyym0RgkrmOiNokbD4WZSO+o/Y//hFzSeiqINHuNs5SvoslXy23bnThrnf8pDeoowJITV3eQZgNw78qKqJxoXft4b79xetSdZasI1W4YxE/PCjdpkOtgJZ7I5oTI=,iv:se5pq320AEnRuZAA3hO7H2LarCJwnK2sTmZU+s4DYBg=,tag:g4aS5C8PWj+mzbSSK61Z3g==,type:str]
lastmodified: "2024-09-26T04:24:17Z"
mac: ENC[AES256_GCM,data:AXhLmyZWGD6KvMkyHqmCERE6eNE3pD5Pa/9mRBWZe4hiXL4mKTzCn5C/ODGQ1ZeQjDdP+awjJRvLRjMiYFhVlU8rKpg/f2G1gDr4cIbr61sCdzXKX8wFW0G7bJWxxpAC4X59+u9EJ3sNcyf7bJrMdkTzTYpgXh29mtl2bprcdJQ=,iv:pK4hYexcWng3GwOmWGqgyMsmATnXgcwR3NH4UxCwpvE=,tag:zpv64JWoXc5cDCukDuW51g==,type:str]
pgp: []
unencrypted_suffix: _unencrypted
version: 3.9.1
version: 3.9.0

View File

@@ -127,8 +127,8 @@ sops:
SnFHS1Z0SXUzTFdEd29KTy9DU3Y3R0UKfhh+rUmWDrf+UGjclP57dHipPLFoXSqy
HdelmfV6q4/c7ppx2E+oZw3VNgoZCsrxxzYZfwxHJiZb+5vkE0D8iA==
-----END AGE ENCRYPTED FILE-----
lastmodified: "2024-11-13T03:06:27Z"
mac: ENC[AES256_GCM,data:aIgKGuyrNWt2etXCtqHXxXwLSTkGhX3wk9NcHXv4u/rkZ3wUz8iJv24whMIN+ZFhQmNV1TLuPncd/O6bYra1YmG0FXSyBkgfQdVbCAR7ys1yXpdz00zcC7zMqm3CeNui89DZH27P5z6cDtNG4Z/dLz6lpln/ummYcdcb+/7KbZQ=,iv:Gl8turVRflUOB3PWqLfwU4JPoy0k9zLKir4CKB9628s=,tag:aJ8PDOfn/XBeklIlSkC2vg==,type:str]
lastmodified: "2024-10-25T08:48:30Z"
mac: ENC[AES256_GCM,data:VtdB55WtONC5orgSMFPuELRVtjAC9REZIscEtWLZ8Cyo+FEYmFAlj+0cg/5aOk4dr2JVUnkcWNyefM8xw7m78yU3f5KruKH0N741ngkovhJnI1V6yuY9om/NXvux6dkYKmQcAXq87rYkoDg5CFxsU9RKJncBMCA7bekebzo0aIw=,iv:7Jv8ciLxXWkCzZeU82Wv8oxBcesjb9/qzWfn9tqyta8=,tag:aEnX4E5w64oY8bbJ5Z8MRg==,type:str]
pgp: []
unencrypted_suffix: _unencrypted
version: 3.9.1

View File

@@ -96,7 +96,7 @@ inputs:
docker = {};
};
bugs = [ "xmunet" "amdpstate" ];
user.users = [ "chn" "xll" "zem" "yjq" "gb" "wp" "hjp" "wm" "lly" "yxf" ];
user.users = [ "chn" "xll" "zem" "yjq" "gb" "wp" "hjp" "wm" "lly" ];
};
services.hardware.bolt.enable = true;
};

View File

@@ -89,7 +89,7 @@ inputs:
docker = {};
};
bugs = [ "xmunet" ];
user.users = [ "chn" "xll" "zem" "yjq" "gb" "wp" "hjp" "wm" "lly" "yxf" ];
user.users = [ "chn" "xll" "zem" "yjq" "gb" "wp" "hjp" "wm" "lly" ];
};
};
}

379
flake.lock generated
View File

@@ -8,16 +8,15 @@
]
},
"locked": {
"lastModified": 1731957371,
"narHash": "sha256-Tf+U5UyjPrmohVywWcrtOT+Cxluo4gJVKpaPlBp8KRg=",
"lastModified": 1730486342,
"narHash": "sha256-/fNj+vW2oE69JMXqyjadxVeuQoWshn+wHp2LHufiVpw=",
"owner": "ezKEa",
"repo": "aagl-gtk-on-nix",
"rev": "203abb8943a35d6163762bc42042b5b41d9910f3",
"rev": "512940696be1969a42d3b89e1e77f9dc7e0641b4",
"type": "github"
},
"original": {
"owner": "ezKEa",
"ref": "release-24.11",
"repo": "aagl-gtk-on-nix",
"type": "github"
}
@@ -25,11 +24,11 @@
"blog": {
"flake": false,
"locked": {
"lastModified": 1731678142,
"narHash": "sha256-glOzOvJtNts0MR/Upt88pEPFWk5j0c97LVxwU1Ld0QA=",
"lastModified": 1730296734,
"narHash": "sha256-GbTFatebZVkpT5kPMJH7jscN5qVNqHCnCIAwbeShQNM=",
"ref": "refs/heads/public",
"rev": "54e09b242cd29e987c43a3205b96f5a0db40bd0a",
"revCount": 7,
"rev": "40fef540abeb027924246907e2d98783fac4b4b9",
"revCount": 5,
"type": "git",
"url": "https://git.chn.moe/chn/blog-public.git"
},
@@ -76,11 +75,11 @@
},
"catppuccin": {
"locked": {
"lastModified": 1731232837,
"narHash": "sha256-0aIwr/RC/oe7rYkfJb47xjdEQDSNcqpFGsEa+EPlDEs=",
"lastModified": 1730458408,
"narHash": "sha256-JQ+SphQn13bdibKUrBBBznYehXX4xJrxD1ifBp6vSWw=",
"owner": "catppuccin",
"repo": "nix",
"rev": "32359bf226fe874d3b7a0a5753d291a4da9616fe",
"rev": "191fbf2d81a63fad8f62f1233c0051f09b75d0ad",
"type": "github"
},
"original": {
@@ -101,11 +100,11 @@
]
},
"locked": {
"lastModified": 1732400024,
"narHash": "sha256-uf1QzIl0Jj5dr7+erWjHWiCUEvywLaR7ir1jcqGgjeQ=",
"lastModified": 1730674629,
"narHash": "sha256-bT4l/nrUvGK5wvUCkq2I5oWphjg3kZXthYcqG7K0uBs=",
"owner": "chaotic-cx",
"repo": "nyx",
"rev": "376a2e022a5d8fa21cecb5bb0fef0cb54db5cdfc",
"rev": "09f0dcfa6a8932850f2291717a271598d3098aad",
"type": "github"
},
"original": {
@@ -149,11 +148,11 @@
"date": {
"flake": false,
"locked": {
"lastModified": 1732291332,
"narHash": "sha256-J03NjeFJ0FXDrKfiGHEJkztfJxG+Nkw9OCgubMOBDwQ=",
"lastModified": 1729448045,
"narHash": "sha256-qfrmH3NRyrDVmHRmmWzM5Zz37E7RFXJqaV1Rq2E59qs=",
"owner": "HowardHinnant",
"repo": "date",
"rev": "f079e3568c9c42f20bd40209b5667f030147069a",
"rev": "5bdb7e6f31fac909c090a46dbd9fea27b6e609a4",
"type": "github"
},
"original": {
@@ -186,11 +185,11 @@
"eigen": {
"flake": false,
"locked": {
"lastModified": 1732246759,
"narHash": "sha256-d0SmmQpiC7/7EIwstnHVcMqRZQV5BLW+HvzrDIT1iSM=",
"lastModified": 1730436603,
"narHash": "sha256-bbmVJabdc6230er1MT/V4GXfrrxLcFs8vGNaiFZUNqo=",
"owner": "libeigen",
"repo": "eigen",
"rev": "8ad4344ca79f2f248bc5ed70eec72e4b9c4d5e88",
"rev": "7fd305ecae2410714cde018cb6851f49138568c8",
"type": "gitlab"
},
"original": {
@@ -362,11 +361,11 @@
"nixpkgs-lib": "nixpkgs-lib"
},
"locked": {
"lastModified": 1730504689,
"narHash": "sha256-hgmguH29K2fvs9szpq2r3pz2/8cJd2LPS+b4tfNFCwE=",
"lastModified": 1727826117,
"narHash": "sha256-K5ZLCyfO/Zj9mPFldf3iwS6oZStJcU4tSpiXTMYaaL0=",
"owner": "hercules-ci",
"repo": "flake-parts",
"rev": "506278e768c2a08bec68eb62932193e341f55c90",
"rev": "3d04084d54bedc3d6b8b736c70ef449225c361b1",
"type": "github"
},
"original": {
@@ -412,11 +411,11 @@
"systems": "systems_2"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"lastModified": 1726560853,
"narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a",
"type": "github"
},
"original": {
@@ -430,11 +429,11 @@
"systems": "systems_3"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"lastModified": 1710146030,
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"type": "github"
},
"original": {
@@ -482,11 +481,11 @@
"git-lfs-transfer": {
"flake": false,
"locked": {
"lastModified": 1731677931,
"narHash": "sha256-upY3xdwFbWpch9m2Sj+vlDdpbl4dKipPCUISfwvFxoc=",
"lastModified": 1728312033,
"narHash": "sha256-YsplPW3i4W1RfkWQI1eGXFXb3JofQwKe+9LbjxeL1cM=",
"owner": "charmbracelet",
"repo": "git-lfs-transfer",
"rev": "b9a7efddbdc611f46ee0b2aed0a8f7d7ca4fb889",
"rev": "422d24414fe4b803849b3f6fe7c4d8ab1b40803b",
"type": "github"
},
"original": {
@@ -536,11 +535,11 @@
"hextra": {
"flake": false,
"locked": {
"lastModified": 1731583139,
"narHash": "sha256-aFpdS/V0B/4ZUXN+FImf2tuXUUYzP5+6jNGyQwZV1ps=",
"lastModified": 1730652798,
"narHash": "sha256-0+vS+s/3hvmpM9EVGsmQ6xrYi4ouLdMINHEjee5erUQ=",
"owner": "imfing",
"repo": "hextra",
"rev": "86a1f3fd9638a65c70fb7892964a396df22409a0",
"rev": "4c4f43779c6de5adf1c61edd4e79aae233965393",
"type": "github"
},
"original": {
@@ -549,24 +548,6 @@
"type": "github"
}
},
"highfive": {
"flake": false,
"locked": {
"lastModified": 1732469115,
"narHash": "sha256-C9gcLlhDd1iJlkW0DtMOi/4leUfo4Phhi9U+xiH/cQw=",
"ref": "refs/heads/master",
"rev": "7f3c91e9a3eff5856f93e61ff1b61060fcfcc636",
"revCount": 722,
"submodules": true,
"type": "git",
"url": "https://github.com/CHN-beta/HighFive"
},
"original": {
"submodules": true,
"type": "git",
"url": "https://github.com/CHN-beta/HighFive"
}
},
"home-manager": {
"inputs": {
"nixpkgs": [
@@ -574,27 +555,26 @@
]
},
"locked": {
"lastModified": 1732466619,
"narHash": "sha256-T1e5oceypZu3Q8vzICjv1X/sGs9XfJRMW5OuXHgpB3c=",
"lastModified": 1730633670,
"narHash": "sha256-ZFJqIXpvVKvzOVFKWNRDyIyAo+GYdmEPaYi1bZB6uf0=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "f3111f62a23451114433888902a55cf0692b408d",
"rev": "8f6ca7855d409aeebe2a582c6fd6b6a8d0bf5661",
"type": "github"
},
"original": {
"owner": "nix-community",
"ref": "release-24.11",
"repo": "home-manager",
"type": "github"
}
},
"impermanence": {
"locked": {
"lastModified": 1731242966,
"narHash": "sha256-B3C3JLbGw0FtLSWCjBxU961gLNv+BOOBC6WvstKLYMw=",
"lastModified": 1730403150,
"narHash": "sha256-W1FH5aJ/GpRCOA7DXT/sJHFpa5r8sq2qAUncWwRZ3Gg=",
"owner": "nix-community",
"repo": "impermanence",
"rev": "3ed3f0eaae9fcc0a8331e77e9319c8a4abd8a71a",
"rev": "0d09341beeaa2367bac5d718df1404bf2ce45e6f",
"type": "github"
},
"original": {
@@ -612,11 +592,11 @@
]
},
"locked": {
"lastModified": 1732032028,
"narHash": "sha256-NjyfJQQxs/a2a/KwTmXM44K7XjeJwGsf4YFtebueQzo=",
"lastModified": 1730625581,
"narHash": "sha256-vFxtzNCxtUIrmv8tluquZHjNTwMkCGtT0NCoVuwlqd4=",
"owner": "Jovian-Experiments",
"repo": "Jovian-NixOS",
"rev": "65dc04371cf914c9af4f073638821e4787303005",
"rev": "e6195c6bfc037617e20d6d7d4d6c9cdeee6aba6d",
"type": "github"
},
"original": {
@@ -628,11 +608,11 @@
"lepton": {
"flake": false,
"locked": {
"lastModified": 1731757089,
"narHash": "sha256-vvCu9LQxi9Sfh2kjfipLu01tO/XOTUsMYR40ubiXL8E=",
"lastModified": 1730725788,
"narHash": "sha256-iqBCjjjwx9uNr5E2eYz9gs9LRdPdTvKb46eZykYljPY=",
"owner": "black7375",
"repo": "Firefox-UI-Fix",
"rev": "190aa839e659c4975d91f80f19cd493021f8bc7a",
"rev": "530b283da01d898d75909385afffacef89ecaa19",
"type": "github"
},
"original": {
@@ -641,14 +621,30 @@
"type": "github"
}
},
"linux-surface": {
"flake": false,
"locked": {
"lastModified": 1729447945,
"narHash": "sha256-DmYbfi7scxWDHlqZA7ZidCnpMexC34+T4DA7yTs5GAI=",
"owner": "linux-surface",
"repo": "linux-surface",
"rev": "260b202ade51ae01f4bf5f4a5516559bd5f04973",
"type": "github"
},
"original": {
"owner": "linux-surface",
"repo": "linux-surface",
"type": "github"
}
},
"lmod": {
"flake": false,
"locked": {
"lastModified": 1732128616,
"narHash": "sha256-uAN5MKOmiKZk4djyRPwvd8euLM/LE5yykzQjlhVL8ZU=",
"lastModified": 1728781056,
"narHash": "sha256-G+6sRJHoJh8IGEAut3U/nFEBkM+ZqeCEghjT2/GzTcY=",
"owner": "TACC",
"repo": "Lmod",
"rev": "b46bcc82b9b37700b84bb0283cec172eda01e5eb",
"rev": "b2068e6bdfacb69ba43511f5a6b6960a2d7824f4",
"type": "github"
},
"original": {
@@ -676,11 +672,11 @@
"misskey": {
"flake": false,
"locked": {
"lastModified": 1732375939,
"narHash": "sha256-ZlyBBJniDJ8yS3ALMQ9gfsVUDTzp/U4Pr3SOtE5FttY=",
"lastModified": 1729490489,
"narHash": "sha256-pYL5gN79GC3GZwjsWG5ufkYGVIg2SHe1ZckJqmUD3MI=",
"ref": "refs/heads/chn-mod",
"rev": "bb3ae0b9c84126dada9ce7e13a42962a8889eba8",
"revCount": 26357,
"rev": "7aa5ed4066b0f48c808defaa0772dd6d703c80fa",
"revCount": 26236,
"submodules": true,
"type": "git",
"url": "https://github.com/CHN-beta/misskey"
@@ -726,11 +722,11 @@
"nc4nix": {
"flake": false,
"locked": {
"lastModified": 1732503843,
"narHash": "sha256-w3BMcrXpwwp0RZApDMNqs8KEQepzQ5N2roliMgN5wT8=",
"lastModified": 1730689542,
"narHash": "sha256-lf60U6B/U/FMuI7HZ+GKp2a/sLN5so8M3qdFBdNZD+g=",
"owner": "helsinki-systems",
"repo": "nc4nix",
"rev": "8368895f664e4fe300183ebd965629ac79378be6",
"rev": "292f924ebbe75718ac7c2e5282842876946e98b1",
"type": "github"
},
"original": {
@@ -741,11 +737,11 @@
},
"nix-flatpak": {
"locked": {
"lastModified": 1732304879,
"narHash": "sha256-/DOW8VadE//HA6tuV2++NowYWi7Wa/FmJHXRJoTQnfQ=",
"lastModified": 1730108712,
"narHash": "sha256-vIvmXmjAQIY39hACGFe/cdBK2r3ZprpHLwX2HIy7Mj8=",
"owner": "gmodena",
"repo": "nix-flatpak",
"rev": "c84579946c03c996916be0fb6e1340f444c277af",
"rev": "1cba177bb0a948c919af7596e40bef307543d40a",
"type": "github"
},
"original": {
@@ -805,11 +801,11 @@
]
},
"locked": {
"lastModified": 1732519917,
"narHash": "sha256-AGXhwHdJV0q/WNgqwrR2zriubLr785b02FphaBtyt1Q=",
"lastModified": 1730604744,
"narHash": "sha256-/MK6QU4iOozJ4oHTfZipGtOgaT/uy/Jm4foCqHQeYR4=",
"owner": "Mic92",
"repo": "nix-index-database",
"rev": "f4a5ca5771ba9ca31ad24a62c8d511a405303436",
"rev": "cc2ddbf2df8ef7cc933543b1b42b845ee4772318",
"type": "github"
},
"original": {
@@ -826,11 +822,11 @@
]
},
"locked": {
"lastModified": 1732519917,
"narHash": "sha256-AGXhwHdJV0q/WNgqwrR2zriubLr785b02FphaBtyt1Q=",
"lastModified": 1729999765,
"narHash": "sha256-LYsavZXitFjjyETZoij8usXjTa7fa9AIF3Sk3MJSX+Y=",
"owner": "nix-community",
"repo": "nix-index-database",
"rev": "f4a5ca5771ba9ca31ad24a62c8d511a405303436",
"rev": "0e3a8778c2ee218eff8de6aacf3d2fa6c33b2d4f",
"type": "github"
},
"original": {
@@ -848,11 +844,11 @@
]
},
"locked": {
"lastModified": 1732499683,
"narHash": "sha256-Hw95rpgNiyAL4v9pJF2756PMud6O0p/1XQixs5f/Shk=",
"lastModified": 1730685024,
"narHash": "sha256-w0cQSTjLBaUSziPGwyI0nbWVD64+N3ByoSxC0CEZmeI=",
"owner": "nix-community",
"repo": "nix-vscode-extensions",
"rev": "b376bfa567fd25f9f22b6f51ffaa4f84d0b7c72f",
"rev": "16ca007ec37c29a8b97e4899f33c013defbdb2f9",
"type": "github"
},
"original": {
@@ -861,6 +857,21 @@
"type": "github"
}
},
"nixos-hardware": {
"locked": {
"lastModified": 1731081747,
"narHash": "sha256-BgZn+3MhbT9voNKTQ5jJopMUAGEej+QcA+HrSS82emo=",
"owner": "CHN-beta",
"repo": "nixos-hardware",
"rev": "c34bd0cab7dfa87b23334fe853dcd200378d261c",
"type": "github"
},
"original": {
"owner": "CHN-beta",
"repo": "nixos-hardware",
"type": "github"
}
},
"nixos-stable": {
"locked": {
"lastModified": 1720535198,
@@ -895,11 +906,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1733112343,
"narHash": "sha256-m3lTc9Ox5dSk4qh21KYHdTM8XawO3Aw1Vo8amzQdYOs=",
"lastModified": 1731201500,
"narHash": "sha256-pgDOLi5nE3rmyzqG1Og97LyHFFVV2+jcA6pHK9lPnxo=",
"owner": "CHN-beta",
"repo": "nixpkgs",
"rev": "14db57c1be0752022482dabbc6229a7a10ccd6c5",
"rev": "a72d95cf9e025ce0d09baa968cbe9532a0687ee6",
"type": "github"
},
"original": {
@@ -927,11 +938,11 @@
},
"nixpkgs-23.11": {
"locked": {
"lastModified": 1733710340,
"narHash": "sha256-+USCPTSnxB1Mx5Klyh6RNhWhce3YsPY+CjNLs6mOD5A=",
"lastModified": 1716265408,
"narHash": "sha256-i5aFF2iw707QrRvLNiLG936p3GXXulDMTKSknhBGwYI=",
"owner": "CHN-beta",
"repo": "nixpkgs",
"rev": "291b26c472d9f4b2840fd625eec6c49c3023deac",
"rev": "c64afe35ab605d20caf19e4bff3ff816b1944c24",
"type": "github"
},
"original": {
@@ -943,11 +954,11 @@
},
"nixpkgs-24_05": {
"locked": {
"lastModified": 1731797254,
"narHash": "sha256-df3dJApLPhd11AlueuoN0Q4fHo/hagP75LlM5K1sz9g=",
"lastModified": 1730137625,
"narHash": "sha256-9z8oOgFZiaguj+bbi3k4QhAD6JabWrnv7fscC/mt0KE=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "e8c38b73aeb218e27163376a2d617e61a2ad9b59",
"rev": "64b80bfb316b57cdb8919a9110ef63393d74382a",
"type": "github"
},
"original": {
@@ -959,23 +970,23 @@
},
"nixpkgs-lib": {
"locked": {
"lastModified": 1730504152,
"narHash": "sha256-lXvH/vOfb4aGYyvFmZK/HlsNsr/0CVWlwYvo2rxJk3s=",
"lastModified": 1727825735,
"narHash": "sha256-0xHYkMkeLVQAMa7gvkddbPqpxph+hDzdu1XdGPJR+Os=",
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/cc2f28000298e1269cea6612cd06ec9979dd5d7f.tar.gz"
"url": "https://github.com/NixOS/nixpkgs/archive/fb192fec7cc7a4c26d51779e9bab07ce6fa5597a.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://github.com/NixOS/nixpkgs/archive/cc2f28000298e1269cea6612cd06ec9979dd5d7f.tar.gz"
"url": "https://github.com/NixOS/nixpkgs/archive/fb192fec7cc7a4c26d51779e9bab07ce6fa5597a.tar.gz"
}
},
"nixpkgs-stable": {
"locked": {
"lastModified": 1730741070,
"narHash": "sha256-edm8WG19kWozJ/GqyYx2VjW99EdhjKwbY3ZwdlPAAlo=",
"lastModified": 1720386169,
"narHash": "sha256-NGKVY4PjzwAa4upkGtAMz1npHGoRzWotlSnVlqI40mo=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "d063c1dd113c91ab27959ba540c0d9753409edf3",
"rev": "194846768975b7ad2c4988bdb82572c00222c0d7",
"type": "github"
},
"original": {
@@ -988,11 +999,11 @@
"nu-scripts": {
"flake": false,
"locked": {
"lastModified": 1732251065,
"narHash": "sha256-8w9//q58zPhGXCfXZeI7FS1UUD2JgBw49X62uFEI7jw=",
"lastModified": 1730201512,
"narHash": "sha256-WlvUtd1XK6GWLNU1xcORRY0OPtumndlhX55R0/xsiH4=",
"owner": "nushell",
"repo": "nu_scripts",
"rev": "dee0e7efcd9387da8e94f35c38472b9d4e7c225f",
"rev": "58f8c75688f4718d1be0ddc5312ac2a99da5a43e",
"type": "github"
},
"original": {
@@ -1015,11 +1026,11 @@
"treefmt-nix": "treefmt-nix_2"
},
"locked": {
"lastModified": 1732386739,
"narHash": "sha256-87sRkBmTkL72K04IoxiwexeYfq35hS5FEbE/6AIAk+c=",
"lastModified": 1730597556,
"narHash": "sha256-9jiePPc/M8bKSCA7mAknuMYLzOokx8F1aZv+CC6uX+Q=",
"owner": "linyinfeng",
"repo": "nur-packages",
"rev": "11589e3ac45c5e16a3bb25a24f851bae284957dc",
"rev": "6f8b5661b71982cd0b41e9e34d7e5e214085ed60",
"type": "github"
},
"original": {
@@ -1041,11 +1052,11 @@
"treefmt-nix": "treefmt-nix_3"
},
"locked": {
"lastModified": 1732529571,
"narHash": "sha256-x7rE2y5xTurtDcdKQIkg/6agZ+yJS/KkNOCg4fs5Qc4=",
"lastModified": 1730683468,
"narHash": "sha256-tS18SIcsECqQbusCxC4ygUcGAl1gtCdBJLHAHsZrl88=",
"owner": "xddxdd",
"repo": "nur-packages",
"rev": "9e811ec5e489bb1a338bf53a2b8c0e2bcb0ef986",
"rev": "1ef1b4470b1dd5efe4883d7c7f8e406a5a86cbd3",
"type": "github"
},
"original": {
@@ -1070,11 +1081,11 @@
]
},
"locked": {
"lastModified": 1732172653,
"narHash": "sha256-GVjVivAz2AW7WNqpWTA5Uy9vN8Wh/3pjuZRFhsGVk24=",
"lastModified": 1718252448,
"narHash": "sha256-xZZBdKqe1ByITzvx65pVgGQ5jeb73MybjgrcfI84lEo=",
"owner": "berberman",
"repo": "nvfetcher",
"rev": "15778ffefbeed7224594301161b0a204a76177bb",
"rev": "fa7609950023462c6f91c425de7610c0bb6b86ba",
"type": "github"
},
"original": {
@@ -1093,11 +1104,11 @@
]
},
"locked": {
"lastModified": 1732501185,
"narHash": "sha256-Z0BpHelaGQsE5VD9hBsBHsvMU9h+Xt0kfkDJyFivZOU=",
"lastModified": 1718252448,
"narHash": "sha256-xZZBdKqe1ByITzvx65pVgGQ5jeb73MybjgrcfI84lEo=",
"owner": "berberman",
"repo": "nvfetcher",
"rev": "bdb14eab6fe9cefc29efe01e60c3a3f616d6b62a",
"rev": "fa7609950023462c6f91c425de7610c0bb6b86ba",
"type": "github"
},
"original": {
@@ -1133,11 +1144,11 @@
]
},
"locked": {
"lastModified": 1732465698,
"narHash": "sha256-xiue+Kj2Jm8PwyZQcHl4CaYmMIgo5oi37hVHqiw2Unk=",
"lastModified": 1730635861,
"narHash": "sha256-Npp3pl9aeAiq+wZPDbw2ZxybNuZWyuN7AY6fik56DCo=",
"owner": "pjones",
"repo": "plasma-manager",
"rev": "16d65cd02b5de665d1bcfec1616c02c71a1014a6",
"rev": "293668587937daae1df085ee36d2b2d0792b7a0f",
"type": "github"
},
"original": {
@@ -1173,11 +1184,11 @@
"treefmt-nix": "treefmt-nix_4"
},
"locked": {
"lastModified": 1731205797,
"narHash": "sha256-F7N1mxH1VrkVNHR3JGNMRvp9+98KYO4b832KS8Gl2xI=",
"lastModified": 1730284601,
"narHash": "sha256-eHYcKVLIRRv3J1vjmxurS6HVdGphB53qxUeAkylYrZY=",
"owner": "nix-community",
"repo": "poetry2nix",
"rev": "f554d27c1544d9c56e5f1f8e2b8aff399803674e",
"rev": "43a898b4d76f7f3f70df77a2cc2d40096bc9d75e",
"type": "github"
},
"original": {
@@ -1197,11 +1208,11 @@
"nixpkgs-stable": "nixpkgs-stable"
},
"locked": {
"lastModified": 1732021966,
"narHash": "sha256-mnTbjpdqF0luOkou8ZFi2asa1N3AA2CchR/RqCNmsGE=",
"lastModified": 1730302582,
"narHash": "sha256-W1MIJpADXQCgosJZT8qBYLRuZls2KSiKdpnTVdKBuvU=",
"owner": "cachix",
"repo": "pre-commit-hooks.nix",
"rev": "3308484d1a443fc5bc92012435d79e80458fe43c",
"rev": "af8a16fe5c264f5e9e18bcee2859b40a656876cf",
"type": "github"
},
"original": {
@@ -1213,11 +1224,11 @@
"py4vasp": {
"flake": false,
"locked": {
"lastModified": 1731589693,
"narHash": "sha256-Y+Y9xzxHZ4+qZgXSCSVILqcTp6Z9n8TM2NxHlIMm2xY=",
"lastModified": 1728372041,
"narHash": "sha256-J3b0Wl5MLZdWRQYlV13SBM6ga2Jl+rnfWzWxXpKUWdA=",
"owner": "vasp-dev",
"repo": "py4vasp",
"rev": "3596b6ab92df6618426f3fdfce1da614f085c712",
"rev": "bf692b9d160526be9772f529963a2080b923bbb6",
"type": "github"
},
"original": {
@@ -1233,11 +1244,11 @@
]
},
"locked": {
"lastModified": 1732453966,
"narHash": "sha256-gjNXCgbBT+XTe+EHuX2JCW2I/L46MGT0ZfYMCZYkoSg=",
"lastModified": 1729862339,
"narHash": "sha256-681g/vv+ZNnhT/5U1dJvORk4vnsrbgtGUumhMuO0meM=",
"owner": "Nix-QChem",
"repo": "NixOS-QChem",
"rev": "bf677ae4ceaf4f3a3f2a4f203f9f46126c579910",
"rev": "6b4144e50a901785dee3271763a3d23a1079a9f1",
"type": "github"
},
"original": {
@@ -1263,10 +1274,10 @@
"git-lfs-transfer": "git-lfs-transfer",
"gricad": "gricad",
"hextra": "hextra",
"highfive": "highfive",
"home-manager": "home-manager",
"impermanence": "impermanence",
"lepton": "lepton",
"linux-surface": "linux-surface",
"lmod": "lmod",
"matplotplusplus": "matplotplusplus",
"misskey": "misskey",
@@ -1276,6 +1287,7 @@
"nix-flatpak": "nix-flatpak",
"nix-index-database": "nix-index-database",
"nix-vscode-extensions": "nix-vscode-extensions",
"nixos-hardware": "nixos-hardware",
"nixos-wallpaper": "nixos-wallpaper",
"nixpkgs": "nixpkgs",
"nixpkgs-23.05": "nixpkgs-23.05",
@@ -1296,11 +1308,8 @@
"sops-nix": "sops-nix",
"spectroscopy": "spectroscopy",
"sqlite-orm": "sqlite-orm",
"stickerpicker": "stickerpicker",
"tgbot-cpp": "tgbot-cpp",
"ufo": "ufo",
"v-sim": "v-sim",
"vaspberry": "vaspberry",
"winapps": "winapps",
"zpp-bits": "zpp-bits"
}
@@ -1308,11 +1317,11 @@
"rsshub": {
"flake": false,
"locked": {
"lastModified": 1732525101,
"narHash": "sha256-9gsT7wtMnYGgNSkeLj9Qbt3spGoFHomsqD/iLV3/xpo=",
"lastModified": 1730730911,
"narHash": "sha256-BOtky6VbmBzHGSr6xS5s4LEGPhlvDgodq2HRCbHdtz8=",
"owner": "DIYgod",
"repo": "RSSHub",
"rev": "d17b40b53931892fcdf986a1e14e67759f7ed558",
"rev": "a5700169a07774c0755517879db610c8bcc97284",
"type": "github"
},
"original": {
@@ -1324,11 +1333,11 @@
"rycee": {
"flake": false,
"locked": {
"lastModified": 1732479769,
"narHash": "sha256-barZy95JsQt4G9EDZ7RNrjgTneelXXfSzRLJJvokjsI=",
"lastModified": 1730693000,
"narHash": "sha256-baSXoP6mctfc29ZzMS8AFJfJPnE6Vm4qZ0kjC/G3qs8=",
"owner": "rycee",
"repo": "nur-expressions",
"rev": "80bf66046d8b8624c5991a0c8e512b211acce2b2",
"rev": "9c9f6b64926d03dba28f3088887699cc7f5da1f5",
"type": "gitlab"
},
"original": {
@@ -1373,14 +1382,17 @@
"inputs": {
"nixpkgs": [
"nixpkgs"
],
"nixpkgs-stable": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1732186149,
"narHash": "sha256-N9JGWe/T8BC0Tss2Cv30plvZUYoiRmykP7ZdY2on2b0=",
"lastModified": 1730605784,
"narHash": "sha256-1NveNAMLHbxOg0BpBMSVuZ2yW2PpDnZLbZ25wV50PMc=",
"owner": "Mic92",
"repo": "sops-nix",
"rev": "53c853fb1a7e4f25f68805ee25c83d5de18dc699",
"rev": "e9b5eef9b51cdf966c76143e13a9476725b2f760",
"type": "github"
},
"original": {
@@ -1421,22 +1433,6 @@
"type": "github"
}
},
"stickerpicker": {
"flake": false,
"locked": {
"lastModified": 1718796561,
"narHash": "sha256-RKAAHve17lrJokgAPkM2k/E+f9djencwwg3Xcd70Yfw=",
"owner": "maunium",
"repo": "stickerpicker",
"rev": "333567f481e60443360aa7199d481e1a45b3a523",
"type": "github"
},
"original": {
"owner": "maunium",
"repo": "stickerpicker",
"type": "github"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
@@ -1571,11 +1567,11 @@
]
},
"locked": {
"lastModified": 1732292307,
"narHash": "sha256-5WSng844vXt8uytT5djmqBCkopyle6ciFgteuA9bJpw=",
"lastModified": 1730321837,
"narHash": "sha256-vK+a09qq19QNu2MlLcvN4qcRctJbqWkX7ahgPZ/+maI=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "705df92694af7093dfbb27109ce16d828a79155f",
"rev": "746901bb8dba96d154b66492a29f5db0693dbfcc",
"type": "github"
},
"original": {
@@ -1592,11 +1588,11 @@
]
},
"locked": {
"lastModified": 1732292307,
"narHash": "sha256-5WSng844vXt8uytT5djmqBCkopyle6ciFgteuA9bJpw=",
"lastModified": 1730321837,
"narHash": "sha256-vK+a09qq19QNu2MlLcvN4qcRctJbqWkX7ahgPZ/+maI=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "705df92694af7093dfbb27109ce16d828a79155f",
"rev": "746901bb8dba96d154b66492a29f5db0693dbfcc",
"type": "github"
},
"original": {
@@ -1626,55 +1622,22 @@
"type": "github"
}
},
"ufo": {
"flake": false,
"locked": {
"lastModified": 1733296869,
"narHash": "sha256-CBXaEPfXe2ENpZdm97Scr5ZOLpI1czoa8L8N3K8ITVU=",
"ref": "refs/heads/main",
"rev": "d584951fd71867f37aca6ba50e276591ce7d3451",
"revCount": 74,
"type": "git",
"url": "https://git.chn.moe/chn/ufo.git"
},
"original": {
"type": "git",
"url": "https://git.chn.moe/chn/ufo.git"
}
},
"v-sim": {
"flake": false,
"locked": {
"lastModified": 1594997908,
"narHash": "sha256-+iuu2kuVQEt2CTjo4g/5jnk2ZAllspxujnFuyp7CAMw=",
"lastModified": 1726128818,
"narHash": "sha256-DsTsqmboCzTjrykPFde4PyQpjQ2ZW0yUmyWQGkZcYmI=",
"owner": "l_sim",
"repo": "v_sim",
"rev": "b76501454b489715495a255347d5c7f756e1207f",
"rev": "8e6b879bcc513d776b31150d7edb4f60049035eb",
"type": "gitlab"
},
"original": {
"owner": "l_sim",
"ref": "master",
"repo": "v_sim",
"type": "gitlab"
}
},
"vaspberry": {
"flake": false,
"locked": {
"lastModified": 1724474006,
"narHash": "sha256-3cmidQRusbEdEog6e6Qe0IKBRpscrX2ghU/HApaNcys=",
"owner": "Infant83",
"repo": "VASPBERRY",
"rev": "3b5efc9ed6b748b1149278748024ffeb140ecfdb",
"type": "github"
},
"original": {
"owner": "Infant83",
"repo": "VASPBERRY",
"type": "github"
}
},
"winapps": {
"inputs": {
"flake-compat": "flake-compat_6",
@@ -1701,11 +1664,11 @@
"zpp-bits": {
"flake": false,
"locked": {
"lastModified": 1731434662,
"narHash": "sha256-e7ETOeSQZ52aD5CMLapMQ2IJUCYbAT3MzuyCxkZPKSk=",
"lastModified": 1726003541,
"narHash": "sha256-VFWJa1gWuKdSpo4swv8qNNsqBVjjcZwUwJsPUK2mVak=",
"owner": "eyalz800",
"repo": "zpp_bits",
"rev": "80d70a6692990969155b5bbb261fd8cbca077d95",
"rev": "244f9c612f668bd466e2ee378a4998d3c577332c",
"type": "github"
},
"original": {

View File

@@ -6,8 +6,12 @@
nixpkgs.url = "github:CHN-beta/nixpkgs/nixos-24.11";
"nixpkgs-23.11".url = "github:CHN-beta/nixpkgs/nixos-23.11";
"nixpkgs-23.05".url = "github:CHN-beta/nixpkgs/nixos-23.05";
home-manager = { url = "github:nix-community/home-manager/release-24.11"; inputs.nixpkgs.follows = "nixpkgs"; };
sops-nix = { url = "github:Mic92/sops-nix"; 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"; };
};
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"; };
@@ -19,6 +23,7 @@
inputs = { nixpkgs.follows = "nixpkgs"; home-manager.follows = "home-manager"; };
};
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"; };
nix-flatpak.url = "github:gmodena/nix-flatpak";
chaotic =
@@ -31,7 +36,7 @@
bscpkgs = { url = "git+https://git.chn.moe/chn/bscpkgs.git"; inputs.nixpkgs.follows = "nixpkgs"; };
poetry2nix = { url = "github:nix-community/poetry2nix"; inputs.nixpkgs.follows = "nixpkgs"; };
winapps = { url = "github:winapps-org/winapps/feat-nix-packaging"; inputs.nixpkgs.follows = "nixpkgs"; };
aagl = { url = "github:ezKEa/aagl-gtk-on-nix/release-24.11"; inputs.nixpkgs.follows = "nixpkgs"; };
aagl = { url = "github:ezKEa/aagl-gtk-on-nix"; inputs.nixpkgs.follows = "nixpkgs"; };
misskey = { url = "git+https://github.com/CHN-beta/misskey?submodules=1"; flake = false; };
rsshub = { url = "github:DIYgod/RSSHub"; flake = false; };
@@ -43,10 +48,11 @@
matplotplusplus = { url = "github:alandefreitas/matplotplusplus"; flake = false; };
nameof = { url = "github:Neargye/nameof"; flake = false; };
tgbot-cpp = { url = "github:reo7sp/tgbot-cpp"; flake = false; };
v-sim = { url = "gitlab:l_sim/v_sim/master"; flake = false; };
v-sim = { url = "gitlab:l_sim/v_sim"; 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; };
linux-surface = { url = "github:linux-surface/linux-surface"; flake = false; };
lepton = { url = "github:black7375/Firefox-UI-Fix"; flake = false; };
lmod = { url = "github:TACC/Lmod"; flake = false; };
mumax = { url = "github:CHN-beta/mumax"; flake = false; };
@@ -62,10 +68,6 @@
blog = { url = "git+https://git.chn.moe/chn/blog-public.git"; flake = false; };
nixos-wallpaper = { url = "git+https://git.chn.moe/chn/nixos-wallpaper.git"; flake = false; };
spectroscopy = { url = "github:skelton-group/Phonopy-Spectroscopy"; flake = false; };
vaspberry = { url = "github:Infant83/VASPBERRY"; flake = false; };
ufo = { url = "git+https://git.chn.moe/chn/ufo.git"; flake = false; };
highfive = { url = "git+https://github.com/CHN-beta/HighFive?submodules=1"; flake = false; };
stickerpicker = { url = "github:maunium/stickerpicker"; flake = false; };
};
outputs = inputs: let localLib = import ./flake/lib.nix inputs.nixpkgs.lib; in

View File

@@ -5,28 +5,24 @@
inputsFrom = [ pkgs.localPackages.biu ];
packages = [ pkgs.clang-tools_18 ];
CMAKE_EXPORT_COMPILE_COMMANDS = "1";
hardeningDisable = [ "all" ];
};
hpcstat = pkgs.mkShell.override { stdenv = pkgs.clang18Stdenv; }
{
inputsFrom = [ (pkgs.localPackages.hpcstat.override { version = null; }) ];
packages = [ pkgs.clang-tools_18 ];
CMAKE_EXPORT_COMPILE_COMMANDS = "1";
hardeningDisable = [ "all" ];
};
sbatch-tui = pkgs.mkShell.override { stdenv = pkgs.clang18Stdenv; }
{
inputsFrom = [ pkgs.localPackages.sbatch-tui ];
packages = [ pkgs.clang-tools_18 ];
CMAKE_EXPORT_COMPILE_COMMANDS = "1";
hardeningDisable = [ "all" ];
};
ufo = pkgs.mkShell.override { stdenv = pkgs.clang18Stdenv; }
{
inputsFrom = [ pkgs.localPackages.ufo ];
packages = [ pkgs.clang-tools_18 ];
CMAKE_EXPORT_COMPILE_COMMANDS = "1";
hardeningDisable = [ "all" ];
};
chn-bsub = pkgs.mkShell
{

View File

@@ -23,7 +23,7 @@ builtins.listToAttrs
];
};
})
[ "nas" "pc" "pi3b" "vps6" "vps7" "xmupc1" "xmupc2" "one" ])
[ "nas" "pc" "pi3b" "surface" "vps4" "vps6" "vps7" "xmupc1" "xmupc2" ])
++ (builtins.map
(node:
{

View File

@@ -23,11 +23,6 @@
};
chn-bsub = pkgs.pkgsStatic.localPackages.chn-bsub;
blog = pkgs.callPackage inputs.blog { inherit (inputs) hextra; };
vaspberry = pkgs.pkgsStatic.localPackages.vaspberry.override
{
gfortran = pkgs.pkgsStatic.gfortran;
lapack = pkgs.pkgsStatic.openblas;
};
}
// (builtins.listToAttrs (builtins.map
(system: { inherit (system) name; value = system.value.config.system.build.toplevel; })

View File

@@ -1,10 +1,4 @@
{ inputs }: let inherit (inputs.self.packages.x86_64-linux) pkgs; in
{
git-lfs-transfer = "sha256-V2cnWCyzxwxlOXXTB8Kz4X4VHvu0H/SqHBzPFwlp73o=";
iso = pkgs.fetchurl
{
url = "https://releases.nixos.org/nixos/24.11/nixos-24.11beta709057.0c582677378f"
+ "/nixos-plasma6-24.11beta709057.0c582677378f-x86_64-linux.iso";
sha256 = "000wmfn6k5awqwsx9qldhdgahv4k09w4yzmvf0djs51qjdpha082";
};
git-lfs-transfer = "sha256-1cGlhLdnU6yTqzcB3J1cq3gawncbtdgkb3LFh2ZmXbM=";
}

View File

@@ -47,8 +47,8 @@ inputs:
let packages = with inputs.pkgs;
{
# TODO: import from nixos-hardware instead
# enableHybridCodec is only needed for some old intel gpus (Atom, Nxxx, etc)
intel = [ intel-vaapi-driver libvdpau-va-gl intel-media-driver ];
intel =
[ (intel-vaapi-driver.override { enableHybridCodec = true; }) libvdpau-va-gl intel-media-driver ];
nvidia = [ vaapiVdpau ];
amd = [];
};
@@ -66,6 +66,10 @@ inputs:
};
};
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;

View File

@@ -4,7 +4,8 @@ inputs:
{
hostname = mkOption { type = types.nonEmptyStr; };
type = mkOption { type = types.enum [ "minimal" "desktop" "server" ]; default = "minimal"; };
private = mkOption { type = types.bool; default = false; };
# not implemented yet
# private = mkOption { type = types.bool; };
cluster = mkOption
{
type = types.nullOr (types.submodule { options =

View File

@@ -1,12 +0,0 @@
inputs:
{
options.nixos.packages.android-studio = let inherit (inputs.lib) mkOption types; in mkOption
{
type = types.nullOr (types.submodule {});
default = null;
};
config = let inherit (inputs.config.nixos.packages) android-studio; in inputs.lib.mkIf (android-studio != null)
{
nixos.packages.packages._packages = with inputs.pkgs; [ androidStudioPackages.stable.full ];
};
}

View File

@@ -12,22 +12,18 @@ inputs:
_packages = mkOption { type = types.listOf types.unspecified; default = []; };
_pythonPackages = mkOption { type = types.listOf types.unspecified; default = []; };
_prebuildPackages = mkOption { type = types.listOf types.unspecified; default = []; };
_pythonEnvFlags = mkOption { type = types.listOf types.nonEmptyStr; default = []; };
_vscodeEnvFlags = mkOption { type = types.listOf types.nonEmptyStr; default = []; };
};
config =
{
environment.systemPackages = with inputs.config.nixos.packages.packages;
(inputs.lib.lists.subtractLists excludePackages (_packages ++ extraPackages))
++ [
(
(inputs.pkgs.python3.withPackages (pythonPackages:
inputs.lib.lists.subtractLists
(builtins.concatLists (builtins.map (packageFunction: packageFunction pythonPackages)
excludePythonPackages))
(builtins.concatLists (builtins.map (packageFunction: packageFunction pythonPackages)
(_pythonPackages ++ extraPythonPackages)))))
.override (prev: { makeWrapperArgs = prev.makeWrapperArgs or [] ++ _pythonEnvFlags; }))
(inputs.pkgs.python3.withPackages (pythonPackages:
inputs.lib.lists.subtractLists
(builtins.concatLists (builtins.map (packageFunction: packageFunction pythonPackages)
excludePythonPackages))
(builtins.concatLists (builtins.map (packageFunction: packageFunction pythonPackages)
(_pythonPackages ++ extraPythonPackages)))))
(inputs.pkgs.writeTextDir "share/prebuild-packages"
(builtins.concatStringsSep "\n" (builtins.map builtins.toString
(inputs.lib.lists.subtractLists excludePrebuildPackages (_prebuildPackages ++ extraPrebuildPackages)))))

View File

@@ -16,7 +16,7 @@ inputs:
# 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 wl-mirror geekbench xpra
kdePackages.qtstyleplugin-kvantum ventoy-full cpu-x wl-mirror
(
writeShellScriptBin "xclip"
''
@@ -43,7 +43,7 @@ inputs:
warp-terminal
# development
adb-sync scrcpy dbeaver-bin cling aircrack-ng
weston cage openbox krita jetbrains.clion fprettify
weston cage openbox krita jetbrains.clion androidStudioPackages.stable.full fprettify
# desktop sharing
rustdesk-flutter
# password and key management
@@ -52,7 +52,7 @@ inputs:
# download
qbittorrent nur-xddxdd.baidupcs-go wgetpaste onedrive onedrivegui rclone
# editor
typora appflowy notion-app-enhanced joplin-desktop standardnotes logseq
typora # appflowy notion-app-enhanced joplin-desktop standardnotes logseq
# news
fluent-reader rssguard newsflash newsboat
# nix tools
@@ -65,14 +65,15 @@ inputs:
google-chrome tor-browser microsoft-edge
# office
crow-translate zotero pandoc libreoffice-qt texliveFull poppler_utils pdftk pdfchain davinci-resolve
ydict texstudio panoply pspp
# TODO: enable in next release
# hdfview
ydict texstudio
# matplot++ needs old gnuplot
inputs.pkgs."pkgs-23.11".gnuplot
# math, physics and chemistry
octaveFull ovito localPackages.vesta localPackages.v-sim jmol mpi geogebra6 localPackages.ufo
(quantum-espresso.override { stdenv = gcc14Stdenv; gfortran = gfortran14;
wannier90 = inputs.pkgs.wannier90.overrideAttrs { buildFlags = [ "dynlib" ]; }; })
inputs.pkgs."pkgs-23.11".hdfview
octaveFull root ovito localPackages.vesta localPackages.v-sim
(mathematica.overrideAttrs (prev: { postInstall = (prev.postInstall or "") + "ln -s ${prev.src} $out/src"; }))
(quantum-espresso.override { stdenv = gcc14Stdenv; gfortran = gfortran14; }) jmol mpi localPackages.ufo
# virtualization
virt-viewer bottles wineWowPackages.stagingFull genymotion playonlinux
# media

View File

@@ -1,13 +0,0 @@
inputs:
{
options.nixos.packages.mathematica = let inherit (inputs.lib) mkOption types; in mkOption
{
type = types.nullOr (types.submodule {});
default = null;
};
config = let inherit (inputs.config.nixos.packages) mathematica; in inputs.lib.mkIf (mathematica != null)
{
nixos.packages.packages._packages = [ (inputs.pkgs.mathematica.overrideAttrs
(prev: { postInstall = (prev.postInstall or "") + "ln -s ${prev.src} $out/src"; })) ];
};
}

View File

@@ -1,40 +0,0 @@
inputs:
{
options.nixos.packages.root = let inherit (inputs.lib) mkOption types; in mkOption
{ type = types.nullOr (types.submodule {}); default = {}; };
config = let inherit (inputs.config.nixos.packages) root; in inputs.lib.mkIf (root != null)
{
nixos.packages.packages =
let
root = inputs.pkgs.root.overrideAttrs rec
{
version = "6.34.00-rc1";
src = inputs.pkgs.fetchurl
{
url = "https://root.cern/download/root_v${version}.source.tar.gz";
sha256 = "1fx6nyv3drcb16a36np7h3vmjlm937j6y9vxkv0sny0grrxcj9lw";
};
patches = [];
};
jupyterPath = inputs.pkgs.jupyter-kernel.create { definitions.root = rec
{
displayName = "ROOT";
language = "c++";
argv = [ "/run/current-system/sw/bin/python3" "-m" "JupyROOT.kernel.rootkernel" "-f" "{connection_file}" ];
logo64 = "${root}/etc/root/notebook/kernels/root/logo-64x64.png";
logo32 = inputs.pkgs.runCommand "logo-32x32.png" {}
"${inputs.pkgs.imagemagick}/bin/convert ${logo64} -resize 32x32 $out";
};};
in
{
_packages = [ root ];
_pythonPackages = [(pythonPackages: with pythonPackages; [ metakernel notebook ])];
_pythonEnvFlags =
[
"--prefix JUPYTER_PATH : ${jupyterPath}"
"--suffix NIX_PYTHONPATH : ${root}/lib"
];
_vscodeEnvFlags = [ "--prefix JUPYTER_PATH : ${jupyterPath}" ];
};
};
}

View File

@@ -9,10 +9,10 @@ inputs:
_packages = with inputs.pkgs;
[
# basic tools
beep dos2unix gnugrep pv tmux screen parallel tldr cowsay jq yq zellij ipfetch localPackages.pslist
beep dos2unix gnugrep pv tmux screen parallel tldr cowsay jq zellij ipfetch localPackages.pslist
fastfetch reptyr duc ncdu progress libva-utils ksh neofetch
# lsxx
pciutils usbutils lshw util-linux lsof dmidecode lm_sensors hwloc acpica-tools
pciutils usbutils lshw util-linux lsof dmidecode lm_sensors hwloc
# top
iotop iftop htop btop powertop s-tui
# editor
@@ -36,7 +36,7 @@ inputs:
# development
gdb try inputs.topInputs.plasma-manager.packages.${inputs.pkgs.system}.rc2nix rr hexo-cli gh nix-init hugo
# stupid things
toilet lolcat localPackages.stickerpicker graph-easy
toilet lolcat
# office
pdfgrep ffmpeg-full # todo-txt-cli
]

View File

@@ -7,6 +7,16 @@ inputs:
services.openssh.knownHosts =
let servers =
{
vps4 =
{
ed25519 = "AAAAC3NzaC1lZDI1NTE5AAAAIF7Y0tjt1XLPjqJ8HEB26W9jVfJafRQ3pv5AbPaxEc/Z";
hostnames = [ "vps4.chn.moe" "104.234.37.61" ];
};
"initrd.vps4" =
{
ed25519 = "AAAAC3NzaC1lZDI1NTE5AAAAIJkOPTFvX9f+Fn/KHOIvUgoRiJfq02T42lVGQhpMUGJq";
hostnames = [ "initrd.vps4.chn.moe" "104.234.37.61" ];
};
vps6 =
{
ed25519 = "AAAAC3NzaC1lZDI1NTE5AAAAIO5ZcvyRyOnUCuRtqrM/Qf+AdUe3a5bhbnfyhw2FSLDZ";
@@ -37,15 +47,15 @@ inputs:
ed25519 = "AAAAC3NzaC1lZDI1NTE5AAAAIAoMu0HEaFQsnlJL0L6isnkNZdRq0OiDXyaX3+fl3NjT";
hostnames = [ "initrd.nas.chn.moe" "192.168.1.2" ];
};
one =
surface =
{
ed25519 = "AAAAC3NzaC1lZDI1NTE5AAAAIC5i2Z/vK0D5DBRg3WBzS2ejM0U+w3ZPDJRJySdPcJ5d";
hostnames = [ "wireguard.one.chn.moe" "192.168.1.4" "192.168.83.5" ];
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.3" "192.168.83.3" ];
hostnames = [ "wireguard.pc.chn.moe" "[office.chn.moe]:3673" "192.168.1.105" "192.168.83.3" ];
};
hpc =
{
@@ -121,10 +131,10 @@ inputs:
(
(builtins.map
(host: { name = host; value = { inherit host; hostname = "${host}.chn.moe"; }; })
[ "vps6" "wireguard.vps6" "vps7" "wireguard.vps7" "wireguard.nas" "wireguard.one" ])
[ "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.xmupc1" "wireguard.xmupc2" "srv1" "wireguard.srv1" ])
[ "wireguard.pc" "wireguard.surface" "wireguard.xmupc1" "wireguard.xmupc2" "srv1" "wireguard.srv1" ])
++ (builtins.map
(host:
{
@@ -144,7 +154,7 @@ inputs:
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; };
one = { host = "one"; hostname = "192.168.1.4"; forwardX11 = true; };
surface = { host = "surface"; hostname = "192.168.1.4"; forwardX11 = true; };
gitea = { host = "gitea"; hostname = "ssh.git.chn.moe"; };
jykang =
{

View File

@@ -18,15 +18,12 @@ inputs:
(set:
{
name = set;
value = vscode-extensions.${set} or {}
// nix-vscode-extensions.vscode-marketplace.${set}
// nix-vscode-extensions.vscode-marketplace-release.${set} or {};
value = nix-vscode-extensions.vscode-marketplace.${set} // vscode-extensions.${set} or {};
})
(inputs.lib.unique
(
(builtins.attrNames vscode-extensions)
++ (builtins.attrNames nix-vscode-extensions.vscode-marketplace)
++ (builtins.attrNames nix-vscode-extensions.vscode-marketplace-release)
(builtins.attrNames nix-vscode-extensions.vscode-marketplace)
++ (builtins.attrNames vscode-extensions)
)));
in with extensions;
(with github; [ copilot github-vscode-theme ])
@@ -54,12 +51,7 @@ inputs:
ms-python.python
# theme
pkief.material-icon-theme
]
# jupyter
# TODO: use last release
++ (with vscode-extensions.ms-toolsai;
[ jupyter jupyter-keymap jupyter-renderers vscode-jupyter-cell-tags vscode-jupyter-slideshow ]);
extraFlags = builtins.concatStringsSep " " inputs.config.nixos.packages.packages._vscodeEnvFlags;
];
}
)];
};

View File

@@ -9,7 +9,6 @@ inputs:
enable = true;
package = inputs.pkgs.ananicy-cpp;
rulesProvider = inputs.pkgs.ananicy-rules-cachyos;
extraRules = [{ name = "YuanShen.exe"; type = "Game"; }];
};
};
}

View File

@@ -7,21 +7,19 @@ inputs:
(
inputs.lib.mkIf (docker != null)
{
virtualisation.docker =
# system-wide docker is not needed
# virtualisation.docker.enable = true;
virtualisation.docker.rootless =
{
enable = true;
rootless =
setSocketVariable = true;
daemon.settings =
{
enable = true;
setSocketVariable = true;
daemon.settings =
{
features.buildkit = true;
# dns 127.0.0.1 make docker not work
dns = [ "1.1.1.1" ];
# prevent create btrfs subvol
storage-driver = "overlay2";
};
features.buildkit = true;
# dns 127.0.0.1 make docker not work
dns = [ "1.1.1.1" ];
# prevent create btrfs subvol
storage-driver = "overlay2";
};
};
}

View File

@@ -16,7 +16,7 @@ inputs:
hostName = nextcloud.hostname;
appstoreEnable = false;
https = true;
package = inputs.pkgs.nextcloud30;
package = inputs.pkgs.nextcloud29;
maxUploadSize = "10G";
config =
{

View File

@@ -1 +0,0 @@
/config.json

View File

@@ -1,22 +0,0 @@
inputs:
{
options.nixos.services.nginx.applications.sticker = let inherit (inputs.lib) mkOption types; in mkOption
{
type = types.nullOr (types.submodule {});
default = {};
};
config = let inherit (inputs.config.nixos.services.nginx.applications) sticker; in inputs.lib.mkIf (sticker != null)
{
nixos.services.nginx.https."sticker.chn.moe".location."/".static =
{
root = builtins.toString (inputs.pkgs.runCommand "web" {}
''
mkdir -p $out
cp -r ${inputs.topInputs.stickerpicker}/web/* $out
chmod -R +w $out
cp -r ${./web}/* $out
'');
index = [ "index.html" ];
};
};
}

File diff suppressed because one or more lines are too long

View File

@@ -1,7 +0,0 @@
{
"packs": [
"Mare_by_WuMingv2Bot.json",
"line_191054124446_by_moe_sticker_bot.json"
],
"homeserver_url": "https://matrix.chn.moe"
}

View File

@@ -250,9 +250,6 @@ inputs:
# nginx will try to redirect https://blog.chn.moe/docs to https://blog.chn.moe:3068/docs/ in default
# this make it redirect to /docs/ without hostname
absolute_redirect off;
# allow realip module to set ip
set_real_ip_from 0.0.0.0/0;
real_ip_header proxy_protocol;
'';
proxyTimeout = "1d";
recommendedZstdSettings = true;

View File

@@ -1,48 +0,0 @@
inputs:
{
options.nixos.services.wechat2tg = let inherit (inputs.lib) mkOption types; in mkOption
{ type = types.nullOr (types.submodule {}); default = null; };
config = let inherit (inputs.config.nixos.services) wechat2tg; in inputs.lib.mkIf (wechat2tg != null)
{
virtualisation.oci-containers.containers.wechat2tg =
{
image = "finalpi/wechat2tg:v1.3.3";
imageFile = inputs.pkgs.dockerTools.pullImage
{
imageName = "finalpi/wechat2tg";
imageDigest = "sha256:48e3aff3f501847f063318b41ca34af7d83278847d2eee40d7ffbf439ee4c194";
sha256 = "04hq577d981mdfz0xwklhj9ifgnpbv91d6zkf37awfrbsiqfkrr6";
finalImageName = "finalpi/wechat2tg";
finalImageTag = "v1.3.3";
};
volumes = [ "wechat2tg-config:/app/storage" "wechat2tg-files:/app/save-files" ];
environmentFiles = [ inputs.config.sops.templates."wechat2tg/env".path ];
};
sops =
{
templates."wechat2tg/env".content = let placeholder = inputs.config.sops.placeholder; in
''
BOT_TOKEN=${placeholder."wechat2tg/token"}
# PROXY_HOST: ""
# PROXY_PORT: ""
# Proxy type: socks5, http, https
# PROXY_PROTOCOL: 'socks5'
# Optional username and password
# PROXY_USERNAME: ""
# PROXY_PASSWORD: ""
# API_ID: ""
# API_HASH: ""
ROOM_MESSAGE='<i>🌐#[topic]</i> ---- <b>👤#[(alias)] #[name]: </b>'
OFFICIAL_MESSAGE='<b>📣#[name]: </b>'
CONTACT_MESSAGE='<b>👤#[alias_first]: </b>'
ROOM_MESSAGE_GROUP='<b>👤#[(alias)] #[name]: </b>'
OFFICIAL_MESSAGE_GROUP='<b>📣#[name]: </b>'
CONTACT_MESSAGE_GROUP='<b>👤#[alias_first]: </b>'
CREATE_ROOM_NAME='#[topic]'
CREATE_CONTACT_NAME='#[alias]#[[name]]'
MESSAGE_DISPLAY='#[identity]#[br]#[body]'
'';
secrets."wechat2tg/token" = {};
};
};
}

View File

@@ -17,7 +17,7 @@ inputs:
supportedFilesystems = [ "ntfs" "nfs" "nfsv4" ];
# consoleLogLevel = 7;
};
hardware = { enableAllFirmware = true; bluetooth.enable = true; sensor.iio.enable = true; };
hardware = { enableAllFirmware = true; bluetooth.enable = true; };
environment =
{
sessionVariables = rec

View File

@@ -4,19 +4,24 @@ inputs:
{
variant = mkOption
{
type = types.nullOr (types.enum
[ "nixos" "xanmod-lts" "xanmod-latest" "cachyos" "cachyos-lto" "cachyos-server" "zen" ]);
type = types.enum [ "nixos" "xanmod-lts" "xanmod-latest" "cachyos" "cachyos-lto" "cachyos-server" "zen" ];
default = "xanmod-lts";
};
patches = mkOption { type = types.listOf types.nonEmptyStr; default = []; };
modules.modprobeConfig = mkOption { type = types.listOf types.str; default = []; };
modules =
{
install = mkOption { type = types.listOf types.str; default = []; };
load = mkOption { type = types.listOf types.str; default = []; };
initrd = mkOption { type = types.listOf types.str; default = []; };
modprobeConfig = mkOption { type = types.listOf types.str; default = []; };
};
};
config = let inherit (inputs.config.nixos.system) kernel; in inputs.lib.mkMerge
[
{
boot =
{
kernelModules = [ "br_netfilter" ];
kernelModules = [ "br_netfilter" ] ++ kernel.modules.load;
# modprobe --show-depends
initrd.availableKernelModules =
[
@@ -36,10 +41,10 @@ inputs:
++ (inputs.lib.optionals (kernel.variant != "nixos") [ "crypto_simd" ])
# for pi3b to show message over hdmi while boot
++ (inputs.lib.optionals (kernel.variant == "nixos") [ "vc4" "bcm2835_dma" "i2c_bcm2835" ]);
extraModulePackages = with inputs.config.boot.kernelPackages; [ v4l2loopback zenpower ];
extraModulePackages = (with inputs.config.boot.kernelPackages; [ v4l2loopback ]) ++ kernel.modules.install;
extraModprobeConfig = builtins.concatStringsSep "\n" kernel.modules.modprobeConfig;
kernelParams = [ "delayacct" ];
kernelPackages = inputs.lib.mkIf (kernel.variant != null)
kernelPackages =
{
nixos = inputs.pkgs.linuxPackages;
xanmod-lts = inputs.pkgs.linuxPackages_xanmod;
@@ -74,6 +79,45 @@ inputs:
HZ = inputs.lib.mkForce (freeform "1000");
};
}];
surface =
let
version =
let versionArray = builtins.splitVersion inputs.config.boot.kernelPackages.kernel.version;
in "${builtins.elemAt versionArray 0}.${builtins.elemAt versionArray 1}";
kernelPatches = builtins.map
(file:
{
name = "surface-${file.name}";
patch = "${inputs.topInputs.linux-surface}/patches/${version}/${file.name}";
})
(builtins.filter
(file: file.value == "regular")
(inputs.localLib.attrsToList (builtins.readDir
"${inputs.topInputs.linux-surface}/patches/${version}")));
kernelConfig = builtins.removeAttrs
(builtins.listToAttrs (builtins.concatLists (builtins.map
(configString:
if builtins.match "CONFIG_.*=." configString == [] then
(
let match = builtins.match "CONFIG_(.*)=(.)" configString; in with inputs.lib.kernel;
[{
name = builtins.elemAt match 0;
value = { m = module; y = yes; }.${builtins.elemAt match 1};
}]
)
else if builtins.match "# CONFIG_.* is not set" configString == [] then
[{
name = builtins.elemAt (builtins.match "# CONFIG_(.*) is not set" configString) 0;
value = inputs.lib.kernel.unset;
}]
else if builtins.match "#.*" configString == [] then []
else if configString == "" then []
else throw "could not parse: ${configString}"
)
(inputs.lib.strings.splitString "\n"
(builtins.readFile "${inputs.topInputs.linux-surface}/configs/surface-${version}.config")))))
[ "VIDEO_IPU3_IMGU" ];
in kernelPatches ++ [{ name = "surface-config"; patch = null; extraStructuredConfig = kernelConfig; }];
hibernate-progress =
[{
name = "hibernate-progress";

View File

@@ -1,128 +0,0 @@
diff --git a/kernel/power/swap.c b/kernel/power/swap.c
index 5bc04bfe2db1..6e7b17b97de7 100644
--- a/kernel/power/swap.c
+++ b/kernel/power/swap.c
@@ -563,7 +563,7 @@ static int save_image(struct swap_map_handle *handle,
hib_init_batch(&hb);
- pr_info("Saving image data pages (%u pages)...\n",
+ pr_err("Saving image data pages (%u pages)...\n",
nr_to_write);
m = nr_to_write / 10;
if (!m)
@@ -578,7 +578,7 @@ static int save_image(struct swap_map_handle *handle,
if (ret)
break;
if (!(nr_pages % m))
- pr_info("Image saving progress: %3d%%\n",
+ pr_err("Image saving progress: %3d%%\n",
nr_pages / m * 10);
nr_pages++;
}
@@ -588,7 +588,7 @@ static int save_image(struct swap_map_handle *handle,
if (!ret)
ret = err2;
if (!ret)
- pr_info("Image saving done\n");
+ pr_err("Image saving done\n");
swsusp_show_speed(start, stop, nr_to_write, "Wrote");
return ret;
}
@@ -795,8 +795,8 @@ static int save_compressed_image(struct swap_map_handle *handle,
*/
handle->reqd_free_pages = reqd_free_pages();
- pr_info("Using %u thread(s) for %s compression\n", nr_threads, hib_comp_algo);
- pr_info("Compressing and saving image data (%u pages)...\n",
+ pr_err("Using %u thread(s) for %s compression\n", nr_threads, hib_comp_algo);
+ pr_err("Compressing and saving image data (%u pages)...\n",
nr_to_write);
m = nr_to_write / 10;
if (!m)
@@ -817,7 +817,7 @@ static int save_compressed_image(struct swap_map_handle *handle,
data_of(*snapshot), PAGE_SIZE);
if (!(nr_pages % m))
- pr_info("Image saving progress: %3d%%\n",
+ pr_err("Image saving progress: %3d%%\n",
nr_pages / m * 10);
nr_pages++;
}
@@ -888,9 +888,9 @@ static int save_compressed_image(struct swap_map_handle *handle,
if (!ret)
ret = err2;
if (!ret)
- pr_info("Image saving done\n");
+ pr_err("Image saving done\n");
swsusp_show_speed(start, stop, nr_to_write, "Wrote");
- pr_info("Image size after compression: %d kbytes\n",
+ pr_err("Image size after compression: %d kbytes\n",
(atomic_read(&compressed_size) / 1024));
out_clean:
@@ -1105,7 +1105,7 @@ static int load_image(struct swap_map_handle *handle,
hib_init_batch(&hb);
clean_pages_on_read = true;
- pr_info("Loading image data pages (%u pages)...\n", nr_to_read);
+ pr_err("Loading image data pages (%u pages)...\n", nr_to_read);
m = nr_to_read / 10;
if (!m)
m = 1;
@@ -1123,7 +1123,7 @@ static int load_image(struct swap_map_handle *handle,
if (ret)
break;
if (!(nr_pages % m))
- pr_info("Image loading progress: %3d%%\n",
+ pr_err("Image loading progress: %3d%%\n",
nr_pages / m * 10);
nr_pages++;
}
@@ -1133,7 +1133,7 @@ static int load_image(struct swap_map_handle *handle,
if (!ret)
ret = err2;
if (!ret) {
- pr_info("Image loading done\n");
+ pr_err("Image loading done\n");
ret = snapshot_write_finalize(snapshot);
if (!ret && !snapshot_image_loaded(snapshot))
ret = -ENODATA;
@@ -1328,8 +1328,8 @@ static int load_compressed_image(struct swap_map_handle *handle,
}
want = ring_size = i;
- pr_info("Using %u thread(s) for %s decompression\n", nr_threads, hib_comp_algo);
- pr_info("Loading and decompressing image data (%u pages)...\n",
+ pr_err("Using %u thread(s) for %s decompression\n", nr_threads, hib_comp_algo);
+ pr_err("Loading and decompressing image data (%u pages)...\n",
nr_to_read);
m = nr_to_read / 10;
if (!m)
@@ -1459,7 +1459,7 @@ static int load_compressed_image(struct swap_map_handle *handle,
data[thr].unc + off, PAGE_SIZE);
if (!(nr_pages % m))
- pr_info("Image loading progress: %3d%%\n",
+ pr_err("Image loading progress: %3d%%\n",
nr_pages / m * 10);
nr_pages++;
@@ -1485,7 +1485,7 @@ static int load_compressed_image(struct swap_map_handle *handle,
}
stop = ktime_get();
if (!ret) {
- pr_info("Image loading done\n");
+ pr_err("Image loading done\n");
ret = snapshot_write_finalize(snapshot);
if (!ret && !snapshot_image_loaded(snapshot))
ret = -ENODATA;
@@ -1593,7 +1593,7 @@ int swsusp_check(bool exclusive)
}
if (!error && swsusp_header->flags & SF_HW_SIG &&
swsusp_header->hw_sig != swsusp_hardware_signature) {
- pr_info("Suspend image hardware signature mismatch (%08x now %08x); aborting resume.\n",
+ pr_err("Suspend image hardware signature mismatch (%08x now %08x); aborting resume.\n",
swsusp_header->hw_sig, swsusp_hardware_signature);
error = -EINVAL;
}

View File

@@ -22,7 +22,7 @@ inputs:
hosts = mkOption { type = types.listOf types.nonEmptyStr; default = []; };
};
};
githubToken.enable = mkOption { type = types.bool; default = inputs.config.nixos.model.private; };
githubToken.enable = mkOption { type = types.bool; default = false; };
};
config = let inherit (inputs.config.nixos.system) nix; in inputs.lib.mkMerge
[
@@ -46,8 +46,6 @@ inputs:
keep-going = true;
keep-outputs = true;
};
# TODO: remove after https://github.com/NixOS/nix/pull/10153 get merged
nix.package = inputs.pkgs.nixVersions.nix_2_18;
systemd.services.nix-daemon = { serviceConfig.CacheDirectory = "nix"; environment.TMPDIR = "/var/cache/nix"; };
}
# nix daemon use lower io/cpu priority

View File

@@ -32,11 +32,11 @@ inputs:
// (builtins.listToAttrs (builtins.map
(system: { name = system; value = { forwardAgent = true; extraOptions.AddKeysToAgent = "yes"; }; })
[
"vps6" "wireguard.vps6" "vps7" "wireguard.vps7" "wireguard.pc" "nas" "wireguard.nas" "pc"
"xmupc1" "wireguard.xmupc1" "xmupc2" "wireguard.xmupc2" "one" "wireguard.one"
"vps4" "vps6" "wireguard.vps6" "vps7" "wireguard.vps7" "wireguard.pc" "nas" "wireguard.nas" "pc"
"wireguard.surface" "xmupc1" "wireguard.xmupc1" "xmupc2" "wireguard.xmupc2"
]));
extraConfig =
inputs.lib.mkIf (builtins.elem inputs.config.nixos.model.hostname [ "pc" ])
inputs.lib.mkIf (builtins.elem inputs.config.nixos.model.hostname [ "pc" "surface" ])
''
IdentityFile ~/.ssh/id_rsa
IdentityFile ~/.ssh/id_ed25519_sk

View File

@@ -49,14 +49,14 @@ inputs:
};
crow-translate = rec
{
fileName = "org.kde.CrowTranslate.desktop";
fileName = "io.crow_translate.CrowTranslate.desktop";
path = "${inputs.pkgs.crow-translate}/share/applications/${fileName}";
};
};
devices =
{
pc = [ "nheko" "kclockd" "yakuake" "telegram" "element" "kmail" "discord" "crow-translate" ];
one = [ "kclockd" "yakuake" "telegram" "element" "kmail" "crow-translate" ];
surface = [ "kclockd" "yakuake" "telegram" "element" "crow-translate" ];
};
in builtins.listToAttrs (builtins.map
(file:

View File

@@ -6,6 +6,7 @@ inputs:
wallpaper =
{
pc = "${nixos-wallpaper}/pixiv-117612023.png";
surface = "${nixos-wallpaper}/fanbox-6682738.png";
}.${inputs.config.nixos.model.hostname} or "${nixos-wallpaper}/pixiv-96734339-x2.png";
in
{

View File

@@ -1,6 +1,10 @@
inputs:
{
config = inputs.lib.mkIf ((builtins.elem "chn" inputs.config.nixos.user.users) && inputs.config.nixos.model.private)
config = inputs.lib.mkIf
(
(builtins.elem "chn" inputs.config.nixos.user.users)
&& (builtins.elem inputs.config.nixos.model.hostname [ "pc" "surface" ])
)
{
home-manager.users.chn = homeInputs:
{

View File

@@ -26,7 +26,6 @@ inputs:
GROUPIII-2 = 1012;
GROUPIII-3 = 1013;
lly = 1014;
yxf = 1015;
misskey-misskey = 2000;
misskey-misskey-old = 2001;
frp = 2002;
@@ -128,23 +127,28 @@ inputs:
(inputs.lib.mkIf (builtins.elem "test" user.users) { users.users.test.password = "test"; })
# disable symlinks directly under home created by home-manager, use bind-mount instead
{
home-manager.users = inputs.lib.mkMerge (builtins.map
(user:
{
${user}.home.file = inputs.lib.mkMerge (builtins.map (file: { "${file}".enable = false; })
[ ".zshrc" ".zshenv" ".profile" ".bashrc" ".bash_profile" ]);
})
user.users);
systemd.mounts = builtins.concatLists (builtins.map
(user: builtins.map
nixos.user.sharedModules =
[{
home.file = inputs.lib.mkMerge (builtins.map (file: { "${file}".enable = false; })
[ ".zshrc" ".zshenv" ".profile" ".bashrc" ".bash_profile" ]);
}];
fileSystems = inputs.lib.mkMerge (builtins.map
(user: inputs.lib.mkMerge (builtins.map
(file:
{
what = "${inputs.config.home-manager.users.${user}.home.file.${file}.source}";
where = "/home/${user}/${file}";
options = "bind";
wantedBy = [ "multi-user.target" ];
"/home/${user}/${file}" =
{
device = "${inputs.config.home-manager.users.${user}.home.file.${file}.source}";
options = [ "bind" ];
};
})
[ ".zshrc" ".zshenv" ".profile" ".bashrc" ".bash_profile" ])
[ ".zshrc" ".zshenv" ".profile" ".bashrc" ".bash_profile" ]))
user.users);
users.users = inputs.lib.mkMerge (builtins.map
(user: { ${user}.home = "/home/${user}"; })
user.users);
home-manager.users = inputs.lib.mkMerge (builtins.map
(user: { ${user}.home.homeDirectory = "/home/${user}"; })
user.users);
}
];

View File

@@ -1 +0,0 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBoDGk9HYphkngx2Ix/vef2ZntdVNK1kbS9pY8+TzI41 yxf

View File

@@ -35,13 +35,8 @@ inputs:
qemu.runAsRoot = false;
onBoot = "ignore";
onShutdown = "shutdown";
shutdownTimeout = 30;
parallelShutdown = 4;
qemu =
{
ovmf.packages = with inputs.pkgs; [ OVMF.fd pkgsCross.aarch64-multiplatform.OVMF.fd ];
swtpm.enable = true;
};
qemu.ovmf.packages = with inputs.pkgs; [ OVMF.fd pkgsCross.aarch64-multiplatform.OVMF.fd ];
};
spiceUSBRedirection.enable = true;
};

View File

@@ -27,15 +27,14 @@ find_package(HDF5 REQUIRED)
find_package(concurrencpp REQUIRED)
find_path(POCKETFFT_INCLUDE_DIR pocketfft.h REQUIRED)
find_package(yaml-cpp REQUIRED)
find_package(glaze REQUIRED)
add_library(biu src/common.cpp src/hdf5.cpp src/string.cpp)
add_library(biu src/common.cpp src/hdf5.cpp src/logger.cpp src/string.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}
${LIBBACKTRACE_INCLUDE_DIR} ${POCKETFFT_INCLUDE_DIR})
target_link_libraries(biu PUBLIC magic_enum::magic_enum fmt::fmt Boost::headers Boost::iostreams Boost::filesystem
range-v3::range-v3 Eigen3::Eigen HighFive TgBot::TgBot ${LIBBACKTRACE_LIBRARY} hdf5::hdf5 concurrencpp::concurrencpp
yaml-cpp::yaml-cpp glaze::glaze)
yaml-cpp::yaml-cpp)
target_compile_features(biu PUBLIC cxx_std_23)
target_compile_options(biu PUBLIC -Wno-gnu-string-literal-operator-template)
install(TARGETS biu EXPORT biuTargets LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
@@ -82,12 +81,3 @@ add_executable(test-yaml test/yaml.cpp)
target_link_libraries(test-yaml PRIVATE biu)
set_property(TARGET test-yaml PROPERTY CXX_STANDARD 23 CXX_STANDARD_REQUIRED ON)
add_test(NAME test-yaml COMMAND test-yaml)
add_executable(test-logger test/logger.cpp)
target_link_libraries(test-logger PRIVATE biu)
target_compile_definitions(test-logger PRIVATE BIU_LOGGER_DEBUG BIU_LOGGER_SOURCE_ROOT="${CMAKE_CURRENT_SOURCE_DIR}")
set_property(TARGET test-logger PROPERTY CXX_STANDARD 23 CXX_STANDARD_REQUIRED ON)
add_test(NAME test-logger COMMAND test-logger)
add_executable(test-glaze test/glaze.cpp)
target_link_libraries(test-glaze PRIVATE biu)
set_property(TARGET test-glaze PROPERTY CXX_STANDARD 23 CXX_STANDARD_REQUIRED ON)
add_test(NAME test-glaze COMMAND test-glaze)

View File

@@ -14,4 +14,3 @@ find_package(HDF5 REQUIRED)
find_package(concurrencpp REQUIRED)
find_path(POCKETFFT_INCLUDE_DIR pocketfft.h REQUIRED)
find_package(yaml-cpp REQUIRED)
find_package(glaze REQUIRED)

View File

@@ -1,7 +1,7 @@
{
stdenv, cmake, lib,
magic-enum, fmt, boost, eigen, range-v3, nameof, zpp-bits, highfive, tgbot-cpp, libbacktrace, hdf5, concurrencpp,
pocketfft, yaml-cpp, glaze
pocketfft, yaml-cpp
}: stdenv.mkDerivation rec
{
name = "biu";
@@ -9,7 +9,7 @@
buildInputs =
[
magic-enum fmt boost range-v3 nameof zpp-bits eigen highfive tgbot-cpp libbacktrace hdf5
concurrencpp pocketfft yaml-cpp glaze
concurrencpp pocketfft yaml-cpp
];
propagatedBuildInputs = buildInputs;
nativeBuildInputs = [ cmake ];

View File

@@ -7,13 +7,9 @@
# include <biu/format.tpp>
# include <biu/eigen.tpp>
# include <biu/hdf5.tpp>
# ifndef BIU_INTERNAL
// while building the library, the logger should not be included, to ensure inline members are not compiled
# include <biu/logger.tpp>
# endif
# include <biu/logger.tpp>
# include <biu/smartref.tpp>
# include <biu/fft.tpp>
# include <biu/yaml.tpp>
# include <biu/serialize.tpp>
# include <biu/glaze.tpp>
# include <range/v3/all.hpp>

View File

@@ -117,11 +117,9 @@ namespace biu
template <typename T> T& operator|(T&& obj, const ToLvalueHelper&);
}
constexpr detail_::ToLvalueHelper toLvalue;
template <typename Function, typename T, typename... Ts> void for_each(Function&& function, T&& arg, Ts&&... args);
}
using common::hash, common::unused, common::block_forever, common::is_interactive, common::env, common::int128_t,
common::uint128_t, common::Empty, common::CaseInsensitiveStringLessComparator, common::RemoveMemberPointer,
common::MoveQualifiers, common::FallbackIfNoTypeDeclared, common::exec, common::sequence, common::read,
common::toLvalue, common::for_each;
common::toLvalue;
}

View File

@@ -46,31 +46,4 @@ namespace biu::common
return sequence(from, to);
}
template <typename T> T& detail_::operator|(T&& obj, const ToLvalueHelper&) { return static_cast<T&>(obj); }
template <typename Function, typename T, typename... Ts> void for_each(Function&& function, T&& arg, Ts&&... args)
{
if constexpr (sizeof...(Ts) == 0)
{
[&]<std::size_t... Is>(std::index_sequence<Is...>)
{ (std::forward<Function>(function)(std::get<Is>(std::forward<T>(arg))) , ...); }
(std::make_index_sequence<sizeof...(Ts)>{});
}
else
{
[&]<typename Tuple, std::size_t... Is>(std::index_sequence<Is...>, Tuple&& tuple)
{
([&]<std::size_t I, std::size_t... Js>(std::index_sequence<Js...>) -> decltype(auto)
{
std::apply
(
std::forward<Function>(function),
std::forward_as_tuple(std::get<I>(std::get<Js>(std::forward<Tuple>(tuple)))...));
}.template operator()<Is>(std::make_index_sequence<std::tuple_size_v<Tuple>>{}), ...);
}
(
std::make_index_sequence<std::tuple_size_v<T>>{},
std::forward_as_tuple(std::forward<T>(arg), std::forward<Ts>(args)...)
);
}
}
}

View File

@@ -3,9 +3,6 @@
# include <tuple>
# include <type_traits>
# include <complex>
# include <set>
# include <unordered_set>
# include <boost/container/flat_set.hpp>
namespace biu
{
@@ -51,13 +48,9 @@ namespace biu
template <typename T> concept Arithmetic = std::is_arithmetic<T>::value || SpecializationOf<T, std::complex>;
template <typename T> concept Nullptr = std::is_null_pointer_v<std::remove_cvref_t<T>>;
template <typename T> concept Set = SpecializationOf<T, std::set> || SpecializationOf<T, std::unordered_set>
|| SpecializationOf<T, std::multiset> || SpecializationOf<T, std::unordered_multiset>
|| SpecializationOf<T, boost::container::flat_set>;
}
using concepts::DecayedType, concepts::SpecializationOf, concepts::CompletedType, concepts::ImplicitlyConvertibleTo,
concepts::ImplicitlyConvertibleFrom, concepts::ExplicitlyConvertibleTo, concepts::ExplicitlyConvertibleFrom,
concepts::ConvertibleTo, concepts::ConvertibleFrom, concepts::ConstevalInvokable, concepts::Enumerable,
concepts::InvocableWithResult, concepts::Arithmetic, concepts::Nullptr, concepts::Set;
concepts::InvocableWithResult, concepts::Arithmetic, concepts::Nullptr;
}

View File

@@ -81,8 +81,8 @@ namespace biu
namespace detail_
{
template <typename Matrix> class EigenMatrix : public std::false_type {};
template <typename Scalar, int Rows, int Cols, int Options, int MaxRows, int MaxCols>
class EigenMatrix<Eigen::Matrix<Scalar, Rows, Cols, Options, MaxRows, MaxCols>> : public std::true_type {};
template <typename Scalar, int Rows, int Cols, int Options>
class EigenMatrix<Eigen::Matrix<Scalar, Rows, Cols, Options>> : public std::true_type {};
}
template <typename Matrix> concept EigenMatrix = detail_::EigenMatrix<Matrix>::value;
}

View File

@@ -2,7 +2,6 @@
# include <utility>
# include <biu/eigen.hpp>
# include <biu/common.hpp>
# include <biu/format.hpp>
# include <range/v3/view.hpp>
# include <zpp_bits.h>
@@ -305,15 +304,3 @@ template <typename Matrix> constexpr auto Eigen::serialize(auto & archive, Matri
return result;
}
}
template <typename Matrix, typename Char> requires
(
biu::EigenMatrix<std::remove_cvref_t<Matrix>>
// should not be vector, vector is handled by fmt ranges
&& []
{
constexpr auto nrows = Matrix::CompileTimeTraits::RowsAtCompileTime,
ncols = Matrix::CompileTimeTraits::ColsAtCompileTime;
return (nrows == Eigen::Dynamic || nrows > 1) && (ncols == Eigen::Dynamic || ncols > 1);
}()
)
struct fmt::formatter<Matrix, Char> : fmt::basic_ostream_formatter<Char> {};

View File

@@ -1,31 +0,0 @@
# pragma once
# include <biu/eigen.hpp>
# include <glaze/glaze.hpp>
namespace glz::detail
{
template <biu::EigenMatrix Matrix> struct from<JSON, Matrix>
{
template <auto Opts> static void op(Matrix& matrix, auto&&... args);
};
template <biu::EigenMatrix Matrix> struct to<JSON, Matrix>
{
template <auto Opts> static void op(Matrix& matrix, auto&&... args) noexcept;
};
}
template <typename Scalar, int Rows, int Cols, int Options, int MaxRows, int MaxCols>
struct glz::meta<Eigen::Matrix<Scalar, Rows, Cols, Options, MaxRows, MaxCols>>
{
static constexpr std::string_view name = join_v
<
chars<"Eigen::Matrix<">, name_v<Scalar>, chars<",">,
chars<num_to_string<Rows>::value>, chars<",">,
chars<num_to_string<Cols>::value>, chars<",">,
chars<num_to_string<Options>::value>, chars<",">,
chars<num_to_string<MaxRows>::value>, chars<",">,
chars<num_to_string<MaxCols>::value>,
chars<">">
>;
};

View File

@@ -1,15 +0,0 @@
# pragma once
# include <biu/glaze.hpp>
template <biu::EigenMatrix Matrix> template <auto Opts> void
glz::detail::from<glz::JSON, Matrix>::op(Matrix& matrix, auto&&... args)
{
decltype(matrix | biu::fromEigen) std_matrix;
read<JSON>::op<Opts>(std_matrix, args...);
matrix = std_matrix | biu::toEigen<>;
}
template <biu::EigenMatrix Matrix> template <auto Opts> void
glz::detail::to<glz::JSON, Matrix>::op(Matrix& matrix, auto&&... args) noexcept
{
write<JSON>::op<Opts>(matrix | biu::fromEigen, args...);
}

View File

@@ -1,7 +1,6 @@
# pragma once
# define BOOST_STACKTRACE_USE_BACKTRACE
# include <fmt/chrono.h>
# include <tgbot/tgbot.h>
# include <biu/logger.hpp>
# include <biu/common.hpp>
# include <biu/format.hpp>
@@ -18,27 +17,6 @@ namespace biu
Logger::Level::Debug
# endif
};
inline void Logger::init(std::experimental::observer_ptr<std::ostream> stream, Level level)
{ LoggerConfig_ = LoggerConfigType_{stream, nullptr, level}; }
inline void Logger::init(std::shared_ptr<std::ostream> stream, Level level)
{
LoggerConfig_ = LoggerConfigType_
{std::experimental::make_observer(stream.get()), stream, level};
}
inline Atomic<std::optional<std::pair<std::string, std::string>>> Logger::TelegramConfig_;
inline void Logger::telegram_init(const std::string& token, const std::string& chat_id)
{ TelegramConfig_ = std::make_pair(token, chat_id); }
inline void Logger::telegram_notify(const std::string& message, bool async)
{
auto notify = [](const std::string& message)
{
auto&& lock = TelegramConfig_.lock();
TgBot::Bot bot(lock.value()->first);
bot.getApi().sendMessage(lock.value()->first, message);
};
if (async) std::thread(notify, message).detach();
else notify(message);
}
template <typename T> Logger::ObjectMonitor<T>::ObjectMonitor()
: CreateTime_{std::chrono::steady_clock::now()}
{
@@ -61,7 +39,6 @@ namespace biu
{ lock->erase(it); return; }
guard.error("{} {} not found in Logger::Objects."_f(fmt::ptr(this), nameof::nameof_full_type<T>()));
}
inline Atomic<std::multimap<const void*, std::string_view>> Logger::Objects_;
template <typename FinalException> Logger::Exception<FinalException>::Exception(const std::string& message)
{
@@ -69,14 +46,6 @@ namespace biu
log.print_exception(nameof::nameof_full_type<FinalException>(), message, Stacktrace_, {});
}
inline thread_local unsigned Logger::Guard::Indent_ = 0;
inline std::size_t Logger::Guard::get_time_ms() const
{
return std::chrono::duration_cast<std::chrono::milliseconds>
(std::chrono::steady_clock::now() - StartTime_).count();
}
inline std::size_t Logger::Guard::get_thread_id() const
{ return std::hash<std::thread::id>{}(std::this_thread::get_id()); }
template <typename... Param> Logger::Guard::Guard(Param&&... param)
: StartTime_{std::chrono::steady_clock::now()}
{
@@ -84,13 +53,8 @@ namespace biu
auto&& lock = Threads_.lock();
if (auto thread_id = get_thread_id(); lock->contains(thread_id)) lock.value()[thread_id]++;
else lock->emplace(thread_id, 1);
auto try_format = []<typename T>(T&& value) -> std::string
{
if constexpr (fmt::is_formattable<T, char>::value) return "{}"_f(std::forward<T>(value));
else return "({})"_f(nameof::nameof_full_type<T>());
};
if constexpr (sizeof...(Param) > 0)
debug("begin function with {{{}}}."_f(fmt::join({try_format(std::forward<Param>(param))...}, ", ")));
debug("begin function with {{{}}}."_f(fmt::join({"{}"_f(std::forward<Param>(param))...}, ", ")));
else debug("begin function.");
}
@@ -107,37 +71,22 @@ namespace biu
void Logger::Guard::operator()() const { debug("reached after {} ms."_f(get_time_ms())); }
template <Logger::Level L> void Logger::Guard::log(const std::string& message) const
{
# ifndef BIU_LOGGER_DEBUG
if constexpr (L == Level::Debug) return;
# endif
if (auto&& lock = LoggerConfig_.lock(); lock->Level >= L)
{
static_assert(std::same_as<std::size_t, std::uint64_t>);
auto time = std::chrono::time_point_cast<std::chrono::milliseconds>(std::chrono::system_clock::now());
# ifdef BIU_LOGGER_DEBUG
auto time = std::chrono::system_clock::now();
boost::stacktrace::stacktrace stack;
# ifdef BIU_LOGGER_SOURCE_ROOT
auto source_root = std::string_view(BIU_LOGGER_SOURCE_ROOT "/");
auto source_file = stack[0].source_file().starts_with(source_root) ?
stack[0].source_file().substr(source_root.size()) : stack[0].source_file();
# else
auto source_file = stack[0].source_file();
# endif
*lock->Stream << "[ {:%T} {:02x} {:02} ] {} (at {}:{} {} )\n"_f
*lock->Stream << "[ {:%Y-%m-%d %H:%M:%S}:{:03} {:08x} {:04} {}:{} {} ] {}\n"_f
(
time,
get_thread_id() % std::numeric_limits<std::uint16_t>::max(),
std::chrono::time_point_cast<std::chrono::milliseconds>(time).time_since_epoch().count() % 1000,
get_thread_id() % std::numeric_limits<std::uint64_t>::max(),
Indent_,
message,
source_file.empty() ? "??"s : source_file,
stack[0].source_file().empty() ? "??"s : stack[0].source_file(),
stack[0].source_line() == 0 ? "??"s : "{}"_f(stack[0].source_line()),
stack[0].name()
stack[0].name(),
message
) << std::flush;
# else
*lock->Stream << "[ {:%T} {:02x} {:02} ] {}\n"_f
(time, get_thread_id() % std::numeric_limits<std::uint16_t>::max(), Indent_, message)
<< std::flush;
# endif
}
}
void Logger::Guard::error(const std::string& message) const { log<Level::Error>(message); }
@@ -170,6 +119,4 @@ namespace biu
*lock->Stream << std::flush;
}
}
inline Atomic<std::map<std::size_t, std::size_t>> Logger::Threads_;
}

View File

@@ -24,21 +24,6 @@ namespace YAML
static Node encode(const Optional&);
static bool decode(const Node& node, Optional&);
};
template <biu::SpecializationOf<std::unique_ptr> Ptr> struct convert<Ptr>
{
static Node encode(const Ptr&);
static bool decode(const Node& node, Ptr&);
};
template <biu::Set Set> struct convert<Set>
{
static Node encode(const Set&);
static bool decode(const Node& node, Set&);
};
template <biu::Enumerable Enum> struct convert<Enum>
{
static Node encode(const Enum&);
static bool decode(const Node& node, Enum&);
};
template <typename T> struct convert
{
static Node encode(const T&);

View File

@@ -5,8 +5,6 @@
# include <biu/eigen.hpp>
# include <boost/pfr.hpp>
# include <boost/pfr/core_name.hpp>
# include <nameof.hpp>
# include <magic_enum.hpp>
namespace YAML
{
@@ -52,42 +50,6 @@ namespace YAML
}
return true;
}
template <biu::SpecializationOf<std::unique_ptr> Ptr> Node convert<Ptr>::encode(const Ptr& ptr)
{
if (ptr) return convert<typename Ptr::element_type>::encode(*ptr);
else return YAML::Node{};
}
template <biu::SpecializationOf<std::unique_ptr> Ptr> bool convert<Ptr>::decode
(const Node& node, Ptr& ptr)
{
if (!node.IsDefined() || node.IsNull()) ptr = nullptr;
else
{
auto* value = new typename Ptr::element_type;
if (!convert<typename Ptr::element_type>::decode(node, *value)) return false;
ptr.reset(value);
}
return true;
}
template <biu::Set Set> Node convert<Set>::encode(const Set& set)
{ return convert<std::vector<typename Set::value_type>>::encode(set | ranges::to_vector); }
template <biu::Set Set> bool convert<Set>::decode(const Node& node, Set& set)
{
std::vector<typename Set::value_type> vec;
if (!convert<std::vector<typename Set::value_type>>::decode(node, vec)) return false;
set = vec | ranges::to<Set>;
return true;
}
template <biu::Enumerable Enum> Node convert<Enum>::encode(const Enum& e)
{ return convert<std::string_view>::encode(nameof::nameof_enum(e)); }
template <biu::Enumerable Enum> bool convert<Enum>::decode(const Node& node, Enum& e)
{
std::string name;
if (!convert<std::string>::decode(node, name)) return false;
auto optional_value = magic_enum::enum_cast<Enum>(name);
if (!optional_value) return false;
else { e = *optional_value; return true; }
}
template <typename T> Node convert<T>::encode(const T& t)
{
YAML::Node node;

View File

@@ -1,7 +1,6 @@
# include <future>
# include <utility>
# include <cstdio>
# define BIU_INTERNAL
# include <biu.hpp>
# include <boost/process.hpp>
# include <boost/preprocessor.hpp>

View File

@@ -1,4 +1,3 @@
# define BIU_INTERNAL
# include <biu.hpp>
namespace biu::hdf5

View File

@@ -0,0 +1,41 @@
# include <tgbot/tgbot.h>
# include <biu.hpp>
namespace biu
{
void Logger::init(std::experimental::observer_ptr<std::ostream> stream, Level level)
{ LoggerConfig_ = LoggerConfigType_{stream, nullptr, level}; }
void Logger::init(std::shared_ptr<std::ostream> stream, Level level)
{
LoggerConfig_ = LoggerConfigType_
{std::experimental::make_observer(stream.get()), stream, level};
}
Atomic<std::optional<std::pair<std::string, std::string>>> 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, bool async)
{
auto notify = [](const std::string& message)
{
auto&& lock = TelegramConfig_.lock();
TgBot::Bot bot(lock.value()->first);
bot.getApi().sendMessage(lock.value()->first, message);
};
if (async) std::thread(notify, message).detach();
else notify(message);
}
Atomic<std::multimap<const void*, std::string_view>> Logger::Objects_;
thread_local unsigned Logger::Guard::Indent_ = 0;
std::size_t Logger::Guard::get_time_ms() const
{
return std::chrono::duration_cast<std::chrono::milliseconds>
(std::chrono::steady_clock::now() - StartTime_).count();
}
std::size_t Logger::Guard::get_thread_id() const
{ return std::hash<std::thread::id>{}(std::this_thread::get_id()); }
Atomic<std::map<std::size_t, std::size_t>> Logger::Threads_;
}

View File

@@ -1,4 +1,3 @@
# define BIU_INTERNAL
# include <biu.hpp>
namespace biu
@@ -6,13 +5,18 @@ namespace biu
concurrencpp::generator<std::pair<std::string_view, std::sregex_iterator>> string::find
(SmartRef<const std::string> data, SmartRef<const std::regex> regex)
{
Logger::Guard log;
std::string::const_iterator unmatched_prefix_begin = data->cbegin(), unmatched_prefix_end;
std::sregex_iterator regit;
while (true)
{
if (regit == std::sregex_iterator{}) regit = std::sregex_iterator{data->begin(), data->end(), *regex};
else regit++;
if (regit == std::sregex_iterator{}) unmatched_prefix_end = data->cend();
if (regit == std::sregex_iterator{})
{
unmatched_prefix_end = data->cend();
log.debug("distance: {}"_f(std::distance(unmatched_prefix_begin, unmatched_prefix_end)));
}
else unmatched_prefix_end = (*regit)[0].first;
co_yield
{
@@ -31,6 +35,7 @@ namespace biu
std::string string::replace
(const std::string& data, const std::regex& regex, std::function<std::string(const std::smatch&)> function)
{
Logger::Guard log;
std::string result;
for (auto matched : find(data, regex))
{

View File

@@ -1,5 +1,4 @@
# include <biu.hpp>
# include <glaze/glaze.hpp>
int main()
{
@@ -11,22 +10,4 @@ int main()
| biu::toLvalue
| ranges::views::transform([](int i){ return i + 1; })
| ranges::to_vector;
struct test_struct
{
int a = 1;
double b = 2;
std::string c = "3";
} c;
biu::for_each([&](auto&& i){ std::cout << c.*i << '\n'; },
std::tuple(&test_struct::a, &test_struct::b, &test_struct::c));
struct test_struct2
{
int a = 4;
double b = 5;
std::string c = "6";
} d;
biu::for_each([&](auto&& i, auto&& j){ c.*i = d.*j; },
std::tuple(&test_struct::a, &test_struct::b, &test_struct::c),
std::tuple(&test_struct2::a, &test_struct2::b, &test_struct2::c));
}

View File

@@ -26,7 +26,4 @@ int main()
auto e = biu::deserialize<decltype(c)>(biu::serialize(c));
static_assert(std::same_as<decltype(e), decltype(c)>);
assert(c == e);
auto i = "{}"_f(a);
auto j = "{}"_f(c);
}

View File

@@ -1,20 +0,0 @@
// # include <biu.hpp>
# include <glaze/glaze.hpp>
# include <Eigen/Dense>
# include <glaze/ext/eigen.hpp>
struct aaa
{
int a = 1;
double b = 2;
std::string c = "3";
Eigen::Matrix3d d = Eigen::Matrix3d::Identity();
bool operator==(const aaa&) const = default;
} bbb;
int main()
{
auto result = glz::write_json(bbb.d).value();
// auto result2 = glz::read_json<aaa>(result).value();
// assert(bbb == result2);
}

View File

@@ -1,5 +0,0 @@
# include <biu.hpp>
int main()
{
biu::Logger::Guard log("test", nullptr, std::ofstream());
}

View File

@@ -8,7 +8,6 @@ int main()
a: [ 1, 2, 3 ]
b: [ [ 1, 2, 3 ], [ 4, 5, 6 ], [ 7, 8, 9 ] ]
c: [ 1, 2 ]
d: null
)";
auto node = YAML::Load(data);
auto a = node["a"].as<Eigen::Vector3i>();
@@ -31,19 +30,9 @@ d: null
Eigen::Vector3i a;
Eigen::Matrix3i b;
std::complex<double> c;
std::unique_ptr<Eigen::Matrix3d> d;
};
auto a3 = node.as<A>();
assert(a3.a == a);
assert(a3.b == b);
assert(a3.c == c);
assert(a3.d == nullptr);
auto e = node["c"].as<std::set<int>>();
assert((e == std::set<int>{1, 2}));
node["c"] = e;
std::string data2 = R"(
a: AAA
)";
enum class E { AAA, BBB, CCC };
auto f = YAML::Load(data2)["a"].as<E>();
}

View File

@@ -39,11 +39,7 @@ inputs: rec
hdf5 = inputs.pkgs.hdf5.override { mpiSupport = true; fortranSupport = true; cppSupport = false; };
};
nvidia = inputs.pkgs.callPackage ./vasp/nvidia
{
inherit lmod nvhpc vtst src;
hdf5 = hdf5-nvhpc;
wannier90 = inputs.pkgs.wannier90.overrideAttrs { buildFlags = [ "dynlib" ]; };
};
{ inherit lmod nvhpc vtst src; hdf5 = hdf5-nvhpc; };
intel = inputs.pkgs.callPackage ./vasp/intel
{
inherit vtst src;
@@ -61,7 +57,6 @@ inputs: rec
enableShared = false;
enableStatic = true;
};
wannier90 = inputs.pkgs.wannier90.overrideAttrs { buildFlags = [ "dynlib" ]; };
};
hdf5-nvhpc = inputs.pkgs.callPackage ./vasp/hdf5-nvhpc { inherit lmod nvhpc; inherit (inputs.pkgs.hdf5) src; };
vtst = (inputs.pkgs.callPackage ./vasp/vtst.nix {});
@@ -81,7 +76,7 @@ inputs: rec
sqlite-orm = inputs.pkgs.callPackage ./sqlite-orm.nix { src = inputs.topInputs.sqlite-orm; };
mkPnpmPackage = inputs.pkgs.callPackage ./mkPnpmPackage.nix {};
sbatch-tui = inputs.pkgs.callPackage ./sbatch-tui { inherit biu; stdenv = inputs.pkgs.clang18Stdenv; };
ufo = inputs.pkgs.callPackage inputs.topInputs.ufo
ufo = inputs.pkgs.callPackage ./ufo
{
inherit biu matplotplusplus;
tbb = inputs.pkgs.tbb_2021_11;
@@ -96,9 +91,6 @@ inputs: rec
pocketfft = inputs.pkgs.callPackage ./pocketfft.nix { src = inputs.topInputs.pocketfft; };
spectroscopy = inputs.pkgs.callPackage ./spectroscopy.nix { src = inputs.topInputs.spectroscopy; };
mirism = inputs.pkgs.callPackage ./mirism { inherit biu; stdenv = inputs.pkgs.clang18Stdenv; };
vaspberry = inputs.pkgs.callPackage ./vaspberry.nix { src = inputs.topInputs.vaspberry; };
highfive = inputs.pkgs.callPackage ./highfive.nix { src = inputs.topInputs.highfive; };
stickerpicker = inputs.pkgs.python3Packages.callPackage ./stickerpicker.nix { src = inputs.topInputs.stickerpicker; };
fromYaml = content: builtins.fromJSON (builtins.readFile
(inputs.pkgs.runCommand "toJSON" {}

View File

@@ -1,8 +0,0 @@
{ src, stdenv, cmake, hdf5 }: stdenv.mkDerivation
{
name = "highfive";
inherit src;
nativeBuildInputs = [ cmake ];
buildInputs = [ hdf5 ];
doCheck = true;
}

View File

@@ -1 +0,0 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBoDGk9HYphkngx2Ix/vef2ZntdVNK1kbS9pY8+TzI41 yxf

View File

@@ -14,7 +14,6 @@ namespace hpcstat
{ "uL/ZfBXKko30VpeuKb5dnnxbhJ8IAuHo8W+n2uwQhCI", { "hjp", "JiaPeng Huang" } },
{ "0tIFcYlfj/onVGVJsg9Th4mPtSZ5R+5srl4gxwZgM3k", { "wm", "Man Wang" } },
{ "Ciam/qGL/ZrXIQearsg9NvFh/soPZUG4Z8JhOFSTk48", { "lly", "Liyi Luo" } },
{ "4C2HKaBqgAzhPLjH/BuQZOjGx85NEeUA+UkkWkRzl8k", { "yxf", "Xiaofang Ye" } },
{ "7bmG24muNsaAZkCy7mQ9Nf2HuNafmvUO+Hf1bId9zts", { "00", "Yaping Wu" } },
{ "dtx0QxdgFrXn2SYxtIRz43jIAH6rLgJidSdTvuTuews", { "01", "Jing Li" } },
{ "8crUO9u4JiVqw3COyjXfzZe87s6XZFhvi0LaY0Mv6bg", { "02", "Huahan Zhan" } },

View File

@@ -1,6 +0,0 @@
{ src, buildPythonApplication, aiohttp, yarl, pillow, telethon, cryptg, python-magic }: buildPythonApplication
{
name = "stickerpicker";
inherit src;
propagatedBuildInputs = [ aiohttp yarl pillow telethon cryptg python-magic ];
}

1
packages/ufo/.envrc Normal file
View File

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

View File

@@ -0,0 +1,31 @@
cmake_minimum_required(VERSION 3.14)
project(ufo VERSION 0 LANGUAGES CXX)
enable_testing()
include(GNUInstallDirs)
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message("Setting build type to 'Release' as none was specified.")
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif()
find_package(TBB REQUIRED)
find_package(Matplot++ REQUIRED)
find_package(biu REQUIRED)
find_package(Threads REQUIRED)
add_executable(ufo src/fold.cpp src/unfold.cpp src/plot.cpp src/main.cpp)
target_include_directories(ufo PRIVATE ${PROJECT_SOURCE_DIR}/include)
target_link_libraries(ufo PRIVATE TBB::tbb Matplot++::matplot biu::biu)
target_compile_features(ufo PRIVATE cxx_std_23)
target_compile_options(ufo PRIVATE -fexperimental-library)
install(TARGETS ufo RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
get_property(ImportedTargets DIRECTORY "${CMAKE_SOURCE_DIR}" PROPERTY IMPORTED_TARGETS)
message("Imported targets: ${ImportedTargets}")
message("List of compile features: ${CMAKE_CXX_COMPILE_FEATURES}")
include(CTest)
add_test(NAME fold COMMAND ufo fold ${PROJECT_SOURCE_DIR}/test/fold/config.yaml)

11
packages/ufo/default.nix Normal file
View File

@@ -0,0 +1,11 @@
{
stdenv, cmake, pkg-config, version ? null,
tbb, matplotplusplus, biu
}: stdenv.mkDerivation
{
name = "ufo";
src = ./.;
buildInputs = [ tbb matplotplusplus biu ];
nativeBuildInputs = [ cmake pkg-config ];
doCheck = true;
}

View File

@@ -0,0 +1,45 @@
分为几个功能:
* fold根据要计算的单胞的 q 点路径,计算超胞中对应的 q 点路径,生成的路径再交给 phonopy 计算。
* unfold根据 phonopy 计算的结果,将超胞的结果展开到单胞中。
* plot对计算结果画图。
主要的输入输出格式均为 yaml。对于数据特别大的情况也可以从 hdf5 中读取一部分数据或者将一部分数据写入到 hdf5 文件中。
# fold
## 输入
```yaml
# 三个整数组成的向量,表示从单胞到超胞,三个晶格矢量的倍数
# 必写
SuperCellMultiplier: [2, 2, 2]
# 一个变换矩阵,表明超胞经历了怎样的扭曲。
# 可选,默认值为单位矩阵
SuperCellDeformation: [[1, 0, 0], [0, 1, 0], [0, 0, 1]]
# 一个由三个浮点数组成的向量,表示考虑的 q 点
# 必写
Qpoints:
- [0, 0, 0]
- [0.1, 0, 0]
- [0.2, 0, 0]
- [0.3, 0, 0]
- [0.4, 0, 0]
- [0.5, 0, 0]
# 一个 DataFile 类型的对象,表明输出结果到哪个文件
# 必写
OutputFile:
```
## 输出
```yaml
# 得到的 q 点坐标
Qpoints:
- [0, 0, 0]
- [0.1, 0, 0]
- [0.2, 0, 0]
- [0.3, 0, 0]
- [0.4, 0, 0]
- [0.5, 0, 0]
```

View File

@@ -0,0 +1,72 @@
# pragma once
# include <biu.hpp>
namespace ufo
{
// 在相位中, 约定为使用 $\exp (2 \pi i \vec{q} \cdot \vec{r})$ 来表示原子的运动状态
// (而不是 $\exp (-2 \pi i \vec{q} \cdot \vec{r})$)
// 一些书定义的倒格矢中包含了 $2 \pi$ 的部分, 我们这里约定不包含这部分.
// 也就是说, 正格子与倒格子的转置相乘, 得到单位矩阵.
using namespace biu::literals;
using namespace biu::stream_operators;
void fold(std::string config_file);
void unfold(std::string config_file);
void plot_band(std::string config_file);
void plot_point(std::string config_file);
// unfold 和 plot 都需要用到这个,所以写出来
struct UnfoldOutput
{
Eigen::Matrix3d PrimativeCell;
Eigen::Matrix3i SuperCellTransformation;
Eigen::Vector3i SuperCellMultiplier;
Eigen::Matrix3d SuperCellDeformation;
std::optional<std::vector<std::size_t>> SelectedAtoms;
// 关于各个 Q 点的数据
struct QpointDataType
{
// Q 点的坐标,单位为单胞的倒格矢
Eigen::Vector3d Qpoint;
// 来源于哪个 Q 点, 单位为超胞的倒格矢
Eigen::Vector3d Source;
std::size_t SourceIndex;
// 关于这个 Q 点上各个模式的数据
struct ModeDataType
{
// 模式的频率,单位为 THz
double Frequency;
// 模式的权重
double Weight;
};
std::vector<ModeDataType> ModeData;
};
std::vector<QpointDataType> QpointData;
struct MetaQpointDataType
{
// Q 点的坐标,单位为单胞的倒格矢
Eigen::Vector3d Qpoint;
// 关于这个 Q 点上各个模式的数据
struct ModeDataType
{
// 模式的频率,单位为 THz
double Frequency;
// 模式中各个原子的运动状态
// 这个数据应当是这样得到的:动态矩阵的 eigenvector 乘以 $\exp(-2 \pi i \vec q \cdot \vec r)$
// 这个数据可以认为是原子位移中, 关于超胞有周期性的那一部分, 再乘以原子质量的开方.
// 这个数据会在 unfold 时被归一化
Eigen::MatrixX3cd AtomMovement;
};
std::vector<ModeDataType> ModeData;
};
std::vector<MetaQpointDataType> MetaQpointData;
using serialize = zpp::bits::members<7>;
};
}

58
packages/ufo/src/fold.cpp Normal file
View File

@@ -0,0 +1,58 @@
# include <ufo.hpp>
void ufo::fold(std::string config_file)
{
struct Input
{
Eigen::Matrix3d SuperCellDeformation;
Eigen::Vector3i SuperCellMultiplier;
std::vector<Eigen::Vector3d> Qpoints;
std::optional<std::string> OutputFile;
};
struct Output
{
std::vector<Eigen::Vector3d> Qpoints;
};
auto fold = []
(
Eigen::Vector3d qpoint_in_reciprocal_primitive_cell_by_reciprocal_primitive_cell,
Eigen::Matrix3d super_cell_transformation
) -> Eigen::Vector3d
{
/*
首先需要将 q 点坐标的单位转换为 ModifiedSuperCell 的格矢,可知:
QpointByReciprocalModifiedSuperCell = SuperCellMultiplier * QpointByReciprocalPrimitiveCell;
接下来考虑将 q 点坐标的单位转换为 SuperCell 的格矢
ModifiedSuperCell = SuperCellMultiplier * PrimativeCell;
SuperCell = SuperCellDeformation * ModifiedSuperCell;
ReciprocalModifiedSuperCell = ModifiedSuperCell.inverse().transpose();
ReciprocalSuperCell = SuperCell.inverse().transpose();
Qpoint = QpointByReciprocalModifiedSuperCell.transpose() * ReciprocalModifiedSuperCell;
Qpoint = QpointByReciprocalSuperCell.transpose() * ReciprocalSuperCell;
整理可以得到:
QpointByReciprocalSuperCell = SuperCellDeformation * QpointByReciprocalModifiedSuperCell;
两个式子结合,可以得到:
QpointByReciprocalSuperCell = SuperCellDeformation * SuperCellMultiplier * QpointByReciprocalPrimitiveCell;
*/
auto qpoint_by_reciprocal_super_cell =
(
super_cell_transformation * qpoint_in_reciprocal_primitive_cell_by_reciprocal_primitive_cell
).eval();
/*
到目前为止,我们还没有移动过 q 点的坐标。现在,我们将它移动整数个 ReciprocalSuperCell直到它落在超胞的倒格子中。
这等价于直接取 QpointByReciprocalSuperCell - QpointByReciprocalSuperCell.floor()。
*/
return (qpoint_by_reciprocal_super_cell.array() - qpoint_by_reciprocal_super_cell.array().floor()).matrix();
};
auto input = YAML::LoadFile(config_file).as<Input>();
Output output;
output.Qpoints = input.Qpoints
| ranges::views::transform([&](auto& qpoint)
{
return fold(qpoint, input.SuperCellDeformation * input.SuperCellMultiplier.cast<double>().asDiagonal());
})
| ranges::to_vector;
// 默认的输出太丑了,但是不想手动写了,忍一下
std::ofstream(input.OutputFile.value_or("output.yaml")) << YAML::Node(output);
}

17
packages/ufo/src/main.cpp Normal file
View File

@@ -0,0 +1,17 @@
# include <ufo.hpp>
int main(int argc, const char** argv)
{
if (argc != 3)
throw std::runtime_error(fmt::format("Usage: {} task config.yaml", argv[0]));
if (argv[1] == std::string("fold"))
ufo::fold(argv[2]);
else if (argv[1] == std::string("unfold"))
ufo::unfold(argv[2]);
else if (argv[1] == std::string("plot-band"))
ufo::plot_band(argv[2]);
else if (argv[1] == std::string("plot-point"))
ufo::plot_point(argv[2]);
else
throw std::runtime_error(fmt::format("Unknown task: {}", argv[1]));
}

431
packages/ufo/src/plot.cpp Normal file
View File

@@ -0,0 +1,431 @@
# include <ufo.hpp>
# include <matplot/matplot.h>
# include <boost/container/flat_map.hpp>
void ufo::plot_band(std::string config_file)
{
struct Input
{
std::string UnfoldedDataFile;
// 要画图的 q 点路径列表
// 内层表示一个路径上的 q 点,外层表示不同的路径
// 单位为倒格矢
std::vector<std::vector<Eigen::Vector3d>> Qpoints;
// 插值时使用的分辨率(不影响画出来图片的分辨率和横纵比)
std::array<std::size_t, 2> InterpolationResolution;
// 画图区域的y轴和x轴的比例。如果不指定则由matplot++自动调整(通常调整为正方形,即 1
std::optional<double> AspectRatio;
// 整张图片的分辨率
std::optional<std::array<std::size_t, 2>> PictureResolution;
// 画图的频率范围
std::array<double, 2> FrequencyRange;
// 搜索 q 点时的阈值,单位为埃^-1
std::optional<double> ThresholdWhenSearchingQpoints;
// 是否要在 y 轴上作一些标记
std::optional<std::vector<std::pair<double, std::string>>> YTicks;
// 是否输出图片
std::optional<std::string> OutputPictureFile;
// 是否输出数据,可以进一步使用 matplotlib 画图
std::optional<std::string> OutputDataFile;
};
// 根据 q 点路径, 搜索要使用的 q 点,返回的是 q 点在 QpointData 中的索引以及到路径起点的距离,以及这段路径的总长度
auto search_qpoints = []
(
const Eigen::Matrix3d& primative_cell,
const std::pair<Eigen::Vector3d, Eigen::Vector3d>& path,
const std::vector<Eigen::Vector3d>& qpoints,
double threshold, bool exclude_endpoint = false
)
{
// 对于 output 中的每一个点, 检查这个点是否在路径上. 如果在, 把它加入到 selected_qpoints 中
// 键为这个点到起点的距离
boost::container::flat_map<double, std::size_t> selected_qpoints;
auto begin = (path.first.transpose() * primative_cell.reverse()).transpose().eval();
auto end = (path.second.transpose() * primative_cell.reverse()).transpose().eval();
for (std::size_t i = 0; i < qpoints.size(); i++)
for (auto cell_shift
: biu::sequence(Eigen::Vector3i(-1, -1, -1), Eigen::Vector3i(2, 2, 2)))
{
auto qpoint
= ((qpoints[i] + cell_shift.first.cast<double>()).transpose() * primative_cell.reverse()).transpose().eval();
// 计算这个点到前两个点所在直线的距离
auto distance = (end - begin).cross(qpoint - begin).norm()
/ (path.second - path.first).norm();
// 如果这个点到前两个点所在直线的距离小于阈值, 则认为这个点在这条直线上,但不一定在这两个点之间
if (distance < threshold)
{
// 计算这个点到前两个点的距离, 两个距离都应该小于两点之间的距离
auto distance1 = (qpoint - begin).norm();
auto distance2 = (qpoint - end).norm();
auto distance3 = (end - begin).norm();
if (distance1 < distance3 + threshold && distance2 < distance3 + threshold)
// 如果这个点不在终点处, 或者不排除终点, 则加入
if (distance2 > threshold || !exclude_endpoint) selected_qpoints.emplace(distance1, i);
}
}
// 去除非常接近的点
for (auto it = selected_qpoints.begin(); it != selected_qpoints.end();)
{
auto next = std::next(it);
if (next == selected_qpoints.end()) break;
else if (next->first - it->first < threshold) selected_qpoints.erase(next);
else it = next;
}
if (selected_qpoints.empty()) throw std::runtime_error("No q points found");
return std::make_pair(selected_qpoints, (end - begin).norm());
};
// 根据搜索到的 q 点, 计算图中每个点的值
auto calculate_values = []
(
// search_qpoints 的第一个返回值
const boost::container::flat_map<double, std::size_t>& path,
// 每一条连续路径的第一个 q 点的索引
const std::set<std::size_t>& path_begin,
// 所有 q 点的数据(需要用到它的频率和权重)
const std::vector<UnfoldOutput::QpointDataType>& qpoints,
// 用于插值的分辨率和范围
const std::array<std::size_t, 2>& resolution,
const std::array<double, 2>& frequency_range,
// 路径的总长度
double total_distance
)
{
// 按比例混合两个 q 点的结果,得到可以用于画图的那一列数据
auto blend = [&]
(
// 两个点的索引
std::size_t a, std::size_t b,
// 按照连续路径混合还是按照断开的路径混合
bool continuous,
// 第一个点占的比例
double ratio,
std::size_t resolution, std::array<double, 2> frequency_range
) -> std::vector<double>
{
// 混合得到的频率和权重
std::vector<double> frequency, weight;
// 如果是连续路径,将每个模式的频率和权重按照比例混合
if (continuous)
{
assert(qpoints[a].ModeData.size() == qpoints[b].ModeData.size());
for (std::size_t i = 0; i < qpoints[a].ModeData.size(); i++)
{
frequency.push_back
(qpoints[a].ModeData[i].Frequency * ratio + qpoints[b].ModeData[i].Frequency * (1 - ratio));
weight.push_back(qpoints[a].ModeData[i].Weight * ratio + qpoints[b].ModeData[i].Weight * (1 - ratio));
}
}
// 如果是不连续路径,将每个模式的权重乘以比例,最后相加
else
{
for (std::size_t i = 0; i < qpoints[a].ModeData.size(); i++)
{
frequency.push_back(qpoints[a].ModeData[i].Frequency);
weight.push_back(qpoints[a].ModeData[i].Weight * ratio);
}
for (std::size_t i = 0; i < qpoints[b].ModeData.size(); i++)
{
frequency.push_back(qpoints[b].ModeData[i].Frequency);
weight.push_back(qpoints[b].ModeData[i].Weight * (1 - ratio));
}
}
std::vector<double> result(resolution);
for (std::size_t i = 0; i < frequency.size(); i++)
{
std::ptrdiff_t index = (frequency[i] - frequency_range[0]) / (frequency_range[1] - frequency_range[0])
* resolution;
if (index >= 0 && index < static_cast<std::ptrdiff_t>(resolution)) result[index] += weight[i];
}
return result;
};
std::vector<std::vector<double>> values;
for (std::size_t i = 0; i < resolution[0]; i++)
{
auto current_distance = total_distance * i / resolution[0];
auto it = path.lower_bound(current_distance);
if (it == path.begin()) values.push_back(blend
(it->second, it->second, true, 1, resolution[1], frequency_range));
else if (it == path.end()) values.push_back(blend
(
std::prev(it)->second, std::prev(it)->second, true, 1,
resolution[1], frequency_range
));
else values.push_back(blend
(
std::prev(it)->second, it->second, !path_begin.contains(it->second),
(it->first - current_distance) / (it->first - std::prev(it)->first),
resolution[1], frequency_range
));
}
return values;
};
// 根据数值, 画图
auto plot = []
(
const std::vector<std::vector<double>>& values,
const std::string& filename,
const std::vector<double>& x_ticks, const std::vector<double>& y_ticks,
const std::vector<std::string>& y_ticklabels,
const std::optional<double>& aspect_ratio,
const std::optional<std::array<std::size_t, 2>>& resolution
)
{
std::vector<std::vector<double>>
r(values[0].size(), std::vector<double>(values.size(), 0)),
g(values[0].size(), std::vector<double>(values.size(), 0)),
b(values[0].size(), std::vector<double>(values.size(), 0)),
a(values[0].size(), std::vector<double>(values.size(), 0));
for (std::size_t i = 0; i < values[0].size(); i++)
for (std::size_t j = 0; j < values.size(); j++)
{
auto v = values[j][i];
if (v < 0.05) v = 0;
a[i][j] = v * 100 * 255;
if (a[i][j] > 255) a[i][j] = 255;
r[i][j] = 255 - v * 2 * 255;
if (r[i][j] < 0) r[i][j] = 0;
g[i][j] = 255 - v * 2 * 255;
if (g[i][j] < 0) g[i][j] = 0;
b[i][j] = 255;
}
auto f = matplot::figure(true);
auto ax = f->current_axes();
auto image = ax->image(std::tie(r, g, b));
image->matrix_a(a);
ax->y_axis().reverse(false);
ax->x_axis().tick_values(x_ticks);
ax->x_axis().tick_length(1);
ax->x_axis().ticklabels(std::vector<std::string>(x_ticks.size()));
ax->y_axis().tick_values(y_ticks);
ax->y_axis().tick_length(1);
ax->y_axis().ticklabels(y_ticklabels);
if (aspect_ratio)
{
ax->axes_aspect_ratio_auto(false);
ax->axes_aspect_ratio(*aspect_ratio);
}
if (resolution)
{
f->width((*resolution)[0]);
f->height((*resolution)[1]);
}
f->save(filename, "png");
};
auto input = YAML::LoadFile(config_file).as<Input>();
auto unfolded_data = biu::deserialize<UnfoldOutput>
(biu::read<std::byte>(input.UnfoldedDataFile));
// 搜索画图需要用到的 q 点
// key 到起点的距离value 为 q 点在 QpointData 中的索引
boost::container::flat_map<double, std::size_t> path;
// 每一条连续路径的第一个 q 点在 path 中的索引
std::set<std::size_t> path_begin;
// x 轴的刻度,为 path 中的索引
std::set<std::size_t> x_ticks_index;
double total_distance = 0;
for (auto& line : input.Qpoints)
{
assert(line.size() >= 2);
path_begin.insert(path.size());
for (std::size_t i = 0; i < line.size() - 1; i++)
{
x_ticks_index.insert(path.size());
auto [this_path, this_distance] = search_qpoints
(
unfolded_data.PrimativeCell, {line[i], line[i + 1]},
unfolded_data.QpointData
| ranges::views::transform(&UnfoldOutput::QpointDataType::Qpoint)
| ranges::to_vector,
input.ThresholdWhenSearchingQpoints.value_or(0.001),
i != line.size() - 2
);
path.merge
(
this_path
| ranges::views::transform([&](auto& p)
{ return std::make_pair(p.first + total_distance, p.second); })
| ranges::to<boost::container::flat_map>
);
total_distance += this_distance;
}
}
// 计算画图的数据
auto values = calculate_values
(
path, path_begin, unfolded_data.QpointData, input.InterpolationResolution,
input.FrequencyRange, total_distance
);
auto x_ticks = x_ticks_index | ranges::views::transform([&](auto i)
{ return path.nth(i)->first / total_distance * input.InterpolationResolution[0]; }) | ranges::to<std::vector>;
auto y_ticks = input.YTicks.value_or(std::vector<std::pair<double, std::string>>{})
| biu::toLvalue | ranges::views::keys
| ranges::views::transform([&](auto i)
{
return (i - input.FrequencyRange[0]) / (input.FrequencyRange[1] - input.FrequencyRange[0])
* input.InterpolationResolution[1];
})
| ranges::to_vector;
auto y_ticklabels = input.YTicks.value_or(std::vector<std::pair<double, std::string>>{})
| biu::toLvalue | ranges::views::values | ranges::to_vector;
if (input.OutputPictureFile) plot
(
values, input.OutputPictureFile.value(),
x_ticks, y_ticks, y_ticklabels, input.AspectRatio, input.PictureResolution
);
if (input.OutputDataFile)
biu::Hdf5file(input.OutputDataFile.value(), true)
.write("Values", values)
.write("XTicks", x_ticks)
.write("YTicks", y_ticks)
.write("YTickLabels", y_ticklabels)
.write("InterpolationResolution", input.InterpolationResolution)
.write("FrequencyRange", input.FrequencyRange);
}
void ufo::plot_point(std::string config_file)
{
struct Input
{
std::string UnfoldedDataFile;
// 要画图的 q 点
Eigen::Vector3d Qpoint;
// 插值的分辨率
std::size_t InterpolationResolution;
std::optional<double> AspectRatio;
std::optional<std::array<std::size_t, 2>> PictureResolution;
// 画图的频率范围
std::array<double, 2> FrequencyRange;
// 搜索 q 点时的阈值,单位为埃^-1
std::optional<double> ThresholdWhenSearchingQpoints;
// 是否要在 z 轴上作一些标记
std::optional<std::vector<std::pair<double, std::string>>> XTicks;
// 是否输出图片
std::optional<std::string> OutputPictureFile;
// 是否输出插值后数据,可以进一步使用 matplotlib 画图
std::optional<std::string> OutputDataFile;
// 是否输出插值前数据,可以配合 phonopy 结果深入研究
std::optional<std::string> OutputRawDataFile;
};
// 根据 q 点路径, 搜索要使用的 q 点,返回的是 q 点在 QpointData 中的索引
auto search_qpoints = []
(
const Eigen::Matrix3d& primative_cell,
const Eigen::Vector3d& qpoint, const std::vector<Eigen::Vector3d>& qpoints,
double threshold
)
{
biu::Logger::Guard log(qpoint);
// 对于 output 中的每一个点, 检查这个点是否与所寻找的点足够近,如果足够近则返回
for (std::size_t i = 0; i < qpoints.size(); i++)
for (auto cell_shift
: biu::sequence(Eigen::Vector3i(-1, -1, -1), Eigen::Vector3i(2, 2, 2)))
{
auto this_qpoint
= (primative_cell.reverse().transpose() * (qpoints[i] + cell_shift.first.cast<double>())).eval();
if ((this_qpoint - primative_cell.reverse().transpose() * qpoint).norm() < threshold) return log.rtn(i);
}
throw std::runtime_error("No q points found");
};
// 根据搜索到的 q 点, 计算图中每个点的值
auto calculate_values = []
(
// q 点的数据(需要用到它的频率和权重)
const UnfoldOutput::QpointDataType& qpoint,
// 用于插值的分辨率和范围
std::size_t resolution,
const std::array<double, 2>& frequency_range
)
{
biu::Logger::Guard log;
std::vector<double> result(resolution);
for (auto& mode : qpoint.ModeData)
{
double index_double = (mode.Frequency - frequency_range[0]) / (frequency_range[1] - frequency_range[0])
* (resolution - 1);
std::ptrdiff_t index = std::round(index_double);
if (index >= 0 && index < static_cast<std::ptrdiff_t>(resolution)) result[index] += mode.Weight;
}
return log.rtn(result);
};
// 根据数值, 画图
auto plot = []
(
const std::vector<double>& values, const std::string& filename,
const std::vector<double>& x_ticks, const std::vector<std::string>& x_ticklabels,
const std::optional<double>& aspect_ratio, const std::optional<std::array<std::size_t, 2>>& resolution
)
{
biu::Logger::Guard log;
auto f = matplot::figure(true);
auto ax = f->current_axes();
auto image = ax->area(values, 0, false, "");
ax->y_axis().reverse(false);
ax->x_axis().tick_values(x_ticks);
ax->x_axis().tick_length(1);
ax->x_axis().ticklabels(x_ticklabels);
ax->y_axis().tick_values({});
if (aspect_ratio)
{
ax->axes_aspect_ratio_auto(false);
ax->axes_aspect_ratio(*aspect_ratio);
}
if (resolution)
{
f->width((*resolution)[0]);
f->height((*resolution)[1]);
}
f->save(filename, "png");
};
biu::Logger::Guard log;
auto input = YAML::LoadFile(config_file).as<Input>();
auto unfolded_data = biu::deserialize<UnfoldOutput>
(biu::read<std::byte>(input.UnfoldedDataFile));
auto qpoint_index = search_qpoints
(
unfolded_data.PrimativeCell, input.Qpoint,
unfolded_data.QpointData
| ranges::views::transform(&UnfoldOutput::QpointDataType::Qpoint)
| ranges::to_vector,
input.ThresholdWhenSearchingQpoints.value_or(0.001)
);
auto values = calculate_values
(
unfolded_data.QpointData[qpoint_index],
input.InterpolationResolution, input.FrequencyRange
);
auto x_ticks = input.XTicks.value_or(std::vector<std::pair<double, std::string>>{})
| biu::toLvalue | ranges::views::keys
| ranges::views::transform([&](auto i)
{
return (i - input.FrequencyRange[0]) / (input.FrequencyRange[1] - input.FrequencyRange[0])
* input.InterpolationResolution;
})
| ranges::to_vector;
auto x_ticklabels = input.XTicks.value_or(std::vector<std::pair<double, std::string>>{})
| biu::toLvalue | ranges::views::values | ranges::to_vector;
if (input.OutputPictureFile) plot
(
values, input.OutputPictureFile.value(),
x_ticks, x_ticklabels, input.AspectRatio, input.PictureResolution
);
if (input.OutputDataFile)
biu::Hdf5file(input.OutputDataFile.value(), true)
.write("Values", values)
.write("XTicks", x_ticks)
.write("XTickLabels", x_ticklabels)
.write("InterpolationResolution", input.InterpolationResolution)
.write("FrequencyRange", input.FrequencyRange);
if (input.OutputRawDataFile)
std::ofstream(*input.OutputRawDataFile) << YAML::Node(unfolded_data.QpointData[qpoint_index]);
}

345
packages/ufo/src/unfold.cpp Normal file
View File

@@ -0,0 +1,345 @@
# include <ufo.hpp>
# include <thread>
# include <syncstream>
# include <execution>
void ufo::unfold(std::string config_file)
{
// 反折叠的原理: 将超胞中的原子运动状态, 投影到一组平面波构成的基矢中.
// 每一个平面波的波矢由两部分相加得到: 一部分是单胞倒格子的整数倍, 所取的个数有一定任意性, 论文中建议取大约单胞中原子个数那么多个;
// 对于没有缺陷的情况, 取一个应该就足够了.
// 这些平面波以原胞为周期。
// 另一部分是超胞倒格子的整数倍, 取 n 个, n 为超胞对应的单胞的倍数, 其实也就是倒空间中单胞对应倒格子中超胞的格点.
// 只要第一部分取得足够多, 那么单胞中原子的状态就可以完全被这些平面波描述.
// 将超胞中原子的运动状态投影到这些基矢上, 计算出投影的系数, 就可以将超胞的原子运动状态分解到单胞中的多个 q 点上.
struct Input
{
// 单胞的三个格矢,每行表示一个格矢的坐标,单位为埃
Eigen::Matrix3d PrimativeCell;
// 单胞到超胞的格矢转换时用到的矩阵
// SuperCellMultiplier 是一个三维列向量且各个元素都是整数,表示单胞在各个方向扩大到多少倍之后,可以得到和超胞一样的体积
// SuperCellDeformation 是一个行列式为 1 的矩阵,它表示经过 SuperCellMultiplier 扩大后,还需要怎样的变换才能得到超胞
// SuperCell = (SuperCellDeformation * SuperCellMultiplier.asDiagonal()) * PrimativeCell
// ReciprocalPrimativeCell = (SuperCellDeformation * SuperCellMultiplier.asDiagonal()).transpose()
// * ReciprocalSuperCell
// Position = PositionToCell(line vector) * Cell
// InversePosition = InversePositionToCell(line vector) * ReciprocalCell
// PositionToSuperCell(line vector) * SuperCell = PositionToPrimativeCell(line vector) * PrimativeCell
// ReciprocalPositionToSuperCell(line vector) * ReciprocalSuperCell
// = ReciprocalPositionToPrimativeCell(line vector) * ReciprocalPrimativeCell
Eigen::Matrix3d SuperCellDeformation;
Eigen::Vector3i SuperCellMultiplier;
// 在单胞内取几个平面波的基矢
Eigen::Vector<std::size_t, 3> PrimativeCellBasisNumber;
// 超胞中原子的坐标,每行表示一个原子的坐标,单位为超胞的格矢
Eigen::MatrixX3d AtomPositionBySuperCell;
// 从 band.hdf5 读入 QpointData
std::optional<std::string> QpointDataInputFile;
// 输出到哪些文件
struct QpointDataOutputFileType
{
std::string Filename;
// 如果指定,则将结果投影到那些原子上
std::optional<std::vector<std::size_t>> SelectedAtoms;
// 默认输出为 zpp 文件,如果指定为 true则输出为 yaml 文件
std::optional<bool> OutputAsYaml;
};
std::vector<QpointDataOutputFileType> QpointDataOutputFile;
};
// 从文件中读取 QpointData
auto read_qpoint_data = [](std::string filename)
{
// 读入原始数据
// phonopy 的输出有两种可能
// 直接指定计算的 q 点时frequency 是 2 维,这时第一个维度是 q 点,第二个维度是不同模式
// 计算能带时frequency 是 3 维,相比于二维的情况多了第一个维度,表示 q 点所在路径
// qpoint 或 path以及 eigenvector 也有类似的变化
// eigenvector 是三维或四维的数组,后两个维度分别表示原子运动和模式(而不是模式和原子),
// 因为后两个维度的尺寸总是一样的(模式个数等于原子坐标个数),非常容易搞错
std::vector<std::array<double, 3>> qpoint;
std::vector<std::vector<double>> frequency;
std::vector<std::vector<std::vector<biu::PhonopyComplex>>> eigenvector_vector;
auto file = biu::Hdf5file(filename);
if (file.File.getDataSet("/frequency").getDimensions().size() == 2)
file.read("/frequency", frequency)
.read("/eigenvector", eigenvector_vector)
.read("/qpoint", qpoint);
else
{
std::vector<std::vector<std::array<double, 3>>> temp_path;
std::vector<std::vector<std::vector<double>>> temp_frequency;
std::vector<std::vector<std::vector<std::vector<biu::PhonopyComplex>>>> temp_eigenvector_vector;
file.read("/frequency", temp_frequency)
.read("/eigenvector", temp_eigenvector_vector)
.read("/path", temp_path);
frequency = temp_frequency | ranges::views::join | ranges::to_vector;
qpoint = temp_path | ranges::views::join | ranges::to_vector;
eigenvector_vector = temp_eigenvector_vector | ranges::views::join | ranges::to_vector;
}
// 整理得到结果
auto number_of_qpoints = frequency.size(), num_of_modes = frequency[0].size();
std::vector<UnfoldOutput::MetaQpointDataType> qpoint_data(number_of_qpoints);
for (std::size_t i = 0; i < number_of_qpoints; i++)
{
qpoint_data[i].Qpoint = qpoint[i] | biu::toEigen<>;
qpoint_data[i].ModeData.resize(num_of_modes);
for (std::size_t j = 0; j < num_of_modes; j++)
{
qpoint_data[i].ModeData[j].Frequency = frequency[i][j];
auto number_of_atoms = eigenvector_vector[i].size() / 3;
Eigen::MatrixX3cd eigenvectors(number_of_atoms, 3);
for (std::size_t k = 0; k < number_of_atoms; k++) for (std::size_t l = 0; l < 3; l++)
eigenvectors(k, l)
= eigenvector_vector[i][k * 3 + l][j].r + eigenvector_vector[i][k * 3 + l][j].i * 1i;
// 原则上讲,需要对读入的原子运动状态作相位转换, 使得它们与我们的约定一致(对超胞周期性重复),但这个转换 phonopy 已经做了
// 这里还要需要做归一化处理 (指将数据简单地作为向量处理的归一化)
qpoint_data[i].ModeData[j].AtomMovement = eigenvectors / eigenvectors.norm();
}
}
return qpoint_data;
};
// 构建基
// 每个 q 点对应一组 sub qpoint。不同的 q 点所对应的 sub qpoint 是不一样的,但 sub qpoint 与 q 点的相对位移在不同 q 点之间是相同的。
// 由于基只与这个相对位置有关(也就是说,不同 q 点的基是一样的),因此可以先计算出所有的基,这样降低计算量。
// 外层下标对应超胞倒格子的整数倍那部分(第二部分), 也就是不同的 sub qpoint
// 内层下标对应单胞倒格子的整数倍那部分(第一部分), 也就是 sub qpoint 上的不同平面波(取的数量越多,结果越精确)
auto construct_basis = []
(
Eigen::Matrix3d primative_cell, Eigen::Vector3i super_cell_multiplier,
Eigen::Vector<std::size_t, 3> primative_cell_basis_number, Eigen::MatrixX3d atom_position
)
{
biu::Logger::Guard log;
std::vector<std::vector<Eigen::VectorXcd>> basis(super_cell_multiplier.prod());
// diff_of_sub_qpoint 表示 sub qpoint 与 qpoint 的相对位置,单位为超胞的倒格矢
for (auto [diff_of_sub_qpoint_by_reciprocal_modified_super_cell, i_of_sub_qpoint]
: biu::sequence(super_cell_multiplier))
{
basis[i_of_sub_qpoint].resize(primative_cell_basis_number.prod());
for (auto [xyz_of_basis, i_of_basis]
: biu::sequence(primative_cell_basis_number))
{
// 计算 q 点的坐标, 单位为单胞的倒格矢
auto diff_of_sub_qpoint_by_reciprocal_primative_cell = xyz_of_basis.cast<double>()
+ super_cell_multiplier.cast<double>().cwiseInverse().asDiagonal()
* diff_of_sub_qpoint_by_reciprocal_modified_super_cell.cast<double>();
// 将单位转换为埃^-1
auto diff_of_sub_qpoint = (diff_of_sub_qpoint_by_reciprocal_primative_cell.transpose()
* (primative_cell.transpose().inverse())).transpose();
// 计算基矢
basis[i_of_sub_qpoint][i_of_basis]
= (2i * std::numbers::pi_v<double> * (atom_position * diff_of_sub_qpoint)).array().exp();
}
}
return basis;
};
// 计算从超胞到原胞的投影系数(不是分原子的投影系数),是反折叠的核心步骤
// 返回的投影系数是一个三维数组,第一维对应不同的 q 点,第二维对应不同的模式,第三维对应不同的 sub qpoint
auto construct_projection_coefficient = []
(
const std::vector<std::vector<Eigen::VectorXcd>>& basis,
// 实际上只需要其中的 AtomMovement
const std::vector<UnfoldOutput::MetaQpointDataType>& qpoint_data,
std::atomic<std::size_t>& number_of_finished_modes
)
{
// 将所有的模式取出,组成一个一维数组,稍后并行计算
std::vector<std::reference_wrapper<const Eigen::MatrixX3cd>> mode_data;
for (auto& qpoint : qpoint_data) for (auto& mode : qpoint.ModeData)
mode_data.emplace_back(mode.AtomMovement);
// 第一层下标对应不同模式, 第二层下标对应这个模式在反折叠后的 q 点(sub qpoint)
std::vector<std::vector<double>> projection_coefficient(mode_data.size());
// 对每个模式并行
std::transform
(
std::execution::par_unseq, mode_data.begin(), mode_data.end(),
projection_coefficient.begin(), [&](const auto& mode_data)
{
// 这里, mode_data 和 projection_coefficient 均指对应于一个模式的数据
std::vector<double> projection_coefficient(basis.size());
for (std::size_t i_of_sub_qpoint = 0; i_of_sub_qpoint < basis.size(); i_of_sub_qpoint++)
// 对于 basis 中, 对应于单胞倒格子的部分, 以及对应于不同方向的部分, 分别求内积, 然后求模方和
for (std::size_t i_of_basis = 0; i_of_basis < basis[i_of_sub_qpoint].size(); i_of_basis++)
projection_coefficient[i_of_sub_qpoint] +=
(basis[i_of_sub_qpoint][i_of_basis].transpose().conjugate() * mode_data.get())
.array().abs2().sum();
// 如果是严格地将向量分解到一组完备的基矢上, 那么不需要对计算得到的权重再做归一化处理
// 但这里并不是这样一个严格的概念. 因此对分解到各个 sub qpoint 上的权重做归一化处理
auto sum = ranges::accumulate(projection_coefficient, 0.);
for (auto& _ : projection_coefficient) _ /= sum;
number_of_finished_modes++;
return projection_coefficient;
}
);
// 将计算得到的投影系数重新组装成三维数组
// 第一维是 meta qpoint第二维是模式第三维是 sub qpoint
std::vector<std::vector<std::vector<double>>> projection_coefficient_output;
for
(
std::size_t i_of_meta_qpoint = 0, num_of_mode_manipulated = 0;
i_of_meta_qpoint < qpoint_data.size();
i_of_meta_qpoint++, num_of_mode_manipulated += qpoint_data[i_of_meta_qpoint].ModeData.size()
)
projection_coefficient_output.emplace_back
(
projection_coefficient.begin() + num_of_mode_manipulated,
projection_coefficient.begin() + num_of_mode_manipulated + qpoint_data[i_of_meta_qpoint].ModeData.size()
);
return projection_coefficient_output;
};
// 组装输出,即将投影系数应用到原始数据上
auto construct_output = []
(
const Input& input,
const std::vector<std::vector<std::vector<double>>>& projection_coefficient,
const std::vector<UnfoldOutput::MetaQpointDataType>& qpoint_data,
const std::optional<std::vector<std::size_t>>& selected_atoms
)
{
UnfoldOutput output;
output.PrimativeCell = input.PrimativeCell;
output.SuperCellMultiplier = input.SuperCellMultiplier;
output.SuperCellDeformation = input.SuperCellDeformation;
output.SelectedAtoms = selected_atoms;
output.MetaQpointData = qpoint_data;
for (std::size_t i_of_meta_qpoint = 0; i_of_meta_qpoint < qpoint_data.size(); i_of_meta_qpoint++)
{
// 如果需要投影到特定的原子上,需要先计算当前 meta qpoint 的不同模式的投影系数
std::optional<std::vector<double>> projection_coefficient_on_atoms;
if (selected_atoms)
{
projection_coefficient_on_atoms.emplace();
for (std::size_t i_of_mode = 0; i_of_mode < qpoint_data[i_of_meta_qpoint].ModeData.size(); i_of_mode++)
{
projection_coefficient_on_atoms->emplace_back(0);
for (auto atom : *selected_atoms)
projection_coefficient_on_atoms->back()
+= qpoint_data[i_of_meta_qpoint].ModeData[i_of_mode].AtomMovement.row(atom).array().abs2().sum();
projection_coefficient_on_atoms->back() *=
static_cast<double>(qpoint_data[i_of_meta_qpoint].ModeData[i_of_mode].AtomMovement.rows())
/ selected_atoms->size();
}
}
for
(
auto [diff_of_sub_qpoint_by_reciprocal_modified_super_cell, i_of_sub_qpoint]
: biu::sequence(input.SuperCellMultiplier)
)
{
auto& _ = output.QpointData.emplace_back();
/*
SubQpointByReciprocalModifiedSuperCell = XyzOfDiffOfSubQpointByReciprocalModifiedSuperCell +
MetaQpointByReciprocalModifiedSuperCell;
SubQpoint = SubQpointByReciprocalModifiedSuperCell.transpose() * ReciprocalModifiedSuperCell;
SubQpoint = SubQpointByReciprocalPrimativeCell.transpose() * ReciprocalPrimativeCell;
ReciprocalModifiedSuperCell = ModifiedSuperCell.inverse().transpose();
ReciprocalPrimativeCell = PrimativeCell.inverse().transpose();
ModifiedSuperCell = SuperCellMultiplier.asDiagonal() * PrimativeCell;
MetaQpoint = MetaQpointByReciprocalModifiedSuperCell.transpose() * ReciprocalModifiedSuperCell;
MetaQpoint = MetaQpointByReciprocalSuperCell.transpose() * ReciprocalSuperCell;
ReciprocalSuperCell = SuperCell.inverse().transpose();
ModifiedSuperCell = SuperCellDeformation * SuperCell;
SuperCell = SuperCellMultiplier.asDiagonal() * PrimativeCell;
整理可以得到:
SubQpointByReciprocalPrimativeCell = SuperCellMultiplier.asDiagonal().inverse() *
(XyzOfDiffOfSubQpointByReciprocalModifiedSuperCell +
SuperCellDeformation.inverse() * MetaQpointByReciprocalSuperCell);
但注意到, 这样得到的 SubQpoint 可能不在 ReciprocalPrimativeCell 中
(当 SuperCellDeformation 不是单位矩阵时, 边界附近的一两条 SubQpoint 会出现这种情况).
解决办法是, 在赋值时, 仅取 SubQpointByReciprocalPrimativeCell 的小数部分.
*/
auto sub_qpoint_by_reciprocal_primative_cell =
(
input.SuperCellMultiplier.cast<double>().cwiseInverse().asDiagonal()
* (
diff_of_sub_qpoint_by_reciprocal_modified_super_cell.cast<double>()
+ input.SuperCellDeformation.inverse() * qpoint_data[i_of_meta_qpoint].Qpoint
)
).eval();
_.Qpoint = sub_qpoint_by_reciprocal_primative_cell.array()
- sub_qpoint_by_reciprocal_primative_cell.array().floor();
_.Source = qpoint_data[i_of_meta_qpoint].Qpoint;
_.SourceIndex = i_of_meta_qpoint;
for (std::size_t i_of_mode = 0; i_of_mode < qpoint_data[i_of_meta_qpoint].ModeData.size(); i_of_mode++)
{
auto& __ = _.ModeData.emplace_back();
__.Frequency = qpoint_data[i_of_meta_qpoint].ModeData[i_of_mode].Frequency;
__.Weight = projection_coefficient[i_of_meta_qpoint][i_of_mode][i_of_sub_qpoint];
if (selected_atoms)
__.Weight *= projection_coefficient_on_atoms.value()[i_of_mode];
}
}
}
return output;
};
biu::Logger::Guard log;
log.info("Reading input file... ");
auto input = YAML::LoadFile(config_file).as<Input>();
auto qpoint_data = read_qpoint_data(input.QpointDataInputFile.value_or("band.hdf5"));
log.info("Done.");
std::clog << "Constructing basis... " << std::flush;
auto basis = construct_basis
(
input.PrimativeCell, input.SuperCellMultiplier,
input.PrimativeCellBasisNumber,
input.AtomPositionBySuperCell
* (input.SuperCellDeformation * input.SuperCellMultiplier.cast<double>().asDiagonal() * input.PrimativeCell)
);
std::clog << "Done." << std::endl;
std::clog << "Calculating projection coefficient... " << std::flush;
// 用来在屏幕上输出进度的计数器和线程
std::atomic<std::size_t> number_of_finished_modes(0);
auto number_of_modes = ranges::accumulate
(
qpoint_data
| ranges::views::transform([](const auto& qpoint)
{ return qpoint.ModeData.size(); }),
0ul
);
std::atomic<bool> finished;
std::thread print_thread([&]
{
while (true)
{
std::osyncstream(std::clog)
<< "\rCalculating projection coefficient... ({}/{})"_f(number_of_finished_modes, number_of_modes)
<< std::flush;
std::this_thread::sleep_for(100ms);
if (finished) break;
}
});
auto projection_coefficient = construct_projection_coefficient(basis, qpoint_data, number_of_finished_modes);
finished = true;
print_thread.join();
std::clog << "\33[2K\rCalculating projection coefficient... Done." << std::endl;
std::clog << "Writing data... " << std::flush;
for (auto& output_file : input.QpointDataOutputFile)
{
auto output = construct_output
(input, projection_coefficient, qpoint_data, output_file.SelectedAtoms);
if (output_file.OutputAsYaml.value_or(false)) std::ofstream(output_file.Filename) << YAML::Node(output);
else std::ofstream(output_file.Filename, std::ios::binary) << biu::serialize<char>(output);
}
std::clog << "Done." << std::endl;
}

View File

@@ -0,0 +1,18 @@
SuperCellMultiplier: [3, 4, 1]
SuperCellDeformation:
- [ 1, 0, 0 ]
- [ 0.6666, 1, 0 ]
- [ 0, 0, 1 ]
Qpoints:
- [0, 0, 0]
- [0.05, 0, 0]
- [0.1, 0, 0]
- [0.15, 0, 0]
- [0.2, 0, 0]
- [0.25, 0, 0]
- [0.3, 0, 0]
- [0.35, 0, 0]
- [0.4, 0, 0]
- [0.45, 0, 0]
- [0.5, 0, 0]
OutputFile: fold-output.yaml

View File

@@ -1,15 +1,21 @@
{
stdenv, src, wrapGAppsHook3, autoreconfHook, gfortran, gtk3, intltool, gtk-doc, pkg-config, libepoxy, libyaml,
libxslt, libGLU, wayland, makeWrapper
stdenv, lib, src,
wrapGAppsHook, autoreconfHook, autoconf, libtool, intltool, gettext, automake, gtk-doc, pkg-config, gfortran, libxslt,
glib, gtk3, libepoxy, libyaml
}:
stdenv.mkDerivation
{
name = "v-sim";
inherit src;
buildInputs = [ gtk3 libepoxy libyaml libGLU ];
nativeBuildInputs = [ autoreconfHook wrapGAppsHook3 gfortran intltool gtk-doc pkg-config libxslt makeWrapper ];
buildInputs = [ glib gtk3 libepoxy libyaml ];
nativeBuildInputs =
[
autoreconfHook wrapGAppsHook autoconf libtool intltool gettext automake pkg-config
gtk-doc gfortran libxslt.bin
];
enableParallelBuilding = true;
postPatch = "./autogen.sh";
dontWrapGApps = true;
postFixup = ''wrapProgram $out/bin/v_sim "''${gappsWrapperArgs[@]}" --set GDK_BACKEND x11'';
postPatch =
''
./autogen.sh
'';
}

View File

@@ -1,9 +0,0 @@
{ stdenv, src, gfortran, lapack }: stdenv.mkDerivation
{
name = "vaspberry";
inherit src;
nativeBuildInputs = [ gfortran ];
buildInputs = [ lapack ];
buildPhase = "gfortran vaspberry_gfortran_serial.f -std=legacy -llapack -o vaspberry";
installPhase = "mkdir -p $out/bin && cp vaspberry $out/bin";
}