It is possible to install packages from nixos-unstable in /etc/nixos/configuration.nix
using the configuration from this answer.
Here is an example of installing the htop
packages from nixos-unstable:
{ config, pkgs, ... }:
let
unstableTarball =
fetchTarball
https://github.com/NixOS/nixpkgs-channels/archive/nixos-unstable.tar.gz;
in
{
...
nixpkgs.config = {
packageOverrides = pkgs: {
unstable = import unstableTarball {
config = config.nixpkgs.config;
};
};
};
environment.systemPackages = with pkgs; [
...
unstable.htop
];
...
};
I would like to be able to install the Virtualbox package (and related kernel modules) from nixos-unstable as well.
Naively adding the virtualbox
package to environment.systemPackages
doesn't work like I expect it would. The Virtualbox modules matching the unstable version of Virtualbox do not get installed. Here is a snippet from my /etc/nixos/configuration.nix
:
nixpkgs.config.virtualbox.enableExtensionPack = true;
virtualisation.virtualbox.host.enable = true;
environment.systemPackages = with pkgs; [
...
unstable.virtualbox
];
The above will correctly install the virtualbox
package from nixos-unstable, but not the Virtualbox kernel modules.
How can I get the Virtualbox kernel modules to be installed from nixos-unstable as well? And why doesn't the above work?