-
Notifications
You must be signed in to change notification settings - Fork 44
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
Allow users to customize outputs list #1223
Comments
Hey @Ten0, For With
This is why, when declaring builtins from Example: For the following {
formatPython,
...
}: {
formatPython = {
project1.targets = ["/project1"];
project2.targets = ["/project2"];
project3.targets = ["/project3"];
};
} We get the following CLI outputs:
With some boilerplate code you could still use all builtins from Example:
{
formatNix,
makeScript,
projectPath,
...
}: let
bin = formatNix {
name = "project1-service1";
targets = [(projectPath "/project1/service1")];
};
in
makeScript {
entrypoint = "format-nix-for-project1-service1";
name = "project1-service1-format";
searchPaths.bin = [bin];
} From that
{
formatNix,
makeScript,
projectPath,
...
}: let
config = import (projectPath "/makes/services.nix") {
inherit formatNix;
inherit makeScript;
inherit projectPath;
};
in
# customFormatNix is a more generic function that runs formatNix as explained before
config.customFormatNix {
name = config.project1.service1.format.name;
targets = config.project1.service1.targets;
} |
You could even declare everything in the makesArgs: let
config = import (makesArgs.projectPath "/makes/services.nix") {inherit makesArgs;};
in
config.project1.service1.format.run |
Thank you for your answer! 🙂 So it looks like my understanding was correct: to generate target paths, I'm tied by either the builtins (which I can't customize) or the "one folder with a main.nix per output" approach (which would force me to create one directory per output with a main file that would specify a bunch of boilerplate and finally Is there any technical constraint that prevents building a system that has a more flexible interface similar to the one I described above? Having the root expression that evaluates to just at-most-one-incantation-of-each-type-of-builtin doesn't allow for flexible program structure compared to something along the lines of At first glance it looks like we could evaluate only the part of the current folder's expressions that are related to outputs names when starting the CLI, and then only when actually building, evaluate the Would a design where we add an To be very clear: I love the idea of the project of having a CI system globally powered by nix, with a CLI that enables choosing the targets we're interested in, especially making full use of caching across all users of the organization for every single derivation. The potential of it looks insane! However, if it seems that the only way to efficiently add outputs to the CLI is to make incantations in the
Thanks a lot 🙂 |
I will start working on a first iteration that allows to declare |
- Add support for jobs in makes.nix in order to deprecate main.nix and CLI job discovery - Remove unused scorecard pipeline
- Add support for jobs in makes.nix in order to deprecate main.nix and CLI job discovery - Add test job - Remove unused scorecard pipeline
- Add support for jobs in makes.nix in order to deprecate main.nix and CLI job discovery - Add test job - Remove unused scorecard pipeline
- Add support for jobs in makes.nix in order to deprecate main.nix and CLI job discovery - Add test job - Remove unused scorecard pipeline Signed-off-by: Daniel Salazar <[email protected]>
- Migrate tests - Migrate makes root job - Adapt CI jobs Signed-off-by: Daniel Salazar <[email protected]>
- Migrate tests - Migrate makes root job - Adapt CI jobs Signed-off-by: Daniel Salazar <[email protected]>
- Migrate tests - Migrate makes root job - Adapt CI jobs Signed-off-by: Daniel Salazar <[email protected]>
feat(cross): #1223 use jobs approach
- Migrate cli - Migrate docs - Remove unused tests environment - Adapt default.nix Signed-off-by: Daniel Salazar <[email protected]>
feat(cross): #1223 use jobs approach
- Make docs use pure poetry - Centralize job in single makes.nix - Stop deploying latest tag and release - Adapt CI jobs Signed-off-by: Daniel Salazar <[email protected]>
- Make docs use pure poetry - Centralize job in single makes.nix - Stop deploying latest tag and release - Adapt CI jobs Signed-off-by: Daniel Salazar <[email protected]>
feat(back): #1223 pure poetry for docs
- Move container to root directory - Move tests to root directory - Move utils to root directory - Create an isolated namespace per test - Adapt CI jobs
- Move container to root directory - Move tests to root directory - Move utils to root directory - Create an isolated namespace per test - Adapt CI jobs
- Move container to root directory - Move tests to root directory - Move utils to root directory - Create an isolated namespace per test - Adapt CI jobs
- Move container to root directory - Move tests to root directory - Move utils to root directory - Create an isolated namespace per test - Adapt CI jobs
- Move container to root directory - Move tests to root directory - Move utils to root directory - Create an isolated namespace per test - Adapt CI jobs
- Move container to root directory - Move tests to root directory - Move utils to root directory - Create an isolated namespace per test - Adapt CI jobs Signed-off-by: Daniel Salazar <[email protected]>
- Move CLI env to src - Adapt default.nix - Move container to root directory - Move tests to root directory - Move utils to root directory - Create an isolated namespace per test - Adapt CI jobs Signed-off-by: Daniel Salazar <[email protected]>
- Move CLI env to src - Adapt default.nix - Move container to root directory - Move tests to root directory - Move utils to root directory - Create an isolated namespace per test - Adapt CI jobs Signed-off-by: Daniel Salazar <[email protected]>
- Move CLI env to src - Adapt default.nix - Move container to root directory - Move tests to root directory - Move utils to root directory - Create an isolated namespace per test - Adapt CI jobs Signed-off-by: Daniel Salazar <[email protected]>
refac(cross): #1223 restructure tests
- Force jobs to begin with / for currently CLI compatibility Signed-off-by: Daniel Salazar <[email protected]>
- Deprecate main.nix from documentation - Reorder everything to simplify adoption
- Deprecate main.nix from documentation - Reorder everything to simplify adoption Signed-off-by: Daniel Salazar <[email protected]>
@Ten0 Hey! If you're still interested, take a look at the new |
I'm considering using this project.
IIUC, I currently have two ways to generate an "output" for the CLI:
builtin
, and that will generate an arbirary number of targets depending on some magic inmakes
' own codeextension
, which always means creating a folder for the target, and having amain.nix
in that folder.What I want to achieve is the following directory structure:
and I want my possible "OUTPUT"s in the CLI to look like this:
where the build/test/run/deploy outputs behavior are all defined by my
/makes/service.nix
That means I need to be able to customize:
<main or makes>.nix
s (so that with a single nix file in a service folder I can declare the multiple targets that I need)<main or makes>.nix
s (to be able to passimport ./makes/service.nix
)My understanding is that this is not possible currently, and instead any such
service.nix
would have to be declared as a builtin inmakes
itself, and then I would put only the configuration of that in somemakes.nix
, which also means I could only instantiate one of each of those permakes.nix
, whereas my ideal syntax would probably be:(where
outputAttrSet
would convert from the attrset of output to probably[{ name, derivation }]
, allowing for further customization if required)Is it actually already possible to achieve something like this? If so, how? If not, is this something that could maybe be made possible in the future or are there any clear blockers?
Thanks,
The text was updated successfully, but these errors were encountered: