From 629ce42a0a39e26629e4d2b9abd5c0525b5f90e4 Mon Sep 17 00:00:00 2001 From: Grisha Shipunov Date: Sun, 5 Mar 2023 14:07:31 +0100 Subject: [PATCH] TLMS.nix: yeet (#12) --- flake.lock | 473 +++++++++-------------- flake.nix | 87 +++-- hardware/dell-wyse-3040.nix | 4 +- hardware/disk-module/default.nix | 16 + hardware/disk-module/make-disk-image.nix | 453 ++++++++++++++++++++++ modules/TLMS/base.nix | 18 +- modules/TLMS/binary-cache.nix | 23 ++ modules/TLMS/default.nix | 6 +- modules/TLMS/json.nix | 15 + modules/data-hoarder/map.nix | 9 +- modules/data-hoarder/postgres.nix | 6 +- 11 files changed, 777 insertions(+), 333 deletions(-) create mode 100644 hardware/disk-module/default.nix create mode 100644 hardware/disk-module/make-disk-image.nix create mode 100644 modules/TLMS/binary-cache.nix create mode 100644 modules/TLMS/json.nix diff --git a/flake.lock b/flake.lock index a10c916..15dbca5 100644 --- a/flake.lock +++ b/flake.lock @@ -1,82 +1,21 @@ { "nodes": { - "TLMS": { - "inputs": { - "click": "click", - "data-accumulator": "data-accumulator", - "dvb-api": "dvb-api", - "funnel": "funnel", - "gnuradio-decoder": "gnuradio-decoder", - "naersk": "naersk", - "nixpkgs": [ - "nixpkgs" - ], - "stops": "stops", - "tlms-rs": "tlms-rs", - "utils": "utils", - "wartrammer": "wartrammer", - "windshield": "windshield" - }, - "locked": { - "lastModified": 1677969729, - "narHash": "sha256-BMQtIGCbtdIyn/y4DGlbufxvftBvlthb4oAra2velZk=", - "owner": "tlm-solutions", - "repo": "TLMS.nix", - "rev": "4d57da4411e6c738d83028d54c298794a764cf73", - "type": "github" - }, - "original": { - "owner": "tlm-solutions", - "repo": "TLMS.nix", - "type": "github" - } - }, - "click": { - "inputs": { - "nixpkgs": [ - "TLMS", - "nixpkgs" - ], - "utils": [ - "TLMS", - "utils" - ] - }, - "locked": { - "lastModified": 1670369433, - "narHash": "sha256-8dnqgBTs11RKG1wPxLX9KGlgEA3TO9cv77kai1TjZe4=", - "owner": "tlm-solutions", - "repo": "click", - "rev": "aef03393401e39d38afa5c9f316da150c9d32f42", - "type": "github" - }, - "original": { - "owner": "tlm-solutions", - "repo": "click", - "type": "github" - } - }, "data-accumulator": { "inputs": { "naersk": [ - "TLMS", "naersk" ], "nixpkgs": [ - "TLMS", "nixpkgs" ], - "utils": [ - "TLMS", - "utils" - ] + "utils": "utils" }, "locked": { - "lastModified": 1676052348, - "narHash": "sha256-YlPv6DzSW5afbq6KsyJsU3NSyTT9hLlY1CJ1S+PamzA=", + "lastModified": 1677980571, + "narHash": "sha256-hVZQgRAJKFPmQFEUqq2n74olh2yQTge1+DhrvMk/4MY=", "owner": "tlm-solutions", "repo": "data-accumulator", - "rev": "eed592d1d9c62a580a2ff51676139f3959f87253", + "rev": "693d000b4011c7d90f51893b76afd803706aa6ba", "type": "github" }, "original": { @@ -93,17 +32,17 @@ "nixpkgs": [ "nixpkgs" ], - "tlms-rs": "tlms-rs_2", - "utils": [ - "utils" - ] + "tlms-rs": [ + "tlms-rs" + ], + "utils": "utils_2" }, "locked": { - "lastModified": 1677731625, - "narHash": "sha256-AZDDm7D3LqzXvi0Hx0iAl44Tx9lX7Ou4/ZoZ3/vRg3I=", + "lastModified": 1677986236, + "narHash": "sha256-R5dGTNNVPvh4W+oFzLqE03OfSRziuzFVhT+uZzJ575Q=", "owner": "tlm-solutions", "repo": "datacare", - "rev": "4b82b714fe393b71824b971d87e535043d6fef1e", + "rev": "b0d750553514ab1e56717a6ac8314ef65e46cc6f", "type": "github" }, "original": { @@ -128,65 +67,13 @@ "type": "github" } }, - "dvb-api": { - "inputs": { - "naersk": [ - "TLMS", - "naersk" - ], - "nixpkgs": [ - "TLMS", - "nixpkgs" - ], - "utils": [ - "TLMS", - "utils" - ] - }, - "locked": { - "lastModified": 1674253720, - "narHash": "sha256-RfXj+E52Abw6RZTZS1Qc+uwMaO1YTy+uGv5OzF78PLI=", - "owner": "tlm-solutions", - "repo": "dvb-api", - "rev": "1c8a9fd89a1a5e9c9a0584498976184b45185f4e", - "type": "github" - }, - "original": { - "owner": "tlm-solutions", - "repo": "dvb-api", - "type": "github" - } - }, "fenix": { - "inputs": { - "nixpkgs": [ - "TLMS", - "stops", - "nixpkgs" - ], - "rust-analyzer-src": "rust-analyzer-src" - }, - "locked": { - "lastModified": 1670566996, - "narHash": "sha256-M+KsSE2D8ByDf3HZhnvLRpytg8aXScoWhg+NrdHjeeE=", - "owner": "nix-community", - "repo": "fenix", - "rev": "ab24d0ad17a733624b99f5d6466e71b8c239a001", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "fenix", - "type": "github" - } - }, - "fenix_2": { "inputs": { "nixpkgs": [ "microvm", "nixpkgs" ], - "rust-analyzer-src": "rust-analyzer-src_2" + "rust-analyzer-src": "rust-analyzer-src" }, "locked": { "lastModified": 1677219923, @@ -221,21 +108,17 @@ "inputs": { "json-structs": "json-structs", "nixpkgs": [ - "TLMS", "nixpkgs" ], "tlms-rust": "tlms-rust", - "utils": [ - "TLMS", - "utils" - ] + "utils": "utils_3" }, "locked": { - "lastModified": 1672329711, - "narHash": "sha256-I4Sx4iwrfp0T/Vg+wCSquNuE46Yt+Zd5xmrkV9a3KNM=", + "lastModified": 1678020126, + "narHash": "sha256-lTMEZJ9khdBPgNjbl3z9C32kxk0Cl3yizaOGP7oBeJQ=", "owner": "tlm-solutions", "repo": "funnel", - "rev": "e49f2f4f1b9cdc3c887be0f35f2a45281b1c67c4", + "rev": "b1768749c2b2e2d5c1c8860af4b201e01a24976a", "type": "github" }, "original": { @@ -247,20 +130,16 @@ "gnuradio-decoder": { "inputs": { "nixpkgs": [ - "TLMS", "nixpkgs" ], - "utils": [ - "TLMS", - "utils" - ] + "utils": "utils_4" }, "locked": { - "lastModified": 1665616750, - "narHash": "sha256-LKkr9h805FuJ+wXUatQ+cz7Vt59S9I7gN/1yzwmraZE=", + "lastModified": 1677980088, + "narHash": "sha256-9vHvfDT9ZEGB+TI5LdiWDFrgyLH9OwXZeGCDgG6hZhw=", "owner": "tlm-solutions", "repo": "gnuradio-decoder", - "rev": "f6f42736cc1a1024c5da4cce69d56042499d81d3", + "rev": "6306579f6fc8d126aaadcce19d742b7575f6e5e4", "type": "github" }, "original": { @@ -272,11 +151,11 @@ "json-structs": { "flake": false, "locked": { - "lastModified": 1671005252, - "narHash": "sha256-U7rrOmDxigZFVxRQDj9g7S9WgLbrPeHZ+UKuZz+eGVU=", + "lastModified": 1674126739, + "narHash": "sha256-qvI29h2Cd15cqFApUVVCrPo2S1osn92mRCMx/TOog2s=", "owner": "jorgen", "repo": "json_struct", - "rev": "09a790818c47c9d748c2381d37b94a697a53d2cd", + "rev": "9b719771470536763430703b7f04acc558dafe56", "type": "github" }, "original": { @@ -290,14 +169,14 @@ "nixpkgs": [ "nixpkgs" ], - "utils": "utils_2" + "utils": "utils_5" }, "locked": { - "lastModified": 1677702784, - "narHash": "sha256-6yBjGrZjLIBBO66BUCfKir1HyYZST1D0AGarIbcsNPw=", + "lastModified": 1677977617, + "narHash": "sha256-wwJzYzK7gc0h70uxDMZvz+etcT9WmZ0zXg8s8RHXrZM=", "owner": "tlm-solutions", "repo": "kindergarten", - "rev": "8c271bb63228163eeb3e5c3b48ddb8101c0e67c1", + "rev": "bc315a7adf9390b31bbaba69bdd57b594a3d951f", "type": "github" }, "original": { @@ -308,7 +187,7 @@ }, "microvm": { "inputs": { - "fenix": "fenix_2", + "fenix": "fenix", "flake-utils": "flake-utils", "nixpkgs": [ "nixpkgs" @@ -329,27 +208,6 @@ } }, "naersk": { - "inputs": { - "nixpkgs": [ - "TLMS", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1671096816, - "narHash": "sha256-ezQCsNgmpUHdZANDCILm3RvtO1xH8uujk/+EqNvzIOg=", - "owner": "nix-community", - "repo": "naersk", - "rev": "d998160d6a076cfe8f9741e56aeec7e267e3e114", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "naersk", - "type": "github" - } - }, - "naersk_2": { "inputs": { "nixpkgs": [ "nixpkgs" @@ -387,11 +245,11 @@ }, "nixpkgs-stable": { "locked": { - "lastModified": 1677560965, - "narHash": "sha256-Tqwt5alTtMnbYUPKCYRYZqlfbjprLgDWqjMhXpFMQ6k=", + "lastModified": 1677948530, + "narHash": "sha256-BkQjq8AGHD55RJe4PUnrWRZZ8jS64p/k0bGDck5wKwY=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "40968a3aa489191cf4b7ba85cf2a54d8a75c8daa", + "rev": "d51554151a91cd4543a7620843cc378e3cbc767e", "type": "github" }, "original": { @@ -403,11 +261,11 @@ }, "nixpkgs-unstable": { "locked": { - "lastModified": 1665643254, - "narHash": "sha256-IBVWNJxGCsshwh62eRfR6+ry3bSXmulB3VQRzLQo3hk=", + "lastModified": 1677932085, + "narHash": "sha256-+AB4dYllWig8iO6vAiGGYl0NEgmMgGHpy9gzWJ3322g=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "ba187fbdc5e35322c7dff556ef2c47bddfd6e8d7", + "rev": "3c5319ad3aa51551182ac82ea17ab1c6b0f0df89", "type": "github" }, "original": { @@ -419,37 +277,25 @@ }, "root": { "inputs": { - "TLMS": "TLMS", + "data-accumulator": "data-accumulator", "datacare": "datacare", "documentation-src": "documentation-src", + "funnel": "funnel", + "gnuradio-decoder": "gnuradio-decoder", "kindergarten": "kindergarten", "microvm": "microvm", - "naersk": "naersk_2", + "naersk": "naersk", "nixpkgs": "nixpkgs", "sops-nix": "sops-nix", + "state-api": "state-api", "telegram-decoder": "telegram-decoder", + "tlms-rs": "tlms-rs", "trekkie": "trekkie", - "utils": "utils_3" + "wartrammer": "wartrammer", + "windshield": "windshield" } }, "rust-analyzer-src": { - "flake": false, - "locked": { - "lastModified": 1670426523, - "narHash": "sha256-Zh+pAuj4PmBmISXCz+54yVSwSXZwbn+ZELgM85xVUE0=", - "owner": "rust-lang", - "repo": "rust-analyzer", - "rev": "6e8a54d0f68702cf7981c8299357838eb0f4d5b2", - "type": "github" - }, - "original": { - "owner": "rust-lang", - "ref": "nightly", - "repo": "rust-analyzer", - "type": "github" - } - }, - "rust-analyzer-src_2": { "flake": false, "locked": { "lastModified": 1676976502, @@ -474,11 +320,11 @@ "nixpkgs-stable": "nixpkgs-stable" }, "locked": { - "lastModified": 1677833841, - "narHash": "sha256-yHZFGe7dhBE43FFWKiWc29NuveH+nfyTT6oKyFDEMys=", + "lastModified": 1677987270, + "narHash": "sha256-NRqhY8jbrmP1C6oiVqv1T0T1r560eo4ZpmEdHoQmKj4=", "owner": "Mic92", "repo": "sops-nix", - "rev": "128e9b29ddd88ceb634a28f7dbbfee7b895f005f", + "rev": "7cff56b43952edc5a2c212076d5fc922f764240f", "type": "github" }, "original": { @@ -487,33 +333,27 @@ "type": "github" } }, - "stops": { + "state-api": { "inputs": { - "fenix": "fenix", "naersk": [ - "TLMS", "naersk" ], "nixpkgs": [ - "TLMS", "nixpkgs" ], - "utils": [ - "TLMS", - "utils" - ] + "utils": "utils_6" }, "locked": { - "lastModified": 1670618313, - "narHash": "sha256-kWvB6v3qJbX+UfcR+lTTJBHo7GUA/9BljBufAlVSkrk=", + "lastModified": 1677981726, + "narHash": "sha256-5Xq2XKYA5dEOdqvBvBS5texdsLeE1pCs4qwEeEP7vxY=", "owner": "tlm-solutions", - "repo": "stop-names", - "rev": "b04e91e0f3f74f6f92626a5af513abfdf8b989df", + "repo": "state-api", + "rev": "0503becdb8be66af65288a848d4199b66379a5fc", "type": "github" }, "original": { "owner": "tlm-solutions", - "repo": "stop-names", + "repo": "state-api", "type": "github" } }, @@ -525,16 +365,14 @@ "nixpkgs": [ "nixpkgs" ], - "utils": [ - "utils" - ] + "utils": "utils_7" }, "locked": { - "lastModified": 1677964001, - "narHash": "sha256-Ky2DC5rL/k26XcQa+QdQFdt6yRErVLEUd3123upZ1TA=", + "lastModified": 1677979421, + "narHash": "sha256-D8olZTuDOaZ+y3JluMRFuk29GmUmLM8k0x03WhOj28M=", "owner": "tlm-solutions", "repo": "telegram-decoder", - "rev": "2627366690d02cb51759f366da9d256c41fce254", + "rev": "a68ef7e52492e248038b4ebfa4cde82f43c340a5", "type": "github" }, "original": { @@ -546,58 +384,15 @@ "tlms-rs": { "inputs": { "nixpkgs": [ - "TLMS", "nixpkgs" ] }, "locked": { - "lastModified": 1677272203, - "narHash": "sha256-ad9W085FHeGUIQI7Iv+15EjueUvvTGgkTnZZVDesUwc=", + "lastModified": 1677980059, + "narHash": "sha256-bPTKW80qgJLv14Th5USYM+S3pt7irsfhnJMxZhQp9eo=", "owner": "tlm-solutions", "repo": "tlms.rs", - "rev": "7bbc276be2e46d83d8cac63f546ff6539c4be5b4", - "type": "github" - }, - "original": { - "owner": "tlm-solutions", - "repo": "tlms.rs", - "type": "github" - } - }, - "tlms-rs_2": { - "inputs": { - "nixpkgs": [ - "datacare", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1675891590, - "narHash": "sha256-68b+CrLyhYhOltprZsXEkCACH58RRiW1Bk4eZqEZHFA=", - "owner": "tlm-solutions", - "repo": "tlms.rs", - "rev": "9a9d288131302bef137141de23d871a6f18ec8b7", - "type": "github" - }, - "original": { - "owner": "tlm-solutions", - "repo": "tlms.rs", - "type": "github" - } - }, - "tlms-rs_3": { - "inputs": { - "nixpkgs": [ - "trekkie", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1675891590, - "narHash": "sha256-68b+CrLyhYhOltprZsXEkCACH58RRiW1Bk4eZqEZHFA=", - "owner": "tlm-solutions", - "repo": "tlms.rs", - "rev": "9a9d288131302bef137141de23d871a6f18ec8b7", + "rev": "99be81df55035ff8645a38983911bd862a8aa281", "type": "github" }, "original": { @@ -609,11 +404,11 @@ "tlms-rust": { "flake": false, "locked": { - "lastModified": 1672266054, - "narHash": "sha256-yyqWR5PP2RemsJA+QFtdKHGOsE84snDS80Joilbm3Hk=", + "lastModified": 1677980059, + "narHash": "sha256-bPTKW80qgJLv14Th5USYM+S3pt7irsfhnJMxZhQp9eo=", "owner": "tlm-solutions", "repo": "tlms.rs", - "rev": "a179ab4ca1cd7349eafd624533648eb5169fd4d5", + "rev": "99be81df55035ff8645a38983911bd862a8aa281", "type": "github" }, "original": { @@ -630,17 +425,17 @@ "nixpkgs": [ "nixpkgs" ], - "tlms-rs": "tlms-rs_3", - "utils": [ - "utils" - ] + "tlms-rs": [ + "tlms-rs" + ], + "utils": "utils_8" }, "locked": { - "lastModified": 1677951625, - "narHash": "sha256-cUSnBfc5lxXLIyh2v8vN+abVBJG3Ay9fH5oH85lKY+E=", + "lastModified": 1677985143, + "narHash": "sha256-VbshNjoXCBQm12Nr4k4Q7f5hr7KONiHAtNFfjgo/vTw=", "owner": "tlm-solutions", "repo": "trekkie", - "rev": "823d821fc5a84c2eb272fdae3c76eea6e25d0297", + "rev": "5b0f4ea3c7886fd1a986b3f3abb2bf4bfeb4c306", "type": "github" }, "original": { @@ -650,6 +445,21 @@ } }, "utils": { + "locked": { + "lastModified": 1667395993, + "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "utils_10": { "locked": { "lastModified": 1676283394, "narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=", @@ -694,28 +504,113 @@ "type": "github" } }, + "utils_4": { + "locked": { + "lastModified": 1659877975, + "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "utils_5": { + "locked": { + "lastModified": 1676283394, + "narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "utils_6": { + "locked": { + "lastModified": 1676283394, + "narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "utils_7": { + "locked": { + "lastModified": 1676283394, + "narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "utils_8": { + "locked": { + "lastModified": 1676283394, + "narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "utils_9": { + "locked": { + "lastModified": 1676283394, + "narHash": "sha256-XX2f9c3iySLCw54rJ/CZs+ZK6IQy7GXNY4nSOyu2QG4=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "3db36a8b464d0c4532ba1c7dda728f4576d6d073", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "wartrammer": { "inputs": { "naersk": [ - "TLMS", "naersk" ], "nixpkgs": [ - "TLMS", "nixpkgs" ], "nixpkgs-unstable": "nixpkgs-unstable", - "utils": [ - "TLMS", - "utils" - ] + "utils": "utils_9" }, "locked": { - "lastModified": 1665780943, - "narHash": "sha256-4tnTVfz25GzY/1vCAITMeWkMqrzVRJUmpSMfqxcU0C4=", + "lastModified": 1677985694, + "narHash": "sha256-IdkWaziDvHvmyjtJpc39tdF4HJUCrLFFzjqPp1XUnrQ=", "owner": "tlm-solutions", "repo": "wartrammer-40k", - "rev": "896550451f1e3b33c7fa8a08922efa3b6b73e4ad", + "rev": "18b51aeb168883ac36a38598c30a94544d23e14d", "type": "github" }, "original": { @@ -727,20 +622,16 @@ "windshield": { "inputs": { "nixpkgs": [ - "TLMS", "nixpkgs" ], - "utils": [ - "TLMS", - "utils" - ] + "utils": "utils_10" }, "locked": { - "lastModified": 1677278629, - "narHash": "sha256-Zd+B3jcCjKQipUv427JmUWH4QjhNNyzj5JEr0p1czNQ=", + "lastModified": 1677756402, + "narHash": "sha256-3c5O7NJSbKEF3miHGQXQcxQaOkk58JlSOoWCQRfznZ0=", "owner": "tlm-solutions", "repo": "windshield", - "rev": "3c00e1cebdcc4ce05931ec3c8f5673c901684bfb", + "rev": "f68eef7e9fa69d95db2bbb612d61db9798ecc678", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 51f71cb..8c172a5 100644 --- a/flake.nix +++ b/flake.nix @@ -9,15 +9,6 @@ inputs.nixpkgs.follows = "nixpkgs"; }; - utils = { - url = "github:numtide/flake-utils"; - }; - - TLMS = { - url = "github:tlm-solutions/TLMS.nix"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - microvm = { url = "github:astro/microvm.nix"; inputs.nixpkgs.follows = "nixpkgs"; @@ -28,6 +19,7 @@ inputs.nixpkgs.follows = "nixpkgs"; }; + ## TLMS stuff below documentation-src = { url = "github:tlm-solutions/documentation"; flake = false; @@ -38,7 +30,7 @@ inputs = { nixpkgs.follows = "nixpkgs"; naersk.follows = "naersk"; - utils.follows = "utils"; + tlms-rs.follows = "tlms-rs"; }; }; @@ -47,7 +39,7 @@ inputs = { nixpkgs.follows = "nixpkgs"; naersk.follows = "naersk"; - utils.follows = "utils"; + tlms-rs.follows = "tlms-rs"; }; }; @@ -61,21 +53,64 @@ inputs = { nixpkgs.follows = "nixpkgs"; naersk.follows = "naersk"; - utils.follows = "utils"; }; }; + + gnuradio-decoder = { + url = "github:tlm-solutions/gnuradio-decoder"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + data-accumulator = { + url = "github:tlm-solutions/data-accumulator"; + inputs.nixpkgs.follows = "nixpkgs"; + inputs.naersk.follows = "naersk"; + }; + + state-api = { + url = "github:tlm-solutions/state-api"; + inputs.nixpkgs.follows = "nixpkgs"; + inputs.naersk.follows = "naersk"; + }; + + funnel = { + url = "github:tlm-solutions/funnel"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + windshield = { + url = "github:tlm-solutions/windshield"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + + wartrammer = { + url = "github:tlm-solutions/wartrammer-40k"; + inputs.nixpkgs.follows = "nixpkgs"; + inputs.naersk.follows = "naersk"; + }; + + tlms-rs = { + url = "github:tlm-solutions/tlms.rs"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; outputs = inputs@{ self + , data-accumulator , datacare - , TLMS + , documentation-src + , funnel + , gnuradio-decoder + , kindergarten , microvm , nixpkgs , sops-nix - , documentation-src + , state-api + , telegram-decoder , trekkie - , kindergarten + , wartrammer + , windshield , ... }: let @@ -86,16 +121,21 @@ data-hoarder-modules = [ ./modules/data-hoarder ./modules/TLMS - sops-nix.nixosModules.sops + data-accumulator.nixosModules.default datacare.nixosModules.default - TLMS.nixosModules.default + funnel.nixosModules.default + sops-nix.nixosModules.sops + state-api.nixosModules.default trekkie.nixosModules.default { nixpkgs.overlays = [ - TLMS.overlays.default datacare.overlays.default kindergarten.overlays.default trekkie.overlays.default + state-api.overlays.default + funnel.overlays.default + data-accumulator.overlays.default + windshield.overlays.default (final: prev: { inherit documentation-src; options-docs = (pkgs.nixosOptionsDoc { @@ -107,9 +147,13 @@ ]; stop-box-modules = [ + ./modules/TLMS + telegram-decoder.nixosModules.default + gnuradio-decoder.nixosModules.default { nixpkgs.overlays = [ - TLMS.overlays.default + telegram-decoder.overlays.default + gnuradio-decoder.overlays.default ]; } ]; @@ -126,7 +170,6 @@ # default modules sops-nix.nixosModules.sops - TLMS.nixosModules.default ./modules/traffic-stop-box ./modules/TLMS { @@ -206,7 +249,7 @@ data-hoarder = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; - specialArgs = inputs; + specialArgs = { inherit inputs self; }; modules = [ microvm.nixosModules.microvm ./hosts/data-hoarder @@ -215,7 +258,7 @@ staging-data-hoarder = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; - specialArgs = inputs; + specialArgs = { inherit inputs self; }; modules = [ ./hosts/staging-data-hoarder microvm.nixosModules.microvm diff --git a/hardware/dell-wyse-3040.nix b/hardware/dell-wyse-3040.nix index e3e5d25..6f39adf 100644 --- a/hardware/dell-wyse-3040.nix +++ b/hardware/dell-wyse-3040.nix @@ -1,11 +1,11 @@ -{ config, lib, TLMS, ... }: +{ config, lib, ... }: { # The global useDHCP flag is deprecated, therefore explicitly set to false here. # Per-interface useDHCP will be mandatory in the future, so this generated config # replicates the default behaviour. imports = [ - TLMS.nixosModules.disk-module + ./disk-module ]; networking = { interfaces.enp1s0.useDHCP = lib.mkDefault true; diff --git a/hardware/disk-module/default.nix b/hardware/disk-module/default.nix new file mode 100644 index 0000000..b2386d8 --- /dev/null +++ b/hardware/disk-module/default.nix @@ -0,0 +1,16 @@ +{ config, lib, pkgs, ... }: +{ + boot.growPartition = true; + system.build.diskImage = import ./make-disk-image.nix { + name = "${config.networking.hostName}-disk"; + partitionTableType = "efi"; + additionalSpace = "0G"; + copyChannel = false; + inherit config lib pkgs; + postVM = '' + mkdir -p $out/nix-support + echo file binary-dist $diskImage >> $out/nix-support/hydra-build-products + ''; + }; + fileSystems."/".autoResize = true; +} diff --git a/hardware/disk-module/make-disk-image.nix b/hardware/disk-module/make-disk-image.nix new file mode 100644 index 0000000..9952bd3 --- /dev/null +++ b/hardware/disk-module/make-disk-image.nix @@ -0,0 +1,453 @@ +{ pkgs +, lib + +, # The NixOS configuration to be installed onto the disk image. + config + +, # The size of the disk, in megabytes. + # if "auto" size is calculated based on the contents copied to it and + # additionalSpace is taken into account. + diskSize ? "auto" + +, # additional disk space to be added to the image if diskSize "auto" + # is used + additionalSpace ? "512M" + +, # size of the boot partition, is only used if partitionTableType is + # either "efi" or "hybrid" + # This will be undersized slightly, as this is actually the offset of + # the end of the partition. Generally it will be 1MiB smaller. + bootSize ? "256M" + +, # The files and directories to be placed in the target file system. + # This is a list of attribute sets {source, target, mode, user, group} where + # `source' is the file system object (regular file or directory) to be + # grafted in the file system at path `target', `mode' is a string containing + # the permissions that will be set (ex. "755"), `user' and `group' are the + # user and group name that will be set as owner of the files. + # `mode', `user', and `group' are optional. + # When setting one of `user' or `group', the other needs to be set too. + contents ? [ ] + +, # Type of partition table to use; either "legacy", "efi", or "none". + # For "efi" images, the GPT partition table is used and a mandatory ESP + # partition of reasonable size is created in addition to the root partition. + # For "legacy", the msdos partition table is used and a single large root + # partition is created. + # For "legacy+gpt", the GPT partition table is used, a 1MiB no-fs partition for + # use by the bootloader is created, and a single large root partition is + # created. + # For "hybrid", the GPT partition table is used and a mandatory ESP + # partition of reasonable size is created in addition to the root partition. + # Also a legacy MBR will be present. + # For "none", no partition table is created. Enabling `installBootLoader` + # most likely fails as GRUB will probably refuse to install. + partitionTableType ? "legacy" + +, # Whether to invoke `switch-to-configuration boot` during image creation + installBootLoader ? true + +, # The root file system type. + fsType ? "ext4" + +, # Filesystem label + label ? if onlyNixStore then "nix-store" else "nixos" + +, # The initial NixOS configuration file to be copied to + # /etc/nixos/configuration.nix. + configFile ? null + +, # Shell code executed after the VM has finished. + postVM ? "" + +, # Copy the contents of the Nix store to the root of the image and + # skip further setup. Incompatible with `contents`, + # `installBootLoader` and `configFile`. + onlyNixStore ? false + +, name ? "nixos-disk-image" + +, # Disk image format, one of qcow2, qcow2-compressed, vdi, vpc, raw. + format ? "raw" + +, # Whether a nix channel based on the current source tree should be + # made available inside the image. Useful for interactive use of nix + # utils, but changes the hash of the image when the sources are + # updated. + copyChannel ? true + +, # Additional store paths to copy to the image's store. + additionalPaths ? [ ] +}: + +assert partitionTableType == "legacy" || partitionTableType == "legacy+gpt" || partitionTableType == "efi" || partitionTableType == "hybrid" || partitionTableType == "none"; +# We use -E offset=X below, which is only supported by e2fsprogs +assert partitionTableType != "none" -> fsType == "ext4"; +# Either both or none of {user,group} need to be set +assert lib.all + (attrs: ((attrs.user or null) == null) + == ((attrs.group or null) == null)) + contents; +assert onlyNixStore -> contents == [ ] && configFile == null && !installBootLoader; + +with lib; + +let format' = format; in let + + format = if format' == "qcow2-compressed" then "qcow2" else format'; + + compress = optionalString (format' == "qcow2-compressed") "-c"; + + filename = "nixos." + { + qcow2 = "qcow2"; + vdi = "vdi"; + vpc = "vhd"; + raw = "img"; + }.${format} or format; + + rootPartition = { + # switch-case + legacy = "1"; + "legacy+gpt" = "2"; + efi = "2"; + hybrid = "3"; + }.${partitionTableType}; + + partitionDiskScript = { + # switch-case + legacy = '' + parted --script $diskImage -- \ + mklabel msdos \ + mkpart primary ext4 1MiB -1 + ''; + "legacy+gpt" = '' + parted --script $diskImage -- \ + mklabel gpt \ + mkpart no-fs 1MB 2MB \ + set 1 bios_grub on \ + align-check optimal 1 \ + mkpart primary ext4 2MB -1 \ + align-check optimal 2 \ + print + ''; + efi = '' + parted --script $diskImage -- \ + mklabel gpt \ + mkpart ESP fat32 8MiB ${bootSize} \ + set 1 boot on \ + mkpart primary ext4 ${bootSize} -1 + ''; + hybrid = '' + parted --script $diskImage -- \ + mklabel gpt \ + mkpart ESP fat32 8MiB ${bootSize} \ + set 1 boot on \ + mkpart no-fs 0 1024KiB \ + set 2 bios_grub on \ + mkpart primary ext4 ${bootSize} -1 + ''; + none = ""; + }.${partitionTableType}; + + nixpkgs = cleanSource pkgs.path; + + # FIXME: merge with channel.nix / make-channel.nix. + channelSources = pkgs.runCommand "nixos-${config.system.nixos.version}" { } '' + mkdir -p $out + cp -prd ${nixpkgs.outPath} $out/nixos + chmod -R u+w $out/nixos + if [ ! -e $out/nixos/nixpkgs ]; then + ln -s . $out/nixos/nixpkgs + fi + rm -rf $out/nixos/.git + echo -n ${config.system.nixos.versionSuffix} > $out/nixos/.version-suffix + ''; + + binPath = with pkgs; makeBinPath ( + [ + rsync + util-linux + parted + e2fsprogs + lkl + config.system.build.nixos-install + config.system.build.nixos-enter + nix + systemdMinimal + ] ++ stdenv.initialPath + ); + + # I'm preserving the line below because I'm going to search for it across nixpkgs to consolidate + # image building logic. The comment right below this now appears in 4 different places in nixpkgs :) + # !!! should use XML. + sources = map (x: x.source) contents; + targets = map (x: x.target) contents; + modes = map (x: x.mode or "''") contents; + users = map (x: x.user or "''") contents; + groups = map (x: x.group or "''") contents; + + basePaths = [ config.system.build.toplevel ] + ++ lib.optional copyChannel channelSources; + + additionalPaths' = subtractLists basePaths additionalPaths; + + closureInfo = pkgs.closureInfo { + rootPaths = basePaths ++ additionalPaths'; + }; + + blockSize = toString (4 * 1024); # ext4fs block size (not block device sector size) + + prepareImage = '' + export PATH=${binPath} + + # Yes, mkfs.ext4 takes different units in different contexts. Fun. + sectorsToKilobytes() { + echo $(( ( "$1" * 512 ) / 1024 )) + } + + sectorsToBytes() { + echo $(( "$1" * 512 )) + } + + # Given lines of numbers, adds them together + sum_lines() { + local acc=0 + while read -r number; do + acc=$((acc+number)) + done + echo "$acc" + } + + mebibyte=$(( 1024 * 1024 )) + + # Approximative percentage of reserved space in an ext4 fs over 512MiB. + # 0.05208587646484375 + # × 1000, integer part: 52 + compute_fudge() { + echo $(( $1 * 52 / 1000 )) + } + + mkdir $out + + root="$PWD/root" + mkdir -p $root + + # Copy arbitrary other files into the image + # Semi-shamelessly copied from make-etc.sh. I (@copumpkin) shall factor this stuff out as part of + # https://github.com/NixOS/nixpkgs/issues/23052. + set -f + sources_=(${concatStringsSep " " sources}) + targets_=(${concatStringsSep " " targets}) + modes_=(${concatStringsSep " " modes}) + set +f + + for ((i = 0; i < ''${#targets_[@]}; i++)); do + source="''${sources_[$i]}" + target="''${targets_[$i]}" + mode="''${modes_[$i]}" + + if [ -n "$mode" ]; then + rsync_chmod_flags="--chmod=$mode" + else + rsync_chmod_flags="" + fi + # Unfortunately cptofs only supports modes, not ownership, so we can't use + # rsync's --chown option. Instead, we change the ownerships in the + # VM script with chown. + rsync_flags="-a --no-o --no-g $rsync_chmod_flags" + if [[ "$source" =~ '*' ]]; then + # If the source name contains '*', perform globbing. + mkdir -p $root/$target + for fn in $source; do + rsync $rsync_flags "$fn" $root/$target/ + done + else + mkdir -p $root/$(dirname $target) + if ! [ -e $root/$target ]; then + rsync $rsync_flags $source $root/$target + else + echo "duplicate entry $target -> $source" + exit 1 + fi + fi + done + + export HOME=$TMPDIR + + # Provide a Nix database so that nixos-install can copy closures. + export NIX_STATE_DIR=$TMPDIR/state + nix-store --load-db < ${closureInfo}/registration + + chmod 755 "$TMPDIR" + echo "running nixos-install..." + nixos-install --root $root --no-bootloader --no-root-passwd \ + --system ${config.system.build.toplevel} \ + ${if copyChannel then "--channel ${channelSources}" else "--no-channel-copy"} \ + --substituters "" + + ${optionalString (additionalPaths' != []) '' + nix --extra-experimental-features nix-command copy --to $root --no-check-sigs ${concatStringsSep " " additionalPaths'} + ''} + + # delete /nix/store/.links (hydra build produces it, my local build does not produce it...) + echo "Deleting root/nix/store/.links" + rm -rf $root/nix/store/.links + + diskImage=nixos.raw + + ${if diskSize == "auto" then '' + ${if partitionTableType == "efi" || partitionTableType == "hybrid" then '' + # Add the GPT at the end + gptSpace=$(( 512 * 34 * 1 )) + # Normally we'd need to account for alignment and things, if bootSize + # represented the actual size of the boot partition. But it instead + # represents the offset at which it ends. + # So we know bootSize is the reserved space in front of the partition. + reservedSpace=$(( gptSpace + $(numfmt --from=iec '${bootSize}') )) + '' else if partitionTableType == "legacy+gpt" then '' + # Add the GPT at the end + gptSpace=$(( 512 * 34 * 1 )) + # And include the bios_grub partition; the ext4 partition starts at 2MB exactly. + reservedSpace=$(( gptSpace + 2 * mebibyte )) + '' else if partitionTableType == "legacy" then '' + # Add the 1MiB aligned reserved space (includes MBR) + reservedSpace=$(( mebibyte )) + '' else '' + reservedSpace=0 + ''} + additionalSpace=$(( $(numfmt --from=iec '${additionalSpace}') + reservedSpace )) + + # Compute required space in filesystem blocks + diskUsage=$(find . ! -type d -print0 | du --files0-from=- --apparent-size --block-size "${blockSize}" | cut -f1 | sum_lines) + # Each inode takes space! + numInodes=$(find . | wc -l) + # Convert to bytes, inodes take two blocks each! + diskUsage=$(( (diskUsage + 2 * numInodes) * ${blockSize} )) + # Then increase the required space to account for the reserved blocks. + fudge=$(compute_fudge $diskUsage) + requiredFilesystemSpace=$(( diskUsage + fudge )) + + diskSize=$(( requiredFilesystemSpace + additionalSpace )) + + # Round up to the nearest mebibyte. + # This ensures whole 512 bytes sector sizes in the disk image + # and helps towards aligning partitions optimally. + if (( diskSize % mebibyte )); then + diskSize=$(( ( diskSize / mebibyte + 1) * mebibyte )) + fi + + truncate -s "$diskSize" $diskImage + + printf "Automatic disk size...\n" + printf " Closure space use: %d bytes\n" $diskUsage + printf " fudge: %d bytes\n" $fudge + printf " Filesystem size needed: %d bytes\n" $requiredFilesystemSpace + printf " Additional space: %d bytes\n" $additionalSpace + printf " Disk image size: %d bytes\n" $diskSize + '' else '' + truncate -s ${toString diskSize}M $diskImage + ''} + + ${partitionDiskScript} + + ${if partitionTableType != "none" then '' + # Get start & length of the root partition in sectors to $START and $SECTORS. + eval $(partx $diskImage -o START,SECTORS --nr ${rootPartition} --pairs) + + mkfs.${fsType} -b ${blockSize} -F -L ${label} $diskImage -E offset=$(sectorsToBytes $START) $(sectorsToKilobytes $SECTORS)K + '' else '' + mkfs.${fsType} -b ${blockSize} -F -L ${label} $diskImage + ''} + + echo "copying staging root to image..." + cptofs -p ${optionalString (partitionTableType != "none") "-P ${rootPartition}"} \ + -t ${fsType} \ + -i $diskImage \ + $root${optionalString onlyNixStore builtins.storeDir}/* / || + (echo >&2 "ERROR: cptofs failed. diskSize might be too small for closure."; exit 1) + ''; + + moveOrConvertImage = '' + ${if format == "raw" then '' + mv $diskImage $out/${filename} + '' else '' + ${pkgs.qemu}/bin/qemu-img convert -f raw -O ${format} ${compress} $diskImage $out/${filename} + ''} + diskImage=$out/${filename} + ''; + + buildImage = pkgs.vmTools.runInLinuxVM ( + pkgs.runCommand name + { + preVM = prepareImage; + buildInputs = with pkgs; [ util-linux e2fsprogs dosfstools ]; + postVM = moveOrConvertImage + postVM; + memSize = 1024; + } '' + export PATH=${binPath}:$PATH + + rootDisk=${if partitionTableType != "none" then "/dev/vda${rootPartition}" else "/dev/vda"} + + # Some tools assume these exist + ln -s vda /dev/xvda + ln -s vda /dev/sda + # make systemd-boot find ESP without udev + mkdir /dev/block + ln -s /dev/vda1 /dev/block/254:1 + + mountPoint=/mnt + mkdir $mountPoint + mount $rootDisk $mountPoint + + # Create the ESP and mount it. Unlike e2fsprogs, mkfs.vfat doesn't support an + # '-E offset=X' option, so we can't do this outside the VM. + ${optionalString (partitionTableType == "efi" || partitionTableType == "hybrid") '' + mkdir -p /mnt/boot + mkfs.vfat -n ESP /dev/vda1 + mount /dev/vda1 /mnt/boot + ''} + + # Install a configuration.nix + mkdir -p /mnt/etc/nixos + ${optionalString (configFile != null) '' + cp ${configFile} /mnt/etc/nixos/configuration.nix + ''} + + ${lib.optionalString installBootLoader '' + # Set up core system link, GRUB, etc. + NIXOS_INSTALL_BOOTLOADER=1 nixos-enter --root $mountPoint -- /nix/var/nix/profiles/system/bin/switch-to-configuration boot + + # The above scripts will generate a random machine-id and we don't want to bake a single ID into all our images + rm -f $mountPoint/etc/machine-id + ''} + + # Set the ownerships of the contents. The modes are set in preVM. + # No globbing on targets, so no need to set -f + targets_=(${concatStringsSep " " targets}) + users_=(${concatStringsSep " " users}) + groups_=(${concatStringsSep " " groups}) + for ((i = 0; i < ''${#targets_[@]}; i++)); do + target="''${targets_[$i]}" + user="''${users_[$i]}" + group="''${groups_[$i]}" + if [ -n "$user$group" ]; then + # We have to nixos-enter since we need to use the user and group of the VM + nixos-enter --root $mountPoint -- chown -R "$user:$group" "$target" + fi + done + + umount -R /mnt + + # Make sure resize2fs works. Note that resize2fs has stricter criteria for resizing than a normal + # mount, so the `-c 0` and `-i 0` don't affect it. Setting it to `now` doesn't produce deterministic + # output, of course, but we can fix that when/if we start making images deterministic. + ${optionalString (fsType == "ext4") '' + tune2fs -T now -c 0 -i 0 $rootDisk + ''} + '' + ); +in +if onlyNixStore then + pkgs.runCommand name { } + (prepareImage + moveOrConvertImage + postVM) +else buildImage diff --git a/modules/TLMS/base.nix b/modules/TLMS/base.nix index f9e3329..01b86b9 100644 --- a/modules/TLMS/base.nix +++ b/modules/TLMS/base.nix @@ -1,4 +1,4 @@ -{ pkgs, config, self, lib, ... }: +{ pkgs, config, lib, inputs, ... }: let regMotd = '' _._ _,-'""`-._ @@ -72,12 +72,12 @@ in networking.firewall.allowedTCPPorts = [ 22 ]; users.users.root = { openssh.authorizedKeys.keyFiles = [ - "${self}/keys/ssh/revol-xut" - "${self}/keys/ssh/oxa" - "${self}/keys/ssh/oxa1" - "${self}/keys/ssh/marenz1" - "${self}/keys/ssh/marenz2" - "${self}/keys/ssh/astro" + ../../keys/ssh/revol-xut + ../../keys/ssh/oxa + ../../keys/ssh/oxa1 + ../../keys/ssh/marenz1 + ../../keys/ssh/marenz2 + ../../keys/ssh/astro ]; }; services.openssh = { @@ -99,6 +99,6 @@ in hardstatus string "%w" ''; - TLMS.stopsJson = "${pkgs.stops}/stop/all.json"; - TLMS.graphJson = "${pkgs.stops}/graph/all.json"; + TLMS.stopsJson = "/var/lib/json_dump/stop-all.json"; + TLMS.graphJson = "/var/lib/json_dump/graph-all.json"; } diff --git a/modules/TLMS/binary-cache.nix b/modules/TLMS/binary-cache.nix new file mode 100644 index 0000000..4395e4b --- /dev/null +++ b/modules/TLMS/binary-cache.nix @@ -0,0 +1,23 @@ +{ config, lib, ... }: { + + options.TLMS = with lib; { + useBinaryCache = mkOption { + type = types.bool; + default = true; + description = ''Wether to use TLMS binary caches.''; + }; + }; + + config = lib.mkIf config.TLMS.useBinaryCache { + nix.settings = { + substituters = [ + "https://dump-dvb.cachix.org" + "https://hydra.hq.c3d2.de" + ]; + trusted-public-keys = [ + "dump-dvb.cachix.org-1:+Dq7gqpQG4YlLA2X3xJsG1v3BrlUGGpVtUKWk0dTyUU=" + "nix-serve.hq.c3d2.de:KZRGGnwOYzys6pxgM8jlur36RmkJQ/y8y62e52fj1ps=" + ]; + }; + }; +} diff --git a/modules/TLMS/default.nix b/modules/TLMS/default.nix index 90fb0a7..845f828 100644 --- a/modules/TLMS/default.nix +++ b/modules/TLMS/default.nix @@ -1,8 +1,10 @@ { imports = [ - ./general-options.nix - ./net.nix ./base.nix + ./binary-cache.nix + ./general-options.nix + ./json.nix + ./net.nix ./wg.nix ]; } diff --git a/modules/TLMS/json.nix b/modules/TLMS/json.nix new file mode 100644 index 0000000..6fdfd1d --- /dev/null +++ b/modules/TLMS/json.nix @@ -0,0 +1,15 @@ +{ lib, pkgs, config, ... }: +with lib; { + options.TLMS = { + stopsJson = mkOption { + type = types.str; + default = ""; + description = "stops.json location"; + }; + graphJson = mkOption { + type = types.str; + default = ""; + description = "graph.json location"; + }; + }; +} diff --git a/modules/data-hoarder/map.nix b/modules/data-hoarder/map.nix index 5c117e6..ffc8c39 100644 --- a/modules/data-hoarder/map.nix +++ b/modules/data-hoarder/map.nix @@ -32,7 +32,8 @@ # STS add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always; add_header "Access-Control-Allow-Origin" "*"; - ''; + ''; + json_dump = "/var/lib/json_dump/"; in { "/" = { root = if (config.deployment-TLMS.domain == "dvb.solutions") then "${pkgs.windshield}/bin/" else "${pkgs.windshield-staging}/bin/"; @@ -41,15 +42,15 @@ tryFiles = "$uri /index.html =404"; }; "~ ^/stop/.*\.json$" = { - root = "${pkgs.stops}/"; + root = json_dump; extraConfig = nginx_config; }; "~ ^/graph/.*\.json$" = { - root = "${pkgs.stops}/"; + root = json_dump; extraConfig = nginx_config; }; "~ ^/region/.*\.json$" = { - root = "${pkgs.stops}/"; + root = json_dump; extraConfig = nginx_config; }; }; diff --git a/modules/data-hoarder/postgres.nix b/modules/data-hoarder/postgres.nix index 3d926cd..8d99487 100644 --- a/modules/data-hoarder/postgres.nix +++ b/modules/data-hoarder/postgres.nix @@ -1,4 +1,4 @@ -{ lib, pkgs, config, TLMS, ... }: { +{ lib, pkgs, config, inputs, ... }: { services.postgresql = { enable = true; @@ -18,7 +18,7 @@ ]; }; - environment.systemPackages = [ TLMS.packages.x86_64-linux.run-database-migration ]; + environment.systemPackages = [ inputs.tlms-rs.packages.x86_64-linux.run-migration ]; systemd.services.postgresql = { unitConfig = { @@ -36,7 +36,7 @@ $PSQL -c "ALTER ROLE grafana WITH PASSWORD '$(cat ${config.sops.secrets.postgres_password_grafana.path})';" export DATABASE_URL=postgres:///dvbdump - ${TLMS.packages.x86_64-linux.run-database-migration}/bin/run-migration + ${inputs.tlms-rs.packages.x86_64-linux.run-migration}/bin/run-migration unset DATABASE_URL ''; };