Skip to content

Commit

Permalink
tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
zupo committed Jul 16, 2023
1 parent 708a905 commit 3523621
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 78 deletions.
21 changes: 6 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,25 +34,16 @@ 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"

- 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"
73 changes: 18 additions & 55 deletions default.nix
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -36,6 +24,7 @@ let
# Python helper scripts
geckodriver
poetry
poetryEnv

]

Expand All @@ -53,7 +42,7 @@ let
pre-commit install -f --hook-type pre-push
fi
dest=${toString buildSrc}/node_modules
dest=./node_modules
${copyGeneratedFiles}
'';
};
Expand All @@ -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;
Expand Down
8 changes: 0 additions & 8 deletions nix/default.nix
Original file line number Diff line number Diff line change
@@ -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;
Expand Down

0 comments on commit 3523621

Please sign in to comment.