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

Allow setting of channel host-wide #117

Closed
ymarkus opened this issue Feb 8, 2021 · 8 comments
Closed

Allow setting of channel host-wide #117

ymarkus opened this issue Feb 8, 2021 · 8 comments
Labels
enhancement New feature or request

Comments

@ymarkus
Copy link
Contributor

ymarkus commented Feb 8, 2021

I would like to use this template to manage all my NixOS systems. Right now I can't find a way to do it easily.
Basically, I would like my servers to follow release and my Laptop/PC to follow unstable

Describe alternatives you've considered
Maybe this is possible with an overlay? I'm not that familiar with overlays as I haven't used them much.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@Pacman99
Copy link
Member

Pacman99 commented Feb 11, 2021

I haven't tested this, but lets say you set the nixos input in the flake to be 20.09, which would then be the default.
You can add master to extern/default.nix as a specialArg:

specialArgs = {
  unstableModulesPath = "${master}/nixos/modules";
  hardware = nixos-hardware.nixosModules;
  inherit master;
};

Then in the host file of any server you want to track master entirely:

{ master, ... }:
nixpkgs.pkgs = mkForce master;

mkForce because it is set to pkgs by default in hosts/default.nix

Again I'm not sure if this will work.

I personally just use a separate repo/nixflk for my server. I'm doubt any configuration framework would be able to abstract away the differences between the format and requirements of my laptop and server configs.

@nrdxp
Copy link
Collaborator

nrdxp commented Feb 11, 2021

Flakes don't use or require nix channels, but the 'nixos' flake input is used as the base of the system. So if you want to rebase on unstable, just point the input from 'release-20.09' to 'nixos-unstable' in the uri and you'll be good to go.

The default mechanism for deploying a release while easily overriding packages and modules from master if/where required, is also available to consider.

@ymarkus
Copy link
Contributor Author

ymarkus commented Feb 11, 2021

I haven't tested this, but lets say you set the nixos input in the flake to be 20.09, which would then be the default.
You can add master to extern/default.nix as a specialArg:

specialArgs = {
  unstableModulesPath = "${master}/nixos/modules";
  hardware = nixos-hardware.nixosModules;
  inherit master;
};

Then in the host file of any server you want to track master entirely:

{ master, ... }:
nixpkgs.pkgs = mkForce master;

mkForce because it is set to pkgs by default in hosts/default.nix

Again I'm not sure if this will work.

I personally just use a separate repo/nixflk for my server. I'm doubt any configuration framework would be able to abstract away the differences between the format and requirements of my laptop and server configs.

I'm not quite sure if that would work... nix flake uses the pkgs that you input to lib.nixosSystem and this project also pulls in nixos in different places, such as lib/default.
I'd like my user configs to be the same that's why using one project would be better for me.

But thanks, I'll try it out and report back.

@ymarkus
Copy link
Contributor Author

ymarkus commented Feb 11, 2021

Flakes don't use or require nix channels, but the 'nixos' flake input is used as the base of the system. So if you want to rebase on unstable, just point the input from 'release-20.09' to 'nixos-unstable' in the uri and you'll be good to go.

The default mechanism for deploying a release while easily overriding packages and modules from master if/where required, is also available to consider.

Thanks, but I understand how to change it for all hosts. My wish would be to use the same flake.nix to deploy some hosts with stable and some with unstable/master (not only the packages, but the modules too). Doing it for every package is a lot of work if I'd like the whole system to use that channel...

@Pacman99
Copy link
Member

Yeah that makes sense. Thats what I use the home-manager only configurations for, so I can use my personal nixflk on my server, and just apply the home-manager configs.

But the server specific things are in a different repository.

Not quite sure how to solve your problem though.

@nrdxp
Copy link
Collaborator

nrdxp commented Feb 12, 2021

@ymarkus, sorry, misunderstood the question. I am actually going to be extracting out a lot of the logic in the existing hosts/default to be easily modifiable per host. This will remain open til that's finished.

@ymarkus
Copy link
Contributor Author

ymarkus commented Feb 12, 2021

Wow, great! Thank you very much.

@nrdxp nrdxp mentioned this issue Feb 15, 2021
17 tasks
@nrdxp nrdxp added the enhancement New feature or request label Feb 17, 2021
@nrdxp nrdxp mentioned this issue Mar 27, 2021
@Pacman99
Copy link
Member

this is now possible in the develop branch with the channels argument and you can set the channelName for each host. Closing this, re-open if there are any problems with the new feature after the next release.

Pacman99 added a commit that referenced this issue Feb 26, 2022
nix: remove ca-references feature flag
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants