Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor dev script improvements #433

Merged
merged 3 commits into from
Mar 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,14 @@ jobs:

- uses: cachix/install-nix-action@v22
with:
nix_path: nixpkgs=https://github.com/NixOS/nixpkgs/archive/43862987c3cf2554a542c6dd81f5f37435eb1423.tar.gz # keep in sync with shell.nix
nix_path: nixpkgs=https://github.com/NixOS/nixpkgs/archive/880992dcc006a5e00dd0591446fdf723e6a51a64.tar.gz # keep in sync with shell.nix
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A bit random to bump this in this commit.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, but the newer version of nixpkgs is needed for wait4x...


- name: Wait for nix daemon to start
if: runner.os == 'macOS'
run: wait4path /nix/var/nix/profiles/per-user

- name: setup direnv
uses: JRMurr/[email protected]
with:
install-nix: "false" # we already install nix
cache-store: "false" # turned out to be faster without the cache
- name: Initialize nix environment
run: nix-shell --run true

- name: Setup backend pypackages cache
uses: actions/cache@v3
Expand All @@ -46,7 +43,7 @@ jobs:
key: ${{ runner.os }}-${{ runner.arch }}-pypackages-${{ hashFiles('worker/pdm.lock', 'proto/transcribee_proto/*.py') }}

- name: install dependencies
run: ./packaging/install_dependencies.sh
run: nix-shell --run ./packaging/install_dependencies.sh

- name: cache pre-commit env
uses: actions/cache@v3
Expand All @@ -55,4 +52,4 @@ jobs:
key: ${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.pre-commit-config.yaml') }}

- name: run pre-commit
run: pre-commit run --show-diff-on-failure --color=always --all-files
run: nix-shell --run 'pre-commit run --show-diff-on-failure --color=always --all-files'
2 changes: 1 addition & 1 deletion packaging/Procfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ backend: ./start_backend.sh
worker: pdm run -p ../worker/ start --coordinator http://127.0.0.1:8000 --token dev_worker --reload
frontend: pnpm --prefix ../frontend/ dev --clearScreen false
db: ./start_db.sh
redis: redis-server
redis: redis-server --dir "$(realpath ../backend/db)"
1 change: 1 addition & 0 deletions packaging/setup_backend.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
set -euxo pipefail

echo -e "\033[1m# setting up backend:\033[0m\n"
wait4x postgresql "postgres://@/transcribee?host=$(pwd)/../backend/db/sockets/"
pdm run -p ../backend/ migrate
pdm run -p ../backend/ create_user --user test --pass test
pdm run -p ../backend/ create_worker --token dev_worker --name "Development Worker"
22 changes: 6 additions & 16 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -1,23 +1,11 @@
{pkgs ? import <nixpkgs> {}}:
let
# We use a fixed version of nixpkgs here, so we get a recent enough version of
# pdm (2.4.6 at the time of writing). The version shipped in current (as of 12-03-23)
# nixpkgs-stable does not support dependencies with relative paths
pkgs = import
(fetchTarball {
name = "nixpkgs-unstable-new-enough-pdm";
url = "https://github.com/NixOS/nixpkgs/archive/43862987c3cf2554a542c6dd81f5f37435eb1423.tar.gz"; # keep in sync with .github/workflows/lint.yml

name = "nixpkgs-stable-2024-03-08";
url = "https://github.com/NixOS/nixpkgs/archive/880992dcc006a5e00dd0591446fdf723e6a51a64.tar.gz"; # keep in sync with .github/workflows/lint.yml
})
{ };
pdm = pkgs.pdm.overridePythonAttrs (old: rec {
version = "2.4.9";
pname = old.pname;
src = pkgs.fetchPypi {
inherit pname version;
sha256 = "28b/sZXzmrJLS8tQf+mXiaYaMhWdi/In8xF7lPMn8vI=";
};
doCheck = false;
});
ld_packages = [
pkgs.file
# for ctranslate2
Expand All @@ -28,12 +16,14 @@ in
pkgs.mkShell {
buildInputs = with pkgs; [
overmind
wait4x
pre-commit

python310
python310Packages.black
pdm

nodejs_20
nodePackages.pnpm

# nix tooling
Expand All @@ -60,7 +50,7 @@ pkgs.mkShell {
icu.dev

# Our database
postgresql
postgresql_14

# Our database2 ?
redis
Expand Down
Loading