From 82ff0e98761facd66de04672adb731e3f2d2d627 Mon Sep 17 00:00:00 2001 From: shivaraj-bh Date: Thu, 13 Jun 2024 11:16:03 +0530 Subject: [PATCH] chore: add `example/llm`; github workflow to update the `example/llm/flake.lock` For context, see: https://github.com/juspay/services-flake/pull/218#issuecomment-2163874302 --- .../workflows/update-flake-lock-ex-llm.yaml | 40 +++++++++++++++++++ example/llm/flake.nix | 27 +++++++++++++ justfile | 4 ++ 3 files changed, 71 insertions(+) create mode 100644 .github/workflows/update-flake-lock-ex-llm.yaml create mode 100644 example/llm/flake.nix diff --git a/.github/workflows/update-flake-lock-ex-llm.yaml b/.github/workflows/update-flake-lock-ex-llm.yaml new file mode 100644 index 0000000..73c344b --- /dev/null +++ b/.github/workflows/update-flake-lock-ex-llm.yaml @@ -0,0 +1,40 @@ +name: update-flake-lock-ex-llm +on: + workflow_dispatch: # allows manual triggering + schedule: + - cron: '0 0 * * 0' # runs weekly on Sunday at 00:00 + +jobs: + update-ex-llm-lock: + runs-on: ubuntu-latest + steps: + - name: Generate Github App Token + uses: navikt/github-app-token-generator@v1 + id: github-app-token + with: + app-id: ${{ vars.NIXOS_ASIA_APP_ID }} + private-key: ${{ secrets.NIXOS_ASIA_PRIVATE_KEY }} + - name: Checkout repository + uses: actions/checkout@v4 + - name: Install Nix + uses: DeterminateSystems/nix-installer-action@main + - name: Update flake.lock + uses: DeterminateSystems/update-flake-lock@main + id: update-flake-lock + with: + commit-msg: "chore(example): Update llm/flake.lock" + pr-title: "Update example/llm/flake.lock" + pr-body: | + Automated changes by the [update-flake-lock](https://github.com/DeterminateSystems/update-flake-lock) GitHub Action. + + ``` + {{ env.GIT_COMMIT_MESSAGE }} + ``` + pr-labels: | + automated + path-to-flake-dir: 'example/llm' + branch: "update_flake_lock_ex_llm" + token: ${{ steps.github-app-token.outputs.token }} + - run: "gh pr merge --auto --rebase --delete-branch ${{ steps.update-flake-lock.outputs.pull-request-number }}" + env: + GH_TOKEN: ${{ github.token }} diff --git a/example/llm/flake.nix b/example/llm/flake.nix new file mode 100644 index 0000000..084c965 --- /dev/null +++ b/example/llm/flake.nix @@ -0,0 +1,27 @@ +{ + description = "A collection of services enabling the users to perform inference on LLM models"; + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable"; + flake-parts.url = "github:hercules-ci/flake-parts"; + systems.url = "github:nix-systems/default"; + process-compose-flake.url = "github:Platonic-Systems/process-compose-flake"; + services-flake.url = "github:juspay/services-flake"; + }; + outputs = inputs: inputs.flake-parts.lib.mkFlake { inherit inputs; } { + systems = import inputs.systems; + imports = [ + inputs.process-compose-flake.flakeModule + ]; + perSystem = { self', pkgs, lib, ... }: { + process-compose."default" = { + imports = [ + inputs.services-flake.processComposeModules.default + ]; + services.ollama."ollama1" = { + enable = true; + models = [ "llama2-uncensored" ]; + }; + }; + }; + }; +} diff --git a/justfile b/justfile index 4232fd7..20591ef 100644 --- a/justfile +++ b/justfile @@ -10,6 +10,10 @@ changelog: ex-simple: cd ./example/simple && nix run . --override-input services-flake ../.. +# Run example/llm +ex-llm: + cd ./example/llm && nix run . --override-input services-flake ../.. + # Run example/share-services ex-share-services: cd ./example/share-services/pgweb && \