How do you enable a service from a different channel, such as nixos-unstable?
(import <nixos-unstable> {}).whatever
works for packages, but I can't find a way to do something similar for a service, is this possible?
N/A
"x86_64-linux"
Linux 4.14.43, NixOS, 18.03.132507.5f2da7f837e (Impala)
yes
yes
nix-env (Nix) 2.0.2
"nixos-18.03, nixos-unstable, nixpkgs"
/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs
You need to disable the module and import it from the other channel, i.e.
{ config, pkgs, lib, ... }:
let
unstable = import <nixos-unstable> { };
in
{
imports = [ <nixos/modules/services/web-servers/caddy.nix> ];
disabledModules = [ "services/web-servers/caddy.nix" ];
}
I think it than uses the package from the "normal" channel, so you need to override that aswell (either as in the next example or via an overlay).
If you want to change the channel for an unfree package, you need to allow unfree packages for the unstable channel as well, i.e.
let
baseconfig = { allowUnfree = true; };
unstable = import <nixos-unstable> { config = baseconfig; };
in
{
imports = [ <nixos-unstable/nixos/modules/services/networking/unifi.nix> ];
disabledModules = [ "services/networking/unifi.nix" ];
nixpkgs.config = baseconfig // {
packageOverrides = pkgs: {
unifi = unstable.unifi;
};
};
};
Ok thanks, that answers my question.
SOLVED
This issue has been mentioned on NixOS Discourse. There might be relevant details there:
https://discourse.nixos.org/t/add-unstable-options-to-stable-install/6482/4
This issue has been mentioned on NixOS Discourse. There might be relevant details there:
https://discourse.nixos.org/t/virtualbox-keeps-getting-rebuilt/6612/3
This issue has been mentioned on NixOS Discourse. There might be relevant details there:
https://discourse.nixos.org/t/nixos-module-development-workflow/8217/5
Most helpful comment
You need to disable the module and import it from the other channel, i.e.
I think it than uses the package from the "normal" channel, so you need to override that aswell (either as in the next example or via an overlay).
If you want to change the channel for an unfree package, you need to allow unfree packages for the unstable channel as well, i.e.