{ pkgs, lib, config, ... }: let inherit (lib) mkEnableOption mkOption types; cfg = config.programs.meat; in { options.programs.meat = { enable = mkEnableOption "meat"; flake = mkOption { type = with types; nullOr (either path str); default = null; description = "path to your system flake"; }; }; config = let inherit (pkgs) meat nh lix; in lib.mkIf cfg.enable { environment.systemPackages = [meat nh lix]; environment.sessionVariables.NH_FLAKE = if (cfg.flake == null) then abort "Please set the programs.meat.flake option to your system flake." else config.programs.meat.flake; }; }