nixos-configuration/nix-os/unstable-packages.nix

26 lines
654 B
Nix

{
config,
lib,
pkgs,
self,
...
}:
let
cfg = config.unstable;
unstableOverlay = self.overlays.unstableWithMeta;
in
{
options.unstable = {
enable = lib.mkEnableOption (lib.mkDoc ''
use of unstable packages in configuration. You can use `unstablePkgs` in configuration modules
'') // { default = true; };
};
config = {
_module.args.unstablePkgs = if config.unstable.enable then pkgs.unstable else pkgs;
nixpkgs.overlays = lib.mkIf cfg.enable [ unstableOverlay ];
system.extraSystemBuilderCmds = lib.mkIf config.unstable.enable ''
echo ${pkgs.unstableVersion} > $out/nixos-unstable-version
'';
};
}