-
Notifications
You must be signed in to change notification settings - Fork 54
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
embed info in channels and pass host's channel as specialArg #44
Conversation
There was a problem hiding this 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?
systemFlake.nix
Outdated
specialArgs = host.specialArgs // { channel = channelInfo; }; | ||
} // (optionalAttrs (host.output == "nixosConfigurations") { | ||
inherit lib baseModules specialArgs; |
There was a problem hiding this comment.
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?
flake-utils-plus/systemFlake.nix
Lines 166 to 173 in 6e6b936
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; | |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
6e6b936
to
77bb2b2
Compare
77bb2b2
to
65cf1b7
Compare
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; }; |
There was a problem hiding this comment.
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.
cdc7b8e
to
4b01c64
Compare
84890a7
to
b758e3f
Compare
add name and input to each channel
b758e3f
to
1245b7e
Compare
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.