Why are channels managed imperatively using nix-channel by default?

and not declaratively in the configuration.nix like the rest of the system

Would it cause any problem doing that?

The main difference is probably that the channels are updated every time you rebuild. In most cases that is what i want. Maybe an option is needed to not update channels configured in configuration.nix when you just want to update configuration without updating packages.

Here are instructions how you configure unstable channel in configuration.nix: how to add NixOS unstable channel declaratively in configuration.nix - Stack Overflow

How are you doing it?

1 Like

and not declaratively in the configuration.nix like the rest of the system

Technically speaking, interpretation of configuration.nix requires an existing NixOS channel or checkout, and imperative management of prerequisite is not that much worse than trying to define a fixpoint over network operations, I guess.

1 Like

I think you often want to “imperatively” decide when a channel is (not) updated. Usually you want configuration changes to be quick (you might even be offline).

2 Likes