diff --git a/.github/workflows/cd-pypi.yml b/.github/workflows/cd-pypi.yml index 77e1bfc59..761b685d5 100644 --- a/.github/workflows/cd-pypi.yml +++ b/.github/workflows/cd-pypi.yml @@ -16,6 +16,8 @@ jobs: uses: actions/checkout@v4 - name: "[INIT] Install uv" uses: astral-sh/setup-uv@v5 + with: + python-version: "3.10" - name: "[EXEC] Build project" run: uv build - name: "[EXEC] Publish package" diff --git a/.github/workflows/ci-lint-test.yml b/.github/workflows/ci-lint-test.yml index aae836103..063cfb808 100644 --- a/.github/workflows/ci-lint-test.yml +++ b/.github/workflows/ci-lint-test.yml @@ -8,15 +8,13 @@ jobs: defaults: run: shell: bash - strategy: - matrix: - python: ["3.10"] steps: - name: "[INIT] Checkout repository" - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: "[INIT] Install uv" uses: astral-sh/setup-uv@v5 with: + python-version: "3.10" enable-cache: true - name: "[INIT] Install dependencies" run: uv sync --locked --all-extras --dev @@ -37,10 +35,11 @@ jobs: os: [ubuntu-latest, macos-latest, windows-latest] steps: - name: "[INIT] Checkout repository" - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: "[INIT] Install uv" uses: astral-sh/setup-uv@v5 with: + python-version: ${{ matrix.python }} enable-cache: true - name: "[INIT] Install dependencies" run: uv sync --locked --all-extras --dev --group test diff --git a/flake.lock b/flake.lock index 6ec37f548..98a4eced2 100644 --- a/flake.lock +++ b/flake.lock @@ -41,7 +41,9 @@ "inputs": { "flake-compat": "flake-compat", "gitignore": "gitignore", - "nixpkgs": "nixpkgs" + "nixpkgs": [ + "nixpkgs" + ] }, "locked": { "lastModified": 1741379162, @@ -59,27 +61,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1730768919, - "narHash": "sha256-8AKquNnnSaJRXZxc5YmF/WfmxiHX6MMZZasRP6RRQkE=", + "lastModified": 1749494155, + "narHash": "sha256-FG4DEYBpROupu758beabUk9lhrblSf5hnv84v1TLqMc=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "a04d33c0c3f1a59a2c1cb0c6e34cd24500e5a1dc", - "type": "github" - }, - "original": { - "owner": "NixOS", - "ref": "nixpkgs-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "nixpkgs_2": { - "locked": { - "lastModified": 1748889542, - "narHash": "sha256-Hb4iMhIbjX45GcrgOp3b8xnyli+ysRPqAgZ/LZgyT5k=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "10d7f8d34e5eb9c0f9a0485186c1ca691d2c5922", + "rev": "88331c17ba434359491e8d5889cce872464052c2", "type": "github" }, "original": { @@ -112,42 +98,8 @@ "root": { "inputs": { "hooks": "hooks", - "nixpkgs": "nixpkgs_2", - "pyproject": "pyproject", - "utils": "utils" - } - }, - "systems": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - }, - "utils": { - "inputs": { - "systems": "systems" - }, - "locked": { - "lastModified": 1731533236, - "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" + "nixpkgs": "nixpkgs", + "pyproject": "pyproject" } } }, diff --git a/flake.nix b/flake.nix index 5e32e8567..4536c0402 100644 --- a/flake.nix +++ b/flake.nix @@ -1,9 +1,11 @@ # TODO: use uv2nix { inputs = { - utils.url = "github:numtide/flake-utils"; - hooks.url = "github:cachix/git-hooks.nix"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05"; + hooks = { + url = "github:cachix/git-hooks.nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; pyproject = { url = "github:pyproject-nix/pyproject.nix"; inputs.nixpkgs.follows = "nixpkgs"; @@ -13,53 +15,71 @@ outputs = { self, hooks, - utils, nixpkgs, pyproject, ... - }: - utils.lib.eachDefaultSystem (system: let - pkgs = import nixpkgs {inherit system;}; + }: let + forAllSystems = function: + nixpkgs.lib.genAttrs [ + "x86_64-linux" + "aarch64-linux" + "x86_64-darwin" + "aarch64-darwin" + ] (system: function system nixpkgs.legacyPackages.${system}); + project = pyproject.lib.project.loadPyproject {projectRoot = ./.;}; + in { + devShells = forAllSystems (system: pkgs: let python = pkgs.python312; - project = pyproject.lib.project.loadPyproject {projectRoot = ./.;}; + arg = project.renderers.withPackages {inherit python;}; + pyenv = python.withPackages arg; + check = self.checks.${system}.pre-commit-check; in { - devShells.default = let - arg = project.renderers.withPackages {inherit python;}; - pyenv = python.withPackages arg; - check = self.checks.${system}.pre-commit-check; - in - pkgs.mkShell { - inherit (check) shellHook; + default = pkgs.mkShell { + inherit (check) shellHook; - packages = check.enabledPackages ++ [ + packages = + check.enabledPackages + ++ [ pyenv pkgs.uv pkgs.pyright + pkgs.hyperfine ]; - }; + }; + }); - packages.default = let - attrs = project.renderers.buildPythonPackage {inherit python;}; - in - python.pkgs.buildPythonPackage attrs; + packages = forAllSystems (system: pkgs: let + python = pkgs.python312; + attrs = project.renderers.buildPythonPackage {inherit python;}; + in { + default = python.pkgs.buildPythonPackage attrs; + }); - apps.default = { + apps = forAllSystems (system: _: { + default = { type = "app"; program = "${self.packages.${system}.default}/bin/proselint"; }; + }); - checks = { - pre-commit-check = hooks.lib.${system}.run { - src = ./.; - hooks = { - trim-trailing-whitespace.enable = true; - end-of-file-fixer.enable = true; - mixed-line-endings.enable = true; - markdownlint.enable = true; - ruff.enable = true; - pyright.enable = true; + checks = forAllSystems (system: _: { + pre-commit-check = hooks.lib.${system}.run { + src = ./.; + hooks = { + trim-trailing-whitespace.enable = true; + end-of-file-fixer.enable = true; + mixed-line-endings.enable = true; + markdownlint.enable = true; + ruff.enable = true; + pyright.enable = true; + convco.enable = true; + alejandra.enable = true; + statix = { + enable = true; + settings.ignore = ["/.direnv"]; }; }; }; }); + }; }