mirror of
https://github.com/CHN-beta/nixos.git
synced 2026-01-11 23:09:22 +08:00
Compare commits
1058 Commits
29fef229d8
...
server
| Author | SHA1 | Date | |
|---|---|---|---|
| 1c1793dd62 | |||
| 9b5ccd0747 | |||
| ca299e0346 | |||
| 34e55061a2 | |||
| ec2540a628 | |||
| fef4d06de1 | |||
| 0e4f1d06a9 | |||
| a519d7426f | |||
| a89fe55896 | |||
| ed349970c2 | |||
| 5c9774e906 | |||
| 76414e846e | |||
| 00e693b7c8 | |||
| e6a5cd695e | |||
| e3c2861cf5 | |||
| 01eee80cd2 | |||
| 4d69011483 | |||
| 09cbc8cecd | |||
| 52c6f7b599 | |||
| 952735986d | |||
| 617759b885 | |||
| c9fed73dcb | |||
| 8bdef9e7f5 | |||
| ea4670fde6 | |||
| 4f26f648f0 | |||
| 959ca6c9b6 | |||
| babb01cd42 | |||
| 1ef3245e52 | |||
| 2f096af374 | |||
| af2f8ddb3e | |||
| 2723044b35 | |||
| 4a6d58e6a2 | |||
| 93d2999523 | |||
| 1ded318fed | |||
| be69db5925 | |||
| 5791b79245 | |||
| 094df77b5b | |||
| c9778ac500 | |||
| 3078090edf | |||
| 3767de3c2a | |||
| 6fc897d5b2 | |||
| 0575ba1cc4 | |||
| 96b58c16fe | |||
| 32e1004a2d | |||
| 85b4404e7a | |||
| f209baaa0f | |||
| 46583151f4 | |||
| 01b766e5ee | |||
| 6f5a077821 | |||
| bc244352b8 | |||
| 2be529f590 | |||
| 843abfbef9 | |||
| e376302c52 | |||
| af8426d40c | |||
| 428d12b7b9 | |||
| 47c77e8ce1 | |||
| 4a1f12adbb | |||
| fc0500c547 | |||
| 632e3baae9 | |||
| c36216802c | |||
| 98f6fef8fe | |||
| 721c34262b | |||
| b56f73d426 | |||
| c4355be79d | |||
| 21f822e5aa | |||
| 2e68c70773 | |||
| 153687806b | |||
| 35253cff0a | |||
| 91b92bd492 | |||
| 0198626002 | |||
| 173dd4a3d7 | |||
| 1854e294cf | |||
| b45a9c7a62 | |||
| 858f4c68aa | |||
| 37e6d70561 | |||
| f101038f4a | |||
| 412fac9692 | |||
| 4c7d17f001 | |||
| e8d80daee2 | |||
| 8aeb290d0f | |||
| 0f37c886a4 | |||
| 5940da526d | |||
| df2ac86e1a | |||
| 8bf7e2cb30 | |||
| 96f7056d16 | |||
| 5cc40727db | |||
| c4f8e5f61c | |||
| 03be19da5a | |||
| 7657fe3d14 | |||
| 9fee2a8e2a | |||
| db1e825cd6 | |||
| 670126ba0c | |||
| 92ddf86df1 | |||
| bd12de34b7 | |||
| a7b0906488 | |||
| 0ce31201a9 | |||
| 58d927b648 | |||
| 5efee599f7 | |||
| 2c833934e7 | |||
| c5dc456c35 | |||
| 7576726fbe | |||
| 6dfd6a8bf0 | |||
| eb68d8f8b1 | |||
| 46ae9f1aac | |||
| bb5aee5545 | |||
| a8833dac7f | |||
| d1b3f84cf3 | |||
| f813ffd053 | |||
| 00c99adca9 | |||
| ef58de9a1d | |||
| b9175a211f | |||
| 0cb7791b84 | |||
| 803af74404 | |||
| c5da42debd | |||
| e16f49b3f3 | |||
| f10c385f13 | |||
| f65ec24862 | |||
| 73261c3e3f | |||
| e50ad89bc2 | |||
| 5f4a79788d | |||
| 1360a3e9fa | |||
| d692bb8baf | |||
| dbcf7093aa | |||
| 7833f37588 | |||
| 673f241490 | |||
| a5be9adb53 | |||
| d6a1da17fb | |||
| 6e0e224530 | |||
| 1a007ab57f | |||
| da76976c3d | |||
| b46f928964 | |||
| 92fdc6c67d | |||
| 2534f35c4d | |||
| f9e376920c | |||
| c335a79b19 | |||
| 2d27006978 | |||
| dd1fb05917 | |||
| 6d814881c4 | |||
| ee18e481ba | |||
| 80ef9571db | |||
| de68b75268 | |||
| 423debe893 | |||
| 076a267ba4 | |||
| 2b88a1e32c | |||
| d8672ea42e | |||
| 7bd6e1f529 | |||
| 3d9af79476 | |||
| 734eedef2a | |||
| dd767f275a | |||
| 416eac129b | |||
| 11171c048a | |||
| e070046fc4 | |||
| b6ee3723d6 | |||
| b731752700 | |||
| 8f09a18dc5 | |||
| 1949ea7d78 | |||
| fb4a9644fc | |||
| 354f7d428e | |||
| 74b6155013 | |||
| 115a7f7753 | |||
| 98eb945684 | |||
| f1c8f8f1bb | |||
| 50da5ffa0b | |||
| b5a4aee761 | |||
| 64532717da | |||
| cc303a082c | |||
| 9e81d5a64f | |||
| c2d54a2b73 | |||
| 4e8452e9e0 | |||
| 9bf65a7a11 | |||
| 861d56ac7a | |||
| d51414e341 | |||
| 61afb76cfe | |||
| 1886f7e647 | |||
| 0a2e7e04e5 | |||
| 7dad1d3ec2 | |||
| 93ad14cc26 | |||
| b39fb0b8e0 | |||
| 30c25c499c | |||
| 4e8b18b417 | |||
| 4779d5e162 | |||
| 3b018c90e6 | |||
| 1dd9a61c95 | |||
| 705a43fa41 | |||
| e01a69e039 | |||
| 682bba4af9 | |||
| b04f527ee1 | |||
| c6d67af8c7 | |||
| 6275f6a519 | |||
| 5baa1ad173 | |||
| 1166dfbbcc | |||
| 5b183a5446 | |||
| 8e3eca38d7 | |||
| f74895585f | |||
| 4a0c5eee5a | |||
| 77296face8 | |||
| eb4cac0f14 | |||
| 7f343ce440 | |||
| 1b42c688ef | |||
| a94a7d368e | |||
| 1429950370 | |||
| f8b5a79afe | |||
| 759b3f7cae | |||
| a9931623b1 | |||
| d0213f48c1 | |||
| 24e8a94e7c | |||
| 0bc485a9b1 | |||
| ba523b61e8 | |||
| c40888a9b9 | |||
| e49d7b4055 | |||
| 4cba5c0160 | |||
| 837c6ff2d5 | |||
| f95c059ece | |||
| f6b40a3f3a | |||
| 5f0ea6f428 | |||
| d90e74c8df | |||
| c3647caacc | |||
| 5a07c21eac | |||
| f31dcbc640 | |||
| 37d90d0ed2 | |||
| 9ef2be228d | |||
| 4a2c0778e3 | |||
| a4c519c882 | |||
| 212869fe29 | |||
| 7afafdaac5 | |||
| 7c6709e70c | |||
| 0e972642be | |||
| 4939db84f0 | |||
| 964028dbe5 | |||
| 307fe81b15 | |||
| 9eea7cb2dc | |||
| 6dca3f3acf | |||
| 9d083566ed | |||
| 02b4a10ceb | |||
| 9617f19292 | |||
| b4b7ebf6fe | |||
| e8a45f91c8 | |||
| 0114927adf | |||
| 5a52292a97 | |||
| 578c2c9646 | |||
| 3059b012f7 | |||
| 9c80e754b2 | |||
| e908765aa8 | |||
| aa050c681a | |||
| e65fa2dc60 | |||
| 6011a2ba9f | |||
| 7281962001 | |||
| 215dbe7669 | |||
| 9f27c9dbc9 | |||
| 37c5678862 | |||
| f414a79a01 | |||
| 6690870fd3 | |||
| be49ac36ac | |||
| 0a55220e4e | |||
| 351623206d | |||
| 8848862e55 | |||
| 9b3db9f446 | |||
| a2166f8090 | |||
| eb01b0532c | |||
| bbad8cc650 | |||
| 779de003aa | |||
| b7ffc2cbe2 | |||
| 74872ec80a | |||
| 6c286cd402 | |||
| a24b38c4a6 | |||
| 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 | |||
| d12e234e71 | |||
| 6ab9fe88ca | |||
| dff2d50f26 | |||
| 55bf66957c | |||
| 0cf1c8f7d2 | |||
| 4d28aa50c7 | |||
| bca081020b | |||
| 379dcd7ba9 | |||
| c7aa418408 | |||
| ce8086a800 | |||
| 4de795bd59 | |||
| 4e7ae53b3d | |||
| 3087681a19 | |||
| 2bdc5b94bc | |||
| 562e51a866 | |||
| 30c7efb426 | |||
| aa278b51a8 | |||
| 392433de5a | |||
| bc368617b9 | |||
| 986dee8d7a | |||
| 83af1576f1 | |||
| 6940dbaf85 | |||
| 9f921d8735 | |||
| 4893999021 | |||
| 016b1e179a | |||
| d51cae120d | |||
| bb9225f236 | |||
| 5e7867a76c | |||
| 400fc0ae03 | |||
| 1d8366517a | |||
| db812b2ab7 | |||
| bb6b65c4d2 | |||
| ff6d0d4af7 | |||
| b04b1375d0 | |||
| 53a2a6ff0c | |||
| bf3eee7931 | |||
| 56d93beb06 | |||
| 707d068b18 | |||
| b5fdd69ebd | |||
| f05e34c864 | |||
| 781da3b465 | |||
| 615d2a4867 | |||
| e69dd36cc3 | |||
| e7a5fe6190 | |||
| b8c4e79183 | |||
| 9b1ec2d09c | |||
| b2666d1fdf | |||
| b3f264a4b6 | |||
| 21614c3b07 | |||
| 6ccdafbdc4 | |||
| b8b93e2b85 | |||
| 5e648574fb | |||
| 3d08a3b498 | |||
| ff4bbd4b48 | |||
| 24d167cb3f | |||
| dda3eb369f | |||
| 60d7cddcb7 | |||
| 6bb54b042c | |||
| 32a38afebb | |||
| 22c31b4511 | |||
| dba0ed975b | |||
| beca8ed39c | |||
| 489a6d8866 | |||
| 2d8dc72c52 | |||
| 8bfde16836 | |||
| a2702a8690 | |||
| 72541d6f77 | |||
| 52459243ed | |||
| 398f4de618 | |||
| 17051ccd12 | |||
| 4c037193cd | |||
| 2331cdc8d3 | |||
| 234f9116f5 | |||
| eb5e634125 | |||
| 06763b5920 | |||
| 50b79be223 | |||
| 2356bbb83b | |||
| 8efdd284a5 | |||
| 6cbe29b4f6 | |||
| 59b7fab8bc | |||
| e636d78fb7 | |||
| 8854f3f775 | |||
| a345125b7c | |||
| 73c8197355 | |||
| 1a5b81a317 | |||
| d97a5a4ada | |||
| 48528c3115 | |||
| 82b13e7574 | |||
| f8cb743b60 | |||
| 2042904cca | |||
| dce1220b24 | |||
| 28f3976a48 | |||
| 8da6495ab7 | |||
| 5c280cb15b | |||
| 4a4d89a9ce | |||
| a5f91fea97 | |||
| 6380195afe | |||
| d804019b54 | |||
| 74c4efaa9c | |||
| cfb7998237 | |||
| cf7151d65b | |||
| b3bcbd99fe | |||
| c964d542b5 | |||
| 9ef099b802 | |||
| 193aa605c6 | |||
| 996c8463da | |||
| f24e139c06 | |||
| c243bb0e12 | |||
| d45d4f05f9 | |||
| 937c2be976 | |||
| 12a2f13ade | |||
| 5b67ec05cf | |||
| 7daf2a0a19 | |||
| 9e31283c30 | |||
| 14a14c8572 | |||
| a73b010701 | |||
| 77e7427c95 | |||
| 8a6935eb59 | |||
| 86f9436872 | |||
| ab6a6f0513 | |||
| 1fe8a11efa | |||
| 199983763c | |||
| bd60bea419 | |||
| 4168a456f8 | |||
| 31af52f129 | |||
| 72c0dbf60a | |||
| 36e6a64e1b | |||
| f3a1a298fa | |||
| da629f2480 | |||
| e8e316b8bb | |||
| 51077626dc | |||
| 584298407d | |||
| 176ec68189 | |||
| e922d8c19a | |||
| bbc8071fa4 | |||
| 23f92b206b | |||
| 8e2c742340 | |||
| 55b26b28aa | |||
| a05a5f8792 | |||
| 6ede310d9f | |||
| 8469e4ae50 | |||
| d44c026ab4 | |||
| 9de690ef37 | |||
| 3a78bf355c | |||
| 3805b34055 | |||
| f899852185 | |||
| 20d73a7928 | |||
| 87646c470d | |||
| 408d9e63a8 | |||
| 0a35bb6de8 | |||
| c273d0422b | |||
| 326d384275 | |||
| 079c97a064 | |||
| ccc5727723 | |||
| 2728a53b43 | |||
| 0f53e77a87 | |||
| 1a77615cd8 | |||
| 1a944085e2 | |||
| 2390edb22f | |||
| cce3917e26 | |||
| 182481d4d5 | |||
| 87caab3535 | |||
| fc93afc10a | |||
| fe56da23eb | |||
| d4dadea0f9 | |||
| 7817f832be | |||
| eb85700981 | |||
| 0317d0361f | |||
| 5357b73c29 | |||
| d5ddd05437 | |||
| ffb0a5d622 | |||
| 02faddaf7b | |||
| c17c173654 | |||
| 8148570b89 | |||
| 712c290357 | |||
| d53a82366b | |||
| 3a269a9897 | |||
| 499f2e0fb3 | |||
| bd5ab4758f | |||
| ed651581b4 | |||
| 2b32d0b57c | |||
| 075a5f255f | |||
| a424e65001 | |||
| 097010113d | |||
| f9f0d5137a | |||
| 22d557b12c | |||
| 2dd85db093 | |||
| 41d3ca3dbe | |||
| 409091a2e3 | |||
| 2d3c9a93f7 | |||
| a146636de2 | |||
| b45c68a431 | |||
| b07e09c94e | |||
| e9413380d4 | |||
| a0ae0522d7 | |||
| 2f59817b22 | |||
| 265b3d89b0 | |||
| 2e8030fd5d | |||
| 2c472400c8 | |||
| 3edf4d340c | |||
| 10b922975e | |||
| fff970f2a5 | |||
| 19ab6c378e | |||
| f75c150bc6 | |||
| 2597870de1 | |||
| 34cfe8cdd3 | |||
| cdd691ba1c | |||
| 71f3be8d2d | |||
| f312b3f53f | |||
| 02b1f1100d | |||
| 30ab9c6ea3 | |||
| c4e9321982 | |||
| 47946acd54 | |||
| 95e92f26cd | |||
| 2240d9655b | |||
| 3e99e33690 | |||
| df041492cc | |||
| cb19a7e674 | |||
| 9e4a57798f | |||
| 818fad6a75 | |||
| 9a9b5c009b | |||
| d126019fdc | |||
| 0de2e097bb | |||
| 72bfa4bbf9 | |||
| f5d4e60aa3 | |||
| 8d5a663ae0 | |||
| 33ef334fb0 | |||
| 7850be2131 | |||
| d622d85546 | |||
| d54404d5bc | |||
| bc1cff1ae1 | |||
| 9e7803df0d | |||
| da89605fa7 | |||
| 9e3adab1c7 | |||
| de23962a21 | |||
| f0beeb202c | |||
| 755f9f1204 | |||
| 6966b5f25b | |||
| 2030c3048f | |||
| 26f9a01845 | |||
| 97460cf9ff | |||
| 2eb933599d | |||
| 82fb082006 | |||
| 50a7839407 | |||
| bc82d0956d | |||
| 8b329eabca | |||
| 5aeca3451d | |||
| 4ea44a179e | |||
| dc0ac2a333 | |||
| bee788f30d | |||
| 2649cc36df | |||
| 09e2076eee | |||
| 7fa8d58e3e | |||
| 82f41d070c | |||
| eac0a49f51 | |||
| 380532ffbc | |||
| bca4d85c7b | |||
| 864d739b68 | |||
| 2e14f31dcb | |||
| b553e1cd21 | |||
| e7c9de177c | |||
| 086cc04512 | |||
| 309812741a | |||
| a92eae2b67 | |||
| 89253105fd | |||
| fd416d5574 | |||
| 815819adb8 | |||
| 8cf5fa8635 | |||
| 38a96c5e56 | |||
| 90101eb222 | |||
| 890000b9ef | |||
| b674075d49 | |||
| d7923aafe1 | |||
| 2b20f5ab35 | |||
| aa7662ef48 | |||
| adf2141297 | |||
| a609a3d6c1 | |||
| a7d372c6a7 | |||
| 2c8dca786e | |||
| 7edb16f163 | |||
| 7458744a1f | |||
| 100f5241b1 | |||
| 29a98af8d4 | |||
| 1bc85bc6af | |||
| a904be79b8 | |||
| 522eff0fad | |||
| 3fb9a0a63c | |||
| 8928406161 | |||
| 2c750d8b90 | |||
| b370ab0a88 | |||
| 3d9a10f8b0 | |||
| 1742ff8cbd | |||
| 4c3b25afca | |||
| e5ba10751b | |||
| 834d44fbf6 | |||
| 1cd3a3ff39 | |||
| 8362b370e8 | |||
| 185c001f3f | |||
| cfc6621074 | |||
| 73445cf51b | |||
| 8ff662be17 | |||
| a3b9c2d29f | |||
| c9552c0674 | |||
| 83b8690bce | |||
| b60a0e9b70 | |||
| 88609fafe4 | |||
| 9204d9879b | |||
| f98887155e | |||
| 77d268d883 | |||
| 128b83a7c6 | |||
| 81ed72bf92 | |||
| 2aefcc5142 | |||
| 6b16d10a83 | |||
| f7ff629c55 | |||
| 61b3df7c82 | |||
| fd4e8ebdff | |||
| 8f623ff3df | |||
| 98817c89d4 | |||
| 983e9163e1 | |||
| ea64073bbf | |||
| aa33572db7 | |||
| 21e8f3ec39 | |||
| 8e2ff3d5a3 | |||
| 7125ae3be8 | |||
| 810afe1df5 | |||
| 7ebb95aac2 | |||
| b5ad8307dc | |||
| 385939522a | |||
| a3e1dce432 | |||
| e5288112e9 | |||
| 2396bdcd64 | |||
| 63e4eb7bba | |||
| c9fbc3b5bc | |||
| a90f74fb77 | |||
| 9b9493be53 | |||
| 983decc8c1 | |||
| 7d584a6563 | |||
| 7f8f65649b | |||
| 390c24aea9 | |||
| 98e75a2ab4 | |||
| 7c161d3521 | |||
| 7cb4c6ecec | |||
| aef16e54f1 | |||
| 536a96ce5e | |||
| a94d6e3d21 | |||
| 0e09b925c2 | |||
| 9d1fae10d8 | |||
| ef1caae121 | |||
| 6d70eecc19 | |||
| 1e42238723 | |||
| fe089060ae | |||
| 8a5bb908c7 | |||
| 54bfa1c8ac | |||
| 54493a2ec6 | |||
| f1218571c5 | |||
| aecc530aa9 | |||
| c43187a15c | |||
| 86a781b327 | |||
| 0424d7eed7 | |||
| 78a74a5aef | |||
| a4c04c9de2 | |||
| aad44c7edd | |||
| 2a7e8d78be | |||
| 8b90c0bc22 | |||
| 6f533e73ee | |||
| 244b0e17fa | |||
| 7f165fccf4 | |||
| 40f4d35b62 | |||
| 02981d242f | |||
| 6a36fe0539 | |||
| 45e5569d55 | |||
| a9027c6127 | |||
| 67079b0885 | |||
| 3384026e91 | |||
| 803b20ec96 | |||
| 074f88d231 | |||
| fd7fe508f5 | |||
| cf6a66f11e | |||
| c4c2e680a4 | |||
| bf16cc5593 | |||
| 5d473887a3 | |||
| 773b2e8cc1 | |||
| c9cfbb515b | |||
| 82e2cd4e7d | |||
| 794657d0ea | |||
| 4f621ce7f1 | |||
| 4ebff80941 | |||
| 6080de15ca | |||
| 2310289c92 | |||
| ef30e0f6dc | |||
| e26e287603 | |||
| f9227c3e85 | |||
| 264be067ca | |||
| 047619ee17 | |||
| fc6cbc6230 | |||
| 056f38dbf5 | |||
| 61d7db84ba | |||
| 6672ea7f4f | |||
| 4aead6cfc6 | |||
| 139722dfdf | |||
| ac85049d0f | |||
| f5f71bee21 | |||
| 08af6615af | |||
| a07800192d | |||
| 13b0c77e7a | |||
| 43e8215fc6 | |||
| abdf3f5f0b | |||
| 9b41ebd154 | |||
| 21e8b5300a | |||
| 6967ab4839 | |||
| 3a60acebb5 | |||
| 26f0b20684 | |||
| 2fe4fb2a25 | |||
| 641fd3bb97 | |||
| d37e47ff40 | |||
| 67d3cac7a1 | |||
| 3ffdf466bb | |||
| c89af3fa52 | |||
| 817613ea96 | |||
| 236ddddffc | |||
| c08fd457cb | |||
| a577616756 | |||
| 9e43844e14 | |||
| 81521bcd3b | |||
| e2674908fb | |||
| 7d43e6218d | |||
| 41552e2ea1 | |||
| 268c5bdf3a | |||
| 500d4ac79e | |||
| d0603c5977 | |||
| a5fdf1ea1d | |||
| 8774a6759a | |||
| d354b555eb | |||
| 3a96911336 | |||
| 08df40f3a3 | |||
| bffed3b584 | |||
| c29eb53ee0 | |||
| 42119af04d | |||
| 9d5772ab1f | |||
| fbc6d5bee1 | |||
| 9f9e58e54e | |||
| dc297d0d04 | |||
| b59dc1b213 | |||
| 853aaf8183 | |||
| 795acc3828 | |||
| 7cf371e78c | |||
| 39fde66754 | |||
| 7a881491bd | |||
| 8e7c615b02 | |||
| dbc6874ead | |||
| 1a2f725a8e | |||
| 0665f57988 | |||
| 15a9f0c05e | |||
| 82d834e93a | |||
| c4cccacba3 | |||
| 753709d494 | |||
| 173d83daae | |||
| cbe228c873 | |||
| eb2ab49388 | |||
| 3fd0988582 | |||
| de3b40360b | |||
| bb9a1bfb68 | |||
| 9d8442b1cf | |||
| 26150244cb | |||
| 914eea92b6 | |||
| b2532ef44d | |||
| b600c81aa7 | |||
| 01a5c290bc | |||
| 16c9fa7c3d | |||
| 9bf3faee63 | |||
| e1789991c4 | |||
| 3cbfe14cc2 | |||
| 2df6396b84 | |||
| ce44fe7856 | |||
| de292de159 | |||
| 81b6831e1b | |||
| bd445d5034 | |||
| 0ca6df2499 | |||
| 00d010a910 | |||
| 48f450bfe3 | |||
| 7e4fe4837f | |||
| 13edf20710 | |||
| 556a8d68fc | |||
| 2e9972a8cd | |||
| 30397a8443 | |||
| 1fcecbb74d | |||
| d80d009e3a | |||
| a9e0a57791 | |||
| 17430b943e | |||
| 7e8bd6f959 | |||
| a624e98514 | |||
| 67a03b5ccc | |||
| f64390d7a7 | |||
| d0158b1608 | |||
| 36da74115e | |||
| fd13dd7319 | |||
| 0e75a6f4e8 | |||
| ccc102ea00 | |||
| 4465522bc5 | |||
| 8ba5913eca | |||
| 478d760816 | |||
| 98f9bfd1e5 | |||
| 2d1df77bc3 | |||
| dc19b577dc | |||
| 49898a9d01 | |||
| c35664984e | |||
| aec8ef7c35 | |||
| 8931b90a33 | |||
| 2b2883ab48 | |||
| 410f73e8b1 | |||
| 8ef28b9de5 | |||
| c8e0c74535 | |||
| d5a3a6b05a | |||
| 00901f5cb5 | |||
| c83505da53 | |||
| 30c18790f9 | |||
| 216117a30a | |||
| c4af4de4ea | |||
| daa824943f | |||
| bcd64f2fe7 | |||
| 259dfd53f3 | |||
| 1a463ee716 | |||
| 78a0a55bed | |||
| 2a465b55ec | |||
| ea3f4bb00c | |||
| bbf601f5a8 | |||
| 8543130661 | |||
| aa93dd53b6 | |||
| 0031080837 | |||
| d3f38c3b55 | |||
| 0c49c71899 | |||
| b0e543d324 | |||
| 51c8a516ff | |||
| f3c8017959 | |||
| 3867469fc5 | |||
| f23f7101e4 | |||
| 8eea6ffdc3 | |||
| 729df7ab63 | |||
| c1737fcb08 | |||
| 50862f0e33 | |||
| 5b30aebfae | |||
| f5e82ee889 | |||
| a6241a201a | |||
| db3571b8e5 | |||
| bd6a867ab3 | |||
| 045de2b18e | |||
| 501df43b0c | |||
| fee1f32a0a | |||
| 71c4426e53 | |||
| 7cd03dd163 | |||
| 4941582aec |
4
.gitattributes
vendored
Normal file
4
.gitattributes
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
*.png filter=lfs diff=lfs merge=lfs -text
|
||||
*.icm filter=lfs diff=lfs merge=lfs -text
|
||||
*.jpg filter=lfs diff=lfs merge=lfs -text
|
||||
*.webp filter=lfs diff=lfs merge=lfs -text
|
||||
6
.gitignore
vendored
6
.gitignore
vendored
@@ -1,3 +1,7 @@
|
||||
result
|
||||
result-man
|
||||
result-*
|
||||
outputs
|
||||
.direnv
|
||||
build
|
||||
.vscode
|
||||
.cache
|
||||
|
||||
46
.sops.yaml
46
.sops.yaml
@@ -1,43 +1,63 @@
|
||||
keys: # cat /etc/ssh/ssh_host_ed25519_key.pub | ssh-to-age
|
||||
- &chn age19ax6vm3pv8rph5tq3mmehd9sy9jk823tw8svsd790r0lkslycquqvlwz9m
|
||||
- &pc age1ffvr5pqd2lfj24e3fh53s92z6h76fda3du4y4k6r3yjumdwvpfgqzj033a
|
||||
- &vps4 age1nnd6u8l20julg4jz4l6kw5gmj6h2tsngpm7n8dx59umgw2s66y4shq6jv4
|
||||
- &vps6 age164tyqklwhdm57tfm5u863mdt2xrzrrzac4py8a0j9y6kzqcjy9zsp073t6
|
||||
- &vps7 age137x7csalutwvfygvvzpemlsywvdxj3j4z93a50z2sjx03w6zau8q3r5902
|
||||
- &yoga age1qrea4twxdhd7fnvlq5v45528c90qy6hp2wa55kghsxzgut6n6fxs7w6u42
|
||||
- &surface age1ck5vzs0xqx0jplmuksrkh45xwmkm2t05m2wyq5k2w2mnkmn79fxs6tvl3l
|
||||
- &nas age19lhcwk37jmvn6z0v4dpdfh0k4u23f76twdjknc0p7atktf37rd7s4t4wj3
|
||||
- &xmupc1 age19ax6vm3pv8rph5tq3mmehd9sy9jk823tw8svsd790r0lkslycquqvlwz9m
|
||||
- &xmupc1 age1hnarptkze0ujpp05dqr8uma04cxg9zqcx68qgpks5uf5l6rpk5gqhh8wxg
|
||||
- &xmupc2 age1l4stuz0vr7gs7pqwjrmezam44702jp2vmqaqyxw0l0r42kf9updq4dfhrw
|
||||
- &pi3b age1yjgswvexp0x0de0sw4u6hamruzeluxccmx2enxazl6pwhhsr2s9qlxdemq
|
||||
- &pcvm age1jmu4jym0e0xkq5shx2g7ef4xzre94vaxy2n4fcn0kp94dtlupdxqkzyyp7
|
||||
creation_rules:
|
||||
- path_regex: secrets/pc/.*$
|
||||
- path_regex: devices/pc/.*$
|
||||
key_groups:
|
||||
- age:
|
||||
- *chn
|
||||
- *pc
|
||||
- path_regex: secrets/vps6/.*$
|
||||
- path_regex: devices/vps4/.*$
|
||||
key_groups:
|
||||
- age:
|
||||
- *chn
|
||||
- *vps4
|
||||
- path_regex: devices/vps6/.*$
|
||||
key_groups:
|
||||
- age:
|
||||
- *chn
|
||||
- *vps6
|
||||
- path_regex: secrets/vps7/.*$
|
||||
- path_regex: devices/vps7/.*$
|
||||
key_groups:
|
||||
- age:
|
||||
- *chn
|
||||
- *vps7
|
||||
- path_regex: secrets/nas/.*$
|
||||
- path_regex: devices/nas/.*$
|
||||
key_groups:
|
||||
- age:
|
||||
- *chn
|
||||
- *nas
|
||||
- path_regex: secrets/xmupc1/.*$
|
||||
- path_regex: devices/surface/.*$
|
||||
key_groups:
|
||||
- age:
|
||||
- *chn
|
||||
- path_regex: secrets/yoga/.*$
|
||||
key_groups:
|
||||
- age:
|
||||
- *chn
|
||||
- *yoga
|
||||
- path_regex: secrets/xmupc1/.*$
|
||||
- *surface
|
||||
- path_regex: devices/xmupc1/.*$
|
||||
key_groups:
|
||||
- age:
|
||||
- *chn
|
||||
- *xmupc1
|
||||
- path_regex: devices/xmupc2/.*$
|
||||
key_groups:
|
||||
- age:
|
||||
- *chn
|
||||
- *xmupc2
|
||||
- path_regex: devices/pi3b/.*$
|
||||
key_groups:
|
||||
- age:
|
||||
- *chn
|
||||
- *pi3b
|
||||
- path_regex: devices/pcvm/.*$
|
||||
key_groups:
|
||||
- age:
|
||||
- *chn
|
||||
- *pcvm
|
||||
|
||||
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
|
||||
42
devices/jykang.xmuhpc/.bashrc
Normal file
42
devices/jykang.xmuhpc/.bashrc
Normal file
@@ -0,0 +1,42 @@
|
||||
# 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_DUC_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"
|
||||
15
devices/jykang.xmuhpc/.ssh/authorized_keys
Normal file
15
devices/jykang.xmuhpc/.ssh/authorized_keys
Normal file
@@ -0,0 +1,15 @@
|
||||
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 AAAAB3NzaC1yc2EAAAADAQABAAABgQCW2fx1Sim7X2i/e/RBPEl1q/XbV7wa9pmZfnRINHIv24MCUgtNZ5GHEEW7dvzrQBeRj3I7CAyK8fbuhv/l8HuDtjxJJ1fmcBp9UG5vfpb/UTxayJxHBRrwokp2JL7HKVviI6d8FcNa/T0CMoUNYXnel6dE3B78k9Q0dDxlOGS1MzgsP3Pn66lm0ww9FRAVHe+KkhFmwyQ1VHUxHgK4QjCIt7+9+PJE7fK0aVWBsR309pui7Pbm6mgd4d6mwiBeVvxsNGnI4DsO1hz4N2GapuQy19PDiG7A4H41Z5RYQnv/3XTy4TBXOFQm77v6pyGkCmG6BGnRdvMB6C0hWPJvudbsA/BNp4ApL7/CrwTdLp1z6ToAOLvKrUQAM+hcbJimnFVMXqz7iSYg99XTnzue7ncecp19XiaDJbM47bGXcT4nTO5XaiMYi2xGAHIrij5GIuFF5ymKYSp5ejb1VucMdKlaaAmS10+wdUcuT7tzX/IuVr5aqg2dsxT5aJCRhZ1k2V0= xly@xmuhpc
|
||||
|
||||
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-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC9FmT0i2j9JsnyeVrEZP8gaWHnc5NnhJgb1sP8MP/pjx/GMEkms2LQvZYNw8MQvGA6HH/O2acy5NIdD69QkRlALXZlWpUQco8JDuJe7+2xkTMGPOAqB5YLMHRpFGHUmDMuSFGSg2YyLXaWXoWmib5xAvTL95xAcdNgp5xqWvO2N55edDeVOY5cTmIE2vC0nm5JSjMEMcIuqL8yJ3AweN4JkD8CVVy3po8f+krKsaYB+f21MqqSnCQ/cpKlWHuMN9k85hP/FB1E7gBXW/MuZ1uOm4IzjBhj8tYVN0UY7Mo2/9PhFqoBKGr6vs7Nx1mXBJ/A1lIKvW+ROvQ9ADpOfww6kPuHbX16gQ55JG7zneWeiP5pVaI4YZ4O1vAvARw/SaSFhRdpymPs5r+wdIDV9gGoqORrYqoPBz7Q02V71W+EV7WFAgxiJozO0vZwD9JJ2zivyIJfcVtIOMIvEhfsha7Hviut4JIOyoaEHjIZYsmvYHEeEBA4pTUHIUZlZj/St7U= 05@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 "$@"
|
||||
78
devices/nas/default.nix
Normal file
78
devices/nas/default.nix
Normal file
@@ -0,0 +1,78 @@
|
||||
inputs:
|
||||
{
|
||||
config =
|
||||
{
|
||||
nixos =
|
||||
{
|
||||
system =
|
||||
{
|
||||
fileSystems =
|
||||
{
|
||||
mount =
|
||||
{
|
||||
vfat."/dev/disk/by-uuid/13BC-F0C9" = "/boot/efi";
|
||||
btrfs =
|
||||
{
|
||||
"/dev/disk/by-uuid/0e184f3b-af6c-4f5d-926a-2559f2dc3063"."/boot" = "/boot";
|
||||
"/dev/mapper/nix"."/nix" = "/nix";
|
||||
"/dev/mapper/root1" =
|
||||
{
|
||||
"/nix/rootfs" = "/nix/rootfs";
|
||||
"/nix/persistent" = "/nix/persistent";
|
||||
"/nix/nodatacow" = "/nix/nodatacow";
|
||||
"/nix/rootfs/current" = "/";
|
||||
"/nix/backup" = "/nix/backup";
|
||||
};
|
||||
};
|
||||
};
|
||||
decrypt.manual =
|
||||
{
|
||||
enable = true;
|
||||
devices =
|
||||
{
|
||||
"/dev/disk/by-uuid/5cf1d19d-b4a5-4e67-8e10-f63f0d5bb649".mapper = "root1";
|
||||
"/dev/disk/by-uuid/aa684baf-fd8a-459c-99ba-11eb7636cb0d".mapper = "root2";
|
||||
"/dev/disk/by-uuid/a47f06e1-dc90-40a4-89ea-7c74226a5449".mapper = "root3";
|
||||
"/dev/disk/by-uuid/b3408fb5-68de-405b-9587-5e6fbd459ea2".mapper = "root4";
|
||||
"/dev/disk/by-uuid/a779198f-cce9-4c3d-a64a-9ec45f6f5495" = { mapper = "nix"; ssd = true; };
|
||||
};
|
||||
delayedMount = [ "/" "/nix" ];
|
||||
};
|
||||
swap = [ "/nix/swap/swap" ];
|
||||
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" ];
|
||||
networking = { hostname = "nas"; networkd = {}; };
|
||||
};
|
||||
hardware = { cpus = [ "intel" ]; gpu.type = "intel"; };
|
||||
services =
|
||||
{
|
||||
snapper.enable = true;
|
||||
samba = { enable = true; hostsAllowed = "192.168. 127."; shares = { home.path = "/home"; root.path = "/"; }; };
|
||||
sshd = {};
|
||||
xray.client = { enable = true; dnsmasq.hosts."git.nas.chn.moe" = "127.0.0.1"; };
|
||||
groupshare = {};
|
||||
smartd.enable = true;
|
||||
beesd.instances =
|
||||
{
|
||||
root = { device = "/"; hashTableSizeMB = 4096; threads = 4; };
|
||||
nix = { device = "/nix"; hashTableSizeMB = 128; };
|
||||
};
|
||||
nginx = { enable = true; applications.webdav.instances."local.webdav.chn.moe" = {}; };
|
||||
wireguard =
|
||||
{
|
||||
enable = true;
|
||||
peers = [ "vps6" ];
|
||||
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,24 +1,27 @@
|
||||
xray-client:
|
||||
uuid: ENC[AES256_GCM,data:97aX07G5FPumdWcDxnYOs6fRgljXWuwyNXGg1d7zdbUUfNnb,iv:+wAC/DZXsg+evYFA4DMfLw5Ut3ExQl1RgZ/2AsNQDpo=,tag:ebD77muITHof+FQMydWobg==,type:str]
|
||||
nebula:
|
||||
key: ENC[AES256_GCM,data:zWLXEH628ZVDZk7U/9zEXocJatCJr7hZrCmh/pifPlxVvVud5RQxLvgRvhQ=,iv:YFn7spiIcaW/l8dQZvGhsERi81L2RKLUE/55Bht0TMQ=,tag:fVdIRCMeT6o0lrGVDjCVlA==,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]
|
||||
yxy: ENC[AES256_GCM,data:71vjvwr29lfPCarnblpbW3WVyJK8EMV+cR4prc4AM3r0PG4z88P6i0IrzSy8XwkVPrEasfYXxn+vDbzXyi7kIWaWXrkjcyGTxg==,iv:LfkinvbIhchvgfgixIY8Wg6esrc+TOS4YWqRTJ0qfvw=,tag:mLPw6z8DOPrHsRpUHn3/gw==,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]
|
||||
gb: ENC[AES256_GCM,data:jIR3EVdATYUgWmW4J8RdURJRmDBC84t0S/c2EzWwtFMtjgKlqg52fIfQ66i7RnIYRAoF+s4Ex0aLSejWgzQ69NA/AF0AIS7Y/Q==,iv:mvTCTP0E74QlvM8TcY4o49G5kNGs5HFx3YUrj6mCrwM=,tag:LXfIOyAB10XuHA6Cg7LBeQ==,type:str]
|
||||
nginx:
|
||||
detectAuth:
|
||||
chn: ENC[AES256_GCM,data:44vsExbVhO3gnD4Gme92eQ==,iv:LyDvZebs1sDL1/hZQiZdHoPBm4hXtBy56jR73zSH6Aw=,tag:w5xPHnK9XOSS0+97q8b5gQ==,type:str]
|
||||
maxmind-license: ENC[AES256_GCM,data:JbAnFQiDcJGwvb89sG2ro77nwwOWcDnqVcA902jwb2zzZci7PpXROw==,iv:eifkWK0oN73Ekn3oWzy6XbYK2GU+4tlnLPJ+96WOWJY=,tag:35ulsshxtUfOsSQOLgAt0g==,type:str]
|
||||
wireguard:
|
||||
privateKey: ENC[AES256_GCM,data:VPlB4wSbWqSYw3rYRwfAMa39xrPcPZfz7sV2Cq3rmOhifnUPwggxnA+51do=,iv:utnyrB6Yfe5O94Oq4HDVFm/lQ9ZBoyvUT68r2G2PdwA=,tag:snm01vA+z2yKK8d2i5i2ig==,type:str]
|
||||
telegram:
|
||||
token: ENC[AES256_GCM,data:NK9Eq3jUaMVNyPyqiXEkrc4m81c2CBg3p9TjpD8TQgKRYs2uxT9lsSrLMi02Rw==,iv:N2mjY9n7QuLD2PG4gNl79c933GTCCfw35XxluiLSuOA=,tag:ZLreEQoV+O0yhHw0CM00aQ==,type:str]
|
||||
chat: ENC[AES256_GCM,data:XJi6HftAygFH,iv:ea2m41/YXp0VyxR9U84xMCHdknZBhP2QUiX6zsipaFc=,tag:+/Y2bvUwrQsLVGUZp0Imwg==,type:str]
|
||||
hpcstat:
|
||||
key: ENC[AES256_GCM,data:3bMieouWGMEw8eu6z55TX66NAGiF/O5dRtnDTjDtNC3fmR4PTn+FreMZuA9+AjTPUm2GsS9esC6tULIzh+qTflnSrxqtTdKAbfqY6o8pPPpDJ9WWm4f/g3x8PnvlsyQDYCZ0MYKYg3cc6n60moCzv1WWlVsT8QUMTXQL3yb36vVzo4ELea4Gf2UkpfYKX89gFDtJK78srh7rj8rwoDiBs1qVUUnIBABUDLxoyC3Rym5yevrCJeFD+8AlIAIaMc62Kslw0lCCKKSaXGsFpppFYFwUTedi595eISEr4tIuPXVd4EECQchsYg+tInphIXebp/5rzXQM37yQEymImNRiMcxDWGR0B8Nq9XO+I5T8VOIb6xXCtvEeY2Z8nPfmUn9UHfvYzqFv3it5TCcd9J4SeBa2LVW8+YCIO/KitznL49O5SGAJUONIkcwMUhUuXQUFe/vnc+g8+yqB5ltCZtHWCOY2pCdmQpBRaZq55fcde5FNhxt3J8zCbu++oIn+ERSHadMIGMuGgGqzG6XDQJZN,iv:cbPCnNi2gX1gZIdcQd7HR3c/JEsWj3nv+x+OQ0bDs40=,tag:olrGr6t2Si39wl/1rR81ig==,type:str]
|
||||
postgresql:
|
||||
gitea: ENC[AES256_GCM,data:qssnsnlaEKwEnLbnpX+XDs7JK/2DdK1cxD6U2NddpCPnwfOinP2cuc1HLnteWQfYZXTuYM3VOXDEXQB9CexILA==,iv:+TVoTuqmxIsTlNPngMBBWgIvP5EQD5ROHZI4u0mSJGE=,tag:6X8hewc5a6C6nbuD5WozCQ==,type:str]
|
||||
mail:
|
||||
bot: ENC[AES256_GCM,data:ugfBeRM4Ks7j+V4lLOqHrA==,iv:QwXeSrfw+TTN5N42DaaA7YgpaIJX/E+kTv9p6eWSxEk=,tag:fLUDBhsvCbOiYqhq9TCzmw==,type:str]
|
||||
sops:
|
||||
kms: []
|
||||
gcp_kms: []
|
||||
@@ -43,8 +46,8 @@ sops:
|
||||
by9Rd0U0bzNiK21BQTNxN1RuQ09DQVkKJmSlzV5ppEkZFljsS17ZWmoI++fz4tJh
|
||||
kTdoAStG1zsKASHyZTsmdm3RBDO3qV1KhQC2gC7d4EiwNZngxOOZJg==
|
||||
-----END AGE ENCRYPTED FILE-----
|
||||
lastmodified: "2023-12-07T08:57:07Z"
|
||||
mac: ENC[AES256_GCM,data:Ihd7p3JU6zwn5tI3XkINrNJcsxdFjTsLdVpZLUvQez2jiNWq1kGP4QeJSBzqq/1Sgowc/PdWULlw8T21LitQalhBwaODVt/dNk0gkHYqrlDMVD90/MthAPKy+vT4YLhBkDC5W00em1qEfLYo5IXazM/0e1aZ7QcwEpp5775ICPc=,iv:Yp32/LLdcDHxdmXnwqJ6OiOm/4mipMlccSRXMMgO8gc=,tag:5T5R4JiJUsbKGrHjfVw92Q==,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
|
||||
BIN
devices/pc/color/TPLCD_161B_Default.icm
LFS
Executable file
BIN
devices/pc/color/TPLCD_161B_Default.icm
LFS
Executable file
Binary file not shown.
BIN
devices/pc/color/TPLCD_161B_Native.icm
LFS
Executable file
BIN
devices/pc/color/TPLCD_161B_Native.icm
LFS
Executable file
Binary file not shown.
BIN
devices/pc/color/TPLCD_161B_Native_HDR.icm
LFS
Executable file
BIN
devices/pc/color/TPLCD_161B_Native_HDR.icm
LFS
Executable file
Binary file not shown.
BIN
devices/pc/color/TPLCD_161B_REC709.icm
LFS
Executable file
BIN
devices/pc/color/TPLCD_161B_REC709.icm
LFS
Executable file
Binary file not shown.
BIN
devices/pc/color/TPLCD_161B_sRGB.icm
LFS
Executable file
BIN
devices/pc/color/TPLCD_161B_sRGB.icm
LFS
Executable file
Binary file not shown.
188
devices/pc/default.nix
Normal file
188
devices/pc/default.nix
Normal file
@@ -0,0 +1,188 @@
|
||||
inputs:
|
||||
{
|
||||
config =
|
||||
{
|
||||
nixos =
|
||||
{
|
||||
system =
|
||||
{
|
||||
fileSystems =
|
||||
{
|
||||
mount =
|
||||
{
|
||||
vfat."/dev/disk/by-uuid/E58F-416A" = "/boot/efi";
|
||||
btrfs =
|
||||
{
|
||||
"/dev/disk/by-uuid/066be4fd-8617-4fe1-9654-c133c2996d33"."/" = "/boot";
|
||||
"/dev/mapper/root1" = { "/nix" = "/nix"; "/nix/rootfs/current" = "/"; };
|
||||
};
|
||||
};
|
||||
decrypt.auto =
|
||||
{
|
||||
"/dev/disk/by-uuid/4c73288c-bcd8-4a7e-b683-693f9eed2d81" = { mapper = "root1"; ssd = true; };
|
||||
"/dev/disk/by-uuid/a9bf47e2-8731-4236-a3eb-0666d49f6150" = { mapper = "root2"; ssd = true; };
|
||||
"/dev/disk/by-uuid/4be45329-a054-4c20-8965-8c5b7ee6b35d" =
|
||||
{ mapper = "swap"; ssd = true; before = [ "root1" "root2" ]; };
|
||||
};
|
||||
swap = [ "/dev/mapper/swap" ];
|
||||
resume = "/dev/mapper/swap";
|
||||
rollingRootfs.waitDevices = [ "/dev/mapper/root2" ];
|
||||
};
|
||||
grub =
|
||||
{
|
||||
# TODO: install windows
|
||||
# windowsEntries = { "7317-1DB6" = "Windows"; "7321-FA9C" = "Windows for malware"; };
|
||||
installDevice = "efi";
|
||||
};
|
||||
nix =
|
||||
{
|
||||
marches =
|
||||
[
|
||||
"znver2" "znver3" "znver4"
|
||||
# FXSR SAHF XSAVE
|
||||
"sandybridge"
|
||||
# FXSR PREFETCHW RDRND SAHF
|
||||
"silvermont"
|
||||
# FXSR HLE LZCNT PREFETCHW RDRND SAHF XSAVE
|
||||
"broadwell"
|
||||
# FXSR HLE LZCNT PREFETCHW RDRND SAHF SGX XSAVE
|
||||
"skylake"
|
||||
# AVX-VNNI CLDEMOTE GFNI-SSE HRESET KL LZCNT MOVDIR64B MOVDIRI PCONFIG PREFETCHW PTWRITE RDRND
|
||||
# SERIALIZE SGX WAITPKG WIDEKL XSAVE XSAVEOPT
|
||||
"alderlake"
|
||||
];
|
||||
remote.master = { enable = true; hosts = [ "xmupc1" "xmupc2" ]; };
|
||||
githubToken.enable = true;
|
||||
};
|
||||
nixpkgs =
|
||||
{ march = "znver4"; cuda = { enable = true; capabilities = [ "8.9" ]; forwardCompat = false; }; };
|
||||
kernel =
|
||||
{
|
||||
variant = "xanmod-latest";
|
||||
patches = [ "cjktty" "hibernate-progress" ];
|
||||
modules.modprobeConfig =
|
||||
[ "options iwlwifi power_save=0" "options iwlmvm power_scheme=1" "options iwlwifi uapsd_disable=1" ];
|
||||
};
|
||||
networking.hostname = "pc";
|
||||
sysctl.laptop-mode = 5;
|
||||
gui.enable = true;
|
||||
};
|
||||
hardware =
|
||||
{
|
||||
cpus = [ "amd" ];
|
||||
gpu =
|
||||
{
|
||||
type = "amd+nvidia";
|
||||
nvidia = { prime.busId = { amd = "6:0:0"; nvidia = "1:0:0"; }; dynamicBoost = true; driver = "beta"; };
|
||||
};
|
||||
legion = {};
|
||||
};
|
||||
packages.packageSet = "workstation";
|
||||
virtualization =
|
||||
{
|
||||
waydroid.enable = true;
|
||||
docker.enable = true;
|
||||
kvmHost = { enable = true; gui = true; };
|
||||
nspawn = [ "arch" "ubuntu-22.04" "fedora" ];
|
||||
};
|
||||
services =
|
||||
{
|
||||
snapper.enable = true;
|
||||
samba =
|
||||
{
|
||||
enable = true;
|
||||
private = true;
|
||||
hostsAllowed = "192.168. 127.";
|
||||
shares =
|
||||
{
|
||||
media.path = "/run/media/chn";
|
||||
home.path = "/home/chn";
|
||||
mnt.path = "/mnt";
|
||||
share.path = "/home/chn/share";
|
||||
};
|
||||
};
|
||||
sshd = {};
|
||||
xray.client =
|
||||
{
|
||||
enable = true;
|
||||
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" = {};
|
||||
frpClient =
|
||||
{
|
||||
enable = true;
|
||||
serverName = "frp.chn.moe";
|
||||
user = "pc";
|
||||
stcpVisitor."yy.vnc".localPort = 6187;
|
||||
};
|
||||
nix-serve = { enable = true; hostname = "nix-store.chn.moe"; };
|
||||
smartd.enable = true;
|
||||
misskey.instances.misskey.hostname = "xn--qbtm095lrg0bfka60z.chn.moe";
|
||||
beesd.instances.root = { device = "/"; hashTableSizeMB = 4096; threads = 4; };
|
||||
wireguard =
|
||||
{
|
||||
enable = true;
|
||||
peers = [ "vps6" ];
|
||||
publicKey = "l1gFSDCeBxyf/BipXNvoEvVvLqPgdil84nmr5q6+EEw=";
|
||||
wireguardIp = "192.168.83.3";
|
||||
};
|
||||
gamemode = { enable = true; drmDevice = 1; };
|
||||
slurm =
|
||||
{
|
||||
enable = true;
|
||||
cpu = { cores = 16; threads = 2; mpiThreads = 2; openmpThreads = 4; };
|
||||
memoryMB = 90112;
|
||||
gpus."4060" = 1;
|
||||
};
|
||||
};
|
||||
bugs = [ "xmunet" "backlight" "amdpstate" ];
|
||||
};
|
||||
boot.kernelParams =
|
||||
[
|
||||
"acpi_osi=!" ''acpi_osi="Windows 2015"''
|
||||
"amdgpu.sg_display=0" # 混合模式下避免外接屏幕闪烁,和内置外接屏幕延迟
|
||||
"acpi.ec_no_wakeup=1" # 睡眠时避免开盖唤醒,似乎没有用
|
||||
"processor.max_cstate=1" # workaround for amd cpu hard lock
|
||||
];
|
||||
# 禁止鼠标等在睡眠时唤醒
|
||||
services.udev.extraRules = ''ACTION=="add", ATTR{power/wakeup}="disabled"'';
|
||||
networking.extraHosts = "74.211.99.69 mirism.one beta.mirism.one ng01.mirism.one";
|
||||
services.colord.enable = true;
|
||||
environment.persistence."/nix/archive" =
|
||||
{
|
||||
hideMounts = true;
|
||||
users.chn.directories = builtins.map
|
||||
(dir: { directory = "repo/${dir}"; user = "chn"; group = "chn"; mode = "0755"; })
|
||||
[ "lammps-SiC" "BPD-paper" "kurumi-asmr" "linwei-stuff" "BPD-paper-old" ];
|
||||
};
|
||||
specialisation =
|
||||
{
|
||||
nvidia.configuration =
|
||||
{
|
||||
nixos =
|
||||
{
|
||||
hardware.gpu.type = inputs.lib.mkForce "nvidia";
|
||||
services.gamemode.drmDevice = inputs.lib.mkForce 0;
|
||||
};
|
||||
system.nixos.tags = [ "nvidia" ];
|
||||
};
|
||||
cachyos.configuration =
|
||||
{
|
||||
nixos.system.kernel.variant = inputs.lib.mkForce "cachyos";
|
||||
system.nixos.tags = [ "cachyos" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -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,12 +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]
|
||||
nebula:
|
||||
key: ENC[AES256_GCM,data:kNm9hwMa/EhDeOCeZw1jEnroolTkeEeAxpSEDko6tHSDHwHbhfjr01ZzHKE=,iv:q2qCi99XgZJvRuF1dm16sK6BFIoa9QUN8p4LSiZq28o=,tag:ApOKdA91LBiWHv6TuXMkpA==,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: []
|
||||
@@ -44,8 +46,8 @@ sops:
|
||||
OUlxNjdQaXdXMkZ6bnV1ek4yZ2dpbkEKpKGOAxo5Eef2jtGrg4iSzmGCeg+vTgvu
|
||||
+K8b+O19MIkGMDBm6UbYUPtc/7eqoEZRiTUzNMTmfkLVS4ul5zou9A==
|
||||
-----END AGE ENCRYPTED FILE-----
|
||||
lastmodified: "2023-12-07T08:55:33Z"
|
||||
mac: ENC[AES256_GCM,data:3WDgwrlyzb0QfhCpGEKSguLZpRE68APpUclQaP4/2O5pX8E/HZ9tXVQNNVeOqozHWIe8sM5/kvY4vXEiXc1t2qrJk4JdPNI7fMIWf7QAYQWcFDNbSquUNp1VSmNp3Aka3xSS1wyVWnQOs6JY9rdbmeOcLQq0jE2sNDvivtBeJJQ=,iv:xt94toLZ91J9Twigu4FiyeYIg27u9oPkzduCUaLIgts=,tag:chf+LnNJMrnMf191BorOvg==,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
|
||||
24
devices/pc/secrets/munge.key
Normal file
24
devices/pc/secrets/munge.key
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"data": "ENC[AES256_GCM,data:ftogJ/2oPME8sVbyNAuI3t3GEzUmdCadyjf2g/bjGNx3AoV0jU0SDxnBLDFfoR1rEtV00zfgCMPDGsEXavg+QVvoICpvvhckXMOLXe37H3Ff0wDVJtL4BBIK3oVh/SiYaRm/+uR0x6HW37KX50RRvKvpQoRdMVNnvtKbMjmQVIA=,iv:MOHfTIavoU643K10jSR3HruzoofOqqVspYgiaLc294o=,tag:zjDTPKwAOh/nqkquvAQpbw==,type:str]",
|
||||
"sops": {
|
||||
"kms": null,
|
||||
"gcp_kms": null,
|
||||
"azure_kv": null,
|
||||
"hc_vault": null,
|
||||
"age": [
|
||||
{
|
||||
"recipient": "age19ax6vm3pv8rph5tq3mmehd9sy9jk823tw8svsd790r0lkslycquqvlwz9m",
|
||||
"enc": "-----BEGIN AGE ENCRYPTED FILE-----\nYWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSA5TTB1bHFXcDhoMk1QVzJ0\nUUplcGVBVUhoOEt0Rnc2ZStDUUpjZmV0eGpvCjFQSGl4TjlMT2R5RExNZWxwOUtz\nSWhhSUtFN0JISzJhclpCMFZDQ09jK28KLS0tIGJydDNoY3hBbEhBYUNYZGZCaWpQ\nQnVDalJCcWpIRTdVaWkzeGVNSGpDRWsKWXoMC8NApfenn191aRwdAjD0iM5+C3R6\nXKpHxfhc1Gf6paxBhketFU+AwWsKiBDKh0gntV49F+YSriPa7uI3FA==\n-----END AGE ENCRYPTED FILE-----\n"
|
||||
},
|
||||
{
|
||||
"recipient": "age1ffvr5pqd2lfj24e3fh53s92z6h76fda3du4y4k6r3yjumdwvpfgqzj033a",
|
||||
"enc": "-----BEGIN AGE ENCRYPTED FILE-----\nYWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSAzclYwVjdOZnQ1Y2dlUi9n\naXQya21QVHZ0KzMxTkVuTEJuazB4WklqdFdvCmpMd0h6OXUvZSttOFpmeUdsSlNs\nQkhQaVJqVFdidFNMejljV2h3WUFTaFUKLS0tIGNBemY5R1N3T00zMEthZjBsWXZh\nVXRtNG5UV3I3WG5LYUphNUNyUDI5WXcKVQpMe3zYgzHOtQQvo8Vvz94lYR6TBFuV\nD7ztr4rD/Vdk3hkSGZQvdzGjNDdGpac38LUN9vtFQbzMofykcn/etw==\n-----END AGE ENCRYPTED FILE-----\n"
|
||||
}
|
||||
],
|
||||
"lastmodified": "2024-02-24T05:48:31Z",
|
||||
"mac": "ENC[AES256_GCM,data:kCLcS6xeMijD8Bxa0MBUbFH2pdXX6BdGL1SztHHPet8loMkiCfgEiyp9l/QjszWa3G6zx3K+0wXXtRXmrNAxThnIgMZQVGCy4Ucw7fp8Pral/5eaJNlZGb56JQPF9ZDHb9YQPDPImaEAKYUtzayyaZAGJGlCmIIhVVhXTx7iiig=,iv:MXRDA/6YnVUbLdYAIrMvrdb2iPsi4Bmr06SPCU8CCVc=,tag:9hT7Xo0tRnHTgAaivKj4QQ==,type:str]",
|
||||
"pgp": null,
|
||||
"unencrypted_suffix": "_unencrypted",
|
||||
"version": "3.8.1"
|
||||
}
|
||||
}
|
||||
28
devices/pcarm/default.nix
Normal file
28
devices/pcarm/default.nix
Normal file
@@ -0,0 +1,28 @@
|
||||
inputs:
|
||||
{
|
||||
config =
|
||||
{
|
||||
nixos =
|
||||
{
|
||||
system =
|
||||
{
|
||||
fileSystems =
|
||||
{
|
||||
mount =
|
||||
{
|
||||
vfat."/dev/disk/by-uuid/CE84-E0D8" = "/boot/efi";
|
||||
btrfs."/dev/disk/by-uuid/61f51d93-d3e5-4028-a903-332fafbfd365" =
|
||||
{ "/nix/rootfs/current" = "/"; "/nix" = "/nix"; "/nix/boot" = "/boot"; };
|
||||
};
|
||||
rollingRootfs = {};
|
||||
};
|
||||
grub.installDevice = "efi";
|
||||
networking = { hostname = "pcarm"; networkd = {}; };
|
||||
nixpkgs.arch = "aarch64";
|
||||
kernel.variant = "nixos";
|
||||
sops.enable = false;
|
||||
};
|
||||
services.sshd = {};
|
||||
};
|
||||
};
|
||||
}
|
||||
33
devices/pcvm/default.nix
Normal file
33
devices/pcvm/default.nix
Normal file
@@ -0,0 +1,33 @@
|
||||
inputs:
|
||||
{
|
||||
config =
|
||||
{
|
||||
nixos =
|
||||
{
|
||||
system =
|
||||
{
|
||||
fileSystems =
|
||||
{
|
||||
mount =
|
||||
{
|
||||
vfat."/dev/disk/by-uuid/AE90-1DD1" = "/boot/efi";
|
||||
btrfs =
|
||||
{
|
||||
"/dev/disk/by-uuid/5a043ec5-7b47-4b0d-ad89-8c3ce5650fcd"."/" = "/boot";
|
||||
"/dev/mapper/root" = { "/nix" = "/nix"; "/nix/rootfs/current" = "/"; };
|
||||
};
|
||||
};
|
||||
decrypt.auto."/dev/disk/by-uuid/a9e4a508-3f0b-492e-b932-e2019be28615" = { mapper = "root"; ssd = true; };
|
||||
rollingRootfs = {};
|
||||
};
|
||||
grub.installDevice = "efi";
|
||||
kernel.variant = "xanmod-latest";
|
||||
networking.hostname = "pcvm";
|
||||
initrd.sshd.enable = true;
|
||||
};
|
||||
hardware.cpus = [ "amd" ];
|
||||
packages.packageSet = "server";
|
||||
services.sshd = {};
|
||||
};
|
||||
};
|
||||
}
|
||||
39
devices/pcvm/secrets.yaml
Normal file
39
devices/pcvm/secrets.yaml
Normal file
@@ -0,0 +1,39 @@
|
||||
hello: ENC[AES256_GCM,data:7xCy5PqPVdUNIdzqaGQLsPA88mAfRt6T57LjFDwOaTlhdejLPrBdyN4=,iv:dM0QWDpylPjnbtdNrjV8LHISNi/U718+xooFm0qTcbI=,tag:d5HbLG7yF3QRz7nP+4aeiA==,type:str]
|
||||
example_key: ENC[AES256_GCM,data:K5SD4k9jL5r4ZSUwNQ==,iv:mJrZshT0PKmT7OJE/ZBUWzq1Gc6xXymFbypxwQtQJq8=,tag:I4+AyMh+AVpmWa1fdIJpyA==,type:str]
|
||||
#ENC[AES256_GCM,data:vHj6+kNand8d1AzgXTaOMQ==,iv:j6b3SDqzVgY8U/puEm9UcpJYGK84gF/YIXzRbG0radQ=,tag:yzfXKHReJ0++3fhk2ztbBA==,type:comment]
|
||||
example_array:
|
||||
- ENC[AES256_GCM,data:vRjjfVSy8g5mBZVM/oU=,iv:C+HE4Q157eNhEmcDJSMJINfMgztf6XfELCjotg8q3XU=,tag:JSQDItdYbCCs65tmbeR6tg==,type:str]
|
||||
- ENC[AES256_GCM,data:xzfN6WiT8r8YcWtS+H4=,iv:btlOvqrn0pITT3rCTIjgS2b5TrfNKym0yPEnE7bJDqg=,tag:Wf40b8zBhrv452OKodkU+w==,type:str]
|
||||
example_number: ENC[AES256_GCM,data:akqZ12u1wl4Zww==,iv:hS3NBWI7o6dZLtsIsoVHYdtyqpUmbQrpMHPhRRzEd18=,tag:1voFm4LuupWJMGP3xd0k4A==,type:float]
|
||||
example_booleans:
|
||||
- ENC[AES256_GCM,data:wWEU8w==,iv:rf8uwo+sP9YFyPmoxROVVmrx+q6Yr0PIOWznM96w9XY=,tag:nVJdD1Z7U8zVRBxs8gLvQQ==,type:bool]
|
||||
- ENC[AES256_GCM,data:gVe51tg=,iv:eOJ2TOWStHpckNyYx2UdLcipshFpjcWtEids5c+Q8bs=,tag:0iSjlC/TgNfl7ZtXmttgaQ==,type:bool]
|
||||
sops:
|
||||
kms: []
|
||||
gcp_kms: []
|
||||
azure_kv: []
|
||||
hc_vault: []
|
||||
age:
|
||||
- recipient: age19ax6vm3pv8rph5tq3mmehd9sy9jk823tw8svsd790r0lkslycquqvlwz9m
|
||||
enc: |
|
||||
-----BEGIN AGE ENCRYPTED FILE-----
|
||||
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSAyTGliaUlvOVlxejZhSDZi
|
||||
YU96S0VPOE5Ldk56WlJjTzBSRm9oYnBoQ0NBCnhJWmg3KzUrT1VyemRiSWtQeklS
|
||||
UFFFTjdod0g1d1EvYWJoOElJSjIrWTgKLS0tIDlaQnJOMTZRUms4am1mQjV5MzFJ
|
||||
QlhKL1ltY2lGZGU0clhIRTRsSW5BOTgK4gKbhvF1bV/YdKOxzqrecHPDAKPOd81V
|
||||
YnWgLpP6h+zycx80iqwsfqiQJdPyDrfhB43ksn2oxsX0qXtLI9j9TQ==
|
||||
-----END AGE ENCRYPTED FILE-----
|
||||
- recipient: age1jmu4jym0e0xkq5shx2g7ef4xzre94vaxy2n4fcn0kp94dtlupdxqkzyyp7
|
||||
enc: |
|
||||
-----BEGIN AGE ENCRYPTED FILE-----
|
||||
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSAzRU1IRXZkbFQ4elgydTlv
|
||||
VlRVKzJIWDVCZk5xaTd0Y2JXS2l0Mi85Zm1jCnNkS0NETm5SaG9WUE9Mb3RtbE5B
|
||||
YTRmWHNXTk9hZHNBT0FxT1RNNnFMNEkKLS0tIGRWNWpLcDVtOEdGZHFPT3paeVo2
|
||||
QWsreTlaVW5Bd2lZb3JZeTdjcG9WQlEKy3p4QnjPrJtfaueLKBzMz7VZ9QfrTer1
|
||||
lEP8mInFprR65LtpoKabsTWQwkzURzB/OdbKSYG2o6Rlqy9L3d5eBw==
|
||||
-----END AGE ENCRYPTED FILE-----
|
||||
lastmodified: "2024-07-02T23:46:35Z"
|
||||
mac: ENC[AES256_GCM,data:OncqYSgPSoge5Nw6eh0A4cm0KXSQhmSpGIu5WSv38LdMto5fNLIK2VRIwaXfq9nyf10bxNN7xSADj2GPhMiwlHM8nIQXtxdlWsZfEOc/qOWM8nz+9DPKtKGD6RZcDLDRhNTDxzPXGWIuY1tDKQpUlt/iDlymSskcqSrdTfBqCGk=,iv:NesxRr6FXXApE8aafnAV3x6hwCoAxoEly/QkcyAQ8Pw=,tag:3o37dr4vKLqEENIdj8RHXw==,type:str]
|
||||
pgp: []
|
||||
unencrypted_suffix: _unencrypted
|
||||
version: 3.8.1
|
||||
42
devices/pi3b/default.nix
Normal file
42
devices/pi3b/default.nix
Normal file
@@ -0,0 +1,42 @@
|
||||
inputs:
|
||||
{
|
||||
config =
|
||||
{
|
||||
nixos =
|
||||
{
|
||||
system =
|
||||
{
|
||||
fileSystems =
|
||||
{
|
||||
mount =
|
||||
{
|
||||
vfat."/dev/disk/by-uuid/ABC6-6B3E" = "/boot/efi";
|
||||
btrfs."/dev/disk/by-uuid/c459c6c0-23a6-4ef2-945a-0bfafa9a45b6" =
|
||||
{ "/nix/rootfs/current" = "/"; "/nix" = "/nix"; "/nix/boot" = "/boot"; };
|
||||
};
|
||||
swap = [ "/nix/swap/swap" ];
|
||||
rollingRootfs = {};
|
||||
};
|
||||
grub.installDevice = "efi";
|
||||
networking = { hostname = "pi3b"; networkd = {}; };
|
||||
nixpkgs.arch = "aarch64";
|
||||
kernel.variant = "nixos";
|
||||
};
|
||||
services =
|
||||
{
|
||||
# snapper.enable = true;
|
||||
sshd = {};
|
||||
xray.client.enable = true;
|
||||
fail2ban = {};
|
||||
wireguard =
|
||||
{
|
||||
enable = true;
|
||||
peers = [ "vps6" ];
|
||||
publicKey = "X5SwWQk3JDT8BDxd04PYXTJi5E20mZKP6PplQ+GDnhI=";
|
||||
wireguardIp = "192.168.83.8";
|
||||
};
|
||||
beesd.instances.root = { device = "/"; hashTableSizeMB = 32; };
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
33
devices/pi3b/secrets.yaml
Normal file
33
devices/pi3b/secrets.yaml
Normal file
@@ -0,0 +1,33 @@
|
||||
xray-client:
|
||||
uuid: ENC[AES256_GCM,data:82Xg9VkmkLrKKcZfojA7dHqqMZh45n+eL4T5qZ1z/xy9k0q5,iv:/2j9flBDwjY6JW2mHYo1S2VE+ruu6gxrw8BzSyoiPcc=,tag:iq8wzfIRyq1T18k3vStVGw==,type:str]
|
||||
wireguard:
|
||||
privateKey: ENC[AES256_GCM,data:8whySpY/4WPWx2+t7IOgn+qjKCsv+BgRtaAFLrP8L0fV3TJdLob5vwDplHk=,iv:kXTDwOyJNzbjPtlzQqNsXtuk3EXFdF9CAsYkvImbyDE=,tag:tsK9nCMmwEb0c08rJ3Iwyg==,type:str]
|
||||
sops:
|
||||
kms: []
|
||||
gcp_kms: []
|
||||
azure_kv: []
|
||||
hc_vault: []
|
||||
age:
|
||||
- recipient: age19ax6vm3pv8rph5tq3mmehd9sy9jk823tw8svsd790r0lkslycquqvlwz9m
|
||||
enc: |
|
||||
-----BEGIN AGE ENCRYPTED FILE-----
|
||||
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSB6TzU0U2Facm5yWkYrREgw
|
||||
a1Fxc1MxaHYwRWUzUHpsbDBHYVoxb1NKVDAwCjNuUFlabzJ0aWtGMFBQb05nSlRP
|
||||
akwrWDI0QnZBYkFmSUpWZFFnYmQ2aDQKLS0tIGlIQ3lTREN4WXgxV3pNdjdaakF6
|
||||
ZnppV1ZRZzZ5Smt2NGsyRndjTFdnV00KaWVPGLWPnqINH6AHKS/84kuYy/v1v4Tb
|
||||
QdehcMiq5ZF5XLqOX5sMDLu8h96FIklqOSTZNFkzr+s9VYv/UO58rg==
|
||||
-----END AGE ENCRYPTED FILE-----
|
||||
- recipient: age1yjgswvexp0x0de0sw4u6hamruzeluxccmx2enxazl6pwhhsr2s9qlxdemq
|
||||
enc: |
|
||||
-----BEGIN AGE ENCRYPTED FILE-----
|
||||
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSAyTEZERkRSZUdSN2dySnlI
|
||||
aDFjdXFCWnlJZlpYQmR1WEE2RzdCaVp1WFEwCjd1N1ZpMUExZ0ZBWmFwSHg3RUs4
|
||||
RkRYTjRMWmE5cTA4Z2JJUGgyN05HSmMKLS0tIFpKZmd2Q2k2bnNYK1V2ZnNQNUxH
|
||||
aDU3Vm95ZkpvSTJDMjJEOFY1ZjhrQlUKLdMYiOj6tlzwLpwZsTQVSQ8hHart0ba3
|
||||
NS7+SprzJRb0hQXrvyU6s9zho8dPOw8wiGbscmMXSVS/Kar3eQigmg==
|
||||
-----END AGE ENCRYPTED FILE-----
|
||||
lastmodified: "2024-03-28T13:31:33Z"
|
||||
mac: ENC[AES256_GCM,data:fuppF9gFh3O6ZqJRTcVxNqVlz2y5f4xR39JIeInKblh4hNhrdnQg7oh8repoZeXHVRewGeGyxSqzUg+Twy8J+q+d6TSmiDVViD/SHse5rPns2Egt671geF7JmGEB/yKSCbECjGCp0QFgYYEg/vUOaV3v1a0s7LLTE/t2haPIaYc=,iv:f4T7JGxKB3WmEtETuSH7ApKRJ8ptPwZPfspyqc8+vmM=,tag:GF5br+e/p6qHsNCTjfIBCA==,type:str]
|
||||
pgp: []
|
||||
unencrypted_suffix: _unencrypted
|
||||
version: 3.8.1
|
||||
66
devices/surface/default.nix
Normal file
66
devices/surface/default.nix
Normal file
@@ -0,0 +1,66 @@
|
||||
inputs:
|
||||
{
|
||||
imports = inputs.localLib.mkModules [ inputs.topInputs.nixos-hardware.nixosModules.microsoft-surface-pro-intel ];
|
||||
config =
|
||||
{
|
||||
nixos =
|
||||
{
|
||||
system =
|
||||
{
|
||||
fileSystems =
|
||||
{
|
||||
mount =
|
||||
{
|
||||
vfat."/dev/disk/by-uuid/7179-9C69" = "/boot/efi";
|
||||
btrfs =
|
||||
{
|
||||
"/dev/disk/by-uuid/c6d35075-85fe-4129-aaa8-f436ab85ce43"."/boot" = "/boot";
|
||||
"/dev/mapper/root" = { "/nix" = "/nix"; "/nix/rootfs/current" = "/"; };
|
||||
};
|
||||
};
|
||||
decrypt.auto =
|
||||
{
|
||||
"/dev/disk/by-uuid/4f7420f9-ea19-4713-b084-2ac8f0a963ac" = { mapper = "root"; ssd = true; };
|
||||
"/dev/disk/by-uuid/88bd9d44-928b-40a2-8f3d-6dcd257c4601" =
|
||||
{ mapper = "swap"; ssd = true; before = [ "root" ]; };
|
||||
};
|
||||
swap = [ "/dev/mapper/swap" ];
|
||||
resume = "/dev/mapper/swap";
|
||||
rollingRootfs = {};
|
||||
};
|
||||
nixpkgs.march = "skylake";
|
||||
grub.installDevice = "efi";
|
||||
nix = { substituters = [ "https://cache.nixos.org/" "https://nix-store.chn.moe" ]; githubToken.enable = true; };
|
||||
kernel = { variant = "xanmod-lts"; patches = [ "cjktty" "lantian" "surface" "hibernate-progress" ]; };
|
||||
networking.hostname = "surface";
|
||||
gui.enable = true;
|
||||
};
|
||||
hardware = { cpus = [ "intel" ]; gpu.type = "intel"; };
|
||||
packages.packageSet = "desktop-extra";
|
||||
virtualization = { docker.enable = true; waydroid.enable = true; };
|
||||
services =
|
||||
{
|
||||
snapper.enable = true;
|
||||
sshd = {};
|
||||
xray.client.enable = true;
|
||||
firewall.trustedInterfaces = [ "virbr0" ];
|
||||
wireguard =
|
||||
{
|
||||
enable = true;
|
||||
peers = [ "vps6" ];
|
||||
publicKey = "j7qEeODVMH31afKUQAmKRGLuqg8Bxd0dIPbo17LHqAo=";
|
||||
wireguardIp = "192.168.83.5";
|
||||
};
|
||||
beesd.instances.root = { device = "/"; hashTableSizeMB = 512; };
|
||||
};
|
||||
bugs = [ "xmunet" "suspend-hibernate-no-platform" ];
|
||||
};
|
||||
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 = 10; };
|
||||
};
|
||||
};
|
||||
}
|
||||
35
devices/surface/secrets.yaml
Normal file
35
devices/surface/secrets.yaml
Normal file
@@ -0,0 +1,35 @@
|
||||
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: []
|
||||
azure_kv: []
|
||||
hc_vault: []
|
||||
age:
|
||||
- recipient: age19ax6vm3pv8rph5tq3mmehd9sy9jk823tw8svsd790r0lkslycquqvlwz9m
|
||||
enc: |
|
||||
-----BEGIN AGE ENCRYPTED FILE-----
|
||||
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBzV1pvWkVGSFg5TVAvRlhu
|
||||
TnFnMEszcDRWWHlQanAyRkRpQWdqQkdhTzFvCjBqUG4xNFBiRnlSeTNQSmdkVkdD
|
||||
UlVCQjRFVExuZHdrSnViajZGZ3c2dWsKLS0tIHlQYU5VeGpEQzllMmxLSnJZZzZx
|
||||
N1R3Mkhxa0dOVlJiU0V2OEZVVzZVMFkKae3c1axl22uxh9wMygAHs6q1WA5ImOS8
|
||||
uzKSthWSqtC7DMqgUFaaSjBYM2TN3l402syx71xVFyyAmCcGZbbJcg==
|
||||
-----END AGE ENCRYPTED FILE-----
|
||||
- recipient: age1ck5vzs0xqx0jplmuksrkh45xwmkm2t05m2wyq5k2w2mnkmn79fxs6tvl3l
|
||||
enc: |
|
||||
-----BEGIN AGE ENCRYPTED FILE-----
|
||||
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBCSHJVRGIwQUFpVER5SWxq
|
||||
YjJOT0lXN3dFOFpjMFlWV3JCbmZFN0hnNEJBClpQUEczK2RWTGlVTmJRbVZaUC8y
|
||||
bEFrL1RjTTNlYVNnRVRBZlRjaTlnUEEKLS0tIE5GM01pTGFFcWVVSWEvUHE3Z08r
|
||||
a2xybTRFUFZZN20zajZJTVNwVEpGcEEKglmFMk7z1q5IlZ+lZf9M0HtknmvcYt/P
|
||||
2/z5e8wLN1Hy0Zsbv0yIL/NmqwxAOGJOdzz7ElJszk/Y4kUr9aRasg==
|
||||
-----END AGE ENCRYPTED FILE-----
|
||||
lastmodified: "2024-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
|
||||
44
devices/vps4/default.nix
Normal file
44
devices/vps4/default.nix
Normal file
@@ -0,0 +1,44 @@
|
||||
inputs:
|
||||
{
|
||||
config =
|
||||
{
|
||||
nixos =
|
||||
{
|
||||
system =
|
||||
{
|
||||
fileSystems =
|
||||
{
|
||||
mount =
|
||||
{
|
||||
btrfs =
|
||||
{
|
||||
"/dev/disk/by-uuid/403fe853-8648-4c16-b2b5-3dfa88aee351"."/boot" = "/boot";
|
||||
"/dev/mapper/root" = { "/nix" = "/nix"; "/nix/rootfs/current" = "/"; };
|
||||
};
|
||||
};
|
||||
decrypt.manual =
|
||||
{
|
||||
enable = true;
|
||||
devices."/dev/disk/by-uuid/bf7646f9-496c-484e-ada0-30335da57068" = { mapper = "root"; ssd = true; };
|
||||
delayedMount = [ "/" ];
|
||||
};
|
||||
swap = [ "/nix/swap/swap" ];
|
||||
rollingRootfs = {};
|
||||
};
|
||||
grub.installDevice = "/dev/disk/by-path/pci-0000:00:04.0";
|
||||
nixpkgs.march = "znver2";
|
||||
nix.substituters = [ "https://cache.nixos.org/" "https://nix-store.chn.moe" ];
|
||||
initrd.sshd.enable = true;
|
||||
networking = { hostname = "vps4"; networkd = {}; };
|
||||
kernel.variant = "xanmod-latest";
|
||||
};
|
||||
services =
|
||||
{
|
||||
snapper.enable = true;
|
||||
sshd = {};
|
||||
fail2ban = {};
|
||||
beesd.instances.root = { device = "/"; hashTableSizeMB = 64; };
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
39
devices/vps4/secrets.yaml
Normal file
39
devices/vps4/secrets.yaml
Normal file
@@ -0,0 +1,39 @@
|
||||
hello: ENC[AES256_GCM,data:mX0hKnLdaujfHSyIikkannf8DDo+r7R0,iv:my9nYiaburkWHQLsNetqD3dYVwsEkJhC7hoh0XagoOk=,tag:D7uhoFGMrTWT3K4LNMFcUA==,type:str]
|
||||
example_key: ENC[AES256_GCM,data:ezHOG8aSXYlosn7ymQ==,iv:NLm785UMihcL1K/M4u7k+P2XftyLlIxtQGPmMLc+rs8=,tag:h9xk+do8pYzxYzUaKKb1PQ==,type:str]
|
||||
#ENC[AES256_GCM,data:pgOf9IVK9ijocRr0uEO0ZA==,iv:aQ2dvfAVhkFWtcDM4VeJQa+NN6kw9IlvidL/usoP/lE=,tag:49iS4s1EfQK5VhlF9nqWRQ==,type:comment]
|
||||
example_array:
|
||||
- ENC[AES256_GCM,data:W8QJiOY6ofqE+XRodK0=,iv:KQ/mYY4N/YA9LhZvJtPJPqRVQq4ob/xa8JSQY06Vm4M=,tag:7NQgidSCjER//ru3AXgLzQ==,type:str]
|
||||
- ENC[AES256_GCM,data:nNML0iYEFdW4S5rJVHM=,iv:LQ1/E/7FExXB16Ur4b59XAUlWSFPub6LQBaFCY+a2lE=,tag:LqPymQ7k5ZsS8d9Z09xJuA==,type:str]
|
||||
example_number: ENC[AES256_GCM,data:UiALks+CeKFusw==,iv:8gQ0aB+9YHXKVDX7moqdQmNJLGDNGfo+glezE39xXgQ=,tag:sJG+DJNzCtx+l4bBgQTtCQ==,type:float]
|
||||
example_booleans:
|
||||
- ENC[AES256_GCM,data:n3cV5g==,iv:z2p5oh8BhEMvwwIDaO8aM8VfxmsR6Z7473pd348tsmU=,tag:oSYsNuk6vY21Nepy8Hkb7g==,type:bool]
|
||||
- ENC[AES256_GCM,data:ns3chHI=,iv:db8M/qF03VKaT/8Q4NqfCdI1zAU9H8JWZFqnzwI7QvI=,tag:FdgUanhezouVdv+9a9/gxQ==,type:bool]
|
||||
sops:
|
||||
kms: []
|
||||
gcp_kms: []
|
||||
azure_kv: []
|
||||
hc_vault: []
|
||||
age:
|
||||
- recipient: age19ax6vm3pv8rph5tq3mmehd9sy9jk823tw8svsd790r0lkslycquqvlwz9m
|
||||
enc: |
|
||||
-----BEGIN AGE ENCRYPTED FILE-----
|
||||
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBIaE9nWEZFaE51alYyTUgr
|
||||
RVBKZ1MvNitBdGpMWURIUkhCTlF6Y1hueVFjCnp2Q0JVL0t2UEZrSmxMbFVwZ0k5
|
||||
QVZDdXNjWmg0S3BIaXF0NDBHOThiMDAKLS0tIDBpenAyTE51MWVkaHFvTFhzNmVV
|
||||
WnlKUFZWNWtaYUpPZkplSm04Q3RFb00Kghj7jLLcLpc8njNyxPj6JWZbBRn2Ou9j
|
||||
FJLfCGLePuJPmdBBN4AGHmtrkfw/SMZJ50DXhKSJSxM91zuJSqFV1g==
|
||||
-----END AGE ENCRYPTED FILE-----
|
||||
- recipient: age1nnd6u8l20julg4jz4l6kw5gmj6h2tsngpm7n8dx59umgw2s66y4shq6jv4
|
||||
enc: |
|
||||
-----BEGIN AGE ENCRYPTED FILE-----
|
||||
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSAzYkJ1NllUR1pMaUdmZ3Z6
|
||||
OEVLWC9nZHNxNWJSZ3VZUVZ3eWlLNWN5V24wClZ3dTh3SVNRS0Z4TFJrNDJBVnJj
|
||||
aDhYNTdSV2JmUVNXR1ZkN1BOdzZzRHcKLS0tIFNhUGIxRVM5MFdvUWZWOG5kYlFM
|
||||
RjZtLzY5b00vMExFSU1xZEl0NFJQQlEK4yUe3V0u6A3niES0Nq28rRYZ1fTEL0Fh
|
||||
RBGZNCute1SShrLZPgNr/lFAc6d8DH6N0IuDKcjguuWtyHY/LFYuYw==
|
||||
-----END AGE ENCRYPTED FILE-----
|
||||
lastmodified: "2024-06-27T09:40:19Z"
|
||||
mac: ENC[AES256_GCM,data:ZdocsIbkzcWsTia7s98T5hjM5HDyBc1a0pwAb3IEFAom9Q0LjOs02BjsBKQT9Z+eMU+Ugkaz+kgP4hwYbcUuAbiVChU6sLMxUPwQDE8E7sJINZvJzth4Kl5SF4qz9fEuY8ZTP1hHc/HC6fSfWm+zH8n755aBjrzdIUvPV0Qv3xI=,iv:SSjyvgMSgZsoKHspRrNJpkmRTDdFqQlJGLUybyMcXbg=,tag:EBLpGZLNwDZxsWwh7Eva7w==,type:str]
|
||||
pgp: []
|
||||
unencrypted_suffix: _unencrypted
|
||||
version: 3.8.1
|
||||
90
devices/vps6/default.nix
Normal file
90
devices/vps6/default.nix
Normal file
@@ -0,0 +1,90 @@
|
||||
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" = "/"; };
|
||||
};
|
||||
};
|
||||
decrypt.manual =
|
||||
{
|
||||
enable = true;
|
||||
devices."/dev/disk/by-uuid/4f8aca22-9ec6-4fad-b21a-fd9d8d0514e8" = { mapper = "root"; ssd = true; };
|
||||
delayedMount = [ "/" ];
|
||||
};
|
||||
swap = [ "/nix/swap/swap" ];
|
||||
rollingRootfs = {};
|
||||
};
|
||||
grub.installDevice = "/dev/disk/by-path/pci-0000:00:05.0-scsi-0:0:0:0";
|
||||
nixpkgs.march = "sandybridge";
|
||||
nix.substituters = [ "https://cache.nixos.org/" "https://nix-store.chn.moe" ];
|
||||
initrd.sshd.enable = true;
|
||||
networking = { hostname = "vps6"; networkd = {}; };
|
||||
# do not use cachyos kernel, beesd + cachyos kernel + heavy io = system freeze, not sure why
|
||||
};
|
||||
services =
|
||||
{
|
||||
snapper.enable = true;
|
||||
sshd = {};
|
||||
xray.server = { serverName = "vps6.xserver.chn.moe"; userNumber = 20; };
|
||||
frpServer = { enable = true; serverName = "frp.chn.moe"; };
|
||||
nginx =
|
||||
{
|
||||
streamProxy.map =
|
||||
{
|
||||
"anchor.fm" = { upstream = "anchor.fm:443"; proxyProtocol = false; };
|
||||
"podcasters.spotify.com" = { upstream = "podcasters.spotify.com:443"; proxyProtocol = false; };
|
||||
"xlog.chn.moe" = { upstream = "cname.xlog.app:443"; proxyProtocol = false; };
|
||||
}
|
||||
// (builtins.listToAttrs (builtins.map
|
||||
(site: { name = "${site}.chn.moe"; value.upstream.address = "wireguard.pc.chn.moe"; })
|
||||
[ "nix-store" "xn--qbtm095lrg0bfka60z" ]))
|
||||
// (builtins.listToAttrs (builtins.map
|
||||
(site: { name = "${site}.chn.moe"; value.upstream.address = "wireguard.vps7.chn.moe"; })
|
||||
[
|
||||
"xn--s8w913fdga" "misskey" "synapse" "syncv3.synapse" "matrix" "syncv3.matrix"
|
||||
"send" "kkmeeting" "api" "git" "grafana" "vikunja"
|
||||
]));
|
||||
applications =
|
||||
{
|
||||
element.instances."element.chn.moe" = {};
|
||||
synapse-admin.instances."synapse-admin.chn.moe" = {};
|
||||
catalog.enable = true;
|
||||
blog.enable = true;
|
||||
main.enable = true;
|
||||
nekomia.enable = true;
|
||||
};
|
||||
};
|
||||
coturn = {};
|
||||
httpua = {};
|
||||
mirism.enable = true;
|
||||
fail2ban = {};
|
||||
wireguard =
|
||||
{
|
||||
enable = true;
|
||||
peers = [ "pc" "nas" "vps7" "surface" "xmupc1" "xmupc2" "pi3b" ];
|
||||
publicKey = "AVOsYUKQQCvo3ctst3vNi8XSVWo1Wh15066aHh+KpF4=";
|
||||
wireguardIp = "192.168.83.1";
|
||||
listenIp = "74.211.99.69";
|
||||
lighthouse = true;
|
||||
};
|
||||
beesd.instances.root = { device = "/"; hashTableSizeMB = 64; };
|
||||
};
|
||||
};
|
||||
specialisation.generic.configuration =
|
||||
{
|
||||
nixos.system.nixpkgs.march = inputs.lib.mkForce null;
|
||||
system.nixos.tags = [ "generic" ];
|
||||
};
|
||||
};
|
||||
}
|
||||
94
devices/vps6/secrets.yaml
Normal file
94
devices/vps6/secrets.yaml
Normal file
@@ -0,0 +1,94 @@
|
||||
acme:
|
||||
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:
|
||||
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]
|
||||
#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]
|
||||
#ENC[AES256_GCM,data:h7E4P6BiGjktYg==,iv:DhkK3NNppBqo3sXt9U7kbgfaBPYcSEX2hu6VOAesDiE=,tag:XoVbZklwCmU1EBhv0ujcSw==,type:comment]
|
||||
user18: ENC[AES256_GCM,data:dssxPEv8srXydunolaaDAYYo+BOXhp2PoqidOWH3z6NYBpyB,iv:WCLcMMwQJiHZBwreQpaOZp2saXvjBwgYUqSf7HQhMgA=,tag:5jsAVcgAgO+7JhBINz6tzQ==,type:str]
|
||||
#ENC[AES256_GCM,data:qGsMmWrUIzVdHw==,iv:DXayEA5zquwOzm+TqECYNHM98r0WSzcP3gA8zkzdPy4=,tag:OKTx12RqP9VxJQOnrBLkmw==,type:comment]
|
||||
user19: ENC[AES256_GCM,data:+Mh15DR9xvFAwks86iuHEA9FpObKWTSuVOEzUDpBUS/h0hOz,iv:zYIkic2bibvwCBpomnJ9465mda1rbm3RERBZY9twXuc=,tag:bwdL6DAGgkGYhYFI2C4A+A==,type:str]
|
||||
private-key: ENC[AES256_GCM,data:ts/LRGFAsYqvGvkvlxUI42IW1a8cGsSkpZhMDd3QVceRKvhPb1SRDaXoSw==,iv:6xX9xFIFUNlLBZ6CPBOz9JbHpvC4+QG9ZaCZcWdl12c=,tag:DYIa+QTV8vyl1l7OKKykTw==,type:str]
|
||||
nginx:
|
||||
#ENC[AES256_GCM,data:85LrqdTMIhSa,iv:mIQPYz8VPd5AxeMCQEdTGMD0Iqa5QEAa5+8JVFaj3JM=,tag:TcZd7S3WRPpEV9lHI1fzbw==,type:comment]
|
||||
#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]
|
||||
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: []
|
||||
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-06-30T10:43:57Z"
|
||||
mac: ENC[AES256_GCM,data:Mg/DZghIkaWM5KEjk5zg3S0L5qPa8/rkc2ooSjA1ewzbDhTKls2tzv7fQqLx2WQtcJiKkoVx22UkiL0AzBwJdCr3473vx93ajTVK9HNu3jqXmuzSiv2iVS21EX9tyBNiL6uWlVAtlVfMMs69PEUF+EJIYY5TkVVPaQjzEebwo5w=,iv:tFON7RVSnNNHo5U4dRuMGDhH5iPGShW9uoda+apiIjI=,tag:3nG/u7vaChFBHoDsLLb23w==,type:str]
|
||||
pgp: []
|
||||
unencrypted_suffix: _unencrypted
|
||||
version: 3.8.1
|
||||
80
devices/vps7/default.nix
Normal file
80
devices/vps7/default.nix
Normal file
@@ -0,0 +1,80 @@
|
||||
inputs:
|
||||
{
|
||||
config =
|
||||
{
|
||||
nixos =
|
||||
{
|
||||
system =
|
||||
{
|
||||
fileSystems =
|
||||
{
|
||||
mount =
|
||||
{
|
||||
btrfs =
|
||||
{
|
||||
"/dev/disk/by-uuid/e36287f7-7321-45fa-ba1e-d126717a65f0"."/boot" = "/boot";
|
||||
"/dev/mapper/root" = { "/nix" = "/nix"; "/nix/rootfs/current" = "/"; };
|
||||
};
|
||||
};
|
||||
decrypt.manual =
|
||||
{
|
||||
enable = true;
|
||||
devices."/dev/disk/by-uuid/db48c8de-bcf7-43ae-a977-60c4f390d5c4" = { mapper = "root"; ssd = true; };
|
||||
delayedMount = [ "/" ];
|
||||
};
|
||||
swap = [ "/nix/swap/swap" ];
|
||||
rollingRootfs = {};
|
||||
};
|
||||
grub.installDevice = "/dev/disk/by-path/pci-0000:00:05.0-scsi-0:0:0:0";
|
||||
nixpkgs.march = "znver2";
|
||||
nix.substituters = [ "https://cache.nixos.org/" "https://nix-store.chn.moe" ];
|
||||
initrd.sshd.enable = true;
|
||||
networking = { hostname = "vps7"; networkd = {}; };
|
||||
kernel.variant = "cachyos-server";
|
||||
};
|
||||
services =
|
||||
{
|
||||
snapper.enable = true;
|
||||
sshd = {};
|
||||
rsshub.enable = true;
|
||||
wallabag.enable = true;
|
||||
misskey.instances =
|
||||
{ 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; };
|
||||
};
|
||||
vaultwarden.enable = true;
|
||||
beesd.instances.root = { device = "/"; hashTableSizeMB = 1024; loadAverage = 4; };
|
||||
photoprism.enable = true;
|
||||
nextcloud = {};
|
||||
freshrss.enable = true;
|
||||
send.enable = true;
|
||||
huginn.enable = true;
|
||||
fz-new-order = {};
|
||||
nginx.applications = { kkmeeting.enable = true; webdav.instances."webdav.chn.moe" = {}; };
|
||||
httpapi.enable = true;
|
||||
gitea = { enable = true; ssh = {}; };
|
||||
grafana.enable = true;
|
||||
fail2ban = {};
|
||||
wireguard =
|
||||
{
|
||||
enable = true;
|
||||
peers = [ "vps6" ];
|
||||
publicKey = "n056ppNxC9oECcW7wEbALnw8GeW7nrMImtexKWYVUBk=";
|
||||
wireguardIp = "192.168.83.2";
|
||||
listenIp = "95.111.228.40";
|
||||
};
|
||||
vikunja.enable = true;
|
||||
chatgpt = {};
|
||||
xray.server = { serverName = "xserver.vps7.chn.moe"; userNumber = 4; };
|
||||
};
|
||||
};
|
||||
specialisation.generic.configuration =
|
||||
{
|
||||
nixos.system.nixpkgs.march = inputs.lib.mkForce null;
|
||||
system.nixos.tags = [ "generic" ];
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,9 +1,10 @@
|
||||
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]
|
||||
led: ENC[AES256_GCM,data:Owax7cyp,iv:NCEKyicVCYZNgxJzlO90heUmwPjfXbZEcyXX09XQKI4=,tag:WMTCVMVCD9sJgAhRUsqvYg==,type:str]
|
||||
chat: ENC[AES256_GCM,data:1HJiO1zU5SX4G56oWxv5zqGyUqnBWByrtSnQ01wvmZ7PmRkrV+DV6StMg5DtJR9HhkWYnbXlbnBHzP+poPUMag==,iv:sfwI62nwGSnsdj1RyADWgXvp5AY+9RQdtSooxbKFWTs=,tag:pN/LF0mo7RXWoIPPzzs8qw==,type:str]
|
||||
maxmind-license: ENC[AES256_GCM,data:9aW4QR3K6S+eTqzIjVlNEwkG0wZ4u5jgRfe7CMwRlJlK4AmcS6c45Q==,iv:cPTN1K4Aag5sohGbCQUZHYTvcwAL7AhF+rrY3OvXGPs=,tag:d9GGUMHnfzRz9Cf2U+dBfw==,type:str]
|
||||
redis:
|
||||
rsshub: ENC[AES256_GCM,data:uPnZIjbnRRoWIHlWkZNZkMpIb3Ujnnpb+AisVSVGFv4sfDAuDlAjt39pRdnWkCXJPqtXjJzQ+FeT34cqxTf8Bg==,iv:/jcyAHkxByFnbkmCAYQwda2QRmhW7L/ICoLuCgsVLCI=,tag:M5Q+dh/Bn7FiNpqQGYus4Q==,type:str]
|
||||
@@ -27,8 +28,7 @@ postgresql:
|
||||
grafana: ENC[AES256_GCM,data:ZLtDIZ3oKasE4r1WNllNe/rkXxqRS+QAJI7EGPKhiFF1BtAxD46UpGQnUag3yg0gP/8+3COQs6camVSxcKFL1A==,iv:wMj3keVjNpVwNMwlt4E3ds1EYjLNIZ/S3RydhOlmYWU=,tag:ZRn7NWaUPbf2rHYLoLYw+w==,type:str]
|
||||
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]
|
||||
meilisearch:
|
||||
misskey-misskey: ENC[AES256_GCM,data:4s+qqd6mmstioC0XmG/vA6ED9mzu1vRJVPFFalRiqnnsFy0dYEU87H+y12eOp/KDSLdTNvpp6Z6jCNvxnpDXzQ==,iv:x6L9OPu/dwVsD9pYb4dqavw9NesMbo7LB+rwz6veAR4=,tag:/BBqV2sHIgPas7XsZydh2g==,type:str]
|
||||
vikunja: ENC[AES256_GCM,data:syb4NYBxL3DdmZmcC+em0klmm6bkkIL/DH/gnzShYRiaezRFskT+yay9govn++SpbuvkoCJq/GYAFxNL+hcVtw==,iv:TQUgdzYQ0gqsAmux9v3BAQFNzHnCTZ+X/OC0b9Bfya8=,tag:b1AsiAW5XzA3DzGdf8J03g==,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]
|
||||
@@ -53,8 +53,6 @@ synapse:
|
||||
form: ENC[AES256_GCM,data:7HF7HMUH1BTJgXXP6cpUiVj0jCwGW57bx9wKTJu7PnRsNuAam/+nKX7Zfg7WD+gSBlA=,iv:SYeUsuFVgAA6U6STCtKT5c5E8Kglh3x7hy6+Op4n0W8=,tag:eICmHTwwn0KcgNhdDGnusA==,type:str]
|
||||
signing-key: ENC[AES256_GCM,data:hzxxDbGp1L09O7+ueUSa5lJOY/QvF2zvHdpueEHjaPQEToQt9mr2loeTQHC7ObTegfLb9UHrI1jn4A==,iv:KngfahwYZZmDQ5LeOUPWptTMGAC8TZm1G0FWcrwCwsw=,tag:U9pW6/boBIpiswn67Ezrfw==,type:str]
|
||||
sliding-sync: ENC[AES256_GCM,data:BeA6g98IWDP6hnLFI77QqG6esDwB6j3OPzAv3eJxWoTajAsByHSgSYP1vHN5Iok6IgvSSmkf0/HiOJy1Ca8IIA==,iv:ca+t/rYwc/fAVUcz0JTmrRQCOcbDNscbnE8BpHkx/OE=,tag:eEfhUChUt4kRnO82XqRY4g==,type:str]
|
||||
nebula:
|
||||
key: ENC[AES256_GCM,data:9o6EkfTWOU0KwnJsgHML4E7VOfzo3LHnlOkV8ubhi6aayXImC3lAaoPrqUI=,iv:KHprijN7z+4FIIW+D5klDM9a9VzMJ5xawPc7jJtbHmk=,tag:0DAmxoz8D5f38ndPbkNW+g==,type:str]
|
||||
vaultwarden:
|
||||
admin_token: ENC[AES256_GCM,data:muavuOY88Lm4rSEoCp4IIPp7Z+sqf36VwpnPgf+K6IwwFkUgYM1GO80ogReYWqqUM6ij1Yzl5D9ncUbq+aGTKQ==,iv:jA4MRJlz71CMmPnWjb2tGbbIoMkEsESUowhXDckKKMI=,tag:l0HaJmnU29YeFUxjOgN3Kg==,type:str]
|
||||
mariadb:
|
||||
@@ -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]
|
||||
@@ -105,6 +101,24 @@ grafana:
|
||||
chn: ENC[AES256_GCM,data:0bbjggWS1MdcUIQiQyPlBTULm+faKDpJbmZmV6vSw8k=,iv:am65WQzUE+AvQrQV+NSF5u6RCWn7EetyPsdy4Cuvyyw=,tag:lxNUM1cIYVSXVgwEnS1Hdw==,type:str]
|
||||
wireguard:
|
||||
privateKey: ENC[AES256_GCM,data:TS+toaJRgAvC78XVwTciXe2IG8++vaqXVCi/u/8Aej6qq1B9Cb6f20cp5K0=,iv:T/NkLvcYiWzIDG3jWtuhe/sH2GT4z5f0xdUGbSL901I=,tag:qN7YokFBj3Kbbx4ijHTRnw==,type:str]
|
||||
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]
|
||||
xray-server:
|
||||
clients:
|
||||
#ENC[AES256_GCM,data:aAZS,iv:Z+iJG7yC6HJeNdKCCpsZSc9Ny7kAt6GYfXUtZozMb4A=,tag:iMfwjqqmLvu5a8YpF7a0zQ==,type:comment]
|
||||
user0: ENC[AES256_GCM,data:Q8MFrN/3SRgzSlwTx2GmpP/gvG1vpYiVgjsESzUoomsJaigP,iv:oLsf7AX3FE0tFOkJAbqrZVrCa6UxKjp450Sl1rs2Vs0=,tag:5w+AX0p4Or1GAQsEU3NxOQ==,type:str]
|
||||
#ENC[AES256_GCM,data:j3zVwqHmag==,iv:8+ol60wNlbV2RzMBe47VxIrZuec8aXDUNcQvHcxKuiA=,tag:1AgCMfZf9vzWiWDS6hkw2Q==,type:comment]
|
||||
user1: ENC[AES256_GCM,data:ucCiL7uoSafFUP9IiwKOjJqgwNxNLmuHxYXsLYl0fBgbCT3F,iv:RbNPwvSWibODQqySRc+YW65nUvRwaeXT0eDh02sfrwM=,tag:iE7GGrkBxljBT9HdPzDOfA==,type:str]
|
||||
#ENC[AES256_GCM,data:x7dwVDe22M8=,iv:+fT7VUxZGd8SgS0PnEBqHLPLDuywu4s01iWB6TA/BKQ=,tag:CxfP7xSd4L9RBulSfViHaQ==,type:comment]
|
||||
user2: ENC[AES256_GCM,data:e6PbRg30dzOJSXNmU6TML4AaFsSWEvZwN7MHAEX6fEW2p3hW,iv:Y+YYAO6hY9e/T8LSCr34M7riGmSzFIocmWwAwWjnZQs=,tag:LTkdGcRyrx7HqvbSYSsv4A==,type:str]
|
||||
#ENC[AES256_GCM,data:j83rYg==,iv:3oEdAoVz7aMcezcy2chTO0LQTtKpTrJJoQZx3PC03BU=,tag:ABteEIyr2Y6MbGQhmrQySQ==,type:comment]
|
||||
user3: ENC[AES256_GCM,data:Uk0Ax9FVzmmYs+ggWy7z6FEkuj2tppGlvnQdoW6PDI1VA9oI,iv:wSxigXleRUalQR1/TzKfdUVrdyEUuq+Wg42gSv1QMAI=,tag:qn6nBWv6MlGhMarCfI13BA==,type:str]
|
||||
private-key: ENC[AES256_GCM,data:TarrinCFzWkB5zCc7i7f3B3tFfxrF+cGnrg4bw9CAGKWBazSJHCviY8Imw==,iv:azHdrc6AlgS9RPwGVsYRb8bBeC/askCdut1rnv9TA3I=,tag:AT2lLraKVgbp9GmlLJiI+w==,type:str]
|
||||
sops:
|
||||
kms: []
|
||||
gcp_kms: []
|
||||
@@ -129,8 +143,8 @@ sops:
|
||||
SnFHS1Z0SXUzTFdEd29KTy9DU3Y3R0UKfhh+rUmWDrf+UGjclP57dHipPLFoXSqy
|
||||
HdelmfV6q4/c7ppx2E+oZw3VNgoZCsrxxzYZfwxHJiZb+5vkE0D8iA==
|
||||
-----END AGE ENCRYPTED FILE-----
|
||||
lastmodified: "2023-12-20T06:27:19Z"
|
||||
mac: ENC[AES256_GCM,data:i7AN+Sd4C61GSzT409mYd6D2tQzDyONIUsto52b1mV8hIJ4Q/U9VT5wumRjm4dGUWqrq9oFdD0/iUL1CmEdasBN7VFwNEpSYl6yhzU7zX3Re3N/0mffeW0Fx/38LdvywusJAHC9yWvsNMblKDnYxGm/UI2W/7QRMDyr8jnU6La0=,iv:Ua+K1m27GkkrUn+wcylkwrdWnq1yzFG1NMVzYAiW/6k=,tag:Gqqk5zOU3Ax2Al5CvXEV7g==,type:str]
|
||||
lastmodified: "2024-06-08T09:15:52Z"
|
||||
mac: ENC[AES256_GCM,data:EY6sFc4EcTuxPgIZQ51HFZZZf+khb7mkNEvb6U12kCtoJAEo+i83uszwBZCo/QWw6VCCt9c//9y0mNH4FjZPJAxweJHcRtanyTXa5jdyv12qINUceYe7Uhcb7JuiiEns9DEbrr3UeAKfbPC+N5mD/2trzht0E8hqnFlWU/fysz8=,iv:saymdP4nFveEWx0JrBR2bW8SUl6xCJKhYqw+CsrfRG8=,tag:CHGvJAO8hpSMNdU2YE2OGw==,type:str]
|
||||
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
|
||||
|
||||
297
devices/xmupc1/README.md
Normal file
297
devices/xmupc1/README.md
Normal file
@@ -0,0 +1,297 @@
|
||||
# 硬件
|
||||
|
||||
* CPU:16 核 32 线程。
|
||||
* 内存:96 G。
|
||||
* 显卡:
|
||||
* 4090:24 G 显存。
|
||||
* 3090:24 G 显存。
|
||||
* 2080Ti: 12 G 显存。
|
||||
* 硬盘:2 T。
|
||||
|
||||
# 队列系统(SLURM)
|
||||
|
||||
## 基本概念
|
||||
|
||||
SLURM 是一个用来对任务排队的系统,轮到某个任务时,再调用其它程序来执行这个任务。
|
||||
|
||||
## 常用命令
|
||||
|
||||
我做了一个 TUI 界面,用起来比较简单,大多情况下可以满足需求。命令为:
|
||||
|
||||
```bash
|
||||
sbatch-tui
|
||||
```
|
||||
|
||||
或
|
||||
|
||||
```bash
|
||||
sbatch
|
||||
```
|
||||
|
||||
如果需要在提交任务时指定更详细的细节,或者要编写脚本批量提交任务,则在 `sbatch` 后面加上参数,这时是直接调用来自 SLURM 的 `sbatch` 命令。
|
||||
常用的参数见下文。更详细的内容见 SLURM 的官方文档。
|
||||
|
||||
提交一个 VASP GPU 任务的例子:
|
||||
|
||||
```bash
|
||||
sbatch --gpus=1 --ntasks-per-gpu=1 --job-name="my great job" vasp-nvidia
|
||||
```
|
||||
|
||||
* `--gpus` 指定使用GPU 的情况:
|
||||
* 要占用任意一个 GPU(排到这个任务时哪个空闲就使用哪个),写 `--gpus=1`。要占用任意两个就写 `--gpus=2`,以此类推。
|
||||
但一般来说,**单个任务不要占用超过一个 GPU**,多个显卡的速度会比单个更慢。
|
||||
* 要指定具体使用哪个 GPU 时,写 `--gpus=4090:1`。2080 Ti 需要写为 `2080_ti`,P5000 需要写为 `p5000`。
|
||||
* 当需要使用多个不同类型的显卡(例如,指定使用一个 3090 和一个 4090)时,写 `--gres=gpu:3090:1,gpu:4090:1`。
|
||||
* `--ntasks-per-gpu=1` 对于 VASP 来说一定要写。
|
||||
* `--job-name=xxx` 指定任务的名字。可以简写为 `-J`。也可以不指定。
|
||||
* 默认情况下,一个 task 会搭配分配一个 CPU 核(一个线程),一般已经够用。如果一定要修改,用 `--cpus-per-task`。
|
||||
* `vasp-nvidia` 指调用 std 版本,要使用 gam 或 ncl 版本时,写为例如 `vasp-nvidia-gam`。
|
||||
|
||||
提交一个 VASP CPU 任务的例子:
|
||||
|
||||
```bash
|
||||
sbatch --ntasks=4 --cpus-per-task=4 --hint=nomultithread --job-name="my great job" vasp-intel
|
||||
```
|
||||
|
||||
* `--ntasks=4 --cpus-per-task=4` 指定使用占用多少核。
|
||||
* CPU 的调度是个非常复杂的问题,而且 slurm 和 Intel MPI 之间的兼容性也不算好,因此**推荐照抄下面的设置**。
|
||||
也可以自己测试一下怎样分配更好,但不要随意地设置。不同的设置会成倍地影响性能。
|
||||
* 对于 xmupc1:`--ntasks=3 --cpus-per-task=4`。
|
||||
* 对于 xmupc2:`--ntasks=4 --cpus-per-task=10`。
|
||||
* `--hint=nomultithread` 记得写。
|
||||
* `--job-name=xxx` 指定任务的名字。可以简写为 `-J`。也可以不指定。
|
||||
* `vasp-intel` 指调用 std 版本,要使用 gam 或 ncl 版本时,写为例如 `vasp-intel-gam`。
|
||||
|
||||
要把其它程序提交到队列里,也是类似的写法。请自行举一反三。
|
||||
|
||||
要列出已经提交(包括已经完成、取消、失败)的任务:
|
||||
|
||||
```bash
|
||||
squeue -t all -l
|
||||
```
|
||||
|
||||
取消一个任务:
|
||||
|
||||
```bash
|
||||
# 按任务的 id 取消
|
||||
scancel 114514
|
||||
# 按任务的名字取消
|
||||
scancel -n my_great_job
|
||||
# 取消一个用户的所有任务
|
||||
scancel -u chn
|
||||
```
|
||||
|
||||
要将自己已经提交的一个任务优先级提到最高(相应降低其它任务的优先级,使得总体来说不影响别人的任务):
|
||||
|
||||
```bash
|
||||
scontrol top 114514
|
||||
```
|
||||
|
||||
要显示一个任务的详细信息(不包括服务器重启之前算过的任务):
|
||||
|
||||
```bash
|
||||
scontrol show job 114514
|
||||
```
|
||||
|
||||
要显示一个任务的详细信息(包括服务器重启之前算过的任务):
|
||||
|
||||
```bash
|
||||
sacct --units M --format=ALL -j 114514 | bat -S
|
||||
```
|
||||
|
||||
## `sbatch` 的更多参数
|
||||
|
||||
```bash
|
||||
# 提交一个新任务,但是礼让后面的任务(推迟到指定时间再开始排队)
|
||||
--begin=16:00 --begin=now+1hour
|
||||
# 指定工作目录
|
||||
--chdir=/path/to/your/workdir
|
||||
# 指定备注
|
||||
--comment="my great job"
|
||||
# 指定任务的 ddl,算不完就杀掉
|
||||
--deadline=now+1hour
|
||||
# 标准错误输出写到别的文件里
|
||||
--error=error.log
|
||||
# 将一些环境变量传递给任务(=ALL是默认行为)
|
||||
--export=ALL,MY_ENV_VAR=my_value
|
||||
# 不传递现在的环境变量
|
||||
--export=NONE
|
||||
# 打开一个文件作为标准输入
|
||||
--input=
|
||||
# 发生一些事件(任务完成等)时发邮件
|
||||
--mail-type=NONE,BEGIN,END,FAIL,REQUEUE,ALL --mail-user=chn@chn.moe
|
||||
# 要求分配内存(不会真的限制内存使用,只是在分配资源时会考虑)
|
||||
--mem=20G --mem-per-cpu --mem-per-gpu
|
||||
# 输出文件是否覆盖
|
||||
--open-mode={append|truncate}
|
||||
# 指定输出文件
|
||||
-o, --output=<filename_pattern>
|
||||
# 不排队,直接跑(超额分配)
|
||||
-s, --oversubscribe
|
||||
# 包裹一个二进制程序
|
||||
--wrap=
|
||||
```
|
||||
|
||||
# 支持的连接协议
|
||||
|
||||
## SSH
|
||||
|
||||
ssh 就是 putty winscp 之类的工具使用的那个协议。
|
||||
|
||||
* 地址:xmupc1.chn.moe
|
||||
* 端口:6007
|
||||
* 用户名:自己名字的拼音首字母
|
||||
* 可以用密码登陆,也可以用证书登陆。
|
||||
|
||||
从一台服务器登陆到其它服务器,只需要使用 `ssh`` 命令:
|
||||
|
||||
```bash
|
||||
ssh jykang
|
||||
ssh xmupc1
|
||||
ssh xmupc2
|
||||
ssh user@host
|
||||
```
|
||||
|
||||
直接从另外一台服务器下载文件,可以使用 `rsync` 命令:
|
||||
|
||||
```bash
|
||||
rsync -avzP jykang:/path/to/remote/directory_or_file /path/to/local/directory
|
||||
```
|
||||
|
||||
将另外一个服务器的某个目录挂载到这个服务器,可以使用 `sshfs` 命令:
|
||||
|
||||
```bash
|
||||
sshfs jykang:/path/to/remote/directory /path/to/local/directory
|
||||
```
|
||||
|
||||
用完之后记得卸载(不卸载也不会有什么后果,只是怕之后忘记了以为这是本地的目录,以及如果网络不稳定的话,运行在这里的软件可能会卡住):
|
||||
|
||||
```bash
|
||||
umount /path/to/local/directory
|
||||
```
|
||||
|
||||
如果不喜欢敲命令来挂载/卸载远程目录,也可以 RDP 登陆后用 dolphin。
|
||||
|
||||
## RDP
|
||||
|
||||
就是 windows 那个远程桌面。
|
||||
|
||||
* 地址:xmupc1.chn.moe
|
||||
* 用户名:自己名字的拼音首字母
|
||||
* 密码和 ssh 一样(使用同样的验证机制)。
|
||||
|
||||
RDP 暂时没有硬件加速(主要是毛玻璃之类的特效会有点卡)。
|
||||
|
||||
记得在连接时,点击“显示选项”,将“体验”中的连接速度改为“LAN(10 Mbps 或更高)”,不然会很卡。
|
||||
|
||||
## samba
|
||||
|
||||
samba 就是 windows 共享文件夹的那个协议。
|
||||
|
||||
* 地址:xmupc1.chn.moe
|
||||
* 用户名:自己名字的拼音首字母
|
||||
* 初始密码和 ssh 一样,你可以自己修改密码(使用 `smbpasswd` 命令)。samba 的密码和 ssh/rdp 的密码是分开的,它们使用不同的验证机制。
|
||||
|
||||
在 windows 上,可以直接在资源管理器中输入 `\\xmupc1.chn.moe` 访问。
|
||||
也可以将它作为一个网络驱动器添加(地址同样是 `\\xmupc1.chn.moe`)。
|
||||
|
||||
# 计算软件
|
||||
|
||||
## VASP
|
||||
|
||||
VASP 有很多很多个版本,具体来说:
|
||||
|
||||
* 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-env mpirun -np 1 -x CUDA_DEVICE_ORDER=PCI_BUS_ID -x CUDA_VISIBLE_DEVICES=0 -x OMP_NUM_THREADS=4 vasp-std
|
||||
vasp-intel-env mpirun -n 2 -genv OMP_NUM_THREADS=4 vasp-std
|
||||
```
|
||||
|
||||
其中 `CUDA_VISIBLE_DEVICES` 用于指定用哪几个显卡计算(多个显卡用逗号分隔)。
|
||||
要查看显卡的编号,可以用 `CUDA_DEVICE_ORDER=PCI_BUS_ID vasp-nvidia-env nvaccelinfo` 命令。
|
||||
|
||||
这里 `vasp-xxx-env` 命令的作用是,进入一个安装了对应版本的 VASP 的环境,实际上和 VASP 关系不大;
|
||||
后面的 `mpirun xxx` 才是真的调用 VASP。
|
||||
所以实际上你也可以在这个环境里做别的事情,例如执行上面的 `nvaccelinfo` 命令。
|
||||
|
||||
要使用 VTST tools 里带的脚本,需要在命令前加上 `vtstscripts` 。例如:
|
||||
|
||||
```bash
|
||||
vtstscripts dist.pl POSCAR.init POSCAR.final
|
||||
```
|
||||
|
||||
## mumax
|
||||
|
||||
问龚斌,我没用过。
|
||||
|
||||
## lammps
|
||||
|
||||
除了我应该没人用,就不写了。
|
||||
|
||||
## quantum espresso
|
||||
|
||||
我也只用过一次。大规模用到了再说吧。
|
||||
|
||||
# 其它软件
|
||||
|
||||
我自己电脑上有的软件,服务器都有装,用于科研的比如 VESTA 什么的。可以自己去菜单里翻一翻。
|
||||
|
||||
## 操作系统
|
||||
|
||||
操作系统是 NixOS,是一个相对来说比较小众的系统。
|
||||
它是一个所谓“函数式”的系统。
|
||||
也就说,理想情况下,系统的状态(包括装了什么软件、每个软件和服务的设置等等)是由一组配置文件唯一决定的(这组配置文件放在 `/etc/nixos` 中)。
|
||||
要修改系统的状态(新增软件、修改设置等等),只需要修改这组配置文件,然后要求系统应用这组配置文件就可以了,
|
||||
系统会自动计算出应该怎么做(增加、删除、修改哪些文件,重启哪些服务等等)。
|
||||
这样设计有许多好处,例如可以方便地回滚到之前任意一个时刻的状态(方便在调试时试错);
|
||||
一份配置文件可以描述多台机器的系统,在一台上调试好后在其它机器上直接部署;
|
||||
以及适合抄或者引用别人写好的配置文件。
|
||||
|
||||
以上都是对于管理员来说的好处。对于用户来说的好处不是太多,但是也有一些。
|
||||
举个例子,如果用户需要使用一个没有安装的软件(例如 `phonopy`,当然实际上这个已经装了),只需要在要执行的命令前加一个逗号:
|
||||
|
||||
```bash
|
||||
, phonopy --dim 2 2 2
|
||||
```
|
||||
|
||||
系统就会帮你下载所有的依赖,并在一个隔离的环境中运行这个命令(不会影响这之后系统的状态)。
|
||||
|
||||
还有一个命令可能也有用,叫 `try`。
|
||||
它会在当前的文件系统上添加一个 overlay,之后执行的命令对文件的修改只会发生在这个 overlay 上;
|
||||
命令执行完成后,它会告诉你哪些文件发生了改变,然后可以选择实际应用这些改变还是丢弃这些改变。
|
||||
例如:
|
||||
|
||||
```bash
|
||||
try phonopy --dim 2 2 2
|
||||
```
|
||||
|
||||
这个命令和 NixOS 无关,只是突然想起来了。
|
||||
|
||||
## 文件系统
|
||||
|
||||
文件系统是 BtrFS。它的好处有:
|
||||
|
||||
* 同样的内容只占用一份空间;以及内容会被压缩存储(在读取时自动解压)。这样大致可以节省一半左右的空间。
|
||||
例如现在 xll 目录里放了 213 G 文件,但只占用了 137 G 空间。
|
||||
* 每小时自动备份,放置在 `/nix/persistent/.snapshots` 中,大致上会保留最近一周的备份。如果你误删了什么文件,可以去里面找回。
|
||||
|
||||
## ZSH
|
||||
|
||||
所谓 “shell” 就是将敲击的一行行命令转换成操作系统能理解的系统调用(C 语言的函数)的那个东西,也就是负责解释敲进去的命令的意思的那个程序。
|
||||
|
||||
大多情况下默认的 shell 是 bash,但我装的服务器上用 zsh。
|
||||
zsh 几乎完全兼容 bash 的语法,除此以外有一些顺手的功能:
|
||||
* 如果忘记了曾经输入过的一个命令,输入其中的几个连续的字母或者单词(不一定是开头的几个字母),然后按 `↑` 键,就会自动在历史命令中依次搜索。
|
||||
例如我输入 `install` 按几下 `↑` 键,就可以找到 `sudo nixos-rebuild boot --flake . --install-bootloader --option substituters https://nix-store.chn.moe` 这个东西。
|
||||
* 如果从头开始输入一个曾经输入过的命令,会用浅灰色提示这个命令。要直接补全全部命令,按 `→` 键。要补全一个单词,按 `Ctrl` + `→` 键。
|
||||
* 常用的命令,以及常用命令的常用选项,按几下 `tab` 键,会自动补全或者弹出提示。
|
||||
97
devices/xmupc1/default.nix
Normal file
97
devices/xmupc1/default.nix
Normal file
@@ -0,0 +1,97 @@
|
||||
inputs:
|
||||
{
|
||||
config =
|
||||
{
|
||||
nixos =
|
||||
{
|
||||
system =
|
||||
{
|
||||
fileSystems =
|
||||
{
|
||||
mount =
|
||||
{
|
||||
vfat."/dev/disk/by-uuid/467C-02E3" = "/boot/efi";
|
||||
btrfs =
|
||||
{
|
||||
"/dev/disk/by-uuid/2f9060bc-09b5-4348-ad0f-3a43a91d158b" = { "/nix" = "/nix"; "/nix/boot" = "/boot"; };
|
||||
"/dev/disk/by-uuid/a04a1fb0-e4ed-4c91-9846-2f9e716f6e12" =
|
||||
{
|
||||
"/nix/rootfs" = "/nix/rootfs";
|
||||
"/nix/persistent" = "/nix/persistent";
|
||||
"/nix/nodatacow" = "/nix/nodatacow";
|
||||
"/nix/rootfs/current" = "/";
|
||||
};
|
||||
};
|
||||
};
|
||||
swap = [ "/nix/swap/swap" ];
|
||||
rollingRootfs = {};
|
||||
};
|
||||
grub.installDevice = "efi";
|
||||
nixpkgs =
|
||||
{
|
||||
march = "znver3";
|
||||
cuda =
|
||||
{
|
||||
enable = true;
|
||||
capabilities =
|
||||
[
|
||||
# p5000 p400
|
||||
"6.1"
|
||||
# 2080 Ti
|
||||
"7.5"
|
||||
# 3090
|
||||
"8.6"
|
||||
# 4090
|
||||
"8.9"
|
||||
];
|
||||
forwardCompat = false;
|
||||
};
|
||||
};
|
||||
gui = { enable = true; preferred = false; autoStart = true; };
|
||||
networking.hostname = "xmupc1";
|
||||
nix.remote.slave.enable = true;
|
||||
};
|
||||
hardware = { cpus = [ "amd" ]; gpu.type = "nvidia"; };
|
||||
packages.packageSet = "workstation";
|
||||
virtualization = { waydroid.enable = true; docker.enable = true; kvmHost = { enable = true; gui = true; }; };
|
||||
services =
|
||||
{
|
||||
snapper.enable = true;
|
||||
sshd = { passwordAuthentication = true; groupBanner = true; };
|
||||
xray.client.enable = true;
|
||||
firewall.trustedInterfaces = [ "virbr0" "waydroid0" ];
|
||||
smartd.enable = true;
|
||||
beesd.instances =
|
||||
{
|
||||
root = { device = "/"; hashTableSizeMB = 16384; threads = 4; };
|
||||
nix = { device = "/nix"; hashTableSizeMB = 512; };
|
||||
};
|
||||
wireguard =
|
||||
{
|
||||
enable = true;
|
||||
peers = [ "vps6" ];
|
||||
publicKey = "JEY7D4ANfTpevjXNvGDYO6aGwtBGRXsf/iwNwjwDRQk=";
|
||||
wireguardIp = "192.168.83.6";
|
||||
};
|
||||
slurm =
|
||||
{
|
||||
enable = true;
|
||||
cpu = { cores = 16; threads = 2; mpiThreads = 3; openmpThreads = 4; };
|
||||
memoryMB = 94208;
|
||||
gpus = { "2080_ti" = 1; "3090" = 1; "4090" = 1; };
|
||||
};
|
||||
xrdp = { enable = true; hostname = [ "xmupc1.chn.moe" ]; };
|
||||
samba =
|
||||
{
|
||||
enable = true;
|
||||
hostsAllowed = "";
|
||||
shares = { home.path = "/home"; root.path = "/"; };
|
||||
};
|
||||
groupshare = {};
|
||||
};
|
||||
bugs = [ "xmunet" "amdpstate" ];
|
||||
user.users = [ "chn" "xll" "zem" "yjq" "gb" ];
|
||||
};
|
||||
services.hardware.bolt.enable = true;
|
||||
};
|
||||
}
|
||||
48
devices/xmupc1/secrets/default.yaml
Normal file
48
devices/xmupc1/secrets/default.yaml
Normal file
@@ -0,0 +1,48 @@
|
||||
acme:
|
||||
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:
|
||||
uuid: ENC[AES256_GCM,data:4PM/d263HgBseIgRplgo5ahJ8u8HuPznXt2hW5O+VawS6WjP,iv:98Ymj4eiCGQPMcaHBI9zJAaRagm82mF0LY2c9bzA+/s=,tag:8imXq/hxAxS5XKy0uWIBPw==,type:str]
|
||||
wireguard:
|
||||
privateKey: ENC[AES256_GCM,data:Azaqung7llErB7/IdnOnEkwjQ39yQHKcO7VgvMDCDTExM7nS0zx+yMYX4ls=,iv:FX8oLHMBVEnKkYOg8q2A9vFmtRZDws5T87+lEl7+2G8=,tag:DdOQUbNKB6JK7Tp6McQ0Og==,type:str]
|
||||
users:
|
||||
#ENC[AES256_GCM,data:1RG/IM/UrLCk,iv:LY2QCBN0gYwuhVwS/WIrjt4MEHhjPPQG+cjTZJhU6Zc=,tag:AEL+smmitSqW+D70K74LbQ==,type:comment]
|
||||
xll: ENC[AES256_GCM,data:YauaeGHDVAnMXp9hSz4r4jNsioF79Q+WplfsYGpl4g5FxoakhfjRlnfzrLmMO3mWEIBOmDqeShbDEulyV5O47CIBGaMUUHe+Gg==,iv:RNwRfghJBb0PO4A/T5d5J1U0NsXdygXlWq/FfF8MO4U=,tag:BOh666TYGbCCHcgB/uBhTw==,type:str]
|
||||
#ENC[AES256_GCM,data:zxOQcoOzJNBK,iv:YJQB8lV+nhwm5XYMpDIyt0IDHBlHTiHO8cpgXkXe/dQ=,tag:re5ekGkYRewPdxv83mtLUQ==,type:comment]
|
||||
zem: ENC[AES256_GCM,data:bIxVN4T3Gh3aSa1gylkPmW3/uT5xQAlruC+L3zk0Tc3KvwBCQA5DpxXU8ZxjeK0P0xGi02U7gFWgm+yxp6otdCsUEmWed4EHHw==,iv:vpKpY0nRUwuI5mCcYTOD3zN/E21wHl4ZbRDUPoFmdhQ=,tag:m5WTzCgOTC7oqU4yfV9gkQ==,type:str]
|
||||
#ENC[AES256_GCM,data:ZnMFN0WzjKDd,iv:t1YHrNoHOohYsdBOqoV6OtfS5ig6CTS8jW5mKy0oSQA=,tag:WkgrH1ZXcbHruxJY/hVsmg==,type:comment]
|
||||
yjq: ENC[AES256_GCM,data:ua0DINHutjt2Pk+SfHRQRV99mT3Cnw6rRKO8VRIAlP0dY6QhK9wkNdyRYWYRBKVrWgyFQMGNFYAxIpymjF/X7mBOVI2sOHLgkw==,iv:PUZ6S0KICuqoSA2sDLxdL4gtAOQnQXOUY+5f3qDZgpc=,tag:f39P34vAUOrV23BsKkRarA==,type:str]
|
||||
#ENC[AES256_GCM,data:6qNjSdjck4Vz,iv:c/GNqCNgRgwgL+2f6Vumtjb/ub9WCBSy8R02NRCDqk8=,tag:b/tucJsHTjSfcK0vgHtE8A==,type:comment]
|
||||
gb: ENC[AES256_GCM,data:3eAKBiJoC1owCHTFd3Xq8vI8VK980evePc92xCXJJ21M9D1MdbwN8ySZ3Ovjk7VfQmEo8oRv1Ll1sftyrXYoeTHmJsNDxCpR6A==,iv:Ju/ERNuGrgO5kYlbvmkbLJkgiW3Elou34AsJTFITCUg=,tag:POVlxYh9kZ1BMSbt97IVOQ==,type:str]
|
||||
mariadb:
|
||||
slurm: ENC[AES256_GCM,data:qQMD8SKNmxb3PdScXNqppF9zkX7dV5i7rvljvZuhiI5zLnu77qYCHBW6ymh0mrY14N9NjxmQZhZWX/H8TvBlcg==,iv:J5N3LjCYW3QmuEkMBpl7qvPFW1Z9ZoPLkj45jKcIW9U=,tag:Tl+ld07+lVkmzt7f/f2MqQ==,type:str]
|
||||
sops:
|
||||
kms: []
|
||||
gcp_kms: []
|
||||
azure_kv: []
|
||||
hc_vault: []
|
||||
age:
|
||||
- recipient: age19ax6vm3pv8rph5tq3mmehd9sy9jk823tw8svsd790r0lkslycquqvlwz9m
|
||||
enc: |
|
||||
-----BEGIN AGE ENCRYPTED FILE-----
|
||||
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSB5RWIreCtMeTZ0UE9Zd2di
|
||||
VE9tR0x6SUNyWjlPV1BqMU5Tb0RTSXNGN2hNCkxuVjFFb0xJZTBMekxqdE96RlRh
|
||||
czF0dHQxdVhsNE5tVWg0Q2RmYktsWDgKLS0tIFY3dHRlbFpsWUsyTzA3RVR1Qyts
|
||||
UUJHMU13cm1lOXhRYzhSWlFyTFltYWcKDUxABRGskWWpHEFL44gHYzAqaQ3AmBDt
|
||||
LcL/4IiEs3TwOpuY+WTVx8JKZBOsxcSlNahiDuCnoTbL4gZTPnd0pA==
|
||||
-----END AGE ENCRYPTED FILE-----
|
||||
- recipient: age1hnarptkze0ujpp05dqr8uma04cxg9zqcx68qgpks5uf5l6rpk5gqhh8wxg
|
||||
enc: |
|
||||
-----BEGIN AGE ENCRYPTED FILE-----
|
||||
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBwbHd4ZHhsTk5leDlreC9E
|
||||
TVAzRXVuS0Judk5zTGVWRVhWSUhpMFdscEg0ClVFYzZYZG9hNjJKTlRVZ1I3eXVq
|
||||
M2Y5by85dE1QM25yQ3g3bFVSL2tsVlkKLS0tIHVYbGxrT0hOQkZ5SHBsQ3UyaVly
|
||||
ZDNHUjE2QVlCV3p0NHdKYW5IMHVBZzQKkZtfyvfroOntg3yRjMw4jQHiQj8eaB2h
|
||||
IeIHfW4y01mmVT2ofbtB0xYpjcl4gtUlQ8X3tn5iJ9P8gcVo0G598A==
|
||||
-----END AGE ENCRYPTED FILE-----
|
||||
lastmodified: "2024-05-10T08:53:57Z"
|
||||
mac: ENC[AES256_GCM,data:ImxIE0d7cEpudUKGs9zHCMFKlHYwFfztLWe5ZMWOrQxr7/uRxfCsiIvuU1nRri0jx2x8J6EFAG1BdrF4KRSeW5sIB9Tlk7X1TJ69zSdLhhnIuPl+rSyovoIkMQAJ0Wvyvlgimh1VQyaBkPsjnGk/dga1N0+gIlmiwFKY5uTpaaA=,iv:fo6S9fIDxnp7VWYYWH613U6bxIlDBZaNObkRR3AdgEc=,tag:ZRIMHkWRsf75K3Tg3Xv5xw==,type:str]
|
||||
pgp: []
|
||||
unencrypted_suffix: _unencrypted
|
||||
version: 3.8.1
|
||||
24
devices/xmupc1/secrets/munge.key
Normal file
24
devices/xmupc1/secrets/munge.key
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"data": "ENC[AES256_GCM,data:tuEymMXW0f7Rui5wrz/xozphTEq6ffkYIfNIoURFNHwH2Cg+aKHz2ox0gk02BJARhPMDrxCYlChkcrEI0ma/T0eBe9sWz3tA8AOwU1lHSZ06d/JWzW7IUIyTac2mnjt3/jY/qpnR4A8wtHwD0j4zkzXgUgFwq7k/fs24acEE4Jo=,iv:iDTS0xswLrwkOYmfomE5hluVONgJYia/RjINDy7T3R0=,tag:oIYNpFCuT2D+X1QEJJiHew==,type:str]",
|
||||
"sops": {
|
||||
"kms": null,
|
||||
"gcp_kms": null,
|
||||
"azure_kv": null,
|
||||
"hc_vault": null,
|
||||
"age": [
|
||||
{
|
||||
"recipient": "age19ax6vm3pv8rph5tq3mmehd9sy9jk823tw8svsd790r0lkslycquqvlwz9m",
|
||||
"enc": "-----BEGIN AGE ENCRYPTED FILE-----\nYWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSA3aFRRa0NsOUp5MEg3UHcx\nc3g1VFZEQS9Tci9QSnNFYnIrT3hUdVU5cWxjCnU5UXVEdTFXczJzcHVvSjF2WHdB\nYmpyQVVaUFozKzJIZThBbXUxb2k2YzAKLS0tIHE1QXVrOXo1Y3VXMzJJYitWU3Qv\neDF1cndrSi94clh1cS9NczN0UW9pOXcKtrnIj3WovMYdcg5nWnnyRhJhTGLrlwxW\nxQ6bmNrfbZedmCNdjY2lPXmudMXJ8YlWe/HGCe94x3iFlaSwCIGUsA==\n-----END AGE ENCRYPTED FILE-----\n"
|
||||
},
|
||||
{
|
||||
"recipient": "age1hnarptkze0ujpp05dqr8uma04cxg9zqcx68qgpks5uf5l6rpk5gqhh8wxg",
|
||||
"enc": "-----BEGIN AGE ENCRYPTED FILE-----\nYWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBocFl1SHJEemRySlBnMmNn\nVW9RS1NNdlo4M3l2WGlQaHJmbDBHcjMwaVVnCnY5WExPOXZJVEdYSlJ6UTRBMGJj\ncmlYaUNVV1hnWTNkaWVuV2VuaXN2eU0KLS0tIDBTYnd2NmVYTUJKaHZWRWo3ZlUx\nTEtPZWc2RE1XNG9WTXFOTllWVUVWeUkK+9aLz1rygGAQjpG+oMNUtrDkQaDfg+2q\nnl/CtZZrFD6NXGw6Di0X5t9fQu295NTJ/0qjXnfMigG8gDtxkE+/7g==\n-----END AGE ENCRYPTED FILE-----\n"
|
||||
}
|
||||
],
|
||||
"lastmodified": "2024-02-26T06:04:53Z",
|
||||
"mac": "ENC[AES256_GCM,data:y0RkPyUwwff95BFL951TxS/x5ORzMsxFJVjopSw+8iVtswD8MT1nmsbwyth4C9OnJ/IAtnZk/CjAt72a68AZpPI+2W/JqJq20ohFoquDNhTlsoyLWdO3Vjrd+Wo3hp0+iKQ3e/uYrF1sTqQO9a3OIxu2sVLM0gEDmIe2nJpLJQo=,iv:EjXTQvVdjzfClNfQ3rPxAFVWVqr7sSOz4ap+nshPEAk=,tag:DcIlf9W7NNqQ+gf8f46MwQ==,type:str]",
|
||||
"pgp": null,
|
||||
"unencrypted_suffix": "_unencrypted",
|
||||
"version": "3.8.1"
|
||||
}
|
||||
}
|
||||
31
devices/xmupc2/README.md
Normal file
31
devices/xmupc2/README.md
Normal file
@@ -0,0 +1,31 @@
|
||||
# 硬件
|
||||
|
||||
* CPU:44 核 88 线程。
|
||||
* 内存:256 G。
|
||||
* 显卡:
|
||||
* 4090:24 G 显存。
|
||||
* P5000:16 G 显存。
|
||||
* 硬盘:18 T。
|
||||
|
||||
# 支持的连接协议
|
||||
|
||||
## SSH
|
||||
|
||||
* 地址:xmupc2.chn.moe
|
||||
* 端口:6394
|
||||
* 用户名:自己名字的拼音首字母
|
||||
* 可以用密码登陆,也可以用证书登陆。
|
||||
|
||||
## RDP
|
||||
|
||||
* 地址:xmupc2.chn.moe
|
||||
* 用户名:自己名字的拼音首字母
|
||||
* 密码和 ssh 一样(使用同样的验证机制)。
|
||||
|
||||
## samba
|
||||
|
||||
* 地址:xmupc2.chn.moe
|
||||
* 用户名:自己名字的拼音首字母
|
||||
* 初始密码和 ssh 一样。
|
||||
|
||||
其它内容请阅读 [xmupc1](../xmupc1) 的说明,两台机器的软件大致是一样的。
|
||||
81
devices/xmupc2/default.nix
Normal file
81
devices/xmupc2/default.nix
Normal file
@@ -0,0 +1,81 @@
|
||||
inputs:
|
||||
{
|
||||
config =
|
||||
{
|
||||
nixos =
|
||||
{
|
||||
system =
|
||||
{
|
||||
fileSystems =
|
||||
{
|
||||
mount =
|
||||
{
|
||||
vfat."/dev/disk/by-uuid/23CA-F4C4" = "/boot/efi";
|
||||
btrfs =
|
||||
{
|
||||
"/dev/disk/by-uuid/d187e03c-a2b6-455b-931a-8d35b529edac" =
|
||||
{ "/nix/rootfs/current" = "/"; "/nix" = "/nix"; "/nix/boot" = "/boot"; };
|
||||
};
|
||||
};
|
||||
swap = [ "/nix/swap/swap" ];
|
||||
rollingRootfs = {};
|
||||
};
|
||||
grub.installDevice = "efi";
|
||||
nixpkgs =
|
||||
{
|
||||
march = "skylake";
|
||||
cuda =
|
||||
{
|
||||
enable = true;
|
||||
capabilities =
|
||||
[
|
||||
# p5000 p400
|
||||
"6.1"
|
||||
# 2080 Ti
|
||||
"7.5"
|
||||
# 3090
|
||||
"8.6"
|
||||
# 4090
|
||||
"8.9"
|
||||
];
|
||||
forwardCompat = false;
|
||||
};
|
||||
};
|
||||
gui = { enable = true; preferred = false; autoStart = true; };
|
||||
networking.hostname = "xmupc2";
|
||||
nix.remote.slave.enable = true;
|
||||
};
|
||||
hardware = { cpus = [ "intel" ]; gpu.type = "nvidia"; };
|
||||
packages.packageSet = "workstation";
|
||||
virtualization = { waydroid.enable = true; docker.enable = true; kvmHost = { enable = true; gui = true; }; };
|
||||
services =
|
||||
{
|
||||
snapper.enable = true;
|
||||
sshd = { passwordAuthentication = true; groupBanner = true; };
|
||||
xray.client.enable = true;
|
||||
firewall.trustedInterfaces = [ "virbr0" "waydroid0" ];
|
||||
smartd.enable = true;
|
||||
beesd.instances.root = { device = "/"; hashTableSizeMB = 16384; threads = 4; };
|
||||
wireguard =
|
||||
{
|
||||
enable = true;
|
||||
peers = [ "vps6" ];
|
||||
publicKey = "lNTwQqaR0w/loeG3Fh5qzQevuAVXhKXgiPt6fZoBGFE=";
|
||||
wireguardIp = "192.168.83.7";
|
||||
};
|
||||
slurm =
|
||||
{
|
||||
enable = true;
|
||||
cpu = { sockets = 2; cores = 22; threads = 2; mpiThreads = 4; openmpThreads = 10; };
|
||||
memoryMB = 253952;
|
||||
gpus = { "4090" = 1; "p5000" = 1; };
|
||||
};
|
||||
xrdp = { enable = true; hostname = [ "xmupc2.chn.moe" ]; };
|
||||
samba = { enable = true; hostsAllowed = ""; shares = { home.path = "/home"; root.path = "/"; }; };
|
||||
groupshare = {};
|
||||
};
|
||||
bugs = [ "xmunet" ];
|
||||
user.users = [ "chn" "xll" "zem" "yjq" "gb" ];
|
||||
};
|
||||
};
|
||||
}
|
||||
48
devices/xmupc2/secrets/default.yaml
Normal file
48
devices/xmupc2/secrets/default.yaml
Normal file
@@ -0,0 +1,48 @@
|
||||
acme:
|
||||
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:
|
||||
uuid: ENC[AES256_GCM,data:j2R0UtfS/es2A+Ic+Kq6FZJSqXlA/Q8tGkuAIX0ZdTsV4hGk,iv:Ovpr49isIJRdUyM3jxgiT+9Sc+qTF6ZnkKUwxIq6KUs=,tag:2VRSkiPNWaOmCqLJti8Bzw==,type:str]
|
||||
wireguard:
|
||||
privateKey: ENC[AES256_GCM,data:0Vw9NVs/Kxc52zUlmeAPFeOG8msdL0YopjhzFKRWhv6+kfb+SFObOP8EJ2M=,iv:KgIZIawbnN+1sIcMjNECkdtujPbg7yQktKVc25SXavI=,tag:b79oZP+GZKmM3OVFshvFhg==,type:str]
|
||||
users:
|
||||
#ENC[AES256_GCM,data:FP1Mr1TmRI4L,iv:3K4LMbOQPvF1ORWNyaXDoC5MXn3yColR4eKs9sm9y5s=,tag:f3guTegVXw1A6aqolKQnqA==,type:comment]
|
||||
xll: ENC[AES256_GCM,data:CAEd+usnLKoQZ+0PLEiJfbZpz2pyn+I/edC2KbNXBXZPAgT7IDENMnSQyxme899KqRVL4nLrtHs82aA8+kl/dE+QYSTCFVVuHg==,iv:Hs8rb0Iu5Xw74p9/cL2gWfPLh61VaLzIltKUSjRFZjc=,tag:/u5vI0oTMQbNoCEzhcWqOw==,type:str]
|
||||
#ENC[AES256_GCM,data:UIns0CnC/QmJ,iv:Gn4XDPcdTyDLXAgGq7qwayrN206Gx7JsJ3V9G+4bTyA=,tag:FITVs8Tgkiq1XoS8joXM1Q==,type:comment]
|
||||
zem: ENC[AES256_GCM,data:znpGuS8LVxaztnwQlIwu3hykWRBUtQvOsniLaOasXDbw9lHGX8lwwYJuCE+0I14HmiZK/RrrouIwfAfcjZQzPyjJ/SRoOG1Vyg==,iv:YXHX43y99/w9102vhsvFLVOUtJmuRnLVLu+ywfn9URY=,tag:AzsmkXOyX7y/D+ndteuMmA==,type:str]
|
||||
#ENC[AES256_GCM,data:6vMItERptBsX,iv:G0sDjEfLciheMxTZbeLIbWKlimPD1ANIk/VVdhQifXA=,tag:oR9FEdVx6W+0uDeKfb37iw==,type:comment]
|
||||
yjq: ENC[AES256_GCM,data:sGPQ0xALULREnhzl9g/V91M5osMglsSps6R4gYn5OZc/4xVC1phF3qajVN3YMOr7kKgkHbF2Rjm6/2vuK0k1iYZnFswUAmFlmw==,iv:5vG1hn7SlX6HCpas2BgxBSwWqLby8OCxcH3EKNvceIc=,tag:TVwFBAuosKnEOZecq1phXw==,type:str]
|
||||
#ENC[AES256_GCM,data:ALHxkRABA+ll,iv:r1IDiHLFcTdLID3q16zrLTavAwQfddC7bXMKcFZFveI=,tag:4Pd0/Q1BmH4gJjaM4hbqqQ==,type:comment]
|
||||
gb: ENC[AES256_GCM,data:z4CrtdmdLJJ0qZzr7qvihnluJQgjtciX56KdEmtemiRu0llEJk9qz6a23aJ7m40Sfc38elF1/LsvjOuBOC87+BVkKDCj76phag==,iv:WrFVxkr3snmqDXZx5kAYCLp7ixEIzxoT7El3rV7Ovqg=,tag:iExf2Y/HObHQrKMTRvqn7A==,type:str]
|
||||
mariadb:
|
||||
slurm: ENC[AES256_GCM,data:9wLQ1zF/kDaiw0s3UaRpiHgmngU7u6hwyqpddSjev0+Z0v58Q2oiJtK8vn+2VlSxx5ACfqEFbzp0PZYAxd575w==,iv:q9JTkgDymOwkbZ/PaxRAAQrtO96QmGgZcQuLTFCMoS4=,tag:dwOHlOTgZqT/1jQ+oGf7UQ==,type:str]
|
||||
sops:
|
||||
kms: []
|
||||
gcp_kms: []
|
||||
azure_kv: []
|
||||
hc_vault: []
|
||||
age:
|
||||
- recipient: age19ax6vm3pv8rph5tq3mmehd9sy9jk823tw8svsd790r0lkslycquqvlwz9m
|
||||
enc: |
|
||||
-----BEGIN AGE ENCRYPTED FILE-----
|
||||
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSA0Rmc2Ull1WFB4Smh3c0Zl
|
||||
emlTNGJKZkpIK2JFeUNVeUcrR2FzRXRQZHlvCkhzMHpzYmZRZ0M0cXdRVi8wZmp6
|
||||
ZDRZQ2FkOWt6M0lrdjBHa3VTWXBDKzgKLS0tIGtJbTRRelg1VVk2QStwdzlFM1g4
|
||||
M1JOd1g3cVdjUFRhZ0FxcWphZXZJbkkKFXDtJVoi+qIrXp6cznevuZ+peBiRRITP
|
||||
rrplqLiYsNIGKmKYtRIUu8WXDZ2q2CJ8Z+pka3W3H/U+m957hBDWyw==
|
||||
-----END AGE ENCRYPTED FILE-----
|
||||
- recipient: age1l4stuz0vr7gs7pqwjrmezam44702jp2vmqaqyxw0l0r42kf9updq4dfhrw
|
||||
enc: |
|
||||
-----BEGIN AGE ENCRYPTED FILE-----
|
||||
YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBsSHdka3FPQUYrcXQzcTFo
|
||||
a000TUllT0MvUzk5ZzVFbXZheG9ZVTM2S253CkE5VW9tQktvL2pMWFoxcnFjTGpr
|
||||
Z0p1RjZWRGpSZ01TdTZRcEJXM2NOUkUKLS0tIC9rNmNzWitMdEd5dXQvdWlELzhM
|
||||
M0xoL1dQR0kvMWpzN0RMNWVCTFQxNFUKj9LPjBo5NGOrGYNvu8qZ13PLYjLEWllU
|
||||
LARzEn4XgkeHckouwvxZYMCx7WxmAruRWaOvnxTIczzSNP7wIrqnkA==
|
||||
-----END AGE ENCRYPTED FILE-----
|
||||
lastmodified: "2024-05-10T08:54:10Z"
|
||||
mac: ENC[AES256_GCM,data:4n7bAGzORwd6vHl/Cs5YT8VZaSdfvxUm6e+fw7PYC2ov8XoRlJKU/Bci8Sbwcy2H6OjbkdRYA61cB2wAjtEY1x9N/c6qvUAOjTvOtcXoQQex8d+aMnJsFfJQ70GHCZE+KRTmy1SAMn+N00Oy0FDisdQe/jIZuWyav5j62CKqLqc=,iv:YEhiXU2IgXy4A0ZLsNY7kFqXJM5RBHE4IZwlRoF8XMA=,tag:aVc0r2g1QkY42NP59p4m2w==,type:str]
|
||||
pgp: []
|
||||
unencrypted_suffix: _unencrypted
|
||||
version: 3.8.1
|
||||
24
devices/xmupc2/secrets/munge.key
Normal file
24
devices/xmupc2/secrets/munge.key
Normal file
@@ -0,0 +1,24 @@
|
||||
{
|
||||
"data": "ENC[AES256_GCM,data:Um00c+kry3QrHEZVdlUws+gGGvtPKh8WzkpT6CHL7uwHRUWc+5E0bvlwXFJTkmPdGOOV2Jx9fGvSKpQb1/MPJhMhpCAw5n69QIRjVVURZcvVVFrl+eNO2sf/h2GTFvKRAtlcNAh7cvjkpiB3r+S7mRYSI914B7w8GLTdRFvtqYo=,iv:gk7S1SiA0iBAfpXLhhPJuexolP6w1XAd8M2H+sqqmoM=,tag:O8Eoa4LjEo14H/+1W5rcgQ==,type:str]",
|
||||
"sops": {
|
||||
"kms": null,
|
||||
"gcp_kms": null,
|
||||
"azure_kv": null,
|
||||
"hc_vault": null,
|
||||
"age": [
|
||||
{
|
||||
"recipient": "age19ax6vm3pv8rph5tq3mmehd9sy9jk823tw8svsd790r0lkslycquqvlwz9m",
|
||||
"enc": "-----BEGIN AGE ENCRYPTED FILE-----\nYWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBWYmNFOFlnbm1FdXdGWUNr\nOGN3THhDUyt4SDVzcHY5dEYrSWsrQm1UOFJvCmhXaWFlcC8wazROaXZzcm9tUnFM\nQlphZ0x6c0RhbzY0aGVFbXdOa1BHbG8KLS0tIHF2YUNTVnZ3Z25FSnFlTEdmdXhE\nb3Z2UEp1c2UrOUp3NEdNcE5HSFptbzAKWGSTwv6xUNs/f+p0Bhpzg8zZ7EVK8kMm\no13fru2Cnqrw8Cj0zfx+7LODpBVzo03fLYKqZ6kbPZGa12ihk+fD4g==\n-----END AGE ENCRYPTED FILE-----\n"
|
||||
},
|
||||
{
|
||||
"recipient": "age1l4stuz0vr7gs7pqwjrmezam44702jp2vmqaqyxw0l0r42kf9updq4dfhrw",
|
||||
"enc": "-----BEGIN AGE ENCRYPTED FILE-----\nYWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOSBKRVMrenM2Q1ZheFVPc2Rz\nYVd6UGoxbkpSQlZsNFN1dmIzSkl6SERwaTBRCjlHV3MvTEpxbDY4OHZjeUd5NmRF\nRmc1NzVCMTA0bDhwajNlMWZKTlNKK2cKLS0tIHRZZ0cxY2dwV21iRDlmeE5UZkM4\nK1dKV24yY3FKV2J3U2VzZWt2QnBSTHcKn8mq+1RnJG/nBbH2mAFpSFSTHDWvMqJj\nsziW9lK0cH6bPxhcpDO4oG8K08bdGHUVGtx2Zk81CDqzfamlMzzG2Q==\n-----END AGE ENCRYPTED FILE-----\n"
|
||||
}
|
||||
],
|
||||
"lastmodified": "2024-03-09T07:59:38Z",
|
||||
"mac": "ENC[AES256_GCM,data:zNh6Cioh4+r0+nx04yLqeQShozxl7bLLKSmwodnmHtVQVlOTjj5sDLMEAAmrj1Ym2KrBPJOgdm34Sl6AbsmiBLxzDcBKe6J68Y/LHIeaPkToRKpmoy9I9a177w0KzFXgNaU2ieH71egD+nf8JmGG61hDjpiJRpx1Lwxb16Bn+Xs=,iv:QxiUYymiGuH0EBwEhyg5gDzkSKvGhq0+0wERNEJ71UM=,tag:N1Nn9X9vrghwwJWC3kituA==,type:str]",
|
||||
"pgp": null,
|
||||
"unencrypted_suffix": "_unencrypted",
|
||||
"version": "3.8.1"
|
||||
}
|
||||
}
|
||||
2003
flake.lock
generated
2003
flake.lock
generated
File diff suppressed because it is too large
Load Diff
775
flake.nix
775
flake.nix
@@ -3,10 +3,12 @@
|
||||
|
||||
inputs =
|
||||
{
|
||||
nixpkgs.url = "github:CHN-beta/nixpkgs/nixos-23.11";
|
||||
nixpkgs-unstable.url = "github:CHN-beta/nixpkgs/nixos-unstable";
|
||||
nixpkgs-2305.url = "github:CHN-beta/nixpkgs/nixos-23.05";
|
||||
home-manager = { url = "github:nix-community/home-manager/release-23.11"; inputs.nixpkgs.follows = "nixpkgs"; };
|
||||
nixpkgs.url = "github:CHN-beta/nixpkgs/nixos-unstable";
|
||||
"nixpkgs-23.11".url = "github:CHN-beta/nixpkgs/nixos-23.11";
|
||||
"nixpkgs-23.05".url = "github:CHN-beta/nixpkgs/nixos-23.05";
|
||||
"nixpkgs-22.11".url = "github:NixOS/nixpkgs/nixos-22.11";
|
||||
"nixpkgs-22.05".url = "github:NixOS/nixpkgs/nixos-22.05";
|
||||
home-manager = { url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; };
|
||||
sops-nix =
|
||||
{
|
||||
url = "github:Mic92/sops-nix";
|
||||
@@ -14,653 +16,184 @@
|
||||
};
|
||||
aagl = { url = "github:ezKEa/aagl-gtk-on-nix"; inputs.nixpkgs.follows = "nixpkgs"; };
|
||||
nix-index-database = { url = "github:Mic92/nix-index-database"; inputs.nixpkgs.follows = "nixpkgs"; };
|
||||
nur.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"; };
|
||||
nix-alien =
|
||||
{
|
||||
url = "github:thiagokokada/nix-alien";
|
||||
inputs = { nixpkgs.follows = "nixpkgs"; nix-index-database.follows = "nix-index-database"; };
|
||||
};
|
||||
impermanence.url = "github:nix-community/impermanence";
|
||||
qchem = { url = "github:Nix-QChem/NixOS-QChem"; 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"; };
|
||||
deploy-rs = { url = "github:serokell/deploy-rs"; inputs.nixpkgs.follows = "nixpkgs"; };
|
||||
pnpm2nix-nzbr = { url = "github:CHN-beta/pnpm2nix-nzbr"; inputs.nixpkgs.follows = "nixpkgs"; };
|
||||
lmix = { url = "github:CHN-beta/lmix"; inputs.nixpkgs.follows = "nixpkgs"; };
|
||||
dguibert-nur-packages = { url = "github:CHN-beta/dguibert-nur-packages"; inputs.nixpkgs.follows = "nixpkgs"; };
|
||||
qchem = { url = "github:Nix-QChem/NixOS-QChem/master"; inputs.nixpkgs.follows = "nixpkgs"; };
|
||||
plasma-manager =
|
||||
{
|
||||
url = "github:pjones/plasma-manager";
|
||||
inputs = { nixpkgs.follows = "nixpkgs"; home-manager.follows = "home-manager"; };
|
||||
};
|
||||
nix-doom-emacs = { url = "github:nix-community/nix-doom-emacs"; inputs.nixpkgs.follows = "nixpkgs"; };
|
||||
nur-linyinfeng = { url = "github:linyinfeng/nur-packages"; inputs.nixpkgs.follows = "nixpkgs"; };
|
||||
nixos-hardware.url = "github:CHN-beta/nixos-hardware";
|
||||
envfs = { url = "github:Mic92/envfs"; inputs.nixpkgs.follows = "nixpkgs"; };
|
||||
nix-fast-build = { url = "github:/Mic92/nix-fast-build"; inputs.nixpkgs.follows = "nixpkgs"; };
|
||||
nix-flatpak.url = "github:gmodena/nix-flatpak";
|
||||
chaotic =
|
||||
{
|
||||
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; };
|
||||
concurrencpp = { url = "github:David-Haim/concurrencpp"; flake = false; };
|
||||
cppcoro = { url = "github:Garcia6l20/cppcoro"; flake = false; };
|
||||
date = { url = "github:HowardHinnant/date"; flake = false; };
|
||||
eigen = { url = "gitlab:libeigen/eigen"; flake = false; };
|
||||
matplotplusplus = { url = "github:alandefreitas/matplotplusplus"; flake = false; };
|
||||
nameof = { url = "github:Neargye/nameof"; flake = false; };
|
||||
nodesoup = { url = "github:olvb/nodesoup"; flake = false; };
|
||||
tgbot-cpp = { url = "github:reo7sp/tgbot-cpp"; flake = false; };
|
||||
v-sim = { url = "gitlab:l_sim/v_sim"; flake = false; };
|
||||
rycee = { url = "gitlab:rycee/nur-expressions"; flake = false; };
|
||||
blurred-wallpaper = { url = "github:bouteillerAlan/blurredwallpaper"; flake = false; };
|
||||
slate = { url = "github:TheBigWazz/Slate"; flake = false; };
|
||||
linux-surface = { url = "github:linux-surface/linux-surface"; flake = false; };
|
||||
lepton = { url = "github:black7375/Firefox-UI-Fix"; flake = false; };
|
||||
lmod = { url = "github:TACC/Lmod"; flake = false; };
|
||||
mumax = { url = "github:CHN-beta/mumax"; flake = false; };
|
||||
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.filter (dir: (builtins.readDir ./devices/${dir})."default.nix" or null == "regular" )
|
||||
(builtins.attrNames (builtins.readDir ./devices));
|
||||
in
|
||||
{
|
||||
packages.x86_64-linux =
|
||||
packages =
|
||||
{
|
||||
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)
|
||||
[ "pc" "vps6" "vps7" "nas" "yoga" ]));
|
||||
}
|
||||
// (
|
||||
builtins.listToAttrs (builtins.map
|
||||
x86_64-linux = rec
|
||||
{
|
||||
pkgs = (import inputs.nixpkgs
|
||||
{ system = "x86_64-linux"; config.allowUnfree = true; overlays = [ inputs.self.overlays.default ]; });
|
||||
default = inputs.nixpkgs.legacyPackages.x86_64-linux.writeText "systems"
|
||||
(builtins.concatStringsSep "\n" (builtins.map
|
||||
(system: builtins.toString inputs.self.outputs.nixosConfigurations.${system}.config.system.build.toplevel)
|
||||
devices));
|
||||
hpcstat =
|
||||
let
|
||||
openssh = (pkgs.pkgsStatic.openssh.override { withLdns = false; etcDir = null; }).overrideAttrs
|
||||
(prev: { doCheck = false; patches = prev.patches ++ [ ./local/pkgs/hpcstat/openssh.patch ];});
|
||||
duc = pkgs.pkgsStatic.duc.override { enableCairo = false; cairo = null; pango = null; };
|
||||
in pkgs.pkgsStatic.localPackages.hpcstat.override
|
||||
{ inherit openssh duc; standalone = true; version = inputs.self.rev or "dirty"; };
|
||||
ufo = pkgs.pkgsStatic.localPackages.ufo.override { version = inputs.self.rev or "dirty"; };
|
||||
chn-bsub = pkgs.pkgsStatic.localPackages.chn-bsub;
|
||||
}
|
||||
// (
|
||||
builtins.listToAttrs (builtins.map
|
||||
(system:
|
||||
{
|
||||
name = system;
|
||||
value = inputs.self.outputs.nixosConfigurations.${system}.config.system.build.toplevel;
|
||||
})
|
||||
devices)
|
||||
);
|
||||
x86_64-w64-mingw32 = rec
|
||||
{
|
||||
pkgs = (import inputs.nixpkgs
|
||||
{
|
||||
crossSystem = inputs.nixpkgs.lib.systems.examples.mingwW64 // { isStatic = true; libc = "ucrt"; };
|
||||
system = "x86_64-linux";
|
||||
config.allowUnfree = true;
|
||||
overlays = [ inputs.self.overlays.default ];
|
||||
});
|
||||
boost = pkgs.boost.override { zstd = null; };
|
||||
magic-enum = pkgs.magic-enum.overrideAttrs (prev: { cmakeFlags = prev.cmakeFlags ++
|
||||
[ "-DMAGIC_ENUM_OPT_BUILD_EXAMPLES=OFF" "-DMAGIC_ENUM_OPT_BUILD_TESTS=OFF" ]; });
|
||||
range-v3 = pkgs.range-v3.overrideAttrs (prev: { cmakeFlags = prev.cmakeFlags ++
|
||||
[ "-DRANGE_V3_DOCS=OFF" "-DRANGE_V3_TESTS=OFF" "-DRANGE_V3_EXAMPLES=OFF" ]; });
|
||||
biu = pkgs.localPackages.biu.override { inherit boost magic-enum range-v3; };
|
||||
winjob = pkgs.localPackages.winjob.override { inherit biu; };
|
||||
};
|
||||
};
|
||||
nixosConfigurations =
|
||||
(
|
||||
(builtins.listToAttrs (builtins.map
|
||||
(system:
|
||||
{
|
||||
name = system;
|
||||
value = inputs.self.outputs.nixosConfigurations.${system}.config.system.build.toplevel;
|
||||
})
|
||||
[ "pc" "vps6" "vps7" "nas" "yoga" "xmupc1" ])
|
||||
);
|
||||
# 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
|
||||
nixosConfigurations =
|
||||
let
|
||||
system =
|
||||
{
|
||||
pc =
|
||||
{
|
||||
system =
|
||||
{
|
||||
fileSystems =
|
||||
{
|
||||
mount =
|
||||
{
|
||||
vfat."/dev/disk/by-uuid/3F57-0EBE" = "/boot/efi";
|
||||
btrfs =
|
||||
{
|
||||
"/dev/disk/by-uuid/02e426ec-cfa2-4a18-b3a5-57ef04d66614"."/" = "/boot";
|
||||
"/dev/mapper/root" = { "/nix" = "/nix"; "/nix/rootfs/current" = "/"; };
|
||||
};
|
||||
};
|
||||
decrypt.auto =
|
||||
{
|
||||
"/dev/disk/by-uuid/55fdd19f-0f1d-4c37-bd4e-6df44fc31f26" = { mapper = "root"; ssd = true; };
|
||||
"/dev/disk/by-uuid/4be45329-a054-4c20-8965-8c5b7ee6b35d" =
|
||||
{ mapper = "swap"; ssd = true; before = [ "root" ]; };
|
||||
};
|
||||
swap = [ "/dev/mapper/swap" ];
|
||||
resume = "/dev/mapper/swap";
|
||||
rollingRootfs = { device = "/dev/mapper/root"; path = "/nix/rootfs"; };
|
||||
};
|
||||
grub =
|
||||
{
|
||||
windowsEntries = { "7317-1DB6" = "Windows"; "7321-FA9C" = "Windows for malware"; };
|
||||
installDevice = "efi";
|
||||
};
|
||||
nix =
|
||||
{
|
||||
marches =
|
||||
[
|
||||
"alderlake"
|
||||
# CX16
|
||||
"sandybridge"
|
||||
# CX16 SAHF FXSR
|
||||
"silvermont"
|
||||
# RDSEED MWAITX SHA CLZERO CX16 SSE4A ABM CLFLUSHOPT WBNOINVD
|
||||
"znver2" "znver3"
|
||||
# CX16 SAHF FXSR HLE RDSEED
|
||||
"broadwell"
|
||||
];
|
||||
keepOutputs = true;
|
||||
};
|
||||
nixpkgs =
|
||||
{ march = "alderlake"; cuda = { enable = true; capabilities = [ "8.6" ]; forwardCompat = false; }; };
|
||||
kernel.patches = [ "cjktty" "lantian" ];
|
||||
impermanence.enable = true;
|
||||
networking.hostname = "pc";
|
||||
sysctl.laptop-mode = 5;
|
||||
};
|
||||
hardware =
|
||||
{
|
||||
cpus = [ "intel" ];
|
||||
gpus = [ "intel" "nvidia" ];
|
||||
bluetooth.enable = true;
|
||||
joystick.enable = true;
|
||||
printer.enable = true;
|
||||
sound.enable = true;
|
||||
prime = { enable = true; mode = "offload"; busId = { intel = "PCI:0:2:0"; nvidia = "PCI:1:0:0"; }; };
|
||||
gamemode.drmDevice = 1;
|
||||
};
|
||||
packages.packageSet = "workstation";
|
||||
virtualization =
|
||||
{
|
||||
waydroid.enable = true;
|
||||
docker.enable = true;
|
||||
kvmHost = { enable = true; gui = true; autoSuspend = [ "win10" "hardconnect" ]; };
|
||||
# kvmGuest.enable = true;
|
||||
nspawn = [ "arch" "ubuntu-22.04" "fedora" ];
|
||||
};
|
||||
services =
|
||||
{
|
||||
snapper.enable = true;
|
||||
fontconfig.enable = true;
|
||||
samba =
|
||||
{
|
||||
enable = true;
|
||||
private = true;
|
||||
hostsAllowed = "192.168. 127.";
|
||||
shares =
|
||||
{
|
||||
media.path = "/run/media/chn";
|
||||
home.path = "/home/chn";
|
||||
mnt.path = "/mnt";
|
||||
share.path = "/home/chn/share";
|
||||
};
|
||||
};
|
||||
sshd.enable = true;
|
||||
xrayClient =
|
||||
{
|
||||
enable = true;
|
||||
serverAddress = "74.211.99.69";
|
||||
serverName = "vps6.xserver.chn.moe";
|
||||
dns =
|
||||
{
|
||||
extraInterfaces = [ "docker0" ];
|
||||
hosts =
|
||||
{
|
||||
"mirism.one" = "74.211.99.69";
|
||||
"beta.mirism.one" = "74.211.99.69";
|
||||
"ng01.mirism.one" = "74.211.99.69";
|
||||
"debug.mirism.one" = "127.0.0.1";
|
||||
"initrd.vps6.chn.moe" = "74.211.99.69";
|
||||
"nix-store.chn.moe" = "127.0.0.1";
|
||||
"initrd.nas.chn.moe" = "192.168.1.185";
|
||||
};
|
||||
};
|
||||
};
|
||||
firewall.trustedInterfaces = [ "virbr0" "waydroid0" ];
|
||||
acme = { enable = true; cert."debug.mirism.one" = {}; };
|
||||
frpClient =
|
||||
{
|
||||
enable = true;
|
||||
serverName = "frp.chn.moe";
|
||||
user = "pc";
|
||||
stcpVisitor."yy.vnc".localPort = 6187;
|
||||
};
|
||||
nix-serve = { enable = true; hostname = "nix-store.chn.moe"; };
|
||||
smartd.enable = true;
|
||||
misskey.instances.misskey.hostname = "xn--qbtm095lrg0bfka60z.chn.moe";
|
||||
beesd = { enable = true; instances.root = { device = "/"; hashTableSizeMB = 2048; }; };
|
||||
wireguard =
|
||||
{
|
||||
enable = true;
|
||||
peers = [ "vps6" ];
|
||||
publicKey = "l1gFSDCeBxyf/BipXNvoEvVvLqPgdil84nmr5q6+EEw=";
|
||||
wireguardIp = "192.168.83.3";
|
||||
};
|
||||
};
|
||||
bugs =
|
||||
[
|
||||
"suspend-hibernate-no-platform" "hibernate-iwlwifi" "suspend-lid-no-wakeup" "xmunet"
|
||||
"suspend-hibernate-waydroid"
|
||||
];
|
||||
};
|
||||
vps6 =
|
||||
{
|
||||
system =
|
||||
{
|
||||
fileSystems =
|
||||
{
|
||||
mount =
|
||||
{
|
||||
btrfs =
|
||||
{
|
||||
"/dev/disk/by-uuid/24577c0e-d56b-45ba-8b36-95a848228600"."/boot" = "/boot";
|
||||
"/dev/mapper/root" = { "/nix" = "/nix"; "/nix/rootfs/current" = "/"; };
|
||||
};
|
||||
};
|
||||
decrypt.manual =
|
||||
{
|
||||
enable = true;
|
||||
devices."/dev/disk/by-uuid/4f8aca22-9ec6-4fad-b21a-fd9d8d0514e8" = { mapper = "root"; ssd = true; };
|
||||
delayedMount = [ "/" ];
|
||||
};
|
||||
swap = [ "/nix/swap/swap" ];
|
||||
rollingRootfs = { device = "/dev/mapper/root"; path = "/nix/rootfs"; };
|
||||
};
|
||||
grub.installDevice = "/dev/disk/by-path/pci-0000:00:05.0-scsi-0:0:0:0";
|
||||
nixpkgs.march = "sandybridge";
|
||||
nix.substituters = [ "https://cache.nixos.org/" "https://nix-store.chn.moe" ];
|
||||
initrd.sshd.enable = true;
|
||||
impermanence.enable = true;
|
||||
networking.hostname = "vps6";
|
||||
};
|
||||
packages.packageSet = "server";
|
||||
services =
|
||||
{
|
||||
snapper.enable = true;
|
||||
sshd.enable = true;
|
||||
xrayServer = { enable = true; serverName = "vps6.xserver.chn.moe"; };
|
||||
frpServer = { enable = true; serverName = "frp.chn.moe"; };
|
||||
nginx =
|
||||
{
|
||||
streamProxy.map =
|
||||
{
|
||||
"anchor.fm" = { upstream = "anchor.fm:443"; proxyProtocol = false; };
|
||||
"podcasters.spotify.com" = { upstream = "podcasters.spotify.com:443"; proxyProtocol = false; };
|
||||
"xlog.chn.moe" = { upstream = "cname.xlog.app:443"; proxyProtocol = false; };
|
||||
}
|
||||
// (builtins.listToAttrs (builtins.map
|
||||
(site: { name = "${site}.chn.moe"; value.upstream.address = "wireguard.pc.chn.moe"; })
|
||||
[ "nix-store" "xn--qbtm095lrg0bfka60z" ]))
|
||||
// (builtins.listToAttrs (builtins.map
|
||||
(site: { name = "${site}.chn.moe"; value.upstream.address = "wireguard.vps7.chn.moe"; })
|
||||
[
|
||||
"xn--s8w913fdga" "misskey" "synapse" "syncv3.synapse" "matrix" "syncv3.matrix"
|
||||
"send" "kkmeeting" "api" "git" "grafana"
|
||||
]));
|
||||
applications =
|
||||
{
|
||||
element.instances."element.chn.moe" = {};
|
||||
synapse-admin.instances."synapse-admin.chn.moe" = {};
|
||||
catalog.enable = true;
|
||||
blog.enable = true;
|
||||
main.enable = true;
|
||||
};
|
||||
};
|
||||
coturn.enable = true;
|
||||
httpua.enable = true;
|
||||
mirism.enable = true;
|
||||
fail2ban.enable = true;
|
||||
wireguard =
|
||||
{
|
||||
enable = true;
|
||||
peers = [ "pc" "nas" "vps7" ];
|
||||
publicKey = "AVOsYUKQQCvo3ctst3vNi8XSVWo1Wh15066aHh+KpF4=";
|
||||
wireguardIp = "192.168.83.1";
|
||||
externalIp = "74.211.99.69";
|
||||
lighthouse = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
vps7 =
|
||||
{
|
||||
system =
|
||||
{
|
||||
fileSystems =
|
||||
{
|
||||
mount =
|
||||
{
|
||||
btrfs =
|
||||
{
|
||||
"/dev/disk/by-uuid/e36287f7-7321-45fa-ba1e-d126717a65f0"."/boot" = "/boot";
|
||||
"/dev/mapper/root" = { "/nix" = "/nix"; "/nix/rootfs/current" = "/"; };
|
||||
};
|
||||
};
|
||||
decrypt.manual =
|
||||
{
|
||||
enable = true;
|
||||
devices."/dev/disk/by-uuid/db48c8de-bcf7-43ae-a977-60c4f390d5c4" = { mapper = "root"; ssd = true; };
|
||||
delayedMount = [ "/" ];
|
||||
};
|
||||
swap = [ "/nix/swap/swap" ];
|
||||
rollingRootfs = { device = "/dev/mapper/root"; path = "/nix/rootfs"; };
|
||||
};
|
||||
grub.installDevice = "/dev/disk/by-path/pci-0000:00:05.0-scsi-0:0:0:0";
|
||||
nixpkgs.march = "broadwell";
|
||||
nix.substituters = [ "https://cache.nixos.org/" "https://nix-store.chn.moe" ];
|
||||
initrd.sshd.enable = true;
|
||||
impermanence.enable = true;
|
||||
networking.hostname = "vps7";
|
||||
gui.preferred = false;
|
||||
};
|
||||
packages.packageSet = "desktop";
|
||||
services =
|
||||
{
|
||||
snapper.enable = true;
|
||||
fontconfig.enable = true;
|
||||
sshd.enable = true;
|
||||
rsshub.enable = true;
|
||||
wallabag.enable = true;
|
||||
misskey.instances =
|
||||
{
|
||||
misskey.hostname = "xn--s8w913fdga.chn.moe";
|
||||
misskey-old = { port = 9727; redis.port = 3546; meilisearch.enable = false; };
|
||||
};
|
||||
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 = { enable = true; instances.root = { device = "/"; hashTableSizeMB = 1024; }; };
|
||||
photoprism.enable = true;
|
||||
nextcloud.enable = true;
|
||||
freshrss.enable = true;
|
||||
send.enable = true;
|
||||
huginn.enable = true;
|
||||
fz-new-order.enable = true;
|
||||
nginx.applications = { kkmeeting.enable = true; webdav.instances."webdav.chn.moe" = {}; };
|
||||
httpapi.enable = true;
|
||||
mastodon.enable = true;
|
||||
gitea.enable = true;
|
||||
grafana.enable = true;
|
||||
fail2ban.enable = true;
|
||||
wireguard =
|
||||
{
|
||||
enable = true;
|
||||
peers = [ "vps6" ];
|
||||
publicKey = "n056ppNxC9oECcW7wEbALnw8GeW7nrMImtexKWYVUBk=";
|
||||
wireguardIp = "192.168.83.2";
|
||||
externalIp = "95.111.228.40";
|
||||
};
|
||||
};
|
||||
};
|
||||
nas =
|
||||
{
|
||||
system =
|
||||
{
|
||||
fileSystems =
|
||||
{
|
||||
mount =
|
||||
{
|
||||
vfat."/dev/disk/by-uuid/13BC-F0C9" = "/boot/efi";
|
||||
btrfs =
|
||||
{
|
||||
"/dev/disk/by-uuid/0e184f3b-af6c-4f5d-926a-2559f2dc3063"."/boot" = "/boot";
|
||||
"/dev/mapper/nix"."/nix" = "/nix";
|
||||
"/dev/mapper/root1" =
|
||||
{
|
||||
"/nix/rootfs" = "/nix/rootfs";
|
||||
"/nix/persistent" = "/nix/persistent";
|
||||
"/nix/nodatacow" = "/nix/nodatacow";
|
||||
"/nix/rootfs/current" = "/";
|
||||
"/nix/backup" = "/nix/backup";
|
||||
};
|
||||
};
|
||||
};
|
||||
decrypt.manual =
|
||||
{
|
||||
enable = true;
|
||||
devices =
|
||||
{
|
||||
"/dev/disk/by-uuid/5cf1d19d-b4a5-4e67-8e10-f63f0d5bb649".mapper = "root1";
|
||||
"/dev/disk/by-uuid/aa684baf-fd8a-459c-99ba-11eb7636cb0d".mapper = "root2";
|
||||
"/dev/disk/by-uuid/a779198f-cce9-4c3d-a64a-9ec45f6f5495" = { mapper = "nix"; ssd = true; };
|
||||
};
|
||||
delayedMount = [ "/" "/nix" ];
|
||||
};
|
||||
swap = [ "/nix/swap/swap" ];
|
||||
rollingRootfs = { device = "/dev/mapper/root1"; path = "/nix/rootfs"; };
|
||||
};
|
||||
initrd.sshd.enable = true;
|
||||
grub.installDevice = "efi";
|
||||
nixpkgs.march = "silvermont";
|
||||
nix.substituters = [ "https://cache.nixos.org/" "https://nix-store.chn.moe" ];
|
||||
kernel.patches = [ "cjktty" ];
|
||||
impermanence.enable = true;
|
||||
networking.hostname = "nas";
|
||||
gui.preferred = false;
|
||||
};
|
||||
hardware = { cpus = [ "intel" ]; gpus = [ "intel" ]; };
|
||||
packages.packageSet = "desktop";
|
||||
services =
|
||||
{
|
||||
snapper.enable = true;
|
||||
fontconfig.enable = true;
|
||||
samba =
|
||||
{
|
||||
enable = true;
|
||||
hostsAllowed = "192.168. 127.";
|
||||
shares = { home.path = "/home"; root.path = "/"; };
|
||||
};
|
||||
sshd = { enable = true; passwordAuthentication = true; };
|
||||
xrayClient =
|
||||
{
|
||||
enable = true;
|
||||
serverAddress = "74.211.99.69";
|
||||
serverName = "vps6.xserver.chn.moe";
|
||||
dns.extraInterfaces = [ "docker0" ];
|
||||
};
|
||||
xrdp = { enable = true; hostname = [ "nas.chn.moe" "office.chn.moe" ]; };
|
||||
groupshare.enable = true;
|
||||
smartd.enable = true;
|
||||
beesd =
|
||||
{
|
||||
enable = true;
|
||||
instances =
|
||||
{
|
||||
root = { device = "/"; hashTableSizeMB = 2048; };
|
||||
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 =
|
||||
{
|
||||
enable = true;
|
||||
peers = [ "vps6" ];
|
||||
publicKey = "xCYRbZEaGloMk7Awr00UR3JcDJy4AzVp4QvGNoyEgFY=";
|
||||
wireguardIp = "192.168.83.4";
|
||||
};
|
||||
};
|
||||
users.users = [ "chn" "xll" "zem" "yjq" "yxy" ];
|
||||
};
|
||||
yoga =
|
||||
{
|
||||
system =
|
||||
{
|
||||
fileSystems =
|
||||
{
|
||||
mount =
|
||||
{
|
||||
vfat."/dev/disk/by-uuid/86B8-CF80" = "/boot/efi";
|
||||
btrfs =
|
||||
{
|
||||
"/dev/disk/by-uuid/e252f81d-b4b3-479f-8664-380a9b73cf83"."/boot" = "/boot";
|
||||
"/dev/mapper/root" = { "/nix" = "/nix"; "/nix/rootfs/current" = "/"; };
|
||||
};
|
||||
};
|
||||
decrypt.auto."/dev/disk/by-uuid/8186d34e-005c-4461-94c7-1003a5bd86c0" =
|
||||
{ mapper = "root"; ssd = true; };
|
||||
swap = [ "/nix/swap/swap" ];
|
||||
rollingRootfs = { device = "/dev/mapper/root"; path = "/nix/rootfs"; };
|
||||
};
|
||||
nixpkgs.march = "silvermont";
|
||||
grub.installDevice = "efi";
|
||||
nix.substituters = [ "https://cache.nixos.org/" "https://nix-store.chn.moe" ];
|
||||
kernel.patches = [ "cjktty" ];
|
||||
impermanence.enable = true;
|
||||
networking.hostname = "yoga";
|
||||
};
|
||||
hardware =
|
||||
{
|
||||
cpus = [ "intel" ];
|
||||
gpus = [ "intel" ];
|
||||
bluetooth.enable = true;
|
||||
joystick.enable = true;
|
||||
printer.enable = true;
|
||||
sound.enable = true;
|
||||
halo-keyboard.enable = true;
|
||||
};
|
||||
packages.packageSet = "desktop-fat";
|
||||
virtualization.docker.enable = true;
|
||||
services =
|
||||
{
|
||||
snapper.enable = true;
|
||||
fontconfig.enable = true;
|
||||
sshd.enable = true;
|
||||
xrayClient =
|
||||
{
|
||||
enable = true;
|
||||
serverAddress = "74.211.99.69";
|
||||
serverName = "vps6.xserver.chn.moe";
|
||||
dns.extraInterfaces = [ "docker0" ];
|
||||
};
|
||||
firewall.trustedInterfaces = [ "virbr0" ];
|
||||
};
|
||||
bugs = [ "xmunet" ];
|
||||
};
|
||||
xmupc1 =
|
||||
{
|
||||
system =
|
||||
{
|
||||
fileSystems =
|
||||
{
|
||||
mount =
|
||||
{
|
||||
vfat."/dev/disk/by-uuid/3F57-0EBE" = "/boot/efi";
|
||||
btrfs =
|
||||
{
|
||||
"/dev/disk/by-uuid/02e426ec-cfa2-4a18-b3a5-57ef04d66614"."/" = "/boot";
|
||||
"/dev/mapper/root" = { "/nix" = "/nix"; "/nix/rootfs/current" = "/"; };
|
||||
};
|
||||
};
|
||||
swap = [ "/dev/mapper/swap" ];
|
||||
resume = "/dev/mapper/swap";
|
||||
rollingRootfs = { device = "/dev/mapper/root"; path = "/nix/rootfs"; };
|
||||
};
|
||||
grub.installDevice = "efi";
|
||||
nixpkgs =
|
||||
{
|
||||
march = "znver3";
|
||||
cuda =
|
||||
{
|
||||
enable = true;
|
||||
capabilities =
|
||||
[
|
||||
# 2080 Ti
|
||||
"7.5"
|
||||
# 3090
|
||||
"8.6"
|
||||
# 4090
|
||||
"8.9"
|
||||
];
|
||||
forwardCompat = false;
|
||||
};
|
||||
};
|
||||
gui.preferred = false;
|
||||
kernel.patches = [ "cjktty" ];
|
||||
impermanence.enable = true;
|
||||
networking.hostname = "xmupc1";
|
||||
};
|
||||
hardware =
|
||||
{
|
||||
cpus = [ "amd" ];
|
||||
gpus = [ "nvidia" ];
|
||||
bluetooth.enable = true;
|
||||
joystick.enable = true;
|
||||
printer.enable = true;
|
||||
sound.enable = true;
|
||||
gamemode.drmDevice = 1;
|
||||
};
|
||||
packages.packageSet = "workstation";
|
||||
virtualization = { docker.enable = true; kvmHost = { enable = true; gui = true; }; };
|
||||
services =
|
||||
{
|
||||
snapper.enable = true;
|
||||
fontconfig.enable = true;
|
||||
samba =
|
||||
{
|
||||
enable = true;
|
||||
private = true;
|
||||
hostsAllowed = "192.168. 127.";
|
||||
shares =
|
||||
{
|
||||
media.path = "/run/media/chn";
|
||||
home.path = "/home/chn";
|
||||
mnt.path = "/mnt";
|
||||
share.path = "/home/chn/share";
|
||||
};
|
||||
};
|
||||
sshd.enable = true;
|
||||
xrayClient =
|
||||
{
|
||||
enable = true;
|
||||
serverAddress = "74.211.99.69";
|
||||
serverName = "vps6.xserver.chn.moe";
|
||||
dns.extraInterfaces = [ "docker0" ];
|
||||
};
|
||||
firewall.trustedInterfaces = [ "virbr0" "waydroid0" ];
|
||||
acme = { enable = true; cert."debug.mirism.one" = {}; };
|
||||
smartd.enable = true;
|
||||
beesd = { enable = true; instances.root = { device = "/nix/persistent"; hashTableSizeMB = 2048; }; };
|
||||
wireguard =
|
||||
{
|
||||
enable = true;
|
||||
peers = [ "vps6" ];
|
||||
publicKey = "JEY7D4ANfTpevjXNvGDYO6aGwtBGRXsf/iwNwjwDRQk=";
|
||||
wireguardIp = "192.168.83.5";
|
||||
};
|
||||
};
|
||||
bugs = [ "xmunet" "firefox" ];
|
||||
};
|
||||
};
|
||||
in builtins.listToAttrs (builtins.map
|
||||
(system:
|
||||
{
|
||||
name = system.name;
|
||||
value = inputs.nixpkgs.lib.nixosSystem
|
||||
{
|
||||
system = "x86_64-linux";
|
||||
specialArgs = { topInputs = inputs; inherit localLib; };
|
||||
modules = localLib.mkModules
|
||||
[
|
||||
(inputs: { config.nixpkgs.overlays = [(final: prev:
|
||||
{ localPackages = (import ./local/pkgs { inherit (inputs) lib; pkgs = final; }); })]; })
|
||||
(moduleInputs: { config.nixpkgs.overlays = [(prev: final:
|
||||
# replace pkgs with final to avoid infinite recursion
|
||||
{ localPackages = import ./local/pkgs (moduleInputs // { pkgs = final; }); })]; })
|
||||
./modules
|
||||
{ config.nixos = system.value; }
|
||||
./devices/${system}
|
||||
];
|
||||
};
|
||||
})
|
||||
(localLib.attrsToList system));
|
||||
# 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";
|
||||
user = "root";
|
||||
fastConnection = true;
|
||||
autoRollback = false;
|
||||
magicRollback = false;
|
||||
nodes = builtins.listToAttrs (builtins.map
|
||||
(node:
|
||||
devices))
|
||||
// {
|
||||
pi3b = inputs.nixpkgs.lib.nixosSystem
|
||||
{
|
||||
name = node;
|
||||
value =
|
||||
{
|
||||
hostname = node;
|
||||
profiles.system.path = inputs.self.nixosConfigurations.${node}.pkgs.deploy-rs.lib.activate.nixos
|
||||
inputs.self.nixosConfigurations.${node};
|
||||
};
|
||||
})
|
||||
[ "vps6" "vps7" "nas" "yoga" ]);
|
||||
};
|
||||
checks = builtins.mapAttrs (system: deployLib: deployLib.deployChecks inputs.self.deploy) inputs.deploy-rs.lib;
|
||||
system = "aarch64-linux";
|
||||
specialArgs = { topInputs = inputs; inherit localLib; };
|
||||
modules = localLib.mkModules
|
||||
[
|
||||
(moduleInputs: { config.nixpkgs.overlays = [(prev: final:
|
||||
# replace pkgs with final to avoid infinite recursion
|
||||
{ localPackages = import ./local/pkgs (moduleInputs // { pkgs = final; }); })]; })
|
||||
./modules
|
||||
./devices/pi3b
|
||||
];
|
||||
};
|
||||
}
|
||||
);
|
||||
overlays.default = final: prev:
|
||||
{ localPackages = (import ./local/pkgs { inherit (inputs) lib; pkgs = final; }); };
|
||||
{ localPackages = (import ./local/pkgs { inherit (inputs) lib; pkgs = final; topInputs = inputs; }); };
|
||||
config = { archive = false; branch = "production"; };
|
||||
devShells.x86_64-linux = let inherit (inputs.self.packages.x86_64-linux) pkgs; in
|
||||
{
|
||||
biu = pkgs.mkShell
|
||||
{
|
||||
inputsFrom = [ pkgs.localPackages.biu ];
|
||||
buildInputs = [ pkgs.clang-tools_18 ];
|
||||
CMAKE_EXPORT_COMPILE_COMMANDS = "1";
|
||||
};
|
||||
hpcstat = pkgs.mkShell.override { stdenv = pkgs.gcc14Stdenv; }
|
||||
{
|
||||
inputsFrom = [ (inputs.self.packages.x86_64-linux.hpcstat.override { version = null; }) ];
|
||||
packages = [ pkgs.clang-tools_18 ];
|
||||
CMAKE_EXPORT_COMPILE_COMMANDS = "1";
|
||||
};
|
||||
sbatch-tui = pkgs.mkShell
|
||||
{
|
||||
inputsFrom = [ pkgs.localPackages.sbatch-tui ];
|
||||
buildInputs = [ pkgs.clang-tools_18 ];
|
||||
CMAKE_EXPORT_COMPILE_COMMANDS = "1";
|
||||
};
|
||||
ufo = pkgs.mkShell
|
||||
{
|
||||
inputsFrom = [ (inputs.self.packages.x86_64-linux.ufo.override { version = null; }) ];
|
||||
packages = [ pkgs.clang-tools_18 ];
|
||||
CMAKE_EXPORT_COMPILE_COMMANDS = "1";
|
||||
};
|
||||
chn-bsub = pkgs.mkShell
|
||||
{
|
||||
inputsFrom = [ pkgs.localPackages.chn-bsub ];
|
||||
buildInputs = [ pkgs.clang-tools_18 ];
|
||||
CMAKE_EXPORT_COMPILE_COMMANDS = "1";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
lib:
|
||||
lib: rec
|
||||
{
|
||||
attrsToList = Attrs: builtins.map ( name: { inherit name; value = Attrs.${name}; } ) ( builtins.attrNames Attrs );
|
||||
attrsToList = attrs: builtins.map (name: { inherit name; value = attrs.${name}; }) (builtins.attrNames attrs);
|
||||
mkConditional = condition: trueResult: falseResult: let inherit (lib) mkMerge mkIf; in
|
||||
mkMerge [ ( mkIf condition trueResult ) ( mkIf (!condition) falseResult ) ];
|
||||
|
||||
@@ -12,9 +12,9 @@ lib:
|
||||
mkModules = moduleList:
|
||||
(builtins.map
|
||||
(
|
||||
let handle = module:
|
||||
if ( builtins.typeOf module ) == "path" then (handle (import module))
|
||||
else if ( builtins.typeOf module ) == "lambda" then ({ pkgs, utils, ... }@inputs: (module inputs))
|
||||
let handle = module: let type = builtins.typeOf module; in
|
||||
if type == "path" || type == "string" then (handle (import module))
|
||||
else if type == "lambda" then ({ pkgs, utils, ... }@inputs: (module inputs))
|
||||
else module;
|
||||
in handle
|
||||
)
|
||||
@@ -37,4 +37,21 @@ lib:
|
||||
findIndex = e: list:
|
||||
let findIndex_ = i: list: if (builtins.elemAt list i) == e then i else findIndex_ (i + 1) list;
|
||||
in findIndex_ 0 list;
|
||||
|
||||
# return a list of path, including:
|
||||
# - all .nix file in the directory except for default.nix
|
||||
# - all directories containing a default.nix
|
||||
findModules = path:
|
||||
mkModules (builtins.filter (path: path != null) (builtins.map
|
||||
(subPath:
|
||||
if subPath.value == "regular" && subPath.name != "default.nix"
|
||||
then if lib.strings.hasSuffix ".nix" subPath.name
|
||||
then "${path}/${subPath.name}"
|
||||
else null
|
||||
else if subPath.value == "directory"
|
||||
then if (builtins.readDir "${path}/${subPath.name}")."default.nix" or null == "regular"
|
||||
then "${path}/${subPath.name}"
|
||||
else null
|
||||
else null)
|
||||
(attrsToList (builtins.readDir path))));
|
||||
}
|
||||
|
||||
3
local/pkgs/biu/.clangd
Normal file
3
local/pkgs/biu/.clangd
Normal file
@@ -0,0 +1,3 @@
|
||||
CompileFlags:
|
||||
Add: [ -Wall, -Wextra, -std=c++23 ]
|
||||
Compiler: g++
|
||||
1
local/pkgs/biu/.envrc
Normal file
1
local/pkgs/biu/.envrc
Normal file
@@ -0,0 +1 @@
|
||||
use flake .#biu
|
||||
53
local/pkgs/biu/CMakeLists.txt
Normal file
53
local/pkgs/biu/CMakeLists.txt
Normal file
@@ -0,0 +1,53 @@
|
||||
cmake_minimum_required(VERSION 3.14)
|
||||
project(biu LANGUAGES CXX)
|
||||
enable_testing()
|
||||
include(GNUInstallDirs)
|
||||
|
||||
option(BUILD_SHARED_LIBS "Build using shared libraries" ON)
|
||||
option(BUILD_FOR_WINDOWS "Do not pull in dependencies not available on Windows" OFF)
|
||||
|
||||
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
||||
message("Setting build type to 'Release' as none was specified.")
|
||||
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE)
|
||||
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
|
||||
endif()
|
||||
|
||||
find_package(magic_enum REQUIRED)
|
||||
find_package(fmt REQUIRED)
|
||||
find_package(Boost REQUIRED COMPONENTS headers iostreams filesystem)
|
||||
find_package(range-v3 REQUIRED)
|
||||
find_path(NAMEOF_INCLUDE_DIR nameof.hpp REQUIRED)
|
||||
find_path(ZPP_BITS_INCLUDE_DIR zpp_bits.h REQUIRED)
|
||||
if (NOT BUILD_FOR_WINDOWS)
|
||||
find_package(Eigen3 REQUIRED)
|
||||
endif()
|
||||
|
||||
add_library(biu src/common.cpp)
|
||||
target_include_directories(biu PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}> ${NAMEOF_INCLUDE_DIR} ${ZPP_BITS_INCLUDE_DIR})
|
||||
target_link_libraries(biu PUBLIC magic_enum::magic_enum fmt::fmt Boost::headers Boost::iostreams Boost::filesystem
|
||||
range-v3::range-v3)
|
||||
if (NOT BUILD_FOR_WINDOWS)
|
||||
target_link_libraries(biu PUBLIC Eigen3::Eigen)
|
||||
endif()
|
||||
set_property(TARGET biu PROPERTY CXX_STANDARD 23 CXX_STANDARD_REQUIRED ON)
|
||||
install(TARGETS biu EXPORT biuTargets LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
||||
install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
||||
install(EXPORT biuTargets FILE biuTargets.cmake NAMESPACE biu:: DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/biu)
|
||||
install(FILES biuConfig.cmake DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/biu)
|
||||
|
||||
get_property(ImportedTargets DIRECTORY "${CMAKE_SOURCE_DIR}" PROPERTY IMPORTED_TARGETS)
|
||||
message("Imported targets: ${ImportedTargets}")
|
||||
message("List of compile features: ${CMAKE_CXX_COMPILE_FEATURES}")
|
||||
|
||||
include(CTest)
|
||||
add_executable(test-serialize test/serialize.cpp)
|
||||
target_link_libraries(test-serialize PRIVATE biu)
|
||||
set_property(TARGET test-serialize PROPERTY CXX_STANDARD 23 CXX_STANDARD_REQUIRED ON)
|
||||
add_test(NAME test-serialize COMMAND test-serialize)
|
||||
add_executable(test-process test/process.cpp)
|
||||
target_link_libraries(test-process PRIVATE biu)
|
||||
set_property(TARGET test-process PROPERTY CXX_STANDARD 23 CXX_STANDARD_REQUIRED ON)
|
||||
add_test(NAME test-process COMMAND test-process)
|
||||
49
local/pkgs/biu/README.md
Normal file
49
local/pkgs/biu/README.md
Normal file
@@ -0,0 +1,49 @@
|
||||
# `common`:
|
||||
|
||||
```c++
|
||||
// get hash of any object
|
||||
std::size_t hash(auto&&... objs);
|
||||
// suppress unused variable warning
|
||||
void unused(auto&&...);
|
||||
// block forever
|
||||
void block_forever();
|
||||
detail_::ExecResult exec
|
||||
(
|
||||
std::filesystem::path program, std::vector<std::string> args, std::optional<std::string> stdin,
|
||||
std::map<std::string, std::string> extra_env
|
||||
);
|
||||
|
||||
using int128_t = ...;
|
||||
using uint128_t = ...;
|
||||
|
||||
struct CaseInsensitiveStringLessComparator {...};
|
||||
|
||||
// remove Class::*
|
||||
template <typename MemberPointer> using RemoveMemberPointer = ...;
|
||||
// move qualifiers (cvref) from From to To
|
||||
template <typename From, typename To> using MoveQualifiers = ...;
|
||||
// get T::type or T::Type if exists, otherwise Fallback
|
||||
template <typename T, typename Fallback = void> using FallbackIfNoTypeDeclared
|
||||
```
|
||||
|
||||
# `inline literals`
|
||||
|
||||
```c++
|
||||
using namespace std::literals;
|
||||
using namespace fmt::literals;
|
||||
std::regex operator""_re(const char* str, std::size_t len);
|
||||
```
|
||||
|
||||
# `inline stream_operators`:
|
||||
|
||||
```c++
|
||||
inline namespace stream_operators { using namespace magic_enum::iostream_operators; }
|
||||
```
|
||||
|
||||
# `env`
|
||||
|
||||
```c++
|
||||
bool is_interactive();
|
||||
std::optional<std::string> env(std::string name);
|
||||
std::map<std::string, std::string> env();
|
||||
```
|
||||
7
local/pkgs/biu/biuConfig.cmake
Normal file
7
local/pkgs/biu/biuConfig.cmake
Normal file
@@ -0,0 +1,7 @@
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/biuTargets.cmake")
|
||||
find_package(magic_enum REQUIRED)
|
||||
find_package(fmt REQUIRED)
|
||||
find_package(Boost REQUIRED COMPONENTS headers iostreams)
|
||||
find_package(Eigen3 REQUIRED)
|
||||
find_package(range-v3 REQUIRED)
|
||||
find_path(NAMEOF_INCLUDE_DIR nameof.hpp REQUIRED)
|
||||
@@ -1,17 +1,13 @@
|
||||
{
|
||||
stdenv, fetchFromGitHub, cmake, pkg-config, ninja,
|
||||
fmt, boost, magic-enum, libbacktrace, concurrencpp, tgbot-cpp, nameof, eigen, range-v3
|
||||
stdenv, cmake, lib,
|
||||
magic-enum, fmt, boost, eigen, range-v3, nameof, zpp-bits
|
||||
}: stdenv.mkDerivation rec
|
||||
{
|
||||
name = "libbiu";
|
||||
src = fetchFromGitHub
|
||||
{
|
||||
owner = "CHN-beta";
|
||||
repo = "biu";
|
||||
rev = "8ed2e52968f98d3a6ddbd01e86e57604ba3a7f54";
|
||||
sha256 = "OqQ+QkjjIbpve/xn/DJA7ONw/bBg5zGNr+VJjc3o+K8=";
|
||||
};
|
||||
nativeBuildInputs = [ cmake pkg-config ninja ];
|
||||
buildInputs = [ fmt boost magic-enum libbacktrace concurrencpp tgbot-cpp nameof eigen range-v3 ];
|
||||
name = "biu";
|
||||
src = ./.;
|
||||
buildInputs = [ magic-enum fmt boost range-v3 nameof zpp-bits ] ++ lib.optional (!stdenv.hostPlatform.isMinGW) eigen;
|
||||
propagatedBuildInputs = buildInputs;
|
||||
nativeBuildInputs = [ cmake ];
|
||||
cmakeFlags = [ "-DBUILD_FOR_WINDOWS=${builtins.toString stdenv.hostPlatform.isMinGW}" ];
|
||||
doCheck = true;
|
||||
}
|
||||
|
||||
11
local/pkgs/biu/include/biu.hpp
Normal file
11
local/pkgs/biu/include/biu.hpp
Normal file
@@ -0,0 +1,11 @@
|
||||
# pragma once
|
||||
// # include <biu/atomic/atomic.tpp>
|
||||
// # include <biu/called_by.hpp>
|
||||
# include <biu/common.tpp>
|
||||
# include <biu/concepts.tpp>
|
||||
# include <biu/string.tpp>
|
||||
# include <biu/format.tpp>
|
||||
// # include <biu/logger.tpp>
|
||||
// # include <biu/smartref.tpp>
|
||||
|
||||
// # include <biu/eigen.hpp>
|
||||
41
local/pkgs/biu/include/biu/atomic/atomic.hpp
Normal file
41
local/pkgs/biu/include/biu/atomic/atomic.hpp
Normal file
@@ -0,0 +1,41 @@
|
||||
# pragma once
|
||||
# include <biu/logger.hpp>
|
||||
|
||||
namespace biu::detail_
|
||||
{
|
||||
template <DecayedType ValueType> class AtomicBase<ValueType, true>
|
||||
: public Logger::ObjectMonitor<Atomic<ValueType, true>>, protected AtomicBase<ValueType, false>
|
||||
{
|
||||
using DeepBase_ = AtomicBase<ValueType, false>;
|
||||
using DeepBase_::AtomicBase;
|
||||
public: class TimeoutException : public Logger::Exception<TimeoutException>
|
||||
{
|
||||
using Logger::Exception<TimeoutException>::Exception;
|
||||
};
|
||||
|
||||
protected: template
|
||||
<
|
||||
bool ReturnFunctionResult,
|
||||
typename ConditionFunction = std::nullptr_t, typename Duration = std::nullptr_t, bool Nothrow = false
|
||||
> static auto apply_
|
||||
(
|
||||
auto&& atomic, auto&& function,
|
||||
ConditionFunction&& condition_function = nullptr, Duration timeout = nullptr
|
||||
) -> DeepBase_::template ApplyReturnType_
|
||||
<decltype(function), decltype(atomic), ReturnFunctionResult, ConditionFunction, Duration, Nothrow>
|
||||
requires DeepBase_::template ApplyConstraint_
|
||||
<decltype(function), decltype(atomic), ConditionFunction, Duration>;
|
||||
|
||||
protected: template <bool Nothrow = false, typename Duration = std::nullptr_t> static auto wait_
|
||||
(auto&& atomic, auto&& condition_function, Duration timeout = nullptr)
|
||||
-> DeepBase_::template WaitReturnType_<decltype(atomic), decltype(condition_function), Duration, Nothrow>
|
||||
requires DeepBase_::template WaitConstraint_<decltype(condition_function), Duration>;
|
||||
|
||||
protected: template
|
||||
<bool Nothrow = false, typename ConditionFunction = std::nullptr_t, typename Duration = std::nullptr_t>
|
||||
static auto lock_
|
||||
(auto&& atomic, ConditionFunction&& condition_function = nullptr, Duration timeout = nullptr)
|
||||
-> DeepBase_::template LockReturnType_<decltype(atomic), Duration, Nothrow>
|
||||
requires DeepBase_::template LockConstraint_<ConditionFunction, Duration>;
|
||||
};
|
||||
}
|
||||
267
local/pkgs/biu/include/biu/atomic/nolog.hpp
Normal file
267
local/pkgs/biu/include/biu/atomic/nolog.hpp
Normal file
@@ -0,0 +1,267 @@
|
||||
# pragma once
|
||||
# include <mutex>
|
||||
# include <optional>
|
||||
# include <condition_variable>
|
||||
# include <cstddef>
|
||||
# include <experimental/memory>
|
||||
# include <biu/common.hpp>
|
||||
# include <biu/concepts.hpp>
|
||||
# include <biu/called_by.hpp>
|
||||
|
||||
namespace biu
|
||||
{
|
||||
template <DecayedType ValueType, bool UseLogger = true> class Atomic;
|
||||
namespace detail_
|
||||
{
|
||||
template <DecayedType ValueType, bool UseLogger> class AtomicBase;
|
||||
template <DecayedType ValueType> class AtomicBase<ValueType, false>
|
||||
{
|
||||
protected: mutable std::recursive_mutex Mutex_;
|
||||
protected: mutable std::condition_variable_any ConditionVariable_;
|
||||
protected: ValueType Value_;
|
||||
|
||||
AtomicBase() = default;
|
||||
AtomicBase(const ValueType& value);
|
||||
AtomicBase(ValueType&& value);
|
||||
|
||||
public: class TimeoutException : public std::exception
|
||||
{
|
||||
protected: std::string Message_;
|
||||
public: explicit TimeoutException(std::string message);
|
||||
public: const char* what() const noexcept override;
|
||||
};
|
||||
|
||||
// Apply a function to stored value.
|
||||
// Wait for some time (if provided) until condition funciton returns true (if provided)
|
||||
// before applying the function.
|
||||
protected: template
|
||||
<
|
||||
typename Function, typename Atomic,
|
||||
typename ConditionFunction = std::nullptr_t, typename Duration = std::nullptr_t
|
||||
>
|
||||
constexpr static bool ApplyConstraint_ =
|
||||
(
|
||||
(std::invocable<Function, MoveQualifiers<Atomic, ValueType>> && std::is_null_pointer_v<ConditionFunction>)
|
||||
|| (
|
||||
InvocableWithResult<ConditionFunction, bool, const ValueType&>
|
||||
&& (std::is_null_pointer_v<Duration> || SpecializationOf<Duration, std::chrono::duration>)
|
||||
)
|
||||
);
|
||||
protected: template
|
||||
<
|
||||
typename Function, typename Atomic, bool ReturnFunctionResult,
|
||||
typename ConditionFunction = std::nullptr_t, typename Duration = std::nullptr_t,
|
||||
bool Nothrow = false
|
||||
> using ApplyReturnType_ = std::conditional_t
|
||||
<
|
||||
Nothrow,
|
||||
std::conditional_t
|
||||
<
|
||||
ReturnFunctionResult && !std::is_void_v<std::invoke_result<Function, ValueType>>,
|
||||
std::optional<std::remove_cvref_t<FallbackIfNoTypeDeclared<std::invoke_result
|
||||
<Function, MoveQualifiers<Atomic, ValueType>, int>>>>,
|
||||
bool
|
||||
>,
|
||||
std::conditional_t
|
||||
<
|
||||
ReturnFunctionResult,
|
||||
std::invoke_result_t<Function, MoveQualifiers<Atomic, ValueType>>,
|
||||
Atomic&&
|
||||
>
|
||||
>;
|
||||
protected: template
|
||||
<
|
||||
bool ReturnFunctionResult,
|
||||
typename ConditionFunction = std::nullptr_t, typename Duration = std::nullptr_t,
|
||||
bool Nothrow = false
|
||||
> static auto apply_
|
||||
(
|
||||
auto&& atomic, auto&& function,
|
||||
ConditionFunction&& condition_function = nullptr, Duration timeout = nullptr
|
||||
) -> ApplyReturnType_
|
||||
<decltype(function), decltype(atomic), ReturnFunctionResult, ConditionFunction, Duration, Nothrow>
|
||||
requires ApplyConstraint_<decltype(function), decltype(atomic), ConditionFunction, Duration>;
|
||||
|
||||
// Wait until condition funciton returns true, with an optional timeout
|
||||
protected: template <typename ConditionFunction, typename Duration = std::nullptr_t>
|
||||
constexpr static bool WaitConstraint_
|
||||
= (InvocableWithResult<ConditionFunction, bool, const ValueType&>
|
||||
&& (std::is_null_pointer_v<Duration> || SpecializationOf<Duration, std::chrono::duration>));
|
||||
protected: template
|
||||
<typename Atomic, typename ConditionFunction, typename Duration = std::nullptr_t, bool Nothrow = false>
|
||||
using WaitReturnType_
|
||||
= std::conditional_t<Nothrow && !std::is_null_pointer_v<Duration>, bool, Atomic&&>;
|
||||
protected: template <bool Nothrow = false, typename Duration = std::nullptr_t> static auto wait_
|
||||
(auto&& atomic, auto&& condition_function, Duration timeout = nullptr)
|
||||
-> WaitReturnType_<decltype(atomic), decltype(condition_function), Duration, Nothrow>
|
||||
requires WaitConstraint_<decltype(condition_function), Duration>;
|
||||
|
||||
protected: template <typename ConditionFunction = std::nullptr_t, typename Duration = std::nullptr_t>
|
||||
constexpr static bool LockConstraint_
|
||||
= std::is_null_pointer_v<ConditionFunction> ||
|
||||
(
|
||||
InvocableWithResult<ConditionFunction, bool, const ValueType&>
|
||||
&& (std::is_null_pointer_v<Duration> || SpecializationOf<Duration, std::chrono::duration>)
|
||||
);
|
||||
protected: template <typename Atomic, typename Duration = std::nullptr_t, bool Nothrow = false>
|
||||
using LockReturnType_
|
||||
= std::conditional_t
|
||||
<
|
||||
Nothrow && !std::is_null_pointer_v<Duration>,
|
||||
std::optional<std::conditional_t
|
||||
<
|
||||
std::is_const_v<Atomic>,
|
||||
typename std::remove_reference_t<Atomic>::template Guard<true>,
|
||||
typename std::remove_reference_t<Atomic>::template Guard<false>
|
||||
>>,
|
||||
std::conditional_t
|
||||
<
|
||||
std::is_const_v<Atomic>,
|
||||
typename std::remove_reference_t<Atomic>::template Guard<true>,
|
||||
typename std::remove_reference_t<Atomic>::template Guard<false>
|
||||
>
|
||||
>;
|
||||
protected: template
|
||||
<bool Nothrow = false, typename ConditionFunction = std::nullptr_t, typename Duration = std::nullptr_t>
|
||||
static auto lock_
|
||||
(auto&& atomic, ConditionFunction&& condition_function = nullptr, Duration timeout = nullptr)
|
||||
-> LockReturnType_<decltype(atomic), Duration, Nothrow>
|
||||
requires LockConstraint_<ConditionFunction, Duration>;
|
||||
};
|
||||
}
|
||||
|
||||
// Thread safe wrapper of custom class
|
||||
template <DecayedType ValueType, bool UseLogger> class Atomic : public detail_::AtomicBase<ValueType, UseLogger>
|
||||
{
|
||||
public: Atomic() = default;
|
||||
public: Atomic(const ValueType& value);
|
||||
public: Atomic(ValueType&& value);
|
||||
public: template <bool OtherUseLogger> Atomic(const Atomic<ValueType, OtherUseLogger>& other);
|
||||
public: template <bool OtherUseLogger> Atomic(Atomic<ValueType, OtherUseLogger>&& other);
|
||||
public: Atomic<ValueType, UseLogger>& operator=(const ValueType& value);
|
||||
public: Atomic<ValueType, UseLogger>& operator=(ValueType&& value);
|
||||
public: template <bool OtherUseLogger>
|
||||
Atomic<ValueType, UseLogger>& operator=(const Atomic<ValueType, OtherUseLogger>& other);
|
||||
public: template <bool OtherUseLogger>
|
||||
Atomic<ValueType, UseLogger>& operator=(Atomic<ValueType, OtherUseLogger>&& other);
|
||||
public: ValueType get() const&;
|
||||
public: ValueType get() &&;
|
||||
public: operator ValueType() const&;
|
||||
public: operator ValueType() &&;
|
||||
|
||||
protected: using DeepBase_ = detail_::AtomicBase<ValueType, false>;
|
||||
|
||||
public: template <bool ReturnFunctionResult = false> auto apply(auto&& function) const&
|
||||
-> DeepBase_::template ApplyReturnType_<decltype(function), decltype(*this), ReturnFunctionResult>
|
||||
requires DeepBase_::template ApplyConstraint_<decltype(function), decltype(*this)>;
|
||||
public: template <bool ReturnFunctionResult = false> auto apply(auto&& function) &
|
||||
-> DeepBase_::template ApplyReturnType_<decltype(function), decltype(*this), ReturnFunctionResult>
|
||||
requires DeepBase_::template ApplyConstraint_<decltype(function), decltype(*this)>;
|
||||
public: template <bool ReturnFunctionResult = false> auto apply(auto&& function) &&
|
||||
-> DeepBase_::template ApplyReturnType_<decltype(function), decltype(*this), ReturnFunctionResult>
|
||||
requires DeepBase_::template ApplyConstraint_<decltype(function), decltype(*this)>;
|
||||
public: template <bool ReturnFunctionResult = false>
|
||||
auto apply(auto&& function, auto&& condition_function) const&
|
||||
-> DeepBase_::template ApplyReturnType_
|
||||
<decltype(function), decltype(*this), ReturnFunctionResult, decltype(condition_function)>
|
||||
requires DeepBase_::template ApplyConstraint_
|
||||
<decltype(function), decltype(*this), decltype(condition_function)>;
|
||||
public: template <bool ReturnFunctionResult = false> auto apply(auto&& function, auto&& condition_function) &
|
||||
-> DeepBase_::template ApplyReturnType_
|
||||
<decltype(function), decltype(*this), ReturnFunctionResult, decltype(condition_function)>
|
||||
requires DeepBase_::template ApplyConstraint_
|
||||
<decltype(function), decltype(*this), decltype(condition_function)>;
|
||||
public: template <bool ReturnFunctionResult = false> auto apply(auto&& function, auto&& condition_function) &&
|
||||
-> DeepBase_::template ApplyReturnType_
|
||||
<decltype(function), decltype(*this), ReturnFunctionResult, decltype(condition_function)>
|
||||
requires DeepBase_::template ApplyConstraint_
|
||||
<decltype(function), decltype(*this), decltype(condition_function)>;
|
||||
public: template <bool ReturnFunctionResult = false, bool Nothrow = false>
|
||||
auto apply(auto&& function, auto&& condition_function, auto timeout) const&
|
||||
-> DeepBase_::template ApplyReturnType_
|
||||
<
|
||||
decltype(function), decltype(*this), ReturnFunctionResult,
|
||||
decltype(condition_function), decltype(timeout), Nothrow
|
||||
> requires DeepBase_::template ApplyConstraint_
|
||||
<decltype(function), decltype(*this), decltype(condition_function), decltype(timeout)>;
|
||||
public: template <bool ReturnFunctionResult = false, bool Nothrow = false>
|
||||
auto apply(auto&& function, auto&& condition_function, auto timeout) &
|
||||
-> DeepBase_::template ApplyReturnType_
|
||||
<
|
||||
decltype(function), decltype(*this), ReturnFunctionResult,
|
||||
decltype(condition_function), decltype(timeout), Nothrow
|
||||
> requires DeepBase_::template ApplyConstraint_
|
||||
<decltype(function), decltype(*this), decltype(condition_function), decltype(timeout)>;
|
||||
public: template <bool ReturnFunctionResult = false, bool Nothrow = false>
|
||||
auto apply(auto&& function, auto&& condition_function, auto timeout) &&
|
||||
-> DeepBase_::template ApplyReturnType_
|
||||
<
|
||||
decltype(function), decltype(*this), ReturnFunctionResult,
|
||||
decltype(condition_function), decltype(timeout), Nothrow
|
||||
> requires DeepBase_::template ApplyConstraint_
|
||||
<decltype(function), decltype(*this), decltype(condition_function), decltype(timeout)>;
|
||||
|
||||
public: auto wait(auto&& condition_function) const&
|
||||
-> DeepBase_::template WaitReturnType_<decltype(*this), decltype(condition_function)>
|
||||
requires DeepBase_::template WaitConstraint_<decltype(condition_function)>;
|
||||
public: auto wait(auto&& condition_function) &
|
||||
-> DeepBase_::template WaitReturnType_<decltype(*this), decltype(condition_function)>
|
||||
requires DeepBase_::template WaitConstraint_<decltype(condition_function)>;
|
||||
public: auto wait(auto&& condition_function) &&
|
||||
-> DeepBase_::template WaitReturnType_<decltype(*this), decltype(condition_function)>
|
||||
requires DeepBase_::template WaitConstraint_<decltype(condition_function)>;
|
||||
public: template <bool Nothrow = false> auto wait(auto&& condition_function, auto timeout) const&
|
||||
-> DeepBase_::template WaitReturnType_
|
||||
<decltype(*this), decltype(condition_function), decltype(timeout), Nothrow>
|
||||
requires DeepBase_::template WaitConstraint_<decltype(condition_function), decltype(timeout)>;
|
||||
public: template <bool Nothrow = false> auto wait(auto&& condition_function, auto timeout) &
|
||||
-> DeepBase_::template WaitReturnType_
|
||||
<decltype(*this), decltype(condition_function), decltype(timeout), Nothrow>
|
||||
requires DeepBase_::template WaitConstraint_<decltype(condition_function), decltype(timeout)>;
|
||||
public: template <bool Nothrow = false> auto wait(auto&& condition_function, auto timeout) &&
|
||||
-> DeepBase_::template WaitReturnType_
|
||||
<decltype(*this), decltype(condition_function), decltype(timeout), Nothrow>
|
||||
requires DeepBase_::template WaitConstraint_<decltype(condition_function), decltype(timeout)>;
|
||||
|
||||
// Attain lock from outside when constructing, and release when destructing.
|
||||
// For non-const variant, When destructing, ConditionVariable_.notify_all() is called.
|
||||
public: template <bool Const> class Guard
|
||||
{
|
||||
protected: std::unique_lock<std::recursive_mutex> Lock_;
|
||||
protected: std::experimental::observer_ptr
|
||||
<std::conditional_t<Const, const Atomic<ValueType, UseLogger>, Atomic<ValueType, UseLogger>>> Value_;
|
||||
|
||||
public: template <bool OtherConst> Guard(const Guard<OtherConst>& other) requires (Const || !OtherConst);
|
||||
public: Guard
|
||||
(decltype(Lock_)&& lock, decltype(Value_) value, CalledBy<detail_::AtomicBase<ValueType, UseLogger>>);
|
||||
public: ~Guard();
|
||||
|
||||
public: std::conditional_t<Const, const ValueType&, ValueType&> operator*() const&;
|
||||
public: std::conditional_t<Const, const ValueType*, ValueType*> operator->() const&;
|
||||
public: std::conditional_t<Const, const ValueType&, ValueType&> value() const&;
|
||||
public: auto operator*() const&& = delete;
|
||||
public: auto operator->() const&& = delete;
|
||||
public: auto value() const&& = delete;
|
||||
};
|
||||
|
||||
public: auto lock() const& -> DeepBase_::template LockReturnType_<decltype(*this)>
|
||||
requires DeepBase_::template LockConstraint_<>;
|
||||
public: auto lock() & -> DeepBase_::template LockReturnType_<decltype(*this)>
|
||||
requires DeepBase_::template LockConstraint_<>;
|
||||
public: auto lock() const&& = delete;
|
||||
public: auto lock(auto&& condition_function) const&
|
||||
-> DeepBase_::template LockReturnType_<decltype(*this), decltype(condition_function)>
|
||||
requires DeepBase_::template LockConstraint_<decltype(condition_function)>;
|
||||
public: auto lock(auto&& condition_function) &
|
||||
-> DeepBase_::template LockReturnType_<decltype(*this), decltype(condition_function)>
|
||||
requires DeepBase_::template LockConstraint_<decltype(condition_function)>;
|
||||
public: auto lock(auto&& condition_function) const&& = delete;
|
||||
public: template <bool Nothrow = false> auto lock(auto&& condition_function, auto timeout) const&
|
||||
-> DeepBase_::template LockReturnType_<decltype(*this), decltype(timeout), Nothrow>
|
||||
requires DeepBase_::template LockConstraint_<decltype(condition_function), decltype(timeout)>;
|
||||
public: template <bool Nothrow = false> auto lock(auto&& condition_function, auto timeout) &
|
||||
-> DeepBase_::template LockReturnType_<decltype(*this), decltype(timeout), Nothrow>
|
||||
requires DeepBase_::template LockConstraint_<decltype(condition_function), decltype(timeout)>;
|
||||
public: template <bool Nothrow = false> auto lock(auto&& condition_function, auto timeout) const&& = delete;
|
||||
};
|
||||
}
|
||||
366
local/pkgs/biu/include/biu/atomic/nolog.tpp
Normal file
366
local/pkgs/biu/include/biu/atomic/nolog.tpp
Normal file
@@ -0,0 +1,366 @@
|
||||
# pragma once
|
||||
# include <biu/atomic/nolog.hpp>
|
||||
|
||||
namespace biu
|
||||
{
|
||||
template <DecayedType ValueType> detail_::AtomicBase<ValueType, false>::AtomicBase(const ValueType& value)
|
||||
: Value_{value} {}
|
||||
template <DecayedType ValueType> detail_::AtomicBase<ValueType, false>::AtomicBase(ValueType&& value)
|
||||
: Value_{std::move(value)} {}
|
||||
|
||||
template <DecayedType ValueType>
|
||||
detail_::AtomicBase<ValueType, false>::TimeoutException::TimeoutException(std::string)
|
||||
: Message_{"TimeoutException"} {}
|
||||
template <DecayedType ValueType>
|
||||
const char* detail_::AtomicBase<ValueType, false>::TimeoutException::what() const noexcept
|
||||
{return Message_.c_str();}
|
||||
|
||||
template <DecayedType ValueType>
|
||||
template <bool ReturnFunctionResult, typename ConditionFunction, typename Duration, bool Nothrow>
|
||||
auto detail_::AtomicBase<ValueType, false>::apply_
|
||||
(auto&& atomic, auto&& function, ConditionFunction&& condition_function, Duration timeout)
|
||||
-> ApplyReturnType_
|
||||
<decltype(function), decltype(atomic), ReturnFunctionResult, ConditionFunction, Duration, Nothrow>
|
||||
requires ApplyConstraint_<decltype(function), decltype(atomic), ConditionFunction, Duration>
|
||||
{
|
||||
std::unique_lock lock{atomic.Mutex_};
|
||||
|
||||
// try to meet the condition
|
||||
if constexpr (!std::is_null_pointer_v<ConditionFunction>)
|
||||
{
|
||||
if constexpr (std::is_null_pointer_v<Duration>)
|
||||
atomic.ConditionVariable_.wait(lock, [&]
|
||||
{return std::forward<ConditionFunction>(condition_function)(std::as_const(atomic.Value_));});
|
||||
else if (!atomic.ConditionVariable_.wait_for(lock, timeout, [&]
|
||||
{return std::forward<ConditionFunction>(condition_function)(std::as_const(atomic.Value_));}))
|
||||
{
|
||||
if constexpr (Nothrow)
|
||||
{
|
||||
if constexpr
|
||||
(ReturnFunctionResult && !std::is_void_v<std::invoke_result_t<decltype(function), ValueType>>)
|
||||
return std::nullopt;
|
||||
else return false;
|
||||
}
|
||||
else throw TimeoutException{};
|
||||
}
|
||||
}
|
||||
|
||||
// apply the function and return
|
||||
if constexpr (ReturnFunctionResult && !std::is_void_v<std::invoke_result_t<decltype(function), ValueType>>)
|
||||
{
|
||||
auto&& result = std::forward<decltype(function)>(function)
|
||||
(static_cast<MoveQualifiers<decltype(atomic), ValueType>&&>(atomic.Value_));
|
||||
if constexpr (!std::is_const_v<decltype(atomic)>) atomic.ConditionVariable_.notify_all();
|
||||
return std::forward<decltype(result)>(result);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::forward<decltype(function)>(function)
|
||||
(static_cast<MoveQualifiers<decltype(atomic), ValueType>&&>(atomic.Value_));
|
||||
if constexpr (!std::is_const_v<decltype(atomic)>) atomic.ConditionVariable_.notify_all();
|
||||
if constexpr (ReturnFunctionResult && std::is_void_v<std::invoke_result_t<decltype(function), ValueType>>)
|
||||
return;
|
||||
else return std::forward<decltype(atomic)>(atomic);
|
||||
}
|
||||
}
|
||||
|
||||
template <DecayedType ValueType> template <bool Nothrow, typename Duration>
|
||||
auto detail_::AtomicBase<ValueType, false>::wait_(auto&& atomic, auto&& condition_function, Duration timeout)
|
||||
-> WaitReturnType_<decltype(atomic), decltype(condition_function), Duration, Nothrow>
|
||||
requires WaitConstraint_<decltype(condition_function), Duration>
|
||||
{
|
||||
std::unique_lock lock{atomic.Mutex_};
|
||||
|
||||
if constexpr (std::is_null_pointer_v<Duration>)
|
||||
{
|
||||
atomic.ConditionVariable_.wait(lock, [&]
|
||||
{return std::forward<decltype(condition_function)>(condition_function)(std::as_const(atomic.Value_));});
|
||||
return std::forward<decltype(atomic)>(atomic);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!atomic.ConditionVariable_.wait_for(lock, timeout, [&]
|
||||
{return std::forward<decltype(condition_function)>(condition_function)(std::as_const(atomic.Value_));}))
|
||||
{
|
||||
if constexpr (Nothrow) return false;
|
||||
else throw TimeoutException{};
|
||||
}
|
||||
else
|
||||
{
|
||||
if constexpr (Nothrow) return true;
|
||||
else return std::forward<decltype(atomic)>(atomic);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <DecayedType ValueType> template <bool Nothrow, typename ConditionFunction, typename Duration>
|
||||
auto detail_::AtomicBase<ValueType, false>::lock_
|
||||
(auto&& atomic, ConditionFunction&& condition_function, Duration timeout)
|
||||
-> LockReturnType_<decltype(atomic), Duration, Nothrow> requires LockConstraint_<ConditionFunction, Duration>
|
||||
{
|
||||
if constexpr (std::is_null_pointer_v<ConditionFunction>)
|
||||
return {std::unique_lock{atomic.Mutex_}, std::experimental::make_observer(&atomic), {}};
|
||||
else if constexpr (std::is_null_pointer_v<Duration>)
|
||||
{
|
||||
std::unique_lock lock{atomic.Mutex_};
|
||||
atomic.ConditionVariable_.wait(lock, [&]
|
||||
{return std::forward<ConditionFunction>(condition_function)(std::as_const(atomic.Value_));});
|
||||
return {std::move(lock), std::experimental::make_observer(&atomic), {}};
|
||||
}
|
||||
else
|
||||
{
|
||||
std::unique_lock lock{atomic.Mutex_};
|
||||
if (!atomic.ConditionVariable_.wait_for(lock, timeout, [&]
|
||||
{return std::forward<ConditionFunction>(condition_function)(std::as_const(atomic.Value_));}))
|
||||
{
|
||||
if constexpr (Nothrow) return std::nullopt;
|
||||
else throw TimeoutException{};
|
||||
}
|
||||
else
|
||||
return {{std::move(lock), std::experimental::make_observer(&atomic), {}}};
|
||||
}
|
||||
}
|
||||
|
||||
template <DecayedType ValueType, bool UseLogger> Atomic<ValueType, UseLogger>::Atomic(const ValueType& value)
|
||||
: detail_::AtomicBase<ValueType, UseLogger>{value} {}
|
||||
template <DecayedType ValueType, bool UseLogger> Atomic<ValueType, UseLogger>::Atomic(ValueType&& value)
|
||||
: detail_::AtomicBase<ValueType, UseLogger>{std::move(value)} {}
|
||||
template <DecayedType ValueType, bool UseLogger> template <bool OtherUseLogger>
|
||||
Atomic<ValueType, UseLogger>::Atomic(const Atomic<ValueType, OtherUseLogger>& other)
|
||||
: detail_::AtomicBase<ValueType, UseLogger>{other} {}
|
||||
template <DecayedType ValueType, bool UseLogger> template <bool OtherUseLogger>
|
||||
Atomic<ValueType, UseLogger>::Atomic(Atomic<ValueType, OtherUseLogger>&& other)
|
||||
: detail_::AtomicBase<ValueType, UseLogger>{std::move(other)} {}
|
||||
template <DecayedType ValueType, bool UseLogger>
|
||||
Atomic<ValueType, UseLogger>& Atomic<ValueType, UseLogger>::operator=(const ValueType& value)
|
||||
{
|
||||
std::scoped_lock lock{DeepBase_::Mutex_};
|
||||
DeepBase_::Value_ = value;
|
||||
DeepBase_::ConditionVariable_.notify_all();
|
||||
return *this;
|
||||
}
|
||||
template <DecayedType ValueType, bool UseLogger>
|
||||
Atomic<ValueType, UseLogger>& Atomic<ValueType, UseLogger>::operator=(ValueType&& value)
|
||||
{
|
||||
std::scoped_lock lock{DeepBase_::Mutex_};
|
||||
DeepBase_::Value_ = std::move(value);
|
||||
DeepBase_::ConditionVariable_.notify_all();
|
||||
return *this;
|
||||
}
|
||||
template <DecayedType ValueType, bool UseLogger> template <bool OtherUseLogger>
|
||||
Atomic<ValueType, UseLogger>& operator=(const Atomic<ValueType, OtherUseLogger>& other)
|
||||
{
|
||||
std::scoped_lock lock{DeepBase_::Mutex_};
|
||||
DeepBase_::Value_ = value;
|
||||
DeepBase_::ConditionVariable_.notify_all();
|
||||
return *this;
|
||||
}
|
||||
template <DecayedType ValueType, bool UseLogger> template <bool OtherUseLogger>
|
||||
Atomic<ValueType, UseLogger>& operator=(Atomic<ValueType, OtherUseLogger>&& other)
|
||||
{
|
||||
std::scoped_lock lock{DeepBase_::Mutex_};
|
||||
DeepBase_::Value_ = std::move(value);
|
||||
DeepBase_::ConditionVariable_.notify_all();
|
||||
return *this;
|
||||
}
|
||||
template <DecayedType ValueType, bool UseLogger> ValueType Atomic<ValueType, UseLogger>::get() const&
|
||||
{
|
||||
std::scoped_lock lock{DeepBase_::Mutex_};
|
||||
return DeepBase_::Value_;
|
||||
}
|
||||
template <DecayedType ValueType, bool UseLogger> ValueType Atomic<ValueType, UseLogger>::get() &&
|
||||
{
|
||||
std::scoped_lock lock{DeepBase_::Mutex_};
|
||||
return std::move(DeepBase_::Value_);
|
||||
}
|
||||
template <DecayedType ValueType, bool UseLogger> Atomic<ValueType, UseLogger>::operator ValueType() const&
|
||||
{return get();}
|
||||
template <DecayedType ValueType, bool UseLogger> Atomic<ValueType, UseLogger>::operator ValueType() &&
|
||||
{return std::move(*this).get();}
|
||||
|
||||
template <DecayedType ValueType, bool UseLogger> template <bool ReturnFunctionResult>
|
||||
auto Atomic<ValueType, UseLogger>::apply(auto&& function) const&
|
||||
-> DeepBase_::template ApplyReturnType_<decltype(function), decltype(*this), ReturnFunctionResult>
|
||||
requires DeepBase_::template ApplyConstraint_<decltype(function), decltype(*this)>
|
||||
{return apply_<ReturnFunctionResult>(*this, std::forward<decltype(function)>(function));}
|
||||
template <DecayedType ValueType, bool UseLogger> template <bool ReturnFunctionResult>
|
||||
auto Atomic<ValueType, UseLogger>::apply(auto&& function) &
|
||||
-> DeepBase_::template ApplyReturnType_<decltype(function), decltype(*this), ReturnFunctionResult>
|
||||
requires DeepBase_::template ApplyConstraint_<decltype(function), decltype(*this)>
|
||||
{return apply_<ReturnFunctionResult>(*this, std::forward<decltype(function)>(function));}
|
||||
template <DecayedType ValueType, bool UseLogger> template <bool ReturnFunctionResult>
|
||||
auto Atomic<ValueType, UseLogger>::apply(auto&& function) &&
|
||||
-> DeepBase_::template ApplyReturnType_<decltype(function), decltype(*this), ReturnFunctionResult>
|
||||
requires DeepBase_::template ApplyConstraint_<decltype(function), decltype(*this)>
|
||||
{return apply_<ReturnFunctionResult>(std::move(*this), std::forward<decltype(function)>(function));}
|
||||
template <DecayedType ValueType, bool UseLogger> template <bool ReturnFunctionResult>
|
||||
auto Atomic<ValueType, UseLogger>::apply(auto&& function, auto&& condition_function) const&
|
||||
-> DeepBase_::template ApplyReturnType_
|
||||
<decltype(function), decltype(*this), ReturnFunctionResult, decltype(condition_function)>
|
||||
requires DeepBase_::template ApplyConstraint_<decltype(function), decltype(*this), decltype(condition_function)>
|
||||
{
|
||||
return apply_<ReturnFunctionResult>
|
||||
(
|
||||
*this, std::forward<decltype(function)>(function),
|
||||
std::forward<decltype(condition_function)>(condition_function)
|
||||
);
|
||||
}
|
||||
template <DecayedType ValueType, bool UseLogger> template <bool ReturnFunctionResult>
|
||||
auto Atomic<ValueType, UseLogger>::apply(auto&& function, auto&& condition_function) &
|
||||
-> DeepBase_::template ApplyReturnType_
|
||||
<decltype(function), decltype(*this), ReturnFunctionResult, decltype(condition_function)>
|
||||
requires DeepBase_::template ApplyConstraint_<decltype(function), decltype(*this), decltype(condition_function)>
|
||||
{
|
||||
return apply_<ReturnFunctionResult>
|
||||
(
|
||||
*this, std::forward<decltype(function)>(function),
|
||||
std::forward<decltype(condition_function)>(condition_function)
|
||||
);
|
||||
}
|
||||
template <DecayedType ValueType, bool UseLogger> template <bool ReturnFunctionResult>
|
||||
auto Atomic<ValueType, UseLogger>::apply(auto&& function, auto&& condition_function) &&
|
||||
-> DeepBase_::template ApplyReturnType_
|
||||
<decltype(function), decltype(*this), ReturnFunctionResult, decltype(condition_function)>
|
||||
requires DeepBase_::template ApplyConstraint_<decltype(function), decltype(*this), decltype(condition_function)>
|
||||
{
|
||||
return apply_<ReturnFunctionResult>
|
||||
(
|
||||
std::move(*this), std::forward<decltype(function)>(function),
|
||||
std::forward<decltype(condition_function)>(condition_function)
|
||||
);
|
||||
}
|
||||
template <DecayedType ValueType, bool UseLogger> template <bool ReturnFunctionResult, bool Nothrow>
|
||||
auto Atomic<ValueType, UseLogger>::apply(auto&& function, auto&& condition_function, auto timeout) const&
|
||||
-> DeepBase_::template ApplyReturnType_
|
||||
<
|
||||
decltype(function), decltype(*this), ReturnFunctionResult,
|
||||
decltype(condition_function), decltype(timeout), Nothrow
|
||||
> requires DeepBase_::template ApplyConstraint_
|
||||
<decltype(function), decltype(*this), decltype(condition_function), decltype(timeout)>
|
||||
{
|
||||
return apply_<ReturnFunctionResult, Nothrow>
|
||||
(
|
||||
*this, std::forward<decltype(function)>(function),
|
||||
std::forward<decltype(condition_function)>(condition_function), timeout
|
||||
);
|
||||
}
|
||||
template <DecayedType ValueType, bool UseLogger> template <bool ReturnFunctionResult, bool Nothrow>
|
||||
auto Atomic<ValueType, UseLogger>::apply(auto&& function, auto&& condition_function, auto timeout) &
|
||||
-> DeepBase_::template ApplyReturnType_
|
||||
<
|
||||
decltype(function), decltype(*this), ReturnFunctionResult,
|
||||
decltype(condition_function), decltype(timeout), Nothrow
|
||||
> requires DeepBase_::template ApplyConstraint_
|
||||
<decltype(function), decltype(*this), decltype(condition_function), decltype(timeout)>
|
||||
{
|
||||
return apply_<ReturnFunctionResult, Nothrow>
|
||||
(
|
||||
*this, std::forward<decltype(function)>(function),
|
||||
std::forward<decltype(condition_function)>(condition_function), timeout
|
||||
);
|
||||
}
|
||||
template <DecayedType ValueType, bool UseLogger> template <bool ReturnFunctionResult, bool Nothrow>
|
||||
auto Atomic<ValueType, UseLogger>::apply(auto&& function, auto&& condition_function, auto timeout) &&
|
||||
-> DeepBase_::template ApplyReturnType_
|
||||
<
|
||||
decltype(function), decltype(*this), ReturnFunctionResult,
|
||||
decltype(condition_function), decltype(timeout), Nothrow
|
||||
> requires DeepBase_::template ApplyConstraint_
|
||||
<decltype(function), decltype(*this), decltype(condition_function), decltype(timeout)>
|
||||
{
|
||||
return apply_<ReturnFunctionResult, Nothrow>
|
||||
(
|
||||
std::move(*this), std::forward<decltype(function)>(function),
|
||||
std::forward<decltype(condition_function)>(condition_function), timeout
|
||||
);
|
||||
}
|
||||
|
||||
template <DecayedType ValueType, bool UseLogger>
|
||||
auto Atomic<ValueType, UseLogger>::wait(auto&& condition_function) const&
|
||||
-> DeepBase_::template WaitReturnType_<decltype(*this), decltype(condition_function)>
|
||||
requires DeepBase_::template WaitConstraint_<decltype(condition_function)>
|
||||
{return wait_(*this, std::forward<decltype(condition_function)>(condition_function));}
|
||||
template <DecayedType ValueType, bool UseLogger>
|
||||
auto Atomic<ValueType, UseLogger>::wait(auto&& condition_function) &
|
||||
-> DeepBase_::template WaitReturnType_<decltype(*this), decltype(condition_function)>
|
||||
requires DeepBase_::template WaitConstraint_<decltype(condition_function)>
|
||||
{return wait_(*this, std::forward<decltype(condition_function)>(condition_function));}
|
||||
template <DecayedType ValueType, bool UseLogger>
|
||||
auto Atomic<ValueType, UseLogger>::wait(auto&& condition_function) &&
|
||||
-> DeepBase_::template WaitReturnType_<decltype(*this), decltype(condition_function)>
|
||||
requires DeepBase_::template WaitConstraint_<decltype(condition_function)>
|
||||
{return wait_(std::move(*this), std::forward<decltype(condition_function)>(condition_function));}
|
||||
template <DecayedType ValueType, bool UseLogger> template <bool Nothrow>
|
||||
auto Atomic<ValueType, UseLogger>::wait(auto&& condition_function, auto timeout) const&
|
||||
-> DeepBase_::template WaitReturnType_
|
||||
<decltype(*this), decltype(condition_function), decltype(timeout), Nothrow>
|
||||
requires DeepBase_::template WaitConstraint_<decltype(condition_function), decltype(timeout)>
|
||||
{return wait_<Nothrow>(*this, std::forward<decltype(condition_function)>(condition_function), timeout);}
|
||||
template <DecayedType ValueType, bool UseLogger> template <bool Nothrow>
|
||||
auto Atomic<ValueType, UseLogger>::wait(auto&& condition_function, auto timeout) &
|
||||
-> DeepBase_::template WaitReturnType_
|
||||
<decltype(*this), decltype(condition_function), decltype(timeout), Nothrow>
|
||||
requires DeepBase_::template WaitConstraint_<decltype(condition_function), decltype(timeout)>
|
||||
{return wait_<Nothrow>(*this, std::forward<decltype(condition_function)>(condition_function), timeout);}
|
||||
template <DecayedType ValueType, bool UseLogger> template <bool Nothrow>
|
||||
auto Atomic<ValueType, UseLogger>::wait(auto&& condition_function, auto timeout) &&
|
||||
-> DeepBase_::template WaitReturnType_
|
||||
<decltype(*this), decltype(condition_function), decltype(timeout), Nothrow>
|
||||
requires DeepBase_::template WaitConstraint_<decltype(condition_function), decltype(timeout)>
|
||||
{
|
||||
return wait_<Nothrow>
|
||||
(std::move(*this), std::forward<decltype(condition_function)>(condition_function), timeout);
|
||||
}
|
||||
|
||||
template <DecayedType ValueType, bool UseLogger> template <bool Const> template <bool OtherConst>
|
||||
Atomic<ValueType, UseLogger>::Guard<Const>::Guard(const Guard<OtherConst>& other)
|
||||
requires (Const || !OtherConst)
|
||||
: Lock_{other.Lock_}, Value_{other.Value_} {}
|
||||
template <DecayedType ValueType, bool UseLogger> template <bool Const>
|
||||
Atomic<ValueType, UseLogger>::Guard<Const>::Guard
|
||||
(decltype(Lock_)&& lock, decltype(Value_) value, CalledBy<detail_::AtomicBase<ValueType, UseLogger>>)
|
||||
: Lock_{std::move(lock)}, Value_{value} {}
|
||||
template <DecayedType ValueType, bool UseLogger> template <bool Const>
|
||||
Atomic<ValueType, UseLogger>::Guard<Const>::~Guard()
|
||||
{Value_->ConditionVariable_.notify_all();}
|
||||
|
||||
template <DecayedType ValueType, bool UseLogger> template <bool Const>
|
||||
std::conditional_t<Const, const ValueType&, ValueType&>
|
||||
Atomic<ValueType, UseLogger>::Guard<Const>::operator*() const&
|
||||
{return Value_->Value_;}
|
||||
template <DecayedType ValueType, bool UseLogger> template <bool Const>
|
||||
std::conditional_t<Const, const ValueType*, ValueType*>
|
||||
Atomic<ValueType, UseLogger>::Guard<Const>::operator->() const&
|
||||
{return &Value_->Value_;}
|
||||
template <DecayedType ValueType, bool UseLogger> template <bool Const>
|
||||
std::conditional_t<Const, const ValueType&, ValueType&>
|
||||
Atomic<ValueType, UseLogger>::Guard<Const>::value() const&
|
||||
{return Value_->Value_;}
|
||||
|
||||
template <DecayedType ValueType, bool UseLogger> auto Atomic<ValueType, UseLogger>::lock() const&
|
||||
-> DeepBase_::template LockReturnType_<decltype(*this)> requires DeepBase_::template LockConstraint_<>
|
||||
{return lock_(*this);}
|
||||
template <DecayedType ValueType, bool UseLogger> auto Atomic<ValueType, UseLogger>::lock() &
|
||||
-> DeepBase_::template LockReturnType_<decltype(*this)> requires DeepBase_::template LockConstraint_<>
|
||||
{return lock_(*this);}
|
||||
template <DecayedType ValueType, bool UseLogger>
|
||||
auto Atomic<ValueType, UseLogger>::lock(auto&& condition_function) const&
|
||||
-> DeepBase_::template LockReturnType_<decltype(*this), decltype(condition_function)>
|
||||
requires DeepBase_::template LockConstraint_<decltype(condition_function)>
|
||||
{return lock_(*this, condition_function);}
|
||||
template <DecayedType ValueType, bool UseLogger>
|
||||
auto Atomic<ValueType, UseLogger>::lock(auto&& condition_function) &
|
||||
-> DeepBase_::template LockReturnType_<decltype(*this), decltype(condition_function)>
|
||||
requires DeepBase_::template LockConstraint_<decltype(condition_function)>
|
||||
{return lock_(*this, condition_function);}
|
||||
template <DecayedType ValueType, bool UseLogger> template <bool Nothrow>
|
||||
auto Atomic<ValueType, UseLogger>::lock(auto&& condition_function, auto timeout) const&
|
||||
-> DeepBase_::template LockReturnType_<decltype(*this), decltype(timeout), Nothrow>
|
||||
requires DeepBase_::template LockConstraint_<decltype(condition_function), decltype(timeout)>
|
||||
{return lock_<Nothrow>(*this, condition_function, timeout);}
|
||||
template <DecayedType ValueType, bool UseLogger> template <bool Nothrow>
|
||||
auto Atomic<ValueType, UseLogger>::lock(auto&& condition_function, auto timeout) &
|
||||
-> DeepBase_::template LockReturnType_<decltype(*this), decltype(timeout), Nothrow>
|
||||
requires DeepBase_::template LockConstraint_<decltype(condition_function), decltype(timeout)>
|
||||
{return lock_<Nothrow>(*this, condition_function, timeout);}
|
||||
}
|
||||
10
local/pkgs/biu/include/biu/called_by.hpp
Normal file
10
local/pkgs/biu/include/biu/called_by.hpp
Normal file
@@ -0,0 +1,10 @@
|
||||
# pragma once
|
||||
|
||||
namespace biu
|
||||
{
|
||||
template <typename AllowedType> class CalledBy
|
||||
{
|
||||
protected: CalledBy() = default;
|
||||
friend AllowedType;
|
||||
};
|
||||
}
|
||||
105
local/pkgs/biu/include/biu/common.hpp
Normal file
105
local/pkgs/biu/include/biu/common.hpp
Normal file
@@ -0,0 +1,105 @@
|
||||
# pragma once
|
||||
# include <regex>
|
||||
# include <optional>
|
||||
# include <filesystem>
|
||||
# include <fmt/format.h>
|
||||
# include <magic_enum_all.hpp>
|
||||
|
||||
namespace biu
|
||||
{
|
||||
inline namespace literals
|
||||
{
|
||||
using namespace std::literals;
|
||||
using namespace fmt::literals;
|
||||
std::regex operator""_re(const char* str, std::size_t len);
|
||||
}
|
||||
inline namespace stream_operators { using namespace magic_enum::iostream_operators; }
|
||||
namespace common
|
||||
{
|
||||
std::size_t hash(auto&&... objs);
|
||||
[[gnu::always_inline]] void unused(auto&&...);
|
||||
[[noreturn]] void block_forever();
|
||||
|
||||
bool is_interactive();
|
||||
std::optional<std::string> env(std::string name);
|
||||
|
||||
using int128_t = __int128_t;
|
||||
using uint128_t = __uint128_t;
|
||||
|
||||
struct Empty {};
|
||||
|
||||
struct CaseInsensitiveStringLessComparator
|
||||
{
|
||||
template <typename String> constexpr bool operator()(const String& s1, const String& s2) const;
|
||||
};
|
||||
namespace detail_
|
||||
{
|
||||
template <typename T> struct RemoveMemberPointerHelper { using Type = T; };
|
||||
template <typename Class, typename Member> struct RemoveMemberPointerHelper<Member Class::*>
|
||||
{ using Type = Member; };
|
||||
}
|
||||
template <typename MemberPointer> using RemoveMemberPointer
|
||||
= typename detail_::RemoveMemberPointerHelper<MemberPointer>::Type;
|
||||
|
||||
namespace detail_
|
||||
{
|
||||
template <typename From, typename To> struct MoveQualifiersHelper
|
||||
{
|
||||
protected: static constexpr bool Const_ = std::is_const_v<From>;
|
||||
protected: static constexpr bool Volatile_ = std::is_volatile_v<From>;
|
||||
protected: static constexpr bool Reference_ = std::is_reference_v<From>;
|
||||
protected: static constexpr bool Lvalue_ = std::is_lvalue_reference_v<From>;
|
||||
protected: using NoCvrefType_ = std::remove_cvref_t<To>;
|
||||
protected: using NoCvType_
|
||||
= std::conditional_t<Reference_, std::conditional_t<Lvalue_, NoCvrefType_&, NoCvrefType_&&>, NoCvrefType_>;
|
||||
protected: using NoConstType_ = std::conditional_t<Volatile_, volatile NoCvType_, NoCvType_>;
|
||||
public: using Type = std::conditional_t<Const_, const NoConstType_, NoConstType_>;
|
||||
};
|
||||
}
|
||||
template <typename From, typename To> using MoveQualifiers
|
||||
= typename detail_::MoveQualifiersHelper<From, To>::Type;
|
||||
|
||||
namespace detail_
|
||||
{
|
||||
template <typename T, typename Fallback = void> struct FallbackIfNoTypeDeclaredHelper { using Type = Fallback; };
|
||||
template <typename T, typename Fallback> requires requires { typename T::Type; }
|
||||
struct FallbackIfNoTypeDeclaredHelper<T, Fallback> { using Type = typename T::Type; };
|
||||
template <typename T, typename Fallback> requires requires {typename T::type;}
|
||||
struct FallbackIfNoTypeDeclaredHelper<T, Fallback> { using Type = typename T::type; };
|
||||
}
|
||||
template <typename T, typename Fallback = void> using FallbackIfNoTypeDeclared
|
||||
= typename detail_::FallbackIfNoTypeDeclaredHelper<T, Fallback>::Type;
|
||||
|
||||
namespace detail_
|
||||
{
|
||||
struct ExecMode { bool DirectStdin = false, DirectStdout = false, DirectStderr = false, SearchPath = false; };
|
||||
template <ExecMode Mode> struct ExecResult
|
||||
{
|
||||
int ExitCode;
|
||||
std::conditional_t<Mode.DirectStdout, Empty, std::string> Stdout;
|
||||
std::conditional_t<Mode.DirectStderr, Empty, std::string> Stderr;
|
||||
operator bool() const;
|
||||
};
|
||||
template <ExecMode Mode> struct ExecInput
|
||||
{
|
||||
std::conditional_t<Mode.SearchPath, std::string, std::filesystem::path> Program;
|
||||
std::vector<std::string> Args = {};
|
||||
std::conditional_t<Mode.DirectStdin, Empty, std::string> Stdin = {};
|
||||
std::map<std::string, std::string> ExtraEnv = {};
|
||||
std::optional<std::chrono::milliseconds> Timeout = {};
|
||||
};
|
||||
}
|
||||
template <detail_::ExecMode Mode = {}> detail_::ExecResult<Mode> exec(detail_::ExecInput<Mode> input);
|
||||
|
||||
static_assert(sizeof(char) == sizeof(std::byte));
|
||||
template <typename Char = std::byte, typename T> requires (std::same_as<Char, std::byte>)
|
||||
std::vector<std::byte> serialize(const T& data);
|
||||
template <typename Char = std::byte, typename T> requires (std::same_as<Char, char>)
|
||||
std::string serialize(const T& data);
|
||||
template <typename T> T deserialize(const std::string& serialized_data);
|
||||
template <typename T> T deserialize(const std::vector<std::byte>& serialized_data);
|
||||
}
|
||||
using common::hash, common::unused, common::block_forever, common::is_interactive, common::env, common::int128_t,
|
||||
common::uint128_t, common::Empty, common::CaseInsensitiveStringLessComparator, common::RemoveMemberPointer,
|
||||
common::MoveQualifiers, common::FallbackIfNoTypeDeclared, common::exec, common::serialize, common::deserialize;
|
||||
}
|
||||
50
local/pkgs/biu/include/biu/common.tpp
Normal file
50
local/pkgs/biu/include/biu/common.tpp
Normal file
@@ -0,0 +1,50 @@
|
||||
# pragma once
|
||||
# include <boost/functional/hash.hpp>
|
||||
# include <zpp_bits.h>
|
||||
# include <biu/common.hpp>
|
||||
|
||||
namespace biu::common
|
||||
{
|
||||
void unused(auto&&...) {}
|
||||
std::size_t hash(auto&&... objs)
|
||||
{
|
||||
std::size_t result = 0;
|
||||
(boost::hash_combine(result, objs), ...);
|
||||
return result;
|
||||
}
|
||||
|
||||
template <typename String> constexpr bool CaseInsensitiveStringLessComparator::operator()
|
||||
(const String& s1, const String& s2) const
|
||||
{
|
||||
return std::lexicographical_compare
|
||||
(
|
||||
s1.begin(), s1.end(), s2.begin(), s2.end(),
|
||||
[](char c1, char c2){return std::tolower(c1) < std::tolower(c2);}
|
||||
);
|
||||
}
|
||||
|
||||
template <typename Char, typename T> requires (std::same_as<Char, std::byte>)
|
||||
std::vector<std::byte> serialize(const T& data)
|
||||
{
|
||||
auto [serialized_data, out] = zpp::bits::data_out();
|
||||
out(data).or_throw();
|
||||
return serialized_data;
|
||||
}
|
||||
template <typename Char, typename T> requires (std::same_as<Char, char>) std::string serialize(const T& data)
|
||||
{
|
||||
auto serialized_data = serialize<std::byte>(data);
|
||||
return {reinterpret_cast<const char*>(serialized_data.data()), serialized_data.size()};
|
||||
}
|
||||
template <typename T> T deserialize(const std::vector<std::byte>& serialized_data)
|
||||
{
|
||||
auto in = zpp::bits::in(serialized_data);
|
||||
T data;
|
||||
in(data).or_throw();
|
||||
return data;
|
||||
}
|
||||
template <typename T> T deserialize(const std::string& serialized_data)
|
||||
{
|
||||
auto begin = reinterpret_cast<const std::byte*>(serialized_data.data()), end = begin + serialized_data.size();
|
||||
return deserialize<T>(std::vector<std::byte>{begin, end});
|
||||
}
|
||||
}
|
||||
54
local/pkgs/biu/include/biu/concepts.hpp
Normal file
54
local/pkgs/biu/include/biu/concepts.hpp
Normal file
@@ -0,0 +1,54 @@
|
||||
# pragma once
|
||||
# include <concepts>
|
||||
# include <tuple>
|
||||
# include <type_traits>
|
||||
# include <complex>
|
||||
|
||||
namespace biu
|
||||
{
|
||||
namespace concepts
|
||||
{
|
||||
template <typename T> concept DecayedType = std::same_as<std::decay_t<T>, T>;
|
||||
|
||||
namespace detail_::specialization_of_detail_
|
||||
{
|
||||
template <typename Tuple> struct DropFirstMemberOfTupleHelper;
|
||||
template <typename First, typename... Others> struct DropFirstMemberOfTupleHelper<std::tuple<First, Others...>>
|
||||
{using Type = std::tuple<Others...>;};
|
||||
template <typename ProvidedArgs, typename ActualArgs> consteval bool check_provided_args();
|
||||
template <typename Class, template <typename...> typename Template> struct SpecializationOfHelper
|
||||
{template <typename... ProvidedArgs> consteval static bool check_provided_args();};
|
||||
template <template <typename...> typename Template, typename... ActualArgs>
|
||||
struct SpecializationOfHelper<Template<ActualArgs...>, Template>
|
||||
{template <typename... ProvidedArgs> consteval static bool check_provided_args();};
|
||||
}
|
||||
template <typename Class, template <typename...> typename Template, typename... ProvidedArgs>
|
||||
concept SpecializationOf
|
||||
= detail_::specialization_of_detail_::SpecializationOfHelper<std::decay_t<Class>, Template>
|
||||
::template check_provided_args<ProvidedArgs...>();
|
||||
|
||||
template <typename T> concept CompletedType = sizeof(T) == sizeof(T);
|
||||
|
||||
template <typename From, typename To> concept ImplicitlyConvertibleTo = std::is_convertible<From, To>::value;
|
||||
template <typename To, typename From> concept ImplicitlyConvertibleFrom = std::is_convertible<From, To>::value;
|
||||
template <typename From, typename To> concept ExplicitlyConvertibleTo = std::is_constructible<To, From>::value;
|
||||
template <typename To, typename From> concept ExplicitlyConvertibleFrom = std::is_constructible<To, From>::value;
|
||||
template <typename From, typename To> concept ConvertibleTo
|
||||
= ImplicitlyConvertibleTo<From, To> || ExplicitlyConvertibleTo<From, To>;
|
||||
template <typename From, typename To> concept ConvertibleFrom = ConvertibleTo<From, To>;
|
||||
|
||||
template <typename Function, auto... Args> concept ConstevalInvokable
|
||||
= requires() {typename std::type_identity_t<int[(Function()(Args...), 1)]>;};
|
||||
|
||||
template <typename T> concept Enumerable = std::is_enum_v<T>;
|
||||
|
||||
template <typename Function, typename Result, typename... Args> concept InvocableWithResult
|
||||
= std::is_invocable_r_v<Result, Function, Args...>;
|
||||
|
||||
template <typename T> concept Arithmetic = std::is_arithmetic<T>::value || SpecializationOf<T, std::complex>;
|
||||
}
|
||||
using concepts::DecayedType, concepts::SpecializationOf, concepts::CompletedType, concepts::ImplicitlyConvertibleTo,
|
||||
concepts::ImplicitlyConvertibleFrom, concepts::ExplicitlyConvertibleTo, concepts::ExplicitlyConvertibleFrom,
|
||||
concepts::ConvertibleTo, concepts::ConvertibleFrom, concepts::ConstevalInvokable, concepts::Enumerable,
|
||||
concepts::InvocableWithResult, concepts::Arithmetic;
|
||||
}
|
||||
34
local/pkgs/biu/include/biu/concepts.tpp
Normal file
34
local/pkgs/biu/include/biu/concepts.tpp
Normal file
@@ -0,0 +1,34 @@
|
||||
# pragma once
|
||||
# include <tuple>
|
||||
# include <biu/concepts.hpp>
|
||||
|
||||
namespace biu::concepts
|
||||
{
|
||||
template <typename ProvidedArgs, typename ActualArgs> consteval bool
|
||||
detail_::specialization_of_detail_::check_provided_args()
|
||||
{
|
||||
if constexpr (std::tuple_size_v<ProvidedArgs> == 0)
|
||||
return true;
|
||||
else if constexpr (std::tuple_size_v<ActualArgs> == 0)
|
||||
return false;
|
||||
else if constexpr
|
||||
(std::same_as<std::tuple_element_t<0, ProvidedArgs>, std::tuple_element_t<0, ActualArgs>>)
|
||||
return check_provided_args
|
||||
<
|
||||
typename DropFirstMemberOfTupleHelper<ProvidedArgs>::Type,
|
||||
typename DropFirstMemberOfTupleHelper<ActualArgs>::Type
|
||||
>();
|
||||
else
|
||||
return false;
|
||||
}
|
||||
template <typename Class, template <typename...> typename Template> template <typename... ProvidedArgs> consteval
|
||||
bool detail_::specialization_of_detail_::SpecializationOfHelper<Class, Template>::check_provided_args()
|
||||
{ return false; }
|
||||
template <template <typename...> typename Template, typename... ActualArgs> template <typename... ProvidedArgs>
|
||||
consteval bool detail_::specialization_of_detail_::SpecializationOfHelper
|
||||
<Template<ActualArgs...>, Template>::check_provided_args()
|
||||
{
|
||||
return specialization_of_detail_::check_provided_args
|
||||
<std::tuple<ProvidedArgs...>, std::tuple<ActualArgs...>>();
|
||||
}
|
||||
}
|
||||
54
local/pkgs/biu/include/biu/eigen.hpp
Normal file
54
local/pkgs/biu/include/biu/eigen.hpp
Normal file
@@ -0,0 +1,54 @@
|
||||
# pragma once
|
||||
# include <vector>
|
||||
# include <span>
|
||||
# include <Eigen/Dense>
|
||||
# include <biu/concepts.hpp>
|
||||
|
||||
namespace biu
|
||||
{
|
||||
namespace detail_::eigen
|
||||
{
|
||||
// user-specified size of destination container: dynamic, unspecified(use default), or fixed
|
||||
constexpr std::size_t dynamicSize = std::dynamic_extent, unspecifiedSize = std::dynamic_extent - 1;
|
||||
static_assert(std::dynamic_extent == std::numeric_limits<std::size_t>::max());
|
||||
|
||||
// supported types of standard containers
|
||||
template <typename T, typename Scalar> struct SpecializationOfArrayHelper : std::false_type {};
|
||||
template <typename Scalar, std::size_t N>
|
||||
struct SpecializationOfArrayHelper<std::array<Scalar, N>, Scalar> : std::true_type {};
|
||||
template <typename Scalar, std::size_t N>
|
||||
struct SpecializationOfArrayHelper<std::array<Scalar, N>, void> : std::true_type {};
|
||||
template <typename T, typename Scalar = void> concept SpecializationOfArray =
|
||||
SpecializationOfArrayHelper<T, Scalar>::value;
|
||||
template <typename T, typename Scalar> concept StandardContainer =
|
||||
SpecializationOf<T, std::vector, Scalar> || SpecializationOfArray<T, Scalar>;
|
||||
|
||||
// helper operator| to specify the size of the destination container
|
||||
// usage: some_value | toEigen<Row, Col>
|
||||
template <std::size_t Row, std::size_t Col> struct ToEigenHelper {};
|
||||
template <std::size_t Row = unspecifiedSize, std::size_t Col = unspecifiedSize>
|
||||
inline constexpr ToEigenHelper<Row, Col> toEigen;
|
||||
// convert 1D standard container to Eigen::Vector
|
||||
// if no size is specified, convert std::vector to dynamic-size Eigen::Vector,
|
||||
// std::array to fixed-size Eigen::Vector;
|
||||
// if size is std::dynamic_extent, always convert to dynamic-size Eigen::Vector
|
||||
// if size is specified as a number, convert to fixed-size Eigen::Vector if specified size equals the size of the
|
||||
// input, otherwise throw an error
|
||||
template <template <int N> typename Callback, std::size_t ToSize> auto deduce_eigen_size(auto&& container);
|
||||
template <Arithmetic T, StandardContainer<T> From, std::size_t ToSize> auto operator|
|
||||
(const From&, const ToEigenHelper<ToSize, unspecifiedSize>&);
|
||||
// convert 2D standard container to Eigen::Matrix
|
||||
// the same rules as above apply
|
||||
// besides, all rows must have the same size, otherwise throw an error
|
||||
template
|
||||
<
|
||||
Arithmetic T, StandardContainer<T> FromPerRow, StandardContainer<FromPerRow> From,
|
||||
std::size_t ToRow, std::size_t ToCol
|
||||
>
|
||||
auto operator|(const From&, const ToEigenHelper<ToRow, ToCol>&);
|
||||
|
||||
// TODO: implement fromEigen
|
||||
}
|
||||
|
||||
inline namespace eigen { using detail_::eigen::toEigen; using detail_::eigen::operator|; }
|
||||
}
|
||||
29
local/pkgs/biu/include/biu/eigen.tpp
Normal file
29
local/pkgs/biu/include/biu/eigen.tpp
Normal file
@@ -0,0 +1,29 @@
|
||||
# pragma once
|
||||
# include <biu/eigen.hpp>
|
||||
// TODO: fix biu::logger
|
||||
// # include <biu/logger.hpp>
|
||||
# include <range/v3/view.hpp>
|
||||
|
||||
namespace biu
|
||||
{
|
||||
namespace detail_::eigen
|
||||
{
|
||||
template <template <int N> typename Callback, std::size_t ToSize> auto deduce_eigen_size(auto&& from)
|
||||
{
|
||||
if constexpr (ToSize == dynamicSize)
|
||||
return Callback<Eigen::Dynamic>()(from.data(), from.size());
|
||||
else if constexpr (ToSize == unspecifiedSize)
|
||||
if constexpr (SpecializationOfArray<decltype(from)>)
|
||||
return Callback<from.size()>()(from.data());
|
||||
else
|
||||
return Callback<Eigen::Dynamic>()(from.data(), from.size());
|
||||
else
|
||||
if (from.size() != ToSize)
|
||||
// TODO: use biu::logger
|
||||
throw std::invalid_argument("biu::toEigen: size mismatch");
|
||||
else
|
||||
return Callback<ToSize>()(from.data());
|
||||
}
|
||||
// TODO: implement 2D case
|
||||
}
|
||||
}
|
||||
71
local/pkgs/biu/include/biu/format.hpp
Normal file
71
local/pkgs/biu/include/biu/format.hpp
Normal file
@@ -0,0 +1,71 @@
|
||||
# pragma once
|
||||
# include <variant>
|
||||
# include <experimental/memory>
|
||||
# include <fmt/ostream.h>
|
||||
# include <biu/string.hpp>
|
||||
# include <biu/concepts.hpp>
|
||||
|
||||
namespace biu
|
||||
{
|
||||
namespace concepts
|
||||
{ template <typename T, typename Char = char> concept Formattable = fmt::is_formattable<T, Char>::value; }
|
||||
using concepts::Formattable;
|
||||
|
||||
namespace detail_
|
||||
{
|
||||
template <typename Char, Char... c> struct FormatLiteralHelper : protected BasicStaticString<Char, c...>
|
||||
{template <typename... Param> std::basic_string<Char> operator()(Param&&... param) const;};
|
||||
}
|
||||
inline namespace literals
|
||||
{ template <typename Char, Char... c> consteval detail_::FormatLiteralHelper<Char, c...> operator""_f(); }
|
||||
|
||||
namespace detail_
|
||||
{
|
||||
template <typename T> concept OptionalWrap
|
||||
= SpecializationOf<T, std::optional> || SpecializationOf<T, std::shared_ptr>
|
||||
|| SpecializationOf<T, std::weak_ptr> || SpecializationOf<T, std::unique_ptr>
|
||||
|| SpecializationOf<T, std::experimental::observer_ptr>;
|
||||
template <typename Wrap> struct UnderlyingTypeOfOptionalWrap;
|
||||
template <typename Wrap> requires requires() {typename Wrap::value_type;}
|
||||
struct UnderlyingTypeOfOptionalWrap<Wrap>
|
||||
{using Type = std::remove_cvref_t<typename Wrap::value_type>;};
|
||||
template <typename Wrap> requires requires() {typename Wrap::element_type;}
|
||||
struct UnderlyingTypeOfOptionalWrap<Wrap>
|
||||
{using Type = std::remove_cvref_t<typename Wrap::element_type>;};
|
||||
template <typename T> struct FormatterReuseProxy
|
||||
{
|
||||
constexpr auto parse(fmt::format_parse_context& ctx)
|
||||
-> std::invoke_result_t<decltype(&fmt::format_parse_context::begin), fmt::format_parse_context>;
|
||||
};
|
||||
template <typename T>
|
||||
requires (!SpecializationOf<T, std::weak_ptr> && std::default_initializable<fmt::formatter<T>>)
|
||||
struct FormatterReuseProxy<T> : fmt::formatter<T> {};
|
||||
}
|
||||
inline namespace stream_operators
|
||||
{
|
||||
template <typename Char, typename... Ts> requires (sizeof...(Ts) > 0) std::basic_ostream<Char>& operator<<
|
||||
(std::basic_ostream<Char>& os, const std::variant<Ts...>& value);
|
||||
}
|
||||
}
|
||||
|
||||
namespace fmt
|
||||
{
|
||||
template <typename Char, biu::detail_::OptionalWrap Wrap> struct formatter<Wrap, Char>
|
||||
: biu::detail_::FormatterReuseProxy<typename biu::detail_::UnderlyingTypeOfOptionalWrap<Wrap>::Type>
|
||||
{
|
||||
template <typename FormatContext> auto format(const Wrap& wrap, FormatContext& ctx)
|
||||
-> std::invoke_result_t<decltype(&FormatContext::out), FormatContext>;
|
||||
};
|
||||
|
||||
template <typename Char, biu::Enumerable T> struct formatter<T, Char>
|
||||
{
|
||||
bool full = false;
|
||||
constexpr auto parse(fmt::format_parse_context& ctx)
|
||||
-> std::invoke_result_t<decltype(&fmt::format_parse_context::begin), fmt::format_parse_context>;
|
||||
template <typename FormatContext> auto format(const T& value, FormatContext& ctx)
|
||||
-> std::invoke_result_t<decltype(&FormatContext::out), FormatContext>;
|
||||
};
|
||||
|
||||
template <typename Char, typename... Ts> struct formatter<std::variant<Ts...>, Char>
|
||||
: basic_ostream_formatter<Char> {};
|
||||
}
|
||||
92
local/pkgs/biu/include/biu/format.tpp
Normal file
92
local/pkgs/biu/include/biu/format.tpp
Normal file
@@ -0,0 +1,92 @@
|
||||
# pragma once
|
||||
# include <nameof.hpp>
|
||||
# include <biu/format.hpp>
|
||||
# include <fmt/core.h>
|
||||
|
||||
namespace biu
|
||||
{
|
||||
template <typename Char, Char... c> template <typename... Param>
|
||||
std::basic_string<Char> detail_::FormatLiteralHelper<Char, c...>::operator() (Param&&... param) const
|
||||
{ return fmt::format(BasicStaticString<Char, c...>::StringView, std::forward<Param>(param)...); }
|
||||
template <typename Char, Char... c> consteval
|
||||
detail_::FormatLiteralHelper<Char, c...> literals::operator""_f()
|
||||
{ return {}; }
|
||||
|
||||
template <typename T> constexpr
|
||||
auto detail_::FormatterReuseProxy<T>::parse(fmt::format_parse_context& ctx)
|
||||
-> std::invoke_result_t<decltype(&fmt::format_parse_context::begin), fmt::format_parse_context>
|
||||
{
|
||||
if (ctx.begin() != ctx.end() && *ctx.begin() != '}')
|
||||
throw fmt::format_error
|
||||
(
|
||||
"{} do not support to be format, so the wrapper should not have any format syntax."_f
|
||||
(nameof::nameof_full_type<T>())
|
||||
);
|
||||
return ctx.begin();
|
||||
}
|
||||
|
||||
template <typename Char, typename... Ts> requires (sizeof...(Ts) > 0) std::basic_ostream<Char>&
|
||||
stream_operators::operator<<(std::basic_ostream<Char>& os, const std::variant<Ts...>& value)
|
||||
{
|
||||
using namespace biu::literals;
|
||||
auto try_print = [&]<typename T>
|
||||
{
|
||||
if (holds_alternative<T>(value))
|
||||
{
|
||||
if constexpr (biu::Formattable<T, Char>) os << "({}: {})"_f(nameof::nameof_full_type<T>(), get<T>(value));
|
||||
else os << "({}: {})"_f(nameof::nameof_full_type<T>(), "non-null unformattable value");
|
||||
}
|
||||
};
|
||||
(try_print.template operator()<Ts>(), ...);
|
||||
return os;
|
||||
}
|
||||
}
|
||||
|
||||
namespace fmt
|
||||
{
|
||||
template <typename Char, biu::detail_::OptionalWrap Wrap> template <typename FormatContext>
|
||||
auto formatter<Wrap, Char>::format(const Wrap& wrap, FormatContext& ctx)
|
||||
-> std::invoke_result_t<decltype(&FormatContext::out), FormatContext>
|
||||
{
|
||||
using value_t = biu::detail_::UnderlyingTypeOfOptionalWrap<Wrap>::Type;
|
||||
auto format_value_type = [&, this](const value_t& value)
|
||||
{
|
||||
if constexpr (!biu::Formattable<value_t, Char>) return fmt::format_to(ctx.out(), "non-null unformattable value");
|
||||
else if constexpr (std::default_initializable<formatter<value_t>>)
|
||||
biu::detail_::FormatterReuseProxy<value_t>::format(value, ctx);
|
||||
else fmt::format_to(ctx.out(), "{}", value);
|
||||
};
|
||||
fmt::format_to(ctx.out(), "(");
|
||||
if constexpr (biu::SpecializationOf<Wrap, std::optional>)
|
||||
{ if (wrap) format_value_type(*wrap); else fmt::format_to(ctx.out(), "null"); }
|
||||
else if constexpr (biu::SpecializationOf<Wrap, std::weak_ptr>)
|
||||
{
|
||||
if (auto shared = wrap.lock())
|
||||
{ fmt::format_to(ctx.out(), "{} ", ptr(shared.get())); format_value_type(*shared); }
|
||||
else fmt::format_to(ctx.out(), "null");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (wrap) { fmt::format_to(ctx.out(), "{} ", ptr(wrap.get())); format_value_type(*wrap); }
|
||||
else fmt::format_to(ctx.out(), "null");
|
||||
}
|
||||
return fmt::format_to(ctx.out(), ")");
|
||||
}
|
||||
|
||||
template <typename Char, biu::Enumerable T> constexpr auto formatter<T, Char>::parse(format_parse_context& ctx)
|
||||
-> std::invoke_result_t<decltype(&format_parse_context::begin), format_parse_context>
|
||||
{
|
||||
auto it = ctx.begin();
|
||||
if (it != ctx.end() && *it == 'f') { full = true; it++; }
|
||||
if (it != ctx.end() && *it != '}') throw format_error{"syntax error."};
|
||||
return it;
|
||||
}
|
||||
|
||||
template <typename Char, biu::Enumerable T> template <typename FormatContext>
|
||||
auto formatter<T, Char>::format(const T& value, FormatContext& ctx)
|
||||
-> std::invoke_result_t<decltype(&FormatContext::out), FormatContext>
|
||||
{
|
||||
if (full) return fmt::format_to(ctx.out(), "{}::{}", nameof::nameof_type<T>(), nameof::nameof_enum(value));
|
||||
else return fmt::format_to(ctx.out(), "{}", nameof::nameof_enum(value));
|
||||
}
|
||||
}
|
||||
103
local/pkgs/biu/include/biu/logger.hpp
Normal file
103
local/pkgs/biu/include/biu/logger.hpp
Normal file
@@ -0,0 +1,103 @@
|
||||
# pragma once
|
||||
# include <map>
|
||||
# include <boost/stacktrace.hpp>
|
||||
# include <biu/atomic/nolog.hpp>
|
||||
|
||||
namespace biu
|
||||
{
|
||||
class Logger
|
||||
{
|
||||
// All the member function corresponding to stacktrace should be inlined
|
||||
// All the public function (including public function of member class) should be thread safe.
|
||||
|
||||
public: Logger() = delete;
|
||||
|
||||
// Setup output stream and log level in a thread-safe way
|
||||
public: enum class Level
|
||||
{
|
||||
None,
|
||||
Error,
|
||||
Access,
|
||||
Info,
|
||||
Debug
|
||||
};
|
||||
protected: struct LoggerConfigType_
|
||||
{
|
||||
std::experimental::observer_ptr<std::ostream> Stream;
|
||||
std::shared_ptr<std::ostream> StreamStorage;
|
||||
Logger::Level Level;
|
||||
};
|
||||
protected: static Atomic<std::optional<LoggerConfigType_>, false> LoggerConfig_;
|
||||
public: static void init(std::experimental::observer_ptr<std::ostream> stream, Level level);
|
||||
public: static void init(std::shared_ptr<std::ostream> stream, Level level);
|
||||
|
||||
// Send a telegram message if token and chat id are set, all the functions are thread-safe
|
||||
protected: static Atomic<std::optional<std::pair<std::string, std::string>>, false> TelegramConfig_;
|
||||
public: static void telegram_init(const std::string& token, const std::string& chat_id);
|
||||
public: static void telegram_notify(const std::string& message);
|
||||
public: static void telegram_notify_async(const std::string& message);
|
||||
|
||||
// Monitor the lifetime of an object
|
||||
// usage: struct my_class : protected Logger::ObjectMonitor<my_class> {}
|
||||
public: template <typename T> class ObjectMonitor
|
||||
{
|
||||
protected: const std::chrono::time_point<std::chrono::steady_clock> CreateTime_;
|
||||
|
||||
// call log<Debug>("create {type} at {address}.");
|
||||
protected: [[gnu::always_inline]] ObjectMonitor();
|
||||
|
||||
// call log<Debug>("destroy {type} at {address} after {duration} ms.");
|
||||
protected: [[gnu::always_inline]] virtual ~ObjectMonitor();
|
||||
};
|
||||
template <typename T> friend class ObjectMonitor;
|
||||
|
||||
// List of objects that is being monitored by ObjectMonitor, {address, type}
|
||||
protected: static Atomic<std::multimap<const void*, std::string_view>, false> Objects_;
|
||||
|
||||
public: template <typename FinalException> class Exception : public std::exception
|
||||
{
|
||||
protected: const std::string Message_;
|
||||
protected: const boost::stacktrace::stacktrace Stacktrace_;
|
||||
|
||||
public: explicit Exception(const std::string& message);
|
||||
public: const char* what() const noexcept final {return Message_.c_str();}
|
||||
};
|
||||
|
||||
// Monitor the start and end of a function, as well as corresponding thread.
|
||||
// This object should be construct at the beginning of the function, and should never be passed to another
|
||||
// function or thread.
|
||||
public: class Guard
|
||||
{
|
||||
protected: thread_local static unsigned Indent_;
|
||||
protected: const std::chrono::time_point<std::chrono::steady_clock> StartTime_;
|
||||
|
||||
// if sizeof...(Param) > 0, call log<Debug>("begin function with {arguments}.");
|
||||
// else call log<Debug>("begin function.");
|
||||
public: template <typename... Param> [[gnu::always_inline]] explicit Guard(Param&&... param);
|
||||
|
||||
// call log<Debug>("end function after {duration} ms.")
|
||||
public: [[gnu::always_inline]] virtual ~Guard();
|
||||
|
||||
// call log<Debug>("reached after {duration} ms.")
|
||||
public: [[gnu::always_inline]] void operator()() const;
|
||||
|
||||
// call log<Debug>("return {return} after {duration} ms.")
|
||||
public: template <typename T> [[gnu::always_inline]] T rtn(T&& value) const;
|
||||
|
||||
// print the following message if LoggerConfig_ is set and the level is higher than the level of the
|
||||
// LoggerConfig_
|
||||
// [ {time} {thread} {indent} {filename}:{line} {function_name} ] {message}
|
||||
public: template <Level L> [[gnu::always_inline]] void log(const std::string& message) const;
|
||||
|
||||
public: template <typename FinalException> [[gnu::always_inline]] void print_exception
|
||||
(
|
||||
const std::string& type, const std::string& message, const boost::stacktrace::stacktrace& stacktrace,
|
||||
CalledBy<Exception<FinalException>>
|
||||
) const;
|
||||
};
|
||||
friend class Guard;
|
||||
|
||||
// list of threads which is being monitored by Guard and number of Guard created in this thread so far
|
||||
protected: static Atomic<std::map<std::size_t, std::size_t>, false> Threads_;
|
||||
};
|
||||
}
|
||||
143
local/pkgs/biu/include/biu/logger.tpp
Normal file
143
local/pkgs/biu/include/biu/logger.tpp
Normal file
@@ -0,0 +1,143 @@
|
||||
# pragma once
|
||||
# define BOOST_STACKTRACE_USE_BACKTRACE
|
||||
# include <fmt/chrono.h>
|
||||
# include <biu/logger.hpp>
|
||||
# include <biu/common.hpp>
|
||||
# include <biu/format.hpp>
|
||||
|
||||
namespace biu
|
||||
{
|
||||
template <typename T> Logger::ObjectMonitor<T>::ObjectMonitor()
|
||||
: CreateTime_{std::chrono::steady_clock::now()}
|
||||
{
|
||||
Guard guard;
|
||||
guard.log<Level::Debug>("create {} at {}."_f(nameof::nameof_full_type<T>(), fmt::ptr(this)));
|
||||
auto&& lock = Objects_.lock();
|
||||
lock->emplace(this, nameof::nameof_full_type<T>());
|
||||
}
|
||||
template <typename T> Logger::ObjectMonitor<T>::~ObjectMonitor()
|
||||
{
|
||||
Guard guard;
|
||||
guard.log<Level::Debug>("destroy {} at {} after {} ms."_f
|
||||
(
|
||||
nameof::nameof_full_type<T>(), fmt::ptr(this),
|
||||
std::chrono::duration_cast<std::chrono::milliseconds>
|
||||
(std::chrono::steady_clock::now() - CreateTime_).count()
|
||||
));
|
||||
auto&& lock = Objects_.lock();
|
||||
auto range = lock->equal_range(this);
|
||||
for (auto it = range.first; it != range.second; it++)
|
||||
if (it->second == nameof::nameof_full_type<T>())
|
||||
{
|
||||
lock->erase(it);
|
||||
return;
|
||||
}
|
||||
guard.log<Level::Error>
|
||||
("{} {} not found in Logger::Objects."_f(fmt::ptr(this), nameof::nameof_full_type<T>()));
|
||||
}
|
||||
|
||||
template <typename FinalException> Logger::Exception<FinalException>::Exception(const std::string& message)
|
||||
{
|
||||
Logger::Guard log{message};
|
||||
log.print_exception(nameof::nameof_full_type<FinalException>(), message, Stacktrace_);
|
||||
}
|
||||
|
||||
template <typename... Param> inline Logger::Guard::Guard(Param&&... param)
|
||||
: StartTime_{std::chrono::steady_clock::now()}
|
||||
{
|
||||
Indent_++;
|
||||
auto&& lock = Threads_.lock();
|
||||
auto thread_id = std::hash<std::thread::id>{}(std::this_thread::get_id());
|
||||
if (lock->contains(thread_id))
|
||||
lock.value()[thread_id]++;
|
||||
else
|
||||
lock->emplace(thread_id, 1);
|
||||
if constexpr (sizeof...(Param) > 0)
|
||||
{
|
||||
std::stringstream ss;
|
||||
std::vector<std::string> params = {"{}"_f(std::forward<Param>(param))...};
|
||||
ss << "begin function with {";
|
||||
for (auto& param : params)
|
||||
ss << param << ", ";
|
||||
ss.seekp(-2, ss.cur);
|
||||
ss << "}.";
|
||||
log<Level::Debug>(ss.str());
|
||||
}
|
||||
else
|
||||
log<Level::Debug>("begin function.");
|
||||
}
|
||||
inline Logger::Guard::~Guard()
|
||||
{
|
||||
log<Level::Debug>("end function after {} ms."_f(std::chrono::duration_cast<std::chrono::milliseconds>
|
||||
(std::chrono::steady_clock::now() - StartTime_).count()));
|
||||
Indent_--;
|
||||
auto&& lock = Threads_.lock();
|
||||
auto thread_id = std::hash<std::thread::id>{}(std::this_thread::get_id());
|
||||
if (lock->contains(thread_id))
|
||||
{
|
||||
lock.value()[thread_id]--;
|
||||
if (lock.value()[thread_id] == 0)
|
||||
lock->erase(thread_id);
|
||||
}
|
||||
else [[unlikely]]
|
||||
log<Level::Debug>("{:08x} not found in Logger::Threads."_f
|
||||
(std::hash<std::thread::id>{}(std::this_thread::get_id()) % std::numeric_limits<std::uint64_t>::max()));
|
||||
}
|
||||
inline void Logger::Guard::operator()() const
|
||||
{
|
||||
log<Level::Debug>("reached after {} ms."_f
|
||||
(
|
||||
std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now() - StartTime_).count()
|
||||
));
|
||||
}
|
||||
template <typename T> inline T Logger::Guard::rtn(T&& value) const
|
||||
{
|
||||
log<Level::Debug>("return {} after {} ms."_f
|
||||
(
|
||||
std::forward<T>(value),
|
||||
std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::steady_clock::now() - StartTime_).count()
|
||||
));
|
||||
return std::forward<T>(value);
|
||||
}
|
||||
template <Logger::Level L> inline void Logger::Guard::log(const std::string& message) const
|
||||
{
|
||||
if (auto&& lock = LoggerConfig_.lock(); *lock && lock.value()->Level >= L)
|
||||
{
|
||||
static_assert(std::same_as<std::size_t, std::uint64_t>);
|
||||
auto time = std::chrono::system_clock::now();
|
||||
boost::stacktrace::stacktrace stack;
|
||||
*lock.value()->Stream << "[ {:%Y-%m-%d %H:%M:%S}:{:03} {:08x} {:04} {}:{} {} ] {}\n"_f
|
||||
(
|
||||
time,
|
||||
std::chrono::time_point_cast<std::chrono::milliseconds>(time).time_since_epoch().count() % 1000,
|
||||
std::hash<std::thread::id>{}(std::this_thread::get_id())
|
||||
% std::numeric_limits<std::uint64_t>::max(),
|
||||
Indent_,
|
||||
stack[0].source_file().empty() ? "??"s : stack[0].source_file(),
|
||||
stack[0].source_line() == 0 ? "??"s : "{}"_f(stack[0].source_line()),
|
||||
stack[0].name(),
|
||||
message
|
||||
) << std::flush;
|
||||
}
|
||||
}
|
||||
template <typename FinalException> inline void Logger::Guard::print_exception
|
||||
(
|
||||
const std::string& type, const std::string& message, const boost::stacktrace::stacktrace& stacktrace,
|
||||
CalledBy<Exception<FinalException>>
|
||||
) const
|
||||
{
|
||||
log<Level::Error>("{}: {}"_f(type, message));
|
||||
if (auto&& lock = LoggerConfig_.lock(); *lock && lock.value()->Level >= Logger::Level::Error)
|
||||
{
|
||||
static_assert(std::same_as<std::size_t, std::uint64_t>);
|
||||
for (auto frame : stacktrace)
|
||||
*lock.value()->Stream << "\tfrom {}:{} {}\n"_f
|
||||
(
|
||||
frame.source_file().empty() ? "??"s : frame.source_file(),
|
||||
frame.source_line() == 0 ? "??"s : "{}"_f(frame.source_line()),
|
||||
frame.name()
|
||||
);
|
||||
*lock.value()->Stream << std::flush;
|
||||
}
|
||||
}
|
||||
}
|
||||
18
local/pkgs/biu/include/biu/smartref.hpp
Normal file
18
local/pkgs/biu/include/biu/smartref.hpp
Normal file
@@ -0,0 +1,18 @@
|
||||
# pragma once
|
||||
# include <memory>
|
||||
# include <type_traits>
|
||||
|
||||
namespace biu
|
||||
{
|
||||
// store a reference to an lvalue, or a value (instead of a reference) copy or moved from an rvalue
|
||||
template <typename T> class SmartRef
|
||||
{
|
||||
protected: std::unique_ptr<T> Ptr_;
|
||||
protected: T& Ref_;
|
||||
|
||||
public: SmartRef(T& val);
|
||||
public: template <typename... Us> requires (std::is_constructible_v<T, Us...>) SmartRef(Us&&... val);
|
||||
public: T& operator*();
|
||||
public: T* operator->();
|
||||
};
|
||||
}
|
||||
13
local/pkgs/biu/include/biu/smartref.tpp
Normal file
13
local/pkgs/biu/include/biu/smartref.tpp
Normal file
@@ -0,0 +1,13 @@
|
||||
# pragma once
|
||||
# include <utility>
|
||||
# include <biu/smartref.hpp>
|
||||
|
||||
namespace biu
|
||||
{
|
||||
template <typename T> inline SmartRef<T>::SmartRef(T& val) : Ref_(val) {}
|
||||
template <typename T> template <typename... Us> requires (std::is_constructible_v<T, Us...>)
|
||||
inline SmartRef<T>::SmartRef(Us&&... val)
|
||||
: Ptr_(std::make_unique<T>(std::forward<Us>(val)...)), Ref_(*Ptr_) {}
|
||||
template <typename T> inline T& SmartRef<T>::operator*() {return Ref_;}
|
||||
template <typename T> inline T* SmartRef<T>::operator->() {return &Ref_;}
|
||||
}
|
||||
117
local/pkgs/biu/include/biu/string.hpp
Normal file
117
local/pkgs/biu/include/biu/string.hpp
Normal file
@@ -0,0 +1,117 @@
|
||||
# pragma once
|
||||
# include <regex>
|
||||
# include <array>
|
||||
# include <string>
|
||||
# include <string_view>
|
||||
# include <iostream>
|
||||
# include <biu/concepts.hpp>
|
||||
|
||||
namespace biu
|
||||
{
|
||||
namespace string
|
||||
{
|
||||
// Store a string in a static member of a class; or, use a class to represent a string.
|
||||
template <DecayedType Char, Char... c> struct BasicStaticString
|
||||
{
|
||||
static constexpr std::array<Char, sizeof...(c)> Array{c...};
|
||||
static constexpr std::basic_string_view<Char> StringView{Array.data(), sizeof...(c)};
|
||||
};
|
||||
template <char... c> using StaticString = BasicStaticString<char, c...>;
|
||||
|
||||
// Store a string in a fixed-size array
|
||||
template <DecayedType Char, std::size_t N> struct BasicFixedString
|
||||
{
|
||||
Char Data[N];
|
||||
constexpr static const std::size_t Size = N - 1;
|
||||
constexpr BasicFixedString(const Char (&str)[N]);
|
||||
};
|
||||
template <std::size_t N> using FixedString = BasicFixedString<char, N>;
|
||||
|
||||
// Store a string with at most N characters
|
||||
template <DecayedType Char, std::size_t N> struct BasicVariableString
|
||||
{
|
||||
Char Data[N];
|
||||
std::size_t Size;
|
||||
constexpr static const std::size_t MaxSize = N - 1;
|
||||
template <std::size_t M> requires (M<=N) constexpr BasicVariableString(const Char (&str)[M]);
|
||||
};
|
||||
template <std::size_t N> using VariableString = BasicVariableString<char, N>;
|
||||
}
|
||||
using string::BasicStaticString, string::StaticString, string::BasicFixedString, string::FixedString,
|
||||
string::BasicVariableString, string::VariableString;
|
||||
|
||||
inline namespace stream_operators
|
||||
{
|
||||
template <typename Char, Char... c>
|
||||
std::basic_ostream<Char>& operator<<(std::basic_ostream<Char>& os, BasicStaticString<Char, c...>);
|
||||
template <typename Char, std::size_t N> std::basic_ostream<Char>& operator<<
|
||||
(std::basic_ostream<Char>& os, const BasicFixedString<Char, N>& str);
|
||||
template <typename Char, std::size_t N> std::basic_ostream<Char>& operator<<
|
||||
(std::basic_ostream<Char>& os, const BasicVariableString<Char, N>& str);
|
||||
}
|
||||
inline namespace literals
|
||||
{
|
||||
template <typename Char, Char... c> consteval BasicStaticString<Char, c...> operator""_ss();
|
||||
template <BasicFixedString FS> constexpr decltype(FS) operator""_fs();
|
||||
}
|
||||
namespace concepts
|
||||
{
|
||||
namespace detail_
|
||||
{
|
||||
template <typename C, typename T> struct SpecializationOfBasicStaticStringHelper : std::false_type {};
|
||||
template <typename C, C... c>
|
||||
struct SpecializationOfBasicStaticStringHelper<C, BasicStaticString<C, c...>> : std::true_type {};
|
||||
template <typename C, C... c>
|
||||
struct SpecializationOfBasicStaticStringHelper<void, BasicStaticString<C, c...>> : std::true_type {};
|
||||
template <typename T, typename C> concept SpecializationOfBasicStaticString
|
||||
= SpecializationOfBasicStaticStringHelper<std::decay_t<C>, std::decay_t<T>>::value;
|
||||
}
|
||||
template <typename T, typename C = void> concept SpecializationOfBasicStaticString
|
||||
= detail_::SpecializationOfBasicStaticString<T, C>
|
||||
&& detail_::SpecializationOfBasicStaticString<T, void>;
|
||||
template <typename T> concept SpecializationOfStaticString = SpecializationOfBasicStaticString<T, char>;
|
||||
|
||||
namespace detail_
|
||||
{
|
||||
template <typename C, typename T> struct SpecializationOfBasicFixedStringHelper : std::false_type {};
|
||||
template <typename C, std::size_t N>
|
||||
struct SpecializationOfBasicFixedStringHelper<C, BasicFixedString<C, N>> : std::true_type {};
|
||||
template <typename C, std::size_t N>
|
||||
struct SpecializationOfBasicFixedStringHelper<void, BasicFixedString<C, N>> : std::true_type {};
|
||||
template <typename T, typename C> concept SpecializationOfBasicFixedString
|
||||
= SpecializationOfBasicFixedStringHelper<std::decay_t<C>, std::decay_t<T>>::value;
|
||||
}
|
||||
template <typename T, typename C = void> concept SpecializationOfBasicFixedString
|
||||
= detail_::SpecializationOfBasicFixedString<T, C>
|
||||
&& detail_::SpecializationOfBasicFixedString<T, void>;
|
||||
template <typename T> concept SpecializationOfFixedString = SpecializationOfBasicFixedString<T, char>;
|
||||
|
||||
namespace detail_
|
||||
{
|
||||
template <typename C, typename T> struct SpecializationOfBasicVariableStringHelper : std::false_type {};
|
||||
template <typename C, std::size_t N>
|
||||
struct SpecializationOfBasicVariableStringHelper<C, BasicVariableString<C, N>> : std::true_type {};
|
||||
template <typename C, std::size_t N>
|
||||
struct SpecializationOfBasicVariableStringHelper<void, BasicVariableString<C, N>> : std::true_type {};
|
||||
template <typename T, typename C> concept SpecializationOfBasicVariableString
|
||||
= SpecializationOfBasicVariableStringHelper<std::decay_t<C>, std::decay_t<T>>::value;
|
||||
}
|
||||
template <typename T, typename C = void> concept SpecializationOfBasicVariableString
|
||||
= detail_::SpecializationOfBasicVariableString<T, C>
|
||||
&& detail_::SpecializationOfBasicVariableString<T, void>;
|
||||
template <typename T> concept SpecializationOfVariableString = SpecializationOfBasicVariableString<T, char>;
|
||||
}
|
||||
using concepts::SpecializationOfBasicStaticString, concepts::SpecializationOfStaticString,
|
||||
concepts::SpecializationOfBasicFixedString, concepts::SpecializationOfFixedString,
|
||||
concepts::SpecializationOfBasicVariableString, concepts::SpecializationOfVariableString;
|
||||
}
|
||||
// namespace string
|
||||
// {
|
||||
// // Find specific content in a string. Return unmatched content before the match and the match result every
|
||||
// // time. If match reached the end, the second returned value will be std::sregex_iterator().
|
||||
// concurrencpp::generator<std::pair<std::string_view, std::sregex_iterator>> find
|
||||
// (SmartRef<const std::string> data, SmartRef<const std::regex> regex);
|
||||
// // Use a regex to find all matches and replace them with a callback function
|
||||
// std::string replace
|
||||
// (const std::string& data, const std::regex& regex, std::function<std::string(const std::smatch&)> function);
|
||||
// }
|
||||
39
local/pkgs/biu/include/biu/string.tpp
Normal file
39
local/pkgs/biu/include/biu/string.tpp
Normal file
@@ -0,0 +1,39 @@
|
||||
# pragma once
|
||||
# include <biu/string.hpp>
|
||||
|
||||
namespace biu
|
||||
{
|
||||
namespace string
|
||||
{
|
||||
template <DecayedType Char, std::size_t N> constexpr
|
||||
BasicFixedString<Char, N>::BasicFixedString(const Char (&str)[N])
|
||||
{ std::copy_n(str, N, Data); }
|
||||
template <DecayedType Char, std::size_t N> template <std::size_t M> requires (M<=N) constexpr
|
||||
BasicVariableString<Char, N>::BasicVariableString(const Char (&str)[M]) : Size(M)
|
||||
{
|
||||
std::fill(Data, Data + N, '\0');
|
||||
std::copy_n(str, M, Data);
|
||||
}
|
||||
}
|
||||
|
||||
inline namespace stream_operators
|
||||
{
|
||||
template <typename Char, Char... c> inline std::basic_ostream<Char>& operator<<
|
||||
(std::basic_ostream<Char>& os, BasicStaticString<Char, c...>)
|
||||
{ return os << std::basic_string_view{c...}; }
|
||||
template <typename Char, std::size_t N> std::basic_ostream<Char>& operator<<
|
||||
(std::basic_ostream<Char>& os, const BasicFixedString<Char, N>& str)
|
||||
{ return os << std::basic_string_view<Char>(str.Data, str.Size); }
|
||||
template <typename Char, std::size_t N> std::basic_ostream<Char>& operator<<
|
||||
(std::basic_ostream<Char>& os, const BasicVariableString<Char, N>& str)
|
||||
{ return os << std::basic_string_view<Char>(str.Data, str.Size); }
|
||||
}
|
||||
|
||||
inline namespace literals
|
||||
{
|
||||
template <typename Char, Char... c> consteval BasicStaticString<Char, c...> operator""_ss()
|
||||
{ return {}; }
|
||||
template <BasicFixedString FS> constexpr decltype(FS) operator""_fs()
|
||||
{ return FS; }
|
||||
}
|
||||
}
|
||||
71
local/pkgs/biu/src/common.cpp
Normal file
71
local/pkgs/biu/src/common.cpp
Normal file
@@ -0,0 +1,71 @@
|
||||
# include <future>
|
||||
# include <utility>
|
||||
# include <cstdio>
|
||||
# include <biu.hpp>
|
||||
# include <boost/process.hpp>
|
||||
# include <boost/preprocessor.hpp>
|
||||
|
||||
namespace biu
|
||||
{
|
||||
std::regex literals::operator""_re(const char* str, std::size_t len) { return std::regex{str, len}; }
|
||||
namespace common
|
||||
{
|
||||
void block_forever() { std::promise<void>().get_future().wait(); std::unreachable(); }
|
||||
bool is_interactive() { return isatty(fileno(stdin)); }
|
||||
std::optional<std::string> env(std::string name)
|
||||
{
|
||||
if (auto value = std::getenv(name.c_str()); !value) return std::nullopt;
|
||||
else return value;
|
||||
}
|
||||
|
||||
template <detail_::ExecMode Mode> detail_::ExecResult<Mode>::operator bool() const { return ExitCode == 0; }
|
||||
|
||||
template <detail_::ExecMode Mode> detail_::ExecResult<Mode> exec(detail_::ExecInput<Mode> input)
|
||||
{
|
||||
namespace bp = boost::process;
|
||||
|
||||
// decide input/output format, prepare environment, seach actual program
|
||||
bp::ipstream stdout_stream, stderr_stream;
|
||||
bp::opstream input_stream;
|
||||
auto&& stdin_format = [&]
|
||||
{ if constexpr (Mode.DirectStdin) return bp::std_in < stdin; else return bp::std_in < input_stream; }();
|
||||
auto&& stdout_format = [&]
|
||||
{ if constexpr (Mode.DirectStdout) return bp::std_out > stdout; else return bp::std_out > stdout_stream; }();
|
||||
auto&& stderr_format = [&]
|
||||
{ if constexpr (Mode.DirectStderr) return bp::std_err > stderr; else return bp::std_err > stderr_stream; }();
|
||||
auto&& actual_program = [&]
|
||||
{
|
||||
if constexpr (Mode.SearchPath) return bp::search_path(input.Program);
|
||||
else return input.Program.string();
|
||||
}();
|
||||
bp::environment env = boost::this_process::environment();
|
||||
for (const auto& [key, value] : input.ExtraEnv) env[key] = value;
|
||||
|
||||
// start
|
||||
auto process = bp::child
|
||||
(actual_program, bp::args(input.Args), stdout_format, stderr_format, stdin_format, env);
|
||||
if constexpr (!Mode.DirectStdin) { input_stream << input.Stdin; input_stream.pipe().close(); }
|
||||
|
||||
// wait for exit
|
||||
if (input.Timeout) { if (!process.wait_for(*input.Timeout)) process.terminate(); }
|
||||
else process.wait();
|
||||
|
||||
// collect output
|
||||
detail_::ExecResult<Mode> result;
|
||||
result.ExitCode = process.exit_code();
|
||||
if constexpr (!Mode.DirectStdout) result.Stdout = {std::istreambuf_iterator<char>{stdout_stream.rdbuf()}, {}};
|
||||
if constexpr (!Mode.DirectStderr) result.Stderr = {std::istreambuf_iterator<char>{stderr_stream.rdbuf()}, {}};
|
||||
return result;
|
||||
}
|
||||
|
||||
# define BIU_EXEC_PRED(r, i) BOOST_PP_NOT_EQUAL(i, 16)
|
||||
# define BIU_EXEC_OP(r, i) BOOST_PP_INC(i)
|
||||
# define BIU_EXEC_MACRO(r, i) \
|
||||
namespace detail_ \
|
||||
{ constexpr ExecMode ExecMode##i {(i & 1) != 0, (i & 2) != 0, (i & 4) != 0, (i & 8) != 0}; } \
|
||||
template detail_::ExecResult<detail_::ExecMode##i>::operator bool() const; \
|
||||
template detail_::ExecResult<detail_::ExecMode##i> \
|
||||
exec<detail_::ExecMode##i>(detail_::ExecInput<detail_::ExecMode##i>);
|
||||
BOOST_PP_FOR(0, BIU_EXEC_PRED, BIU_EXEC_OP, BIU_EXEC_MACRO)
|
||||
}
|
||||
}
|
||||
36
local/pkgs/biu/src/logger.cpp
Normal file
36
local/pkgs/biu/src/logger.cpp
Normal file
@@ -0,0 +1,36 @@
|
||||
# include <tgbot/tgbot.h>
|
||||
# include <biu.hpp>
|
||||
|
||||
namespace biu
|
||||
{
|
||||
Atomic<std::optional<typename Logger::LoggerConfigType_>, false> Logger::LoggerConfig_;
|
||||
void Logger::init(std::experimental::observer_ptr<std::ostream> stream, Level level)
|
||||
{
|
||||
auto&& lock = LoggerConfig_.lock();
|
||||
lock->emplace(stream, nullptr, level);
|
||||
}
|
||||
void Logger::init(std::shared_ptr<std::ostream> stream, Level level)
|
||||
{
|
||||
auto&& lock = LoggerConfig_.lock();
|
||||
lock->emplace(std::experimental::make_observer(stream.get()), stream, level);
|
||||
}
|
||||
|
||||
Atomic<std::optional<std::pair<std::string, std::string>>, false> Logger::TelegramConfig_;
|
||||
void Logger::telegram_init(const std::string& token, const std::string& chat_id)
|
||||
{TelegramConfig_ = std::make_pair(token, chat_id);}
|
||||
void Logger::telegram_notify(const std::string& message)
|
||||
{
|
||||
if (auto&& lock = TelegramConfig_.lock(); *lock)
|
||||
{
|
||||
TgBot::Bot bot{lock.value()->first};
|
||||
bot.getApi().sendMessage(lock.value()->first, message);
|
||||
}
|
||||
}
|
||||
void Logger::telegram_notify_async(const std::string& message)
|
||||
{std::thread{Logger::telegram_notify, message}.detach();}
|
||||
|
||||
Atomic<std::multimap<const void*, std::string_view>, false> Logger::Objects_;
|
||||
|
||||
thread_local unsigned Logger::Guard::Indent_ = 0;
|
||||
Atomic<std::map<std::size_t, std::size_t>, false> Logger::Threads_;
|
||||
}
|
||||
53
local/pkgs/biu/src/string.cpp
Normal file
53
local/pkgs/biu/src/string.cpp
Normal file
@@ -0,0 +1,53 @@
|
||||
# include <fmt/chrono.h>
|
||||
# include <biu.hpp>
|
||||
|
||||
namespace biu
|
||||
{
|
||||
concurrencpp::generator<std::pair<std::string_view, std::sregex_iterator>> string::find
|
||||
(SmartRef<const std::string> data, SmartRef<const std::regex> regex)
|
||||
{
|
||||
Logger::Guard log;
|
||||
std::string::const_iterator unmatched_prefix_begin = data->cbegin(), unmatched_prefix_end;
|
||||
std::sregex_iterator regit;
|
||||
while (true)
|
||||
{
|
||||
if (regit == std::sregex_iterator{})
|
||||
regit = std::sregex_iterator{data->begin(), data->end(), *regex};
|
||||
else
|
||||
regit++;
|
||||
if (regit == std::sregex_iterator{})
|
||||
{
|
||||
unmatched_prefix_end = data->cend();
|
||||
log.log<Logger::Level::Debug>("distance: {}"_f(std::distance(unmatched_prefix_begin, unmatched_prefix_end)));
|
||||
}
|
||||
else
|
||||
unmatched_prefix_end = (*regit)[0].first;
|
||||
co_yield
|
||||
{
|
||||
std::string_view
|
||||
{
|
||||
&*unmatched_prefix_begin,
|
||||
static_cast<std::size_t>(std::distance(unmatched_prefix_begin, unmatched_prefix_end))
|
||||
},
|
||||
regit
|
||||
};
|
||||
if (regit == std::sregex_iterator{})
|
||||
break;
|
||||
unmatched_prefix_begin = (*regit)[0].second;
|
||||
}
|
||||
}
|
||||
|
||||
std::string string::replace
|
||||
(const std::string& data, const std::regex& regex, std::function<std::string(const std::smatch&)> function)
|
||||
{
|
||||
Logger::Guard log;
|
||||
std::string result;
|
||||
for (auto matched : find(data, regex))
|
||||
{
|
||||
result.append(matched.first);
|
||||
if (matched.second != std::sregex_iterator{})
|
||||
result.append(function(*matched.second));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
9
local/pkgs/biu/test/process.cpp
Normal file
9
local/pkgs/biu/test/process.cpp
Normal file
@@ -0,0 +1,9 @@
|
||||
# include <biu.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
using namespace biu::literals;
|
||||
auto result = biu::exec<{.SearchPath = true}>({.Program = "sleep", .Args = {"10"}, .Timeout = 3s});
|
||||
std::cout << "{}\n"_f(result.ExitCode);
|
||||
assert(!result);
|
||||
}
|
||||
17
local/pkgs/biu/test/serialize.cpp
Normal file
17
local/pkgs/biu/test/serialize.cpp
Normal file
@@ -0,0 +1,17 @@
|
||||
# include <biu.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
struct student
|
||||
{
|
||||
int number;
|
||||
std::string name;
|
||||
std::vector<std::optional<double>> grade;
|
||||
using serialize = zpp::bits::members<3>;
|
||||
auto operator<=>(const student&) const = default;
|
||||
};
|
||||
student bob{ 123, "Bob", { 3.5, std::nullopt, 4.0 } };
|
||||
auto serialized_bob = biu::serialize(bob);
|
||||
auto bob2 = biu::deserialize<student>(serialized_bob);
|
||||
assert(bob == bob2);
|
||||
}
|
||||
11
local/pkgs/blurred-wallpaper.nix
Normal file
11
local/pkgs/blurred-wallpaper.nix
Normal file
@@ -0,0 +1,11 @@
|
||||
{ stdenv, src }: stdenv.mkDerivation
|
||||
{
|
||||
name = "blurred-wallpaper";
|
||||
inherit src;
|
||||
phases = [ "installPhase" ];
|
||||
installPhase =
|
||||
''
|
||||
mkdir -p $out/share/plasma/wallpapers
|
||||
cp -r $src/a2n.blur $out/share/plasma/wallpapers
|
||||
'';
|
||||
}
|
||||
26
local/pkgs/chn-bsub/CMakeLists.txt
Normal file
26
local/pkgs/chn-bsub/CMakeLists.txt
Normal file
@@ -0,0 +1,26 @@
|
||||
cmake_minimum_required(VERSION 3.14)
|
||||
project(chn-bsub VERSION 0.0.0 LANGUAGES CXX)
|
||||
enable_testing()
|
||||
include(GNUInstallDirs)
|
||||
|
||||
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
||||
message("Setting build type to 'Release' as none was specified.")
|
||||
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE)
|
||||
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
|
||||
endif()
|
||||
|
||||
find_package(ftxui REQUIRED)
|
||||
find_package(Boost REQUIRED COMPONENTS filesystem iostreams)
|
||||
find_package(range-v3 REQUIRED)
|
||||
find_package(biu REQUIRED)
|
||||
|
||||
add_executable(chn-bsub src/main.cpp)
|
||||
target_compile_features(chn-bsub PUBLIC cxx_std_23)
|
||||
target_link_libraries(chn-bsub PRIVATE fmt::fmt ftxui::screen ftxui::dom ftxui::component Boost::filesystem
|
||||
range-v3::range-v3 biu::biu)
|
||||
|
||||
install(TARGETS chn-bsub RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
|
||||
get_property(ImportedTargets DIRECTORY "${CMAKE_SOURCE_DIR}" PROPERTY IMPORTED_TARGETS)
|
||||
message("Imported targets: ${ImportedTargets}")
|
||||
message("List of compile features: ${CMAKE_CXX_COMPILE_FEATURES}")
|
||||
12
local/pkgs/chn-bsub/default.nix
Normal file
12
local/pkgs/chn-bsub/default.nix
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
stdenv, lib, sbatchConfig ? null, substituteAll, runCommand,
|
||||
cmake, pkg-config, ftxui, biu
|
||||
}:
|
||||
stdenv.mkDerivation
|
||||
{
|
||||
name = "chn-bsub";
|
||||
src = ./.;
|
||||
buildInputs = [ ftxui biu ];
|
||||
nativeBuildInputs = [ cmake pkg-config ];
|
||||
postInstall = "ln -s chn-bsub $out/bin/chn_bsub";
|
||||
}
|
||||
202
local/pkgs/chn-bsub/src/main.cpp
Normal file
202
local/pkgs/chn-bsub/src/main.cpp
Normal file
@@ -0,0 +1,202 @@
|
||||
# include <map>
|
||||
# include <filesystem>
|
||||
# include <ftxui/component/component.hpp>
|
||||
# include <ftxui/component/component_options.hpp>
|
||||
# include <ftxui/component/screen_interactive.hpp>
|
||||
# include <boost/process.hpp>
|
||||
# include <boost/algorithm/string.hpp>
|
||||
# include <biu.hpp>
|
||||
|
||||
using namespace biu::literals;
|
||||
|
||||
int main()
|
||||
{
|
||||
// 需要绑定到界面上的变量
|
||||
struct
|
||||
{
|
||||
std::array<int, 3> vasp_version_selected = {0, 0, 0};
|
||||
std::vector<std::string> vasp_version_entries_level1 = {"640", "631"};
|
||||
std::map<std::string, std::vector<std::string>> vasp_version_entries_level2 =
|
||||
{
|
||||
{"640", {"(default)", "fixc", "optcell_vtst_wannier90", "shmem", "vtst"}},
|
||||
{"631", {"shmem"}}
|
||||
};
|
||||
std::vector<std::string> vasp_version_entries_level3 = {"std", "gam", "ncl"};
|
||||
|
||||
int queue_selected = 0;
|
||||
std::vector<std::string> queue_entries =
|
||||
{
|
||||
"normal_1day", "normal_1week", "normal",
|
||||
"normal_1day_new", "ocean_530_1day", "ocean6226R_1day"
|
||||
};
|
||||
std::map<std::string, std::size_t> max_cores =
|
||||
{
|
||||
{"normal_1day", 28}, {"normal_1week", 28}, {"normal", 20},
|
||||
{"normal_1day_new", 24}, {"ocean_530_1day", 24}, {"ocean6226R_1day", 32}
|
||||
};
|
||||
std::string ncores = "";
|
||||
std::string job_name = []
|
||||
{
|
||||
// /data/gpfs01/jykang/linwei/chn/lammps-SiC
|
||||
std::vector<std::string> paths;
|
||||
boost::split(paths, std::filesystem::current_path().string(),
|
||||
boost::is_any_of("/"));
|
||||
if (paths.size() < 7)
|
||||
return "my-great-job"s;
|
||||
else
|
||||
return paths[5] + "_" + paths.back();
|
||||
}();
|
||||
std::string bsub = "";
|
||||
std::string user_command = "";
|
||||
} state;
|
||||
|
||||
// 为组件增加标题栏
|
||||
auto component_with_title = [](std::string title, ftxui::Component component)
|
||||
{
|
||||
return ftxui::Renderer(component, [title, component]
|
||||
{
|
||||
return ftxui::vbox
|
||||
({
|
||||
ftxui::text(title) | ftxui::bgcolor(ftxui::Color::Blue),
|
||||
component->Render(),
|
||||
ftxui::separator()
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
// 构建界面, 需要至少 25 行 47 列
|
||||
auto screen = ftxui::ScreenInteractive::Fullscreen();
|
||||
auto request_interface = [&state, &screen, &component_with_title]
|
||||
{
|
||||
auto vasp_version_level1 = ftxui::Menu
|
||||
(&state.vasp_version_entries_level1, &state.vasp_version_selected[0])
|
||||
| ftxui::size(ftxui::WIDTH, ftxui::EQUAL, 8);
|
||||
std::vector<ftxui::Component> vasp_version_level2_children;
|
||||
for (auto& i : state.vasp_version_entries_level1)
|
||||
vasp_version_level2_children.push_back(ftxui::Menu
|
||||
(
|
||||
&state.vasp_version_entries_level2[i],
|
||||
&state.vasp_version_selected[1]
|
||||
));
|
||||
auto vasp_version_level2 = ftxui::Container::Tab
|
||||
(
|
||||
vasp_version_level2_children,
|
||||
&state.vasp_version_selected[0]
|
||||
) | ftxui::size(ftxui::WIDTH, ftxui::EQUAL, 27);
|
||||
auto vasp_version_level3 = ftxui::Menu
|
||||
(&state.vasp_version_entries_level3, &state.vasp_version_selected[2])
|
||||
| ftxui::size(ftxui::WIDTH, ftxui::EQUAL, 8);
|
||||
auto vasp_version = component_with_title("Select vasp version:",
|
||||
ftxui::Container::Horizontal
|
||||
({vasp_version_level1, vasp_version_level2, vasp_version_level3})
|
||||
| ftxui::size(ftxui::HEIGHT, ftxui::EQUAL, 5));
|
||||
auto queue = component_with_title("Select queue:",
|
||||
ftxui::Menu(&state.queue_entries, &state.queue_selected)
|
||||
| ftxui::size(ftxui::HEIGHT, ftxui::EQUAL, 6));
|
||||
auto ncores = component_with_title("Input cores you want to use:",
|
||||
ftxui::Input(&state.ncores, "(leave blank to use all cores)"))
|
||||
| ftxui::size(ftxui::HEIGHT, ftxui::EQUAL, 3);
|
||||
auto job_name = component_with_title("Job name:",
|
||||
ftxui::Input(&state.job_name, ""))
|
||||
| ftxui::size(ftxui::HEIGHT, ftxui::EQUAL, 3);
|
||||
auto continue_button = ftxui::Button("Continue",
|
||||
[&]{state.user_command = "continue"; screen.ExitLoopClosure()();});
|
||||
auto quit_button = ftxui::Button("Quit",
|
||||
[&]{state.user_command = "quit"; screen.ExitLoopClosure()();});
|
||||
return ftxui::Container::Vertical
|
||||
({
|
||||
vasp_version, queue, ncores, job_name,
|
||||
ftxui::Container::Horizontal({continue_button, quit_button})
|
||||
}) | ftxui::borderHeavy
|
||||
| ftxui::size(ftxui::WIDTH, ftxui::EQUAL, 47)
|
||||
| ftxui::size(ftxui::HEIGHT, ftxui::EQUAL, 24);
|
||||
}();
|
||||
auto confirm_interface = [&state, &screen, &component_with_title]
|
||||
{
|
||||
ftxui::InputOption input_option;
|
||||
input_option.multiline = true;
|
||||
return ftxui::Container::Vertical
|
||||
({
|
||||
component_with_title
|
||||
(
|
||||
"Double check & modify submit command:",
|
||||
ftxui::Input(&state.bsub, "", input_option)
|
||||
)
|
||||
| ftxui::size(ftxui::HEIGHT, ftxui::EQUAL, 7),
|
||||
ftxui::Container::Horizontal
|
||||
({
|
||||
ftxui::Button("Submit",
|
||||
[&]{state.user_command = "submit"; screen.ExitLoopClosure()();}),
|
||||
ftxui::Button("Quit",
|
||||
[&]{state.user_command = "quit"; screen.ExitLoopClosure()();}),
|
||||
ftxui::Button("Back",
|
||||
[&]{state.user_command = "back"; screen.ExitLoopClosure()();})
|
||||
}),
|
||||
ftxui::Renderer([]{return ftxui::vbox
|
||||
({
|
||||
ftxui::separator(),
|
||||
ftxui::text("Source code:"),
|
||||
ftxui::text("https://github.com/CHN-beta/chn_bsub.git"),
|
||||
ftxui::text("Star & PR are welcome!"),
|
||||
});})
|
||||
}) | ftxui::borderHeavy
|
||||
| ftxui::size(ftxui::WIDTH, ftxui::EQUAL, 47)
|
||||
| ftxui::size(ftxui::HEIGHT, ftxui::EQUAL, 14);
|
||||
}();
|
||||
|
||||
// 实际投递任务
|
||||
auto submit = [](std::string bsub)
|
||||
{
|
||||
// replace \n with space
|
||||
boost::replace_all(bsub, "\n", " ");
|
||||
auto process = boost::process::child
|
||||
(
|
||||
boost::process::search_path("sh"), "-c", bsub,
|
||||
boost::process::std_in.close(),
|
||||
boost::process::std_out > stdout,
|
||||
boost::process::std_err > stderr
|
||||
);
|
||||
process.wait();
|
||||
};
|
||||
|
||||
// 进入事件循环
|
||||
while (true)
|
||||
{
|
||||
screen.Loop(request_interface);
|
||||
if (state.user_command == "quit")
|
||||
return EXIT_FAILURE;
|
||||
else if (state.user_command != "continue")
|
||||
throw std::runtime_error("user_command is not recognized");
|
||||
state.bsub = fmt::format
|
||||
(
|
||||
"bsub -J '{}'\n-q {}\n-n {}\n-R 'span[hosts=1]'\n-o 'output.txt'\nchn_vasp.sh {}",
|
||||
state.job_name,
|
||||
state.queue_entries[state.queue_selected],
|
||||
state.ncores.empty() ? state.max_cores[state.queue_entries[state.queue_selected]] :
|
||||
std::stoi(state.ncores),
|
||||
[&]
|
||||
{
|
||||
auto version_level1 = state.vasp_version_entries_level1[state.vasp_version_selected[0]];
|
||||
auto version_level2 = state.vasp_version_entries_level2[version_level1]
|
||||
[state.vasp_version_selected[1]];
|
||||
auto version_level3 = state.vasp_version_entries_level3[state.vasp_version_selected[2]];
|
||||
return fmt::format
|
||||
(
|
||||
"{}{}_{}",
|
||||
version_level1,
|
||||
version_level2 == "(default)" ? ""s : "_" + version_level2,
|
||||
version_level3
|
||||
);
|
||||
}()
|
||||
);
|
||||
screen.Loop(confirm_interface);
|
||||
if (state.user_command == "quit")
|
||||
return EXIT_FAILURE;
|
||||
else if (state.user_command == "back")
|
||||
continue;
|
||||
else if (state.user_command != "submit")
|
||||
throw std::runtime_error("user_command is not recognized");
|
||||
submit(state.bsub);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
{ lib, stdenv, fetchFromGitHub, fetchurl, cmake }: stdenv.mkDerivation rec
|
||||
{
|
||||
pname = "chromiumos-touch-keyboard";
|
||||
version = "1.4.1";
|
||||
src = fetchFromGitHub
|
||||
{
|
||||
owner = "CHN-beta";
|
||||
repo = "chromiumos_touch_keyboard";
|
||||
rev = "32b72240ccac751a1b983152f65aa5b19503ffcf";
|
||||
sha256 = "eFesDSBS2VzTOVfepgXYGynWvkrCSdCV9C/gcG/Ocbg=";
|
||||
};
|
||||
cmakeFlags = [ "-DCMAKE_CXX_FLAGS=-Wno-error=stringop-truncation" ];
|
||||
nativeBuildInputs = [ cmake ];
|
||||
postInstall =
|
||||
''
|
||||
cp $out/etc/touch_keyboard/layouts/YB1-X9x-pc105.csv $out/etc/touch_keyboard/layout.csv
|
||||
'';
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
{ stdenvNoCC, texlive, fetchFromGitHub }: stdenvNoCC.mkDerivation (finalAttrs: rec
|
||||
{
|
||||
pname = "citation-style-language";
|
||||
version = "0.4.5";
|
||||
passthru = {
|
||||
pkgs = [ finalAttrs.finalPackage ];
|
||||
tlDeps = with texlive; [ latex ];
|
||||
tlType = "run";
|
||||
};
|
||||
|
||||
src = fetchFromGitHub
|
||||
{
|
||||
owner = "zepinglee";
|
||||
repo = "citeproc-lua";
|
||||
rev = "v${version}";
|
||||
sha256 = "XH+GH+t/10hr4bfaod8F9JPxmBnAQlDmpSvQNDQsslM=";
|
||||
fetchSubmodules = true;
|
||||
};
|
||||
|
||||
nativeBuildInputs = [ texlive.combined.scheme-full ];
|
||||
dontConfigure = true;
|
||||
dontBuild = true;
|
||||
installPhase =
|
||||
''
|
||||
runHook preInstall
|
||||
export TEXMFHOME=$out
|
||||
l3build install
|
||||
runHook postInstall
|
||||
'';
|
||||
})
|
||||
@@ -1,13 +1,6 @@
|
||||
{ stdenv, fetchFromGitHub, cmake }: stdenv.mkDerivation rec
|
||||
{ stdenv, cmake, src }: stdenv.mkDerivation
|
||||
{
|
||||
pname = "concurrencpp";
|
||||
version = "0.1.7";
|
||||
src = fetchFromGitHub
|
||||
{
|
||||
owner = "David-Haim";
|
||||
repo = "concurrencpp";
|
||||
rev = "v.${version}";
|
||||
sha256 = "4qT29YVjKEWcMrI5R5Ps8aD4grAAgz5VOxANjpp1oTo=";
|
||||
};
|
||||
name = "concurrencpp";
|
||||
inherit src;
|
||||
nativeBuildInputs = [ cmake ];
|
||||
}
|
||||
|
||||
@@ -1,13 +1,7 @@
|
||||
{ stdenv, fetchFromGitHub, cmake }: stdenv.mkDerivation
|
||||
{ stdenv, cmake, src }: stdenv.mkDerivation
|
||||
{
|
||||
name = "cppcoro";
|
||||
src = fetchFromGitHub
|
||||
{
|
||||
owner = "Garcia6l20";
|
||||
repo = "cppcoro";
|
||||
rev = "e1d53e620b0eee828915ada179cd7ca8e66ca855";
|
||||
sha256 = "luBkf1x5kqXaVbQM01yWRmA5QvrQNZkFVCjRctJdnXc=";
|
||||
};
|
||||
inherit src;
|
||||
nativeBuildInputs = [ cmake ];
|
||||
patches = [ ./cppcoro-include-utility.patch ];
|
||||
}
|
||||
|
||||
@@ -1,18 +1,7 @@
|
||||
{ stdenv, fetchFromGitHub }: stdenv.mkDerivation
|
||||
{ stdenv, src, cmake, pkg-config }: stdenv.mkDerivation
|
||||
{
|
||||
name = "date";
|
||||
src = fetchFromGitHub
|
||||
{
|
||||
owner = "HowardHinnant";
|
||||
repo = "date";
|
||||
rev = "cc4685a21e4a4fdae707ad1233c61bbaff241f93";
|
||||
sha256 = "KilhBEeLMvHtS76Gu0UhzE8lhS1+sCwQ1UL4pswKXTs=";
|
||||
};
|
||||
phases = [ "installPhase" ];
|
||||
installPhase =
|
||||
''
|
||||
runHook preInstall
|
||||
mkdir -p $out
|
||||
cp -r $src/{include,src} $out
|
||||
'';
|
||||
inherit src;
|
||||
nativeBuildInputs = [ cmake pkg-config ];
|
||||
cmakeFlags = [ "-DBUILD_TZ_LIB=ON" "-DUSE_SYSTEM_TZ_DB=ON" ];
|
||||
}
|
||||
|
||||
@@ -1,48 +1,87 @@
|
||||
{ lib, pkgs }: with pkgs; rec
|
||||
inputs: rec
|
||||
{
|
||||
typora = callPackage ./typora {};
|
||||
vesta = callPackage ./vesta {};
|
||||
oneapi = callPackage ./oneapi {};
|
||||
rsshub = callPackage ./rsshub {};
|
||||
misskey = callPackage ./misskey {};
|
||||
mk-meili-mgn = callPackage ./mk-meili-mgn {};
|
||||
# vasp = callPackage ./vasp
|
||||
# {
|
||||
# stdenv = pkgs.lmix-pkgs.intel21Stdenv;
|
||||
# intel-mpi = pkgs.lmix-pkgs.intel-oneapi-mpi_2021_9_0;
|
||||
# ifort = pkgs.lmix-pkgs.intel-oneapi-ifort_2021_9_0;
|
||||
# };
|
||||
vasp = callPackage ./vasp
|
||||
typora = inputs.pkgs.callPackage ./typora {};
|
||||
vesta = inputs.pkgs.callPackage ./vesta {};
|
||||
rsshub = inputs.pkgs.callPackage ./rsshub.nix
|
||||
{
|
||||
openmp = llvmPackages.openmp;
|
||||
openmpi = pkgs.openmpi.override { cudaSupport = false; };
|
||||
inherit mkPnpmPackage;
|
||||
src = inputs.topInputs.rsshub;
|
||||
nodejs = nodejs-with-pnpm9.override { nodejs = inputs.pkgs.nodejs_22; };
|
||||
};
|
||||
vaspkit = callPackage ./vaspkit { attrsToList = (import ../lib lib).attrsToList; };
|
||||
v_sim = callPackage ./v_sim {};
|
||||
concurrencpp = callPackage ./concurrencpp { stdenv = gcc13Stdenv; };
|
||||
eigengdb = python3Packages.callPackage ./eigengdb {};
|
||||
nodesoup = callPackage ./nodesoup {};
|
||||
matplotplusplus = callPackage ./matplotplusplus { inherit nodesoup glad; };
|
||||
zpp-bits = callPackage ./zpp-bits {};
|
||||
eigen = callPackage ./eigen {};
|
||||
nameof = callPackage ./nameof {};
|
||||
pslist = callPackage ./pslist {};
|
||||
glad = callPackage ./glad {};
|
||||
chromiumos-touch-keyboard = callPackage ./chromiumos-touch-keyboard {};
|
||||
yoga-support = callPackage ./yoga-support {};
|
||||
tgbot-cpp = callPackage ./tgbot-cpp {};
|
||||
biu = callPackage ./biu { inherit concurrencpp tgbot-cpp nameof; stdenv = gcc13Stdenv; };
|
||||
citation-style-language = callPackage ./citation-style-language {};
|
||||
mirism = callPackage ./mirism
|
||||
misskey = inputs.pkgs.callPackage ./misskey.nix
|
||||
{ inherit mkPnpmPackage; src = inputs.topInputs.misskey; nodejs = nodejs-with-pnpm9; };
|
||||
mk-meili-mgn = inputs.pkgs.callPackage ./mk-meili-mgn {};
|
||||
vaspkit = inputs.pkgs.callPackage ./vaspkit { inherit (inputs.localLib) attrsToList; };
|
||||
v-sim = inputs.pkgs.callPackage ./v-sim { src = inputs.topInputs.v-sim; };
|
||||
concurrencpp = inputs.pkgs.callPackage ./concurrencpp { src = inputs.topInputs.concurrencpp; };
|
||||
eigengdb = inputs.pkgs.python3Packages.callPackage ./eigengdb {};
|
||||
nodesoup = inputs.pkgs.callPackage ./nodesoup { src = inputs.topInputs.nodesoup; };
|
||||
matplotplusplus = inputs.pkgs.callPackage ./matplotplusplus
|
||||
{ inherit nodesoup glad; src = inputs.topInputs.matplotplusplus; };
|
||||
zpp-bits = inputs.pkgs.callPackage ./zpp-bits { src = inputs.topInputs.zpp-bits; };
|
||||
eigen = inputs.pkgs.callPackage ./eigen { src = inputs.topInputs.eigen; };
|
||||
nameof = inputs.pkgs.callPackage ./nameof { src = inputs.topInputs.nameof; };
|
||||
pslist = inputs.pkgs.callPackage ./pslist {};
|
||||
glad = inputs.pkgs.callPackage ./glad {};
|
||||
chromiumos-touch-keyboard = inputs.pkgs.callPackage ./chromiumos-touch-keyboard {};
|
||||
yoga-support = inputs.pkgs.callPackage ./yoga-support {};
|
||||
tgbot-cpp = inputs.pkgs.callPackage ./tgbot-cpp { src = inputs.topInputs.tgbot-cpp; };
|
||||
mirism = inputs.pkgs.callPackage ./mirism
|
||||
{
|
||||
inherit cppcoro nameof tgbot-cpp date;
|
||||
nghttp2 = nghttp2-2305.override { enableAsioLib = true; };
|
||||
nghttp2 = inputs.pkgs.callPackage "${inputs.topInputs."nixpkgs-23.05"}/pkgs/development/libraries/nghttp2"
|
||||
{ enableAsioLib = true; stdenv = inputs.pkgs.gcc12Stdenv; };
|
||||
stdenv = inputs.pkgs.gcc12Stdenv;
|
||||
};
|
||||
cppcoro = callPackage ./cppcoro {};
|
||||
date = callPackage ./date {};
|
||||
esbonio = python3Packages.callPackage ./esbonio {};
|
||||
pix2tex = python3Packages.callPackage ./pix2tex {};
|
||||
pyreadline3 = python3Packages.callPackage ./pyreadline3 {};
|
||||
torchdata = python3Packages.callPackage ./torchdata {};
|
||||
torchtext = python3Packages.callPackage ./torchtext { inherit torchdata; };
|
||||
cppcoro = inputs.pkgs.callPackage ./cppcoro { src = inputs.topInputs.cppcoro; };
|
||||
date = inputs.pkgs.callPackage ./date { src = inputs.topInputs.date; };
|
||||
esbonio = inputs.pkgs.python3Packages.callPackage ./esbonio {};
|
||||
pix2tex = inputs.pkgs.python3Packages.callPackage ./pix2tex {};
|
||||
pyreadline3 = inputs.pkgs.python3Packages.callPackage ./pyreadline3 {};
|
||||
torchdata = inputs.pkgs.python3Packages.callPackage ./torchdata {};
|
||||
torchtext = inputs.pkgs.python3Packages.callPackage ./torchtext { inherit torchdata; };
|
||||
blurred-wallpaper = inputs.pkgs.callPackage ./blurred-wallpaper.nix { src = inputs.topInputs.blurred-wallpaper; };
|
||||
slate = inputs.pkgs.callPackage ./slate { src = inputs.topInputs.slate; };
|
||||
nvhpc = inputs.pkgs.callPackage ./nvhpc {};
|
||||
lmod = inputs.pkgs.callPackage ./lmod { src = inputs.topInputs.lmod; };
|
||||
vasp = rec
|
||||
{
|
||||
src = inputs.pkgs.callPackage ./vasp/source.nix {};
|
||||
gnu = inputs.pkgs.callPackage ./vasp/gnu
|
||||
{
|
||||
inherit (inputs.pkgs.llvmPackages) openmp;
|
||||
inherit src;
|
||||
hdf5 = inputs.pkgs.hdf5.override { mpiSupport = true; fortranSupport = true; cppSupport = false; };
|
||||
};
|
||||
nvidia = inputs.pkgs.callPackage ./vasp/nvidia
|
||||
{ inherit lmod nvhpc vtst src; hdf5 = hdf5-nvhpc; };
|
||||
intel = inputs.pkgs.callPackage ./vasp/intel
|
||||
{ inherit lmod oneapi vtst src; hdf5 = hdf5-oneapi; };
|
||||
hdf5-nvhpc = inputs.pkgs.callPackage ./vasp/hdf5-nvhpc { inherit lmod nvhpc; inherit (inputs.pkgs.hdf5) src; };
|
||||
hdf5-oneapi = inputs.pkgs.callPackage ./vasp/hdf5-oneapi { inherit lmod oneapi; inherit (inputs.pkgs.hdf5) src; };
|
||||
vtst = (inputs.pkgs.callPackage ./vasp/vtst.nix {});
|
||||
vtstscripts = inputs.pkgs.callPackage ./vasp/vtstscripts.nix {};
|
||||
};
|
||||
# TODO: use other people packaged hpc version
|
||||
oneapi = inputs.pkgs.callPackage ./oneapi {};
|
||||
mumax = inputs.pkgs.callPackage ./mumax { src = inputs.topInputs.mumax; };
|
||||
kylin-virtual-keyboard = inputs.pkgs.libsForQt5.callPackage ./kylin-virtual-keyboard
|
||||
{ src = inputs.topInputs.kylin-virtual-keyboard; };
|
||||
biu = inputs.pkgs.callPackage ./biu { inherit nameof zpp-bits; };
|
||||
zxorm = inputs.pkgs.callPackage ./zxorm { src = inputs.topInputs.zxorm; };
|
||||
hpcstat = inputs.pkgs.callPackage ./hpcstat
|
||||
{ inherit sqlite-orm date biu openxlsx; stdenv = inputs.pkgs.gcc14Stdenv; };
|
||||
openxlsx = inputs.pkgs.callPackage ./openxlsx { src = inputs.topInputs.openxlsx; };
|
||||
sqlite-orm = inputs.pkgs.callPackage ./sqlite-orm { src = inputs.topInputs.sqlite-orm; };
|
||||
mkPnpmPackage = inputs.pkgs.callPackage ./mkPnpmPackage.nix {};
|
||||
nodejs-with-pnpm9 = inputs.pkgs.callPackage ./nodejs-with-pnpm9.nix {};
|
||||
sbatch-tui = inputs.pkgs.callPackage ./sbatch-tui { inherit biu; };
|
||||
ufo = inputs.pkgs.callPackage ./ufo
|
||||
{ inherit concurrencpp biu glad matplotplusplus zpp-bits; tbb = inputs.pkgs.tbb_2021_11; };
|
||||
chn-bsub = inputs.pkgs.callPackage ./chn-bsub { inherit biu; };
|
||||
winjob = inputs.pkgs.callPackage ./winjob { inherit sqlite-orm biu; stdenv = inputs.pkgs.gcc14Stdenv; };
|
||||
|
||||
fromYaml = content: builtins.fromJSON (builtins.readFile
|
||||
(inputs.pkgs.runCommand "toJSON" {}
|
||||
"${inputs.pkgs.remarshal}/bin/yaml2json ${builtins.toFile "content.yaml" content} $out"));
|
||||
}
|
||||
|
||||
@@ -1,12 +1,6 @@
|
||||
{ lib, stdenv, fetchFromGitLab, cmake }: stdenv.mkDerivation rec
|
||||
{ lib, stdenv, cmake, src }: stdenv.mkDerivation
|
||||
{
|
||||
name = "eigen";
|
||||
src = fetchFromGitLab
|
||||
{
|
||||
owner = "libeigen";
|
||||
repo = name;
|
||||
rev = "6d829e766ff1b1ab867d93631163cbc63ed5798f";
|
||||
sha256 = "BXUnizcRPrOyiPpoyYJ4VVOjlG49aj80mgzPKmEYPKU=";
|
||||
};
|
||||
inherit src;
|
||||
nativeBuildInputs = [ cmake ];
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
{ lib, fetchPypi, buildPythonPackage }: buildPythonPackage rec
|
||||
{
|
||||
pname = "esbonio";
|
||||
version = "0.16.3";
|
||||
version = "0.16.4";
|
||||
src = fetchPypi
|
||||
{
|
||||
inherit pname version;
|
||||
sha256 = "1ggxdzl95fy0zxpyd1pcylhif1x604wk4wy7sv9322hc84b708zx";
|
||||
sha256 = "1MBNBLCEBD6HtlxEASc4iZaXYyNdih2MIHoxK84jMdI=";
|
||||
};
|
||||
doCheck = false;
|
||||
}
|
||||
|
||||
3
local/pkgs/hpcstat/.clangd
Normal file
3
local/pkgs/hpcstat/.clangd
Normal file
@@ -0,0 +1,3 @@
|
||||
CompileFlags:
|
||||
Add: [ -Wall, -Wextra, -std=c++26 ]
|
||||
Compiler: g++
|
||||
1
local/pkgs/hpcstat/.envrc
Normal file
1
local/pkgs/hpcstat/.envrc
Normal file
@@ -0,0 +1 @@
|
||||
use flake .#hpcstat
|
||||
40
local/pkgs/hpcstat/CMakeLists.txt
Normal file
40
local/pkgs/hpcstat/CMakeLists.txt
Normal file
@@ -0,0 +1,40 @@
|
||||
# cmake_minimum_required(VERSION 3.30)
|
||||
cmake_minimum_required(VERSION 3.29)
|
||||
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(Boost REQUIRED COMPONENTS headers filesystem)
|
||||
find_package(SqliteOrm REQUIRED)
|
||||
find_package(nlohmann_json REQUIRED)
|
||||
find_package(range-v3 REQUIRED)
|
||||
find_package(date REQUIRED)
|
||||
find_package(httplib REQUIRED)
|
||||
find_package(termcolor REQUIRED)
|
||||
find_package(biu REQUIRED)
|
||||
find_package(OpenXLSX REQUIRED)
|
||||
|
||||
add_executable(hpcstat src/main.cpp src/env.cpp src/keys.cpp src/ssh.cpp src/sql.cpp src/lfs.cpp src/common.cpp
|
||||
src/push.cpp src/disk.cpp)
|
||||
# target_compile_features(hpcstat PRIVATE cxx_std_26)
|
||||
target_compile_options(hpcstat PRIVATE "-std=c++26")
|
||||
target_include_directories(hpcstat PRIVATE ${PROJECT_SOURCE_DIR}/include)
|
||||
target_link_libraries(hpcstat PRIVATE Boost::headers Boost::filesystem sqlite_orm::sqlite_orm
|
||||
nlohmann_json::nlohmann_json range-v3::range-v3 date::date date::date-tz httplib::httplib
|
||||
termcolor::termcolor biu::biu OpenXLSX::OpenXLSX)
|
||||
target_compile_definitions(hpcstat PRIVATE HPCSTAT_VERSION="${HPCSTAT_VERSION}")
|
||||
|
||||
install(TARGETS hpcstat RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
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}")
|
||||
20
local/pkgs/hpcstat/default.nix
Normal file
20
local/pkgs/hpcstat/default.nix
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
stdenv, cmake, pkg-config, standalone ? false, version ? null, makeWrapper, lib,
|
||||
sqlite-orm, nlohmann_json, range-v3, openssh, sqlite, date, httplib, openssl, openxlsx, termcolor, duc, biu
|
||||
}: stdenv.mkDerivation
|
||||
{
|
||||
name = "hpcstat";
|
||||
src = ./.;
|
||||
buildInputs =
|
||||
[ sqlite-orm nlohmann_json range-v3 sqlite date httplib termcolor openssl biu openxlsx ];
|
||||
nativeBuildInputs = [ cmake pkg-config makeWrapper ];
|
||||
cmakeFlags = lib.optionals (version != null) [ "-DHPCSTAT_VERSION=${version}" ];
|
||||
postInstall =
|
||||
if standalone then "cp ${openssh}/bin/{ssh-add,ssh-keygen} ${duc}/bin/duc $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 \
|
||||
--set HPCSTAT_DUC_BINDIR ${duc}/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.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user