From 7a5dc53e1ef7dcab31a1a74b84b85c8719241b9e Mon Sep 17 00:00:00 2001 From: Chris Martin Date: Wed, 9 Oct 2024 15:35:27 -0600 Subject: [PATCH] add haskell-openapi3-code-generator --- main/checks.nix | 1 + main/flake.lock | 255 +++++++++++++++++- main/flake.nix | 1 + .../checks.nix | 30 +++ .../packages.nix | 5 + main/packages.nix | 1 + 6 files changed, 280 insertions(+), 13 deletions(-) create mode 100644 main/haskell-openapi3-code-generator/checks.nix create mode 100644 main/haskell-openapi3-code-generator/packages.nix diff --git a/main/checks.nix b/main/checks.nix index 3386515..b53037b 100644 --- a/main/checks.nix +++ b/main/checks.nix @@ -15,6 +15,7 @@ let ./cypress/checks.nix ./fourmolu/checks.nix ./ghc/checks.nix + ./haskell-openapi3-code-generator/checks.nix ./locize-cli/checks.nix ./nodejs/checks.nix ./prettier/checks.nix diff --git a/main/flake.lock b/main/flake.lock index c9e0e93..235a73d 100644 --- a/main/flake.lock +++ b/main/flake.lock @@ -1,5 +1,37 @@ { "nodes": { + "autodocodec": { + "flake": false, + "locked": { + "lastModified": 1722952210, + "narHash": "sha256-+vz0En2dkS0nfOq12QAJtV6GcdP0WoDv7HwzrMIsnGo=", + "owner": "NorfairKing", + "repo": "autodocodec", + "rev": "ac36615cb344ec43259fb65cafe3e55308ce4662", + "type": "github" + }, + "original": { + "owner": "NorfairKing", + "repo": "autodocodec", + "type": "github" + } + }, + "flake-compat": { + "flake": false, + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, "flake-utils": { "inputs": { "systems": "systems" @@ -18,6 +50,70 @@ "type": "github" } }, + "flake-utils_2": { + "inputs": { + "systems": "systems_2" + }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "haskell-openapi-code-generator", + "pre-commit-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "haskell-openapi-code-generator": { + "inputs": { + "autodocodec": "autodocodec", + "flake-utils": "flake-utils_2", + "nixpkgs": "nixpkgs", + "pre-commit-hooks": "pre-commit-hooks", + "safe-coloured-text": "safe-coloured-text", + "sydtest": "sydtest", + "validity": "validity" + }, + "locked": { + "lastModified": 1723367996, + "narHash": "sha256-maI3mrsCCt+su8PBuLmVtznwyaR8e4xKGgmu7qKW6l8=", + "owner": "Haskell-OpenAPI-Code-Generator", + "repo": "Haskell-OpenAPI-Client-Code-Generator", + "rev": "3ab804875a272cf51b9faeab04c2f7afd2628a25", + "type": "github" + }, + "original": { + "owner": "Haskell-OpenAPI-Code-Generator", + "repo": "Haskell-OpenAPI-Client-Code-Generator", + "type": "github" + } + }, "nix-github-actions": { "inputs": { "nixpkgs": [ @@ -40,16 +136,16 @@ }, "nixpkgs": { "locked": { - "lastModified": 1722185531, - "narHash": "sha256-veKR07psFoJjINLC8RK4DiLniGGMgF3QMlS4tb74S6k=", - "owner": "nixos", + "lastModified": 1722987190, + "narHash": "sha256-68hmex5efCiM2aZlAAEcQgmFI4ZwWt8a80vOeB/5w3A=", + "owner": "NixOS", "repo": "nixpkgs", - "rev": "52ec9ac3b12395ad677e8b62106f0b98c1f8569d", + "rev": "21cc704b5e918c5fbf4f9fff22b4ac2681706d90", "type": "github" }, "original": { - "owner": "nixos", - "ref": "nixos-unstable", + "owner": "NixOS", + "ref": "nixos-24.05", "repo": "nixpkgs", "type": "github" } @@ -200,15 +296,15 @@ }, "nixpkgs-stable": { "locked": { - "lastModified": 1728328465, - "narHash": "sha256-a0a0M1TmXMK34y3M0cugsmpJ4FJPT/xsblhpiiX1CXo=", - "owner": "nixos", + "lastModified": 1720386169, + "narHash": "sha256-NGKVY4PjzwAa4upkGtAMz1npHGoRzWotlSnVlqI40mo=", + "owner": "NixOS", "repo": "nixpkgs", - "rev": "1bfbbbe5bbf888d675397c66bfdb275d0b99361c", + "rev": "194846768975b7ad2c4988bdb82572c00222c0d7", "type": "github" }, "original": { - "owner": "nixos", + "owner": "NixOS", "ref": "nixos-24.05", "repo": "nixpkgs", "type": "github" @@ -230,6 +326,22 @@ "type": "github" } }, + "nixpkgs-stable_2": { + "locked": { + "lastModified": 1728328465, + "narHash": "sha256-a0a0M1TmXMK34y3M0cugsmpJ4FJPT/xsblhpiiX1CXo=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "1bfbbbe5bbf888d675397c66bfdb275d0b99361c", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-24.05", + "repo": "nixpkgs", + "type": "github" + } + }, "nixpkgs-unstable-2023-10-21": { "locked": { "lastModified": 1697793076, @@ -310,6 +422,38 @@ "type": "github" } }, + "nixpkgs_2": { + "locked": { + "lastModified": 1719082008, + "narHash": "sha256-jHJSUH619zBQ6WdC21fFAlDxHErKVDJ5fpN0Hgx4sjs=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "9693852a2070b398ee123a329e68f0dab5526681", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { + "locked": { + "lastModified": 1722185531, + "narHash": "sha256-veKR07psFoJjINLC8RK4DiLniGGMgF3QMlS4tb74S6k=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "52ec9ac3b12395ad677e8b62106f0b98c1f8569d", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "pgp-wordlist": { "flake": false, "locked": { @@ -326,9 +470,31 @@ "type": "github" } }, + "pre-commit-hooks": { + "inputs": { + "flake-compat": "flake-compat", + "gitignore": "gitignore", + "nixpkgs": "nixpkgs_2", + "nixpkgs-stable": "nixpkgs-stable" + }, + "locked": { + "lastModified": 1723202784, + "narHash": "sha256-qbhjc/NEGaDbyy0ucycubq4N3//gDFFH3DOmp1D3u1Q=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "c7012d0c18567c889b948781bc74a501e92275d1", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, "root": { "inputs": { "flake-utils": "flake-utils", + "haskell-openapi-code-generator": "haskell-openapi-code-generator", "nix-github-actions": "nix-github-actions", "nixpkgs-22-11": "nixpkgs-22-11", "nixpkgs-23-05": "nixpkgs-23-05", @@ -339,7 +505,7 @@ "nixpkgs-master-2023-07-18": "nixpkgs-master-2023-07-18", "nixpkgs-master-2023-09-15": "nixpkgs-master-2023-09-15", "nixpkgs-master-2024-01-27": "nixpkgs-master-2024-01-27", - "nixpkgs-stable": "nixpkgs-stable", + "nixpkgs-stable": "nixpkgs-stable_2", "nixpkgs-stable-2023-07-25": "nixpkgs-stable-2023-07-25", "nixpkgs-unstable-2023-10-21": "nixpkgs-unstable-2023-10-21", "nixpkgs-unstable-2024-02-20": "nixpkgs-unstable-2024-02-20", @@ -349,9 +515,25 @@ "stack-lint-extra-deps": "stack-lint-extra-deps" } }, + "safe-coloured-text": { + "flake": false, + "locked": { + "lastModified": 1722709522, + "narHash": "sha256-zglWqKISYz34A+/PvqwvwrbQYSEcko8C595VAeINitw=", + "owner": "NorfairKing", + "repo": "safe-coloured-text", + "rev": "046f10147a058c00c2706d98c341219e3cbc7669", + "type": "github" + }, + "original": { + "owner": "NorfairKing", + "repo": "safe-coloured-text", + "type": "github" + } + }, "stack-lint-extra-deps": { "inputs": { - "nixpkgs": "nixpkgs", + "nixpkgs": "nixpkgs_3", "pgp-wordlist": "pgp-wordlist", "stacklock2nix": "stacklock2nix" }, @@ -384,6 +566,22 @@ "type": "github" } }, + "sydtest": { + "flake": false, + "locked": { + "lastModified": 1722766036, + "narHash": "sha256-i7N8HKkFPUfnOOmj47Di/XnQS66mUzTG6HISUccNhOA=", + "owner": "NorfairKing", + "repo": "sydtest", + "rev": "23baea50a08857baf3121fc55096c40a93ff5f17", + "type": "github" + }, + "original": { + "owner": "NorfairKing", + "repo": "sydtest", + "type": "github" + } + }, "systems": { "locked": { "lastModified": 1681028828, @@ -398,6 +596,37 @@ "repo": "default", "type": "github" } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "validity": { + "flake": false, + "locked": { + "lastModified": 1722943924, + "narHash": "sha256-hq5FwDFW+02u5Qsx8v1KWoQUsY6S6ufI4WYKZ6yhYUA=", + "owner": "NorfairKing", + "repo": "validity", + "rev": "51b8843b9bd5228160b99f653d3271147245d689", + "type": "github" + }, + "original": { + "owner": "NorfairKing", + "repo": "validity", + "type": "github" + } } }, "root": "root", diff --git a/main/flake.nix b/main/flake.nix index 40aa8ae..4b686ba 100644 --- a/main/flake.nix +++ b/main/flake.nix @@ -20,6 +20,7 @@ flake-utils.url = "github:numtide/flake-utils"; nix-github-actions.url = "github:nix-community/nix-github-actions"; nix-github-actions.inputs.nixpkgs.follows = "nixpkgs-stable"; + haskell-openapi-code-generator.url = "github:Haskell-OpenAPI-Code-Generator/Haskell-OpenAPI-Client-Code-Generator"; }; outputs = inputs: diff --git a/main/haskell-openapi3-code-generator/checks.nix b/main/haskell-openapi3-code-generator/checks.nix new file mode 100644 index 0000000..6a0be8d --- /dev/null +++ b/main/haskell-openapi3-code-generator/checks.nix @@ -0,0 +1,30 @@ +{ + inputs, + system, + packages, + ... +}: +let + nixpkgs = import inputs.nixpkgs-stable { + inherit system; + config = { }; + }; + inherit (nixpkgs) writeText runCommand; + inherit (nixpkgs.lib.attrsets) recursiveUpdate; + inherit (nixpkgs.testers) testEqualContents; + + check = + package: + testEqualContents { + assertion = "haskell-openapi3-code-generator runs"; + expected = writeText "expected" '' + Generate Haskell code from OpenAPI 3 specifications + ''; + actual = runCommand "actual" { nativeBuildInputs = [ package ]; } '' + openapi3-code-generator-exe -h | head -n1 > $out + ''; + }; +in +{ + haskell-openapi3-code-generator-default = check packages.haskell-openapi3-code-generator-default; +} diff --git a/main/haskell-openapi3-code-generator/packages.nix b/main/haskell-openapi3-code-generator/packages.nix new file mode 100644 index 0000000..9cb450e --- /dev/null +++ b/main/haskell-openapi3-code-generator/packages.nix @@ -0,0 +1,5 @@ +{ inputs, system, ... }: +rec { + haskell-openapi3-code-generator-default = + inputs.haskell-openapi-code-generator.packages.${system}.default; +} diff --git a/main/packages.nix b/main/packages.nix index 2a31578..97c9643 100644 --- a/main/packages.nix +++ b/main/packages.nix @@ -10,6 +10,7 @@ let ./cypress/packages.nix ./fourmolu/packages.nix ./ghc/packages.nix + ./haskell-openapi3-code-generator/packages.nix ./locize-cli/packages.nix ./nodejs/packages.nix ./prettier/packages.nix