I'm considering using this project.
IIUC, I currently have two ways to generate an "output" for the CLI:
- use a
builtin, and that will generate an arbirary number of targets depending on some magic in makes' own code
- use an
extension, which always means creating a folder for the target, and having a main.nix in that folder.
What I want to achieve is the following directory structure:
project1
/service1/<main or makes>.nix
/service2/<main or makes>.nix
project2
/service1/<main or makes>.nix
makes/service.nix
and I want my possible "OUTPUT"s in the CLI to look like this:
/project1/service1/build
/project1/service1/test
/project1/service1/run
/project1/service1/deploy
/project1/service2/build
/project1/service2/test
/project1/service2/run
/project1/service2/deploy
/project2/service1/build
/project2/service1/test
/project2/service1/run
/project2/service1/deploy
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:
- The list of targets that are made available from a
<main or makes>.nixs (so that with a single nix file in a service folder I can declare the multiple targets that I need)
- The arguments that are passed to the
<main or makes>.nixs (to be able to pass import ./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 in makes itself, and then I would put only the configuration of that in some makes.nix, which also means I could only instantiate one of each of those per makes.nix, whereas my ideal syntax would probably be:
# /project1/service1/<main or makes>.nix
{ args, service, pkgs, ... }: service { name = "a"; }
# /makes/service.nix
{ args, pkgs, makeScript, deployContainerImage, outputAttrSet, ... }:
let
build = { /* ... */ };
docker = pkgs.dockerTools.buildLayeredImage { /* ... */ };
# Where args are the arguments pased as [ARGS...] to the CLI and may be used here
in
outputAttrSet {
inherit build;
deploy = deployContainerImage {
images = [{
src = docker;
registry = { /* ... */ };
}];
};
test = { /* ... */};
run = makeScript { /* ... */ };
}
(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,
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.nixin 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.nixThat means I need to be able to customize:
<main or makes>.nixs (so that with a single nix file in a service folder I can declare the multiple targets that I need)<main or makes>.nixs (to be able to passimport ./makes/service.nix)My understanding is that this is not possible currently, and instead any such
service.nixwould have to be declared as a builtin inmakesitself, 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
outputAttrSetwould 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,