From 113bda1571591386b05ed52f791f468d9bef6dd5 Mon Sep 17 00:00:00 2001 From: guangtao Date: Mon, 6 Nov 2023 03:33:07 -0800 Subject: [PATCH] refactor: update tenzir-devops --- .github/workflows/nix-oci.yaml | 2 +- README.org | 30 +- dev/configs/treefmt.toml | 3 - dev/tasks/runScriptWithEnv.nix | 14 - devshell.toml | 7 +- diagrams/images/process-compose-tenzir.svg | 850 ++++++++++++++++++ diagrams/process-compose.org | 6 +- flake.lock | 647 +++---------- flake.nix | 29 +- prod/tasks/deploy-tenzir-aws/default.nix | 10 - units/cells/dev/configs/treefmt.nix | 6 + .../cells/dev/shellsProfiles}/commands.toml | 0 .../cells/dev/shellsProfiles}/packages.toml | 0 units/cells/dev/tasks/climod.md | 37 + units/cells/dev/tasks/climod.nix | 32 + units/cells/dev/tasks/makes-ps-tenzir/_env | 5 + .../dev}/tasks/makes-ps-tenzir/default.nix | 9 +- .../cells/dev}/tasks/makes-ps-tenzir/env | 0 .../dev}/tasks/makes-ps-tenzir/tenzir.yaml | 0 {dev => units/cells/dev}/tasks/makes-test.nix | 6 +- units/cells/dev/tasks/runScriptWithEnv.nix | 18 + .../cells/dev}/tasks/script-json/default.json | 0 .../dev}/tasks/script-json/function.json | 0 units/cells/dev/tasks/test.nix | 1 + .../cells/prod}/schemas/tenzir-sysmon.yaml | 0 .../prod/tasks/deploy-tenzir-aws/default.nix | 6 + .../tasks/deploy-tenzir-aws/entrypoint.sh | 0 .../cells/prod}/tasks/deploy-tenzir-aws/env | 0 28 files changed, 1116 insertions(+), 602 deletions(-) delete mode 100644 dev/configs/treefmt.toml delete mode 100644 dev/tasks/runScriptWithEnv.nix create mode 100644 diagrams/images/process-compose-tenzir.svg delete mode 100644 prod/tasks/deploy-tenzir-aws/default.nix create mode 100644 units/cells/dev/configs/treefmt.nix rename {dev/shellProfiles => units/cells/dev/shellsProfiles}/commands.toml (100%) rename {dev/shellProfiles => units/cells/dev/shellsProfiles}/packages.toml (100%) create mode 100644 units/cells/dev/tasks/climod.md create mode 100644 units/cells/dev/tasks/climod.nix create mode 100644 units/cells/dev/tasks/makes-ps-tenzir/_env rename {dev => units/cells/dev}/tasks/makes-ps-tenzir/default.nix (58%) rename {dev => units/cells/dev}/tasks/makes-ps-tenzir/env (100%) rename {dev => units/cells/dev}/tasks/makes-ps-tenzir/tenzir.yaml (100%) rename {dev => units/cells/dev}/tasks/makes-test.nix (86%) create mode 100644 units/cells/dev/tasks/runScriptWithEnv.nix rename {dev => units/cells/dev}/tasks/script-json/default.json (100%) rename {dev => units/cells/dev}/tasks/script-json/function.json (100%) create mode 100644 units/cells/dev/tasks/test.nix rename {prod => units/cells/prod}/schemas/tenzir-sysmon.yaml (100%) create mode 100644 units/cells/prod/tasks/deploy-tenzir-aws/default.nix rename {prod => units/cells/prod}/tasks/deploy-tenzir-aws/entrypoint.sh (100%) rename {prod => units/cells/prod}/tasks/deploy-tenzir-aws/env (100%) diff --git a/.github/workflows/nix-oci.yaml b/.github/workflows/nix-oci.yaml index 942401d..7f39b8b 100644 --- a/.github/workflows/nix-oci.yaml +++ b/.github/workflows/nix-oci.yaml @@ -23,4 +23,4 @@ jobs: - name: copy oci-image to the register run: | - nix run ./#x86_64-linux.dev.containers.default.copyToRegistry + nix run ./#x86_64-linux.dev.containers.default.out.copyToRegistry diff --git a/README.org b/README.org index 6c5f618..01868f4 100644 --- a/README.org +++ b/README.org @@ -12,23 +12,27 @@ * Configuration languages or files -By simply placing the supported configuration formats or files in the corresponding folders, the auto-importing mechanism will be triggered automatically. +By simply placing the supported configuration formats or files in the corresponding folders, the auto-importing mechanism will be triggered. #+begin_quote We have a global command-line tool called ~std~ that allows users to query and execute various tasks. #+end_quote -- [X] ~devshell~ -> path -> ./cells/devshell - - nix,yaml -- [X] ~tasks~ -> path -> ./cells/tasks/tasks - - nix,json,yaml -- [X] ~schemas~ -> path -> ./tenzir/schemas/ - - nix,yaml,json -- [ ] ~terraform~ -> path -> ./deploy/tf - - nix(validator::terranix),hcl(validator::internal),json(overrideValues),nickel(validator::tf-ncl) -- [ ] ~kubernets~ -> path -> ./deploy/k8s - - ts(validator::architect-k8s-template),yaml,nickel,nix,json(overrideValues) -- [] ~secrets~ -> path -> ./secrets - - envs(yaml/json), sops(GPG,ssh),age(ssh),vault(cloud),git-crypt ++ units (dirs) + 1) cells(std&nix) A DevOps framework for the SDLC with the power of Nix and Flakes. Good for keeping deadlines! + - [X] ~devshell~ -> path -> ./cells/devshell + - nix,yaml + - [X] ~tasks~ -> path -> ./cells/tasks/tasks + - nix,json,yaml + - [X] ~schemas~ -> path -> ./tenzir/schemas/ + - nix,yaml,json + - [ ] ~terraform~ -> path -> ./deploy/tf + - nix(validator::terranix),hcl(validator::internal),json(overrideValues),nickel(validator::tf-ncl) + - [ ] ~kubernets~ -> path -> ./deploy/k8s + - ts(validator::architect-k8s-template),yaml,nickel,nix,json(overrideValues) + - [] ~secrets~ -> path -> ./secrets + - envs(yaml/json), sops(GPG,ssh),age(ssh),vault(cloud),git-crypt + + 2) nickel: Introducing the experimental incorporation of Nickel into security dataflow. Moreover, users have the flexibility to modify the structure of the related cells' paths by using the ~cellsFrom~ field in the ~./devshell.toml~. diff --git a/dev/configs/treefmt.toml b/dev/configs/treefmt.toml deleted file mode 100644 index 6297c92..0000000 --- a/dev/configs/treefmt.toml +++ /dev/null @@ -1,3 +0,0 @@ -[formatter.prettier] -command = "prettier" -excludes = ["generated-*.yaml"] diff --git a/dev/tasks/runScriptWithEnv.nix b/dev/tasks/runScriptWithEnv.nix deleted file mode 100644 index aae18a8..0000000 --- a/dev/tasks/runScriptWithEnv.nix +++ /dev/null @@ -1,14 +0,0 @@ -makeScript { - name = "runScriptWithEnv"; - env = { - a = "1"; - b = "2"; - VAR_NAME = "test"; - }; - searchPaths.bin = [nixpkgs.hello]; - searchPaths.source = []; - entrypoint = '' - hello --help - echo $a - ''; -} diff --git a/devshell.toml b/devshell.toml index 9d3c1b6..ea960d5 100644 --- a/devshell.toml +++ b/devshell.toml @@ -1,9 +1,4 @@ -[cellBlocks] -shellProfiles = "/shellProfiles" #toml,nix -shell = "/shell" # nix -tasks = "/tasks" -configs = "/configs" #json,toml,yaml -schemas = "/schemas" #json,toml,yaml +cellsFrom = "/units/cells" [devshell] # programs.sops.enable = true; diff --git a/diagrams/images/process-compose-tenzir.svg b/diagrams/images/process-compose-tenzir.svg new file mode 100644 index 0000000..f8e523c --- /dev/null +++ b/diagrams/images/process-compose-tenzir.svg @@ -0,0 +1,850 @@ +Process Composeprocess-compose tenzirTenzirData SciencePublishernodewebjupyterlabnotebookquarto + + + + + + + + + + + + diff --git a/diagrams/process-compose.org b/diagrams/process-compose.org index 0296d97..709cb47 100644 --- a/diagrams/process-compose.org +++ b/diagrams/process-compose.org @@ -9,8 +9,8 @@ -* init Jobs -#+BEGIN_SRC d2 :file images/process-compose-tenzir.png :flags --theme 200 :exports both :tangle (concat (org-entry-get nil "PRJ-DIR" t) "process-compose-tenzir.d2") +* tenzir +#+BEGIN_SRC d2 :file images/process-compose-tenzir.svg :flags --theme 200 :exports both :tangle (concat (org-entry-get nil "PRJ-DIR" t) "process-compose-tenzir.d2") # !/usr/bin/env d2 --theme 200 # title: { @@ -41,4 +41,4 @@ process-compose: Process Compose { #+END_SRC #+RESULTS: -[[file:images/process-compose-tenzir.png]] +[[file:images/process-compose-tenzir.svg]] diff --git a/flake.lock b/flake.lock index 12e1c33..cb4f2af 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,15 @@ "nodes": { "POP": { "inputs": { - "flake-compat": "flake-compat", + "flake-compat": [ + "tenzir-devops", + "omnibus", + "flops" + ], "nixlib": "nixlib", "nixpkgs": [ "tenzir-devops", - "std-ext", + "omnibus", "flops" ] }, @@ -39,28 +43,13 @@ "type": "github" } }, - "blank_2": { - "locked": { - "lastModified": 1625557891, - "narHash": "sha256-O8/MWsPBGhhyPoPLHZAuoZiiHo9q6FLlEeIDEXuj6T4=", - "owner": "divnix", - "repo": "blank", - "rev": "5a5d2684073d9f563072ed07c871d577a6c614a8", - "type": "github" - }, - "original": { - "owner": "divnix", - "repo": "blank", - "type": "github" - } - }, "call-flake": { "locked": { - "lastModified": 1687380775, + "lastModified": 1697332845, "narHash": "sha256-bmhE1TmrJG4ba93l9WQTLuYM53kwGQAjYHRvHOeuxWU=", "owner": "divnix", "repo": "call-flake", - "rev": "74061f6c241227cd05e79b702db9a300a2e4131a", + "rev": "088f8589c7f3ee59bea1858a89f5125d284c3c4a", "type": "github" }, "original": { @@ -71,11 +60,11 @@ }, "call-flake_2": { "locked": { - "lastModified": 1689473344, + "lastModified": 1687380775, "narHash": "sha256-bmhE1TmrJG4ba93l9WQTLuYM53kwGQAjYHRvHOeuxWU=", "owner": "divnix", "repo": "call-flake", - "rev": "a07e91d3fb59eb9f7ec706a151e1a7b36a1e8727", + "rev": "74061f6c241227cd05e79b702db9a300a2e4131a", "type": "github" }, "original": { @@ -86,42 +75,18 @@ }, "devshell": { "inputs": { - "nixpkgs": "nixpkgs_3", - "systems": "systems" - }, - "locked": { - "lastModified": 1688380630, - "narHash": "sha256-8ilApWVb1mAi4439zS3iFeIT0ODlbrifm/fegWwgHjA=", - "owner": "numtide", - "repo": "devshell", - "rev": "f9238ec3d75cefbb2b42a44948c4e8fb1ae9a205", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "devshell", - "type": "github" - } - }, - "devshell_2": { - "inputs": { - "flake-utils": [ - "tenzir-devops", - "std-oci", - "flake-utils" - ], "nixpkgs": [ "tenzir-devops", - "std-oci", "nixpkgs" - ] + ], + "systems": "systems" }, "locked": { - "lastModified": 1663445644, - "narHash": "sha256-+xVlcK60x7VY1vRJbNUEAHi17ZuoQxAIH4S4iUFUGBA=", + "lastModified": 1698410321, + "narHash": "sha256-MphuSlgpmKwtJncGMohryHiK55J1n6WzVQ/OAfmfoMc=", "owner": "numtide", "repo": "devshell", - "rev": "e3dc3e21594fe07bdb24bdf1c8657acaa4cb8f66", + "rev": "1aed986e3c81a4f6698e85a7452cbfcc4b31a36e", "type": "github" }, "original": { @@ -134,18 +99,20 @@ "inputs": { "haumea": [ "tenzir-devops", - "std", + "omnibus", + "flops", "haumea" ], "nixlib": [ "tenzir-devops", - "std", - "haumea", - "nixpkgs" + "omnibus", + "flops", + "nixlib" ], "yants": [ "tenzir-devops", - "std", + "omnibus", + "flops", "yants" ] }, @@ -159,7 +126,6 @@ }, "original": { "owner": "divnix", - "ref": "0.2.1", "repo": "dmerge", "type": "github" } @@ -168,20 +134,18 @@ "inputs": { "haumea": [ "tenzir-devops", - "std-ext", - "flops", + "std", "haumea" ], "nixlib": [ "tenzir-devops", - "std-ext", - "flops", - "nixlib" + "std", + "haumea", + "nixpkgs" ], "yants": [ "tenzir-devops", - "std-ext", - "flops", + "std", "yants" ] }, @@ -195,53 +159,11 @@ }, "original": { "owner": "divnix", + "ref": "0.2.1", "repo": "dmerge", "type": "github" } }, - "dmerge_3": { - "inputs": { - "nixlib": [ - "tenzir-devops", - "std-oci", - "nixpkgs" - ], - "yants": [ - "tenzir-devops", - "std-oci", - "yants" - ] - }, - "locked": { - "lastModified": 1659548052, - "narHash": "sha256-fzI2gp1skGA8mQo/FBFrUAtY0GQkAIAaV/V127TJPyY=", - "owner": "divnix", - "repo": "data-merge", - "rev": "d160d18ce7b1a45b88344aa3f13ed1163954b497", - "type": "github" - }, - "original": { - "owner": "divnix", - "repo": "data-merge", - "type": "github" - } - }, - "flake-compat": { - "flake": false, - "locked": { - "lastModified": 1650374568, - "narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=", - "owner": "edolstra", - "repo": "flake-compat", - "rev": "b4a34015c698c7793d592d66adbab377907a2be8", - "type": "github" - }, - "original": { - "owner": "edolstra", - "repo": "flake-compat", - "type": "github" - } - }, "flake-parts": { "inputs": { "nixpkgs-lib": [ @@ -250,11 +172,11 @@ ] }, "locked": { - "lastModified": 1690933134, - "narHash": "sha256-ab989mN63fQZBFrkk4Q8bYxQCktuHmBIBqUG1jl6/FQ=", + "lastModified": 1698882062, + "narHash": "sha256-HkhafUayIqxXyHH1X8d9RDl1M2CkFgZLjKD3MzabiEo=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "59cf3f1447cfc75087e7273b04b31e689a8599fb", + "rev": "8c9fa2545007b49a5db5f650ae91f227672c3877", "type": "github" }, "original": { @@ -264,72 +186,15 @@ } }, "flake-utils": { - "locked": { - "lastModified": 1653893745, - "narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "flake-utils_2": { - "locked": { - "lastModified": 1653893745, - "narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "flake-utils_3": { - "locked": { - "lastModified": 1653893745, - "narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "flake-utils_4": { - "locked": { - "lastModified": 1653893745, - "narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1", - "type": "github" + "inputs": { + "systems": "systems_2" }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "flake-utils_5": { "locked": { - "lastModified": 1653893745, - "narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=", + "lastModified": 1694529238, + "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", "owner": "numtide", "repo": "flake-utils", - "rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1", + "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", "type": "github" }, "original": { @@ -338,7 +203,7 @@ "type": "github" } }, - "flake-utils_6": { + "flake-utils_2": { "locked": { "lastModified": 1653893745, "narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=", @@ -353,36 +218,21 @@ "type": "github" } }, - "flake-utils_7": { - "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" - } - }, "flops": { "inputs": { "POP": "POP", - "call-flake": "call-flake_2", - "dmerge": "dmerge_2", - "haumea": "haumea_2", + "call-flake": "call-flake", + "dmerge": "dmerge", + "haumea": "haumea", "nixlib": "nixlib_2", - "yants": "yants_2" + "yants": "yants" }, "locked": { - "lastModified": 1691319618, - "narHash": "sha256-2bzDIZNahyiwUnHCnmLhbyTTMX4hgZ1HlRQNqff2jCk=", + "lastModified": 1699270012, + "narHash": "sha256-izzsLl21YKYRv44bjiJgx7+BTViiB/q6cPD0j7vd7+s=", "owner": "gtrunsec", "repo": "flops", - "rev": "4cd9339adb5f4bf6ded2f8cb32c0cb9bc299fc99", + "rev": "9821cfc20ea0a7179576a99576d25f6ce31c2177", "type": "github" }, "original": { @@ -393,42 +243,42 @@ }, "haumea": { "inputs": { - "nixpkgs": "nixpkgs_2" + "nixpkgs": [ + "tenzir-devops", + "omnibus", + "flops", + "nixlib" + ] }, "locked": { - "lastModified": 1685133229, - "narHash": "sha256-FePm/Gi9PBSNwiDFq3N+DWdfxFq0UKsVVTJS3cQPn94=", + "lastModified": 1697205539, + "narHash": "sha256-gHEy0Q+eEQJkWl6/DpFxXPOlTx/lMU7Pvs/bwoq4OhI=", "owner": "nix-community", "repo": "haumea", - "rev": "34dd58385092a23018748b50f9b23de6266dffc2", + "rev": "fc119c500189f739fec7ad33d111f9c92910eccf", "type": "github" }, "original": { "owner": "nix-community", - "ref": "v0.2.2", "repo": "haumea", "type": "github" } }, "haumea_2": { "inputs": { - "nixpkgs": [ - "tenzir-devops", - "std-ext", - "flops", - "nixlib" - ] + "nixpkgs": "nixpkgs_3" }, "locked": { - "lastModified": 1689557889, - "narHash": "sha256-kllmt6JnHlry+WAASdSMDaRwbiuk2dFhkbW3Qz1w8BU=", + "lastModified": 1685133229, + "narHash": "sha256-FePm/Gi9PBSNwiDFq3N+DWdfxFq0UKsVVTJS3cQPn94=", "owner": "nix-community", "repo": "haumea", - "rev": "d6a9593ff2160ce29bf6d905e9ccbcecd66baeef", + "rev": "34dd58385092a23018748b50f9b23de6266dffc2", "type": "github" }, "original": { "owner": "nix-community", + "ref": "v0.2.2", "repo": "haumea", "type": "github" } @@ -456,28 +306,6 @@ "type": "github" } }, - "incl_2": { - "inputs": { - "nixlib": [ - "tenzir-devops", - "std-oci", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1669263024, - "narHash": "sha256-E/+23NKtxAqYG/0ydYgxlgarKnxmDbg6rCMWnOBqn9Q=", - "owner": "divnix", - "repo": "incl", - "rev": "ce7bebaee048e4cd7ebdb4cee7885e00c4e2abca", - "type": "github" - }, - "original": { - "owner": "divnix", - "repo": "incl", - "type": "github" - } - }, "n2c": { "inputs": { "flake-utils": "flake-utils", @@ -487,11 +315,11 @@ ] }, "locked": { - "lastModified": 1688922987, - "narHash": "sha256-RnQwrCD5anqWfyDAVbfFIeU+Ha6cwt5QcIwIkaGRzQw=", + "lastModified": 1697285352, + "narHash": "sha256-tRGLm/DO8+anGUCgLYxTF5EPqWv8EZ9MVFWRdh285HU=", "owner": "nlewo", "repo": "nix2container", - "rev": "ab381a7d714ebf96a83882264245dbd34f0a7ec8", + "rev": "9d7f33ef0058f4df4c0912025f43c758a3289d76", "type": "github" }, "original": { @@ -503,10 +331,11 @@ "nixago": { "inputs": { "flake-utils": "flake-utils_2", - "nixago-exts": "nixago-exts", + "nixago-exts": [ + "tenzir-devops" + ], "nixpkgs": [ "tenzir-devops", - "std-ext", "nixpkgs" ] }, @@ -524,112 +353,6 @@ "type": "github" } }, - "nixago-exts": { - "inputs": { - "flake-utils": "flake-utils_3", - "nixago": "nixago_2", - "nixpkgs": [ - "tenzir-devops", - "std-ext", - "nixago", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1676070308, - "narHash": "sha256-QaJ65oc2l8iwQIGWUJ0EKjCeSuuCM/LqR8RauxZUUkc=", - "owner": "nix-community", - "repo": "nixago-extensions", - "rev": "e5380cb0456f4ea3c86cf94e3039eb856bf07d0b", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "nixago-extensions", - "type": "github" - } - }, - "nixago-exts_2": { - "inputs": { - "flake-utils": "flake-utils_5", - "nixago": "nixago_3", - "nixpkgs": [ - "tenzir-devops", - "std-ext", - "nixago", - "nixago-exts", - "nixago", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1655508669, - "narHash": "sha256-BDDdo5dZQMmwNH/GNacy33nPBnCpSIydWFPZs0kkj/g=", - "owner": "nix-community", - "repo": "nixago-extensions", - "rev": "3022a932ce109258482ecc6568c163e8d0b426aa", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "nixago-extensions", - "type": "github" - } - }, - "nixago_2": { - "inputs": { - "flake-utils": "flake-utils_4", - "nixago-exts": "nixago-exts_2", - "nixpkgs": [ - "tenzir-devops", - "std-ext", - "nixago", - "nixago-exts", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1676070010, - "narHash": "sha256-iYzJIWptE1EUD8VINAg66AAMUajizg8JUYN3oBmb8no=", - "owner": "nix-community", - "repo": "nixago", - "rev": "d480ba6c0c16e2c5c0bd2122852d6a0c9ad1ed0e", - "type": "github" - }, - "original": { - "owner": "nix-community", - "ref": "rename-config-data", - "repo": "nixago", - "type": "github" - } - }, - "nixago_3": { - "inputs": { - "flake-utils": "flake-utils_6", - "nixpkgs": [ - "tenzir-devops", - "std-ext", - "nixago", - "nixago-exts", - "nixago", - "nixago-exts", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1655405483, - "narHash": "sha256-Crd49aZWNrpczlRTOwWGfwBMsTUoG9vlHDKQC7cx264=", - "owner": "nix-community", - "repo": "nixago", - "rev": "e6a9566c18063db5b120e69e048d3627414e327d", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "nixago", - "type": "github" - } - }, "nixlib": { "locked": { "lastModified": 1653180592, @@ -647,11 +370,11 @@ }, "nixlib_2": { "locked": { - "lastModified": 1689469483, - "narHash": "sha256-2SBhY7rZQ/iNCxe04Eqxlz9YK9KgbaTMBssq3/BgdWY=", + "lastModified": 1698540503, + "narHash": "sha256-YN6DJQc7SMe6ep9FhD2BGl92bo24NPNRWjADEJE4xeU=", "owner": "nix-community", "repo": "nixpkgs.lib", - "rev": "02fea408f27186f139153e1ae88f8ab2abd9c22c", + "rev": "ce2acb20a405bf6f910081c2adc988bbc8100e4c", "type": "github" }, "original": { @@ -662,11 +385,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1691279975, - "narHash": "sha256-EwPVVuQJGf77NOlX96FE9bpbFGz1wq/M4sqJ6Vk4LyM=", + "lastModified": 1699126377, + "narHash": "sha256-LtDx5VgD/F+5SSRqt8BRSiZi5EwMjWLI1XGjWizcnMI=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "97bd658852ce0efbdc4d9ca84ad466a4cbfb1cf4", + "rev": "e583a3b08f2b59488deb2ace2528df37c931509f", "type": "github" }, "original": { @@ -678,11 +401,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1681001314, - "narHash": "sha256-5sDnCLdrKZqxLPK4KA8+f4A3YKO/u6ElpMILvX0g72c=", + "lastModified": 1660438583, + "narHash": "sha256-rJUTYxFKlWUJI3njAwEc1pKAVooAViZGJvsgqfh/q/E=", "owner": "nix-community", "repo": "nixpkgs.lib", - "rev": "367c0e1086a4eb4502b24d872cea2c7acdd557f4", + "rev": "bbd8f7cd87d0b29294ef3072ffdbd61d60f05da4", "type": "github" }, "original": { @@ -693,27 +416,11 @@ }, "nixpkgs_3": { "locked": { - "lastModified": 1677383253, - "narHash": "sha256-UfpzWfSxkfXHnb4boXZNaKsAcUrZT9Hw+tao1oZxd08=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "9952d6bc395f5841262b006fbace8dd7e143b634", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_4": { - "locked": { - "lastModified": 1660438583, - "narHash": "sha256-rJUTYxFKlWUJI3njAwEc1pKAVooAViZGJvsgqfh/q/E=", + "lastModified": 1681001314, + "narHash": "sha256-5sDnCLdrKZqxLPK4KA8+f4A3YKO/u6ElpMILvX0g72c=", "owner": "nix-community", "repo": "nixpkgs.lib", - "rev": "bbd8f7cd87d0b29294ef3072ffdbd61d60f05da4", + "rev": "367c0e1086a4eb4502b24d872cea2c7acdd557f4", "type": "github" }, "original": { @@ -737,24 +444,27 @@ "type": "github" } }, - "nosys_2": { + "omnibus": { + "inputs": { + "flops": "flops" + }, "locked": { - "lastModified": 1668010795, - "narHash": "sha256-JBDVBnos8g0toU7EhIIqQ1If5m/nyBqtHhL3sicdPwI=", - "owner": "divnix", - "repo": "nosys", - "rev": "feade0141487801c71ff55623b421ed535dbdefa", + "lastModified": 1699270133, + "narHash": "sha256-AS/w3i6zKiGs+u9t4B9dMbnLnGoRMPbEKqPFrU3uRVw=", + "owner": "gtrunsec", + "repo": "omnibus", + "rev": "4afa8d88956fe14b8c0a38006eccd54f432ff195", "type": "github" }, "original": { - "owner": "divnix", - "repo": "nosys", + "owner": "gtrunsec", + "repo": "omnibus", "type": "github" } }, "paisano": { "inputs": { - "call-flake": "call-flake", + "call-flake": "call-flake_2", "nixpkgs": [ "tenzir-devops", "std", @@ -798,34 +508,6 @@ "type": "github" } }, - "paisano_2": { - "inputs": { - "nixpkgs": [ - "tenzir-devops", - "std-oci", - "nixpkgs" - ], - "nosys": "nosys_2", - "yants": [ - "tenzir-devops", - "std-oci", - "yants" - ] - }, - "locked": { - "lastModified": 1676683211, - "narHash": "sha256-5pkyVT4UF89QhEGH/vb7JgbGsOW76bTDtdNETUJtAqA=", - "owner": "divnix", - "repo": "paisano", - "rev": "63b36b54d5368722e386e16f8e0827dc75165f06", - "type": "github" - }, - "original": { - "owner": "divnix", - "repo": "paisano", - "type": "github" - } - }, "root": { "inputs": { "nixpkgs": [ @@ -845,11 +527,10 @@ "blank": "blank", "devshell": [ "tenzir-devops", - "std-ext", "devshell" ], - "dmerge": "dmerge", - "haumea": "haumea", + "dmerge": "dmerge_2", + "haumea": "haumea_2", "incl": "incl", "makes": [ "tenzir-devops", @@ -867,7 +548,6 @@ ], "nixago": [ "tenzir-devops", - "std-ext", "nixago" ], "nixpkgs": [ @@ -881,14 +561,14 @@ "std", "blank" ], - "yants": "yants" + "yants": "yants_2" }, "locked": { - "lastModified": 1689337213, - "narHash": "sha256-qa0B38ihDW1MuAshwgvlbkk3CgheWlvYr35oMpDrxJs=", + "lastModified": 1692861655, + "narHash": "sha256-NVScyi+Gd7lf5bcH8vysGSqESNiZGrDgaxXY5KdO3iA=", "owner": "divnix", "repo": "std", - "rev": "17dc4eb9587517397dad00617b020769fece3cfe", + "rev": "3ce88a33db33ae48ec0081f717e4f035812c3755", "type": "github" }, "original": { @@ -897,91 +577,22 @@ "type": "github" } }, - "std-ext": { - "inputs": { - "devshell": "devshell", - "flops": "flops", - "nixago": "nixago", - "nixpkgs": [ - "tenzir-devops", - "nixpkgs" - ], - "org-roam-book-template": [ - "tenzir-devops" - ], - "std": [ - "tenzir-devops", - "std" - ] - }, - "locked": { - "lastModified": 1691319692, - "narHash": "sha256-n2c/ULAPojGkQz5itVB9g7D1gaLxAJJ2tGaIpJGBfEE=", - "owner": "gtrunsec", - "repo": "std-ext", - "rev": "db6280ad2105c94813ddeedc9a9fe5b12937079e", - "type": "github" - }, - "original": { - "owner": "gtrunsec", - "repo": "std-ext", - "type": "github" - } - }, - "std-oci": { - "inputs": { - "arion": [ - "tenzir-devops", - "std-oci", - "blank" - ], - "blank": "blank_2", - "devshell": "devshell_2", - "dmerge": "dmerge_3", - "flake-utils": "flake-utils_7", - "incl": "incl_2", - "makes": [ - "tenzir-devops", - "std-oci", - "blank" - ], - "microvm": [ - "tenzir-devops", - "std-oci", - "blank" - ], - "n2c": [ - "tenzir-devops", - "n2c" - ], - "nixago": [ - "tenzir-devops", - "std-ext", - "nixago" - ], - "nixpkgs": [ - "tenzir-devops", - "nixpkgs" - ], - "paisano": "paisano_2", - "yants": "yants_3" - }, + "systems": { "locked": { - "lastModified": 1691357392, - "narHash": "sha256-7BiQyfCE0rRBXU1TECSsFt25C8tYkiVP/yXE+rl1dVg=", - "owner": "gtrunsec", - "repo": "std", - "rev": "15f9545da1d800212a0fa8ca8ccb0b60794fb5c3", + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", "type": "github" }, "original": { - "owner": "gtrunsec", - "ref": "mkDevOCI", - "repo": "std", + "owner": "nix-systems", + "repo": "default", "type": "github" } }, - "systems": { + "systems_2": { "locked": { "lastModified": 1681028828, "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", @@ -998,29 +609,25 @@ }, "tenzir-devops": { "inputs": { + "devshell": "devshell", "flake-parts": "flake-parts", - "flops": [ - "tenzir-devops", - "std-ext", - "flops" - ], "n2c": "n2c", + "nixago": "nixago", "nixpkgs": "nixpkgs", "nixpkgs-users": [ "tenzir-devops", "nixpkgs" ], - "std": "std", - "std-ext": "std-ext", - "std-oci": "std-oci" + "omnibus": "omnibus", + "std": "std" }, "locked": { "dir": "nix/devops", - "lastModified": 1691492090, - "narHash": "sha256-p8/ybRAL/Tmev54Zd3UKRyvop4JuJgD7pi9zhFPcOyw=", + "lastModified": 1699270317, + "narHash": "sha256-UxRJBS1rU4iD/MZhB2SjjjiEz0f+vty0b+0z1Q0YzbY=", "owner": "gtrunsec", "repo": "vast", - "rev": "3add8e933d01ccce81b8f42905d685785522fe7d", + "rev": "54b74fa23aa5b1af59ebbb26949debeea192834e", "type": "github" }, "original": { @@ -1033,12 +640,7 @@ }, "yants": { "inputs": { - "nixpkgs": [ - "tenzir-devops", - "std", - "haumea", - "nixpkgs" - ] + "nixpkgs": "nixpkgs_2" }, "locked": { "lastModified": 1686863218, @@ -1055,37 +657,20 @@ } }, "yants_2": { - "inputs": { - "nixpkgs": "nixpkgs_4" - }, - "locked": { - "lastModified": 1686863218, - "narHash": "sha256-kooxYm3/3ornWtVBNHM3Zh020gACUyFX2G0VQXnB+mk=", - "owner": "divnix", - "repo": "yants", - "rev": "8f0da0dba57149676aa4817ec0c880fbde7a648d", - "type": "github" - }, - "original": { - "owner": "divnix", - "repo": "yants", - "type": "github" - } - }, - "yants_3": { "inputs": { "nixpkgs": [ "tenzir-devops", - "std-oci", + "std", + "haumea", "nixpkgs" ] }, "locked": { - "lastModified": 1667096281, - "narHash": "sha256-wRRec6ze0gJHmGn6m57/zhz/Kdvp9HS4Nl5fkQ+uIuA=", + "lastModified": 1686863218, + "narHash": "sha256-kooxYm3/3ornWtVBNHM3Zh020gACUyFX2G0VQXnB+mk=", "owner": "divnix", "repo": "yants", - "rev": "d18f356ec25cb94dc9c275870c3a7927a10f8c3c", + "rev": "8f0da0dba57149676aa4817ec0c880fbde7a648d", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index b797ea8..fbc3351 100644 --- a/flake.nix +++ b/flake.nix @@ -1,23 +1,30 @@ { description = "The users' interface to the Tenzir platform"; - outputs = { - self, - tenzir-devops, - ... - } @ inputs: - ( - tenzir-devops.lib.mkStd {inherit inputs;} - ) + outputs = + { self, tenzir-devops, ... }@inputs: + (tenzir-devops.lib.mkStd { inherit inputs; }) // { - devShells = inputs.tenzir-devops.inputs.std.harvest inputs.self [["dev" "shells"]]; - templates = (inputs.tenzir-devops.inputs.std.harvest inputs.self ["dev" "lib"]).x86_64-linux.templates; + devShells = inputs.tenzir-devops.inputs.std.harvest inputs.self [ + [ + "dev" + "shells" + ] + ]; + templates = + (inputs.tenzir-devops.inputs.std.harvest inputs.self [ + "dev" + "lib" + ]).x86_64-linux.templates; }; inputs = { tenzir-devops.url = "github:gtrunsec/vast/devops?dir=nix/devops"; nixpkgs.follows = "tenzir-devops/nixpkgs"; }; nixConfig = { - extra-substituters = ["https://tenzir.cachix.org" "https://vast.cachix.org"]; + extra-substituters = [ + "https://tenzir.cachix.org" + "https://vast.cachix.org" + ]; extra-trusted-public-keys = [ "tenzir.cachix.org-1:+MLwldLx9GLGLsi9mDr5RrVYyI64iVobWpntJaPM50E=" "vast.cachix.org-1:0L8rErLUuFAdspyGYYQK3Sgs9PYRMzkLEqS2GxfaQhA=" diff --git a/prod/tasks/deploy-tenzir-aws/default.nix b/prod/tasks/deploy-tenzir-aws/default.nix deleted file mode 100644 index 91bdceb..0000000 --- a/prod/tasks/deploy-tenzir-aws/default.nix +++ /dev/null @@ -1,10 +0,0 @@ -makeScript { - name = "runScriptWithEnv"; - searchPaths.bin = [ - nixpkgs.awscli - ]; - searchPaths.source = [ - ./env - ]; - entrypoint = ./entrypoint.sh; -} diff --git a/units/cells/dev/configs/treefmt.nix b/units/cells/dev/configs/treefmt.nix new file mode 100644 index 0000000..cee8e56 --- /dev/null +++ b/units/cells/dev/configs/treefmt.nix @@ -0,0 +1,6 @@ +{ + formatter.prettier = { + command = "prettier"; + excludes = dmerge.append [ "generated-*.yaml" ]; + }; +} diff --git a/dev/shellProfiles/commands.toml b/units/cells/dev/shellsProfiles/commands.toml similarity index 100% rename from dev/shellProfiles/commands.toml rename to units/cells/dev/shellsProfiles/commands.toml diff --git a/dev/shellProfiles/packages.toml b/units/cells/dev/shellsProfiles/packages.toml similarity index 100% rename from dev/shellProfiles/packages.toml rename to units/cells/dev/shellsProfiles/packages.toml diff --git a/units/cells/dev/tasks/climod.md b/units/cells/dev/tasks/climod.md new file mode 100644 index 0000000..e7cc72a --- /dev/null +++ b/units/cells/dev/tasks/climod.md @@ -0,0 +1,37 @@ +# climod + +```nix +climod { + name = "demo"; + description = "Demo CLI generated"; + action.bash = '' + echo Hello, world + echo $# + while [ $# -gt 0 ]; do + echo "$1" + shift + done + ''; + target.bash.prelude = '' + echo "Starting..." + ''; + allowExtraArguments = true; + subcommands.args.description = "Print args"; + subcommands.args.allowExtraArguments = true; + subcommands.args.action.bash = '' + for line in "$@"; do + echo $line + done + ''; + subcommands.eoq.description = "Eoq subcommand"; + subcommands.eoq.subcommands.greet.description = "Greets the user"; + subcommands.eoq.subcommands.greet.action.bash = "echo Hello, $GREET_USER!"; + subcommands.eoq.subcommands.greet.flags = [ + { + description = "User name"; + keywords = ["-n" "--name"]; + variable = "GREET_USER"; + } + ]; +} +``` diff --git a/units/cells/dev/tasks/climod.nix b/units/cells/dev/tasks/climod.nix new file mode 100644 index 0000000..f6835f6 --- /dev/null +++ b/units/cells/dev/tasks/climod.nix @@ -0,0 +1,32 @@ +climod { + name = "demo"; + description = "Demo CLI generated"; + action.bash = '' + echo Hello, world + ''; + target.bash.prelude = '' + echo "This is a prelude" + ''; + allowExtraArguments = true; + subcommands.tasks.description = "Print args"; + subcommands.tasks.allowExtraArguments = true; + subcommands.tasks.action.bash = '' + # glow ${./climod.md} + echo Hello + ''; + subcommands.eoq.description = "Eoq subcommand"; + subcommands.tasks.subcommands.makeScript.description = "makes::fun => make a script"; + subcommands.tasks.subcommands.makeScript.action.bash = + let + md = '' + # example + + ```nix + ${builtins.readFile ./makes-test.nix} + ``` + ''; + in + '' + echo '${md}' | glow - + ''; +} diff --git a/units/cells/dev/tasks/makes-ps-tenzir/_env b/units/cells/dev/tasks/makes-ps-tenzir/_env new file mode 100644 index 0000000..357a7ed --- /dev/null +++ b/units/cells/dev/tasks/makes-ps-tenzir/_env @@ -0,0 +1,5 @@ +TENZIR_PLUGINS__PLATFORM__CONTROL_ENDPOINT="wss://ws.tenzir.app/production" +TENZIR_PLUGINS__PLATFORM__API_KEY="bVXe-Gtwr3VRKoOhDvUFldM35VAQTiteWca16rcX23c" +TENZIR_PLUGINS__PLATFORM__TENANT_ID="t-8937c5hz" +TENZIR_ENDPOINT=127.0.0.1:5158 +TENZIR_ALLOW_UNSAFE_PIPELINES=true diff --git a/dev/tasks/makes-ps-tenzir/default.nix b/units/cells/dev/tasks/makes-ps-tenzir/default.nix similarity index 58% rename from dev/tasks/makes-ps-tenzir/default.nix rename to units/cells/dev/tasks/makes-ps-tenzir/default.nix index 251b8ec..74ccb47 100644 --- a/dev/tasks/makes-ps-tenzir/default.nix +++ b/units/cells/dev/tasks/makes-ps-tenzir/default.nix @@ -1,21 +1,18 @@ makeScript { name = "process-compose-tenzir"; - searchPaths.bin = []; + searchPaths.bin = [ ]; searchPaths.source = [ ./env (makeEnvVars { name = "configs"; mapping = { tenzirConfig = ./tenzir.yaml; - extraWebFlags = "--bind=127.0.0.1"; + tenzirWebFlag = "--mode=dev --bind=127.0.0.1"; }; }) ]; entrypoint = '' - # automatically export all variables - set -a # keep the running directory in the top-level of git - cd $PRJ_ROOT - ${nixpkgs.lib.getExe tenzir-devops.packages.ps-tenzir-users} + (cd $PRJ_ROOT && ${nixpkgs.lib.getExe tenzir-devops.packages.ps-tenzir-users}) ''; } diff --git a/dev/tasks/makes-ps-tenzir/env b/units/cells/dev/tasks/makes-ps-tenzir/env similarity index 100% rename from dev/tasks/makes-ps-tenzir/env rename to units/cells/dev/tasks/makes-ps-tenzir/env diff --git a/dev/tasks/makes-ps-tenzir/tenzir.yaml b/units/cells/dev/tasks/makes-ps-tenzir/tenzir.yaml similarity index 100% rename from dev/tasks/makes-ps-tenzir/tenzir.yaml rename to units/cells/dev/tasks/makes-ps-tenzir/tenzir.yaml diff --git a/dev/tasks/makes-test.nix b/units/cells/dev/tasks/makes-test.nix similarity index 86% rename from dev/tasks/makes-test.nix rename to units/cells/dev/tasks/makes-test.nix index a787a23..7133c0f 100644 --- a/dev/tasks/makes-test.nix +++ b/units/cells/dev/tasks/makes-test.nix @@ -1,8 +1,6 @@ makeScript { name = "runScriptWithEnv"; - searchPaths.bin = [ - nixpkgs.hello - ]; + searchPaths.bin = [ nixpkgs.hello ]; searchPaths.source = [ (makeEnvVars { name = "firstEnvVarsOutput"; @@ -21,6 +19,6 @@ makeScript { ]; entrypoint = '' hello --help - echo $a + echo "$a" ''; } diff --git a/units/cells/dev/tasks/runScriptWithEnv.nix b/units/cells/dev/tasks/runScriptWithEnv.nix new file mode 100644 index 0000000..082ffdd --- /dev/null +++ b/units/cells/dev/tasks/runScriptWithEnv.nix @@ -0,0 +1,18 @@ +makeScript { + name = "runScriptWithEnv"; + searchPaths.bin = [ nixpkgs.hello ]; + searchPaths.source = [ + (makeEnvVars { + name = "firstEnvVarsOutput"; + mapping = { + a = "1"; + b = "2"; + VAR_NAME = "test"; + }; + }) + ]; + entrypoint = '' + hello --help + echo $a + ''; +} diff --git a/dev/tasks/script-json/default.json b/units/cells/dev/tasks/script-json/default.json similarity index 100% rename from dev/tasks/script-json/default.json rename to units/cells/dev/tasks/script-json/default.json diff --git a/dev/tasks/script-json/function.json b/units/cells/dev/tasks/script-json/function.json similarity index 100% rename from dev/tasks/script-json/function.json rename to units/cells/dev/tasks/script-json/function.json diff --git a/units/cells/dev/tasks/test.nix b/units/cells/dev/tasks/test.nix new file mode 100644 index 0000000..d73fae6 --- /dev/null +++ b/units/cells/dev/tasks/test.nix @@ -0,0 +1 @@ +{ tenzir-devops }@args: args diff --git a/prod/schemas/tenzir-sysmon.yaml b/units/cells/prod/schemas/tenzir-sysmon.yaml similarity index 100% rename from prod/schemas/tenzir-sysmon.yaml rename to units/cells/prod/schemas/tenzir-sysmon.yaml diff --git a/units/cells/prod/tasks/deploy-tenzir-aws/default.nix b/units/cells/prod/tasks/deploy-tenzir-aws/default.nix new file mode 100644 index 0000000..3029854 --- /dev/null +++ b/units/cells/prod/tasks/deploy-tenzir-aws/default.nix @@ -0,0 +1,6 @@ +makeScript { + name = "runScriptWithEnv"; + searchPaths.bin = [ nixpkgs.awscli ]; + searchPaths.source = [ ./env ]; + entrypoint = ./entrypoint.sh; +} diff --git a/prod/tasks/deploy-tenzir-aws/entrypoint.sh b/units/cells/prod/tasks/deploy-tenzir-aws/entrypoint.sh similarity index 100% rename from prod/tasks/deploy-tenzir-aws/entrypoint.sh rename to units/cells/prod/tasks/deploy-tenzir-aws/entrypoint.sh diff --git a/prod/tasks/deploy-tenzir-aws/env b/units/cells/prod/tasks/deploy-tenzir-aws/env similarity index 100% rename from prod/tasks/deploy-tenzir-aws/env rename to units/cells/prod/tasks/deploy-tenzir-aws/env