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

27 lines
654 B
Nix
Raw Normal View History

2025-01-12 21:54:47 +01:00
{
config,
lib,
pkgs,
self,
...
}:
let
cfg = config.unstable;
2025-01-12 21:54:47 +01:00
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
'';
};
}