use mkIf for conditionals

This commit is contained in:
2025-02-08 13:26:08 +00:00
parent 6d0f9224be
commit 138d1bd1b3

View File

@@ -4,13 +4,16 @@ with lib;
{ {
options.terminal = { options.terminal = {
nixUpdateLocation = mkOption { nixUpdateLocation = mkOption {
type = types.str; type = lib.types.nullOr lib.types.str;
default = null;
}; };
flakeUpdateLocation = mkOption { flakeUpdateLocation = mkOption {
type = types.str; type = lib.types.nullOr lib.types.str;
default = null;
}; };
homeUpdateLocation = mkOption { homeUpdateLocation = mkOption {
type = types.str; type = lib.types.nullOr lib.types.str;
default = null;
}; };
}; };
@@ -139,18 +142,38 @@ with lib;
topgrade = with config.terminal;{ topgrade = with config.terminal;{
enable = true; enable = true;
settings = { # settings = {
# misc = {
# assume_yes = true;
# };
# linux = {
# nix_arguments = if nixUpdateLocation != null then "--flake ${nixUpdateLocation}" else default;
# home_manager_arguments = if homeUpdateLocation != null then "--flake ${homeUpdateLocation}" else "";
# };
# pre_commands = {
# nix-flake-update = if flakeUpdateLocation != null then "sudo nix flake update --flake ${flakeUpdateLocation}" else "";
# };
# };
settings = mkMerge [{
misc = { misc = {
assume_yes = true; assume_yes = true;
}; };
linux = { }
nix_arguments = if nixUpdateLocation then "--flake ${nixUpdateLocation}" else null; (mkIf (nixUpdateLocation != null) {
home_manager_arguments = if homeUpdateLocation then "--flake ${homeUpdateLocation}" else null; linux = {
}; nix_arguments = "--flake ${nixUpdateLocation}";
pre_commands = { };
nix-flake-update = if flakeUpdateLocation then "sudo nix flake update --flake ${flakeUpdateLocation}" else null; })
}; (mkIf (homeUpdateLocation != null) {
}; linux = {
home_manager_arguments = "--flake ${homeUpdateLocation}";
};
})
(mkIf (flakeUpdateLocation != null) {
pre_commands = {
nix-flake-update = "sudo nix flake update --flake ${flakeUpdateLocation}";
};
})];
}; };
alacritty = { alacritty = {