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

embed info in channels and pass host's channel as specialArg #44

Merged
merged 2 commits into from
Apr 26, 2021

Conversation

Pacman99
Copy link
Collaborator

@Pacman99 Pacman99 commented Apr 25, 2021

gives both builders and hosts information about what channel their on. The former is so you can implement channel-specific logic in a builder. In devos we have a extended nixosSystem, so we would want to do specialArgs.channel.input.lib.nixosSystem, to ensure we are using the write channel for that host. And modules can do logic to hosts based on what channel the host is on.

Copy link
Collaborator

@blaggacao blaggacao left a comment

Choose a reason for hiding this comment

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

Simple. Effective. Spot on. I would even say: neuralgic. 😉 What not.

An example to cater the fully-featured, maybe?

@blaggacao blaggacao mentioned this pull request Apr 25, 2021
systemFlake.nix Outdated
Comment on lines 153 to 155
specialArgs = host.specialArgs // { channel = channelInfo; };
} // (optionalAttrs (host.output == "nixosConfigurations") {
inherit lib baseModules specialArgs;

Choose a reason for hiding this comment

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

is this even working? Is it not getting overwritten by host.output == "nixosConfigurations" part? I might be misreading something.

Also, maybe it would make more sense to attach the name somewhere around here?

importChannel = name: value: import (patchChannel system value.input (value.patches or [ ])) {
inherit system;
overlays = sharedOverlays ++ (if (value ? overlaysBuilder) then (value.overlaysBuilder pkgs) else [ ]);
config = channelsConfig // (value.config or { });
};
pkgs = mapAttrs importChannel channels;

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

the specialArgs above has a // host.specialArgs. So theres no issue with specialArgs right now, but channel would get overwritten.

And yeah thats a good idea, I'll move name down.

Copy link
Collaborator

@blaggacao blaggacao Apr 25, 2021

Choose a reason for hiding this comment

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

Unrelated: I found that nuance a bit implicit. Glad to know we bump on it.

Copy link
Collaborator Author

@Pacman99 Pacman99 Apr 25, 2021

Choose a reason for hiding this comment

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

Ohh that doesn't actually work, since we can't pass an instantiated nixpkgs, I was just hoping to pass channel metadata, so its pulled directly from the channels argument.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

So I decided to go ahead and pass the instantiated nixpkgs and then added channel information - name and input - implicitly to all channels

systemFlake.nix Outdated
@@ -89,20 +89,24 @@ let
selectedNixpkgs = getNixpkgs host;
host = evalHostArgs (mergeAny hostDefaults host');
patchedChannel = selectedNixpkgs.path;
channel = channels.${host.channelName} // { name = host.channelName; };
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I just want to pass channel metadata and passing the imported channel would result in a string which is very hard to use. Whereas input/name is more useful. Theres no place right now to edit all channels, so I think this is the best way to do it.

@Pacman99 Pacman99 force-pushed the channel-specialArg branch 2 times, most recently from cdc7b8e to 4b01c64 Compare April 25, 2021 21:49
@Pacman99 Pacman99 force-pushed the channel-specialArg branch 2 times, most recently from 84890a7 to b758e3f Compare April 26, 2021 05:50
@Pacman99 Pacman99 changed the title pass channel info to hosts as channel specialArg embed info in channels and pass host's channel as specialArg Apr 26, 2021
@Pacman99 Pacman99 merged commit 0f0c148 into gytis-ivaskevicius:staging Apr 26, 2021
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.

3 participants