Sender | Message | Time |
---|---|---|
16 Aug 2024 | ||
Pol | you should have everything you need there | 07:24:01 |
Pol | Forget what I just said, that last example if very outdated. | 07:25:14 |
nebucatnetzer13 | composer-plugin-nixify looks interesting thank you. With the first examples I see that it gets phpunit from Nixpkgs, I could do that but I would prefer to let composer deal with the PHP packages if possible. That way Nix isn't a "hard dependency". | 07:31:15 |
nebucatnetzer13 | In reply to @drupol:matrix.orgAh to bad :) | 07:31:26 |
Pol | Then just use buildComposerProject builder from nixpkgs and let phpunit in the require-dev section. | 07:32:22 |
nebucatnetzer13 | That only works if I only use phpunit for testing right? Otherwise I would have to build two buildComposerProject one for testing and one for production? | 07:34:56 |
Pol | When you build a project uising buildComposerProject it is inherently made for production. | 07:42:15 |
Pol | Since it, by default, doesn't include require-dev . I don't see the point doing it either. | 07:42:40 |
Pol | Perhaps I'm misunderstanding your request? | 07:42:51 |
nebucatnetzer13 | Maybe, let me try to rephrase. | 07:43:38 |
nebucatnetzer13 | I would like to run phpunit in a Gitlab CI. Nix devShell will be used to provide PHP and Gitlab provides a MariaDB container. In an existing project we use imperative containers for the unittests. What I tried so far is a fixed output derivation which looks like the following.
| 07:53:48 |
piotrkwiecinski | You cannot have --no-dev and install phpunit with require-dev dependencies at the same time | 07:56:16 |
piotrkwiecinski | in this case you have to install phpunit separately | 07:56:37 |
nebucatnetzer13 | Ah sorry I have two derivations, thats the one for production dependencies | 07:56:56 |
nebucatnetzer13 |
| 07:57:08 |
nebucatnetzer13 | This one depends on the previous one and that's how I noticed that the outputHash changed because I didn't push the previous derivation to the cache. Therefore the runner had to built it itself and failed because the hash didn't match. | 07:58:35 |
nebucatnetzer13 | However I don't need it to work exactly this way. This was just me trying to hack something together. | 07:59:12 |
nebucatnetzer13 | In a Python project with poetry2nix I can do this for example: https://github.com/Nebucatnetzer/sort-of-pastebin/blob/main/flake.nix#L54-L67 | 08:04:30 |
nebucatnetzer13 | One is the dev environment which which I can run the tests and the other is the final application. | 08:05:07 |
nebucatnetzer13 | Which I ten use like this to do the tests: https://github.com/Nebucatnetzer/sort-of-pastebin/blob/main/.github/workflows/tests.yml | 08:05:49 |
nebucatnetzer13 | And when they succeed I build the container | 08:06:02 |
nebucatnetzer13 | https://github.com/Nebucatnetzer/sort-of-pastebin/blob/main/.github/workflows/build_containers.yml | 08:06:10 |
Pol | But you're using nix develop . | 08:09:59 |
Pol | buildComposerProject does not create a development shell (to be used with nix develop ). | 08:10:25 |
nebucatnetzer13 | Is there a way to do that? | 08:15:32 |
Pol | Creating a devshell containing your tools ? | 08:23:39 |
Pol | Yeah it's quite easy to do | 08:23:46 |
Pol | That's the easiest thing to do in Nix I believe. | 08:23:56 |
nebucatnetzer13 | yeah but especially with the content of composer.lock | 08:24:36 |
Pol | mmh I don't think it has been done yet | 08:25:05 |