Closed drupol closed 3 weeks ago
Someone asked the same question on Zulip sometime ago: https://nixos.zulipchat.com/#narrow/stream/414011-services-flake/topic/.E2.9C.94.20custom.20local.20service/near/440612147
Here’s what the message says:
Yes, there is. See the pgweb service here: https://github.com/juspay/services-flake/blob/5ffae902f78b8f31416e5667ab95c40ee7a5ebef/example/simple/flake.nix#L42-L61
And here’s an example of a service that doesn’t exist upstream but is only specific to the project: https://github.com/nammayatri/nammayatri/blob/main/Backend/nix/services/postgres-with-replica.nix
And one more example: https://github.com/nammayatri/passetto/blob/nixify/process-compose.nix. This service is imported in nammayatri: https://github.com/nammayatri/nammayatri/blob/e8032f1fac3581b9062e2469dfc778d2913d3665/Backend/nix/services/nammayatri.nix#L32
and it is configured like: https://github.com/nammayatri/nammayatri/blob/e8032f1fac3581b9062e2469dfc778d2913d3665/Backend/nix/services/nammayatri.nix#L285-L297
I am also working on documenting this more formally now.
Cool !
I tried to do this thing: https://github.com/drupol/wip-services-flake-llm
But I'm getting nowhere at the moment. I wish it could be so simple, but it is not yet.
The idea is to mimic what's done in services-flake
and be able to import services easily.
Do you have a clue on what's wrong in there?
Aah, infinite recursions are painful to debug.
I took a guess and modified the way multiService
was being used, and that seemed to fix it. See: https://github.com/shivaraj-bh/wip-services-flake-llm/commit/8b3016d077d68365ca0a3f76295b52b5b416f531
Although, it would be interesting to see why was there infinite recursion, because by looking at it, it seemed right.
Thank you mate <3, I really appreciate. Now I'm going to watch at your changes and hack a bit to try to understand this correctly.
Ah, I forgot to note. Can we put this page under "Guide"?
(The URL should remain the same)
cf. "How-to guides" in https://diataxis.fr/ which is what our "Guide" folder is about.
Hey,
I've been following the documentation to add a new custom multi service (tika) in my project, but I got stuck. The branch is here: https://github.com/drupol/wip-services-flake-llm/pull/1
When I try to run it (nix run):
❯ nix run
error:
… while calling the 'derivationStrict' builtin
at /builtin/derivation.nix:1:208:
… while evaluating derivation 'services-flake-llm'
whose name attribute is located at /nix/store/pfqbxdicyksnqda6h5xv285sx7vamwzd-source/pkgs/stdenv/generic/make-derivation.nix:331:7
… while evaluating attribute 'text' of derivation 'services-flake-llm'
at /nix/store/pfqbxdicyksnqda6h5xv285sx7vamwzd-source/pkgs/build-support/trivial-builders/default.nix:103:17:
102| ({
103| inherit text executable checkPhase allowSubstitutes preferLocalBuild;
| ^
104| passAsFile = [ "text" ]
(stack trace truncated; use '--show-trace' to show the full trace)
error: The option `perSystem.x86_64-linux.process-compose.services-flake-llm.services.tika.tika1.outputs' does not exist. Definition values:
- In `/nix/store/h6chvy49v501iz2zli5nd0vaw49izz8p-source/services/tika.nix'
~/C/d/wip-services-flake-llm > add-tika ✘
Do you have any idea of what I'm doing wrong there?
@drupol After https://github.com/juspay/services-flake/pull/258 there was a change to the multiService
library function, you might want to update the services-flake
input in your repo.
Also, note that dataDir
and enable
options are also no longer needed when your service has multiple instances, due to https://github.com/juspay/services-flake/commit/dfcdbbca0213cb0b7d4839145c3466f73073c207 and https://github.com/juspay/services-flake/commit/ea3a18a991fd5e0df3543f17c9209a6942068c4a
Thank you once again, that works!
Hello,
I would like to have some documentation on how to have custom local services definitions that are not meant to be upstreamed in
services-flake
.Do you have some info on how to do that?
Thanks.