WIP: destructure pkgs argument in package modules #395

Closed
kiara wants to merge 1 commit from kiara/fediversity:destructure-packages into main
Owner

restructures some initial package-structured modules, as a start to #93.
i mostly tried this for the learning experience, as i feel unsure as to how to approach this properly:
by default imports won't pass pkgs in destructured form as well, unless using pkgs.callPackage (or manually passing // pkgs), which:

  • so far we weren't using
  • imposes some extra burden on the importer
  • seems aimed at package modules, which i'm not sure helps for the likes of e.g. NixOS modules
restructures some initial package-structured modules, as a start to #93. i mostly tried this for the learning experience, as i feel unsure as to how to approach this properly: by default imports won't pass `pkgs` in destructured form as well, unless using `pkgs.callPackage` (or manually passing `// pkgs`), which: - so far we weren't using - imposes some extra burden on the importer - seems aimed at package modules, which i'm not sure helps for the likes of e.g. NixOS modules
destructure pkgs argument in package modules
Some checks failed
/ check-data-model (pull_request) Successful in 19s
/ check-peertube (pull_request) Successful in 19s
/ check-panel (pull_request) Successful in 1m21s
/ check-deployment-basic (pull_request) Successful in 11m30s
/ check-deployment-cli (pull_request) Successful in 38m39s
/ check-pre-commit (pull_request) Successful in 13s
/ check-deployment-panel (pull_request) Has been cancelled
27398befd8

This change does not relate to #93, and arguably we don't need to expand the arguments -- pkgs can be taken from the test module argument, such as here: https://git.fediversity.eu/Fediversity/Fediversity/compare/main...fricklerhandwerk:peertube-test-refactor -- then the test is a module (as it should be, instead of a function call layering in a pkgs) and we invoke it from the outside.

On that note, nix-build services -A tests.mastodon fails with

       error: attribute 'id' missing
       at ~/src/Fediversity/services/tests/mastodon.nix:72:31:
           71|         environment.variables = {
           72|           AWS_ACCESS_KEY_ID = config.fediversity.garage.ensureKeys.mastodon.id;
             |                               ^
           73|           AWS_SECRET_ACCESS_KEY = config.fediversity.garage.ensureKeys.mastodon.secret;

and same for pixelfed-garage. cc @Niols.

This change does not relate to #93, and arguably we don't need to expand the arguments -- `pkgs` can be taken from the test module argument, such as here: https://git.fediversity.eu/Fediversity/Fediversity/compare/main...fricklerhandwerk:peertube-test-refactor -- then the test is a module (as it should be, instead of a function call layering in a `pkgs`) and we invoke it from the outside. On that note, `nix-build services -A tests.mastodon` fails with ```log error: attribute 'id' missing at ~/src/Fediversity/services/tests/mastodon.nix:72:31: 71| environment.variables = { 72| AWS_ACCESS_KEY_ID = config.fediversity.garage.ensureKeys.mastodon.id; | ^ 73| AWS_SECRET_ACCESS_KEY = config.fediversity.garage.ensureKeys.mastodon.secret; ``` and same for `pixelfed-garage`. cc @Niols.
Author
Owner

@fricklerhandwerk wrote in Fediversity/Fediversity#395 (comment):

nix-build services -A tests.mastodon fails with

       error: attribute 'id' missing
       at ~/src/Fediversity/services/tests/mastodon.nix:72:31:
           71|         environment.variables = {
           72|           AWS_ACCESS_KEY_ID = config.fediversity.garage.ensureKeys.mastodon.id;
             |                               ^
           73|           AWS_SECRET_ACCESS_KEY = config.fediversity.garage.ensureKeys.mastodon.secret;

and same for pixelfed-garage. cc @Niols.

i believe those have been regressions on main induced as they never worked in CI (#34 / #33), tho i'm not sure #13 is still relevant.

@fricklerhandwerk wrote in https://git.fediversity.eu/Fediversity/Fediversity/pulls/395#issuecomment-8024: > `nix-build services -A tests.mastodon` fails with > > ```log > error: attribute 'id' missing > at ~/src/Fediversity/services/tests/mastodon.nix:72:31: > 71| environment.variables = { > 72| AWS_ACCESS_KEY_ID = config.fediversity.garage.ensureKeys.mastodon.id; > | ^ > 73| AWS_SECRET_ACCESS_KEY = config.fediversity.garage.ensureKeys.mastodon.secret; > ``` > > and same for `pixelfed-garage`. cc @Niols. i believe those have been regressions on `main` induced as they never worked in CI (#34 / #33), tho i'm not sure #13 is still relevant.
Author
Owner

pkgs can be taken from the test module argument, such as here: https://git.fediversity.eu/Fediversity/Fediversity/compare/main...fricklerhandwerk:peertube-test-refactor -- then the test is a module (as it should be, instead of a function call layering in a pkgs) and we invoke it from the outside.

thanks, opened as #396 - closing in favor of that one then.

> `pkgs` can be taken from the test module argument, such as here: https://git.fediversity.eu/Fediversity/Fediversity/compare/main...fricklerhandwerk:peertube-test-refactor -- then the test is a module (as it should be, instead of a function call layering in a `pkgs`) and we invoke it from the outside. thanks, opened as #396 - closing in favor of that one then.
kiara closed this pull request 2025-06-19 12:23:47 +02:00
Some checks failed
/ check-data-model (pull_request) Successful in 19s
/ check-peertube (pull_request) Successful in 19s
/ check-panel (pull_request) Successful in 1m21s
/ check-deployment-basic (pull_request) Successful in 11m30s
/ check-deployment-cli (pull_request) Successful in 38m39s
/ check-pre-commit (pull_request) Successful in 13s
/ check-deployment-panel (pull_request) Has been cancelled

Pull request closed

Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
fediversity/fediversity!395
No description provided.