From 984f4cfa24ee7e421bb1fbdf5907ae60375cf9ef Mon Sep 17 00:00:00 2001 From: seth Date: Mon, 29 Jul 2024 04:53:25 -0400 Subject: use github contents api for image urls + summer cleaning (#253) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * nix: alejandra -> nixfmt-rfc-style * nix: pre-commit-hooks -> treefmt-nix * nix: use corepack * ci: cleanup workflows * ci: use better dependabot scopes * gitignore: extend with github templates * remove teawie-archive submodule * pnpm: 8.8.0 -> 9.6.0 * nix: add nrr to shell * nix: add node lsps to shell * use github contents api for image urls * ci: cleanup workflows * nix: add ci shell * `octokit` -> `fetch` & cache responses * nix: use nixpkgs wrangler * nix: update flake.lock Flake lock file updates: • Updated input 'nixpkgs': 'github:NixOS/nixpkgs/d9c0b9d611277e42e6db055636ba0409c59db6d2' (2024-07-05) → 'github:NixOS/nixpkgs/038fb464fcfa79b4f08131b07f2d8c9a6bcc4160' (2024-07-28) * tsconfig: use strictest * adopt openapi * package.json: rename to teawie-api * nix: add treefmt to ci shell * ci: add release gate --- flake.nix | 100 ++++++++++++++++++++++++++++++++------------------------------ 1 file changed, 52 insertions(+), 48 deletions(-) (limited to 'flake.nix') diff --git a/flake.nix b/flake.nix index 96cc880..94b8099 100644 --- a/flake.nix +++ b/flake.nix @@ -7,19 +7,15 @@ inputs.nixpkgs-lib.follows = "nixpkgs"; }; - pre-commit = { - url = "github:cachix/pre-commit-hooks.nix"; + treefmt-nix = { + url = "github:numtide/treefmt-nix"; inputs.nixpkgs.follows = "nixpkgs"; - inputs.nixpkgs-stable.follows = "nixpkgs"; }; }; - outputs = { - parts, - pre-commit, - ... - } @ inputs: - parts.lib.mkFlake {inherit inputs;} { + outputs = + { parts, treefmt-nix, ... }@inputs: + parts.lib.mkFlake { inherit inputs; } { systems = [ "x86_64-linux" "aarch64-linux" @@ -27,55 +23,63 @@ "aarch64-darwin" ]; - imports = [pre-commit.flakeModule]; + imports = [ treefmt-nix.flakeModule ]; - perSystem = { - config, - pkgs, - ... - }: { - devShells.default = pkgs.mkShellNoCC { - shellHook = '' - [ ! -d node_modules ] && pnpm install --frozen-lockfile - ${config.pre-commit.installationScript} - ''; + perSystem = + { self', pkgs, ... }: + { + devShells = { + default = pkgs.mkShellNoCC { + packages = with pkgs; [ + # node + nodejs_20 + corepack_20 + wrangler + nrr + typescript-language-server + vscode-langservers-extracted # for eslint server - packages = with pkgs; [ - nodejs_20 - (nodePackages_latest.pnpm.override {nodejs = nodejs_20;}) + # github actions + actionlint - actionlint - editorconfig-checker + # nix + self'.formatter + nil + statix + ]; - config.formatter - deadnix - nil - statix - ]; - }; - - formatter = pkgs.alejandra; + env = { + # https://github.com/NixOS/nixpkgs/pull/330808 + SSL_CERT_FILE = "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt"; + }; + }; - pre-commit.settings = { - hooks = { - actionlint.enable = true; - editorconfig-checker.enable = true; + ci = pkgs.mkShellNoCC { + shellHook = '' + corepack install + ''; - # typescript - eslint.enable = true; - prettier.enable = true; + packages = with pkgs; [ + nodejs_20 + corepack_20 + nrr - # nix - ${config.formatter.pname}.enable = true; - deadnix.enable = true; - nil.enable = true; - statix.enable = true; + self'.formatter + ]; + }; }; - settings = { - eslint.extensions = "\\.(js|jsx|ts|tsx)$"; + treefmt = { + projectRootFile = ".git/config"; + + programs = { + actionlint.enable = true; + deadnix.enable = true; + nixfmt.enable = true; + prettier.enable = true; + statix.enable = true; + }; }; }; - }; }; } -- cgit v1.2.3