From ccbff32f83aacc42169762d6b525a722fdb8505e Mon Sep 17 00:00:00 2001 From: Robin Stumm Date: Wed, 23 Nov 2022 21:30:45 +0100 Subject: [PATCH] add std flake and tullia --- flake.lock | 447 +++++++++++++++++++++++++++++ flake.nix | 39 +++ nix/cells/automation/hydraJobs.nix | 9 + nix/cells/automation/pipelines.nix | 29 ++ nix/cells/cloud/actions.nix | 23 ++ nix/cells/cloud/library.nix | 6 + 6 files changed, 553 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 nix/cells/automation/hydraJobs.nix create mode 100644 nix/cells/automation/pipelines.nix create mode 100644 nix/cells/cloud/actions.nix create mode 100644 nix/cells/cloud/library.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..0803816 --- /dev/null +++ b/flake.lock @@ -0,0 +1,447 @@ +{ + "nodes": { + "blank": { + "locked": { + "lastModified": 1625557891, + "narHash": "sha256-O8/MWsPBGhhyPoPLHZAuoZiiHo9q6FLlEeIDEXuj6T4=", + "owner": "divnix", + "repo": "blank", + "rev": "5a5d2684073d9f563072ed07c871d577a6c614a8", + "type": "github" + }, + "original": { + "owner": "divnix", + "repo": "blank", + "type": "github" + } + }, + "devshell": { + "inputs": { + "flake-utils": [ + "tullia", + "std", + "flake-utils" + ], + "nixpkgs": [ + "tullia", + "std", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1663445644, + "narHash": "sha256-+xVlcK60x7VY1vRJbNUEAHi17ZuoQxAIH4S4iUFUGBA=", + "owner": "numtide", + "repo": "devshell", + "rev": "e3dc3e21594fe07bdb24bdf1c8657acaa4cb8f66", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "devshell", + "type": "github" + } + }, + "dmerge": { + "inputs": { + "nixlib": [ + "tullia", + "std", + "nixpkgs" + ], + "yants": [ + "tullia", + "std", + "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-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": 1659877975, + "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", + "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" + } + }, + "gomod2nix": { + "inputs": { + "nixpkgs": "nixpkgs", + "utils": "utils" + }, + "locked": { + "lastModified": 1655245309, + "narHash": "sha256-d/YPoQ/vFn1+GTmSdvbSBSTOai61FONxB4+Lt6w/IVI=", + "owner": "tweag", + "repo": "gomod2nix", + "rev": "40d32f82fc60d66402eb0972e6e368aeab3faf58", + "type": "github" + }, + "original": { + "owner": "tweag", + "repo": "gomod2nix", + "type": "github" + } + }, + "mdbook-kroki-preprocessor": { + "flake": false, + "locked": { + "lastModified": 1661755005, + "narHash": "sha256-1TJuUzfyMycWlOQH67LR63/ll2GDZz25I3JfScy/Jnw=", + "owner": "JoelCourtney", + "repo": "mdbook-kroki-preprocessor", + "rev": "93adb5716d035829efed27f65f2f0833a7d3e76f", + "type": "github" + }, + "original": { + "owner": "JoelCourtney", + "repo": "mdbook-kroki-preprocessor", + "type": "github" + } + }, + "n2c": { + "inputs": { + "flake-utils": "flake-utils_3", + "nixpkgs": [ + "tullia", + "std", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1665039323, + "narHash": "sha256-SAh3ZjFGsaCI8FRzXQyp56qcGdAqgKEfJWPCQ0Sr7tQ=", + "owner": "nlewo", + "repo": "nix2container", + "rev": "b008fe329ffb59b67bf9e7b08ede6ee792f2741a", + "type": "github" + }, + "original": { + "owner": "nlewo", + "repo": "nix2container", + "type": "github" + } + }, + "nix-nomad": { + "inputs": { + "flake-compat": "flake-compat", + "flake-utils": [ + "tullia", + "nix2container", + "flake-utils" + ], + "gomod2nix": "gomod2nix", + "nixpkgs": [ + "tullia", + "nixpkgs" + ], + "nixpkgs-lib": [ + "tullia", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1658277770, + "narHash": "sha256-T/PgG3wUn8Z2rnzfxf2VqlR1CBjInPE0l1yVzXxPnt0=", + "owner": "tristanpemble", + "repo": "nix-nomad", + "rev": "054adcbdd0a836ae1c20951b67ed549131fd2d70", + "type": "github" + }, + "original": { + "owner": "tristanpemble", + "repo": "nix-nomad", + "type": "github" + } + }, + "nix2container": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1658567952, + "narHash": "sha256-XZ4ETYAMU7XcpEeAFP3NOl9yDXNuZAen/aIJ84G+VgA=", + "owner": "nlewo", + "repo": "nix2container", + "rev": "60bb43d405991c1378baf15a40b5811a53e32ffa", + "type": "github" + }, + "original": { + "owner": "nlewo", + "repo": "nix2container", + "type": "github" + } + }, + "nixago": { + "inputs": { + "flake-utils": [ + "tullia", + "std", + "flake-utils" + ], + "nixago-exts": [ + "tullia", + "std", + "blank" + ], + "nixpkgs": [ + "tullia", + "std", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1661824785, + "narHash": "sha256-/PnwdWoO/JugJZHtDUioQp3uRiWeXHUdgvoyNbXesz8=", + "owner": "nix-community", + "repo": "nixago", + "rev": "8c1f9e5f1578d4b2ea989f618588d62a335083c3", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixago", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1653581809, + "narHash": "sha256-Uvka0V5MTGbeOfWte25+tfRL3moECDh1VwokWSZUdoY=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "83658b28fe638a170a19b8933aa008b30640fbd1", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1654807842, + "narHash": "sha256-ADymZpr6LuTEBXcy6RtFHcUZdjKTBRTMYwu19WOx17E=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "fc909087cc3386955f21b4665731dbdaceefb1d8", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { + "locked": { + "lastModified": 1653920503, + "narHash": "sha256-BBeCZwZImtjP3oYy4WogkQYy5OxNyfNciVSc1AfZgLQ=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "a634c8f6c1fbf9b9730e01764999666f3436f10a", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-22.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_4": { + "locked": { + "lastModified": 1665087388, + "narHash": "sha256-FZFPuW9NWHJteATOf79rZfwfRn5fE0wi9kRzvGfDHPA=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "95fda953f6db2e9496d2682c4fc7b82f959878f7", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": [ + "tullia", + "nixpkgs" + ], + "std": [ + "tullia", + "std" + ], + "tullia": "tullia" + } + }, + "std": { + "inputs": { + "blank": "blank", + "devshell": "devshell", + "dmerge": "dmerge", + "flake-utils": "flake-utils_2", + "makes": [ + "tullia", + "std", + "blank" + ], + "mdbook-kroki-preprocessor": "mdbook-kroki-preprocessor", + "microvm": [ + "tullia", + "std", + "blank" + ], + "n2c": "n2c", + "nixago": "nixago", + "nixpkgs": "nixpkgs_4", + "yants": "yants" + }, + "locked": { + "lastModified": 1665513321, + "narHash": "sha256-D6Pacw9yf/HMs84KYuCxHXnNDL7v43gtcka5URagFqE=", + "owner": "divnix", + "repo": "std", + "rev": "94a90eedb9cfc115b12ae8f6622d9904788559e4", + "type": "github" + }, + "original": { + "owner": "divnix", + "repo": "std", + "type": "github" + } + }, + "tullia": { + "inputs": { + "nix-nomad": "nix-nomad", + "nix2container": "nix2container", + "nixpkgs": "nixpkgs_3", + "std": "std" + }, + "locked": { + "lastModified": 1668711738, + "narHash": "sha256-CBjky16o9pqsGE1bWu6nRlRajgSXMEk+yaFQLibqXcE=", + "owner": "input-output-hk", + "repo": "tullia", + "rev": "ead1f515c251f0e060060ef0e2356a51d3dfe4b0", + "type": "github" + }, + "original": { + "owner": "input-output-hk", + "repo": "tullia", + "type": "github" + } + }, + "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" + } + }, + "yants": { + "inputs": { + "nixpkgs": [ + "tullia", + "std", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1660507851, + "narHash": "sha256-BKjq7JnVuUR/xDtcv6Vm9GYGKAblisXrAgybor9hT/s=", + "owner": "divnix", + "repo": "yants", + "rev": "0b895ca02a8fa72bad50b454cb3e7d8a66407c96", + "type": "github" + }, + "original": { + "owner": "divnix", + "repo": "yants", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..9758ce9 --- /dev/null +++ b/flake.nix @@ -0,0 +1,39 @@ +{ + inputs = { + nixpkgs.follows = "tullia/nixpkgs"; + std.follows = "tullia/std"; + tullia.url = github:input-output-hk/tullia; + }; + + outputs = { + self, + std, + tullia, + ... + } @ inputs: + std.growOn { + inherit inputs; + cellsFrom = nix/cells; + cellBlocks = [ + (std.functions "library") + (std.functions "hydraJobs") + (tullia.tasks "pipelines") + (std.functions "actions") + ]; + } + ( + tullia.fromStd { + actions = std.harvest self ["cloud" "actions"]; + tasks = std.harvest self ["automation" "pipelines"]; + } + ) + { + hydraJobs = std.harvest self ["automation" "hydraJobs"]; + }; + + nixConfig = { + extra-substituters = ["https://cache.iog.io"]; + extra-trusted-public-keys = ["hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ="]; + allow-import-from-derivation = true; + }; +} diff --git a/nix/cells/automation/hydraJobs.nix b/nix/cells/automation/hydraJobs.nix new file mode 100644 index 0000000..b8acd86 --- /dev/null +++ b/nix/cells/automation/hydraJobs.nix @@ -0,0 +1,9 @@ +{ + cell, + inputs, +}: + +import "${inputs.self}/release.nix" { + smash = inputs.self; + supportedSystems = [inputs.nixpkgs.system]; +} diff --git a/nix/cells/automation/pipelines.nix b/nix/cells/automation/pipelines.nix new file mode 100644 index 0000000..bf47651 --- /dev/null +++ b/nix/cells/automation/pipelines.nix @@ -0,0 +1,29 @@ +{ + inputs, + cell, +}: { + ci = {config, lib, ...}: { + preset = { + nix.enable = true; + + github.ci = { + # Tullia tasks can run locally or on Cicero. + # When no facts are present we know that we are running locally and vice versa. + # When running locally, the current directory is already bind-mounted into the container, + # so we don't need to fetch the source from GitHub and we don't want to report a GitHub status. + enable = config.actionRun.facts != {}; + repository = "input-output-hk/smash"; + revision = config.preset.github.lib.readRevision inputs.cells.cloud.library.actionCiInputName null; + }; + }; + + command.text = config.preset.github.status.lib.reportBulk { + bulk.text = "nix eval .#hydraJobs --apply __attrNames --json | nix-systems -i"; + each.text = ''nix build -L .#hydraJobs."$1".required''; + skippedDescription = lib.escapeShellArg "No nix builder available for this system"; + }; + + memory = 1024 * 8; + nomad.resources.cpu = 10000; + }; +} diff --git a/nix/cells/cloud/actions.nix b/nix/cells/cloud/actions.nix new file mode 100644 index 0000000..d91bcf9 --- /dev/null +++ b/nix/cells/cloud/actions.nix @@ -0,0 +1,23 @@ +{ + cell, + inputs, +}: { + "smash/ci" = { + task = "ci"; + io = '' + // This is a CUE expression that defines what events trigger a new run of this action. + // There is no documentation for this yet. Ask SRE if you have trouble changing this. + + let github = { + #input: "${cell.library.actionCiInputName}" + #repo: "input-output-hk/smash" + } + + #lib.merge + #ios: [ + #lib.io.github_push & github, + { #lib.io.github_pr, github, #target_default: false }, + ] + ''; + }; +} diff --git a/nix/cells/cloud/library.nix b/nix/cells/cloud/library.nix new file mode 100644 index 0000000..1185023 --- /dev/null +++ b/nix/cells/cloud/library.nix @@ -0,0 +1,6 @@ +{ + inputs, + cell, +}: { + actionCiInputName = "GitHub event"; +}