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

feat: Provide a devShell with packages from enabled services #355

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

shivaraj-bh
Copy link
Member

resolves #194

@shivaraj-bh shivaraj-bh changed the title feat(devShell): Output a shell with packages of all the enabled services feat(devShell): Output a shell with packages from enabled services Oct 9, 2024
@shivaraj-bh shivaraj-bh changed the title feat(devShell): Output a shell with packages from enabled services feat: Provide a devShell with packages from enabled services Oct 9, 2024
@shivaraj-bh shivaraj-bh requested a review from srid October 9, 2024 12:48
Copy link
Member

@srid srid left a comment

Choose a reason for hiding this comment

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

LGTM, with these changes.

nix/services/default.nix Show resolved Hide resolved
# Output = [ <cfg1> <cfg2> <cfg3> ]
(lib.foldlAttrs (acc: _: v: (lib.attrValues v) ++ acc) [ ])
(lib.filter (service: service.enable))
(map (service: service.package))
Copy link
Member

Choose a reason for hiding this comment

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

This assumes that all services -- and services to be added in future -- have package option, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes

Comment on lines 41 to 49
# `outputs` is a reserved attribute set and is not the name of a service.
(lib.filterAttrs (n: _: n != "outputs"))
# Flatten services attrset
#
# Example:
# Input = { mysql."m1" = <cfg1>; mysql."m2" = <cfg2>; redis."r1" = <cfg3>; }
# Output = [ <cfg1> <cfg2> <cfg3> ]
(lib.foldlAttrs (acc: _: v: (lib.attrValues v) ++ acc) [ ])
(lib.filter (service: service.enable))
Copy link
Member

Choose a reason for hiding this comment

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

You can possibly move this to services.outputs.enabledServices option, thus simplifying the code here.

Copy link
Member

Choose a reason for hiding this comment

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

This could just be listOf string, fwiw.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Have services provide the relevant devShell?
2 participants