mirror of
https://github.com/CHN-beta/nixos.git
synced 2026-01-12 04:19:22 +08:00
Compare commits
243 Commits
split-desk
...
next-debug
| Author | SHA1 | Date | |
|---|---|---|---|
| 8a21069aa2 | |||
| afeeade925 | |||
| 4334f84710 | |||
| a0735f00e4 | |||
| d77fd05405 | |||
| e0bec05c59 | |||
| 7aeb283101 | |||
| 745525f41f | |||
| 08e99e9fe1 | |||
| 45551ba438 | |||
| 5ddf6cebaa | |||
| e2b2801a37 | |||
| e71c7ef993 | |||
| 2c5e6fb4f0 | |||
| f5f5dd5724 | |||
| cf00062fab | |||
| 0a672ca144 | |||
| 7c1fba7939 | |||
| 525147f9d4 | |||
| 5f12da16ec | |||
| 62d3c7ed4a | |||
| 9333bd01d4 | |||
| c7eb349ca2 | |||
| ddd4cd667d | |||
| f97fad608d | |||
| 8115d2a0c6 | |||
| dd01486bb4 | |||
| c30304abac | |||
| 6e736c8093 | |||
| eb97197d0d | |||
| 629980e81b | |||
| 174e893fbb | |||
| 57fdb9ff6e | |||
| f14ea18b30 | |||
| 224026ed3c | |||
| c509149fbe | |||
| dc3e9819fd | |||
| ade11c0e06 | |||
| 0844e08bc9 | |||
| 7556cd2879 | |||
| 8989e30455 | |||
| 374c1ef112 | |||
| 3945a494f2 | |||
| bb11c24eaa | |||
| 95d54a1a0f | |||
| aa635de7f2 | |||
| 4e19f686b8 | |||
| f172f3d44a | |||
| 474990323c | |||
| d00729a7bf | |||
| 39636c14c8 | |||
| 449e62b52c | |||
| 6ffabba263 | |||
| 1e4077af0c | |||
| 0743dc3255 | |||
| dbd2833bfd | |||
| 386a46e884 | |||
| e5020092da | |||
| 57d09cb3ba | |||
| c274af61a5 | |||
| 19e3acc4f4 | |||
| 965d6b01aa | |||
| 0cb75a802a | |||
| db04febfa2 | |||
| 1a35c9e742 | |||
| 47ab4876b5 | |||
| d0839dc726 | |||
| c8ed0a7a02 | |||
| b492c82b45 | |||
| 22464c272a | |||
| f58e2e3eba | |||
| 4af5512f85 | |||
| ec9d89a592 | |||
| 7785cea534 | |||
| 355ccbbcc7 | |||
| 9c678b4e0c | |||
| 5dd21a1b44 | |||
| 0ab4353016 | |||
| 01711bd339 | |||
| 8caee452ad | |||
| 4c71ca5642 | |||
| 89ad32bac6 | |||
| 731756cd38 | |||
| e4bab2b5d5 | |||
| 0bf23f71e9 | |||
| 7ed3355f62 | |||
| 18cf44e270 | |||
| 38697d89a7 | |||
| 1d7b25f2f1 | |||
| 4ec6fe4a27 | |||
| 29420a8521 | |||
| 1291cda91f | |||
| c7d2badc74 | |||
| 9b2e8dc472 | |||
| fdee36fb97 | |||
| b5753b7b05 | |||
| aaeea6a22d | |||
| 7b40f61b8a | |||
| 7197e19188 | |||
| 815dfaab7e | |||
| 4e4f32c82e | |||
| 2335a510dc | |||
| 06f2ec22d3 | |||
| 93f11a5776 | |||
| 5047ae84a0 | |||
| dbf23db014 | |||
| b5d6f29a3a | |||
| 440fe83e22 | |||
| 972f33599b | |||
| 3aa9fbc75f | |||
| 14232bf369 | |||
| a31c7e5485 | |||
| 72e14db25f | |||
| c82cc289b0 | |||
| 4c9b3cf6cb | |||
| 4e90a8aa47 | |||
| 6a5888d63e | |||
| 483df46bfa | |||
| 03c4161725 | |||
| b815650666 | |||
| d69f2911cc | |||
| 3a49f53714 | |||
| 668e5a2ea3 | |||
| 118ff59ce2 | |||
| 9941446351 | |||
| bd32f705bc | |||
| 46f109cce1 | |||
| 2bc088ce85 | |||
| a9df0cabda | |||
| f9ebd70b38 | |||
| ed8ec81674 | |||
| 10495ee0cd | |||
| 41cf7f2c63 | |||
| b28255e866 | |||
| a661584161 | |||
| 055f63f0c9 | |||
| fd120e0ca9 | |||
| 045f7ec30e | |||
| e0f992ead9 | |||
| ba2ac91a4d | |||
| 788f44f6a0 | |||
| 7d72356996 | |||
| 451da06005 | |||
| 4516bf7d69 | |||
| 10cc12788c | |||
| 6066245021 | |||
| 0dfb95d722 | |||
| bdcb968392 | |||
| e999735cd6 | |||
| c136bd2243 | |||
| 387b82d0d1 | |||
| a2d2422b92 | |||
| 4753d78ed3 | |||
| 4cb8ae548a | |||
| 008fc61887 | |||
| ecadca93b3 | |||
| ec85e19bb1 | |||
| 87a8e7eb84 | |||
| fc6a692bfc | |||
| 4f79141d1b | |||
| 9ab1997e78 | |||
| 348830084b | |||
| 3302666b76 | |||
| 3b858d88ea | |||
| 9efe69151c | |||
| f1e2be106e | |||
| 7533ef13cc | |||
| 422c1f7615 | |||
| e5fd732788 | |||
| 58786cef0e | |||
| 3ce244eb30 | |||
| ffad809c4a | |||
| 9719e19879 | |||
| 30415da2d1 | |||
| 4c5e3f696c | |||
| aff9b29c1c | |||
| 47cd032906 | |||
| 1fe31395f6 | |||
| 79926e1a7a | |||
| 5255cb2845 | |||
| 139405b891 | |||
| 1a109ff0f9 | |||
| 1d295d2cbb | |||
| 4e82ca7811 | |||
| 2d1bfb84eb | |||
| 42f84e2f6d | |||
| ff84538460 | |||
| ea9170e3d3 | |||
| dc48d30d75 | |||
| 83e54aa09d | |||
| 6920f5d845 | |||
| 405dc14ce7 | |||
| eb8ea76980 | |||
| fc41506c1f | |||
| 3e7a50df5f | |||
| 21a4afe164 | |||
| 103a78431d | |||
| f5a153d1a3 | |||
| 6d237e3b90 | |||
| 614113b297 | |||
| 2bb94ef0a2 | |||
| 173a88ba1a | |||
| 6d2321a24a | |||
| 8cfcb30895 | |||
| 5f0cba97e0 | |||
| 9ef3cd7cfd | |||
| f5dc63cbbc | |||
| 0bdfca6de0 | |||
| abb296f4eb | |||
| 80167bda73 | |||
| dd2cab14d7 | |||
| 8e49002d3e | |||
| c2572a79f8 | |||
| 8d673f2d93 | |||
| 618be8cca0 | |||
| a7451983e7 | |||
| 0541d0929d | |||
| 178e421846 | |||
| b74cfc2102 | |||
| 45dae9fd01 | |||
| 6640f317af | |||
| e000248e5b | |||
| 4bc6db326d | |||
| d8d8211493 | |||
| b06a14c327 | |||
| 4eee83a7d8 | |||
| 0fa545ff9a | |||
| 8769d365b1 | |||
| a7e2391a64 | |||
| 9a9fe6cbd8 | |||
| d1941d99e7 | |||
| 749c04f283 | |||
| 7dc3015c9b | |||
| a3486a2a2c | |||
| 8feb4677ba | |||
| 25e317841d | |||
| 473279d295 | |||
| cfb1e3e727 | |||
| bab71d6f90 | |||
| abe81f230c | |||
| 7fb18889e0 | |||
| d45e033314 | |||
| 8232e3c794 |
6
bugs.md
Normal file
6
bugs.md
Normal file
@@ -0,0 +1,6 @@
|
||||
* pc: 使用 cachyos 内核时,一些外接显示器无法使用。
|
||||
* pc: 使用 amd 显卡时,原神明显卡顿。
|
||||
* 桌面壁纸无法保存
|
||||
* 桌面任务栏设置无法保存
|
||||
* xray 没有放行防火墙指定的端口
|
||||
* gtk 没有主题
|
||||
3
devices/jykang.xmuhpc/.bash_logout
Normal file
3
devices/jykang.xmuhpc/.bash_logout
Normal file
@@ -0,0 +1,3 @@
|
||||
if [ -z "${CHN_DEBUG-}" ]; then
|
||||
hpcstat logout
|
||||
fi
|
||||
3
devices/jykang.xmuhpc/.bash_profile
Normal file
3
devices/jykang.xmuhpc/.bash_profile
Normal file
@@ -0,0 +1,3 @@
|
||||
if [ -f ~/.bashrc ]; then
|
||||
. ~/.bashrc
|
||||
fi
|
||||
41
devices/jykang.xmuhpc/.bashrc
Normal file
41
devices/jykang.xmuhpc/.bashrc
Normal file
@@ -0,0 +1,41 @@
|
||||
# This is really FOLLISH but it works
|
||||
if [ -z "${BASHRC_SOURCED-}" ]; then
|
||||
if [[ $TERM == chn_unset_ls_colors* ]]; then
|
||||
export TERM=${TERM#*:}
|
||||
export CHN_LS_USE_COLOR=1
|
||||
fi
|
||||
if [[ $TERM == chn_cd* ]]; then
|
||||
export TERM=${TERM#*:}
|
||||
cd ~/${TERM%%:*}
|
||||
export TERM=${TERM#*:}
|
||||
fi
|
||||
if [[ $TERM == hpcstat_subaccount* ]]; then
|
||||
export TERM=${TERM#*:}
|
||||
export HPCSTAT_SUBACCOUNT=${TERM%%:*}
|
||||
export TERM=${TERM#*:}
|
||||
fi
|
||||
if [[ $TERM == chn_debug* ]]; then
|
||||
export TERM=${TERM#*:}
|
||||
export CHN_DEBUG=1
|
||||
fi
|
||||
|
||||
export HPCSTAT_DATADIR=$HOME/linwei/chn/software/hpcstat/var/lib/hpcstat
|
||||
export HPCSTAT_SHAREDIR=$HOME/linwei/chn/software/hpcstat/share/hpcstat
|
||||
export HPCSTAT_SSH_BINDIR=$HOME/linwei/chn/software/hpcstat/bin
|
||||
export HPCSTAT_BSUB=/opt/ibm/lsfsuite/lsf/10.1/linux2.6-glibc2.3-x86_64/bin/bsub
|
||||
${HPCSTAT_SSH_BINDIR}/hpcstat login
|
||||
if [ "$?" -ne 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -f /etc/bashrc ]; then
|
||||
. /etc/bashrc
|
||||
fi
|
||||
|
||||
if [ -z "${BASHRC_SOURCED-}" ]; then
|
||||
export PATH=$HPCSTAT_SSH_BINDIR:$PATH:$HOME/bin:$HOME/linwei/chn/software/scripts
|
||||
export BASHRC_SOURCED=1
|
||||
fi
|
||||
|
||||
[ -n "$CHN_LS_USE_COLOR" ] && alias ls="ls --color=auto"
|
||||
14
devices/jykang.xmuhpc/.ssh/authorized_keys
Normal file
14
devices/jykang.xmuhpc/.ssh/authorized_keys
Normal file
@@ -0,0 +1,14 @@
|
||||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDXlhoouWG+arWJz02vBP/lxpG2tUjx8jhGBnDeNyMu0OtGcnHMAWcb3YDP0A2XJIVFBCCZMM2REwnSNbHRSCl1mTdRbelfjA+7Jqn1wnrDXkAOG3S8WYXryPGpvavu6lgW7p+dIhGiTLWwRbFH+epFTn1hZ3A1UofVIWTOPdoOnx6k7DpQtIVMWiIXLg0jIkOZiTMr3jKfzLMBAqQ1xbCV2tVwbEY02yxxyxIznbpSPReyn1RDLWyqqLRd/oqGPzzhEXNGNAZWnSoItkYq9Bxh2AvMBihiTir3FEVPDgDLtS5LUpM93PV1yTr6JyCPAod9UAxpfBYzHKse0KCQFoZH chn@chn-PC
|
||||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDWAfyfDFctbzJTiuK9IPw3yFLqt7vqd/T0/HoZfH/bzLZ8GVeod2oz6kjm3ns0IG94HO5vGMEmQfbK1ZKT2TqA7ve+3wG9seiwfh8xh7Xhl2AnaF0pjHEXnw+w8mTzxCv9qRhsgfHuuBVhH6PguHvk66GKjvNaxTJhlKAyNogOI3jLnw7ODFScldHbJlMYl1pBHV/G/Zeuq0qnA/pkeiFdvlsZUVGD0cCfuoHm8FCfEzv6pfkhVJUH0v5rof8GiT9eg7ntG49Gei1lkH5NosbY8f6fEKNSoOc0dm5g2FaI3D7LJixwQ6rMiJwmPb6A4oHmcJQKokU8uhROQorYLgV7RtrnHu2cHMRW6SiAUvpmvaPPcxn8CbfuSOGDhYRKxNJNtWRK08Urtq9tYD+Fpze4QoZXxN35uvsi3lMA55PK0AsTm/aVGslzHUUzgWtDxcI2pLAm9rFpCRPCY+UC1Xp5vjZoqZXwhJ81qZ7VXWTM2voxCrKAlu+Zg2FaQD5szOU= gb@xmupc1
|
||||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDJ/jzUQ6QuAjnAryvpWk7TReS6pnHxhEXY9RonojKkurhfYSQO/IlxDMDq23TFXcgu8iZG4cS6MADgx/KNZD/MjuN9YNCIEGvMwzWvB0oM25BC6Vf3iKDmhH06rZKH6/g5GN+HWoCN4yE/+MhIpegFO3+YMpveXwEESlyoIjPvcW+RwmlNJevrHd83ETYDQ4AybWyJo6en5tz2ngr22HaK4MtxgrqnIN/KorY+nrzTNa7VBC7BaZc1tA5FLwUeCXtuzp2ibfrxoGUAiDig4FW09ijCk3Y77y7aNVI2nw5y28nCV5rgVMh5fejtNVqIqku7p+8qgjxvY6veATG0lYgZgw2ldnDGDNbEGxcCnKKmCgZMxok8zTRsniZ91KuHkcl2L7xUo7kdQYzBRwZyQ53eW+yPoqUya4yn272rscBEUMyZzmegfr1SXMqw/8zn+MZdr1KXEvrbfjX+2QL52GY3bfYUf3KFje+Sp88k688bRH0vrxj9BCOS7ovbyfe9BEU= xll@xmupc1
|
||||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCtnVhZQsJfbs2w9hFZkx4qDhIs++7no+6r5TifP3Dq7epJYd2QYx4dI66XxTNhKxZjN6a4Xn5nFlYLtQJXOvzBLC8IBf1W5GCH0k/jqzzskS0/Ix/70HzcBwJk8ihWDkyON5Ki1BRCx34RNxth1BIxWyc5QT+lou+D92x8iAu/uOvmcAL3Ua0OlZwxw03hLp/PpS4ZnUqFjc2JVtarY7eQu/i3RwOZUaK6nT2EL8RObzk4xnieqsU5PWwA3voVjetqZaDQ+P7dimQXz/FaucroKxCNyTiy1oG4fdQpm2UDrH6ZfPvdQLYrtet6FQabXOxhV7MuR3jYtxZjs1kDVZIseIZ6IwjetaUoMxvIouRfYjOSIEo9Ek9o0+Yhku4r0uWmPDrymWugU1raMmlRxSUwdlzW+C7mQwtGbs/MG4MN4GWkM6id5DKlY2vYKUfrTzmhY1swCtzKq20fjvyX8qhJdcytgVlOrBZnPje6Qd55sI0RjdgJrBsxT2SYquez7U8= yjq@xmupc1
|
||||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDn1pfGen7kjPTHsbb8AgrUJWOeFPHK5S4M97Lcj3tvdcjZi2SXN6PwHQfh8/xGhZbTLPz/40S9O9/Dn30xkUTfnONirKt790jp7VEbOtPnjQPOd/KRNWlS3VV0BELuq5p633Mi13rP6JZtdKmU2uSkvvaUBfCppy3JaWv/B7HLJ48f8IzkdiT1px3dN1eQ4SFoHOiVG0ci5TGG6wfMdoAAnM9R1aXI4gDxnYjLYujpaNZ4hBOta/6ZK/PV0JufoXdIAZjubgk1Hv04XHXLR2Z0UhRM6x7UrZIOdM/LlnKmcVk408ZKEj/9m1xRyDsNoZ24CF++cmnwfBHrp9I5nvDI7xOTdZlOhzkiiPM3f4i6s2Qjdv4vpZ6AeE3Qt1LVQyAr67b4UMjHuYqSi2KgyCO6My2Ov2eRoS74EKcb8ejJv3O+XInmYUgDgTgDFT3CgQgK2DG45HiV6nOkaE/6iKx2JSOiYZTFc7TRcePfXF9JQD7dXFde6qm3EbIVyJIpCJ8= zem@xmupc1
|
||||
|
||||
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
|
||||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDkT/P4MnzxBh8sRi0oQ88duNpY/ejFtptGqUQJVobj23vbu7ju6x/yuXqnHFOLi/IOZgNl5oBhRlJekRL+FWMIwpPBA6MnbVNkHXvwu5kLXVTt0O9dhJfDiPPbYcNjOhw4o8aZMc0oEyz8xZgkPoIehHQda+K5vRhFnYCRgn2X92VY/dW1QqPJKEfN47Tsp00w8wyKixEvuJe8OBEoKDpiZYzbXJKuoKhCdMp0uMHMCojYuYP9rGZO6bHl7Q6cYotGx1jH2pe30Ujtm3Xbm44H1mhXr1K/lhcHfojSge8POqii+eaXSCzqRlXaWyvrL9JLaaRD7GfWDaRWSKDfN8Ha4mnUvRtObRMSLOnr2QOTLJw9QPnlDDxCd1q7yluKraccYnTQQP5JuBwkRqjuJTatd9b18Z14HffmXZNR7asT1sJXK1rWKeLTrZwqxpkuwLAnbr60PVwfMHZeZ6FVPXGZ4wQb22lFHvaZZCEJf+9QDXpDn5L59FlaBYO2Xwojj3s= 02@xmuhpc
|
||||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDOF3LfnQiI8wpsXGn87bt7rbUZcgsdaOSOswk4Vf4dBautEdQZc0q+UDB2TlR2K8L7SPyywpl5z67euN5QRJLEwg8flTybiJp3EKDctYEM22sa36ONcSIJ/iHSdCkwtPXkBYreh9e+MAHfTroIKK5zM/P1QIN3NrknIXpWjLDF73ejrxE+EXRK6jbuWfo+5dnLnDoUFt1e+pYLZos5KRRB94Qt5I79D/cAg3hG+Zl2FCCOpn1hIdLo/kWJTKUPe61oUaIxriV6nCXp/pU1BHlM43hGowiHa4bVZIs8Eo4r7OI9thhSuS2BKSifibBKIicZtntSlS/I3xa5am28YLmrOiEXRsjPom7trO8qIhPfYOc/yFDg1gcpLxyNroCPooPBzPxUqrTT96Q4fDDTaqfyuVxQFxbYoFAqQs8/lw6WcGJ4fGC5JPsPiwoSdQy/B7gCfQcFjPXp1NH8Sx+xMLCmxRqdKSyeiEwoyB0tZ6ngaI73HFhCPX1/rLx3xv0zd/8= 03@xmuhpc
|
||||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC96jp6qFrWt4651Arg+Ua6AU3CjftZuounKLlZ8s268Lo9Cba+nmoOGRNzefqr+f6/7KmFKd9+jqS3ZnKFQbzRFVzzHHIT7tSlgxFRw+yb553/vgm7z6d0HGd3B7XjpIpR7DrM/unnXtiT/WuX+UIKKQ1S4kHp4fTJxZuwzYgNWDsT7O/5H7nBoRVuUSG/achCzTq5V5WfNjvrGZypCmcCw5MTH3Iab4qQ7fhRK46e/OpgSMmsY1ZuEynIwVtimW4G10MUWZdawN4LHBNsCDBmBu0H1DYBb9AUW5IuifAyFPPlTOPtuzpEganaMwotcXiAwhfPQg1c0TfbB4ZJPow612dzxcflHAJyFy2LXbiG0rF48h0GpW5gY92QkeMQcbybKOS5yVlXynNNg0nL1bx+reu7Fy4jurc0facTaqzpSiyXsBLSOva+DZrxl2MBDLEdykkQMNIY69GeeC2XIN4tbfGDYU8VVtwnXJUkmeHAge5ypI1kkPhYRDxPDspym9M= 04@xmuhpc
|
||||
|
||||
|
||||
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJRWge2+B1Et03n/B4ALBcAnjvtWPPmcFAoIlLP8oFkB hpcstat
|
||||
165
devices/jykang.xmuhpc/.vaspkit
Normal file
165
devices/jykang.xmuhpc/.vaspkit
Normal file
@@ -0,0 +1,165 @@
|
||||
# cp how_to_set_environment_variables ~/.vaspkit and modify the ~/.vaspkit file based on the settings in your supercomputer!
|
||||
# All environment variables are case sensitive.
|
||||
VASP5 = .TRUE. # .TRUE. or .FALSE.; Set .FALSE. if you are using vasp.4.x
|
||||
LDA_PATH = /data/gpfs01/jykang/linwei/chn/software/vaspkit-1.4.1/POTCAR/PAW_LDA
|
||||
PBE_PATH = /data/gpfs01/jykang/linwei/chn/software/vaspkit-1.4.1/POTCAR/PAW_PBE
|
||||
GGA_PATH = /data/gpfs01/jykang/linwei/chn/software/vaspkit-1.4.1/POTCAR/PAW_PW91
|
||||
VASPKIT_UTILITIES_PATH = /data/gpfs01/jykang/linwei/chn/software/vaspkit-1.4.1/utilities
|
||||
PYTHON_BIN = /data/gpfs01/jykang/linwei/chn/software/scripts/chn_python3.sh
|
||||
POTCAR_TYPE = PBE # PBE, PW91 or LDA; Set PBE if you want to make PBE-POTCAR file
|
||||
GW_POTCAR = .FALSE. # .TRUE. or .FALSE.; For example, H_GW, O_GW will be chose when POTCAR_GW set to .TRUE.
|
||||
RECOMMENDED_POTCAR = .TRUE. # .TRUE. or .FALSE.; The recommended PAW potential will be chose when RECOMMENDED_POTCAR set to .TRUE.
|
||||
SET_FERMI_ENERGY_ZERO = .TRUE. # .TRUE. or .FALSE.; The Fermi Energy will be set to zero eV when SET_FERMI_ENERGY_ZERO set to .TRUE.
|
||||
SET_MINI_INCAR = .FALSE. # .TRUE. or .FALSE.; A simplified INCAR will be written when MINI_INCAR set to .TRUE.
|
||||
USER_DEFINED_INCAR = .FALSE. # .TRUE. or .FALSE.; whether to use embedded INCAR templates or user defined INCAR templates
|
||||
WRITE_SELECTIVE_DYNAMICS = .FALSE. # .TRUE. or .FALSE.; the selective dymanics set will be forced to write when SET_SELECTIVE_DYNAMICS_MODE set to .TRUE.
|
||||
GET_DOS_FROM_HYBRID_BAND = .FASLE. # .TRUE. or .FALSE.; whether to calculate DOS using optimized tetrahedron method in the hybrid band strucutre calculations
|
||||
ADVANCED_USER = .TRUE. # .TRUE. or .FALSE.; Please fill in your settings in the block 'USER_DEFINED' if you want vaspkit to integrate your own scripts in the 'UTILITIES' file.
|
||||
SET_INCAR_WRITE_MODE = OVERRIDE # OVERRIDE, APPEND, BACK-UP-OLD,BACK-UP-NEW; "Customize INCAR File" whether to override existing or appending existing INCAR/backup existing INCAR to INCAR.old && write into INCAR/write into INCAR.new
|
||||
APPLY_SCISSOR_CORRECTION = .FALSE. # .TRUE. or .FALSE.; whether to rigidly shift of the conduction band with respect to the valence band of nonmagnetic semiconductors to matches with that of the experimental, HSE or GW value (default: .FALSE)
|
||||
APPLY_PHS_CORRECTION = .FALSE. # .TRUE. or .FALSE.; whether to make PHS correction during linear optical calculations. More details are given in Comput. Mater. Sci. 172 (2020) 109315
|
||||
NORMALIZE_ORBITAL_WEIGHTS = .FALSE. # .TRUE. or .FALSE.; whether to normalize orbital-projected weights in each state (default: .FALSE.)
|
||||
REORIENTATE_LATTICE_VECTORS = .FALSE. # .TRUE. or .FALSE.; reorientate lattice vectors when build supercell or heterojunction or not (default: .FALSE.)
|
||||
GET_IRREDUCIBLE_KPOINTS = .TRUE. # .TRUE. or .FALSE.; Control whether to generate k-points in the symmetry-irreducible wedge of the Brillouin Zone (default: .TRUE.)
|
||||
FACTOR_ENCUT2NPWS = 0.262465831d0 # Adjust the final decimal place (or one beyond that) of this parameter if you encounter an error message saying that “Error: the calculated NPWS is not equal to the read NPWS”.
|
||||
SYMMETRY_TOLERANCE = 1E-5 # Tolerance in Cartesian coordinates to find crystal symmetry, compatibility with SYMPREC (default: 1E-5)
|
||||
LATTICE_TOLERANCE = 0.2 # Float lattice tolerance for the lattice vectors (default: 0.2 angstrom)
|
||||
ANGLE_TOLERANCE = 0.2 # Float angle tolerance for the lattice vectors in degrees (default: 0.2 degree)
|
||||
EMIN = -20.0 # Minimum energy for evaluation of DOS (default: -20.0 eV)
|
||||
EMAX = 20.0 # Maximum energy for evaluation of DOS (default: 20.0 eV)
|
||||
SIGMA = 0.2 # The width of the smearing to calculate DOS from eigenvalue (default: 0.2 eV)
|
||||
NEDOS = 2001 # Number of grid points in DOS (default: 2001)
|
||||
GAMMA_CENTERED = .TRUE. # .TRUE. or .FALSE. (default: .TRUE.).
|
||||
VACUUM_THICKNESS = 15.0 # The thickness of vacuum to build slab or 2D materials (default: 10 angstrom)
|
||||
CENTER_SLAB = .TRUE. # Center the slab in the z direction; (default: .TRUE.)
|
||||
|
||||
# New added in Version 1.3.0
|
||||
MAX_ATOM_NUMBER = 10000 # The maximum number of atoms to screen heterostructures (default: 10000)
|
||||
MIN_ATOM_NUMBER = 1 # The minimum number of atoms to screen heterostructures (default: 1)
|
||||
MIN_LATTICE_ANGLE = 0.0 # The minimum lattice angle to screen heterostructures (default: 0.0)
|
||||
MAX_LATTICE_ANGLE = 180.0 # The maximum lattice angle to screen heterostructures (default: 180.0)
|
||||
GET_INTERPOLATED_DATA = .FALSE. # .TRUE. or .FALSE.; Whether to interpolate the grid data of charge/spin density, potential, band structure, etc. (default: .FALSE.)
|
||||
INTERPOLATION_SPACING = 0.04 # Determines the number of interpolation grids, in unit of A in real-space or 1/A in reciprocal space (default: 0.04)
|
||||
INTERPOLATION_METHOD = 'cubic' # 'linear', 'cubic' (3rd order-spline interpolation), quartic (4th order-spline interpolation), or FFT available only for 2D and 3D grids (default method: 'cubic')
|
||||
AUTO_SUBMIT_JOB = .FALSE. # .TRUE. or .FALSE. (default: .FASLE.). Whether to auto-submit vaspkit or vasp job or not.
|
||||
SUBMIT_JOB_COMMAND = 'qsub job.sh' # The command line to submit job
|
||||
AUTO_PLOT = .TRUE. # TRUE. or .FALSE. (default: .FASLE.). Whether to auto-plot data graphs in the post-processing.
|
||||
|
||||
# New added in Version 1.4.1
|
||||
REDUCE_FERMISURFACE_FILE = .FALSE. # TRUE. or .FALSE. (default: .FASLE.). Whether to write only the bands which cross the Fermi energy.
|
||||
WEIGHT_THRESHOLD = 0.00 # Threshold value of spectra weight in the band structure unfolding.
|
||||
|
||||
# New added in Version 1.5.0
|
||||
CENTER_DEFECT_POSITION = .TRUE. # Move the position of defect to the center of the supercell; (default value: .TRUE.)
|
||||
VACUUM_THICKNES = 10 # Vacuum thickness (default value: 10 Angstrom).
|
||||
UNWRAP_TRAJECTORIES = .TRUE. # Unwrap MD trajectories or not; (default value: .TRUE.)
|
||||
|
||||
#USER_DEFINED
|
||||
#Synopsis:The first parameter is the command-id,starting with 'u'; the second is the interpreter, like 'python/bash/perl'(Please left it blank if you are using an executive binary); the third is the name of a script or an executive binary; the fourth one is a switch, if any extra argv is needed, please set if .TRUE. ; the last on is the description, MUST use '_' as delimiter.
|
||||
# id interpreter script argv description
|
||||
#Example1 'u1 python get_entropy.py .TRUE. get_entropy'
|
||||
#Example2 'u2 hello.exe .FALSE. ls '
|
||||
|
||||
u1 python get_entropy.py .TRUE. get_entropy_for_adsorbate
|
||||
u2 python bader2pqr.py .FALSE. bader2pqr
|
||||
#END_USER_DEFINED
|
||||
|
||||
#+------------------------------------------------------------------------------------------------------------------+
|
||||
#| Customize VASP job script |
|
||||
#| Must copy the block from #BEGIN_CUSTOMIZE_JOB_SCRIPT to #END_CUSTOMIZE_JOB_SCRIPT |
|
||||
#+------------------------------------------------------------------------------------------------------------------+
|
||||
#BEGIN_CUSTOMIZE_JOB_SCRIPT
|
||||
#PBS -N name
|
||||
#PBS -o out
|
||||
#PBS -e err
|
||||
#PBS -l nodes=2:ppn=4
|
||||
#PBS -r y
|
||||
cd $PBS_O_WORKDIR
|
||||
mpirun -np 8 vasp_std > vasp-out
|
||||
#END_CUSTOMIZE_JOB_SCRIPT
|
||||
#+------------------------------------------------------------------------------------------------------------------+
|
||||
|
||||
#BEGIN_CUSTOMIZE_PLOT
|
||||
#+------------------------------------------------------------------------------------------------------------------+
|
||||
#| WARNNING! The character-type values of plot variables are case sensitive and must be enclosed in single quotes. |
|
||||
#+------------------------------------------------------------------------------------------------------------------+
|
||||
# https://matplotlib.org/3.3.3/tutorials/introductory/customizing.html
|
||||
# https://matplotlib.org/tutorials/text/text_props.html
|
||||
# https://github.com/rougier/matplotlib-cheatsheet
|
||||
# Advanced Features of VASPKIT Pro version
|
||||
figure_format = 'pdf' # string type (default: 'jpg'). Options: 'png', 'pdf', 'eps', 'jpg', etc.
|
||||
figure_height = 4.0 # float type (default: 4.0). The height of the figure.
|
||||
figure_width = 5.0 # float type (default: 5.0). The width of the figure.
|
||||
dpi = 400 # integer type (default: 400). The resolution of the figure in dots-per-inch.
|
||||
set_tight_layout = .FALSE. # .TRUE. or .FALSE (default: .FALSE.). Automatically adjust the padding between and around subplots.
|
||||
|
||||
# Global settings =
|
||||
figure_style = 'default' # string type (default: 'default'). Options: 'default', 'classic', 'grayscale', 'seaborn', 'bmh', 'seaborn-notebook', etc.
|
||||
font_family = 'arial' # string type (default: 'arial'). Options: 'fantasy','arial','sans-serif', 'monospace', 'cursive', 'serif', etc.
|
||||
global_fontsize = 12.0 # float type (default: 15.0).
|
||||
label_fontsize = 12.0 # float type (default: 15.0).
|
||||
number_format = '%.3f' # string type (default: 15.0).
|
||||
|
||||
# Legend-related settings =
|
||||
show_legend = .TRUE. # .TRUE. or .FALSE (default: .TRUE.).
|
||||
legend_location = 'best' # string type (default: 'best'). Options: 'best', 'upper right', 'upper left', 'lower left', 'lower right', 'right', 'center left', 'center right', 'lower center', 'upper center', 'center', etc.
|
||||
legend_fontsize = 12.0 # float type (default: 14.0).
|
||||
=
|
||||
# Line-related settings =
|
||||
line_colors = ['b', 'g', 'r', 'm'] # string type (default: 'blue'). Options: 'red', 'green', 'cyan', '#4c005c', etc.
|
||||
line_styles = ['-', '-', '-', '-'] # string type (default: '-'). Options: '-' or solid, '--' or 'dashed', '-.' or 'dashdot', etc.
|
||||
line_widths = [1.5, 1.5, 1.5] # float type (default: 1.5).
|
||||
line_alpha = [1.0, 1.0, 1.0] # float type (default: 1.0). 0.0< alpha <=1.0, adjust the transparency of each line (by default, alpha=1.0)
|
||||
fill_areas = .FALSE. # .TRUE. or .FALSE (default: .FLASE.). Fill the area between two horizontal curves.
|
||||
|
||||
# Marker-related settings =
|
||||
#marker_colors = ['blue', 'cyan', 'red', 'magenta', 'orange', 'lawngreen', 'deeppink', 'brown', 'dodgerblue']
|
||||
marker_symbols = ['o','o','o'] # string type (default: 'o'). Options: 'o': Circle, 'x': Cross, '+': Plus sign, 'D': Filled diamond, 's': Square, '^': Triangle, etc.
|
||||
marker_colors = ['#0db14b', '#4c005c', '#d93b2b','#0075dc', '#740aff', '#993f00', '#4c005c', '#426600']
|
||||
marker_sizes = [60, 60.0, 60.0] # float type (default: 10.0).
|
||||
marker_scale = 1.0 # float type (default: 1.0). marker_sizes = marker_sizes * marker_scale
|
||||
marker_alpha = [0.8, 0.7, 0.6, 0.5, 0.4] # float type (default: 1.0). 0.0< alpha <=1.0), adjust the transparency of markers (by default, alpha=1.0)
|
||||
|
||||
# Tick-related settings =
|
||||
#x_label = 'Wave vector' # string type (No default value).
|
||||
#y_label = 'Energy (eV)' # string type (No default value).
|
||||
#z_label = 'k$_x$ ($\\mathrm{\\AA}$)' # string type (No default value).
|
||||
#x_limits = [-8.0, 8.0] # float type [xmin, xmax] (No default value).
|
||||
#y_limits = [-8.0, 8.0] # float type [ymin, ymax] (No default value).
|
||||
#z_limits = [-8.0, 8.0] # float type [zmin, zmax] (No default value).
|
||||
#x_major_locator = 2.0 # float type (No default value).
|
||||
#y_major_locator = 2.0 # float type (No default value).
|
||||
#z_major_locator = 2.0 # float type (No default value).
|
||||
#x_minor_locator = 1.0 # float type (No default value).
|
||||
#y_minor_locator = 1.0 # float type (No default value).
|
||||
#z_minor_locator = 1.0 # float type (No default value).
|
||||
|
||||
# contour-related settings
|
||||
colormap = 'RdBu' # string typ (default: 'jet'). Options: 'jet', 'hsv', 'viridis', 'gray', etc.
|
||||
contour_levels = 5 # integer type (default: 5).
|
||||
contour_limits = [0.0, 0.5] # float type (No default value).
|
||||
display_colorbar = .FLASE. # .TRUE. or .FALSE (default: .FLASE.).
|
||||
display_level_value = .FLASE. # .TRUE. or .FALSE (default: .FLASE.).
|
||||
display_contour = .FLASE. # .TRUE. or .FALSE (default: .FLASE.).
|
||||
colorbar_shrink = 0.5 # float type (default: 0.4).
|
||||
colorbar_orientation = 'vertical' # 'horizontal' or 'vertical' (default: 'horizontal')
|
||||
|
||||
# 3D-plot related settings
|
||||
elevation = 12.0 # float type (default: 12).
|
||||
azimuth = 24.0 # float type (default: 23).
|
||||
display_coordinate_axes = .TRUE. # .TRUE. or .FALSE (default: .TRUE.).
|
||||
display_brillouin_zone = .TRUE. # .TRUE. or .FALSE (default: .TRUE.).
|
||||
axis_length = [1.0, 1.0, 1.0] # Determine the length of each axis
|
||||
box_linewidth = 1.0 # Specify the transparency level for the lines of the box or Brillouin zone
|
||||
box_linealpha = 1.0 # Evaluate the line width of the box or Brillouin zone
|
||||
|
||||
# XKCD sketch-style related settings
|
||||
xkcd_style = .FALSE. # .TRUE. or .FALSE (default: .FLASE.). Turn on xkcd sketch-style drawing mode or not.
|
||||
xkcd_scale = 1 # float type (default: 1.0). The amplitude of the wiggle perpendicular to the source line (default: 1).
|
||||
xkcd_length = 100 # float type (default: 100.0). The length of the wiggle along the line (default: 100).
|
||||
xkcd_randomness = 2 # float type (default: 2.0). The scale factor by which the length is shrunken or expanded (default: 2).
|
||||
|
||||
# band structure related settings
|
||||
disconnecte_band_paths = .TRUE. # .TRUE. or .FALSE (default: .TRUE.). Turn on disconnected band paths drawing mode or not.
|
||||
|
||||
#END_CUSTOMIZE_PLOT
|
||||
2
devices/jykang.xmuhpc/linwei/chn/software/hpcstat/bin/bsub
Executable file
2
devices/jykang.xmuhpc/linwei/chn/software/hpcstat/bin/bsub
Executable file
@@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env sh
|
||||
hpcstat submitjob "$@"
|
||||
@@ -32,36 +32,29 @@ inputs:
|
||||
{
|
||||
"/dev/disk/by-uuid/5cf1d19d-b4a5-4e67-8e10-f63f0d5bb649".mapper = "root1";
|
||||
"/dev/disk/by-uuid/aa684baf-fd8a-459c-99ba-11eb7636cb0d".mapper = "root2";
|
||||
"/dev/disk/by-uuid/a47f06e1-dc90-40a4-89ea-7c74226a5449".mapper = "root3";
|
||||
"/dev/disk/by-uuid/b3408fb5-68de-405b-9587-5e6fbd459ea2".mapper = "root4";
|
||||
"/dev/disk/by-uuid/a779198f-cce9-4c3d-a64a-9ec45f6f5495" = { mapper = "nix"; ssd = true; };
|
||||
};
|
||||
delayedMount = [ "/" "/nix" ];
|
||||
};
|
||||
swap = [ "/nix/swap/swap" ];
|
||||
rollingRootfs.waitDevices = [ "/dev/mapper/root2" ];
|
||||
rollingRootfs.waitDevices = [ "/dev/mapper/root2" "/dev/mapper/root3" "/dev/mapper/root4" ];
|
||||
};
|
||||
initrd.sshd.enable = true;
|
||||
grub.installDevice = "efi";
|
||||
nixpkgs.march = "silvermont";
|
||||
nix.substituters = [ "https://cache.nixos.org/" "https://nix-store.chn.moe" ];
|
||||
kernel.patches = [ "cjktty" "lantian" ];
|
||||
networking = { hostname = "nas"; networkd = {}; };
|
||||
gui.preferred = false;
|
||||
kernel.variant = "xanmod-latest";
|
||||
};
|
||||
hardware = { cpus = [ "intel" ]; gpu.type = "intel"; };
|
||||
packages.packageSet = "desktop-fat";
|
||||
services =
|
||||
{
|
||||
snapper.enable = true;
|
||||
fontconfig.enable = true;
|
||||
samba =
|
||||
{
|
||||
enable = true;
|
||||
hostsAllowed = "192.168. 127.";
|
||||
shares = { home.path = "/home"; root.path = "/"; };
|
||||
};
|
||||
samba = { enable = true; hostsAllowed = "192.168. 127."; shares = { home.path = "/home"; root.path = "/"; }; };
|
||||
sshd = {};
|
||||
xray.client.dae.wanInterface = [ "enp3s0" ];
|
||||
xrdp = { enable = true; hostname = [ "nas.chn.moe" "office.chn.moe" ]; };
|
||||
xray.client.dnsmasq.hosts."git.nas.chn.moe" = "127.0.0.1";
|
||||
groupshare = {};
|
||||
smartd.enable = true;
|
||||
beesd.instances =
|
||||
@@ -69,13 +62,6 @@ inputs:
|
||||
root = { device = "/"; hashTableSizeMB = 4096; threads = 4; };
|
||||
nix = { device = "/nix"; hashTableSizeMB = 128; };
|
||||
};
|
||||
frpClient =
|
||||
{
|
||||
enable = true;
|
||||
serverName = "frp.chn.moe";
|
||||
user = "nas";
|
||||
stcp.hpc = { localIp = "hpc.xmu.edu.cn"; localPort = 22; };
|
||||
};
|
||||
nginx = { enable = true; applications.webdav.instances."local.webdav.chn.moe" = {}; };
|
||||
wireguard =
|
||||
{
|
||||
@@ -84,6 +70,8 @@ inputs:
|
||||
publicKey = "xCYRbZEaGloMk7Awr00UR3JcDJy4AzVp4QvGNoyEgFY=";
|
||||
wireguardIp = "192.168.83.4";
|
||||
};
|
||||
hpcstat = {};
|
||||
gitea = { enable = true; hostname = "git.nas.chn.moe"; ssh = { hostname = "office.chn.moe"; port = 5440; }; };
|
||||
};
|
||||
user.users = [ "chn" "xll" "zem" "yjq" "gb" ];
|
||||
};
|
||||
|
||||
@@ -1,22 +1,27 @@
|
||||
xray-client:
|
||||
uuid: ENC[AES256_GCM,data:97aX07G5FPumdWcDxnYOs6fRgljXWuwyNXGg1d7zdbUUfNnb,iv:+wAC/DZXsg+evYFA4DMfLw5Ut3ExQl1RgZ/2AsNQDpo=,tag:ebD77muITHof+FQMydWobg==,type:str]
|
||||
acme:
|
||||
cloudflare.ini: ENC[AES256_GCM,data:/LpP1qoVS+CG+5ska6vtmagHNrhcgr5e1QRzDdbdCYGnDB8Nca/GmIogzHCXsogQY/rwGTCZoXLKKEGToYiThwk=,iv:R++I0ued2wrVsmM/vYvBVMOp9M7HyZIfDOVOlg7GALE=,tag:gYchPuh8MHk3EEnGb9g4WA==,type:str]
|
||||
token: ENC[AES256_GCM,data:OrYgBRU1VPpkpDzYMFHINfPSHsXEKABdZOcgiAiBJKcreBoaSVHUvg==,iv:XIeZPJhzmUi5ZHKBCYN5UA9HWH1K+26SvcIWVrHAYDA=,tag:3F93syLBZjcHwnRRkUEjlw==,type:str]
|
||||
users:
|
||||
xll: ENC[AES256_GCM,data:XLSsz6fZ23PPaJS1Y5C3FAOks3wzb2f+Pv8TgyKrDBfMeoLk1M37A00OGJ2wsYxkuR0JV6Uoh+hhRpTUjOQnmLfQrBxPxxP8DA==,iv:jxEZX/flxxduM1sdrYfGHfMtFMYduMg0Lr6hY1pkAPg=,tag:CYy0y1e2S2Txz1OSh+XDHA==,type:str]
|
||||
zem: ENC[AES256_GCM,data:VCVLfGO9a06XhAOBciFf1u7A5jaQikAt2wZf+dCAi1BglXpM6Hof1yAunadYOwLOBFgGlP19kX53CBBlZtaqZFL2GRDzXP0woQ==,iv:AFYtHCCkzNrllN/fjQ8GKYs2TyV3uj3BsU5n1tBQAmM=,tag:5dP7c5N4yG2NS4T+Vg0Zpg==,type:str]
|
||||
yjq: ENC[AES256_GCM,data:yn6eGrySCxlRsFioaE2p1qlTHkIGC9l64+edjuDvt232xc+iFeD03EYfuulyr0GxYFwnlAwtaJnyMi5eOrSd1W6HeV3Canzdbw==,iv:qTc6vA8uQza8CB+BvffEN9GqHkiwNM4h9RkqQR14ylk=,tag:UZ2GYCJLjcWLuVXlscLviw==,type:str]
|
||||
gb: ENC[AES256_GCM,data:jIR3EVdATYUgWmW4J8RdURJRmDBC84t0S/c2EzWwtFMtjgKlqg52fIfQ66i7RnIYRAoF+s4Ex0aLSejWgzQ69NA/AF0AIS7Y/Q==,iv:mvTCTP0E74QlvM8TcY4o49G5kNGs5HFx3YUrj6mCrwM=,tag:LXfIOyAB10XuHA6Cg7LBeQ==,type:str]
|
||||
frp:
|
||||
token: ENC[AES256_GCM,data:zYRZoWa3Llv0NiPXtSfhWUn+wt4uIcw8Wa+QBTzn7gLk6UVIA4FD7FLABBKoFbwg62Fo79Nn,iv:YZdOYkJf6BN76Z68nCtetKElJkqKiYmcx6UmLoIXSdo=,tag:5sC2vt3Z21KhgOU9mrfXhg==,type:str]
|
||||
stcp:
|
||||
hpc: ENC[AES256_GCM,data:lkpM4nzt8ymQ+5eV,iv:LvSShCSN8w0VsJYjICG9NWCMiw7NSPpoSZ+I2t7uILs=,tag:LLry5z4KpPdnN75x8dANqg==,type:str]
|
||||
nginx:
|
||||
detectAuth:
|
||||
chn: ENC[AES256_GCM,data:44vsExbVhO3gnD4Gme92eQ==,iv:LyDvZebs1sDL1/hZQiZdHoPBm4hXtBy56jR73zSH6Aw=,tag:w5xPHnK9XOSS0+97q8b5gQ==,type:str]
|
||||
maxmind-license: ENC[AES256_GCM,data:JbAnFQiDcJGwvb89sG2ro77nwwOWcDnqVcA902jwb2zzZci7PpXROw==,iv:eifkWK0oN73Ekn3oWzy6XbYK2GU+4tlnLPJ+96WOWJY=,tag:35ulsshxtUfOsSQOLgAt0g==,type:str]
|
||||
wireguard:
|
||||
privateKey: ENC[AES256_GCM,data:VPlB4wSbWqSYw3rYRwfAMa39xrPcPZfz7sV2Cq3rmOhifnUPwggxnA+51do=,iv:utnyrB6Yfe5O94Oq4HDVFm/lQ9ZBoyvUT68r2G2PdwA=,tag:snm01vA+z2yKK8d2i5i2ig==,type:str]
|
||||
telegram:
|
||||
token: ENC[AES256_GCM,data:NK9Eq3jUaMVNyPyqiXEkrc4m81c2CBg3p9TjpD8TQgKRYs2uxT9lsSrLMi02Rw==,iv:N2mjY9n7QuLD2PG4gNl79c933GTCCfw35XxluiLSuOA=,tag:ZLreEQoV+O0yhHw0CM00aQ==,type:str]
|
||||
chat: ENC[AES256_GCM,data:XJi6HftAygFH,iv:ea2m41/YXp0VyxR9U84xMCHdknZBhP2QUiX6zsipaFc=,tag:+/Y2bvUwrQsLVGUZp0Imwg==,type:str]
|
||||
hpcstat:
|
||||
key: ENC[AES256_GCM,data:3bMieouWGMEw8eu6z55TX66NAGiF/O5dRtnDTjDtNC3fmR4PTn+FreMZuA9+AjTPUm2GsS9esC6tULIzh+qTflnSrxqtTdKAbfqY6o8pPPpDJ9WWm4f/g3x8PnvlsyQDYCZ0MYKYg3cc6n60moCzv1WWlVsT8QUMTXQL3yb36vVzo4ELea4Gf2UkpfYKX89gFDtJK78srh7rj8rwoDiBs1qVUUnIBABUDLxoyC3Rym5yevrCJeFD+8AlIAIaMc62Kslw0lCCKKSaXGsFpppFYFwUTedi595eISEr4tIuPXVd4EECQchsYg+tInphIXebp/5rzXQM37yQEymImNRiMcxDWGR0B8Nq9XO+I5T8VOIb6xXCtvEeY2Z8nPfmUn9UHfvYzqFv3it5TCcd9J4SeBa2LVW8+YCIO/KitznL49O5SGAJUONIkcwMUhUuXQUFe/vnc+g8+yqB5ltCZtHWCOY2pCdmQpBRaZq55fcde5FNhxt3J8zCbu++oIn+ERSHadMIGMuGgGqzG6XDQJZN,iv:cbPCnNi2gX1gZIdcQd7HR3c/JEsWj3nv+x+OQ0bDs40=,tag:olrGr6t2Si39wl/1rR81ig==,type:str]
|
||||
postgresql:
|
||||
gitea: ENC[AES256_GCM,data:qssnsnlaEKwEnLbnpX+XDs7JK/2DdK1cxD6U2NddpCPnwfOinP2cuc1HLnteWQfYZXTuYM3VOXDEXQB9CexILA==,iv:+TVoTuqmxIsTlNPngMBBWgIvP5EQD5ROHZI4u0mSJGE=,tag:6X8hewc5a6C6nbuD5WozCQ==,type:str]
|
||||
mail:
|
||||
bot: ENC[AES256_GCM,data:ugfBeRM4Ks7j+V4lLOqHrA==,iv:QwXeSrfw+TTN5N42DaaA7YgpaIJX/E+kTv9p6eWSxEk=,tag:fLUDBhsvCbOiYqhq9TCzmw==,type:str]
|
||||
sops:
|
||||
kms: []
|
||||
gcp_kms: []
|
||||
@@ -41,8 +46,8 @@ sops:
|
||||
by9Rd0U0bzNiK21BQTNxN1RuQ09DQVkKJmSlzV5ppEkZFljsS17ZWmoI++fz4tJh
|
||||
kTdoAStG1zsKASHyZTsmdm3RBDO3qV1KhQC2gC7d4EiwNZngxOOZJg==
|
||||
-----END AGE ENCRYPTED FILE-----
|
||||
lastmodified: "2024-03-07T12:35:21Z"
|
||||
mac: ENC[AES256_GCM,data:bR4PPHaGX6VCRP+Ze96sccnwYxnZkfpmJp6iMBzr+W3JRd0VjTEwTH8aNn1WIsNFXco+BCmwroJR07oKYnbusBYgiEeHnkhXvyAELETs7BitH8JrUtSsGs2wJDfkU9fWf6BNT7oHGpP69Tyrl+8v+Q8jyLV8kW8+c7uJPyT2ACQ=,iv:Hl2eX7TV6lgWjUim0m4r44Ji0c9QDH+qzpDyBOTeVp4=,tag:6xkFMQMwEP7IhpXEB4o+hQ==,type:str]
|
||||
lastmodified: "2024-05-10T08:52:02Z"
|
||||
mac: ENC[AES256_GCM,data:gKEZ0bxn+xCu7wPRCRpacErzqdajw4zNalUwZvldUP+Ygdq6KOMgjxvm3hy7GIBlhK2MLgps3X3sjdrUW1A7Tx5wiPtrqddVo5qiubZcuWqNO4SSoM2x/VxtHbKcZQMaNdIHXx3TUFjQ0tcsMuDBNNUZ192JJUDE/DaDyxTklq4=,iv:sZ98srsM68h59R9HHeh7gXdUBN2JtoWx+PhU1nsHgk0=,tag:N7211a4Jrp6AdPKhQCz65g==,type:str]
|
||||
pgp: []
|
||||
unencrypted_suffix: _unencrypted
|
||||
version: 3.8.1
|
||||
|
||||
@@ -51,19 +51,16 @@ inputs:
|
||||
"alderlake"
|
||||
];
|
||||
remote.master = { enable = true; hosts = [ "xmupc1" "xmupc2" ]; };
|
||||
githubToken.enable = true;
|
||||
};
|
||||
nixpkgs =
|
||||
{ march = "znver4"; cuda = { enable = true; capabilities = [ "8.9" ]; forwardCompat = false; }; };
|
||||
kernel = { varient = "cachyos"; patches = [ "cjktty" "hibernate-progress" ]; };
|
||||
kernel.patches = [ "cjktty" "hibernate-progress" ];
|
||||
networking.hostname = "pc";
|
||||
sysctl.laptop-mode = 5;
|
||||
gui.enable = true;
|
||||
};
|
||||
hardware =
|
||||
{
|
||||
cpus = [ "amd" ];
|
||||
gpu = { type = "amd+nvidia"; prime.busId = { amd = "8:0:0"; nvidia = "1:0:0"; }; dynamicBoost = true; };
|
||||
legion = {};
|
||||
};
|
||||
hardware = { cpus = [ "amd" ]; gpu = { type = "nvidia"; dynamicBoost = true; }; legion = {}; };
|
||||
packages.packageSet = "workstation";
|
||||
virtualization =
|
||||
{
|
||||
@@ -75,7 +72,6 @@ inputs:
|
||||
services =
|
||||
{
|
||||
snapper.enable = true;
|
||||
fontconfig.enable = true;
|
||||
samba =
|
||||
{
|
||||
enable = true;
|
||||
@@ -92,10 +88,18 @@ inputs:
|
||||
sshd = {};
|
||||
xray.client =
|
||||
{
|
||||
dnsmasq.hosts = builtins.listToAttrs (builtins.map
|
||||
(name: { inherit name; value = "74.211.99.69"; })
|
||||
[ "mirism.one" "beta.mirism.one" "ng01.mirism.one" "initrd.vps6.chn.moe" ]);
|
||||
dae.wanInterface = [ "wlp4s0" "enp5s0" ];
|
||||
dnsmasq.hosts = builtins.listToAttrs
|
||||
(
|
||||
(builtins.map
|
||||
(name: { inherit name; value = "74.211.99.69"; })
|
||||
[ "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"
|
||||
"dispatchcnglobal.yuanshen.com"
|
||||
])
|
||||
);
|
||||
};
|
||||
firewall.trustedInterfaces = [ "virbr0" "waydroid0" ];
|
||||
acme.cert."debug.mirism.one" = {};
|
||||
@@ -117,59 +121,32 @@ inputs:
|
||||
publicKey = "l1gFSDCeBxyf/BipXNvoEvVvLqPgdil84nmr5q6+EEw=";
|
||||
wireguardIp = "192.168.83.3";
|
||||
};
|
||||
gamemode = { enable = true; drmDevice = 1; };
|
||||
gamemode = { enable = true; drmDevice = 0; };
|
||||
slurm = { enable = true; cpu = { cores = 16; threads = 2; }; memoryMB = 90112; gpus."4060" = 1; };
|
||||
xrdp =
|
||||
{
|
||||
enable = true;
|
||||
hostname = [ "pc.chn.moe" ];
|
||||
};
|
||||
xrdp = { enable = true; hostname = [ "pc.chn.moe" ]; };
|
||||
};
|
||||
bugs = [ "xmunet" "backlight" "amdpstate" "suspend-hibernate-no-platform" ];
|
||||
user.users = [ "chn" "test" ];
|
||||
};
|
||||
system.nixos.tags = [ "next" ];
|
||||
networking.extraHosts = "74.211.99.69 mirism.one beta.mirism.one ng01.mirism.one";
|
||||
services.colord.enable = true;
|
||||
virtualisation.virtualbox.host = { enable = true; enableExtensionPack = true; };
|
||||
specialisation =
|
||||
{
|
||||
nvidia.configuration =
|
||||
hybrid.configuration =
|
||||
{
|
||||
nixos =
|
||||
{
|
||||
hardware.gpu.type = inputs.lib.mkForce "nvidia";
|
||||
services.gamemode.drmDevice = inputs.lib.mkForce 0;
|
||||
hardware.gpu =
|
||||
{ type = inputs.lib.mkForce "amd+nvidia"; prime.busId = { amd = "6:0:0"; nvidia = "1:0:0"; }; };
|
||||
services.gamemode.drmDevice = inputs.lib.mkForce 1;
|
||||
};
|
||||
system.nixos.tags = [ "nvidia" ];
|
||||
system.nixos.tags = [ "hybrid" ];
|
||||
};
|
||||
hybrid-sync.configuration =
|
||||
xanmod.configuration =
|
||||
{
|
||||
nixos.hardware.gpu.prime.mode = "sync";
|
||||
system.nixos.tags = [ "hybrid-sync" ];
|
||||
};
|
||||
amd.configuration =
|
||||
{
|
||||
nixos.hardware.gpu = { type = inputs.lib.mkForce "amd"; dynamicBoost = inputs.lib.mkForce false; };
|
||||
boot =
|
||||
{
|
||||
extraModprobeConfig =
|
||||
''
|
||||
blacklist nouveau
|
||||
options nouveau modeset=0
|
||||
'';
|
||||
blacklistedKernelModules = [ "nvidia" "nvidia_drm" "nvidia_modeset" ];
|
||||
};
|
||||
services.udev.extraRules =
|
||||
''
|
||||
# Remove NVIDIA USB xHCI Host Controller devices, if present
|
||||
ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x0c0330", ATTR{power/control}="auto", ATTR{remove}="1"
|
||||
# Remove NVIDIA USB Type-C UCSI devices, if present
|
||||
ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x0c8000", ATTR{power/control}="auto", ATTR{remove}="1"
|
||||
# Remove NVIDIA Audio devices, if present
|
||||
ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x040300", ATTR{power/control}="auto", ATTR{remove}="1"
|
||||
# Remove NVIDIA VGA/3D controller devices
|
||||
ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x03[0-9]*", ATTR{power/control}="auto", ATTR{remove}="1"
|
||||
'';
|
||||
system.nixos.tags = [ "amd" ];
|
||||
nixos.system.kernel.variant = "xanmod-latest";
|
||||
system.nixos.tags = [ "xanmod" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
xray-client:
|
||||
uuid: ENC[AES256_GCM,data:XU7/GZ8cJmDwNsrQfoFHrquZT5QkjvTPZfnghX3BLyvPLlrX,iv:e/BQkZ5ydWD4P/qT9OUloB8/cXImfkG3YZnuIeNLoTc=,tag:EW3ZBzGnyIrUfcMeJqm4aA==,type:str]
|
||||
acme:
|
||||
cloudflare.ini: ENC[AES256_GCM,data:hPNpTclYvRbcbFO6aR9PNyHt3kDUmjeUgg4NPsr+c/yxKPundoiziNYBRfF7/axlw8Hu32jf/cDlcWaEmqCBQJY=,iv:bdGCD/a6AnGQhiFNyZ+fD1f/rILsEcPXC2qRDsAO4n8=,tag:MLZak9uSqsg/0Ldx2Wgb6A==,type:str]
|
||||
token: ENC[AES256_GCM,data:e+ZPOwOobbShxm5zZqmIeM4cmP4JQT8kDQ0goKsSwpIKmJAzi8WutQ==,iv:ZKOzKa98yWTM2LkC4+rzA6rTW4afm3oAG4nc/2vk7Bg=,tag:Qctw1sk1SC/a6Xv5Fju8EA==,type:str]
|
||||
frp:
|
||||
token: ENC[AES256_GCM,data:0mE8/cWqHKNquCIiqgbjcNhipKk7KEfbZ+qRYbu+iZr7AH9QjfYZQiMJNp4Aa3JWwBLYAnpf,iv:ID4cc8Tn0H9b1CimXlPamMlhlAkafhRApDHo/CCQ4BE=,tag:BUuU/BCj16R7FlKlpubawA==,type:str]
|
||||
stcp:
|
||||
@@ -14,14 +14,14 @@ postgresql:
|
||||
misskey_misskey: ENC[AES256_GCM,data:MSDbQffk/WjZ6EYiwVuUMdhdv9VE59ZM7t4XldOKRO0=,iv:J/x9t4Pk5zi7Av9fbzxgAbbtbEUZttSx/JGRmmgmvE4=,tag:CwFR9K++T7YqYR932z3IAg==,type:str]
|
||||
redis:
|
||||
misskey-misskey: ENC[AES256_GCM,data:vcvQ/hs/F3BZd1sfvWwfEeB8vVoqdnprxobcmL6xsmg=,iv:S32yrjrjj56HbxTlfFGjOb+sO2M9KKEDEazCrpQWj6Q=,tag:iwnvqwQEdd6jicx9jJBdbg==,type:str]
|
||||
meilisearch:
|
||||
misskey-misskey: ENC[AES256_GCM,data:/wYR3Bz4LRk/Ks0vizlZS3Ebf5qVfnlBBqZEm/ZIBFdDuhddgu71cqCjTHIKQ6CYh3CoUyguKIIFWku/kOCHKA==,iv:dllKvZwxvZC4pVyEMOB9WNiVBsVxzo5kwbdYKCzzyrY=,tag:MvzqalVvBkyJoLbirN0V8Q==,type:str]
|
||||
wireguard:
|
||||
privateKey: ENC[AES256_GCM,data:oIpiXJvEoyryS4eEutoe85Af0L5a5iNuOsCWCat9KEhr2ecY/vRimk/1fbA=,iv:dm2hTSNX7Q38yASon5o1jxEJZbWPXUWYydXYMBHF/sE=,tag:yrANhwIF/wHQGHGA1bfPgw==,type:str]
|
||||
mariadb:
|
||||
slurm: ENC[AES256_GCM,data:fGvNMmqk7Cee28VJ1QoBVrBbgIUbj/F1W0SRjdP8N4K/M8Wx4AVm1kAr0IAhPWyDLXlIjM1NUvuEV5BpYDBdjg==,iv:rFTMJ4x2kgENQUA8ftSaLjdOc25i5mWR3UYbdq54vjs=,tag:6feD0eCSv7bcHWBveLNJwg==,type:str]
|
||||
nix:
|
||||
remote: ENC[AES256_GCM,data:uosYkxTCB0wiY+Uufk//OcBZFN3EzbZoQGZ95M9eZMjQ5AobAZqosi4laE+EMcZL1CqYqlWXaSoEUOB8biUaZPseo+1AX1TlmUgZ7QpkfOX0VKZu01C6C+lVyqVqMFq6z1BFyX/oeITMIfnd4a/2KwJCHLAZ4hMkJ5p+aJwByKGa3N/2m41HH/1S3z7pYQWj7YJxunTPPG6WNSiRncQki11rvmddwnXmsBF89+jW1Phge8U295haC57T5oIGPxR645IeTK4ZUlL8eVuZ+BhsnwbkYcaxvjSwe+DOIVPupR8GW+gis7KxwE89kqvnQhinamexcPUz4lGHlqO/Xn6jrJx6T/wXF+19epAzeHapYte3dTWNsdPwPLPJihT16YT5fwrLnH3zq8kexWz1crmnCGUoaBs4S2tHWHLgv2lTv0IHLx5F6ijpDBj/Avg9YILIURzdeea+rBxdycHasUDTVlJtYKRH5J+WbAKWI+oJ5qmXjIRUYL+O9xIUfOGO+1b3xs8MYxRWuvDV2P88N8vN,iv:yQQp5wjbSVn1oia5yL7d6GF9Vo704G0iOQRGMbzQHzg=,tag:bpBag5y5n+7ojOa8QOcDvA==,type:str]
|
||||
github:
|
||||
token: ENC[AES256_GCM,data:59z1zSofzUyv2Qfn8oS7dZplzJDtOD/zxhPm07MLbVLHt8mE57IGcw==,iv:nZ4JmIE1h496RN6BChvqo7XWHjur76jP4HMgqGBbMJQ=,tag:pUSGsofG7hvkvJxCRwkg1Q==,type:str]
|
||||
sops:
|
||||
kms: []
|
||||
gcp_kms: []
|
||||
@@ -46,8 +46,8 @@ sops:
|
||||
OUlxNjdQaXdXMkZ6bnV1ek4yZ2dpbkEKpKGOAxo5Eef2jtGrg4iSzmGCeg+vTgvu
|
||||
+K8b+O19MIkGMDBm6UbYUPtc/7eqoEZRiTUzNMTmfkLVS4ul5zou9A==
|
||||
-----END AGE ENCRYPTED FILE-----
|
||||
lastmodified: "2024-03-11T08:27:38Z"
|
||||
mac: ENC[AES256_GCM,data:X5AqIdnMzLNCHXbN3TuG4st907Rw080V8AqzesiwVFOjbBYRZWetCndtfE+/o8G1q5YE/Qwspy7HsxP5tCbSNI5c8P0XTjRTCEGyRFY8fM1TFIM32rCFjUot1iFC+l//iq62M/5iMhT2Z7pi+CDIyNMEE3TJMhBc8JmgTJXIsI8=,iv:UZXFi3rJgVHBNVqwNHlIkmW+xYkX6X2/54QQ1aZTmyU=,tag:SXyL69DZ5i0cQFvXnFkZIg==,type:str]
|
||||
lastmodified: "2024-05-24T03:34:07Z"
|
||||
mac: ENC[AES256_GCM,data:+nJ/wuO5G6pEsCiBNEHOYrbiYyGXXIHu3ZUgEVwqLQ10W94EOGLUto61IGtkapk4xmaHYAVmUlq76g2hRGrndLVlUthGnEc5QoQKZoUmrxK7ux1R2ubv0s1k+l2HpRerr/I8X+hHyV0fdxT6ivkpq6OsEzHDnxgewDvYNZGQS4k=,iv:TuzO1Yo0MPms5RrG8+GbwSCOILp9BF7Jsv5JvcAPwFw=,tag:fUNc+ccQDE/jcMLuQ4thCQ==,type:str]
|
||||
pgp: []
|
||||
unencrypted_suffix: _unencrypted
|
||||
version: 3.8.1
|
||||
|
||||
@@ -18,11 +18,9 @@ inputs:
|
||||
};
|
||||
grub.installDevice = "efi";
|
||||
networking = { hostname = "pcarm"; networkd = {}; };
|
||||
binfmt.enable = false;
|
||||
nixpkgs.arch = "aarch64";
|
||||
kernel.varient = "nixos";
|
||||
kernel.variant = "nixos";
|
||||
};
|
||||
packages.packageSet = "server";
|
||||
services.sshd = {};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -19,16 +19,14 @@ inputs:
|
||||
};
|
||||
grub.installDevice = "efi";
|
||||
networking = { hostname = "pi3b"; networkd = {}; };
|
||||
binfmt.enable = false;
|
||||
nixpkgs.arch = "aarch64";
|
||||
kernel.varient = "nixos";
|
||||
kernel.variant = "nixos";
|
||||
};
|
||||
packages.packageSet = "server";
|
||||
services =
|
||||
{
|
||||
# snapper.enable = true;
|
||||
sshd = {};
|
||||
xray.client.dae.wanInterface = [ "enu1u1" ];
|
||||
xray.client = {};
|
||||
fail2ban = {};
|
||||
wireguard =
|
||||
{
|
||||
|
||||
@@ -30,19 +30,19 @@ inputs:
|
||||
};
|
||||
nixpkgs.march = "skylake";
|
||||
grub.installDevice = "efi";
|
||||
nix.substituters = [ "https://cache.nixos.org/" "https://nix-store.chn.moe" ];
|
||||
kernel.patches = [ "cjktty" "lantian" "surface" ];
|
||||
nix = { substituters = [ "https://cache.nixos.org/" "https://nix-store.chn.moe" ]; githubToken.enable = true; };
|
||||
kernel = { variant = "xanmod-lts"; patches = [ "cjktty" "lantian" "surface" "hibernate-progress" ]; };
|
||||
networking.hostname = "surface";
|
||||
gui.enable = true;
|
||||
};
|
||||
hardware = { cpus = [ "intel" ]; gpu.type = "intel"; };
|
||||
packages.packageSet = "desktop-fat";
|
||||
packages.packageSet = "desktop-extra";
|
||||
virtualization = { docker.enable = true; waydroid.enable = true; };
|
||||
services =
|
||||
{
|
||||
snapper.enable = true;
|
||||
fontconfig.enable = true;
|
||||
sshd = {};
|
||||
xray.client.dae.wanInterface = [ "wlp2s0" ];
|
||||
xray.client = {};
|
||||
firewall.trustedInterfaces = [ "virbr0" ];
|
||||
wireguard =
|
||||
{
|
||||
@@ -53,10 +53,15 @@ inputs:
|
||||
};
|
||||
beesd.instances.root = { device = "/"; hashTableSizeMB = 512; };
|
||||
};
|
||||
bugs = [ "xmunet" ];
|
||||
bugs = [ "xmunet" "suspend-hibernate-no-platform" ];
|
||||
};
|
||||
boot.kernelParams = [ "intel_iommu=off" ];
|
||||
environment.systemPackages = with inputs.pkgs; [ maliit-keyboard maliit-framework ];
|
||||
powerManagement.resumeCommands = ''${inputs.pkgs.systemd}/bin/systemctl restart iptsd'';
|
||||
services.iptsd.config =
|
||||
{
|
||||
Touch = { DisableOnPalm = true; DisableOnStylus = true; Overshoot = 0.5; };
|
||||
Contacts = { Neutral = "Average"; NeutralValue = 100; };
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@ 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]
|
||||
sops:
|
||||
kms: []
|
||||
gcp_kms: []
|
||||
@@ -26,8 +28,8 @@ sops:
|
||||
a2xybTRFUFZZN20zajZJTVNwVEpGcEEKglmFMk7z1q5IlZ+lZf9M0HtknmvcYt/P
|
||||
2/z5e8wLN1Hy0Zsbv0yIL/NmqwxAOGJOdzz7ElJszk/Y4kUr9aRasg==
|
||||
-----END AGE ENCRYPTED FILE-----
|
||||
lastmodified: "2024-02-16T14:25:17Z"
|
||||
mac: ENC[AES256_GCM,data:lpZ+Jd5LF35ESBOmOoq7pbNHze7rJiQsiq8cOgf8+cWnAqVh1bccG0cFe7R8uBhmuKIqp7TwkORDFuD+KFCZW14cbR4SP3vndSoYzKxIBdKTObR95w2ETst+prUtQ3fvFeEtlJexeljikfprWf2pGo1OzPophAyocgT31z2iMjs=,iv:Bryz+kqRvXYPj6YuxeDhQfLsgYqHXrA+lHFX18m2GGE=,tag:A7mvmguWoOir2JoIprgL4A==,type:str]
|
||||
lastmodified: "2024-05-24T03:36:38Z"
|
||||
mac: ENC[AES256_GCM,data:Dv6WO5K0GFVm4Rt+GjXeE1vwqlPkP+kmRCGU41rbSR3YBcL8mkpBRQQXJiMU99cQQMK/rCGy+k91fhGnG5xFT/FdEZF8qUjRHPZ5MdWCjPOuY/LrXWnSnwwJa2neQLFH/ToUkNaGHCk/FngnZ/e0U43Rnwt3iHRDBG3io8oDY0M=,iv:Jf5EtkTuf/MFDq6UiOo8/31ev5zBiaP9WnlgsUgK5Y4=,tag:r6ql+UbXbG5A1vtbsGXnJQ==,type:str]
|
||||
pgp: []
|
||||
unencrypted_suffix: _unencrypted
|
||||
version: 3.8.1
|
||||
|
||||
37
devices/vps4/default.nix
Normal file
37
devices/vps4/default.nix
Normal file
@@ -0,0 +1,37 @@
|
||||
inputs:
|
||||
{
|
||||
config =
|
||||
{
|
||||
nixos =
|
||||
{
|
||||
system =
|
||||
{
|
||||
fileSystems =
|
||||
{
|
||||
mount =
|
||||
{
|
||||
btrfs =
|
||||
{
|
||||
"/dev/disk/by-uuid/24577c0e-d56b-45ba-8b36-95a848228600"."/boot" = "/boot";
|
||||
"/dev/mapper/root" = { "/nix" = "/nix"; "/nix/rootfs/current" = "/"; };
|
||||
};
|
||||
};
|
||||
swap = [ "/nix/swap/swap" ];
|
||||
rollingRootfs = {};
|
||||
};
|
||||
grub.installDevice = "/dev/disk/by-path/pci-0000:00:05.0-scsi-0:0:0:0";
|
||||
nixpkgs.march = "znver2";
|
||||
nix.substituters = [ "https://cache.nixos.org/" "https://nix-store.chn.moe" ];
|
||||
initrd.sshd.enable = true;
|
||||
networking = { hostname = "vps4"; networkd = {}; };
|
||||
};
|
||||
services =
|
||||
{
|
||||
snapper.enable = true;
|
||||
sshd = {};
|
||||
fail2ban = {};
|
||||
beesd.instances.root = { device = "/"; hashTableSizeMB = 64; };
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
84
devices/vps4/secrets.yaml
Normal file
84
devices/vps4/secrets.yaml
Normal file
@@ -0,0 +1,84 @@
|
||||
acme:
|
||||
cloudflare.ini: ENC[AES256_GCM,data:X1v1QuOZemIuxldd1bzIvbUsq+8HMGLh91zUB+fnrxaW40z0OQh9L1rF/0Nj3gmUmgT4KEV7nkHFYYpZBp4/Kyc=,iv:fQmbhx9wV3l+DVPaBrAyJbTCsS3q3s5F9Go1F7pZ2pQ=,tag:P4vuruX460YSOUsx6zGHXQ==,type:str]
|
||||
frp:
|
||||
token: ENC[AES256_GCM,data:T8b1ku4HNCNSJ+33QgIt1GILFA4wTu3Qd0rDqHPVgdqsGo0R90k0u8z+dElSO7q9PapTqUbZ,iv:hwnMu6JxfYLgw4TyhujX5dI2IAytgZh+Bexhgta6ATQ=,tag:lqgwvXlS/jGPxasmk5Vh3w==,type:str]
|
||||
xray-server:
|
||||
clients:
|
||||
#ENC[AES256_GCM,data:DXEC,iv:SZ1AhmK6fWQ/HGDk97kDUcRN84zQMp99eiz4SpRhig8=,tag:Fkdf28ZvB8XKCxSYdjuuHw==,type:comment]
|
||||
user0: ENC[AES256_GCM,data:rJ00sfe/oJSry6Ixn4Bn+p41syqsOrdWv6fRGVCwPvn/unMY,iv:htTvFMvhIRkORA/gIU8J7CgA+tOncYQWh7sUh+F6XDs=,tag:VrSJBD7ti9WtSLHoWjMClw==,type:str]
|
||||
#ENC[AES256_GCM,data:OVgDU+zqcQ==,iv:8KuEqBuL5Ca6pUOFFA+vySJx/h3BhGAAC0CgnxiW46o=,tag:TY1MajSSy2RjKVI2SSAAFw==,type:comment]
|
||||
user1: ENC[AES256_GCM,data:S3IHO9FcVHTJOsRxjSohM9MgnrEwLdDpFU+efLkQaXT2jNJG,iv:KOesvPzjDfm1EDLFiegbk0wgjp7di5mUwUuuY2hwvOQ=,tag:ZsYyUyyEhO5S3weCw/gPMw==,type:str]
|
||||
#ENC[AES256_GCM,data:OQOPobpbbhajgA==,iv:4jG3bHKzWcR+JnvSlJsc0Qlv5kywqVN5UE96J31CP7Q=,tag:P+jJkRxPu99tLXyO5k6dRA==,type:comment]
|
||||
user2: ENC[AES256_GCM,data:e7ITe2ZouKr8dXT7SYATyzbzHaVeu6AKt1OcQKk3U0nsQgoa,iv:UbOOuojy6OAFEH8lGhKe5Hs+2K6FX5MZ8Br9AB007gs=,tag:5XeB4YngzTcHZvCpXe/ZXA==,type:str]
|
||||
#ENC[AES256_GCM,data:93BxR0AEdQ==,iv:rf69GWpuxYt7fu1Fyv55pynuQDhi+TA5CwZK3cc3yBo=,tag:/hLy6atNMxLw6G3/qgMM4g==,type:comment]
|
||||
user3: ENC[AES256_GCM,data:r+6jXaIj4HJoYLnJcnjJB+WEZlGaoSy/ktc1Aw77hFtNrrGp,iv:P+YUKns1yaOZokH5WkDB0jssGyHg3ncc54tF1PyA7Oc=,tag:/pxMEr7l4ye5EDAOsllxJA==,type:str]
|
||||
#ENC[AES256_GCM,data:4gqZh391hg==,iv:No22DrD6EBs2FA4/qH8msWEjs20fc+ZpEeZep+HIv+c=,tag:aHrYNbI83POI4PRj1nd+Yw==,type:comment]
|
||||
user4: ENC[AES256_GCM,data:ujiml/r4aFiKOkSJkaD/KE8rKuBtLSnpZREBH3vRJUzDT0QM,iv:a3VFlXpMLNFihvFa7gloANtHmBLg4szTL5LTm8E2kNs=,tag:W9KZ1GAVx9IBKfda7Zedng==,type:str]
|
||||
#ENC[AES256_GCM,data:PTYBkBHs16U=,iv:qr3u7OveM1CmTBIf9gZK4fTRuLCpcZCwf8jmnd1L3Co=,tag:w3O41NG7yCwCVqPGh/6SXA==,type:comment]
|
||||
user5: ENC[AES256_GCM,data:iDuLRb4dhLUOjpamioMwoTYrn7Cy+Ln4SaedVXkwVD05rjJ0,iv:AqzBBvLpJuIJCUJq0IyDcHrlqb0e84nQC0c94Rj85uw=,tag:0xou1i/iwAxGngO74OIMXg==,type:str]
|
||||
#ENC[AES256_GCM,data:D5xiJW0Oyg==,iv:9a/6myiT9Crf/fff6ZkXj/obW2k95cABUNqQdPmcwcc=,tag:chs8BA8YtVkM9m3Ey9ETlA==,type:comment]
|
||||
user6: ENC[AES256_GCM,data:YzLlf37SxKmU1/QA7gUIJsGid3KZNoAGOew8xR7cmw5l8ZmX,iv:SfKubo2jfjtxKn9odDiokMEZyPFfYZ/wwyYtBrgvgmM=,tag:+hxwIU5uBhzQyrKX4r3oiw==,type:str]
|
||||
#ENC[AES256_GCM,data:8FxApg==,iv:vPa5p3QVHAvw+ECusWGqx1ugTcHh42CVFDQcMhG59wM=,tag:lHiZtydcYFBQiXnWh8pCrw==,type:comment]
|
||||
user7: ENC[AES256_GCM,data:H/jje9ONEY6XuBXTZmTVGIcWUgGSMf5OB1NNRPtqGCgRP1ei,iv:xew+0BkRqz3nfOoBXTPbBv5hRczy/3tgYSKq432q4iw=,tag:da2ljcffiCVJCsMZaNPZyQ==,type:str]
|
||||
#ENC[AES256_GCM,data:QdaYYH3RGJ4qIg==,iv:79NBTEKCPtgVVv3G7wg+vdoLOWxc+bdqT1lF4HJpTC8=,tag:8mRFGjy7lBrdyGyX9vaSOQ==,type:comment]
|
||||
user8: ENC[AES256_GCM,data:H1gPtqF8vryD0rVH7HYzpMuZ3lufOBYczKwaTr4PidQtTyQK,iv:wh7NwFc/1ogNrnTTpm5L9dBqDVkvWiIsJZelR2mtR4Q=,tag:oEFdMFZJ9UYhsSVdefJ4rg==,type:str]
|
||||
#ENC[AES256_GCM,data:aYWIiLxs1UvupQ==,iv:AisokHuAzD5B6fEF6ak8WfAe151CM3a8MsaWC4uJPnw=,tag:cdk5S4n9ulyWrqsD+jcqYg==,type:comment]
|
||||
user9: ENC[AES256_GCM,data:HVK9KvGfOcwn1joc3VrkjBjE6hrxQPOBD5RTtQUgBPepToh6,iv:VK9aQ64L/GajpledBxC8PNB1BdNYEqwcdL3GKttgxvs=,tag:O/piztCYBARtAFxTMNXGaA==,type:str]
|
||||
#ENC[AES256_GCM,data:b839t/OihMOmz0gIcTo43r2MIw==,iv:8kaAFG7DhFOoitcvbFaAvE1NUSLFrFhy1KiMrqs4r/c=,tag:G4vSADa52ZfN5y5ytoFJoQ==,type:comment]
|
||||
user10: ENC[AES256_GCM,data:xjVkr/wy7OxRuNZKfQagfNxdVxTEyQP1ZhnR6jHy2gjBQ0RD,iv:G6iOBCHOqlvfEENY/ega/TUm81wgT2OOdZKZ6bPfg9o=,tag:p8AMa3bGsIl0hWQ09lSzgA==,type:str]
|
||||
#ENC[AES256_GCM,data:+s3MMeNU5Q==,iv:CUrg+nNxCpJFbHQmMNXmSE+JcZK6Dfu8cGwtznx3CFY=,tag:G5CYMtao+hz3hs0fPVPmcw==,type:comment]
|
||||
user11: ENC[AES256_GCM,data:BIZ2zRgGv5/9AexiZZvu+m4A62YUWtAkjWWMu89GteqpWMBq,iv:13IJcDf18LjoxJk7uoKnuFZT6Ihxrxsy7DBaAaiFqus=,tag:RN7wj+uPneCkqNlMRyYrXw==,type:str]
|
||||
#ENC[AES256_GCM,data:spyQkQIHwg==,iv:7+0DUK95MPH7lpr+GMbbLu4/5yA11/4gTuLhQKlStfE=,tag:G/gIXML8UhYoCi9FfoTvSA==,type:comment]
|
||||
user12: ENC[AES256_GCM,data:FAF9lXOzXW9CrZgnQ1a2+E8snZj2+JHqP5Gny92k09o/Wzga,iv:/qZuAtFmUQE7A9lMzJUoCvGx+3Sv9Ioh2ahch3puaC4=,tag:urwbLwGkSX3e85NCjyPhhg==,type:str]
|
||||
#ENC[AES256_GCM,data:HueqiREBet2bxQ==,iv:WCjTAGg2gXgBSvY3zc/YyB/1X0XjvphPduVXLsjOwH8=,tag:wC+On6lyyYQ1Dt/BHDvONw==,type:comment]
|
||||
user13: ENC[AES256_GCM,data:ExbnvWDIBqga5+k2mpoT8AKBOXAvUNMjBTPXUKrmtWzz4l+L,iv:UI7CvSx2FHYGf6BEHS4e3iwHZZWkl2Zt5xg2WdKbLvY=,tag:ad0c7YW2Bxo+Dn+BoSZ0Ng==,type:str]
|
||||
#ENC[AES256_GCM,data:R8lN5T0=,iv:FXLf8Vtjg+PkwNhxXWDViMKqwn7tFMaPhio9zhnudZw=,tag:34gxRH+P9lmkUxlOPKcYMg==,type:comment]
|
||||
user14: ENC[AES256_GCM,data:dgNPPlJD5JOFPbKhlvlRHBLmUNKeDm/JAiawUVpBE7H07Box,iv:w+t9BkqYvlxVKr+x0MwtBz0/YSR/7z1OnZLIoPdW4gc=,tag:CR3GLbaO0jSQgA2HuwzRqg==,type:str]
|
||||
telegram:
|
||||
token: ENC[AES256_GCM,data:xsJoGgQ8pLeZqA2alGKkCyrvnjY6rVF5TlXn4GWDrStFBl65XXzwVY/9ZZthYQ==,iv:qTLfpRUyuIGFM668URfknhSRtx3WEHp/WTGzGUPuFd4=,tag:p8mF0tM+t02g7v2EQZN3Vg==,type:str]
|
||||
chat: ENC[AES256_GCM,data:X1JxFQw0bPCu,iv:hf+TOSH2p9RdnXDFKxTpSRzxDLdJyzNHVV8MfOQuGWY=,tag:iiWw9IFiBGOOyOSl9Jj2wQ==,type:str]
|
||||
private-key: ENC[AES256_GCM,data:ts/LRGFAsYqvGvkvlxUI42IW1a8cGsSkpZhMDd3QVceRKvhPb1SRDaXoSw==,iv:6xX9xFIFUNlLBZ6CPBOz9JbHpvC4+QG9ZaCZcWdl12c=,tag:DYIa+QTV8vyl1l7OKKykTw==,type:str]
|
||||
nginx:
|
||||
#ENC[AES256_GCM,data:85LrqdTMIhSa,iv:mIQPYz8VPd5AxeMCQEdTGMD0Iqa5QEAa5+8JVFaj3JM=,tag:TcZd7S3WRPpEV9lHI1fzbw==,type:comment]
|
||||
#ENC[AES256_GCM,data:rVTLpe3uIQ5LArPnEY8N8kjtHq8kZddbqR+nyUaia72Y7PWEfHzy6wgx3Q==,iv:AZEufH3zfVL0XbUh3CQZGYcx6zIMFV4tF+jHf73IplU=,tag:B/UbtQh5dGrctNih2uoO8w==,type:comment]
|
||||
#ENC[AES256_GCM,data:InzwjKl3R4SJSXTz5u1Pt0kf2HYEtKfSkJO0cbPhhXADNp2/Tn0nwQJFy9EzpMvK9mw8+l5LadbY0tIwmTVvV5yxUQo78HcgXWInfp/zJ+GG1L/RQOHck74lEA==,iv:UBMRYPd0loOQBs3mNyndiKPu72aRA8HbOKWDfUWPQg8=,tag:t/ONqdwpWcbo/2vy5TOjlA==,type:comment]
|
||||
#ENC[AES256_GCM,data:HTinhnsAbVujUOuLIVT/CkvdtTN9Nk7wZKZ5SyrPC+vZ/cB9E10FffMYLQ==,iv:Clby9A7MIUSknNFkzKuWEDL0yUW/ctd6KShCIEYrDZA=,tag:CJKORoXrspDjRmaSHUnlqw==,type:comment]
|
||||
#ENC[AES256_GCM,data:cwAb68VgebTwCCeAFUbOG0CUAuggfRnLNv9NWldJN+E9NY4WKxs12Nz7yX/vtelcqqJ2TOUL78uAR88Nzavv7VtCTZRivWjRG6GvAUyRdv8lAZo=,iv:PScTSTCuVnsoZlvyTVL+ZgqqEm4m2/fUqWzPwE+PvuY=,tag:1jeRsHqgMheXbcnhRicsnw==,type:comment]
|
||||
#ENC[AES256_GCM,data:V5XRrTvyeezkcJqw1/BhhZz5K/egpl+PtNwjAGELjWRp7IqDfRsInxBKEg==,iv:LdOTkL22HvaNbiUi6hG8o0ownfZ22OKFGxCuGPqG8xU=,tag:/06I/mLzBlgS489iuwFTuw==,type:comment]
|
||||
#ENC[AES256_GCM,data:i9PXzaO1od7HimP/6vxYfh30SxFbdXRDcnXujH3VrvngFcWaVcXgigncp3cboi6RoERSZ6yakxviVyEBIS4v0qRfombj2UtJg8N3Kg==,iv:aohIMhAYfZhlGDrcEvi+Qc16nF8ZgrPUGhWj/7nl8Fs=,tag:o70qsk/2cAbZgbVBwfl3Ew==,type:comment]
|
||||
maxmind-license: ENC[AES256_GCM,data:sESU6uK9EYLido9/0sXO2Zw1SjuKmxPh4r3giJcaG7068gn1kByjsA==,iv:htnFgnLrH35zSvmlRAdoRDLFIpKroKO5dW9TNK9soUc=,tag:6pJuc54SrKP5n0kJJ7fGyA==,type:str]
|
||||
send:
|
||||
redis-password: ENC[AES256_GCM,data:6zVKw9AmKwSWvHUZhzy0F2KcJW96uFoZY/N1Zq8ilUJOLZeX,iv:viwLIgJz9v8oadr8784OgETbEsxzGsJvVoxmOwWEFxo=,tag:XEYFnoCGwlnrkqaUbgeH+Q==,type:str]
|
||||
coturn:
|
||||
auth-secret: ENC[AES256_GCM,data:50KqO4GQ1ERbCnK4IjYu6aywT+IPMtVlTzh/TE4MwWApU4pO9yqz25ENGUAKRLi4p+Ecug+Rn3InRl1b+q6bAQ==,iv:SgHkHvHg/+yA1Z5E9effgCnZMVXv5amGNUsVKErai54=,tag:PoYLV9Xr0IXXsA39n7wiTQ==,type:str]
|
||||
wireguard:
|
||||
privateKey: ENC[AES256_GCM,data:4DKPPqQkjb33rQzFIz863A2arDRQA9AivWFBaWTf0xXDX4hWvJFiIlJQfvE=,iv:0R2TH3CMxHgwVjojzjE2Gnp8SXonmBDLWF7hB33NiX0=,tag:vgtV8JkuCdspleN/SvgIqQ==,type:str]
|
||||
sops:
|
||||
kms: []
|
||||
gcp_kms: []
|
||||
azure_kv: []
|
||||
hc_vault: []
|
||||
age:
|
||||
- recipient: age19ax6vm3pv8rph5tq3mmehd9sy9jk823tw8svsd790r0lkslycquqvlwz9m
|
||||
enc: |
|
||||
-----BEGIN AGE ENCRYPTED FILE-----
|
||||
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSA1QXc4NzREZHlhMDV2WXlM
|
||||
a2I4d1pjWm9Xd2gzUDUwZ1ZSTkFGR1ZQNDJzCmJwcWFxRWNNVGxTNno2b1NxNktO
|
||||
aHhINXBjdmE3alFGYk9kUHZ1UzdJUk0KLS0tIFdKMDlvb1Z2Qi8xRjl0MXpKMDMz
|
||||
cVVNdDRDNmtHZlJEcVRXR1FLVkZrMWcKn2iTHH7/52fJNXcbDFbzOxNAaiQRA0nO
|
||||
we74EeNzcaaQwuEmBQPKxd/g7/kjhnHzTkoX3OneXMd/gBZMn2knXw==
|
||||
-----END AGE ENCRYPTED FILE-----
|
||||
- recipient: age164tyqklwhdm57tfm5u863mdt2xrzrrzac4py8a0j9y6kzqcjy9zsp073t6
|
||||
enc: |
|
||||
-----BEGIN AGE ENCRYPTED FILE-----
|
||||
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBycEw1bXA4QUZkUzJ0Z3pM
|
||||
Z0xHam5SLzRGV21XYUtxTFh1VnhQUk1NbzAwCkU1Z3VTR1FtZ05GOWNDOENlZTgz
|
||||
SitzYXo2Q2VEaGtLTGE2UGRoUDkxN28KLS0tIHhRS2Y1cnQreC9Fc2FLdGR1ZXdJ
|
||||
ZXFTU3ZCaW1pTVh0RUJzdDdGdHlPYTgK2mlgcX2kEc8+2UDdBnhUm6IIuh8V6agW
|
||||
ooxH9OEPXUVI/4JcDo4v8ZUhAyU1ehLH0Ef7PJCChOZe2KZmWSNbhA==
|
||||
-----END AGE ENCRYPTED FILE-----
|
||||
lastmodified: "2024-03-28T10:31:05Z"
|
||||
mac: ENC[AES256_GCM,data:6Z+ltjbvQaYhDPoiCN7ajQeWcp6vj3TIcUXUm/r/tZU4mIOvfxA7hxW971b76bYPTeVwgp7ZB9qQy9emDHV9i+aSyJpTPKQHRRz5J+T+NJhTP/IL3R3VmG89ssC6NH8FSk0S487JkPd8tNz+G6bvwFCPRxRLNj1pXX0Dp6tgwIw=,iv:xLw2iX1ODAbJCTJ8fEvG7SdZ1GnGwADIckH8DibVM2Y=,tag:TTzlHdcyIQr/92ZHmViRXQ==,type:str]
|
||||
pgp: []
|
||||
unencrypted_suffix: _unencrypted
|
||||
version: 3.8.1
|
||||
@@ -31,12 +31,11 @@ inputs:
|
||||
initrd.sshd.enable = true;
|
||||
networking = { hostname = "vps6"; networkd = {}; };
|
||||
};
|
||||
packages.packageSet = "server";
|
||||
services =
|
||||
{
|
||||
snapper.enable = false;
|
||||
snapper.enable = true;
|
||||
sshd = {};
|
||||
xray.server = { serverName = "vps6.xserver.chn.moe"; userNumber = 14; };
|
||||
xray.server = { serverName = "vps6.xserver.chn.moe"; userNumber = 18; };
|
||||
frpServer = { enable = true; serverName = "frp.chn.moe"; };
|
||||
nginx =
|
||||
{
|
||||
@@ -62,6 +61,7 @@ inputs:
|
||||
catalog.enable = true;
|
||||
blog.enable = true;
|
||||
main.enable = true;
|
||||
nekomia.enable = true;
|
||||
};
|
||||
};
|
||||
coturn = {};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
acme:
|
||||
cloudflare.ini: ENC[AES256_GCM,data:X1v1QuOZemIuxldd1bzIvbUsq+8HMGLh91zUB+fnrxaW40z0OQh9L1rF/0Nj3gmUmgT4KEV7nkHFYYpZBp4/Kyc=,iv:fQmbhx9wV3l+DVPaBrAyJbTCsS3q3s5F9Go1F7pZ2pQ=,tag:P4vuruX460YSOUsx6zGHXQ==,type:str]
|
||||
token: ENC[AES256_GCM,data:lJc2A1Q5vxWQsSchA5pvXSYW+DjBCkdSbWVD7+Py+lG/6nGUmEAHVw==,iv:ZcysHsiLQzD/7vMn1wTCE5lw7/IgkH3oLem5xCjnf7Q=,tag:7EC+S79HRCG/Q+bqVcGVDw==,type:str]
|
||||
frp:
|
||||
token: ENC[AES256_GCM,data:T8b1ku4HNCNSJ+33QgIt1GILFA4wTu3Qd0rDqHPVgdqsGo0R90k0u8z+dElSO7q9PapTqUbZ,iv:hwnMu6JxfYLgw4TyhujX5dI2IAytgZh+Bexhgta6ATQ=,tag:lqgwvXlS/jGPxasmk5Vh3w==,type:str]
|
||||
xray-server:
|
||||
@@ -34,9 +34,12 @@ xray-server:
|
||||
user13: ENC[AES256_GCM,data:ExbnvWDIBqga5+k2mpoT8AKBOXAvUNMjBTPXUKrmtWzz4l+L,iv:UI7CvSx2FHYGf6BEHS4e3iwHZZWkl2Zt5xg2WdKbLvY=,tag:ad0c7YW2Bxo+Dn+BoSZ0Ng==,type:str]
|
||||
#ENC[AES256_GCM,data:R8lN5T0=,iv:FXLf8Vtjg+PkwNhxXWDViMKqwn7tFMaPhio9zhnudZw=,tag:34gxRH+P9lmkUxlOPKcYMg==,type:comment]
|
||||
user14: ENC[AES256_GCM,data:dgNPPlJD5JOFPbKhlvlRHBLmUNKeDm/JAiawUVpBE7H07Box,iv:w+t9BkqYvlxVKr+x0MwtBz0/YSR/7z1OnZLIoPdW4gc=,tag:CR3GLbaO0jSQgA2HuwzRqg==,type:str]
|
||||
telegram:
|
||||
token: ENC[AES256_GCM,data:xsJoGgQ8pLeZqA2alGKkCyrvnjY6rVF5TlXn4GWDrStFBl65XXzwVY/9ZZthYQ==,iv:qTLfpRUyuIGFM668URfknhSRtx3WEHp/WTGzGUPuFd4=,tag:p8mF0tM+t02g7v2EQZN3Vg==,type:str]
|
||||
chat: ENC[AES256_GCM,data:X1JxFQw0bPCu,iv:hf+TOSH2p9RdnXDFKxTpSRzxDLdJyzNHVV8MfOQuGWY=,tag:iiWw9IFiBGOOyOSl9Jj2wQ==,type:str]
|
||||
#ENC[AES256_GCM,data:X80nhW5a/JQ1IQ==,iv:2UTsNLLDr4uBAEcPyvmep1fqH43JLUiHc/zqQWChfDk=,tag:DJEArs1nVnlcJgqM2uy17A==,type:comment]
|
||||
user15: ENC[AES256_GCM,data:6AskiMLLl0HV6tm2rYpV46XW0jePQy+wme2oi3M7He7WsgVM,iv:lGfnFn69Vnjv5J3rp5sRazD5/B+8Nk8MNG7HIyf4HKA=,tag:Vbg82tdn3noOfhKVVx0Phg==,type:str]
|
||||
#ENC[AES256_GCM,data:4jJkbMD9Psxrag==,iv:arRtRaNrqnYcT7vE3wqgl/y8/65ORaxqTdGw55AKDP8=,tag:pRpta6mXfy0XCyzMA4+cEQ==,type:comment]
|
||||
user16: ENC[AES256_GCM,data:fo6KJXlPDn7+FmxjEJQo9d79rDYemLFx6LanYZcJpKJR7Gxq,iv:yEUKPNZ9idrSqyVO9fhksP/7bjPMT/LzNK2VSq503/c=,tag:M87D44SIo9JzDB3ZyKu7fA==,type:str]
|
||||
#ENC[AES256_GCM,data:/Kec+CdtnT11EA==,iv:DnmbWfgriaE6XAnMqq2UXhHhN+Rd/3YRodKVUCJo6p4=,tag:NimqZpbslKxwzoljaZqEdw==,type:comment]
|
||||
user17: ENC[AES256_GCM,data:gQInIcNFxJuCSsMDGq4yTp5JdMMmJRy1tY3PGLoLuuIXWV0a,iv:ya4n9Z7T9/bxeHqi5QqwJprEzDMsT6X0BuEXRS67wWk=,tag:RcjQfAHv8uc3PgN5c4bySA==,type:str]
|
||||
private-key: ENC[AES256_GCM,data:ts/LRGFAsYqvGvkvlxUI42IW1a8cGsSkpZhMDd3QVceRKvhPb1SRDaXoSw==,iv:6xX9xFIFUNlLBZ6CPBOz9JbHpvC4+QG9ZaCZcWdl12c=,tag:DYIa+QTV8vyl1l7OKKykTw==,type:str]
|
||||
nginx:
|
||||
#ENC[AES256_GCM,data:85LrqdTMIhSa,iv:mIQPYz8VPd5AxeMCQEdTGMD0Iqa5QEAa5+8JVFaj3JM=,tag:TcZd7S3WRPpEV9lHI1fzbw==,type:comment]
|
||||
@@ -53,6 +56,9 @@ coturn:
|
||||
auth-secret: ENC[AES256_GCM,data:50KqO4GQ1ERbCnK4IjYu6aywT+IPMtVlTzh/TE4MwWApU4pO9yqz25ENGUAKRLi4p+Ecug+Rn3InRl1b+q6bAQ==,iv:SgHkHvHg/+yA1Z5E9effgCnZMVXv5amGNUsVKErai54=,tag:PoYLV9Xr0IXXsA39n7wiTQ==,type:str]
|
||||
wireguard:
|
||||
privateKey: ENC[AES256_GCM,data:4DKPPqQkjb33rQzFIz863A2arDRQA9AivWFBaWTf0xXDX4hWvJFiIlJQfvE=,iv:0R2TH3CMxHgwVjojzjE2Gnp8SXonmBDLWF7hB33NiX0=,tag:vgtV8JkuCdspleN/SvgIqQ==,type:str]
|
||||
telegram:
|
||||
token: ENC[AES256_GCM,data:LskBPmXZk3hRZ2bChXZjmRzzGd2A2GKrUZMknCDXTpTzOdP/RDibRvgI75HLWg==,iv:9lJKuGLD5HuQinWvvAvwWFAvEJofUGkJsxKNpqZrGmI=,tag:pTmTOlsYIY6Uqd69AtrnBA==,type:str]
|
||||
chat: ENC[AES256_GCM,data:0ehCIvd7sBFc,iv:OwdiIoPrt/e1YgsCrYcqqMYhsJuEtKW2pSKNVxahMV4=,tag:ig2CfQxwzv2ppIutU6371w==,type:str]
|
||||
sops:
|
||||
kms: []
|
||||
gcp_kms: []
|
||||
@@ -77,8 +83,8 @@ sops:
|
||||
ZXFTU3ZCaW1pTVh0RUJzdDdGdHlPYTgK2mlgcX2kEc8+2UDdBnhUm6IIuh8V6agW
|
||||
ooxH9OEPXUVI/4JcDo4v8ZUhAyU1ehLH0Ef7PJCChOZe2KZmWSNbhA==
|
||||
-----END AGE ENCRYPTED FILE-----
|
||||
lastmodified: "2024-03-28T10:31:05Z"
|
||||
mac: ENC[AES256_GCM,data:6Z+ltjbvQaYhDPoiCN7ajQeWcp6vj3TIcUXUm/r/tZU4mIOvfxA7hxW971b76bYPTeVwgp7ZB9qQy9emDHV9i+aSyJpTPKQHRRz5J+T+NJhTP/IL3R3VmG89ssC6NH8FSk0S487JkPd8tNz+G6bvwFCPRxRLNj1pXX0Dp6tgwIw=,iv:xLw2iX1ODAbJCTJ8fEvG7SdZ1GnGwADIckH8DibVM2Y=,tag:TTzlHdcyIQr/92ZHmViRXQ==,type:str]
|
||||
lastmodified: "2024-05-25T09:01:19Z"
|
||||
mac: ENC[AES256_GCM,data:xYK5VTYHwryDcH0fhnezn5aYQ+XAPAJ7PIrL1ygKw3F/rAwRQlWk0/zmqypmpqbPX4mAJKzDfgoTNh8iUtF8ehmfOS+7OPUTuKVRvPI39HfcJbRN3/oOdN40AXSa5cZjgKrAGdhWvwyw0WdDMkRfwJztAR5Jj0dKzZ5THW+5zSs=,iv:Y5UUe1I95ltiVcUPBUcmIpnKHFfAlQmcF8ZlxZht1i4=,tag:3mA/epV254+P7WkkuhDOqg==,type:str]
|
||||
pgp: []
|
||||
unencrypted_suffix: _unencrypted
|
||||
version: 3.8.1
|
||||
|
||||
@@ -30,27 +30,20 @@ inputs:
|
||||
nix.substituters = [ "https://cache.nixos.org/" "https://nix-store.chn.moe" ];
|
||||
initrd.sshd.enable = true;
|
||||
networking = { hostname = "vps7"; networkd = {}; };
|
||||
gui.preferred = false;
|
||||
};
|
||||
packages.packageSet = "desktop";
|
||||
services =
|
||||
{
|
||||
snapper.enable = true;
|
||||
fontconfig.enable = true;
|
||||
sshd = {};
|
||||
rsshub.enable = true;
|
||||
wallabag.enable = true;
|
||||
misskey.instances =
|
||||
{
|
||||
misskey.hostname = "xn--s8w913fdga.chn.moe";
|
||||
misskey-old = { port = 9727; redis.port = 3546; meilisearch.enable = false; };
|
||||
};
|
||||
{ misskey.hostname = "xn--s8w913fdga.chn.moe"; misskey-old = { port = 9727; redis.port = 3546; }; };
|
||||
synapse.instances =
|
||||
{
|
||||
synapse.matrixHostname = "synapse.chn.moe";
|
||||
matrix = { port = 8009; redisPort = 6380; slidingSyncPort = 9001; };
|
||||
};
|
||||
xrdp = { enable = true; hostname = [ "vps7.chn.moe" ]; };
|
||||
vaultwarden.enable = true;
|
||||
beesd.instances.root = { device = "/"; hashTableSizeMB = 1024; };
|
||||
photoprism.enable = true;
|
||||
@@ -61,7 +54,7 @@ inputs:
|
||||
fz-new-order = {};
|
||||
nginx.applications = { kkmeeting.enable = true; webdav.instances."webdav.chn.moe" = {}; };
|
||||
httpapi.enable = true;
|
||||
gitea.enable = true;
|
||||
gitea = { enable = true; ssh = {}; };
|
||||
grafana.enable = true;
|
||||
fail2ban = {};
|
||||
wireguard =
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
acme:
|
||||
cloudflare.ini: ENC[AES256_GCM,data:PJ3JhdSPCyxzdcRI4UFdESWgyAjIYGyuVaU9l0R3s8mJidtgavvSSMy0hC0G/2fauLB/Eqc3L3NppXFjlKVywVE=,iv:lZVlOf7P/Vs/+u/5YPKFXmdeYV9NP9kcVWd00w1OjB4=,tag:LfWZTvPQH4QPrNrYfZ/Z6Q==,type:str]
|
||||
token: ENC[AES256_GCM,data:D5D9Voteggfoc7Hj/xdhGEHmFIkG2H0Y0t2AfSY7hjRlsQhUoAzCRg==,iv:JLUjY/6DJrNsG0YZ0WD/Dmjgjsbx26VANAQvZnyj6l4=,tag:WBQv8AvPW5+XK8FAzppnNw==,type:str]
|
||||
nginx:
|
||||
detectAuth:
|
||||
chn: ENC[AES256_GCM,data:Gk0TTbnFcsvIgoDcen6B8w==,iv:kvyvygw9zDwaiTQ2vPFTHQex0EWDFg8M8U22AConQFM=,tag:ewAZ/nXxmTOhDAjW/A2OnA==,type:str]
|
||||
@@ -29,8 +29,6 @@ postgresql:
|
||||
akkoma: ENC[AES256_GCM,data:6piRt7BbMBLVGdot+VyoJN3/S8DoPNTYHFh/1coHSLNmiA6kU/6sca4Bts1Up/Vu164oTsFAr1JsKx6tzNzAPg==,iv:qplA1GXHwzVrmjm7eagCk3PFa7DRdwaf+p7N1HLb6mw=,tag:W6WedSK3R1IgZVo/0Hr9vA==,type:str]
|
||||
synapse_matrix: ENC[AES256_GCM,data:5j+TYJ3vYUqu6CdRDYAT558DsTWbX4Rh+HuukPog5HGXlhneL3RnxVeGBR9CV1rlCP1NY99Nm8roBG+BcyPYHQ==,iv:CboB6lzqxAE/8ZlzaTU3bxw94N6OAhrq8pZ0AfxQiUc=,tag:z6cM3ufgbMn5n5PzgqdRjw==,type:str]
|
||||
vikunja: ENC[AES256_GCM,data:syb4NYBxL3DdmZmcC+em0klmm6bkkIL/DH/gnzShYRiaezRFskT+yay9govn++SpbuvkoCJq/GYAFxNL+hcVtw==,iv:TQUgdzYQ0gqsAmux9v3BAQFNzHnCTZ+X/OC0b9Bfya8=,tag:b1AsiAW5XzA3DzGdf8J03g==,type:str]
|
||||
meilisearch:
|
||||
misskey-misskey: ENC[AES256_GCM,data:4s+qqd6mmstioC0XmG/vA6ED9mzu1vRJVPFFalRiqnnsFy0dYEU87H+y12eOp/KDSLdTNvpp6Z6jCNvxnpDXzQ==,iv:x6L9OPu/dwVsD9pYb4dqavw9NesMbo7LB+rwz6veAR4=,tag:/BBqV2sHIgPas7XsZydh2g==,type:str]
|
||||
rsshub:
|
||||
pixiv-refreshtoken: ENC[AES256_GCM,data:EeSOTSAAh+1Dc8+a/AaPJ0aBK5DTa3pdS6DrIMQmRw/n0SRu2QoynIF76w==,iv:dnZxi8jM1I4w3C2duYielpP/8wOAdHDjcqDIrowM0dM=,tag:8irGvLEbRJHV9TB8Jibs9g==,type:str]
|
||||
youtube-key: ENC[AES256_GCM,data:OEm/ynOUPUq7ZEVzL2jgs9d+utkLTIdNq0MHE0JDujb9ndAwyJJI,iv:RRae6Cg6GdDnXAQOdtBYmcA7ZNuu70VpIg2MEezBn5k=,tag:gX4ZG345cT3Jh3ovUxtLGw==,type:str]
|
||||
@@ -93,8 +91,6 @@ fz-new-order:
|
||||
username: ENC[AES256_GCM,data:xWP1cesh,iv:11KFZ/J9PScz/oW2+H5BWgw0+ETkCXlcYOMuPpgjEs0=,tag:HswEVzm6ElRjIDsZyEfZcA==,type:str]
|
||||
password: ENC[AES256_GCM,data:Da/E7ZeZ,iv:gIoheXeTErV3+CtZSEDsX7pGzRahHWlKYQ6QZ6W2eu8=,tag:0oQzQ5DJiS2hqMQfU6JRWw==,type:str]
|
||||
comment: ENC[AES256_GCM,data:etfZKwbh,iv:XqqF3D0PpCPd2Q/CCu/PAH4SrvXAOu+lIXvSht/KfKk=,tag:7jyG33foxneRK2wvI/5uBg==,type:str]
|
||||
httpapi:
|
||||
token: ENC[AES256_GCM,data:fuGJ+5sKr3yob7JbyqtwGBAxnDzxTvoC5XPWHNawOjqC7Ydz6HujpYudG2CUMxt+rA==,iv:Yhg5NqRRp+PYsxNKFUiUydAL1hmz2pr/T0f5GDKV18w=,tag:SZoy0gTzpeq39mEFBTUDLA==,type:str]
|
||||
gitlab:
|
||||
secret: ENC[AES256_GCM,data:hBax7ClSuttBacykKw42pvrvowZW8OeTry/0rkmy5BHyLM7HllNYCOw+tupIOdhVEfgJPWQeBeGuyFHt7lPRWQ==,iv:zOM+eMW04Z9QkTchkAXWYHg2eWTQmGEs/dHtUnvNVd8=,tag:RzLyecuASl9CcmQSuabN6w==,type:str]
|
||||
otp: ENC[AES256_GCM,data:Hgq5Tyq+BUTsexVsjFWf07fY0znPL50+qIm+fhuVljlauXBZouQjJKMhqTs9zhLECOktYUtp0wrNa++nO1Ys9A==,iv:Am51j8QjDtldtsZL8uCu0I3pr/SQ6R8KUQinznZjClg=,tag:hbtrlG0MGNL3VcbQUG/irQ==,type:str]
|
||||
@@ -109,6 +105,9 @@ vikunja:
|
||||
jwtsecret: ENC[AES256_GCM,data:p6e22qPJzTGB21oWhSr8AA4bfrele9ZOHVtZ8BHgX21IhoKdm58coGtSX1CGXR7J6+1/74RdLY9K88nGrM1F1w==,iv:DGUO8rhf7Lg9dTqSmzlR/Jd2K4oUjO8w9E5bihwsykI=,tag:SpX6UI0QIju/tC1fIL9CCg==,type:str]
|
||||
chatgpt:
|
||||
key: ENC[AES256_GCM,data:bkLxKUqkjwpUeqeAZCaAgKiOse8QtZ0zOn9TQNA84+B3rxNiTFPisI8=,iv:Zd5dO5Sdt4HCvNZgS2K0FjJAzti6oE22vahYQl99TrI=,tag:E3o+X84tRsIEGU9Jfb85JQ==,type:str]
|
||||
telegram:
|
||||
token: ENC[AES256_GCM,data:Mr6KrAzYoDXA+dPT3oXqK2wm9ahTjZ5GVE/iRPsmcM+S2MABT+8ramyHz9oIFw==,iv:nIZ8rpSxz2GwMbDQFfG3xauMQjiriZ1oxFMrEQeH7sQ=,tag:y5U1T1vV/mmdE/CeaeTR8g==,type:str]
|
||||
chat: ENC[AES256_GCM,data:8w/0EI64a1dC,iv:dHu9JHcUY7QPd9YBKXnrRXQB2K6jpnLrSFs+1IJmkio=,tag:3ucN3uNnBxxRF+cbLsa1nQ==,type:str]
|
||||
sops:
|
||||
kms: []
|
||||
gcp_kms: []
|
||||
@@ -133,8 +132,8 @@ sops:
|
||||
SnFHS1Z0SXUzTFdEd29KTy9DU3Y3R0UKfhh+rUmWDrf+UGjclP57dHipPLFoXSqy
|
||||
HdelmfV6q4/c7ppx2E+oZw3VNgoZCsrxxzYZfwxHJiZb+5vkE0D8iA==
|
||||
-----END AGE ENCRYPTED FILE-----
|
||||
lastmodified: "2024-04-06T14:33:12Z"
|
||||
mac: ENC[AES256_GCM,data:bQIh7fDdE5/fEbTP1pNWcGwZILfOcWoNM/uhj3A+rxYukwMSLKL7MUHnLCFEnjrTkm2CxOdXYda5jCGEOKgRZsKePSz4/8sFKX2yJrWpRCn+02/wtDyCc1JSFgV9TmJpydmdltZvl663vU6Fot0/9oIvGH/M6GiGo3OAqjhl1ig=,iv:i1w31ujw3wcFat33auutDuxBDQ9YpWkJLvKxZ625NWM=,tag:mAk0tLLe07hLtZUQjKNKFg==,type:str]
|
||||
lastmodified: "2024-05-10T08:51:41Z"
|
||||
mac: ENC[AES256_GCM,data:JQGv8hKLp0XFj5se+dKGs8r+qjEnlxXNMBlMk3Cv/c/b96nyreKva95DyR9JdY4ND8emY00IAIefnzT+uMvpmxXO/ttM8Vf2xPus6jBKp5omSjr0mbwBcUz9+oXWElua6LJKL/3v1NZ7t/usH9KCWeAnjtaNi/6T4U0z3IY6a9U=,iv:SadPtZGKqHS+ZTp09kR9gs8OyIr2lcywRxyPTfsqL6A=,tag:itZBK6Dde5212d+OBTKb9A==,type:str]
|
||||
pgp: []
|
||||
unencrypted_suffix: _unencrypted
|
||||
version: 3.8.1
|
||||
|
||||
12
devices/wlin.xmuhpc/.bash_profile
Normal file
12
devices/wlin.xmuhpc/.bash_profile
Normal file
@@ -0,0 +1,12 @@
|
||||
# .bash_profile
|
||||
|
||||
# Get the aliases and functions
|
||||
if [ -f ~/.bashrc ]; then
|
||||
. ~/.bashrc
|
||||
fi
|
||||
|
||||
# User specific environment and startup programs
|
||||
|
||||
PATH=$PATH:$HOME/bin
|
||||
|
||||
export PATH
|
||||
43
devices/wlin.xmuhpc/.bashrc
Normal file
43
devices/wlin.xmuhpc/.bashrc
Normal file
@@ -0,0 +1,43 @@
|
||||
# .bashrc
|
||||
|
||||
# Source global definitions
|
||||
if [ -f /etc/bashrc ]; then
|
||||
. /etc/bashrc
|
||||
fi
|
||||
|
||||
export PATH=$PATH:/data/gpfs01/wlin/bin
|
||||
|
||||
# User specific aliases and functions
|
||||
export PATH=/data/gpfs01/wlin/bin/vaspkit.1.4.1/bin:${PATH}
|
||||
#export PATH=~/bin:/data/gpfs01/wlin/opt/mpich_ifort/bin:$PATH
|
||||
#export LD_LIBRARY_PATH=/data/gpfs01/wlin/opt/mpich_ifort/lib:$LD_LIBRARY_PATH
|
||||
#export PATH=~/bin:/data/gpfs01/wlin/opt/mpich/bin:$PATH
|
||||
#export LD_LIBRARY_PATH=/data/gpfs01/wlin/opt/mpich/lib:$LD_LIBRARY_PATH
|
||||
export P4_RSHCOMMAND=ssh
|
||||
shopt -s cdspell
|
||||
export HISTCONTROL=ignoredups
|
||||
#shopt -s histappend
|
||||
PROMPT_COMMAND='history -a'
|
||||
export C3_RSH="ssh -x"
|
||||
export OMP_NUM_THREADS=1
|
||||
export MKL_NUM_THREADS=1
|
||||
alias grep='grep --color'
|
||||
USER_IP=`who -u am i 2>/dev/null| awk '{print $NF}'|sed -e 's/[()]//g'`
|
||||
|
||||
export HISTTIMEFORMAT="%Y-%m-%d %H:%M:%S `whoami`@${USER_IP}: "
|
||||
export HISTFILESIZE=1000000
|
||||
export PROMPT_COMMAND="history -a; history -r; $PROMPT_COMMAND"
|
||||
shopt -s histappend
|
||||
# Auto add env parameter $PROMPT_COMMAND when use non-Linux tty login by ssh.
|
||||
if [ "$SSH_CONNECTION" != '' -a "$TERM" != 'linux' ]; then
|
||||
declare -a HOSTIP
|
||||
HOSTIP=`echo $SSH_CONNECTION |awk '{print $3}'`
|
||||
export PROMPT_COMMAND='echo -ne "\033]0;${USER}@$HOSTIP:[${HOSTNAME%%.*}]:${PWD/#$HOME/~} \007"'
|
||||
fi
|
||||
ulimit -s unlimited
|
||||
export PYTHONPATH=/data/gpfs01/wlin/bin/VaspBandUnfolding-master:${PYTHONPATH}
|
||||
|
||||
# vsts, see https://theory.cm.utexas.edu/vtsttools/scripts.html
|
||||
export PATH=$PATH:/data/gpfs01/wlin/yjj/vtstscripts-1022
|
||||
export PERL5LIB=/data/gpfs01/wlin/yjj/vtstscripts-1022
|
||||
|
||||
@@ -186,22 +186,21 @@ samba 就是 windows 共享文件夹的那个协议。
|
||||
|
||||
VASP 有很多很多个版本,具体来说:
|
||||
|
||||
* VASP 多个版本可以共存。目前安装了两个版本:6.3.1 和 6.4.0。
|
||||
* VASP 可以用不同的编译器编译。目前安装的有:nvidia、gnu、intel 和 amd。nvidia 使用 GPU 计算,其它的只能用 CPU 计算。
|
||||
* VASP 多个版本可以共存,但为了简单只安装了 6.4.0 版本。
|
||||
* VASP 可以用不同的编译器编译。目前安装的有:nvidia、intel。nvidia 使用 GPU 计算,intel 能用 CPU 计算。其它版本性能不佳,没有安装。
|
||||
* VASP 的 std/gam/ncl 版本有一点区别,一般用 std,只有一个 gamma 点的时候用 gam 会快一点,系统中存在方向不平行的磁矩时必须用 ncl。
|
||||
* 无论哪个版本,都集成了下面这些补丁:
|
||||
* HDF5:用于生成 hdf5 格式的输出文件。
|
||||
* wannier90:我也不知道干啥的,随手加上的。
|
||||
* OPTCELL:如果存在一个 `OPTCELL` 文件,VASP 会据此决定弛豫时仅优化哪几个晶胞参数。
|
||||
* MPI shared memory:用来减小内存占用。
|
||||
* VTST tools:用来计算 neb。
|
||||
|
||||
如何提交 VASP 到队列系统已经在上面介绍过了。下面的例子是,如果要直接运行一个任务的写法:
|
||||
|
||||
```bash
|
||||
vasp-nvidia-640-env mpirun -np 1 -x CUDA_DEVICE_ORDER=PCI_BUS_ID -x CUDA_VISIBLE_DEVICES=0 -x OMP_NUM_THREADS=4 vasp-std
|
||||
vasp-gnu-640-env mpirun -np 2 -x OMP_NUM_THREADS=4 vasp-std
|
||||
vasp-intel-640-env mpirun -n 2 -genv OMP_NUM_THREADS=4 vasp-std
|
||||
vasp-amd-640-env mpirun -np 2 -x OMP_NUM_THREADS=4 vasp-std
|
||||
```
|
||||
|
||||
其中 `CUDA_VISIBLE_DEVICES` 用于指定用哪几个显卡计算(多个显卡用逗号分隔)。
|
||||
@@ -211,6 +210,12 @@ vasp-amd-640-env mpirun -np 2 -x OMP_NUM_THREADS=4 vasp-std
|
||||
后面的 `mpirun xxx` 才是真的调用 VASP。
|
||||
所以实际上你也可以在这个环境里做别的事情,例如执行上面的 `nvaccelinfo` 命令。
|
||||
|
||||
要使用 VTST tools 里带的脚本,需要在命令前加上 `vtstscripts` 。例如:
|
||||
|
||||
```bash
|
||||
vtstscripts dist.pl POSCAR.init POSCAR.final
|
||||
```
|
||||
|
||||
## mumax
|
||||
|
||||
问龚斌,我没用过。
|
||||
|
||||
@@ -47,8 +47,7 @@ inputs:
|
||||
forwardCompat = false;
|
||||
};
|
||||
};
|
||||
gui = { preferred = false; autoStart = true; };
|
||||
kernel.patches = [ "cjktty" "lantian" ];
|
||||
gui = { enable = true; preferred = false; autoStart = true; };
|
||||
networking.hostname = "xmupc1";
|
||||
nix.remote.slave.enable = true;
|
||||
};
|
||||
@@ -58,9 +57,8 @@ inputs:
|
||||
services =
|
||||
{
|
||||
snapper.enable = true;
|
||||
fontconfig.enable = true;
|
||||
sshd = { passwordAuthentication = true; groupBanner = true; };
|
||||
xray.client.dae.wanInterface = [ "wlp57s0" ];
|
||||
xray.client = {};
|
||||
firewall.trustedInterfaces = [ "virbr0" "waydroid0" ];
|
||||
smartd.enable = true;
|
||||
beesd.instances =
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
acme:
|
||||
cloudflare.ini: ENC[AES256_GCM,data:PjCyozvFTXxA///enYYbaMZ8ISfFjJviLVKfdOcMSi5G3CEjEsp1Ez4krbgy4/eJo4v9HfTN0bMmUnl2OHOyzTg=,iv:e1iQZ5JUHkzfnfP956Lzl3FWs11xdULctA5MZsALtU0=,tag:8X2Q/Hixxn/ci4XRSUDidg==,type:str]
|
||||
token: ENC[AES256_GCM,data:KKMdZgzciiM+n0Hdsb8vivjmCw6SiqJMbEAmvFwFQgvS9zpCNSyh+g==,iv:GbNJrVLmFudVzgoLdf+j8JsEPRvrQhBu3+2585grReQ=,tag:3tNL+2hoz2R9aOz0TUTjVQ==,type:str]
|
||||
nginx:
|
||||
maxmind-license: ENC[AES256_GCM,data:/7R7w+fiMw54Cmd7y/wT/s8RMqFMf3Fc0Mph0ZhURmCzowkmLEhtmw==,iv:i+Z+2NbssI864Edwf73SQfaeFuWoqr+U8eQ/8R23FOk=,tag:8ITlkS97vlsmHM1HDk6/3A==,type:str]
|
||||
xray-client:
|
||||
@@ -41,8 +41,8 @@ sops:
|
||||
ZDNHUjE2QVlCV3p0NHdKYW5IMHVBZzQKkZtfyvfroOntg3yRjMw4jQHiQj8eaB2h
|
||||
IeIHfW4y01mmVT2ofbtB0xYpjcl4gtUlQ8X3tn5iJ9P8gcVo0G598A==
|
||||
-----END AGE ENCRYPTED FILE-----
|
||||
lastmodified: "2024-03-10T13:47:17Z"
|
||||
mac: ENC[AES256_GCM,data:19w2Q1SRhKIyxibGgKa+CkEhiizFJ27FePOlMll+8tJVJRzfIl8KrutlRi0hMhEYFlML0bWunbINUEIg7yJbIwFCSjxFDnqKsCT3iClT3kaktxr5+0R+ECoQTGGV67VkT5WY/LT3V1zdLYI38MVaBQObGKCpBs23nIK2QXrg39Q=,iv:q1ezSmo14vsmEE8owxnsonWMq2uj6mrVjKNh+RuK+cE=,tag:QBc99UEaEPiEgZH+Z3Z8tA==,type:str]
|
||||
lastmodified: "2024-05-10T08:53:57Z"
|
||||
mac: ENC[AES256_GCM,data:ImxIE0d7cEpudUKGs9zHCMFKlHYwFfztLWe5ZMWOrQxr7/uRxfCsiIvuU1nRri0jx2x8J6EFAG1BdrF4KRSeW5sIB9Tlk7X1TJ69zSdLhhnIuPl+rSyovoIkMQAJ0Wvyvlgimh1VQyaBkPsjnGk/dga1N0+gIlmiwFKY5uTpaaA=,iv:fo6S9fIDxnp7VWYYWH613U6bxIlDBZaNObkRR3AdgEc=,tag:ZRIMHkWRsf75K3Tg3Xv5xw==,type:str]
|
||||
pgp: []
|
||||
unencrypted_suffix: _unencrypted
|
||||
version: 3.8.1
|
||||
|
||||
@@ -41,8 +41,7 @@ inputs:
|
||||
forwardCompat = false;
|
||||
};
|
||||
};
|
||||
gui = { preferred = false; autoStart = true; };
|
||||
kernel.patches = [ "cjktty" "lantian" ];
|
||||
gui = { enable = true; preferred = false; autoStart = true; };
|
||||
networking.hostname = "xmupc2";
|
||||
nix.remote.slave.enable = true;
|
||||
};
|
||||
@@ -52,9 +51,8 @@ inputs:
|
||||
services =
|
||||
{
|
||||
snapper.enable = true;
|
||||
fontconfig.enable = true;
|
||||
sshd = { passwordAuthentication = true; groupBanner = true; };
|
||||
xray.client.dae.wanInterface = [ "wlp4s0" ];
|
||||
xray.client = {};
|
||||
firewall.trustedInterfaces = [ "virbr0" "waydroid0" ];
|
||||
smartd.enable = true;
|
||||
beesd.instances.root = { device = "/"; hashTableSizeMB = 16384; threads = 4; };
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
acme:
|
||||
cloudflare.ini: ENC[AES256_GCM,data:/y070fzfZFI/Jb9xS8UO7iRnjHJ3uItqsHqjyHPAqsTN4tSEyMpaE3KtNpecgWxk2PvLRfqdmdwu/bnGlIp7adU=,iv:fv4dbeK1F/cn5nhnSC1lTUqxeFPG/0lNqEvPWMH6Mzw=,tag:dE4clxPGraAXXsJM6NS8XQ==,type:str]
|
||||
token: ENC[AES256_GCM,data:Wb7Gons3HCMK5WGIZpG4XrrqZ5G6bymjuKMW6IUjLiK0CIXFz/ARNg==,iv:zc4BgHcc+O7SHQbJkff11fBwgsd+TFtvSEGJ/qrzVo4=,tag:K+Nu9kenTtTnin4+hDCdWA==,type:str]
|
||||
nginx:
|
||||
maxmind-license: ENC[AES256_GCM,data:FPVSD8otQMNpbESNEHXCfQjB/zi3OVwZoyLijUtnHQlQzec7KVSiGw==,iv:DkkwCqvRmcFHQIXseh2fycCxZboJMYhHPu67GddenY4=,tag:iHEC8r5GcuB1QcZ5Uf8Skw==,type:str]
|
||||
xray-client:
|
||||
@@ -41,8 +41,8 @@ sops:
|
||||
M0xoL1dQR0kvMWpzN0RMNWVCTFQxNFUKj9LPjBo5NGOrGYNvu8qZ13PLYjLEWllU
|
||||
LARzEn4XgkeHckouwvxZYMCx7WxmAruRWaOvnxTIczzSNP7wIrqnkA==
|
||||
-----END AGE ENCRYPTED FILE-----
|
||||
lastmodified: "2024-03-10T13:46:59Z"
|
||||
mac: ENC[AES256_GCM,data:j+bdp0emAtTNNI7aZsKTJ+uARsuyLb9GRV0CeIb2EoZaOmj5cJpUzYtcAWIdCYplt1ZScCcR7iQPUlCzUb0+pXth7QDibtGJcj0dqw87DoaY3cqm7jNkKteiIYxXOCmbMBgED9eMxQVdcGZTDSuTQ0KjFYoXkcUSriMsJltDUDc=,iv:+eLNmlxeqB/Q7Rmz5B/wZSajiesV+/ED3ROJuuShpfo=,tag:95xKRRuqRZkUFUjHbPrDNw==,type:str]
|
||||
lastmodified: "2024-05-10T08:54:10Z"
|
||||
mac: ENC[AES256_GCM,data:4n7bAGzORwd6vHl/Cs5YT8VZaSdfvxUm6e+fw7PYC2ov8XoRlJKU/Bci8Sbwcy2H6OjbkdRYA61cB2wAjtEY1x9N/c6qvUAOjTvOtcXoQQex8d+aMnJsFfJQ70GHCZE+KRTmy1SAMn+N00Oy0FDisdQe/jIZuWyav5j62CKqLqc=,iv:YEhiXU2IgXy4A0ZLsNY7kFqXJM5RBHE4IZwlRoF8XMA=,tag:aVc0r2g1QkY42NP59p4m2w==,type:str]
|
||||
pgp: []
|
||||
unencrypted_suffix: _unencrypted
|
||||
version: 3.8.1
|
||||
|
||||
973
flake.lock
generated
973
flake.lock
generated
File diff suppressed because it is too large
Load Diff
126
flake.nix
126
flake.nix
@@ -3,30 +3,25 @@
|
||||
|
||||
inputs =
|
||||
{
|
||||
nixpkgs.url = "github:CHN-beta/nixpkgs/nixos-23.11";
|
||||
nixpkgs.url = "github:CHN-beta/nixpkgs/nixos-24.05";
|
||||
nixpkgs-unstable.url = "github:CHN-beta/nixpkgs/nixos-unstable";
|
||||
"nixpkgs-23.11".url = "github:CHN-beta/nixpkgs/nixos-23.11";
|
||||
"nixpkgs-23.05".url = "github:CHN-beta/nixpkgs/nixos-23.05";
|
||||
"nixpkgs-22.11".url = "github:NixOS/nixpkgs/nixos-22.11";
|
||||
"nixpkgs-22.05".url = "github:NixOS/nixpkgs/nixos-22.05";
|
||||
home-manager = { url = "github:nix-community/home-manager/release-23.11"; inputs.nixpkgs.follows = "nixpkgs"; };
|
||||
home-manager = { url = "github:nix-community/home-manager/release-24.05"; inputs.nixpkgs.follows = "nixpkgs"; };
|
||||
sops-nix =
|
||||
{
|
||||
url = "github:Mic92/sops-nix";
|
||||
inputs = { nixpkgs.follows = "nixpkgs"; nixpkgs-stable.follows = "nixpkgs"; };
|
||||
};
|
||||
aagl = { url = "github:ezKEa/aagl-gtk-on-nix"; inputs.nixpkgs.follows = "nixpkgs"; };
|
||||
aagl = { url = "github:ezKEa/aagl-gtk-on-nix/release-24.05"; inputs.nixpkgs.follows = "nixpkgs"; };
|
||||
nix-index-database = { url = "github:Mic92/nix-index-database"; inputs.nixpkgs.follows = "nixpkgs-unstable"; };
|
||||
nur.url = "github:nix-community/NUR";
|
||||
nixos-cn = { url = "github:nixos-cn/flakes"; inputs.nixpkgs.follows = "nixpkgs"; };
|
||||
nur-xddxdd = { url = "github:xddxdd/nur-packages"; inputs.nixpkgs.follows = "nixpkgs"; };
|
||||
nix-vscode-extensions = { url = "github:nix-community/nix-vscode-extensions"; inputs.nixpkgs.follows = "nixpkgs"; };
|
||||
impermanence.url = "github:nix-community/impermanence";
|
||||
qchem = { url = "github:Nix-QChem/NixOS-QChem/release-23.11"; inputs.nixpkgs.follows = "nixpkgs"; };
|
||||
nixd = { url = "github:nix-community/nixd"; inputs.nixpkgs.follows = "nixpkgs"; };
|
||||
napalm = { url = "github:nix-community/napalm"; inputs.nixpkgs.follows = "nixpkgs"; };
|
||||
nixpak = { url = "github:nixpak/nixpak"; inputs.nixpkgs.follows = "nixpkgs"; };
|
||||
qchem = { url = "github:Nix-QChem/NixOS-QChem/master"; inputs.nixpkgs.follows = "nixpkgs"; };
|
||||
deploy-rs = { url = "github:serokell/deploy-rs"; inputs.nixpkgs.follows = "nixpkgs"; };
|
||||
pnpm2nix-nzbr = { url = "github:CHN-beta/pnpm2nix-nzbr"; inputs.nixpkgs.follows = "nixpkgs"; };
|
||||
plasma-manager =
|
||||
{
|
||||
url = "github:pjones/plasma-manager";
|
||||
@@ -40,15 +35,16 @@
|
||||
nix-flatpak.url = "github:gmodena/nix-flatpak";
|
||||
chaotic =
|
||||
{
|
||||
url = "github:chaotic-cx/nyx?rev=03b2bea544688068025df1912ff1e9a1ad4a642a";
|
||||
url = "github:chaotic-cx/nyx";
|
||||
inputs = { nixpkgs.follows = "nixpkgs"; home-manager.follows = "home-manager"; };
|
||||
};
|
||||
gricad = { url = "github:Gricad/nur-packages"; flake = false; };
|
||||
catppuccin.url = "github:catppuccin/nix";
|
||||
bscpkgs = { url = "git+https://pm.bsc.es/gitlab/rarias/bscpkgs.git"; inputs.nixpkgs.follows = "nixpkgs"; };
|
||||
|
||||
misskey = { url = "git+https://github.com/CHN-beta/misskey?submodules=1"; flake = false; };
|
||||
rsshub = { url = "github:DIYgod/RSSHub"; flake = false; };
|
||||
zpp-bits = { url = "github:eyalz800/zpp_bits"; flake = false; };
|
||||
citation-style-language = { url = "git+https://github.com/zepinglee/citeproc-lua?submodules=1"; flake = false; };
|
||||
concurrencpp = { url = "github:David-Haim/concurrencpp"; flake = false; };
|
||||
cppcoro = { url = "github:Garcia6l20/cppcoro"; flake = false; };
|
||||
date = { url = "github:HowardHinnant/date"; flake = false; };
|
||||
@@ -68,33 +64,50 @@
|
||||
lmod = { url = "github:TACC/Lmod"; flake = false; };
|
||||
mumax = { url = "github:CHN-beta/mumax"; flake = false; };
|
||||
kylin-virtual-keyboard = { url = "git+https://gitee.com/openkylin/kylin-virtual-keyboard.git"; flake = false; };
|
||||
cjktty = { url = "github:CHN-beta/cjktty-patches"; flake = false; };
|
||||
zxorm = { url = "github:CHN-beta/zxorm"; flake = false; };
|
||||
openxlsx = { url = "github:troldal/OpenXLSX"; flake = false; };
|
||||
sqlite-orm = { url = "github:fnc12/sqlite_orm"; flake = false; };
|
||||
|
||||
# does not support lfs yet
|
||||
# nixos-wallpaper = { url = "git+https://git.chn.moe/chn/nixos-wallpaper.git"; flake = false; };
|
||||
};
|
||||
|
||||
outputs = inputs:
|
||||
let
|
||||
localLib = import ./local/lib inputs.nixpkgs.lib;
|
||||
devices = builtins.attrNames (builtins.readDir ./devices);
|
||||
devices = builtins.filter (dir: (builtins.readDir ./devices/${dir})."default.nix" or null == "regular" )
|
||||
(builtins.attrNames (builtins.readDir ./devices));
|
||||
in
|
||||
{
|
||||
packages.x86_64-linux =
|
||||
{
|
||||
default = inputs.nixpkgs.legacyPackages.x86_64-linux.writeText "systems"
|
||||
(builtins.concatStringsSep "\n" (builtins.map
|
||||
(system: builtins.toString inputs.self.outputs.nixosConfigurations.${system}.config.system.build.toplevel)
|
||||
devices));
|
||||
}
|
||||
// (
|
||||
builtins.listToAttrs (builtins.map
|
||||
(system:
|
||||
{
|
||||
name = system;
|
||||
value = inputs.self.outputs.nixosConfigurations.${system}.config.system.build.toplevel;
|
||||
})
|
||||
devices)
|
||||
);
|
||||
# ssh-keygen -t rsa -C root@pe -f /mnt/nix/persistent/etc/ssh/ssh_host_rsa_key
|
||||
# ssh-keygen -t ed25519 -C root@pe -f /mnt/nix/persistent/etc/ssh/ssh_host_ed25519_key
|
||||
# systemd-machine-id-setup --root=/mnt/nix/persistent
|
||||
let pkgs = (import inputs.nixpkgs
|
||||
{
|
||||
system = "x86_64-linux";
|
||||
config.allowUnfree = true;
|
||||
overlays = [ inputs.self.overlays.default ];
|
||||
});
|
||||
in
|
||||
{
|
||||
default = inputs.nixpkgs.legacyPackages.x86_64-linux.writeText "systems"
|
||||
(builtins.concatStringsSep "\n" (builtins.map
|
||||
(system: builtins.toString inputs.self.outputs.nixosConfigurations.${system}.config.system.build.toplevel)
|
||||
devices));
|
||||
hpcstat =
|
||||
let openssh = (pkgs.pkgsStatic.openssh.override { withLdns = false; etcDir = null; }).overrideAttrs
|
||||
(prev: { doCheck = false; patches = prev.patches ++ [ ./local/pkgs/hpcstat/openssh.patch ];});
|
||||
in pkgs.pkgsStatic.localPackages.hpcstat.override
|
||||
{ inherit openssh; standalone = true; version = inputs.self.rev or "dirty"; };
|
||||
}
|
||||
// (
|
||||
builtins.listToAttrs (builtins.map
|
||||
(system:
|
||||
{
|
||||
name = system;
|
||||
value = inputs.self.outputs.nixosConfigurations.${system}.config.system.build.toplevel;
|
||||
})
|
||||
devices)
|
||||
);
|
||||
nixosConfigurations =
|
||||
(
|
||||
(builtins.listToAttrs (builtins.map
|
||||
@@ -132,23 +145,6 @@
|
||||
};
|
||||
}
|
||||
);
|
||||
# sudo HTTPS_PROXY=socks5://127.0.0.1:10884 nixos-install --flake .#bootstrap --option substituters http://127.0.0.1:5000 --option require-sigs false --option system-features gccarch-silvermont
|
||||
# nix-serve -p 5000
|
||||
# nix copy --substitute-on-destination --to ssh://server /run/current-system
|
||||
# nix copy --to ssh://nixos@192.168.122.56 ./result
|
||||
# sudo nixos-install --flake .#bootstrap
|
||||
# --option substituters http://192.168.122.1:5000 --option require-sigs false
|
||||
# sudo chattr -i var/empty
|
||||
# nix-shell -p ssh-to-age --run 'cat /etc/ssh/ssh_host_ed25519_key.pub | ssh-to-age'
|
||||
# sudo nixos-rebuild switch --flake .#vps6 --log-format internal-json -v |& nom --json
|
||||
# boot.shell_on_fail systemd.setenv=SYSTEMD_SULOGIN_FORCE=1
|
||||
# sudo usbipd
|
||||
# ssh -R 3240:127.0.0.1:3240 root@192.168.122.57
|
||||
# modprobe vhci-hcd
|
||||
# sudo usbip bind -b 3-6
|
||||
# usbip attach -r 127.0.0.1 -b 3-6
|
||||
# systemd-cryptenroll --fido2-device=auto /dev/vda2
|
||||
# systemd-cryptsetup attach root /dev/vda2
|
||||
deploy =
|
||||
{
|
||||
sshUser = "root";
|
||||
@@ -174,14 +170,30 @@
|
||||
overlays.default = final: prev:
|
||||
{ localPackages = (import ./local/pkgs { inherit (inputs) lib; pkgs = final; topInputs = inputs; }); };
|
||||
config.archive = false;
|
||||
devShell.x86_64-linux = let inherit (inputs.self.nixosConfigurations.pc) pkgs; in pkgs.mkShell
|
||||
{
|
||||
packages = with pkgs; [ pkg-config cmake ninja clang-tools_17 ];
|
||||
buildInputs =
|
||||
(with pkgs; [ fmt boost magic-enum libbacktrace eigen range-v3 ])
|
||||
++ (with pkgs.localPackages; [ concurrencpp tgbot-cpp nameof ]);
|
||||
# hardeningDisable = [ "all" ];
|
||||
# NIX_DEBUG = "1";
|
||||
};
|
||||
devShells.x86_64-linux =
|
||||
let pkgs = (import inputs.nixpkgs
|
||||
{
|
||||
system = "x86_64-linux";
|
||||
config.allowUnfree = true;
|
||||
overlays = [ inputs.self.overlays.default ];
|
||||
});
|
||||
in
|
||||
{
|
||||
biu = pkgs.mkShell
|
||||
{
|
||||
packages = with pkgs; [ pkg-config cmake ninja clang-tools_17 ];
|
||||
buildInputs =
|
||||
(with pkgs; [ fmt boost magic-enum libbacktrace eigen range-v3 ])
|
||||
++ (with pkgs.localPackages; [ concurrencpp tgbot-cpp nameof ]);
|
||||
# hardeningDisable = [ "all" ];
|
||||
# NIX_DEBUG = "1";
|
||||
};
|
||||
hpcstat = pkgs.mkShell
|
||||
{
|
||||
inputsFrom = [ (inputs.self.packages.x86_64-linux.hpcstat.override { version = null; }) ];
|
||||
packages = [ pkgs.clang-tools_17 ];
|
||||
CMAKE_EXPORT_COMPILE_COMMANDS = "1";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
{ version ? "4.2.0", stdenv, fetchurl, lib }:
|
||||
let versions =
|
||||
{
|
||||
"4.1.0" = "1k9anln9hmdjflrkq4iacrmhma7gfrfj6d0b8ywxys0wfpdvy12v";
|
||||
"4.2.0" = "1aycw6ygzr1db6xf3z7v5lpznhs8j7gcpkawd304vcj5qw75cnpd";
|
||||
};
|
||||
in stdenv.mkDerivation
|
||||
{
|
||||
pname = "aocc";
|
||||
inherit version;
|
||||
src = fetchurl
|
||||
{
|
||||
url = "https://download.amd.com/developer/eula/aocc/aocc-"
|
||||
+ builtins.concatStringsSep "-" (lib.lists.take 2 (builtins.splitVersion version))
|
||||
+ "/aocc-compiler-${version}.tar";
|
||||
sha256 = versions.${version};
|
||||
};
|
||||
dontBuild = true;
|
||||
installPhase =
|
||||
''
|
||||
mkdir -p $out
|
||||
cp -r bin include lib lib32 libexec share $out
|
||||
'';
|
||||
dontFixup = true;
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
{ version ? "4.2.0", stdenv, fetchurl, lib }:
|
||||
let versions =
|
||||
{
|
||||
"4.1.0" = "04780c2zks0g76c4n4a2cbbhs1qz4lza4ffiw1fj0md3f1lxihr5";
|
||||
"4.2.0" = "0p4x0zza6y18hjjs1971gyc5kjd2f8nzzynp2jabhl2vxiys2nnj";
|
||||
};
|
||||
in stdenv.mkDerivation
|
||||
{
|
||||
pname = "aocl";
|
||||
inherit version;
|
||||
src = fetchurl
|
||||
{
|
||||
url = "https://download.amd.com/developer/eula/aocl/aocl-"
|
||||
+ builtins.concatStringsSep "-" (lib.lists.take 2 (builtins.splitVersion version))
|
||||
+ "/aocl-linux-aocc-${version}.tar.gz";
|
||||
sha256 = versions.${version};
|
||||
};
|
||||
dontBuild = true;
|
||||
installPhase =
|
||||
''
|
||||
installDir=$(mktemp -d)
|
||||
bash ./install.sh -t $installDir
|
||||
mkdir -p $out
|
||||
cp -r $installDir/${version}/aocc/lib_LP64 $out/lib
|
||||
cp -r $installDir/${version}/aocc/include_LP64 $out/include
|
||||
'';
|
||||
dontFixup = true;
|
||||
}
|
||||
1
local/pkgs/biu/.envrc
Normal file
1
local/pkgs/biu/.envrc
Normal file
@@ -0,0 +1 @@
|
||||
use flake .#biu
|
||||
@@ -1,22 +0,0 @@
|
||||
{ stdenvNoCC, texlive, src }: stdenvNoCC.mkDerivation (finalAttrs:
|
||||
{
|
||||
name = "citation-style-language";
|
||||
inherit src;
|
||||
passthru =
|
||||
{
|
||||
pkgs = [ finalAttrs.finalPackage ];
|
||||
tlDeps = with texlive; [ latex ];
|
||||
tlType = "run";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ texlive.combined.scheme-full ];
|
||||
dontConfigure = true;
|
||||
dontBuild = true;
|
||||
installPhase =
|
||||
''
|
||||
runHook preInstall
|
||||
export TEXMFHOME=$out
|
||||
l3build install
|
||||
runHook postInstall
|
||||
'';
|
||||
})
|
||||
@@ -1,13 +1,7 @@
|
||||
{ stdenv, src }: stdenv.mkDerivation
|
||||
{ stdenv, src, cmake, pkg-config }: stdenv.mkDerivation
|
||||
{
|
||||
name = "date";
|
||||
inherit src;
|
||||
phases = [ "installPhase" ];
|
||||
installPhase =
|
||||
''
|
||||
runHook preInstall
|
||||
mkdir -p $out
|
||||
cp -r $src/{include,src} $out
|
||||
runHook postInstall
|
||||
'';
|
||||
nativeBuildInputs = [ cmake pkg-config ];
|
||||
cmakeFlags = [ "-DBUILD_TZ_LIB=ON" "-DUSE_SYSTEM_TZ_DB=ON" ];
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@ inputs: rec
|
||||
{
|
||||
typora = inputs.pkgs.callPackage ./typora {};
|
||||
vesta = inputs.pkgs.callPackage ./vesta {};
|
||||
rsshub = inputs.pkgs.callPackage ./rsshub { src = inputs.topInputs.rsshub; };
|
||||
misskey = inputs.pkgs.callPackage ./misskey { nodejs = inputs.pkgs.nodejs_21; src = inputs.topInputs.misskey; };
|
||||
rsshub = inputs.pkgs.callPackage ./rsshub.nix { inherit mkPnpmPackage; src = inputs.topInputs.rsshub; };
|
||||
misskey = inputs.pkgs.callPackage ./misskey.nix { inherit mkPnpmPackage; src = inputs.topInputs.misskey; };
|
||||
mk-meili-mgn = inputs.pkgs.callPackage ./mk-meili-mgn {};
|
||||
vaspkit = inputs.pkgs.callPackage ./vaspkit { inherit (inputs.localLib) attrsToList; };
|
||||
v-sim = inputs.pkgs.callPackage ./v-sim { src = inputs.topInputs.v-sim; };
|
||||
@@ -20,8 +20,6 @@ inputs: rec
|
||||
chromiumos-touch-keyboard = inputs.pkgs.callPackage ./chromiumos-touch-keyboard {};
|
||||
yoga-support = inputs.pkgs.callPackage ./yoga-support {};
|
||||
tgbot-cpp = inputs.pkgs.callPackage ./tgbot-cpp { src = inputs.topInputs.tgbot-cpp; };
|
||||
citation-style-language = inputs.pkgs.callPackage ./citation-style-language
|
||||
{ src = inputs.topInputs.citation-style-language; };
|
||||
mirism = inputs.pkgs.callPackage ./mirism
|
||||
{
|
||||
inherit cppcoro nameof tgbot-cpp date;
|
||||
@@ -43,44 +41,35 @@ inputs: rec
|
||||
lmod = inputs.pkgs.callPackage ./lmod { src = inputs.topInputs.lmod; };
|
||||
vasp = rec
|
||||
{
|
||||
source = inputs.pkgs.callPackage ./vasp/source.nix {};
|
||||
src = inputs.pkgs.callPackage ./vasp/source.nix {};
|
||||
gnu = inputs.pkgs.callPackage ./vasp/gnu
|
||||
{
|
||||
inherit (inputs.pkgs.llvmPackages) openmp;
|
||||
inherit wannier90 additionalCommands;
|
||||
hdf5 = inputs.pkgs.hdf5.override { mpiSupport = true; fortranSupport = true; };
|
||||
};
|
||||
gnu-mkl = inputs.pkgs.callPackage ./vasp/gnu-mkl
|
||||
{
|
||||
inherit (inputs.pkgs.llvmPackages) openmp;
|
||||
inherit wannier90 additionalCommands;
|
||||
hdf5 = inputs.pkgs.hdf5.override { mpiSupport = true; fortranSupport = true; };
|
||||
inherit wannier90 src;
|
||||
hdf5 = inputs.pkgs.hdf5.override { mpiSupport = true; fortranSupport = true; cppSupport = false; };
|
||||
};
|
||||
nvidia = inputs.pkgs.callPackage ./vasp/nvidia
|
||||
{ inherit lmod nvhpc wannier90 additionalCommands; hdf5 = hdf5-nvhpc; };
|
||||
{ inherit lmod nvhpc wannier90 vtst src; hdf5 = hdf5-nvhpc; };
|
||||
intel = inputs.pkgs.callPackage ./vasp/intel
|
||||
{ inherit lmod oneapi wannier90 additionalCommands; hdf5 = hdf5-oneapi; };
|
||||
amd = inputs.pkgs.callPackage ./vasp/amd
|
||||
{ inherit aocc aocl wannier90 additionalCommands; hdf5 = hdf5-aocc; openmpi = openmpi-aocc; gcc = gcc-pie; };
|
||||
{ inherit lmod oneapi wannier90 vtst src; hdf5 = hdf5-oneapi; };
|
||||
wannier90 = inputs.pkgs.callPackage
|
||||
"${inputs.topInputs.nixpkgs-unstable}/pkgs/by-name/wa/wannier90/package.nix" {};
|
||||
hdf5-nvhpc = inputs.pkgs.callPackage ./vasp/hdf5-nvhpc { inherit lmod nvhpc; inherit (inputs.pkgs.hdf5) src; };
|
||||
hdf5-oneapi = inputs.pkgs.callPackage ./vasp/hdf5-oneapi { inherit lmod oneapi; inherit (inputs.pkgs.hdf5) src; };
|
||||
hdf5-aocc = inputs.pkgs.callPackage ./vasp/hdf5-aocc
|
||||
{ inherit (inputs.pkgs.hdf5) src; inherit aocc; openmpi = openmpi-aocc; gcc = gcc-pie; };
|
||||
openmpi-aocc = inputs.pkgs.callPackage ./vasp/openmpi-aocc { inherit aocc; gcc = gcc-pie; };
|
||||
gcc-pie = inputs.pkgs.wrapCC (inputs.pkgs.gcc.cc.overrideAttrs (prev:
|
||||
{ configureFlags = prev.configureFlags ++ [ "--enable-default-pie" ];}));
|
||||
additionalCommands = let uid = inputs.config.nixos.user.uid.gb; in
|
||||
''[ "$(${inputs.pkgs.coreutils}/bin/id -u)" -eq ${builtins.toString uid} ] && exit 1'';
|
||||
vtst = (inputs.pkgs.callPackage ./vasp/vtst.nix {});
|
||||
vtstscripts = inputs.pkgs.callPackage ./vasp/vtstscripts.nix {};
|
||||
};
|
||||
# TODO: use other people packaged hpc version
|
||||
oneapi = inputs.pkgs.callPackage ./oneapi {};
|
||||
mumax = inputs.pkgs.callPackage ./mumax { src = inputs.topInputs.mumax; };
|
||||
aocc = inputs.pkgs.callPackage ./aocc {};
|
||||
aocl = inputs.pkgs.callPackage ./aocl {};
|
||||
kylin-virtual-keyboard = inputs.pkgs.libsForQt5.callPackage ./kylin-virtual-keyboard
|
||||
{ src = inputs.topInputs.kylin-virtual-keyboard; };
|
||||
biu = inputs.pkgs.callPackage ./biu { inherit nameof; };
|
||||
zxorm = inputs.pkgs.callPackage ./zxorm { src = inputs.topInputs.zxorm; };
|
||||
hpcstat = inputs.pkgs.callPackage ./hpcstat { inherit nameof sqlite-orm zpp-bits date openxlsx; };
|
||||
openxlsx = inputs.pkgs.callPackage ./openxlsx { src = inputs.topInputs.openxlsx; };
|
||||
sqlite-orm = inputs.pkgs.callPackage ./sqlite-orm { src = inputs.topInputs.sqlite-orm; };
|
||||
mkPnpmPackage = inputs.pkgs.callPackage ./mkPnpmPackage.nix {};
|
||||
|
||||
fromYaml = content: builtins.fromJSON (builtins.readFile
|
||||
(inputs.pkgs.runCommand "toJSON" {}
|
||||
|
||||
3
local/pkgs/hpcstat/.clangd
Normal file
3
local/pkgs/hpcstat/.clangd
Normal file
@@ -0,0 +1,3 @@
|
||||
CompileFlags:
|
||||
Add: [ -Wall, -Wextra, -std=c++23 ]
|
||||
Compiler: g++
|
||||
1
local/pkgs/hpcstat/.envrc
Normal file
1
local/pkgs/hpcstat/.envrc
Normal file
@@ -0,0 +1 @@
|
||||
use flake .#hpcstat
|
||||
38
local/pkgs/hpcstat/CMakeLists.txt
Normal file
38
local/pkgs/hpcstat/CMakeLists.txt
Normal file
@@ -0,0 +1,38 @@
|
||||
cmake_minimum_required(VERSION 3.14)
|
||||
project(hpcstat VERSION 0.0.0 LANGUAGES CXX)
|
||||
enable_testing()
|
||||
include(GNUInstallDirs)
|
||||
|
||||
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
||||
message("Setting build type to 'Release' as none was specified.")
|
||||
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE)
|
||||
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
|
||||
endif()
|
||||
|
||||
set(HPCSTAT_VERSION "unknown" CACHE STRING "Version of the hpcstat")
|
||||
|
||||
find_package(fmt REQUIRED)
|
||||
find_package(Boost REQUIRED COMPONENTS headers filesystem)
|
||||
find_package(SqliteOrm REQUIRED)
|
||||
find_package(nlohmann_json REQUIRED)
|
||||
find_path(ZPP_BITS_INCLUDE_DIR zpp_bits.h REQUIRED)
|
||||
find_package(range-v3 REQUIRED)
|
||||
find_path(NAMEOF_INCLUDE_DIR nameof.hpp REQUIRED)
|
||||
find_package(date REQUIRED)
|
||||
find_package(OpenXLSX REQUIRED)
|
||||
find_package(httplib REQUIRED)
|
||||
|
||||
add_executable(hpcstat src/main.cpp src/env.cpp src/keys.cpp src/ssh.cpp src/sql.cpp src/lfs.cpp src/common.cpp
|
||||
src/push.cpp)
|
||||
target_compile_features(hpcstat PUBLIC cxx_std_23)
|
||||
target_include_directories(hpcstat PRIVATE ${PROJECT_SOURCE_DIR}/include ${ZPP_BITS_INCLUDE_DIR})
|
||||
target_link_libraries(hpcstat PRIVATE fmt::fmt Boost::headers Boost::filesystem sqlite_orm::sqlite_orm
|
||||
nlohmann_json::nlohmann_json range-v3::range-v3 date::date date::date-tz OpenXLSX::OpenXLSX httplib::httplib)
|
||||
target_compile_definitions(hpcstat PRIVATE HPCSTAT_VERSION="${HPCSTAT_VERSION}")
|
||||
|
||||
install(TARGETS hpcstat RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
install(DIRECTORY share/ DESTINATION ${CMAKE_INSTALL_DATADIR}/hpcstat)
|
||||
|
||||
get_property(ImportedTargets DIRECTORY "${CMAKE_SOURCE_DIR}" PROPERTY IMPORTED_TARGETS)
|
||||
message("Imported targets: ${ImportedTargets}")
|
||||
message("List of compile features: ${CMAKE_CXX_COMPILE_FEATURES}")
|
||||
19
local/pkgs/hpcstat/default.nix
Normal file
19
local/pkgs/hpcstat/default.nix
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
stdenv, cmake, pkg-config, standalone ? false, version ? null, makeWrapper, lib,
|
||||
boost, fmt, sqlite-orm, nlohmann_json, zpp-bits, range-v3, nameof, openssh, sqlite, date, openxlsx, httplib, openssl,
|
||||
}: stdenv.mkDerivation
|
||||
{
|
||||
name = "hpcstat";
|
||||
src = ./.;
|
||||
buildInputs =
|
||||
[ boost fmt sqlite-orm nlohmann_json zpp-bits range-v3 nameof sqlite date openxlsx httplib openssl.dev ];
|
||||
nativeBuildInputs = [ cmake pkg-config makeWrapper ];
|
||||
cmakeFlags = lib.optionals (version != null) [ "-DHPCSTAT_VERSION=${version}" ];
|
||||
postInstall =
|
||||
if standalone then "cp ${openssh}/bin/{ssh-add,ssh-keygen} $out/bin"
|
||||
else
|
||||
''
|
||||
wrapProgram $out/bin/hpcstat --set HPCSTAT_SHAREDIR $out/share/hpcstat \
|
||||
--set HPCSTAT_DATADIR /var/lib/hpcstat --set HPCSTAT_SSH_BINDIR ${openssh}/bin
|
||||
'';
|
||||
}
|
||||
BIN
local/pkgs/hpcstat/doc/pageant1.png
LFS
Normal file
BIN
local/pkgs/hpcstat/doc/pageant1.png
LFS
Normal file
Binary file not shown.
BIN
local/pkgs/hpcstat/doc/pageant2.png
LFS
Normal file
BIN
local/pkgs/hpcstat/doc/pageant2.png
LFS
Normal file
Binary file not shown.
BIN
local/pkgs/hpcstat/doc/putty1.png
LFS
Normal file
BIN
local/pkgs/hpcstat/doc/putty1.png
LFS
Normal file
Binary file not shown.
BIN
local/pkgs/hpcstat/doc/putty2.png
LFS
Normal file
BIN
local/pkgs/hpcstat/doc/putty2.png
LFS
Normal file
Binary file not shown.
BIN
local/pkgs/hpcstat/doc/putty3.png
LFS
Normal file
BIN
local/pkgs/hpcstat/doc/putty3.png
LFS
Normal file
Binary file not shown.
214
local/pkgs/hpcstat/doc/setup.md
Normal file
214
local/pkgs/hpcstat/doc/setup.md
Normal file
@@ -0,0 +1,214 @@
|
||||
# 设置 SSH agent forwarding
|
||||
|
||||
为了区分登陆 jykang@hpc.xmu.edu.cn 时使用的密钥,并分密钥统计使用情况,需要启用一项名为“SSH agent forwarding”的功能。
|
||||
接下来的内容将带领您在 Windows 系统上配置 SSH agent forwarding。
|
||||
|
||||
> [!NOTE]
|
||||
> 在 Linux 上的配置方法放在了文章末尾。大多数用户不需要阅读。
|
||||
|
||||
要启用“SSH agent forwarding”,需要下面三个步骤:
|
||||
1. 启动 Pageant 并添加密钥。 **这一步骤每次登陆前都需要执行。**
|
||||
2. 配置 PuTTY,使 PuTTY 在每次登陆时不直接使用密钥,而是利用 Pageant 完成认证。这一步骤只需要执行一次。
|
||||
3. 配置 WinSCP,使 WinSCP 在每次登陆时不直接使用密钥,而是利用 Pageant 完成认证。这一步骤只需要执行一次。
|
||||
|
||||
接下来将分别说明这三个步骤。
|
||||
|
||||
## Pageant:
|
||||
|
||||
1. 找到 Pageant 程序。Pageant 会随着 PuTTY 一起安装,一般来说您可以直接在开始菜单中搜索 “pageant” 找到它,也可以在 PuTTY 的安装目录中找到它。
|
||||
2. 启动 Pageant。启动后可能没有任何反应,也可能有一个黑框闪过,这是正常的。只要右下角的系统托盘中出现了 pageant 的图标就可以了。
|
||||
|
||||

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

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

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

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

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

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

|
||||
|
||||
> [!NOTE]
|
||||
> 无论是 PuTTY 还是 WinSCP,改完设置后都记得保存。
|
||||
|
||||
> [!IMPORTANT]
|
||||
> 如果您确认已经按照教程设置好了却仍然不能连接,可以尝试将 WinSCP 和 PuTTY 都更新到最新。
|
||||
>
|
||||
> 我测试使用的版本是:PuTTY 0.78 和 WinSCP 6.3.3。
|
||||
|
||||
---
|
||||
|
||||
# 其它内容
|
||||
|
||||
接下来的内容不是使用 jykang@hpc.xmu.edu.cn 的必需内容,不须要阅读。
|
||||
如果您按照上面的步骤配置 SSH agent forwarding 失败,那么请再次仔细阅读上面的内容,**接下来的内容对您没有帮助**。
|
||||
|
||||
接下来的内容包括:
|
||||
* 解释为什么不转发 agent 就无法区分不同密钥。
|
||||
* 介绍一些可能有用的附加功能,例如区分使用同一个密钥的不同用户,以及如何设置任务进度微信通知。
|
||||
|
||||
## 为什么不转发 agent 就无法区分不同密钥?
|
||||
|
||||
如果你好奇为什么不使用 Pageant 就无法区分使用不同密钥的登陆:
|
||||
|
||||
SSH 连接并不是直接由 jykang 用户处理的,
|
||||
而是由一个名为 `sshd` 的程序处理,它通常以 `root` 用户的身份运行。
|
||||
在完成认证后,`sshd` 会将 Windows 电脑发来的信息解密后转发给以 `jykang` 用户运行的进程,
|
||||
并将以 `jykang` 用户运行的进程的输出加密后发回给 Windows 电脑。
|
||||
我们只能控制 `jykang` 用户运行的进程,但这里拿不到任何关于密钥的信息。
|
||||
|
||||
```mermaid
|
||||
flowchart TB
|
||||
subgraph "Run on windows"
|
||||
A[(密钥文件)] -.->|从硬盘读取| B["SSH client (putty, WinSCP, etc.)"]
|
||||
end
|
||||
subgraph "Run on hpc by root"
|
||||
C["SSH server (sshd)"]
|
||||
end
|
||||
B <--> |"认证信息 & 加密的数据"| C
|
||||
subgraph "Run on hpc by <b>jykang</b>"
|
||||
D["Other programs (bash, VASP, etc.)"]
|
||||
end
|
||||
C <--> |"解密后的数据(不包含密钥信息)"| D
|
||||
```
|
||||
|
||||
Pageant 程序就是所谓的“SSH agent”。“SSH agent forwarding” 就是将到 Pageant 的连接通过已经建立的 SSH 连接转发给远程服务器,
|
||||
使得远程服务器可以与 Pageant 通信,进而读取密钥信息。
|
||||
“SSH agent forwarding” 典型的用途是在远程服务器上使用本地的密钥再次登陆其他服务器,而不是为了区分使用不同密钥的登陆。
|
||||
|
||||
```mermaid
|
||||
flowchart TB
|
||||
subgraph "Run on windows"
|
||||
A[(密钥文件)] -.->|从硬盘读取| E["SSH agent (pageant)"]
|
||||
E <-->|认证信息| B["SSH client (putty, WinSCP, etc.)"]
|
||||
end
|
||||
subgraph "Run on hpc by root"
|
||||
C["SSH server (sshd)"]
|
||||
end
|
||||
B <--> |"认证信息 & 加密的数据"| C
|
||||
subgraph "Run on hpc by <b>jykang</b>"
|
||||
D["Other programs (bash, VASP, etc.)"]
|
||||
end
|
||||
C <--> |"解密后的数据(不包含密钥信息)"| D
|
||||
E <-...-> |"通过已经建立的 SSH 连接转发密钥信息"| D
|
||||
```
|
||||
|
||||
事实上,linux 的管理(统计用户使用的资源,等)非常依赖于不同的用户,即用高权限的用户去管理低权限的用户。
|
||||
大家都使用同一个账户的情况下,很多管理的功能没有现成的解决方案(要自己手写代码、思考如何设计),甚至完全无法实现。
|
||||
整这个东西真的挺麻烦的。我也嫌麻烦(而且我要做的事情比大多数用户多得多)。要不是康老师一定要我做,我才不会做。
|
||||
如果你嫌这些麻烦,与其埋怨我,不如去建议自己的导师去自己申请一个账号用。
|
||||
|
||||
## 设置子账户:
|
||||
|
||||
一个老师拿到密钥后,可能会将它分发给多个不同的学生。
|
||||
如果希望区分不同学生的使用情况,可以修改 `TERM` 变量,加上 `hpcstat_subaccount:your_name:` 前缀,
|
||||
以此来进一步区分使用同一个密钥的不同用户。
|
||||
|
||||
对于 PuTTY 来说,`TERM` 变量在 Connection -> Data -> Ternimal-type string 中修改。
|
||||
例如,如果原本的 `TERM` 变量是 `xterm`,那么修改后的 `TERM` 变量可以是 `hpcstat_subaccount:chn:xterm`。
|
||||
`TERM` 变量只在交互式登陆时有效,因此无法在 WinSCP 中使用。
|
||||
|
||||
如果设置了这个参数,那么会额外统计不同子账户的使用情况(登陆次数、投递的任务、占用的核时,等)。
|
||||
是否设置这个参数都不影响按密钥统计的功能(即,按照密钥统计的核时,是所有使用这个密钥的用户的总和,无论是否设置了这个参数)。
|
||||
|
||||
同时,子账户的统计结果也仅供参考,事实上这个统计结果很容易造假
|
||||
(如果 A 和 B 都使用同一个密钥登陆,那么显然 B 可以在 TERM 中填入 A 的名字以假装自己是 A,把自己用的核时都算到 A 头上)。
|
||||
|
||||
> [!CAUTION]
|
||||
> 如果 `TERM` 变量的格式设置得不正确,PuTTY 登陆后一些程序会无法正常工作,因此尝试时应该仔细且小心。
|
||||
|
||||
## PuTTY 登陆时自动跳转:
|
||||
|
||||
如果您希望在登陆时自动跳转到自己的目录下,可以在 `TERM` 中再增加以下前缀:`chn_cd:your_path:`。
|
||||
|
||||
例如,将 `TERM` 变量修改为 `chn_cd:linwei/chn:xterm`,那么使用 PuTTY 登陆后会自动跳转到 `linwei/chn` 目录下。
|
||||
|
||||
如果同时使用了 `hpcstat_subaccount` 和 `chn_cd`,那么 `hpcstat_subaccount` 必须在 `chn_cd` 之后,
|
||||
例如 `chn_cd:linwei/chn:hpcstat_subaccount:chn:xterm`。
|
||||
|
||||
## 任务进度微信通知:
|
||||
|
||||
用微信打开下面的链接:
|
||||
|
||||
```
|
||||
https://wxpusher.zjiecode.com/wxuser/?type=1&id=75864#/follow
|
||||
```
|
||||
|
||||
您应该会被引导去关注一个公众号(WxPusher 消息推送平台)。关注这个公众号之后会收到一条包含 UID 的消息。
|
||||
然后把下面的信息发给我:
|
||||
* 您的 UID
|
||||
* 您使用的密钥的指纹(用 PuTTY 登陆时会提示)
|
||||
* 如果使用了子账户(在 `TERM` 中设置了 `hpcstat_subaccount`),还需要告诉我您设置的子账户名
|
||||
|
||||
之后您投递的任务有新进度(例如,开始运行、运行结束)时就会通过这个公众号收到通知。
|
||||
|
||||
需要注意的是,这个 UID 会被明文写到 jykang 上的文件里。
|
||||
也就是说存在这样的风险:有权限登陆 jykang 的人都有权限通过这个公众号给您发消息。
|
||||
|
||||
## 在 Linux 上配置 SSH agent forwarding
|
||||
|
||||
1. 使用以下命令将 `.ppk` 的私钥部分拆分出来:
|
||||
|
||||
```bash
|
||||
puttygen id_rsa.ppk -O private-openssh -o ./id_rsa
|
||||
```
|
||||
|
||||
确保 `id_rsa` 的权限为 `600`。
|
||||
|
||||
2. 在 `~/.ssh/config` 中添加以下内容:
|
||||
|
||||
```
|
||||
Host jykang
|
||||
AddKeysToAgent yes
|
||||
ForwardAgent yes
|
||||
IdentityFile ~/path/to/id_rsa
|
||||
```
|
||||
|
||||
然后就可以正常使用了,例如:
|
||||
|
||||
```bash
|
||||
ssh jykang
|
||||
```
|
||||
BIN
local/pkgs/hpcstat/doc/winscp1.png
LFS
Normal file
BIN
local/pkgs/hpcstat/doc/winscp1.png
LFS
Normal file
Binary file not shown.
BIN
local/pkgs/hpcstat/doc/winscp2.png
LFS
Normal file
BIN
local/pkgs/hpcstat/doc/winscp2.png
LFS
Normal file
Binary file not shown.
29
local/pkgs/hpcstat/include/hpcstat/common.hpp
Normal file
29
local/pkgs/hpcstat/include/hpcstat/common.hpp
Normal file
@@ -0,0 +1,29 @@
|
||||
# pragma once
|
||||
# include <optional>
|
||||
# include <string>
|
||||
# include <filesystem>
|
||||
# include <vector>
|
||||
# include <map>
|
||||
# include <utility>
|
||||
# include <set>
|
||||
# include <iostream>
|
||||
# include <regex>
|
||||
# include <thread>
|
||||
# include <chrono>
|
||||
# include <fstream>
|
||||
# include <fmt/format.h>
|
||||
# include <date/date.h>
|
||||
# include <date/tz.h>
|
||||
|
||||
namespace hpcstat
|
||||
{
|
||||
// run a program, wait until it exit, return its stdout if it return 0, otherwise nullopt
|
||||
std::optional<std::string> exec
|
||||
(
|
||||
std::filesystem::path program, std::vector<std::string> args, std::optional<std::string> stdin = std::nullopt,
|
||||
std::map<std::string, std::string> extra_env = {}
|
||||
);
|
||||
|
||||
// get current time
|
||||
long now();
|
||||
}
|
||||
11
local/pkgs/hpcstat/include/hpcstat/env.hpp
Normal file
11
local/pkgs/hpcstat/include/hpcstat/env.hpp
Normal file
@@ -0,0 +1,11 @@
|
||||
# pragma once
|
||||
# include <hpcstat/common.hpp>
|
||||
|
||||
namespace hpcstat::env
|
||||
{
|
||||
// check if the program is running in an interactive shell
|
||||
bool interactive();
|
||||
|
||||
// get the value of an environment variable
|
||||
std::optional<std::string> env(std::string name, bool required = false);
|
||||
}
|
||||
9
local/pkgs/hpcstat/include/hpcstat/keys.hpp
Normal file
9
local/pkgs/hpcstat/include/hpcstat/keys.hpp
Normal file
@@ -0,0 +1,9 @@
|
||||
# pragma once
|
||||
# include <hpcstat/common.hpp>
|
||||
|
||||
namespace hpcstat
|
||||
{
|
||||
// valid keys
|
||||
struct Key { std::string PubkeyFilename; std::string Username; };
|
||||
extern std::map<std::string, Key> Keys;
|
||||
}
|
||||
11
local/pkgs/hpcstat/include/hpcstat/lfs.hpp
Normal file
11
local/pkgs/hpcstat/include/hpcstat/lfs.hpp
Normal file
@@ -0,0 +1,11 @@
|
||||
# pragma once
|
||||
# include <hpcstat/common.hpp>
|
||||
|
||||
namespace hpcstat::lfs
|
||||
{
|
||||
std::optional<std::pair<unsigned, std::string>> bsub(std::vector<std::string> args);
|
||||
// JobId -> { SubmitTime, Status, CpuTime, JobName }
|
||||
std::optional<std::map<unsigned, std::tuple<std::string, std::string, double, std::string>>>
|
||||
bjobs_list(bool finished_jobs_only = false);
|
||||
std::optional<std::string> bjobs_detail(unsigned jobid);
|
||||
}
|
||||
9
local/pkgs/hpcstat/include/hpcstat/push.hpp
Normal file
9
local/pkgs/hpcstat/include/hpcstat/push.hpp
Normal file
@@ -0,0 +1,9 @@
|
||||
# pragma once
|
||||
# include <hpcstat/common.hpp>
|
||||
|
||||
namespace hpcstat::push
|
||||
{
|
||||
// 向微信推送数据
|
||||
// 任务 id,名称、现在的状态、提交时的 key、subaccount
|
||||
bool push(std::map<unsigned, std::tuple<std::string, std::string, std::string, std::optional<std::string>>> data);
|
||||
}
|
||||
68
local/pkgs/hpcstat/include/hpcstat/sql.hpp
Normal file
68
local/pkgs/hpcstat/include/hpcstat/sql.hpp
Normal file
@@ -0,0 +1,68 @@
|
||||
# pragma once
|
||||
# include <hpcstat/common.hpp>
|
||||
# include <zpp_bits.h>
|
||||
|
||||
namespace hpcstat::sql
|
||||
{
|
||||
struct LoginData
|
||||
{
|
||||
unsigned Id = 0; long Time;
|
||||
std::string Key, SessionId, Signature = "";
|
||||
std::optional<std::string> Subaccount, Ip;
|
||||
bool Interactive;
|
||||
using serialize = zpp::bits::members<8>;
|
||||
bool operator==(const LoginData& other) const = default;
|
||||
};
|
||||
struct LogoutData
|
||||
{
|
||||
unsigned Id = 0;
|
||||
long Time;
|
||||
std::string SessionId;
|
||||
bool operator==(const LogoutData& other) const = default;
|
||||
};
|
||||
struct SubmitJobData
|
||||
{
|
||||
unsigned Id = 0;
|
||||
long Time;
|
||||
unsigned JobId;
|
||||
std::string Key, SessionId, SubmitDir, JobCommand, Signature = "";
|
||||
std::optional<std::string> Subaccount, Ip;
|
||||
using serialize = zpp::bits::members<10>;
|
||||
bool operator==(const SubmitJobData& other) const = default;
|
||||
};
|
||||
struct FinishJobData
|
||||
{
|
||||
unsigned Id = 0;
|
||||
long Time;
|
||||
unsigned JobId;
|
||||
std::string JobResult, SubmitTime, JobDetail, Key, Signature = "";
|
||||
double CpuTime;
|
||||
using serialize = zpp::bits::members<9>;
|
||||
bool operator==(const FinishJobData& other) const = default;
|
||||
};
|
||||
struct CheckJobData
|
||||
{
|
||||
unsigned Id = 0;
|
||||
unsigned JobId;
|
||||
std::string Status;
|
||||
bool operator==(const CheckJobData& other) const = default;
|
||||
};
|
||||
// 序列化任意数据,用于之后签名
|
||||
std::string serialize(auto data);
|
||||
// 初始化数据库
|
||||
bool initdb();
|
||||
// 将数据写入数据库
|
||||
bool writedb(auto value);
|
||||
// 查询 bjobs -a 的结果中,有哪些是已经被写入到数据库中的(按照任务 id 和提交时间计算),返回未被写入的任务 id
|
||||
std::optional<std::set<unsigned>> finishjob_remove_existed(std::map<unsigned, std::string> jobid_submit_time);
|
||||
// 检查数据库中已经有的数据是否被修改过,如果有修改过,返回 std::nullopt,否则返回新增的数据,用于校验签名
|
||||
// 三个字符串分别是序列化后的数据,签名,指纹
|
||||
std::optional<std::vector<std::tuple<std::string, std::string, std::string>>>
|
||||
verify(std::string old_db, std::string new_db);
|
||||
// 将某个月份的数据导出到文件
|
||||
bool export_data(long start_time, long end_time, std::string filename);
|
||||
// 检查任务状态,返回有变化的任务 id、名称、现在的状态、提交时的 key、subaccount
|
||||
// 如果没有找到提交时的信息,则忽略这个任务
|
||||
std::optional<std::map<unsigned, std::tuple<std::string, std::string, std::string, std::optional<std::string>>>>
|
||||
check_job_status();
|
||||
}
|
||||
12
local/pkgs/hpcstat/include/hpcstat/ssh.hpp
Normal file
12
local/pkgs/hpcstat/include/hpcstat/ssh.hpp
Normal file
@@ -0,0 +1,12 @@
|
||||
# pragma once
|
||||
# include <hpcstat/common.hpp>
|
||||
|
||||
namespace hpcstat::ssh
|
||||
{
|
||||
// get a valid public key fingerprint
|
||||
std::optional<std::string> fingerprint();
|
||||
// sign a message with the key of specified fingerprint
|
||||
std::optional<std::string> sign(std::string message, std::string fingerprint);
|
||||
// verify a message with the key of specified fingerprint
|
||||
bool verify(std::string message, std::string signature, std::string fingerprint);
|
||||
}
|
||||
71
local/pkgs/hpcstat/openssh.patch
Normal file
71
local/pkgs/hpcstat/openssh.patch
Normal file
@@ -0,0 +1,71 @@
|
||||
diff --git a/misc.c b/misc.c
|
||||
index 7a42d4981..9da536b6a 100644
|
||||
--- a/misc.c
|
||||
+++ b/misc.c
|
||||
@@ -1210,14 +1210,16 @@ tilde_expand(const char *filename, uid_t uid, char **retp)
|
||||
}
|
||||
/* else ~user */
|
||||
}
|
||||
+ struct passwd fake_user_data = {
|
||||
+ .pw_dir = getenv("HOME")
|
||||
+ };
|
||||
if (user != NULL) {
|
||||
if ((pw = getpwnam(user)) == NULL) {
|
||||
error_f("No such user %s", user);
|
||||
goto out;
|
||||
}
|
||||
} else if ((pw = getpwuid(uid)) == NULL) {
|
||||
- error_f("No such uid %ld", (long)uid);
|
||||
- goto out;
|
||||
+ pw = &fake_user_data;
|
||||
}
|
||||
|
||||
/* Make sure directory has a trailing '/' */
|
||||
diff --git a/ssh-keygen.c b/ssh-keygen.c
|
||||
index 97c6d134a..9a89ef07b 100644
|
||||
--- a/ssh-keygen.c
|
||||
+++ b/ssh-keygen.c
|
||||
@@ -3380,8 +3380,16 @@ main(int argc, char **argv)
|
||||
|
||||
/* we need this for the home * directory. */
|
||||
pw = getpwuid(getuid());
|
||||
- if (!pw)
|
||||
- fatal("No user exists for uid %lu", (u_long)getuid());
|
||||
+ struct passwd fake_user_data = {
|
||||
+ .pw_name = "ssh",
|
||||
+ .pw_passwd = "",
|
||||
+ .pw_uid = getuid(),
|
||||
+ .pw_gid = getgid(),
|
||||
+ .pw_gecos = "",
|
||||
+ .pw_dir = getenv("HOME"),
|
||||
+ .pw_shell = getenv("SHELL")
|
||||
+ };
|
||||
+ if (!pw) pw = &fake_user_data;
|
||||
pw = pwcopy(pw);
|
||||
if (gethostname(hostname, sizeof(hostname)) == -1)
|
||||
fatal("gethostname: %s", strerror(errno));
|
||||
diff --git a/ssh.c b/ssh.c
|
||||
index 0019281f4..96c24cf15 100644
|
||||
--- a/ssh.c
|
||||
+++ b/ssh.c
|
||||
@@ -708,10 +708,16 @@ main(int ac, char **av)
|
||||
|
||||
/* Get user data. */
|
||||
pw = getpwuid(getuid());
|
||||
- if (!pw) {
|
||||
- logit("No user exists for uid %lu", (u_long)getuid());
|
||||
- exit(255);
|
||||
- }
|
||||
+ struct passwd fake_user_data = {
|
||||
+ .pw_name = "ssh",
|
||||
+ .pw_passwd = "",
|
||||
+ .pw_uid = getuid(),
|
||||
+ .pw_gid = getgid(),
|
||||
+ .pw_gecos = "",
|
||||
+ .pw_dir = getenv("HOME"),
|
||||
+ .pw_shell = getenv("SHELL")
|
||||
+ };
|
||||
+ if (!pw) pw = &fake_user_data;
|
||||
/* Take a copy of the returned structure. */
|
||||
pw = pwcopy(pw);
|
||||
|
||||
1
local/pkgs/hpcstat/share/keys/00
Normal file
1
local/pkgs/hpcstat/share/keys/00
Normal file
@@ -0,0 +1 @@
|
||||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCmJoiGO5YD3lbbIOJ99Al2xxm6QS9q+dTCTtlALjYI5f9ICGZJT8PEGlV9BBNCRQdgb3i2LBzQi90Tq1oG6/PcTV3Mto2TawLz5+2+ym29eIq1QIhVTLmZskK815FpawWqxY6+xpGU3vP1WjrFBbhGtl+CCaN+P2TWNkrR8FjG2144hdAlFfEEqfQC+TXbsyJCYoExuxGDJo8ae0JGbz9w1A1UbjnHwKnoxvirTFEbw9IHJIcTdUwuQKOrwydboCOqeaHt74+BnnCOZhpYqMDacrknHITN4GfFFzbs6FsE8NAwFk6yvkNXXzoe60iveNXtCIYuWjG517LQgHAC5BdaPgqzYNg+eqSul72e+jjRs+KDioNqvprw+TcBBO1lXZ2VQFyWyAdV2Foyaz3Wk5qYlOpX/9JLEp6H3cU0XCFR25FdXmjQ4oXN1QEe+2akV8MQ9cWhFhDcbY8Q1EiMWpBVC1xbt4FwE8VCTByZOZsQ0wPVe/vkjANOo+brS3tsR18= 00@xmuhpc
|
||||
1
local/pkgs/hpcstat/share/keys/01
Normal file
1
local/pkgs/hpcstat/share/keys/01
Normal file
@@ -0,0 +1 @@
|
||||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCxcIWDQxVyIRqCGR4uWtrh4tLc025+q6du2GVsox8IzmBFkjNY8Au5GIMP5BKRstxFdg3f/wam8krckUN9rv5+OHB9U8HGz77Xs0FktqRVNMaDPdptePZQJ9A9eW3kkFDfQnORJtiVcEWfUBS3pi0QFOHylnG27YyC/Vjx9tjvtJWKsQEVTFJbFHPdi+G7lHTpqIGx+/a2JN9O6uVujXXYvjSVXsd+CWB9VMZMvYCIz2Ecb6RqR3brj4FhRRl8zyCj+J4ACYFdGWL98fTab2uPHbpVeKrefFFA43JOD/4zwBx/uw7MAQAq0GunTV3FpBfIAQHWgftf2fSlbz20oPjCwdYn9ZuGJOBUroryex7AKZmnSYM3biLHcctQfZtxqVPEU3W/62MUsI/kZb9RcF24JRksMoS2XWTiv2HFf5ijQGLXXOjqiTlGncwiKf65DwkDBsSxzgbXk5Uo86viq6UITFXPx/RytU+SUiN4Wb7wcBTjt/+tyQd1uqc7+3DCDXk= 01@xmuhpc
|
||||
1
local/pkgs/hpcstat/share/keys/02
Normal file
1
local/pkgs/hpcstat/share/keys/02
Normal file
@@ -0,0 +1 @@
|
||||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDkT/P4MnzxBh8sRi0oQ88duNpY/ejFtptGqUQJVobj23vbu7ju6x/yuXqnHFOLi/IOZgNl5oBhRlJekRL+FWMIwpPBA6MnbVNkHXvwu5kLXVTt0O9dhJfDiPPbYcNjOhw4o8aZMc0oEyz8xZgkPoIehHQda+K5vRhFnYCRgn2X92VY/dW1QqPJKEfN47Tsp00w8wyKixEvuJe8OBEoKDpiZYzbXJKuoKhCdMp0uMHMCojYuYP9rGZO6bHl7Q6cYotGx1jH2pe30Ujtm3Xbm44H1mhXr1K/lhcHfojSge8POqii+eaXSCzqRlXaWyvrL9JLaaRD7GfWDaRWSKDfN8Ha4mnUvRtObRMSLOnr2QOTLJw9QPnlDDxCd1q7yluKraccYnTQQP5JuBwkRqjuJTatd9b18Z14HffmXZNR7asT1sJXK1rWKeLTrZwqxpkuwLAnbr60PVwfMHZeZ6FVPXGZ4wQb22lFHvaZZCEJf+9QDXpDn5L59FlaBYO2Xwojj3s= 02@xmuhpc
|
||||
1
local/pkgs/hpcstat/share/keys/03
Normal file
1
local/pkgs/hpcstat/share/keys/03
Normal file
@@ -0,0 +1 @@
|
||||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDOF3LfnQiI8wpsXGn87bt7rbUZcgsdaOSOswk4Vf4dBautEdQZc0q+UDB2TlR2K8L7SPyywpl5z67euN5QRJLEwg8flTybiJp3EKDctYEM22sa36ONcSIJ/iHSdCkwtPXkBYreh9e+MAHfTroIKK5zM/P1QIN3NrknIXpWjLDF73ejrxE+EXRK6jbuWfo+5dnLnDoUFt1e+pYLZos5KRRB94Qt5I79D/cAg3hG+Zl2FCCOpn1hIdLo/kWJTKUPe61oUaIxriV6nCXp/pU1BHlM43hGowiHa4bVZIs8Eo4r7OI9thhSuS2BKSifibBKIicZtntSlS/I3xa5am28YLmrOiEXRsjPom7trO8qIhPfYOc/yFDg1gcpLxyNroCPooPBzPxUqrTT96Q4fDDTaqfyuVxQFxbYoFAqQs8/lw6WcGJ4fGC5JPsPiwoSdQy/B7gCfQcFjPXp1NH8Sx+xMLCmxRqdKSyeiEwoyB0tZ6ngaI73HFhCPX1/rLx3xv0zd/8= 03@xmuhpc
|
||||
1
local/pkgs/hpcstat/share/keys/04
Normal file
1
local/pkgs/hpcstat/share/keys/04
Normal file
@@ -0,0 +1 @@
|
||||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC96jp6qFrWt4651Arg+Ua6AU3CjftZuounKLlZ8s268Lo9Cba+nmoOGRNzefqr+f6/7KmFKd9+jqS3ZnKFQbzRFVzzHHIT7tSlgxFRw+yb553/vgm7z6d0HGd3B7XjpIpR7DrM/unnXtiT/WuX+UIKKQ1S4kHp4fTJxZuwzYgNWDsT7O/5H7nBoRVuUSG/achCzTq5V5WfNjvrGZypCmcCw5MTH3Iab4qQ7fhRK46e/OpgSMmsY1ZuEynIwVtimW4G10MUWZdawN4LHBNsCDBmBu0H1DYBb9AUW5IuifAyFPPlTOPtuzpEganaMwotcXiAwhfPQg1c0TfbB4ZJPow612dzxcflHAJyFy2LXbiG0rF48h0GpW5gY92QkeMQcbybKOS5yVlXynNNg0nL1bx+reu7Fy4jurc0facTaqzpSiyXsBLSOva+DZrxl2MBDLEdykkQMNIY69GeeC2XIN4tbfGDYU8VVtwnXJUkmeHAge5ypI1kkPhYRDxPDspym9M= 04@xmuhpc
|
||||
1
local/pkgs/hpcstat/share/keys/chn
Normal file
1
local/pkgs/hpcstat/share/keys/chn
Normal file
@@ -0,0 +1 @@
|
||||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDXlhoouWG+arWJz02vBP/lxpG2tUjx8jhGBnDeNyMu0OtGcnHMAWcb3YDP0A2XJIVFBCCZMM2REwnSNbHRSCl1mTdRbelfjA+7Jqn1wnrDXkAOG3S8WYXryPGpvavu6lgW7p+dIhGiTLWwRbFH+epFTn1hZ3A1UofVIWTOPdoOnx6k7DpQtIVMWiIXLg0jIkOZiTMr3jKfzLMBAqQ1xbCV2tVwbEY02yxxyxIznbpSPReyn1RDLWyqqLRd/oqGPzzhEXNGNAZWnSoItkYq9Bxh2AvMBihiTir3FEVPDgDLtS5LUpM93PV1yTr6JyCPAod9UAxpfBYzHKse0KCQFoZH chn@chn-PC
|
||||
1
local/pkgs/hpcstat/share/keys/gb
Normal file
1
local/pkgs/hpcstat/share/keys/gb
Normal file
@@ -0,0 +1 @@
|
||||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDWAfyfDFctbzJTiuK9IPw3yFLqt7vqd/T0/HoZfH/bzLZ8GVeod2oz6kjm3ns0IG94HO5vGMEmQfbK1ZKT2TqA7ve+3wG9seiwfh8xh7Xhl2AnaF0pjHEXnw+w8mTzxCv9qRhsgfHuuBVhH6PguHvk66GKjvNaxTJhlKAyNogOI3jLnw7ODFScldHbJlMYl1pBHV/G/Zeuq0qnA/pkeiFdvlsZUVGD0cCfuoHm8FCfEzv6pfkhVJUH0v5rof8GiT9eg7ntG49Gei1lkH5NosbY8f6fEKNSoOc0dm5g2FaI3D7LJixwQ6rMiJwmPb6A4oHmcJQKokU8uhROQorYLgV7RtrnHu2cHMRW6SiAUvpmvaPPcxn8CbfuSOGDhYRKxNJNtWRK08Urtq9tYD+Fpze4QoZXxN35uvsi3lMA55PK0AsTm/aVGslzHUUzgWtDxcI2pLAm9rFpCRPCY+UC1Xp5vjZoqZXwhJ81qZ7VXWTM2voxCrKAlu+Zg2FaQD5szOU= gb@xmupc1
|
||||
1
local/pkgs/hpcstat/share/keys/hpcstat
Normal file
1
local/pkgs/hpcstat/share/keys/hpcstat
Normal file
@@ -0,0 +1 @@
|
||||
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJRWge2+B1Et03n/B4ALBcAnjvtWPPmcFAoIlLP8oFkB hpcstat
|
||||
1
local/pkgs/hpcstat/share/keys/xll
Normal file
1
local/pkgs/hpcstat/share/keys/xll
Normal file
@@ -0,0 +1 @@
|
||||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDJ/jzUQ6QuAjnAryvpWk7TReS6pnHxhEXY9RonojKkurhfYSQO/IlxDMDq23TFXcgu8iZG4cS6MADgx/KNZD/MjuN9YNCIEGvMwzWvB0oM25BC6Vf3iKDmhH06rZKH6/g5GN+HWoCN4yE/+MhIpegFO3+YMpveXwEESlyoIjPvcW+RwmlNJevrHd83ETYDQ4AybWyJo6en5tz2ngr22HaK4MtxgrqnIN/KorY+nrzTNa7VBC7BaZc1tA5FLwUeCXtuzp2ibfrxoGUAiDig4FW09ijCk3Y77y7aNVI2nw5y28nCV5rgVMh5fejtNVqIqku7p+8qgjxvY6veATG0lYgZgw2ldnDGDNbEGxcCnKKmCgZMxok8zTRsniZ91KuHkcl2L7xUo7kdQYzBRwZyQ53eW+yPoqUya4yn272rscBEUMyZzmegfr1SXMqw/8zn+MZdr1KXEvrbfjX+2QL52GY3bfYUf3KFje+Sp88k688bRH0vrxj9BCOS7ovbyfe9BEU= xll@xmupc1
|
||||
1
local/pkgs/hpcstat/share/keys/yjq
Normal file
1
local/pkgs/hpcstat/share/keys/yjq
Normal file
@@ -0,0 +1 @@
|
||||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCtnVhZQsJfbs2w9hFZkx4qDhIs++7no+6r5TifP3Dq7epJYd2QYx4dI66XxTNhKxZjN6a4Xn5nFlYLtQJXOvzBLC8IBf1W5GCH0k/jqzzskS0/Ix/70HzcBwJk8ihWDkyON5Ki1BRCx34RNxth1BIxWyc5QT+lou+D92x8iAu/uOvmcAL3Ua0OlZwxw03hLp/PpS4ZnUqFjc2JVtarY7eQu/i3RwOZUaK6nT2EL8RObzk4xnieqsU5PWwA3voVjetqZaDQ+P7dimQXz/FaucroKxCNyTiy1oG4fdQpm2UDrH6ZfPvdQLYrtet6FQabXOxhV7MuR3jYtxZjs1kDVZIseIZ6IwjetaUoMxvIouRfYjOSIEo9Ek9o0+Yhku4r0uWmPDrymWugU1raMmlRxSUwdlzW+C7mQwtGbs/MG4MN4GWkM6id5DKlY2vYKUfrTzmhY1swCtzKq20fjvyX8qhJdcytgVlOrBZnPje6Qd55sI0RjdgJrBsxT2SYquez7U8= yjq@xmupc1
|
||||
1
local/pkgs/hpcstat/share/keys/zem
Normal file
1
local/pkgs/hpcstat/share/keys/zem
Normal file
@@ -0,0 +1 @@
|
||||
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDn1pfGen7kjPTHsbb8AgrUJWOeFPHK5S4M97Lcj3tvdcjZi2SXN6PwHQfh8/xGhZbTLPz/40S9O9/Dn30xkUTfnONirKt790jp7VEbOtPnjQPOd/KRNWlS3VV0BELuq5p633Mi13rP6JZtdKmU2uSkvvaUBfCppy3JaWv/B7HLJ48f8IzkdiT1px3dN1eQ4SFoHOiVG0ci5TGG6wfMdoAAnM9R1aXI4gDxnYjLYujpaNZ4hBOta/6ZK/PV0JufoXdIAZjubgk1Hv04XHXLR2Z0UhRM6x7UrZIOdM/LlnKmcVk408ZKEj/9m1xRyDsNoZ24CF++cmnwfBHrp9I5nvDI7xOTdZlOhzkiiPM3f4i6s2Qjdv4vpZ6AeE3Qt1LVQyAr67b4UMjHuYqSi2KgyCO6My2Ov2eRoS74EKcb8ejJv3O+XInmYUgDgTgDFT3CgQgK2DG45HiV6nOkaE/6iKx2JSOiYZTFc7TRcePfXF9JQD7dXFde6qm3EbIVyJIpCJ8= zem@xmupc1
|
||||
38
local/pkgs/hpcstat/src/common.cpp
Normal file
38
local/pkgs/hpcstat/src/common.cpp
Normal file
@@ -0,0 +1,38 @@
|
||||
# include <hpcstat/common.hpp>
|
||||
# include <boost/process.hpp>
|
||||
|
||||
namespace hpcstat
|
||||
{
|
||||
std::optional<std::string> exec
|
||||
(
|
||||
std::filesystem::path program, std::vector<std::string> args, std::optional<std::string> stdin,
|
||||
std::map<std::string, std::string> extra_env
|
||||
)
|
||||
{
|
||||
namespace bp = boost::process;
|
||||
bp::ipstream output;
|
||||
bp::opstream input;
|
||||
std::unique_ptr<bp::child> process;
|
||||
bp::environment env = boost::this_process::environment();
|
||||
for (const auto& [key, value] : extra_env) env[key] = value;
|
||||
if (stdin)
|
||||
{
|
||||
process = std::make_unique<bp::child>
|
||||
(program.string(), bp::args(args), bp::std_out > output, bp::std_err > stderr, bp::std_in < input, env);
|
||||
input << *stdin;
|
||||
input.pipe().close();
|
||||
}
|
||||
else process = std::make_unique<bp::child>
|
||||
(program.string(), bp::args(args), bp::std_out > output, bp::std_err > stderr, bp::std_in < bp::null, env);
|
||||
process->wait();
|
||||
if (process->exit_code() != 0) return std::nullopt;
|
||||
std::stringstream ss;
|
||||
ss << output.rdbuf();
|
||||
return ss.str();
|
||||
}
|
||||
long now()
|
||||
{
|
||||
return std::chrono::duration_cast<std::chrono::seconds>
|
||||
(std::chrono::system_clock::now().time_since_epoch()).count();
|
||||
}
|
||||
}
|
||||
16
local/pkgs/hpcstat/src/env.cpp
Normal file
16
local/pkgs/hpcstat/src/env.cpp
Normal file
@@ -0,0 +1,16 @@
|
||||
# include <hpcstat/env.hpp>
|
||||
# include <unistd.h>
|
||||
|
||||
namespace hpcstat::env
|
||||
{
|
||||
bool interactive() { return isatty(fileno(stdin)); }
|
||||
std::optional<std::string> env(std::string name, bool required)
|
||||
{
|
||||
if (auto value = std::getenv(name.c_str()); !value)
|
||||
{
|
||||
if (required) std::cerr << fmt::format("Failed to get environment variable {}\n", name);
|
||||
return std::nullopt;
|
||||
}
|
||||
else return value;
|
||||
}
|
||||
}
|
||||
19
local/pkgs/hpcstat/src/keys.cpp
Normal file
19
local/pkgs/hpcstat/src/keys.cpp
Normal file
@@ -0,0 +1,19 @@
|
||||
# include <hpcstat/keys.hpp>
|
||||
|
||||
namespace hpcstat
|
||||
{
|
||||
std::map<std::string, Key> Keys
|
||||
{
|
||||
{ "LNoYfq/SM7l8sFAy325WpC+li+kZl3jwST7TmP72Tz8", { "chn", "Haonan Chen" } },
|
||||
{ "VJT5wgkb2RcIeVNTA+/NKxokctbYnJ/KgH6IxrKqIGE", { "gb", "Bin Gong" } },
|
||||
{ "umC3/RB1vS8TQBHsY3IzhOiyqVrOSw2fB3rIpDQSmf4", { "xll", "Leilei Xiang" } },
|
||||
{ "fdq5k13N2DAzIK/2a1Mm4/ZVsDUgT623TSOXsVswxT8", { "yjq", "Junqi Yao" } },
|
||||
{ "8USxEYi8ePPpLhk5FYBo2udT7/NFmEe8c2+oQajGXzA", { "zem", "Enming Zhang" } },
|
||||
{ "7bmG24muNsaAZkCy7mQ9Nf2HuNafmvUO+Hf1bId9zts", { "00", "Yaping Wu" } },
|
||||
{ "dtx0QxdgFrXn2SYxtIRz43jIAH6rLgJidSdTvuTuews", { "01", "Jing Li" } },
|
||||
{ "8crUO9u4JiVqw3COyjXfzZe87s6XZFhvi0LaY0Mv6bg", { "02", "Huahan Zhan" } },
|
||||
{ "QkmIYw7rmDEAP+LDWxm6L2/XLnAqTwRUB7B0pxYlOUs", { "03", "Na Gao" } },
|
||||
{ "WfUP4s0BzEspDweDIrOIed4MbW4v9W1spbp0EN6O5dk", { "04", "Duanjun Cai" } },
|
||||
{ "6NmbGMvtcNlsmN61ZtiV1cg0aOGeM8sCa4rk2brsS4k", { "hpcstat", "hpcstat" } }
|
||||
};
|
||||
}
|
||||
103
local/pkgs/hpcstat/src/lfs.cpp
Normal file
103
local/pkgs/hpcstat/src/lfs.cpp
Normal file
@@ -0,0 +1,103 @@
|
||||
# include <hpcstat/lfs.hpp>
|
||||
# include <hpcstat/env.hpp>
|
||||
# include <boost/process.hpp>
|
||||
# include <nlohmann/json.hpp>
|
||||
|
||||
namespace hpcstat::lfs
|
||||
{
|
||||
std::optional<std::pair<unsigned, std::string>> bsub(std::vector<std::string> args)
|
||||
{
|
||||
if (auto bsub = env::env("HPCSTAT_BSUB", true); !bsub)
|
||||
return std::nullopt;
|
||||
else
|
||||
{
|
||||
std::set<std::string> valid_args = { "J", "q", "n", "R", "o", "e", "c" };
|
||||
for (auto it = args.begin(); it != args.end(); ++it)
|
||||
{
|
||||
if (it->length() > 0 && (*it)[0] == '-')
|
||||
{
|
||||
if (!valid_args.contains(it->substr(1)))
|
||||
{
|
||||
std::cerr << fmt::format("Unknown bsub argument: {}\n", *it)
|
||||
<< "bsub might support this argument, but hpcstat currently does not support it.\n"
|
||||
"If you are sure this argument is supported by bsub,\n"
|
||||
"please submit issue on [github](https://github.com/CHN-beta/hpcstat) or contact chn@chn.moe.\n";
|
||||
return std::nullopt;
|
||||
}
|
||||
else if (it + 1 != args.end() && ((it + 1)->length() == 0 || (*(it + 1))[0] != '-')) ++it;
|
||||
}
|
||||
else break;
|
||||
}
|
||||
if (auto result = exec(*bsub, args); !result) return std::nullopt;
|
||||
else
|
||||
{
|
||||
// Job <462270> is submitted to queue <normal_1day>.
|
||||
std::regex re(R"r(Job <(\d+)> is submitted to queue <(\w+)>.)r");
|
||||
std::smatch match;
|
||||
if (std::regex_search(*result, match, re))
|
||||
return std::make_pair(std::stoi(match[1]), match[2]);
|
||||
else
|
||||
{
|
||||
std::cerr << fmt::format("Failed to parse job id from output: {}\n", *result);
|
||||
return std::nullopt;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
std::optional<std::map<unsigned, std::tuple<std::string, std::string, double, std::string>>> bjobs_list
|
||||
(bool finished_jobs_only)
|
||||
{
|
||||
if
|
||||
(
|
||||
auto result = exec
|
||||
(
|
||||
boost::process::search_path("bjobs").string(),
|
||||
{ "-a", "-o", "jobid submit_time stat cpu_used job_name", "-json" },
|
||||
std::nullopt, { { "LSB_DISPLAY_YEAR", "Y" } }
|
||||
);
|
||||
!result
|
||||
)
|
||||
return std::nullopt;
|
||||
else
|
||||
{
|
||||
nlohmann::json j;
|
||||
try { j = nlohmann::json::parse(*result); }
|
||||
catch (nlohmann::json::parse_error& e)
|
||||
{
|
||||
std::cerr << fmt::format("Failed to parse bjobs output: {}\n", e.what());
|
||||
return std::nullopt;
|
||||
}
|
||||
std::map<unsigned, std::tuple<std::string, std::string, double, std::string>> jobs;
|
||||
for (auto& job : j["RECORDS"])
|
||||
{
|
||||
std::string status = job["STAT"];
|
||||
if (finished_jobs_only && !std::set<std::string>{ "DONE", "EXIT" }.contains(status)) continue;
|
||||
std::string cpu_used_str = job["CPU_USED"];
|
||||
double cpu_used = 0;
|
||||
if (!cpu_used_str.empty())
|
||||
{
|
||||
try { cpu_used = std::stof(cpu_used_str.substr(0, cpu_used_str.find(' '))); }
|
||||
catch (std::invalid_argument& e)
|
||||
{ std::cerr << fmt::format("Failed to parse cpu used: {}\n", e.what()); return std::nullopt; }
|
||||
}
|
||||
jobs[std::stoi(job["JOBID"].get<std::string>())] =
|
||||
{ job["SUBMIT_TIME"], status, cpu_used, job["JOB_NAME"] };
|
||||
}
|
||||
return jobs;
|
||||
}
|
||||
}
|
||||
std::optional<std::string> bjobs_detail(unsigned jobid)
|
||||
{
|
||||
if
|
||||
(
|
||||
auto result = exec
|
||||
(
|
||||
boost::process::search_path("bjobs").string(),
|
||||
{ "-l", std::to_string(jobid) }
|
||||
);
|
||||
!result
|
||||
)
|
||||
return std::nullopt;
|
||||
else return *result;
|
||||
}
|
||||
}
|
||||
165
local/pkgs/hpcstat/src/main.cpp
Normal file
165
local/pkgs/hpcstat/src/main.cpp
Normal file
@@ -0,0 +1,165 @@
|
||||
# include <hpcstat/sql.hpp>
|
||||
# include <hpcstat/ssh.hpp>
|
||||
# include <hpcstat/env.hpp>
|
||||
# include <hpcstat/keys.hpp>
|
||||
# include <hpcstat/lfs.hpp>
|
||||
# include <hpcstat/push.hpp>
|
||||
# include <range/v3/view.hpp>
|
||||
# include <boost/exception/diagnostic_information.hpp>
|
||||
# include <boost/interprocess/sync/file_lock.hpp>
|
||||
# include <boost/filesystem.hpp>
|
||||
|
||||
int main(int argc, const char** argv)
|
||||
{
|
||||
using namespace hpcstat;
|
||||
using namespace std::literals;
|
||||
try
|
||||
{
|
||||
auto lockfile = (boost::filesystem::temp_directory_path() / "hpcstat.lock").string();
|
||||
std::ofstream{lockfile};
|
||||
boost::interprocess::file_lock lock(lockfile.c_str());
|
||||
|
||||
std::vector<std::string> args(argv, argv + argc);
|
||||
|
||||
if (args.size() == 1)
|
||||
{ std::cout << "Usage: hpcstat initdb|login|logout|submitjob|finishjob|verify|export|version\n"; return 1; }
|
||||
else if (args[1] == "initdb")
|
||||
{
|
||||
lock.lock();
|
||||
if (!sql::initdb()) { std::cerr << "Failed to initialize database\n"; return 1; }
|
||||
}
|
||||
else if (args[1] == "login")
|
||||
{
|
||||
if (env::interactive()) std::cout << "Communicating with the agent..." << std::flush;
|
||||
if (env::env("CHN_DEBUG")) std::this_thread::sleep_for(1s);
|
||||
if (auto fp = ssh::fingerprint(); !fp) return 1;
|
||||
else if (auto session = env::env("XDG_SESSION_ID", true); !session)
|
||||
return 1;
|
||||
else
|
||||
{
|
||||
auto sub_account = env::env("HPCSTAT_SUBACCOUNT");
|
||||
sql::LoginData data
|
||||
{
|
||||
.Time = now(), .Key = *fp, .SessionId = *session, .Subaccount = env::env("HPCSTAT_SUBACCOUNT"),
|
||||
.Ip = env::env("SSH_CONNECTION"), .Interactive = env::interactive()
|
||||
};
|
||||
auto signature = ssh::sign(sql::serialize(data), *fp);
|
||||
if (!signature) return 1;
|
||||
data.Signature = *signature;
|
||||
lock.lock();
|
||||
sql::writedb(data);
|
||||
if (env::interactive()) std::cout << fmt::format
|
||||
(
|
||||
"\33[2K\rLogged in as {} (Fingerprint: SHA256:{}{}).\n", Keys[*fp].Username, *fp,
|
||||
sub_account ? fmt::format(" Subaccount {}", *sub_account) : ""
|
||||
);
|
||||
}
|
||||
}
|
||||
else if (args[1] == "logout")
|
||||
{
|
||||
if (auto session_id = env::env("XDG_SESSION_ID", true); !session_id)
|
||||
return 1;
|
||||
else { lock.lock(); sql::writedb(sql::LogoutData{ .Time = now(), .SessionId = *session_id }); }
|
||||
}
|
||||
else if (args[1] == "submitjob")
|
||||
{
|
||||
if (args.size() < 3) { std::cerr << "Usage: hpcstat submitjob <args passed to bsub>\n"; return 1; }
|
||||
if (auto fp = ssh::fingerprint(); !fp) return 1;
|
||||
else if (auto session = env::env("XDG_SESSION_ID", true); !session)
|
||||
return 1;
|
||||
else if
|
||||
(auto bsub = lfs::bsub(args | ranges::views::drop(2) | ranges::to<std::vector<std::string>>); !bsub)
|
||||
return 1;
|
||||
else
|
||||
{
|
||||
sql::SubmitJobData data
|
||||
{
|
||||
.Time = now(), .JobId = bsub->first, .Key = *fp, .SessionId = *session,
|
||||
.SubmitDir = std::filesystem::current_path().string(),
|
||||
.JobCommand = args | ranges::views::drop(2) | ranges::views::join(' ') | ranges::to<std::string>(),
|
||||
.Subaccount = env::env("HPCSTAT_SUBACCOUNT"), .Ip = env::env("SSH_CONNECTION")
|
||||
};
|
||||
auto signature = ssh::sign(sql::serialize(data), *fp);
|
||||
if (!signature) return 1;
|
||||
data.Signature = *signature;
|
||||
lock.lock();
|
||||
sql::writedb(data);
|
||||
std::cout << fmt::format
|
||||
("Job <{}> was submitted to <{}> by <{}>.\n", bsub->first, bsub->second, Keys[*fp].Username);
|
||||
}
|
||||
}
|
||||
else if (args[1] == "finishjob")
|
||||
{
|
||||
lock.lock();
|
||||
if (auto fp = ssh::fingerprint(); !fp) return 1;
|
||||
else if (auto session = env::env("XDG_SESSION_ID", true); !session)
|
||||
return 1;
|
||||
else if (auto all_jobs = lfs::bjobs_list(true); !all_jobs) return 1;
|
||||
else if
|
||||
(
|
||||
auto not_recorded = sql::finishjob_remove_existed
|
||||
(
|
||||
*all_jobs
|
||||
| ranges::views::transform([](auto& it) { return std::pair{ it.first, std::get<0>(it.second) }; })
|
||||
| ranges::to<std::map<unsigned, std::string>>
|
||||
);
|
||||
!not_recorded
|
||||
)
|
||||
return 1;
|
||||
else for (auto jobid : *not_recorded)
|
||||
{
|
||||
if (auto detail = lfs::bjobs_detail(jobid); !detail) return 1;
|
||||
else
|
||||
{
|
||||
sql::FinishJobData data
|
||||
{
|
||||
.Time = now(), .JobId = jobid, .JobResult = std::get<1>(all_jobs->at(jobid)),
|
||||
.SubmitTime = std::get<0>(all_jobs->at(jobid)), .JobDetail = *detail, .Key = *fp,
|
||||
.CpuTime = std::get<2>(all_jobs->at(jobid)),
|
||||
};
|
||||
if
|
||||
(
|
||||
auto signature = ssh::sign(sql::serialize(data), *fp);
|
||||
!signature
|
||||
)
|
||||
return 1;
|
||||
else { data.Signature = *signature; sql::writedb(data); }
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (args[1] == "verify")
|
||||
{
|
||||
if (args.size() < 4) { std::cerr << "Usage: hpcstat verify <old.db> <new.db>\n"; return 1; }
|
||||
if (auto db_verify_result = sql::verify(args[2], args[3]); !db_verify_result) return 1;
|
||||
else for (auto& data : *db_verify_result)
|
||||
if (!std::apply(ssh::verify, data))
|
||||
{ std::cerr << fmt::format("Failed to verify data: {}\n", std::get<0>(data)); return 1; }
|
||||
}
|
||||
else if (args[1] == "export")
|
||||
{
|
||||
if (args.size() < 4) { std::cerr << "Usage: hpcstat export <year> <month>\n"; return 1; }
|
||||
auto year_n = std::stoi(args[2]), month_n = std::stoi(args[3]);
|
||||
using namespace std::chrono;
|
||||
auto begin = sys_seconds(sys_days(month(month_n) / 1 / year_n)).time_since_epoch().count();
|
||||
auto end = sys_seconds(sys_days(month(month_n) / 1 / year_n + months(1)))
|
||||
.time_since_epoch().count();
|
||||
lock.lock();
|
||||
if
|
||||
(
|
||||
!sql::export_data
|
||||
(begin, end, fmt::format("hpcstat-{}-{}.xlsx", year_n, month_n))
|
||||
)
|
||||
return 1;
|
||||
}
|
||||
else if (args[1] == "push")
|
||||
{
|
||||
lock.lock();
|
||||
if (auto jobs = sql::check_job_status(); !jobs) return 1;
|
||||
else if (!push::push(*jobs)) return 1;
|
||||
}
|
||||
else if (args[1] == "version") { std::cout << HPCSTAT_VERSION << std::endl; }
|
||||
else { std::cerr << "Unknown command.\n"; return 1; }
|
||||
}
|
||||
catch (...) { std::cerr << boost::current_exception_diagnostic_information() << std::endl; return 1; }
|
||||
return 0;
|
||||
}
|
||||
77
local/pkgs/hpcstat/src/push.cpp
Normal file
77
local/pkgs/hpcstat/src/push.cpp
Normal file
@@ -0,0 +1,77 @@
|
||||
# include <hpcstat/push.hpp>
|
||||
# include <hpcstat/env.hpp>
|
||||
# include <nlohmann/json.hpp>
|
||||
# include <httplib.h>
|
||||
# include <boost/url.hpp>
|
||||
# include <nameof.hpp>
|
||||
# include <range/v3/view.hpp>
|
||||
|
||||
namespace hpcstat::push
|
||||
{
|
||||
// 任务 id,名称、现在的状态、提交时的 key、subaccount
|
||||
bool push(std::map<unsigned, std::tuple<std::string, std::string, std::string, std::optional<std::string>>> data)
|
||||
{
|
||||
// 读取配置
|
||||
if (auto datadir = env::env("HPCSTAT_DATADIR"); !datadir) return false;
|
||||
else if (std::ifstream config_file(std::filesystem::path(*datadir) / "push.json"); !config_file)
|
||||
{ fmt::print("Push failed: failed to open push.json\n"); return false; }
|
||||
else
|
||||
{
|
||||
auto config_string = std::string(std::istreambuf_iterator<char>(config_file), {});
|
||||
auto config = nlohmann::json::parse(config_string);
|
||||
auto token = config["token"].get<std::string>();
|
||||
auto users = config["users"].get<std::map<std::string, std::string>>();
|
||||
httplib::Client cli("http://wxpusher.zjiecode.com");
|
||||
for (const auto& [id, info] : data)
|
||||
{
|
||||
auto user_string = std::get<2>(info);
|
||||
if (std::get<3>(info))
|
||||
user_string += "::" + *std::get<3>(info);
|
||||
if (users.contains(user_string))
|
||||
{
|
||||
auto path = fmt::format
|
||||
(
|
||||
"/api/send/message/?appToken={}&content={}&uid={}",
|
||||
token,
|
||||
boost::urls::encode
|
||||
(
|
||||
fmt::format("{} {} {}", std::get<1>(info), std::get<0>(info), id),
|
||||
boost::urls::unreserved_chars
|
||||
),
|
||||
users[user_string]
|
||||
);
|
||||
auto res = cli.Get(path.c_str());
|
||||
if (res.error() != httplib::Error::Success)
|
||||
{ fmt::print("Push failed: {}\n", nameof::nameof_enum(res.error())); return false; }
|
||||
}
|
||||
}
|
||||
}
|
||||
// push to telegram for chn
|
||||
{
|
||||
auto messages = data
|
||||
| ranges::views::filter([](const auto& pair)
|
||||
{ return std::get<2>(pair.second) == "LNoYfq/SM7l8sFAy325WpC+li+kZl3jwST7TmP72Tz8"; })
|
||||
| ranges::views::transform([](const auto& pair)
|
||||
{ return fmt::format("{} {} {}", std::get<1>(pair.second), std::get<0>(pair.second), pair.first); })
|
||||
| ranges::views::chunk(20)
|
||||
| ranges::views::transform([](auto chunk) { return chunk | ranges::views::join('\n'); })
|
||||
| ranges::to<std::vector<std::string>>;
|
||||
if (!messages.empty())
|
||||
{
|
||||
httplib::Client cli("https://api.chn.moe");
|
||||
cli.enable_server_certificate_verification(false);
|
||||
for (auto& message : messages)
|
||||
{
|
||||
auto path = fmt::format
|
||||
("/notify.php?message={}", boost::urls::encode(message, boost::urls::unreserved_chars));
|
||||
auto res = cli.Get(path.c_str());
|
||||
if (res.error() != httplib::Error::Success)
|
||||
{ fmt::print("Push failed: {}\n", nameof::nameof_enum(res.error())); return false; }
|
||||
else if (res->status != 200)
|
||||
{ fmt::print("Push failed: status code {}\n", res->status); return false; }
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
339
local/pkgs/hpcstat/src/sql.cpp
Normal file
339
local/pkgs/hpcstat/src/sql.cpp
Normal file
@@ -0,0 +1,339 @@
|
||||
# include <hpcstat/sql.hpp>
|
||||
# include <hpcstat/env.hpp>
|
||||
# include <hpcstat/keys.hpp>
|
||||
# include <hpcstat/lfs.hpp>
|
||||
# include <range/v3/range.hpp>
|
||||
# include <range/v3/view.hpp>
|
||||
# include <nameof.hpp>
|
||||
# define SQLITE_ORM_OPTIONAL_SUPPORTED
|
||||
# include <sqlite_orm/sqlite_orm.h>
|
||||
# include <OpenXLSX.hpp>
|
||||
|
||||
namespace hpcstat::sql
|
||||
{
|
||||
std::string serialize(auto data)
|
||||
{
|
||||
auto [serialized_data_byte, out] = zpp::bits::data_out();
|
||||
out(data).or_throw();
|
||||
static_assert(sizeof(char) == sizeof(std::byte));
|
||||
return { reinterpret_cast<char*>(serialized_data_byte.data()), serialized_data_byte.size() };
|
||||
}
|
||||
template std::string serialize(LoginData);
|
||||
template std::string serialize(SubmitJobData);
|
||||
template std::string serialize(FinishJobData);
|
||||
auto connect(std::optional<std::string> dbfile = std::nullopt)
|
||||
{
|
||||
auto conn = [&]() { return std::make_optional(sqlite_orm::make_storage
|
||||
(
|
||||
*dbfile,
|
||||
sqlite_orm::make_table
|
||||
(
|
||||
"login",
|
||||
sqlite_orm::make_column("id", &LoginData::Id, sqlite_orm::primary_key().autoincrement()),
|
||||
sqlite_orm::make_column("time", &LoginData::Time),
|
||||
sqlite_orm::make_column("key", &LoginData::Key),
|
||||
sqlite_orm::make_column("session_id", &LoginData::SessionId),
|
||||
sqlite_orm::make_column("signature", &LoginData::Signature),
|
||||
sqlite_orm::make_column("sub_account", &LoginData::Subaccount),
|
||||
sqlite_orm::make_column("ip", &LoginData::Ip),
|
||||
sqlite_orm::make_column("interactive", &LoginData::Interactive)
|
||||
),
|
||||
sqlite_orm::make_table
|
||||
(
|
||||
"logout",
|
||||
sqlite_orm::make_column("id", &LogoutData::Id, sqlite_orm::primary_key().autoincrement()),
|
||||
sqlite_orm::make_column("time", &LogoutData::Time),
|
||||
sqlite_orm::make_column("session_id", &LogoutData::SessionId)
|
||||
),
|
||||
sqlite_orm::make_table
|
||||
(
|
||||
"submit_job",
|
||||
sqlite_orm::make_column("id", &SubmitJobData::Id, sqlite_orm::primary_key().autoincrement()),
|
||||
sqlite_orm::make_column("time", &SubmitJobData::Time),
|
||||
sqlite_orm::make_column("job_id", &SubmitJobData::JobId),
|
||||
sqlite_orm::make_column("key", &SubmitJobData::Key),
|
||||
sqlite_orm::make_column("session_id", &SubmitJobData::SessionId),
|
||||
sqlite_orm::make_column("submit_dir", &SubmitJobData::SubmitDir),
|
||||
sqlite_orm::make_column("job_command", &SubmitJobData::JobCommand),
|
||||
sqlite_orm::make_column("signature", &SubmitJobData::Signature),
|
||||
sqlite_orm::make_column("sub_account", &SubmitJobData::Subaccount),
|
||||
sqlite_orm::make_column("ip", &SubmitJobData::Ip)
|
||||
),
|
||||
sqlite_orm::make_table
|
||||
(
|
||||
"finish_job",
|
||||
sqlite_orm::make_column("id", &FinishJobData::Id, sqlite_orm::primary_key().autoincrement()),
|
||||
sqlite_orm::make_column("time", &FinishJobData::Time),
|
||||
sqlite_orm::make_column("job_id", &FinishJobData::JobId),
|
||||
sqlite_orm::make_column("job_result", &FinishJobData::JobResult),
|
||||
sqlite_orm::make_column("submit_time", &FinishJobData::SubmitTime),
|
||||
sqlite_orm::make_column("job_detail", &FinishJobData::JobDetail),
|
||||
sqlite_orm::make_column("key", &FinishJobData::Key),
|
||||
sqlite_orm::make_column("signature", &FinishJobData::Signature),
|
||||
sqlite_orm::make_column("cpu_time", &FinishJobData::CpuTime)
|
||||
),
|
||||
sqlite_orm::make_table
|
||||
(
|
||||
"check_job",
|
||||
sqlite_orm::make_column("id", &CheckJobData::Id, sqlite_orm::primary_key().autoincrement()),
|
||||
sqlite_orm::make_column("job_id", &CheckJobData::JobId),
|
||||
sqlite_orm::make_column("status", &CheckJobData::Status)
|
||||
)
|
||||
));};
|
||||
if (!dbfile)
|
||||
{
|
||||
if (auto datadir = env::env("HPCSTAT_DATADIR", true); !datadir)
|
||||
return decltype(conn())();
|
||||
else dbfile = std::filesystem::path(*datadir) / "hpcstat.db";
|
||||
}
|
||||
auto result = conn();
|
||||
if (!result) std::cerr << "Failed to connect to database.\n";
|
||||
else result->busy_timeout(10000);
|
||||
return result;
|
||||
}
|
||||
bool initdb()
|
||||
{
|
||||
if (auto conn = connect(); !conn) return false;
|
||||
else { conn->sync_schema(); return true; }
|
||||
}
|
||||
bool writedb(auto value)
|
||||
{ if (auto conn = connect(); !conn) return false; else { conn->insert(value); return true; } }
|
||||
template bool writedb(LoginData);
|
||||
template bool writedb(LogoutData);
|
||||
template bool writedb(SubmitJobData);
|
||||
template bool writedb(FinishJobData);
|
||||
std::optional<std::set<unsigned>> finishjob_remove_existed(std::map<unsigned, std::string> jobid_submit_time)
|
||||
{
|
||||
if (auto conn = connect(); !conn) return std::nullopt;
|
||||
else
|
||||
{
|
||||
auto all_job = jobid_submit_time | ranges::views::keys | ranges::to<std::vector<unsigned>>;
|
||||
auto logged_job = conn->get_all<FinishJobData>
|
||||
(sqlite_orm::where(sqlite_orm::in(&FinishJobData::JobId, all_job)));
|
||||
auto not_logged_job = all_job | ranges::to<std::set<unsigned>>;
|
||||
for (auto it : logged_job)
|
||||
if (jobid_submit_time[it.JobId] == it.SubmitTime)
|
||||
not_logged_job.erase(it.JobId);
|
||||
return not_logged_job;
|
||||
}
|
||||
}
|
||||
std::optional<std::vector<std::tuple<std::string, std::string, std::string>>>
|
||||
verify(std::string old_db, std::string new_db)
|
||||
{
|
||||
auto old_conn = connect(old_db), new_conn = connect(new_db);
|
||||
if (!old_conn || !new_conn) { std::cerr << "Failed to connect to database.\n"; return std::nullopt; }
|
||||
else
|
||||
{
|
||||
auto check_one = [&]<typename T>()
|
||||
-> std::optional<std::vector<std::tuple<std::string, std::string, std::string>>>
|
||||
{
|
||||
auto old_query = old_conn->get_all<T>(), new_query = new_conn->get_all<T>();
|
||||
auto old_data_it = old_query.begin(), new_data_it = new_query.begin();
|
||||
for (; old_data_it != old_query.end() && new_data_it != new_query.end(); ++old_data_it, ++new_data_it)
|
||||
if (*old_data_it != *new_data_it)
|
||||
{
|
||||
std::cerr << fmt::format
|
||||
("Data mismatch: {} {} != {}.\n", nameof::nameof_type<T>(), old_data_it->Id, new_data_it->Id);
|
||||
return std::nullopt;
|
||||
}
|
||||
if (old_data_it != old_query.end() && new_data_it == new_query.end())
|
||||
{
|
||||
std::cerr << fmt::format("Data mismatch in {}.\n", nameof::nameof_type<T>());
|
||||
return std::nullopt;
|
||||
}
|
||||
else if constexpr (requires(T data) { data.Signature; })
|
||||
{
|
||||
std::vector<std::tuple<std::string, std::string, std::string>> diff;
|
||||
for (; old_data_it != old_query.end(); ++old_data_it)
|
||||
{
|
||||
auto data = *old_data_it;
|
||||
data.Signature = "";
|
||||
data.Id = 0;
|
||||
diff.push_back({ serialize(data), old_data_it->Signature, old_data_it->Key });
|
||||
}
|
||||
return diff;
|
||||
}
|
||||
else return std::vector<std::tuple<std::string, std::string, std::string>>{};
|
||||
};
|
||||
auto check_many = [&]<typename T, typename... Ts>(auto&& self)
|
||||
-> std::optional<std::vector<std::tuple<std::string, std::string, std::string>>>
|
||||
{
|
||||
if (auto diff = check_one.operator()<T>(); !diff) return std::nullopt;
|
||||
else if constexpr (sizeof...(Ts) == 0) return diff;
|
||||
else if (auto diff2 = self.template operator()<Ts...>(self); !diff2) return std::nullopt;
|
||||
else { diff->insert(diff->end(), diff2->begin(), diff2->end()); return diff; }
|
||||
};
|
||||
return check_many.operator()<LoginData, LogoutData, SubmitJobData, FinishJobData>(check_many);
|
||||
}
|
||||
}
|
||||
// search corresponding job in submit table
|
||||
std::optional<SubmitJobData> search_job_in_submit(auto connection, unsigned job_id, std::string submit_time)
|
||||
{
|
||||
std::optional<SubmitJobData> result;
|
||||
long submit_date = [&]
|
||||
{
|
||||
std::chrono::system_clock::time_point submit_date_with_local;
|
||||
std::stringstream(submit_time) >> date::parse("%b %d %H:%M:%S %Y", submit_date_with_local);
|
||||
date::zoned_time submit_date_with_zone
|
||||
(
|
||||
date::current_zone(),
|
||||
date::local_seconds
|
||||
{
|
||||
std::chrono::seconds(std::chrono::duration_cast<std::chrono::seconds>
|
||||
(submit_date_with_local.time_since_epoch()).count())
|
||||
}
|
||||
);
|
||||
auto submit_date = submit_date_with_zone.get_sys_time();
|
||||
return std::chrono::duration_cast<std::chrono::seconds>(submit_date.time_since_epoch()).count();
|
||||
}();
|
||||
auto submit_jobs = connection->template get_all<SubmitJobData>
|
||||
(sqlite_orm::where(sqlite_orm::is_equal(&SubmitJobData::JobId, job_id)));
|
||||
for (auto& job_submit : submit_jobs)
|
||||
if (auto diff = job_submit.Time - submit_date; std::abs(diff) < 3600)
|
||||
{
|
||||
result = job_submit;
|
||||
if (std::abs(diff) > 60)
|
||||
std::cerr << fmt::format("large difference found: {} {}\n", job_id, diff);
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
bool export_data(long start_time, long end_time, std::string filename)
|
||||
{
|
||||
if (auto conn = connect(); !conn) return false;
|
||||
else
|
||||
{
|
||||
struct StatResult
|
||||
{
|
||||
double CpuTime = 0;
|
||||
unsigned LoginInteractive = 0, LoginNonInteractive = 0, SubmitJob = 0, FinishJobSuccess = 0,
|
||||
FinishJobFailed = 0;
|
||||
StatResult& operator+=(const StatResult& rhs)
|
||||
{
|
||||
CpuTime += rhs.CpuTime;
|
||||
LoginInteractive += rhs.LoginInteractive;
|
||||
LoginNonInteractive += rhs.LoginNonInteractive;
|
||||
SubmitJob += rhs.SubmitJob;
|
||||
FinishJobSuccess += rhs.FinishJobSuccess;
|
||||
FinishJobFailed += rhs.FinishJobFailed;
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
// Key SubAccount -> StatResult
|
||||
std::map<std::pair<std::string, std::optional<std::string>>, StatResult> stat;
|
||||
// CpuTime & FinishJobSuccess & FinishJobFailed
|
||||
for
|
||||
(
|
||||
auto& it : conn->get_all<FinishJobData>(sqlite_orm::where
|
||||
(sqlite_orm::between(&FinishJobData::Time, start_time, end_time)))
|
||||
)
|
||||
{
|
||||
auto job_in_submit = search_job_in_submit
|
||||
(conn, it.JobId, it.SubmitTime);
|
||||
std::pair<std::string, std::optional<std::string>> key;
|
||||
if (!job_in_submit) key = { "", {} };
|
||||
else key = std::make_pair(job_in_submit->Key, job_in_submit->Subaccount);
|
||||
stat[key].CpuTime += it.CpuTime / 3600;
|
||||
if (it.JobResult == "DONE") stat[key].FinishJobSuccess++;
|
||||
else stat[key].FinishJobFailed++;
|
||||
}
|
||||
// LoginInteractive & LoginNonInteractive
|
||||
for
|
||||
(
|
||||
auto& it : conn->get_all<LoginData>(sqlite_orm::where
|
||||
(sqlite_orm::between(&LoginData::Time, start_time, end_time)))
|
||||
)
|
||||
{
|
||||
auto key = std::make_pair(it.Key, it.Subaccount);
|
||||
if (it.Interactive) stat[key].LoginInteractive++; else stat[key].LoginNonInteractive++;
|
||||
}
|
||||
// SubmitJob
|
||||
for
|
||||
(
|
||||
auto& it : conn->get_all<SubmitJobData>(sqlite_orm::where
|
||||
(sqlite_orm::between(&SubmitJobData::Time, start_time, end_time)))
|
||||
)
|
||||
stat[{it.Key,it.Subaccount }].SubmitJob++;
|
||||
// add all result with subaccount into result without subaccount
|
||||
std::map<std::string, StatResult> stat_without_subaccount;
|
||||
for (auto& [key, value] : stat) stat_without_subaccount[key.first] += value;
|
||||
// remove all result without subaccount
|
||||
std::erase_if(stat, [](auto& it) { return !it.first.second; });
|
||||
// write to excel
|
||||
OpenXLSX::XLDocument doc;
|
||||
doc.create(filename);
|
||||
doc.workbook().addWorksheet("Statistics");
|
||||
auto wks1 = doc.workbook().worksheet("Statistics");
|
||||
wks1.row(1).values() = std::vector<std::string>
|
||||
{
|
||||
"Username", "FingerPrint", "CpuTime", "LoginInteractive", "LoginNonInteractive",
|
||||
"SubmitJob", "FinishJobSuccess", "FinishJobFailed"
|
||||
};
|
||||
for
|
||||
(
|
||||
auto [row, it] = std::tuple(2, stat_without_subaccount.begin());
|
||||
it != stat_without_subaccount.end();
|
||||
it++, row++
|
||||
)
|
||||
wks1.row(row).values() = std::vector<std::string>
|
||||
{
|
||||
Keys.contains(it->first) ? Keys[it->first].Username : "(unknown)",
|
||||
it->first, fmt::format("{:.2f}", it->second.CpuTime),
|
||||
std::to_string(it->second.LoginInteractive), std::to_string(it->second.LoginNonInteractive),
|
||||
std::to_string(it->second.SubmitJob), std::to_string(it->second.FinishJobSuccess),
|
||||
std::to_string(it->second.FinishJobFailed)
|
||||
};
|
||||
doc.workbook().addWorksheet("StatisticsWithSubAccount");
|
||||
auto wks2 = doc.workbook().worksheet("StatisticsWithSubAccount");
|
||||
wks2.row(1).values() = std::vector<std::string>
|
||||
{
|
||||
"Username::SubAccount", "CpuTime", "LoginInteractive", "LoginNonInteractive",
|
||||
"SubmitJob", "FinishJobSuccess", "FinishJobFailed"
|
||||
};
|
||||
for (auto [row, it] = std::tuple(2, stat.begin()); it != stat.end(); it++, row++)
|
||||
wks2.row(row).values() = std::vector<std::string>
|
||||
{
|
||||
(Keys.contains(it->first.first) ? Keys[it->first.first].Username : "(unknown)")
|
||||
+ "::" + *it->first.second,
|
||||
fmt::format("{:.2f}", it->second.CpuTime),
|
||||
std::to_string(it->second.LoginInteractive), std::to_string(it->second.LoginNonInteractive),
|
||||
std::to_string(it->second.SubmitJob), std::to_string(it->second.FinishJobSuccess),
|
||||
std::to_string(it->second.FinishJobFailed)
|
||||
};
|
||||
doc.workbook().deleteSheet("Sheet1");
|
||||
doc.save();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
std::optional<std::map<unsigned, std::tuple<std::string, std::string, std::string, std::optional<std::string>>>>
|
||||
check_job_status()
|
||||
{
|
||||
if (auto conn = connect(); !conn) return std::nullopt;
|
||||
else if (auto jobs_current = lfs::bjobs_list(); !jobs_current) return std::nullopt;
|
||||
else
|
||||
{
|
||||
auto jobs_previous_query_result = conn->get_all<CheckJobData>();
|
||||
auto jobs_previous = jobs_previous_query_result
|
||||
| ranges::views::transform([](auto& it) { return std::pair{it.JobId, it.Status}; })
|
||||
| ranges::to<std::map<unsigned, std::string>>;
|
||||
std::map<unsigned, std::tuple<std::string, std::string, std::string, std::optional<std::string>>> result;
|
||||
for (auto& [job_id, status] : *jobs_current)
|
||||
if (!jobs_previous.contains(job_id) || jobs_previous[job_id] != std::get<1>(status))
|
||||
if
|
||||
(
|
||||
auto job_in_submit =
|
||||
search_job_in_submit(conn, job_id, std::get<0>(status));
|
||||
job_in_submit
|
||||
)
|
||||
result[job_id] =
|
||||
{ std::get<3>(status), std::get<1>(status), job_in_submit->Key, job_in_submit->Subaccount };
|
||||
conn->remove_all<CheckJobData>();
|
||||
auto new_data = *jobs_current
|
||||
| ranges::views::transform
|
||||
([](auto& it) { return CheckJobData{ .JobId = it.first, .Status = std::get<1>(it.second) }; })
|
||||
| ranges::to<std::vector<CheckJobData>>;
|
||||
conn->insert_range(new_data.begin(), new_data.end());
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
85
local/pkgs/hpcstat/src/ssh.cpp
Normal file
85
local/pkgs/hpcstat/src/ssh.cpp
Normal file
@@ -0,0 +1,85 @@
|
||||
# include <hpcstat/ssh.hpp>
|
||||
# include <hpcstat/keys.hpp>
|
||||
# include <hpcstat/env.hpp>
|
||||
# include <boost/filesystem.hpp>
|
||||
# include <boost/process.hpp>
|
||||
# include <boost/dll.hpp>
|
||||
|
||||
namespace hpcstat::ssh
|
||||
{
|
||||
std::optional<std::string> fingerprint()
|
||||
{
|
||||
if (auto sshbindir = env::env("HPCSTAT_SSH_BINDIR"); !sshbindir)
|
||||
return std::nullopt;
|
||||
else if
|
||||
(
|
||||
auto output =
|
||||
exec(std::filesystem::path(*sshbindir) / "ssh-add", { "-l" });
|
||||
!output
|
||||
)
|
||||
{ std::cerr << "Failed to get ssh fingerprints\n"; return std::nullopt; }
|
||||
else
|
||||
{
|
||||
std::regex pattern(R"r(\b(?:sha|SHA)256:([0-9A-Za-z+/=]{43})\b)r");
|
||||
std::smatch match;
|
||||
for
|
||||
(
|
||||
auto i = std::sregex_iterator(output->begin(), output->end(), pattern);
|
||||
i != std::sregex_iterator(); ++i
|
||||
)
|
||||
if (Keys.contains(i->str(1))) return i->str(1);
|
||||
std::cerr << fmt::format("No valid fingerprint found in:\n{}\n", *output);
|
||||
return std::nullopt;
|
||||
}
|
||||
}
|
||||
std::optional<std::string> sign(std::string message, std::string fingerprint)
|
||||
{
|
||||
if (auto sshbindir = env::env("HPCSTAT_SSH_BINDIR"); !sshbindir)
|
||||
return std::nullopt;
|
||||
else if (auto sharedir = env::env("HPCSTAT_SHAREDIR", true); !sharedir)
|
||||
return std::nullopt;
|
||||
else if
|
||||
(
|
||||
auto output = exec
|
||||
(
|
||||
std::filesystem::path(*sshbindir) / "ssh-keygen",
|
||||
{
|
||||
"-Y", "sign", "-q",
|
||||
"-f", fmt::format("{}/keys/{}", *sharedir, Keys[fingerprint].PubkeyFilename),
|
||||
"-n", "hpcstat@chn.moe", "-"
|
||||
},
|
||||
message
|
||||
);
|
||||
!output
|
||||
)
|
||||
{ std::cerr << fmt::format("Failed to sign message: {}\n", message); return std::nullopt; }
|
||||
else return *output;
|
||||
}
|
||||
bool verify(std::string message, std::string signature, std::string fingerprint)
|
||||
{
|
||||
if (auto sshbindir = env::env("HPCSTAT_SSH_BINDIR"); !sshbindir)
|
||||
return false;
|
||||
else if (auto sharedir = env::env("HPCSTAT_SHAREDIR", true); !sharedir)
|
||||
return false;
|
||||
else
|
||||
{
|
||||
namespace bf = boost::filesystem;
|
||||
auto tempdir = bf::temp_directory_path() / bf::unique_path();
|
||||
bf::create_directories(tempdir);
|
||||
auto signaturefile = tempdir / "signature";
|
||||
std::ofstream(signaturefile) << signature;
|
||||
auto result = exec
|
||||
(
|
||||
std::filesystem::path(*sshbindir) / "ssh-keygen",
|
||||
{
|
||||
"-Y", "verify",
|
||||
"-f", fmt::format("{}/keys/{}", *sharedir, Keys[fingerprint].PubkeyFilename),
|
||||
"-n", "hpcstat@chn.moe", "-s", signaturefile.string()
|
||||
},
|
||||
message
|
||||
);
|
||||
std::filesystem::remove_all(tempdir.string());
|
||||
return result.has_value();
|
||||
}
|
||||
}
|
||||
}
|
||||
28
local/pkgs/misskey.nix
Normal file
28
local/pkgs/misskey.nix
Normal file
@@ -0,0 +1,28 @@
|
||||
{
|
||||
lib, mkPnpmPackage, nodejs, writeShellScript,
|
||||
bash, cypress, vips, src
|
||||
}: (mkPnpmPackage.override { inherit nodejs; })
|
||||
{
|
||||
inherit src;
|
||||
extraIntegritySha256."https://github.com/aiscript-dev/aiscript-languageserver/releases/download/0.1.5/aiscript-dev-aiscript-languageserver-0.1.5.tgz" = "1mhnwa8h48bc21f0zv8q93aphiqz9i70r7m4xsa4sd1mlncfgyl7";
|
||||
extraNativeBuildInputs = [ bash nodejs.pkgs.typescript nodejs.pkgs.gulp ];
|
||||
extraAttrs =
|
||||
{
|
||||
CYPRESS_INSTALL_BINARY = "0";
|
||||
NODE_ENV = "production";
|
||||
postInstall =
|
||||
let startScript = writeShellScript "misskey"
|
||||
''
|
||||
export PATH=${lib.makeBinPath [ bash nodejs nodejs.pkgs.pnpm nodejs.pkgs.gulp cypress ]}:$PATH
|
||||
export CYPRESS_RUN_BINARY="${cypress}/bin/Cypress"
|
||||
export NODE_ENV=production
|
||||
pnpm run migrateandstart
|
||||
'';
|
||||
in
|
||||
''
|
||||
mkdir -p $out/bin
|
||||
cp ${startScript} $out/bin/misskey
|
||||
mkdir -p $out/files
|
||||
'';
|
||||
};
|
||||
}
|
||||
@@ -1,69 +0,0 @@
|
||||
{
|
||||
lib, stdenv, mkPnpmPackage, fetchurl, nodejs, writeShellScript, buildFHSEnv,
|
||||
bash, cypress, vips, pkg-config, src, libtensorflow
|
||||
}:
|
||||
let
|
||||
name = "misskey";
|
||||
originalPnpmPackage = mkPnpmPackage
|
||||
{
|
||||
inherit name src nodejs;
|
||||
copyPnpmStore = true;
|
||||
extraIntegritySha256."https://github.com/aiscript-dev/aiscript-languageserver/releases/download/0.1.5/aiscript-dev-aiscript-languageserver-0.1.5.tgz" = "1mhnwa8h48bc21f0zv8q93aphiqz9i70r7m4xsa4sd1mlncfgyl7";
|
||||
};
|
||||
startScript = writeShellScript "misskey"
|
||||
''
|
||||
export PATH=${lib.makeBinPath [ bash nodejs nodejs.pkgs.pnpm nodejs.pkgs.gulp cypress ]}:$PATH
|
||||
export CYPRESS_RUN_BINARY="${cypress}/bin/Cypress"
|
||||
export NODE_ENV=production
|
||||
pnpm run migrateandstart
|
||||
'';
|
||||
in
|
||||
stdenv.mkDerivation rec
|
||||
{
|
||||
inherit src name;
|
||||
buildInputs =
|
||||
[
|
||||
bash nodejs nodejs.pkgs.typescript nodejs.pkgs.pnpm nodejs.pkgs.gulp cypress vips pkg-config
|
||||
];
|
||||
nativeBuildInputs = buildInputs;
|
||||
CYPRESS_RUN_BINARY = "${cypress}/bin/Cypress";
|
||||
NODE_ENV = "production";
|
||||
configurePhase =
|
||||
''
|
||||
export HOME=$NIX_BUILD_TOP # Some packages need a writable HOME
|
||||
export npm_config_nodedir=${nodejs}
|
||||
pnpm config set reporter append-only
|
||||
|
||||
runHook preConfigure
|
||||
|
||||
store=$(pnpm store path)
|
||||
mkdir -p $(dirname $store)
|
||||
|
||||
cp -f ${originalPnpmPackage.passthru.patchedLockfileYaml} pnpm-lock.yaml
|
||||
cp -RL ${originalPnpmPackage.passthru.pnpmStore} $store
|
||||
chmod -R +w $store
|
||||
pnpm install --frozen-lockfile --offline
|
||||
|
||||
runHook postConfigure
|
||||
'';
|
||||
buildPhase =
|
||||
''
|
||||
runHook preBuild
|
||||
pnpm run build
|
||||
runHook postBuild
|
||||
'';
|
||||
installPhase =
|
||||
''
|
||||
runHook preInstall
|
||||
mkdir -p $out
|
||||
mv * .* $out
|
||||
mkdir -p $out/bin
|
||||
cp ${startScript} $out/bin/misskey
|
||||
mkdir -p $out/files
|
||||
runHook postInstall
|
||||
'';
|
||||
passthru =
|
||||
{
|
||||
inherit originalPnpmPackage startScript;
|
||||
};
|
||||
}
|
||||
85
local/pkgs/mkPnpmPackage.nix
Normal file
85
local/pkgs/mkPnpmPackage.nix
Normal file
@@ -0,0 +1,85 @@
|
||||
{ lib, remarshal, fetchurl, runCommand, nodejs, stdenv, pkg-config, writeText }:
|
||||
{
|
||||
src,
|
||||
lockFile ? "${src}/pnpm-lock.yaml",
|
||||
packageFile ? "${src}/package.json",
|
||||
pname ? (builtins.fromJSON (builtins.readFile packageFile)).name,
|
||||
version ? (builtins.fromJSON (builtins.readFile packageFile)).version or null,
|
||||
extraIntegritySha256 ? {},
|
||||
registry ? "https://registry.npmjs.org",
|
||||
extraNativeBuildInputs ? [],
|
||||
buildScript ? "build",
|
||||
extraAttrs ? {},
|
||||
}:
|
||||
let
|
||||
originalLock = builtins.fromJSON
|
||||
(builtins.readFile (runCommand "toJSON" { } "${remarshal}/bin/yaml2json ${lockFile} $out"));
|
||||
patchedLock = originalLock
|
||||
// {
|
||||
packages = lib.mapAttrs
|
||||
(name: value:
|
||||
if (value.resolution ? integrity) == (value.resolution ? tarball)
|
||||
then throw "could not determine source ${name}"
|
||||
else if value.resolution ? integrity then
|
||||
# name maybe /@vue/compiler-core@3.4.18 or @vue/compiler-core@3.4.18
|
||||
# or /@storybook/core-server@8.0.0-beta.6(react-dom@18.2.0)(react@18.2.0)
|
||||
let nameAtVersion = builtins.head (lib.splitString "(" name);
|
||||
in let
|
||||
version = lib.last (lib.splitString "@" nameAtVersion);
|
||||
name = lib.last (lib.init (lib.splitString "@" nameAtVersion));
|
||||
baseName = lib.last (lib.splitString "/" name);
|
||||
url = "${registry}/${name}/-/${baseName}-${version}.tgz";
|
||||
tarball = fetchurl { inherit url; sha512 = value.resolution.integrity; };
|
||||
in value // { resolution.tarball = "file:${tarball}"; }
|
||||
else # if value.resolution ? tarball then
|
||||
if lib.hasPrefix "https://codeload.github.com" value.resolution.tarball then
|
||||
let
|
||||
match = lib.strings.match
|
||||
"https://codeload.github.com/([^/]+)/([^/]+)/tar\\.gz/([a-f0-9]+)" value.resolution.tarball;
|
||||
repo = fetchGit
|
||||
{
|
||||
url = "https://github.com/${builtins.elemAt match 0}/${builtins.elemAt match 1}";
|
||||
rev = builtins.elemAt match 2;
|
||||
shallow = true;
|
||||
};
|
||||
tarball = runCommand "${builtins.elemAt match 1}.tgz" {} "tar -czf $out -C ${repo} .";
|
||||
in value // { resolution.tarball = "file:${tarball}"; }
|
||||
else
|
||||
let tarball = fetchurl rec
|
||||
{ url = value.resolution.tarball; sha256 = extraIntegritySha256.${url}; };
|
||||
in value // { resolution.tarball = "file:${tarball}"; }
|
||||
)
|
||||
originalLock.packages;
|
||||
};
|
||||
patchedLockFile = writeText "pnpm-lock.yaml" (builtins.toJSON patchedLock);
|
||||
in stdenv.mkDerivation
|
||||
({
|
||||
inherit src pname version;
|
||||
nativeBuildInputs = [ nodejs nodejs.pkgs.pnpm pkg-config ] ++ extraNativeBuildInputs;
|
||||
|
||||
configurePhase =
|
||||
''
|
||||
runHook preConfigure
|
||||
export HOME=$NIX_BUILD_TOP # Some packages need a writable HOME
|
||||
export npm_config_nodedir=${nodejs}
|
||||
pnpm config set reporter append-only
|
||||
cp -f ${patchedLockFile} pnpm-lock.yaml
|
||||
runHook postConfigure
|
||||
'';
|
||||
|
||||
buildPhase =
|
||||
''
|
||||
runHook preBuild
|
||||
pnpm install --frozen-lockfile --offline
|
||||
pnpm run ${buildScript}
|
||||
runHook postBuild
|
||||
'';
|
||||
|
||||
installPhase =
|
||||
''
|
||||
runHook preInstall
|
||||
mkdir -p $out
|
||||
mv * .* $out
|
||||
runHook postInstall
|
||||
'';
|
||||
} // extraAttrs)
|
||||
@@ -39,5 +39,5 @@ in stdenvNoCC.mkDerivation
|
||||
mkdir -p $out
|
||||
${builder}/bin/builder ./install
|
||||
'';
|
||||
requiredSystemFeatures = [ "gccarch-exact-${stdenvNoCC.hostPlatform.gcc.arch}" "big-parallel" ];
|
||||
requiredSystemFeatures = [ "gccarch-exact-${stdenvNoCC.hostPlatform.gcc.arch}" ];
|
||||
}
|
||||
|
||||
@@ -86,5 +86,5 @@ in stdenvNoCC.mkDerivation rec
|
||||
--ignore-latest
|
||||
'';
|
||||
dontFixup = true;
|
||||
requiredSystemFeatures = [ "gccarch-exact-${stdenvNoCC.hostPlatform.gcc.arch}" "big-parallel" ];
|
||||
requiredSystemFeatures = [ "gccarch-exact-${stdenvNoCC.hostPlatform.gcc.arch}" ];
|
||||
}
|
||||
|
||||
11
local/pkgs/openxlsx/default.nix
Normal file
11
local/pkgs/openxlsx/default.nix
Normal file
@@ -0,0 +1,11 @@
|
||||
{ stdenv, src, cmake, pkg-config }: stdenv.mkDerivation
|
||||
{
|
||||
name = "openxlsx";
|
||||
inherit src;
|
||||
nativeBuildInputs = [ cmake pkg-config ];
|
||||
cmakeFlags =
|
||||
[
|
||||
"-DOPENXLSX_CREATE_DOCS=OFF" "-DOPENXLSX_BUILD_SAMPLES=OFF" "-DOPENXLSX_BUILD_TESTS=OFF"
|
||||
"-DOPENXLSX_BUILD_BENCHMARKS=OFF"
|
||||
];
|
||||
}
|
||||
24
local/pkgs/rsshub.nix
Normal file
24
local/pkgs/rsshub.nix
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
lib, mkPnpmPackage, nodejs, writeShellScript,
|
||||
bash, chromium, src, git
|
||||
}: (mkPnpmPackage.override { inherit nodejs; })
|
||||
{
|
||||
inherit src;
|
||||
extraNativeBuildInputs = [ bash git ];
|
||||
extraAttrs =
|
||||
{
|
||||
PUPPETEER_SKIP_DOWNLOAD = true;
|
||||
postInstall =
|
||||
let startScript = writeShellScript "rsshub"
|
||||
''
|
||||
export PATH=${lib.makeBinPath [ bash nodejs nodejs.pkgs.pnpm chromium git ]}:$PATH
|
||||
export CHROMIUM_EXECUTABLE_PATH=chromium
|
||||
pnpm start
|
||||
'';
|
||||
in
|
||||
''
|
||||
mkdir -p $out/bin
|
||||
cp ${startScript} $out/bin/rsshub
|
||||
'';
|
||||
};
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
{
|
||||
lib, stdenv, mkPnpmPackage, nodejs, writeShellScript,
|
||||
chromium, bash, src
|
||||
}:
|
||||
let
|
||||
name = "rsshub";
|
||||
originalPnpmPackage = mkPnpmPackage { inherit name src nodejs; };
|
||||
nodeModules = originalPnpmPackage.nodeModules.overrideAttrs { PUPPETEER_SKIP_DOWNLOAD = true; };
|
||||
rsshub-unwrapped = stdenv.mkDerivation
|
||||
{
|
||||
inherit src;
|
||||
name = "${name}-unwrapped";
|
||||
configurePhase =
|
||||
''
|
||||
export HOME=$NIX_BUILD_TOP # Some packages need a writable HOME
|
||||
export npm_config_nodedir=${nodejs}
|
||||
|
||||
runHook preConfigure
|
||||
|
||||
ln -s ${nodeModules}/. node_modules
|
||||
|
||||
runHook postConfigure
|
||||
'';
|
||||
installPhase =
|
||||
''
|
||||
runHook preInstall
|
||||
mkdir -p $out
|
||||
mv * .* $out
|
||||
runHook postInstall
|
||||
'';
|
||||
};
|
||||
startScript = writeShellScript "rsshub"
|
||||
''
|
||||
cd ${rsshub-unwrapped}
|
||||
export PATH=${lib.makeBinPath [ bash nodejs nodejs.pkgs.pnpm chromium ]}:$PATH
|
||||
export CHROMIUM_EXECUTABLE_PATH=chromium
|
||||
pnpm start
|
||||
'';
|
||||
in stdenv.mkDerivation
|
||||
{
|
||||
inherit name;
|
||||
phases = [ "installPhase" ];
|
||||
installPhase =
|
||||
''
|
||||
runHook preInstall
|
||||
mkdir -p $out/bin
|
||||
cp ${startScript} $out/bin/rsshub
|
||||
runHook postInstall
|
||||
'';
|
||||
}
|
||||
7
local/pkgs/sqlite-orm/default.nix
Normal file
7
local/pkgs/sqlite-orm/default.nix
Normal file
@@ -0,0 +1,7 @@
|
||||
{ stdenv, src, cmake, pkg-config, sqlite }: stdenv.mkDerivation
|
||||
{
|
||||
name = "sqlite-orm";
|
||||
inherit src;
|
||||
nativeBuildInputs = [ cmake pkg-config ];
|
||||
buildInputs = [ sqlite ];
|
||||
}
|
||||
@@ -1,75 +0,0 @@
|
||||
{
|
||||
buildFHSEnv, writeScript, stdenvNoCC, requireFile, substituteAll,
|
||||
aocc, rsync, which, hdf5, wannier90, aocl, openmpi, gcc, zlib, glibc, binutils, libpsm2,
|
||||
additionalCommands ? ""
|
||||
}:
|
||||
let
|
||||
sources = import ../source.nix { inherit requireFile; };
|
||||
buildEnv = buildFHSEnv
|
||||
{
|
||||
name = "buildEnv";
|
||||
targetPkgs = _: [ zlib aocc aocl openmpi gcc.cc gcc.cc.lib glibc.dev binutils.bintools ];
|
||||
};
|
||||
buildScript = writeScript "build"
|
||||
''
|
||||
mkdir -p bin
|
||||
make DEPS=1 -j$NIX_BUILD_CORES
|
||||
'';
|
||||
include = version: substituteAll
|
||||
{
|
||||
src = ./makefile.include-${version};
|
||||
gccArch = stdenvNoCC.hostPlatform.gcc.arch;
|
||||
};
|
||||
vasp = version: stdenvNoCC.mkDerivation rec
|
||||
{
|
||||
pname = "vasp-amd";
|
||||
inherit version;
|
||||
src = sources.${version};
|
||||
configurePhase =
|
||||
''
|
||||
cp ${include version} makefile.include
|
||||
cp ${../constr_cell_relax.F} src/constr_cell_relax.F
|
||||
'';
|
||||
buildInputs = [ wannier90 ];
|
||||
nativeBuildInputs = [ rsync which ];
|
||||
AMDBLIS_ROOT = aocl;
|
||||
AMDLIBFLAME_ROOT = aocl;
|
||||
AMDSCALAPACK_ROOT = aocl;
|
||||
AMDFFTW_ROOT = aocl;
|
||||
HDF5_ROOT = hdf5;
|
||||
WANNIER90_ROOT = wannier90;
|
||||
OMPI_CC = "clang";
|
||||
OMPI_CXX = "clang++";
|
||||
OMPI_FC = "flang";
|
||||
buildPhase = "${buildEnv}/bin/buildEnv ${buildScript}";
|
||||
installPhase =
|
||||
''
|
||||
mkdir -p $out/bin
|
||||
for i in std gam ncl; do cp bin/vasp_$i $out/bin/vasp-$i; done
|
||||
'';
|
||||
dontFixup = true;
|
||||
requiredSystemFeatures = [ "gccarch-exact-${stdenvNoCC.hostPlatform.gcc.arch}" "big-parallel" ];
|
||||
};
|
||||
startScript = version: writeScript "vasp-nvidia-${version}"
|
||||
''
|
||||
# if OMP_NUM_THREADS is not set, set it according to SLURM_CPUS_PER_TASK or to 1
|
||||
if [ -z "''${OMP_NUM_THREADS-}" ]; then
|
||||
if [ -n "''${SLURM_CPUS_PER_TASK-}" ]; then
|
||||
OMP_NUM_THREADS=$SLURM_CPUS_PER_TASK
|
||||
else
|
||||
OMP_NUM_THREADS=1
|
||||
fi
|
||||
fi
|
||||
export OMP_NUM_THREADS
|
||||
|
||||
${additionalCommands}
|
||||
|
||||
exec "$@"
|
||||
'';
|
||||
runEnv = version: buildFHSEnv
|
||||
{
|
||||
name = "vasp-amd-${builtins.replaceStrings ["."] [""] version}-env";
|
||||
targetPkgs = _: [ zlib (vasp version) aocc aocl openmpi gcc.cc.lib hdf5 wannier90 libpsm2 ];
|
||||
runScript = startScript version;
|
||||
};
|
||||
in builtins.mapAttrs (version: _: runEnv version) sources
|
||||
@@ -1,91 +0,0 @@
|
||||
# Default precompiler options
|
||||
CPP_OPTIONS = -DHOST=\"LinuxGNU\" \
|
||||
-DMPI -DMPI_BLOCK=8000 -Duse_collective \
|
||||
-DscaLAPACK \
|
||||
-DCACHE_SIZE=4000 \
|
||||
-Davoidalloc \
|
||||
-Dvasp6 \
|
||||
-Duse_bse_te \
|
||||
-Dtbdyn \
|
||||
-Dfock_dblbuf \
|
||||
-D_OPENMP -Duse_shmem -Dshmem_bcast_buffer -Dshmem_rproj
|
||||
|
||||
CPP = flang -E -C -w $*$(FUFFIX) >$*$(SUFFIX) $(CPP_OPTIONS) -ffree-form
|
||||
|
||||
FC = mpif90 -fopenmp
|
||||
FCL = mpif90 -fopenmp
|
||||
|
||||
FREE = -ffree-form -ffree-line-length-none
|
||||
|
||||
FFLAGS = -w -fno-fortran-main -Mbackslash
|
||||
|
||||
OFLAG = -O2
|
||||
OFLAG_IN = $(OFLAG)
|
||||
DEBUG = -O0
|
||||
|
||||
OBJECTS = fftmpiw.o fftmpi_map.o fftw3d.o fft3dlib.o
|
||||
OBJECTS_O1 += fftw3d.o fftmpi.o fftmpiw.o
|
||||
OBJECTS_O2 += fft3dlib.o
|
||||
|
||||
# For what used to be vasp.5.lib
|
||||
CPP_LIB = $(CPP)
|
||||
FC_LIB = $(FC)
|
||||
CC_LIB = clang
|
||||
CFLAGS_LIB = -O
|
||||
FFLAGS_LIB = -O1
|
||||
FREE_LIB = $(FREE)
|
||||
|
||||
OBJECTS_LIB = linpack_double.o getshmem.o
|
||||
|
||||
# For the parser library
|
||||
CXX_PARS = clang++
|
||||
LLIBS = -lstdc++
|
||||
|
||||
##
|
||||
## Customize as of this point! Of course you may change the preceding
|
||||
## part of this file as well if you like, but it should rarely be
|
||||
## necessary ...
|
||||
##
|
||||
|
||||
# When compiling on the target machine itself, change this to the
|
||||
# relevant target when cross-compiling for another architecture
|
||||
VASP_TARGET_CPU ?= -march=@gccArch@
|
||||
FFLAGS += $(VASP_TARGET_CPU)
|
||||
|
||||
# BLAS (mandatory)
|
||||
AMDBLIS_ROOT ?= /path/to/your/amdblis/installation
|
||||
BLAS = -L${AMDBLIS_ROOT}/lib -lblis-mt
|
||||
|
||||
# LAPACK (mandatory)
|
||||
AMDLIBFLAME_ROOT ?= /path/to/your/amdlibflame/installation
|
||||
LAPACK = -L${AMDLIBFLAME_ROOT}/lib -lflame
|
||||
|
||||
# scaLAPACK (mandatory)
|
||||
AMDSCALAPACK_ROOT ?= /path/to/your/amdscalapack/installation
|
||||
SCALAPACK = -L${AMDSCALAPACK_ROOT}/lib -lscalapack
|
||||
|
||||
LLIBS += $(SCALAPACK) $(LAPACK) $(BLAS)
|
||||
|
||||
# FFTW (mandatory)
|
||||
AMDFFTW_ROOT ?= /path/to/your/amdfftw/installation
|
||||
LLIBS += -L$(AMDFFTW_ROOT)/lib -lfftw3 -lfftw3_omp
|
||||
INCS += -I$(AMDFFTW_ROOT)/include
|
||||
|
||||
# HDF5-support (optional but strongly recommended)
|
||||
CPP_OPTIONS+= -DVASP_HDF5
|
||||
HDF5_ROOT ?= /path/to/your/hdf5/installation
|
||||
LLIBS += -L$(HDF5_ROOT)/lib -lhdf5_fortran
|
||||
INCS += -I$(HDF5_ROOT)/include
|
||||
|
||||
# For the VASP-2-Wannier90 interface (optional)
|
||||
CPP_OPTIONS += -DVASP2WANNIER90
|
||||
WANNIER90_ROOT ?= /path/to/your/wannier90/installation
|
||||
LLIBS += -L$(WANNIER90_ROOT)/lib -lwannier
|
||||
|
||||
# For the fftlib library (recommended)
|
||||
CPP_OPTIONS+= -Dsysv
|
||||
FCL += fftlib.o
|
||||
CXX_FFTLIB = clang++ -fopenmp -std=c++11 -DFFTLIB_THREADSAFE
|
||||
INCS_FFTLIB = -I./include -I$(AMDFFTW_ROOT)/include
|
||||
LIBS += fftlib
|
||||
LLIBS += -ldl
|
||||
@@ -1,91 +0,0 @@
|
||||
# Default precompiler options
|
||||
CPP_OPTIONS = -DHOST=\"LinuxGNU\" \
|
||||
-DMPI -DMPI_BLOCK=8000 -Duse_collective \
|
||||
-DscaLAPACK \
|
||||
-DCACHE_SIZE=4000 \
|
||||
-Davoidalloc \
|
||||
-Dvasp6 \
|
||||
-Duse_bse_te \
|
||||
-Dtbdyn \
|
||||
-Dfock_dblbuf \
|
||||
-D_OPENMP -Duse_shmem -Dshmem_bcast_buffer -Dshmem_rproj
|
||||
|
||||
CPP = flang -E -ffree-form -C -w $*$(FUFFIX) >$*$(SUFFIX) $(CPP_OPTIONS) -ffree-form
|
||||
|
||||
FC = mpif90 -fopenmp
|
||||
FCL = mpif90 -fopenmp
|
||||
|
||||
FREE = -ffree-form -ffree-line-length-none
|
||||
|
||||
FFLAGS = -w -fno-fortran-main -Mbackslash
|
||||
|
||||
OFLAG = -O2
|
||||
OFLAG_IN = $(OFLAG)
|
||||
DEBUG = -O0
|
||||
|
||||
OBJECTS = fftmpiw.o fftmpi_map.o fftw3d.o fft3dlib.o
|
||||
OBJECTS_O1 += fftw3d.o fftmpi.o fftmpiw.o
|
||||
OBJECTS_O2 += fft3dlib.o
|
||||
|
||||
# For what used to be vasp.5.lib
|
||||
CPP_LIB = $(CPP)
|
||||
FC_LIB = $(FC)
|
||||
CC_LIB = clang
|
||||
CFLAGS_LIB = -O
|
||||
FFLAGS_LIB = -O1
|
||||
FREE_LIB = $(FREE)
|
||||
|
||||
OBJECTS_LIB = linpack_double.o getshmem.o
|
||||
|
||||
# For the parser library
|
||||
CXX_PARS = clang++
|
||||
LLIBS = -lstdc++
|
||||
|
||||
##
|
||||
## Customize as of this point! Of course you may change the preceding
|
||||
## part of this file as well if you like, but it should rarely be
|
||||
## necessary ...
|
||||
##
|
||||
|
||||
# When compiling on the target machine itself, change this to the
|
||||
# relevant target when cross-compiling for another architecture
|
||||
VASP_TARGET_CPU ?= -march=@gccArch@
|
||||
FFLAGS += $(VASP_TARGET_CPU)
|
||||
|
||||
# BLAS (mandatory)
|
||||
AMDBLIS_ROOT ?= /path/to/your/amdblis/installation
|
||||
BLAS = -L${AMDBLIS_ROOT}/lib -lblis-mt
|
||||
|
||||
# LAPACK (mandatory)
|
||||
AMDLIBFLAME_ROOT ?= /path/to/your/amdlibflame/installation
|
||||
LAPACK = -L${AMDLIBFLAME_ROOT}/lib -lflame
|
||||
|
||||
# scaLAPACK (mandatory)
|
||||
AMDSCALAPACK_ROOT ?= /path/to/your/amdscalapack/installation
|
||||
SCALAPACK = -L${AMDSCALAPACK_ROOT}/lib -lscalapack
|
||||
|
||||
LLIBS += $(SCALAPACK) $(LAPACK) $(BLAS)
|
||||
|
||||
# FFTW (mandatory)
|
||||
AMDFFTW_ROOT ?= /path/to/your/amdfftw/installation
|
||||
LLIBS += -L$(AMDFFTW_ROOT)/lib -lfftw3 -lfftw3_omp
|
||||
INCS += -I$(AMDFFTW_ROOT)/include
|
||||
|
||||
# HDF5-support (optional but strongly recommended)
|
||||
CPP_OPTIONS+= -DVASP_HDF5
|
||||
HDF5_ROOT ?= /path/to/your/hdf5/installation
|
||||
LLIBS += -L$(HDF5_ROOT)/lib -lhdf5_fortran
|
||||
INCS += -I$(HDF5_ROOT)/include
|
||||
|
||||
# For the VASP-2-Wannier90 interface (optional)
|
||||
CPP_OPTIONS += -DVASP2WANNIER90
|
||||
WANNIER90_ROOT ?= /path/to/your/wannier90/installation
|
||||
LLIBS += -L$(WANNIER90_ROOT)/lib -lwannier
|
||||
|
||||
# For the fftlib library (recommended)
|
||||
CPP_OPTIONS+= -Dsysv
|
||||
FCL += fftlib.o
|
||||
CXX_FFTLIB = clang++ -fopenmp -std=c++11 -DFFTLIB_THREADSAFE
|
||||
INCS_FFTLIB = -I./include -I$(AMDFFTW_ROOT)/include
|
||||
LIBS += fftlib
|
||||
LLIBS += -ldl
|
||||
@@ -1,57 +0,0 @@
|
||||
{
|
||||
stdenvNoCC, requireFile, writeShellApplication,
|
||||
rsync, mkl, mpi, openmp, gfortran, gcc, fftwMpi, hdf5, wannier90,
|
||||
additionalCommands ? ""
|
||||
}:
|
||||
let
|
||||
sources = import ../source.nix { inherit requireFile; };
|
||||
include = version: ./makefile.include-${version};
|
||||
vasp = version: stdenvNoCC.mkDerivation rec
|
||||
{
|
||||
pname = "vasp-gnu-mkl";
|
||||
inherit version;
|
||||
src = sources.${version};
|
||||
configurePhase =
|
||||
''
|
||||
cp ${include version} makefile.include
|
||||
cp ${../constr_cell_relax.F} src/constr_cell_relax.F
|
||||
mkdir -p bin
|
||||
'';
|
||||
enableParallelBuilding = true;
|
||||
makeFlags = "DEPS=1";
|
||||
buildInputs = [ mkl mpi openmp fftwMpi.dev fftwMpi hdf5 hdf5.dev wannier90 ];
|
||||
nativeBuildInputs = [ rsync gfortran gfortran.cc gcc ];
|
||||
FFTW_ROOT = fftwMpi.dev;
|
||||
HDF5_ROOT = hdf5.dev;
|
||||
WANNIER90_ROOT = wannier90;
|
||||
MKLROOT = mkl;
|
||||
installPhase =
|
||||
''
|
||||
mkdir -p $out/bin
|
||||
for i in std gam ncl; do
|
||||
cp bin/vasp_$i $out/bin/vasp-$i
|
||||
done
|
||||
'';
|
||||
};
|
||||
startScript = version: writeShellApplication
|
||||
{
|
||||
name = "vasp-gnu-${builtins.replaceStrings ["."] [""] version}-env";
|
||||
runtimeInputs = [(vasp version)];
|
||||
text =
|
||||
''
|
||||
# if OMP_NUM_THREADS is not set, set it according to SLURM_CPUS_PER_TASK or to 1
|
||||
if [ -z "''${OMP_NUM_THREADS-}" ]; then
|
||||
if [ -n "''${SLURM_CPUS_PER_TASK-}" ]; then
|
||||
OMP_NUM_THREADS=$SLURM_CPUS_PER_TASK
|
||||
else
|
||||
OMP_NUM_THREADS=1
|
||||
fi
|
||||
fi
|
||||
export OMP_NUM_THREADS
|
||||
|
||||
${additionalCommands}
|
||||
|
||||
exec "$@"
|
||||
'';
|
||||
};
|
||||
in builtins.mapAttrs (version: _: startScript version) sources
|
||||
@@ -1,87 +0,0 @@
|
||||
# Default precompiler options
|
||||
CPP_OPTIONS = -DHOST=\"LinuxGNU\" \
|
||||
-DMPI -DMPI_BLOCK=8000 -Duse_collective \
|
||||
-DscaLAPACK \
|
||||
-DCACHE_SIZE=4000 \
|
||||
-Davoidalloc \
|
||||
-Dvasp6 \
|
||||
-Duse_bse_te \
|
||||
-Dtbdyn \
|
||||
-Dfock_dblbuf \
|
||||
-D_OPENMP -Duse_shmem -Dshmem_bcast_buffer -Dshmem_rproj
|
||||
|
||||
CPP = gcc -E -C -w $*$(FUFFIX) >$*$(SUFFIX) $(CPP_OPTIONS)
|
||||
|
||||
FC = mpif90 -fopenmp
|
||||
FCL = mpif90 -fopenmp
|
||||
|
||||
FREE = -ffree-form -ffree-line-length-none
|
||||
|
||||
FFLAGS = -w -ffpe-summary=none
|
||||
|
||||
OFLAG = -O2
|
||||
OFLAG_IN = $(OFLAG)
|
||||
DEBUG = -O0
|
||||
|
||||
OBJECTS = fftmpiw.o fftmpi_map.o fftw3d.o fft3dlib.o
|
||||
OBJECTS_O1 += fftw3d.o fftmpi.o fftmpiw.o
|
||||
OBJECTS_O2 += fft3dlib.o
|
||||
|
||||
# For what used to be vasp.5.lib
|
||||
CPP_LIB = $(CPP)
|
||||
FC_LIB = $(FC)
|
||||
CC_LIB = gcc
|
||||
CFLAGS_LIB = -O
|
||||
FFLAGS_LIB = -O1
|
||||
FREE_LIB = $(FREE)
|
||||
|
||||
OBJECTS_LIB = linpack_double.o getshmem.o
|
||||
|
||||
# For the parser library
|
||||
CXX_PARS = g++
|
||||
LLIBS = -lstdc++
|
||||
|
||||
##
|
||||
## Customize as of this point! Of course you may change the preceding
|
||||
## part of this file as well if you like, but it should rarely be
|
||||
## necessary ...
|
||||
##
|
||||
|
||||
# When compiling on the target machine itself, change this to the
|
||||
# relevant target when cross-compiling for another architecture
|
||||
# VASP_TARGET_CPU ?= -march=native
|
||||
# FFLAGS += $(VASP_TARGET_CPU)
|
||||
|
||||
# For gcc-10 and higher (comment out for older versions)
|
||||
FFLAGS += -fallow-argument-mismatch
|
||||
|
||||
# Intel MKL for FFTW, BLAS, LAPACK, and scaLAPACK
|
||||
MKLROOT ?= /path/to/your/mkl/installation
|
||||
LLIBS_MKL = -L$(MKLROOT)/lib/intel64 -Wl,--no-as-needed -lmkl_gf_lp64 -lmkl_gnu_thread -lmkl_core -lmkl_scalapack_lp64 -lmkl_blacs_openmpi_lp64 -lgomp -lpthread -lm -ldl
|
||||
INCS = -I$(MKLROOT)/include/fftw
|
||||
|
||||
# Use a separate scaLAPACK installation (optional but recommended in combination with OpenMPI)
|
||||
# Comment out the two lines below if you want to use scaLAPACK from MKL instead
|
||||
#SCALAPACK_ROOT ?= /path/to/your/scalapack/installation
|
||||
#LLIBS_MKL = -L$(SCALAPACK_ROOT)/lib -lscalapack -L$(MKLROOT)/lib/intel64 -Wl,--no-as-needed -lmkl_gf_lp64 -lmkl_gnu_thread -lmkl_core -lgomp -lpthread -lm -ldl
|
||||
|
||||
LLIBS += $(LLIBS_MKL)
|
||||
|
||||
# HDF5-support (optional but strongly recommended)
|
||||
CPP_OPTIONS+= -DVASP_HDF5
|
||||
HDF5_ROOT ?= /path/to/your/hdf5/installation
|
||||
LLIBS += -L$(HDF5_ROOT)/lib -lhdf5_fortran
|
||||
INCS += -I$(HDF5_ROOT)/include
|
||||
|
||||
# For the VASP-2-Wannier90 interface (optional)
|
||||
CPP_OPTIONS += -DVASP2WANNIER90
|
||||
WANNIER90_ROOT ?= /path/to/your/wannier90/installation
|
||||
LLIBS += -L$(WANNIER90_ROOT)/lib -lwannier
|
||||
|
||||
# For the fftlib library (hardly any benefit in combination with MKL's FFTs)
|
||||
#CPP_OPTIONS+= -Dsysv
|
||||
#FCL += fftlib.o
|
||||
#CXX_FFTLIB = g++ -fopenmp -std=c++11 -DFFTLIB_USE_MKL -DFFTLIB_THREADSAFE
|
||||
#INCS_FFTLIB = -I./include -I$(MKLROOT)/include/fftw
|
||||
#LIBS += fftlib
|
||||
#LLIBS += -ldl
|
||||
@@ -1,87 +0,0 @@
|
||||
# Default precompiler options
|
||||
CPP_OPTIONS = -DHOST=\"LinuxGNU\" \
|
||||
-DMPI -DMPI_BLOCK=8000 -Duse_collective \
|
||||
-DscaLAPACK \
|
||||
-DCACHE_SIZE=4000 \
|
||||
-Davoidalloc \
|
||||
-Dvasp6 \
|
||||
-Duse_bse_te \
|
||||
-Dtbdyn \
|
||||
-Dfock_dblbuf \
|
||||
-D_OPENMP -Duse_shmem -Dshmem_bcast_buffer -Dshmem_rproj
|
||||
|
||||
CPP = gcc -E -C -w $*$(FUFFIX) >$*$(SUFFIX) $(CPP_OPTIONS)
|
||||
|
||||
FC = mpif90 -fopenmp
|
||||
FCL = mpif90 -fopenmp
|
||||
|
||||
FREE = -ffree-form -ffree-line-length-none
|
||||
|
||||
FFLAGS = -w -ffpe-summary=none
|
||||
|
||||
OFLAG = -O3
|
||||
OFLAG_IN = $(OFLAG)
|
||||
DEBUG = -O0
|
||||
|
||||
OBJECTS = fftmpiw.o fftmpi_map.o fftw3d.o fft3dlib.o
|
||||
OBJECTS_O1 += fftw3d.o fftmpi.o fftmpiw.o
|
||||
OBJECTS_O2 += fft3dlib.o
|
||||
|
||||
# For what used to be vasp.5.lib
|
||||
CPP_LIB = $(CPP)
|
||||
FC_LIB = $(FC)
|
||||
CC_LIB = gcc
|
||||
CFLAGS_LIB = -O
|
||||
FFLAGS_LIB = -O1
|
||||
FREE_LIB = $(FREE)
|
||||
|
||||
OBJECTS_LIB = linpack_double.o getshmem.o
|
||||
|
||||
# For the parser library
|
||||
CXX_PARS = g++
|
||||
LLIBS = -lstdc++
|
||||
|
||||
##
|
||||
## Customize as of this point! Of course you may change the preceding
|
||||
## part of this file as well if you like, but it should rarely be
|
||||
## necessary ...
|
||||
##
|
||||
|
||||
# When compiling on the target machine itself, change this to the
|
||||
# relevant target when cross-compiling for another architecture
|
||||
# VASP_TARGET_CPU ?= -march=native
|
||||
# FFLAGS += $(VASP_TARGET_CPU)
|
||||
|
||||
# For gcc-10 and higher (comment out for older versions)
|
||||
FFLAGS += -fallow-argument-mismatch
|
||||
|
||||
# Intel MKL for FFTW, BLAS, LAPACK, and scaLAPACK
|
||||
MKLROOT ?= /path/to/your/mkl/installation
|
||||
LLIBS_MKL = -L$(MKLROOT)/lib/intel64 -Wl,--no-as-needed -lmkl_gf_lp64 -lmkl_gnu_thread -lmkl_core -lmkl_scalapack_lp64 -lmkl_blacs_openmpi_lp64 -lgomp -lpthread -lm -ldl
|
||||
INCS = -I$(MKLROOT)/include/fftw
|
||||
|
||||
# Use a separate scaLAPACK installation (optional but recommended in combination with OpenMPI)
|
||||
# Comment out the two lines below if you want to use scaLAPACK from MKL instead
|
||||
#SCALAPACK_ROOT ?= /path/to/your/scalapack/installation
|
||||
#LLIBS_MKL = -L$(SCALAPACK_ROOT)/lib -lscalapack -L$(MKLROOT)/lib/intel64 -Wl,--no-as-needed -lmkl_gf_lp64 -lmkl_gnu_thread -lmkl_core -lgomp -lpthread -lm -ldl
|
||||
|
||||
LLIBS += $(LLIBS_MKL)
|
||||
|
||||
# HDF5-support (optional but strongly recommended)
|
||||
CPP_OPTIONS+= -DVASP_HDF5
|
||||
HDF5_ROOT ?= /path/to/your/hdf5/installation
|
||||
LLIBS += -L$(HDF5_ROOT)/lib -lhdf5_fortran
|
||||
INCS += -I$(HDF5_ROOT)/include
|
||||
|
||||
# For the VASP-2-Wannier90 interface (optional)
|
||||
CPP_OPTIONS += -DVASP2WANNIER90
|
||||
WANNIER90_ROOT ?= /path/to/your/wannier90/installation
|
||||
LLIBS += -L$(WANNIER90_ROOT)/lib -lwannier
|
||||
|
||||
# For the fftlib library (hardly any benefit in combination with MKL's FFTs)
|
||||
#CPP_OPTIONS+= -Dsysv
|
||||
#FCL += fftlib.o
|
||||
#CXX_FFTLIB = g++ -fopenmp -std=c++11 -DFFTLIB_USE_MKL -DFFTLIB_THREADSAFE
|
||||
#INCS_FFTLIB = -I./include -I$(MKLROOT)/include/fftw
|
||||
#LIBS += fftlib
|
||||
#LLIBS += -ldl
|
||||
@@ -1,56 +1,47 @@
|
||||
{
|
||||
stdenvNoCC, requireFile, writeShellApplication,
|
||||
rsync, blas, scalapack, mpi, openmp, gfortran, gcc, fftwMpi, hdf5, wannier90,
|
||||
additionalCommands ? ""
|
||||
stdenvNoCC, writeShellApplication, src,
|
||||
rsync, blas, scalapack, mpi, openmp, gfortran, gcc, fftwMpi, hdf5, wannier90
|
||||
}:
|
||||
let
|
||||
sources = import ../source.nix { inherit requireFile; };
|
||||
include = version: ./makefile.include-${version};
|
||||
vasp = version: stdenvNoCC.mkDerivation rec
|
||||
{
|
||||
pname = "vasp-gnu";
|
||||
inherit version;
|
||||
src = sources.${version};
|
||||
configurePhase =
|
||||
''
|
||||
cp ${include version} makefile.include
|
||||
cp ${../constr_cell_relax.F} src/constr_cell_relax.F
|
||||
mkdir -p bin
|
||||
'';
|
||||
enableParallelBuilding = true;
|
||||
makeFlags = "DEPS=1";
|
||||
buildInputs = [ blas scalapack mpi openmp fftwMpi.dev fftwMpi hdf5 hdf5.dev wannier90 ];
|
||||
nativeBuildInputs = [ rsync gfortran gfortran.cc gcc ];
|
||||
FFTW_ROOT = fftwMpi.dev;
|
||||
HDF5_ROOT = hdf5.dev;
|
||||
WANNIER90_ROOT = wannier90;
|
||||
installPhase =
|
||||
''
|
||||
mkdir -p $out/bin
|
||||
for i in std gam ncl; do
|
||||
cp bin/vasp_$i $out/bin/vasp-$i
|
||||
done
|
||||
'';
|
||||
};
|
||||
startScript = version: writeShellApplication
|
||||
{
|
||||
name = "vasp-gnu-${builtins.replaceStrings ["."] [""] version}-env";
|
||||
runtimeInputs = [(vasp version)];
|
||||
text =
|
||||
''
|
||||
# if OMP_NUM_THREADS is not set, set it according to SLURM_CPUS_PER_TASK or to 1
|
||||
if [ -z "''${OMP_NUM_THREADS-}" ]; then
|
||||
if [ -n "''${SLURM_CPUS_PER_TASK-}" ]; then
|
||||
OMP_NUM_THREADS=$SLURM_CPUS_PER_TASK
|
||||
else
|
||||
OMP_NUM_THREADS=1
|
||||
fi
|
||||
let vasp = stdenvNoCC.mkDerivation
|
||||
{
|
||||
name = "vasp-gnu";
|
||||
inherit src;
|
||||
configurePhase =
|
||||
''
|
||||
cp ${./makefile.include} makefile.include
|
||||
cp ${../constr_cell_relax.F} src/constr_cell_relax.F
|
||||
'';
|
||||
enableParallelBuilding = true;
|
||||
makeFlags = "DEPS=1";
|
||||
buildInputs = [ blas scalapack mpi openmp fftwMpi.dev fftwMpi hdf5 hdf5.dev wannier90 ];
|
||||
nativeBuildInputs = [ rsync gfortran gfortran.cc gcc ];
|
||||
FFTW_ROOT = fftwMpi.dev;
|
||||
HDF5_ROOT = hdf5.dev;
|
||||
WANNIER90_ROOT = wannier90;
|
||||
installPhase =
|
||||
''
|
||||
mkdir -p $out/bin
|
||||
for i in std gam ncl; do
|
||||
cp bin/vasp_$i $out/bin/vasp-$i
|
||||
done
|
||||
'';
|
||||
};
|
||||
in writeShellApplication
|
||||
{
|
||||
name = "vasp-gnu-env";
|
||||
runtimeInputs = [ vasp ];
|
||||
text =
|
||||
''
|
||||
# if OMP_NUM_THREADS is not set, set it according to SLURM_CPUS_PER_TASK or to 1
|
||||
if [ -z "''${OMP_NUM_THREADS-}" ]; then
|
||||
if [ -n "''${SLURM_CPUS_PER_TASK-}" ]; then
|
||||
OMP_NUM_THREADS=$SLURM_CPUS_PER_TASK
|
||||
else
|
||||
OMP_NUM_THREADS=1
|
||||
fi
|
||||
export OMP_NUM_THREADS
|
||||
fi
|
||||
export OMP_NUM_THREADS
|
||||
|
||||
${additionalCommands}
|
||||
|
||||
exec "$@"
|
||||
'';
|
||||
};
|
||||
in builtins.mapAttrs (version: _: startScript version) sources
|
||||
exec "$@"
|
||||
'';
|
||||
}
|
||||
|
||||
@@ -49,38 +49,29 @@ LLIBS = -lstdc++
|
||||
|
||||
# When compiling on the target machine itself, change this to the
|
||||
# relevant target when cross-compiling for another architecture
|
||||
# VASP_TARGET_CPU ?= -march=native
|
||||
# FFLAGS += $(VASP_TARGET_CPU)
|
||||
|
||||
# For gcc-10 and higher (comment out for older versions)
|
||||
FFLAGS += -fallow-argument-mismatch
|
||||
|
||||
# BLAS and LAPACK (mandatory)
|
||||
# OPENBLAS_ROOT ?= /path/to/your/openblas/installation
|
||||
# BLASPACK = -L$(OPENBLAS_ROOT)/lib -lopenblas
|
||||
BLASPACK = -lblas
|
||||
|
||||
# scaLAPACK (mandatory)
|
||||
# SCALAPACK_ROOT ?= /path/to/your/scalapack/installation
|
||||
# SCALAPACK = -L$(SCALAPACK_ROOT)/lib -lscalapack
|
||||
SCALAPACK = -lscalapack
|
||||
|
||||
LLIBS += $(SCALAPACK) $(BLASPACK)
|
||||
|
||||
# FFTW (mandatory)
|
||||
FFTW_ROOT ?= /path/to/your/fftw/installation
|
||||
LLIBS += -L$(FFTW_ROOT)/lib -lfftw3 -lfftw3_omp
|
||||
INCS += -I$(FFTW_ROOT)/include
|
||||
|
||||
# HDF5-support (optional but strongly recommended)
|
||||
CPP_OPTIONS+= -DVASP_HDF5
|
||||
HDF5_ROOT ?= /path/to/your/hdf5/installation
|
||||
LLIBS += -L$(HDF5_ROOT)/lib -lhdf5_fortran
|
||||
INCS += -I$(HDF5_ROOT)/include
|
||||
|
||||
# For the VASP-2-Wannier90 interface (optional)
|
||||
CPP_OPTIONS += -DVASP2WANNIER90
|
||||
WANNIER90_ROOT ?= /path/to/your/wannier90/installation
|
||||
LLIBS += -L$(WANNIER90_ROOT)/lib -lwannier
|
||||
|
||||
# For the fftlib library (recommended)
|
||||
@@ -1,92 +0,0 @@
|
||||
# Default precompiler options
|
||||
CPP_OPTIONS = -DHOST=\"LinuxGNU\" \
|
||||
-DMPI -DMPI_BLOCK=8000 -Duse_collective \
|
||||
-DscaLAPACK \
|
||||
-DCACHE_SIZE=4000 \
|
||||
-Davoidalloc \
|
||||
-Dvasp6 \
|
||||
-Duse_bse_te \
|
||||
-Dtbdyn \
|
||||
-Dfock_dblbuf \
|
||||
-D_OPENMP -Duse_shmem -Dshmem_bcast_buffer -Dshmem_rproj
|
||||
|
||||
CPP = gcc -E -C -w $*$(FUFFIX) >$*$(SUFFIX) $(CPP_OPTIONS)
|
||||
|
||||
FC = mpif90 -fopenmp
|
||||
FCL = mpif90 -fopenmp
|
||||
|
||||
FREE = -ffree-form -ffree-line-length-none
|
||||
|
||||
FFLAGS = -w -ffpe-summary=none
|
||||
|
||||
OFLAG = -O3
|
||||
OFLAG_IN = $(OFLAG)
|
||||
DEBUG = -O0
|
||||
|
||||
OBJECTS = fftmpiw.o fftmpi_map.o fftw3d.o fft3dlib.o
|
||||
OBJECTS_O1 += fftw3d.o fftmpi.o fftmpiw.o
|
||||
OBJECTS_O2 += fft3dlib.o
|
||||
|
||||
# For what used to be vasp.5.lib
|
||||
CPP_LIB = $(CPP)
|
||||
FC_LIB = $(FC)
|
||||
CC_LIB = gcc
|
||||
CFLAGS_LIB = -O
|
||||
FFLAGS_LIB = -O1
|
||||
FREE_LIB = $(FREE)
|
||||
|
||||
OBJECTS_LIB = linpack_double.o getshmem.o
|
||||
|
||||
# For the parser library
|
||||
CXX_PARS = g++
|
||||
LLIBS = -lstdc++
|
||||
|
||||
##
|
||||
## Customize as of this point! Of course you may change the preceding
|
||||
## part of this file as well if you like, but it should rarely be
|
||||
## necessary ...
|
||||
##
|
||||
|
||||
# When compiling on the target machine itself, change this to the
|
||||
# relevant target when cross-compiling for another architecture
|
||||
# VASP_TARGET_CPU ?= -march=native
|
||||
# FFLAGS += $(VASP_TARGET_CPU)
|
||||
|
||||
# For gcc-10 and higher (comment out for older versions)
|
||||
FFLAGS += -fallow-argument-mismatch
|
||||
|
||||
# BLAS and LAPACK (mandatory)
|
||||
# OPENBLAS_ROOT ?= /path/to/your/openblas/installation
|
||||
# BLASPACK = -L$(OPENBLAS_ROOT)/lib -lopenblas
|
||||
BLASPACK = -lblas
|
||||
|
||||
# scaLAPACK (mandatory)
|
||||
# SCALAPACK_ROOT ?= /path/to/your/scalapack/installation
|
||||
# SCALAPACK = -L$(SCALAPACK_ROOT)/lib -lscalapack
|
||||
SCALAPACK = -lscalapack
|
||||
|
||||
LLIBS += $(SCALAPACK) $(BLASPACK)
|
||||
|
||||
# FFTW (mandatory)
|
||||
FFTW_ROOT ?= /path/to/your/fftw/installation
|
||||
LLIBS += -L$(FFTW_ROOT)/lib -lfftw3 -lfftw3_omp
|
||||
INCS += -I$(FFTW_ROOT)/include
|
||||
|
||||
# HDF5-support (optional but strongly recommended)
|
||||
CPP_OPTIONS+= -DVASP_HDF5
|
||||
HDF5_ROOT ?= /path/to/your/hdf5/installation
|
||||
LLIBS += -L$(HDF5_ROOT)/lib -lhdf5_fortran
|
||||
INCS += -I$(HDF5_ROOT)/include
|
||||
|
||||
# For the VASP-2-Wannier90 interface (optional)
|
||||
CPP_OPTIONS += -DVASP2WANNIER90
|
||||
WANNIER90_ROOT ?= /path/to/your/wannier90/installation
|
||||
LLIBS += -L$(WANNIER90_ROOT)/lib -lwannier
|
||||
|
||||
# For the fftlib library (recommended)
|
||||
CPP_OPTIONS+= -Dsysv
|
||||
FCL += fftlib.o
|
||||
CXX_FFTLIB = g++ -fopenmp -std=c++11 -DFFTLIB_THREADSAFE
|
||||
INCS_FFTLIB = -I./include -I$(FFTW_ROOT)/include
|
||||
LIBS += fftlib
|
||||
LLIBS += -ldl
|
||||
@@ -1,46 +0,0 @@
|
||||
{
|
||||
buildFHSEnv, writeScript, stdenvNoCC,
|
||||
src,
|
||||
aocc, cmake, openmpi, zlib, gcc, glibc, binutils, pkg-config
|
||||
}:
|
||||
let
|
||||
buildEnv = buildFHSEnv
|
||||
{
|
||||
name = "buildEnv";
|
||||
targetPkgs = _: [ zlib aocc gcc.cc.lib.lib glibc.dev binutils.bintools openmpi pkg-config ];
|
||||
extraBwrapArgs = [ "--bind" "$out" "$out" ];
|
||||
};
|
||||
buildScript = writeScript "build"
|
||||
''
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -DCMAKE_INSTALL_PREFIX=$out -DHDF5_INSTALL_CMAKE_DIR=$out/lib/cmake \
|
||||
-DHDF5_BUILD_FORTRAN=ON -DHDF5_ENABLE_PARALLEL=ON ..
|
||||
make -j$NIX_BUILD_CORES
|
||||
make install
|
||||
'';
|
||||
in stdenvNoCC.mkDerivation
|
||||
{
|
||||
name = "hdf5-aocc";
|
||||
inherit src;
|
||||
dontConfigure = true;
|
||||
enableParallelBuilding = true;
|
||||
nativeBuildInputs = [ cmake ];
|
||||
CC = "clang";
|
||||
CXX = "clang++";
|
||||
FC = "flang";
|
||||
OMPI_CC = "clang";
|
||||
OMPI_CXX = "clang++";
|
||||
OMPI_FC = "flang";
|
||||
CFLAGS = "-march=${stdenvNoCC.hostPlatform.gcc.arch} -O2";
|
||||
CXXFLAGS = "-march=${stdenvNoCC.hostPlatform.gcc.arch} -O2";
|
||||
FCFLAGS = "-march=${stdenvNoCC.hostPlatform.gcc.arch} -O2";
|
||||
buildPhase =
|
||||
''
|
||||
mkdir -p $out
|
||||
${buildEnv}/bin/buildEnv ${buildScript}
|
||||
'';
|
||||
dontInstall = true;
|
||||
dontFixup = true;
|
||||
requiredSystemFeatures = [ "gccarch-exact-${stdenvNoCC.hostPlatform.gcc.arch}" "big-parallel" ];
|
||||
}
|
||||
@@ -36,5 +36,5 @@ in stdenvNoCC.mkDerivation
|
||||
'';
|
||||
dontInstall = true;
|
||||
dontFixup = true;
|
||||
requiredSystemFeatures = [ "gccarch-exact-${stdenvNoCC.hostPlatform.gcc.arch}" "big-parallel" ];
|
||||
requiredSystemFeatures = [ "gccarch-exact-${stdenvNoCC.hostPlatform.gcc.arch}" ];
|
||||
}
|
||||
|
||||
@@ -44,5 +44,5 @@ in stdenvNoCC.mkDerivation
|
||||
'';
|
||||
dontInstall = true;
|
||||
dontFixup = true;
|
||||
requiredSystemFeatures = [ "gccarch-exact-${stdenvNoCC.hostPlatform.gcc.arch}" "big-parallel" ];
|
||||
requiredSystemFeatures = [ "gccarch-exact-${stdenvNoCC.hostPlatform.gcc.arch}" ];
|
||||
}
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
{
|
||||
buildFHSEnv, writeScript, stdenvNoCC, requireFile, substituteAll, symlinkJoin, writeTextDir,
|
||||
config, oneapiArch ? config.oneapiArch or "SSE3", additionalCommands ? "",
|
||||
oneapi, gcc, glibc, lmod, rsync, which, wannier90, binutils, hdf5, zlib
|
||||
buildFHSEnv, writeScript, stdenvNoCC, substituteAll, symlinkJoin, writeTextDir, src,
|
||||
config, oneapiArch ? config.oneapiArch or "SSE3",
|
||||
oneapi, gcc, glibc, lmod, rsync, which, wannier90, binutils, hdf5, zlib, vtst
|
||||
}:
|
||||
let
|
||||
sources = import ../source.nix { inherit requireFile; };
|
||||
buildEnv = buildFHSEnv
|
||||
{
|
||||
name = "buildEnv";
|
||||
@@ -17,24 +16,22 @@ let
|
||||
module use ${oneapi}/share/intel/modulefiles
|
||||
module load tbb compiler-rt oclfpga # dependencies
|
||||
module load mpi mkl compiler
|
||||
mkdir -p bin
|
||||
make DEPS=1 -j$NIX_BUILD_CORES
|
||||
'';
|
||||
include = version: substituteAll
|
||||
{
|
||||
src = ./makefile.include-${version};
|
||||
inherit oneapiArch;
|
||||
};
|
||||
include = substituteAll { src = ./makefile.include; inherit oneapiArch; };
|
||||
gccFull = symlinkJoin { name = "gcc"; paths = [ gcc gcc.cc gcc.cc.lib glibc.dev binutils.bintools ]; };
|
||||
vasp = version: stdenvNoCC.mkDerivation rec
|
||||
vasp = stdenvNoCC.mkDerivation
|
||||
{
|
||||
pname = "vasp-intel";
|
||||
inherit version;
|
||||
src = sources.${version};
|
||||
name = "vasp-intel";
|
||||
inherit src;
|
||||
patches = [ ../vtst.patch ];
|
||||
configurePhase =
|
||||
''
|
||||
cp ${include version} makefile.include
|
||||
cp ${include} makefile.include
|
||||
chmod +w makefile.include
|
||||
cp ${../constr_cell_relax.F} src/constr_cell_relax.F
|
||||
cp -r ${vtst}/* src
|
||||
chmod -R +w src
|
||||
'';
|
||||
nativeBuildInputs = [ rsync which ];
|
||||
HDF5_ROOT = hdf5;
|
||||
@@ -46,9 +43,9 @@ let
|
||||
for i in std gam ncl; do cp bin/vasp_$i $out/bin/vasp-$i; done
|
||||
'';
|
||||
dontFixup = true;
|
||||
requiredSystemFeatures = [ "gccarch-exact-${stdenvNoCC.hostPlatform.gcc.arch}" "big-parallel" ];
|
||||
requiredSystemFeatures = [ "gccarch-exact-${stdenvNoCC.hostPlatform.gcc.arch}" ];
|
||||
};
|
||||
startScript = { version, variant }: writeScript "vasp-intel-${version}"
|
||||
startScript = variant: writeScript "vasp-intel"
|
||||
''
|
||||
. ${lmod}/share/lmod/lmod/init/bash
|
||||
module use ${oneapi}/share/intel/modulefiles
|
||||
@@ -82,30 +79,26 @@ let
|
||||
# set OMP_STACKSIZE if not set
|
||||
export OMP_STACKSIZE=''${OMP_STACKSIZE-512M}
|
||||
|
||||
${additionalCommands}
|
||||
|
||||
${
|
||||
if variant == "env" then ''exec "$@"''
|
||||
else
|
||||
''
|
||||
if [ -n "''${SLURM_JOB_ID-}" ]; then
|
||||
exec mpirun -n $SLURM_NTASKS ${vasp version}/bin/vasp-${variant}
|
||||
exec mpirun -n $SLURM_NTASKS ${vasp}/bin/vasp-${variant}
|
||||
else
|
||||
exec mpirun -n 1 ${vasp version}/bin/vasp-${variant}
|
||||
exec mpirun -n 1 ${vasp}/bin/vasp-${variant}
|
||||
fi
|
||||
''
|
||||
}
|
||||
'';
|
||||
runEnv = { version, variant }: let shortVersion = builtins.replaceStrings ["."] [""] version; in buildFHSEnv
|
||||
runEnv = variant: buildFHSEnv
|
||||
{
|
||||
name = "vasp-intel-${shortVersion}${if variant == "" then "" else "-${variant}"}";
|
||||
targetPkgs = _: [ zlib (vasp version) (writeTextDir "etc/release" "") gccFull ];
|
||||
runScript = startScript { inherit version; variant = if variant == "" then "std" else variant; };
|
||||
name = "vasp-intel${if variant == "" then "" else "-${variant}"}";
|
||||
targetPkgs = _: [ zlib vasp (writeTextDir "etc/release" "") gccFull ];
|
||||
runScript = startScript (if variant == "" then "std" else variant);
|
||||
};
|
||||
in builtins.mapAttrs
|
||||
(version: _: symlinkJoin
|
||||
{
|
||||
name = "vasp-intel-${version}";
|
||||
paths = builtins.map (variant: runEnv { inherit version variant; }) [ "" "env" "std" "gam" "ncl" ];
|
||||
})
|
||||
sources
|
||||
in symlinkJoin
|
||||
{
|
||||
name = "vasp-intel";
|
||||
paths = builtins.map (variant: runEnv variant) [ "" "env" "std" "gam" "ncl" ];
|
||||
}
|
||||
|
||||
@@ -52,32 +52,24 @@ LLIBS = -lstdc++
|
||||
VASP_TARGET_CPU ?= -x@oneapiArch@
|
||||
FFLAGS += $(VASP_TARGET_CPU)
|
||||
|
||||
# Intel MKL for FFTW, BLAS, LAPACK, and scaLAPACK
|
||||
# Intel MKL (FFTW, BLAS, LAPACK, and scaLAPACK)
|
||||
# (Note: for Intel Parallel Studio's MKL use -mkl instead of -qmkl)
|
||||
FCL += -qmkl
|
||||
MKLROOT ?= /path/to/your/mkl/installation
|
||||
MKLROOT ?= /path/to/your/mkl/installation
|
||||
LLIBS += -L$(MKLROOT)/lib/intel64 -lmkl_scalapack_lp64 -lmkl_blacs_intelmpi_lp64
|
||||
INCS =-I$(MKLROOT)/include/fftw
|
||||
|
||||
# Use a separate scaLAPACK installation (optional but recommended in combination with OpenMPI)
|
||||
# Comment out the two lines below if you want to use scaLAPACK from MKL instead
|
||||
# SCALAPACK_ROOT ?= /path/to/your/scalapack/installation
|
||||
# LLIBS += -L${SCALAPACK_ROOT}/lib -lscalapack
|
||||
|
||||
# HDF5-support (optional but strongly recommended)
|
||||
CPP_OPTIONS+= -DVASP_HDF5
|
||||
HDF5_ROOT ?= /path/to/your/hdf5/installation
|
||||
LLIBS += -L$(HDF5_ROOT)/lib -lhdf5_fortran
|
||||
INCS += -I$(HDF5_ROOT)/include
|
||||
|
||||
# For the VASP-2-Wannier90 interface (optional)
|
||||
CPP_OPTIONS += -DVASP2WANNIER90
|
||||
WANNIER90_ROOT ?= /path/to/your/wannier90/installation
|
||||
LLIBS += -L$(WANNIER90_ROOT)/lib -lwannier
|
||||
|
||||
# For the fftlib library (hardly any benefit in combination with MKL's FFTs)
|
||||
#CPP_OPTION += -Dsysv
|
||||
#FCL = mpif90 fftlib.o -qmkl
|
||||
#FCL = mpiifort fftlib.o -qmkl
|
||||
#CXX_FFTLIB = icpc -qopenmp -std=c++11 -DFFTLIB_USE_MKL -DFFTLIB_THREADSAFE
|
||||
#INCS_FFTLIB = -I./include -I$(MKLROOT)/include/fftw
|
||||
#LIBS += fftlib
|
||||
@@ -1,83 +0,0 @@
|
||||
# Default precompiler options
|
||||
CPP_OPTIONS = -DHOST=\"LinuxIFC\" \
|
||||
-DMPI -DMPI_BLOCK=8000 -Duse_collective \
|
||||
-DscaLAPACK \
|
||||
-DCACHE_SIZE=4000 \
|
||||
-Davoidalloc \
|
||||
-Dvasp6 \
|
||||
-Duse_bse_te \
|
||||
-Dtbdyn \
|
||||
-Dfock_dblbuf \
|
||||
-D_OPENMP -Duse_shmem -Dshmem_bcast_buffer -Dshmem_rproj
|
||||
|
||||
CPP = fpp -f_com=no -free -w0 $*$(FUFFIX) $*$(SUFFIX) $(CPP_OPTIONS)
|
||||
|
||||
FC = mpiifx -qopenmp
|
||||
FCL = mpiifx
|
||||
|
||||
FREE = -free -names lowercase
|
||||
|
||||
FFLAGS = -assume byterecl -w
|
||||
|
||||
OFLAG = -O2
|
||||
OFLAG_IN = $(OFLAG)
|
||||
DEBUG = -O0
|
||||
|
||||
OBJECTS = fftmpiw.o fftmpi_map.o fftw3d.o fft3dlib.o
|
||||
OBJECTS_O1 += fftw3d.o fftmpi.o fftmpiw.o
|
||||
OBJECTS_O2 += fft3dlib.o
|
||||
|
||||
# For what used to be vasp.5.lib
|
||||
CPP_LIB = $(CPP)
|
||||
FC_LIB = $(FC)
|
||||
CC_LIB = icx
|
||||
CFLAGS_LIB = -O
|
||||
FFLAGS_LIB = -O1
|
||||
FREE_LIB = $(FREE)
|
||||
|
||||
OBJECTS_LIB = linpack_double.o getshmem.o
|
||||
|
||||
# For the parser library
|
||||
CXX_PARS = icpx
|
||||
LLIBS = -lstdc++
|
||||
|
||||
##
|
||||
## Customize as of this point! Of course you may change the preceding
|
||||
## part of this file as well if you like, but it should rarely be
|
||||
## necessary ...
|
||||
##
|
||||
|
||||
# When compiling on the target machine itself, change this to the
|
||||
# relevant target when cross-compiling for another architecture
|
||||
VASP_TARGET_CPU ?= -x@oneapiArch@
|
||||
FFLAGS += $(VASP_TARGET_CPU)
|
||||
|
||||
# Intel MKL for FFTW, BLAS, LAPACK, and scaLAPACK
|
||||
# (Note: for Intel Parallel Studio's MKL use -mkl instead of -qmkl)
|
||||
FCL += -qmkl
|
||||
MKLROOT ?= /path/to/your/mkl/installation
|
||||
LLIBS += -L$(MKLROOT)/lib/intel64 -lmkl_scalapack_lp64 -lmkl_blacs_intelmpi_lp64
|
||||
INCS =-I$(MKLROOT)/include/fftw
|
||||
|
||||
# Use a separate scaLAPACK installation (optional but recommended in combination with OpenMPI)
|
||||
# Comment out the two lines below if you want to use scaLAPACK from MKL instead
|
||||
# SCALAPACK_ROOT ?= /path/to/your/scalapack/installation
|
||||
# LLIBS += -L${SCALAPACK_ROOT}/lib -lscalapack
|
||||
|
||||
# HDF5-support (optional but strongly recommended)
|
||||
CPP_OPTIONS+= -DVASP_HDF5
|
||||
HDF5_ROOT ?= /path/to/your/hdf5/installation
|
||||
LLIBS += -L$(HDF5_ROOT)/lib -lhdf5_fortran
|
||||
INCS += -I$(HDF5_ROOT)/include
|
||||
|
||||
# For the VASP-2-Wannier90 interface (optional)
|
||||
CPP_OPTIONS += -DVASP2WANNIER90
|
||||
WANNIER90_ROOT ?= /path/to/your/wannier90/installation
|
||||
LLIBS += -L$(WANNIER90_ROOT)/lib -lwannier
|
||||
|
||||
# For the fftlib library (hardly any benefit in combination with MKL's FFTs)
|
||||
#CPP_OPTION += -Dsysv
|
||||
#FCL = mpif90 fftlib.o -qmkl
|
||||
#CXX_FFTLIB = icpc -qopenmp -std=c++11 -DFFTLIB_USE_MKL -DFFTLIB_THREADSAFE
|
||||
#INCS_FFTLIB = -I./include -I$(MKLROOT)/include/fftw
|
||||
#LIBS += fftlib
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user