use mkIf for conditionals
This commit is contained in:
@@ -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;
|
||||||
};
|
};
|
||||||
|
}
|
||||||
|
(mkIf (nixUpdateLocation != null) {
|
||||||
linux = {
|
linux = {
|
||||||
nix_arguments = if nixUpdateLocation then "--flake ${nixUpdateLocation}" else null;
|
nix_arguments = "--flake ${nixUpdateLocation}";
|
||||||
home_manager_arguments = if homeUpdateLocation then "--flake ${homeUpdateLocation}" else null;
|
|
||||||
};
|
};
|
||||||
|
})
|
||||||
|
(mkIf (homeUpdateLocation != null) {
|
||||||
|
linux = {
|
||||||
|
home_manager_arguments = "--flake ${homeUpdateLocation}";
|
||||||
|
};
|
||||||
|
})
|
||||||
|
(mkIf (flakeUpdateLocation != null) {
|
||||||
pre_commands = {
|
pre_commands = {
|
||||||
nix-flake-update = if flakeUpdateLocation then "sudo nix flake update --flake ${flakeUpdateLocation}" else null;
|
nix-flake-update = "sudo nix flake update --flake ${flakeUpdateLocation}";
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
})];
|
||||||
};
|
};
|
||||||
|
|
||||||
alacritty = {
|
alacritty = {
|
||||||
|
|||||||
Reference in New Issue
Block a user