{config, pkgs, lib, ...}: let cfg = config.unstable; unstableOverlay = import ../pkgs/overlays/unstable.nix; 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 ''; }; }