diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 77e065b..ade0540 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,6 +34,12 @@ jobs: with: cachix_auth_token: '${{ secrets.CACHIX_AUTH_TOKEN_PUBLIC }}' + - uses: lhotari/action-upterm@v1 + with: + limit-access-to-actor: true + env: + CACHIX_AUTH_TOKEN_PUBLIC: ${{ secrets.CACHIX_AUTH_TOKEN_PUBLIC }} + - run: nix-shell --run "make lint all=true" - run: nix-shell --run "make tests" @@ -41,18 +47,3 @@ jobs: - run: nix-shell --run "make dist" - uses: ./.github/actions/uncommitted-changes - -# yamllint disable -# TODO: publishing workflow - # steps: - # - checkout - - # - configure_nix - - # - run: - # name: Authenticate with registry - # command: echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > ~/salarycalc/.npmrc - - # - run: - # name: Publish the package to NPM - # command: nix-shell --run "npm version --no-git-tag-version prerelease --preid $(date +%Y-%m-%dT%H-%M-%S) && make dist && npm publish" diff --git a/default.nix b/default.nix index 0633f18..90dcb6c 100644 --- a/default.nix +++ b/default.nix @@ -1,22 +1,10 @@ -{ pkgs ? import ./nix { } -# Allows CI to override this to an empty directory to determine dependencies -# Which then can get cached without the source code itself -, buildSrc ? ./. -}: +{ pkgs ? import ./nix { } }: let - buildableShell = import ./nix/buildableShell.nix { - inherit pkgs; - # We reimport this file with buildSrc set to /var/empty such that the dev env to - # upload to cachix doesn't depend on where the project is located in the filesystem - drv = (import ./. { buildSrc = "/var/empty"; }).devShell; - }; - # The development shell definition devShell = pkgs.mkShell { buildInputs = with pkgs; [ # common tooling - devEnv gitAndTools.pre-commit niv vim @@ -36,6 +24,7 @@ let # Python helper scripts geckodriver poetry + poetryEnv ] @@ -53,7 +42,7 @@ let pre-commit install -f --hook-type pre-push fi - dest=${toString buildSrc}/node_modules + dest=./node_modules ${copyGeneratedFiles} ''; }; @@ -80,54 +69,28 @@ let ''; # Python stuff - removePytestRunner = pkg: pkg.overrideAttrs (old: { - postPatch = old.postPatch or "" + '' - substituteInPlace setup.py \ - --replace "'pytest-runner'," "" \ - --replace "'pytest-runner'" "" \ - --replace '"pytest-runner",' "" \ - --replace '"pytest-runner"' "" - ''; - }); - - poetryOverrides = self: super: { - # Fails when trying to update Nix packages. Research Done here: https://github.com/teamniteo/kai/issues/238 - flake8-debugger = removePytestRunner super.flake8-debugger; - flake8-mutable = removePytestRunner super.flake8-mutable; - flake8-print = removePytestRunner super.flake8-print; - - isort = super.isort.overridePythonAttrs ( - old: { - buildInputs = (old.buildInputs or [ ]) ++ [ super.poetry ]; - }); - - flake8-assertive = super.flake8-assertive.overridePythonAttrs ( - old: { - buildInputs = (old.buildInputs or [ ]) ++ [ super.setuptools ]; - }); - - }; - - commonPoetryArgs = { - projectDir = ./.; + poetryEnv = pkgs.poetry2nix.mkPoetryEnv { python = pkgs.python311; - overrides = [ - pkgs.poetry2nix.defaultPoetryOverrides - poetryOverrides - ]; - }; - - # All dev and non-dev dependencies with knowledge of the salarycalc module in the source - devEnv = pkgs.poetry2nix.mkPoetryEnv (commonPoetryArgs // { + projectDir = ./.; editablePackageSources = { - salarycalc = buildSrc + "./"; + salarycalc = ./.; }; - }); + overrides = pkgs.poetry2nix.defaultPoetryOverrides.extend(self: super: { + isort = super.isort.overridePythonAttrs ( + old: { + buildInputs = (old.buildInputs or [ ]) ++ [ super.poetry ]; + }); + + flake8-assertive = super.flake8-assertive.overridePythonAttrs ( + old: { + buildInputs = (old.buildInputs or [ ]) ++ [ super.setuptools ]; + }); + }); + }; in { inherit devShell; - inherit buildableShell; # Used to install dependencies for CI and Heroku inherit pkgs; diff --git a/nix/default.nix b/nix/default.nix index 0aad8ba..c25df77 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -1,14 +1,6 @@ { sources ? import ./sources.nix }: - # currently using the fork at - # https://github.com/Infinisil/yarn2nix/tree/yarnnix which includes - # https://github.com/NixOS/nixpkgs/pull/92856 (the current yarn2nix Nix code - # comes from the yarn2nix module, but it's included in nixpkgs in the future) - # yarn2nix = import sources.yarn2nix { - # inherit pkgs; - # nodejs = pkgs.nodejs-10_x; - # }; let overlay = final: pkgs: { gitignoreSource = (import sources.gitignore { inherit (pkgs) lib; }).gitignoreSource;