2023-08-23 20:29:29 +01:00
|
|
|
{ config, lib, options, pkgs, ... }: # XXX migration code for freeform settings: `options` can be removed in 2025
|
|
|
|
let optionsGlobal = options; in
|
2019-05-15 17:17:30 +01:00
|
|
|
|
|
|
|
let
|
|
|
|
|
2023-08-23 15:56:55 +01:00
|
|
|
inherit (lib.attrsets) attrNames attrValues mapAttrsToList removeAttrs;
|
|
|
|
inherit (lib.lists) all allUnique concatLists elem isList map;
|
2019-05-15 17:17:30 +01:00
|
|
|
inherit (lib.modules) mkDefault mkIf;
|
nixos/tsm-client: use `freeformType` for server config
`tsm-client` uses a global configuration
file that must contain coordinates for each
server that it is supposed to contact.
This configuration consists of text
lines with key-value pairs.
In the NixOS module, these servers may be declared
with an attribute set, where the attribute name
defines an alias for the server, and the value
is again an attribute set with the settings for
the respective server.
This is organized as an option of type `attrsOf submodule...`.
Before this commit:
Important settings have their own option within
the submodule. For everything else, there is
the "catch-all" option `extraConfig` that may
be used to declare any key-value pairs.
There is also `text` that can be used to
add arbitrary text to each server's
section in the global config file.
After this commit:
`extraConfig` and `text` are gone,
the attribute names and values of each server's attribute
set are translated directly into key-value pairs,
with the following notable rules:
* Lists are translated into multiple lines
with the same key, as such is permitted by
the software for certain keys.
* `null` may be used to override/shadow a value that
is defined elsewhere and hides the corresponding key.
Those "important settings" that have previously been
defined as dedicated options are still defined as such,
but they have been renamed to match their
corresponding key names in the configuration file.
There is a notable exception:
"Our" boolean option `genPasswd` influences the "real"
option `passwordaccess', but the latter one is
uncomfortable to use and might lead
to undesirable outcome if used the wrong way.
So it seems advisable to keep the boolean option
and the warning in its description.
To this end, the value of `getPasswd` itself is
later filtered out when the config file is generated.
The tsm-backup service module and the vm test are adapted.
Migration code will be added in a separate
commit to permit easy reversal later, when the
migration code is no longer deemed necessary.
2023-08-23 15:00:32 +01:00
|
|
|
inherit (lib.options) mkEnableOption mkOption mkPackageOption;
|
2023-08-23 15:56:55 +01:00
|
|
|
inherit (lib.strings) concatLines match optionalString toLower;
|
nixos/tsm-client: use `freeformType` for server config
`tsm-client` uses a global configuration
file that must contain coordinates for each
server that it is supposed to contact.
This configuration consists of text
lines with key-value pairs.
In the NixOS module, these servers may be declared
with an attribute set, where the attribute name
defines an alias for the server, and the value
is again an attribute set with the settings for
the respective server.
This is organized as an option of type `attrsOf submodule...`.
Before this commit:
Important settings have their own option within
the submodule. For everything else, there is
the "catch-all" option `extraConfig` that may
be used to declare any key-value pairs.
There is also `text` that can be used to
add arbitrary text to each server's
section in the global config file.
After this commit:
`extraConfig` and `text` are gone,
the attribute names and values of each server's attribute
set are translated directly into key-value pairs,
with the following notable rules:
* Lists are translated into multiple lines
with the same key, as such is permitted by
the software for certain keys.
* `null` may be used to override/shadow a value that
is defined elsewhere and hides the corresponding key.
Those "important settings" that have previously been
defined as dedicated options are still defined as such,
but they have been renamed to match their
corresponding key names in the configuration file.
There is a notable exception:
"Our" boolean option `genPasswd` influences the "real"
option `passwordaccess', but the latter one is
uncomfortable to use and might lead
to undesirable outcome if used the wrong way.
So it seems advisable to keep the boolean option
and the warning in its description.
To this end, the value of `getPasswd` itself is
later filtered out when the config file is generated.
The tsm-backup service module and the vm test are adapted.
Migration code will be added in a separate
commit to permit easy reversal later, when the
migration code is no longer deemed necessary.
2023-08-23 15:00:32 +01:00
|
|
|
inherit (lib.trivial) isInt;
|
|
|
|
inherit (lib.types) addCheck attrsOf coercedTo either enum int lines listOf nonEmptyStr nullOr oneOf path port singleLineStr strMatching submodule;
|
|
|
|
|
|
|
|
scalarType =
|
|
|
|
# see the option's description below for the
|
|
|
|
# handling/transformation of each possible type
|
|
|
|
oneOf [ (enum [ true null ]) int path singleLineStr ];
|
2019-05-15 17:17:30 +01:00
|
|
|
|
|
|
|
# TSM rejects servername strings longer than 64 chars.
|
2023-08-21 15:45:24 +01:00
|
|
|
servernameType = strMatching "[^[:space:]]{1,64}";
|
2019-05-15 17:17:30 +01:00
|
|
|
|
|
|
|
serverOptions = { name, config, ... }: {
|
nixos/tsm-client: use `freeformType` for server config
`tsm-client` uses a global configuration
file that must contain coordinates for each
server that it is supposed to contact.
This configuration consists of text
lines with key-value pairs.
In the NixOS module, these servers may be declared
with an attribute set, where the attribute name
defines an alias for the server, and the value
is again an attribute set with the settings for
the respective server.
This is organized as an option of type `attrsOf submodule...`.
Before this commit:
Important settings have their own option within
the submodule. For everything else, there is
the "catch-all" option `extraConfig` that may
be used to declare any key-value pairs.
There is also `text` that can be used to
add arbitrary text to each server's
section in the global config file.
After this commit:
`extraConfig` and `text` are gone,
the attribute names and values of each server's attribute
set are translated directly into key-value pairs,
with the following notable rules:
* Lists are translated into multiple lines
with the same key, as such is permitted by
the software for certain keys.
* `null` may be used to override/shadow a value that
is defined elsewhere and hides the corresponding key.
Those "important settings" that have previously been
defined as dedicated options are still defined as such,
but they have been renamed to match their
corresponding key names in the configuration file.
There is a notable exception:
"Our" boolean option `genPasswd` influences the "real"
option `passwordaccess', but the latter one is
uncomfortable to use and might lead
to undesirable outcome if used the wrong way.
So it seems advisable to keep the boolean option
and the warning in its description.
To this end, the value of `getPasswd` itself is
later filtered out when the config file is generated.
The tsm-backup service module and the vm test are adapted.
Migration code will be added in a separate
commit to permit easy reversal later, when the
migration code is no longer deemed necessary.
2023-08-23 15:00:32 +01:00
|
|
|
freeformType = attrsOf (either scalarType (listOf scalarType));
|
|
|
|
# Client system-options file directives are explained here:
|
|
|
|
# https://www.ibm.com/docs/en/storage-protect/8.1.20?topic=commands-processing-options
|
|
|
|
options.servername = mkOption {
|
2019-05-15 17:17:30 +01:00
|
|
|
type = servernameType;
|
nixos/tsm-client: use `freeformType` for server config
`tsm-client` uses a global configuration
file that must contain coordinates for each
server that it is supposed to contact.
This configuration consists of text
lines with key-value pairs.
In the NixOS module, these servers may be declared
with an attribute set, where the attribute name
defines an alias for the server, and the value
is again an attribute set with the settings for
the respective server.
This is organized as an option of type `attrsOf submodule...`.
Before this commit:
Important settings have their own option within
the submodule. For everything else, there is
the "catch-all" option `extraConfig` that may
be used to declare any key-value pairs.
There is also `text` that can be used to
add arbitrary text to each server's
section in the global config file.
After this commit:
`extraConfig` and `text` are gone,
the attribute names and values of each server's attribute
set are translated directly into key-value pairs,
with the following notable rules:
* Lists are translated into multiple lines
with the same key, as such is permitted by
the software for certain keys.
* `null` may be used to override/shadow a value that
is defined elsewhere and hides the corresponding key.
Those "important settings" that have previously been
defined as dedicated options are still defined as such,
but they have been renamed to match their
corresponding key names in the configuration file.
There is a notable exception:
"Our" boolean option `genPasswd` influences the "real"
option `passwordaccess', but the latter one is
uncomfortable to use and might lead
to undesirable outcome if used the wrong way.
So it seems advisable to keep the boolean option
and the warning in its description.
To this end, the value of `getPasswd` itself is
later filtered out when the config file is generated.
The tsm-backup service module and the vm test are adapted.
Migration code will be added in a separate
commit to permit easy reversal later, when the
migration code is no longer deemed necessary.
2023-08-23 15:00:32 +01:00
|
|
|
default = name;
|
2019-05-15 17:17:30 +01:00
|
|
|
example = "mainTsmServer";
|
|
|
|
description = lib.mdDoc ''
|
|
|
|
Local name of the IBM TSM server,
|
nixos/tsm-client: use `freeformType` for server config
`tsm-client` uses a global configuration
file that must contain coordinates for each
server that it is supposed to contact.
This configuration consists of text
lines with key-value pairs.
In the NixOS module, these servers may be declared
with an attribute set, where the attribute name
defines an alias for the server, and the value
is again an attribute set with the settings for
the respective server.
This is organized as an option of type `attrsOf submodule...`.
Before this commit:
Important settings have their own option within
the submodule. For everything else, there is
the "catch-all" option `extraConfig` that may
be used to declare any key-value pairs.
There is also `text` that can be used to
add arbitrary text to each server's
section in the global config file.
After this commit:
`extraConfig` and `text` are gone,
the attribute names and values of each server's attribute
set are translated directly into key-value pairs,
with the following notable rules:
* Lists are translated into multiple lines
with the same key, as such is permitted by
the software for certain keys.
* `null` may be used to override/shadow a value that
is defined elsewhere and hides the corresponding key.
Those "important settings" that have previously been
defined as dedicated options are still defined as such,
but they have been renamed to match their
corresponding key names in the configuration file.
There is a notable exception:
"Our" boolean option `genPasswd` influences the "real"
option `passwordaccess', but the latter one is
uncomfortable to use and might lead
to undesirable outcome if used the wrong way.
So it seems advisable to keep the boolean option
and the warning in its description.
To this end, the value of `getPasswd` itself is
later filtered out when the config file is generated.
The tsm-backup service module and the vm test are adapted.
Migration code will be added in a separate
commit to permit easy reversal later, when the
migration code is no longer deemed necessary.
2023-08-23 15:00:32 +01:00
|
|
|
must not contain space or more than 64 chars.
|
2019-05-15 17:17:30 +01:00
|
|
|
'';
|
|
|
|
};
|
nixos/tsm-client: use `freeformType` for server config
`tsm-client` uses a global configuration
file that must contain coordinates for each
server that it is supposed to contact.
This configuration consists of text
lines with key-value pairs.
In the NixOS module, these servers may be declared
with an attribute set, where the attribute name
defines an alias for the server, and the value
is again an attribute set with the settings for
the respective server.
This is organized as an option of type `attrsOf submodule...`.
Before this commit:
Important settings have their own option within
the submodule. For everything else, there is
the "catch-all" option `extraConfig` that may
be used to declare any key-value pairs.
There is also `text` that can be used to
add arbitrary text to each server's
section in the global config file.
After this commit:
`extraConfig` and `text` are gone,
the attribute names and values of each server's attribute
set are translated directly into key-value pairs,
with the following notable rules:
* Lists are translated into multiple lines
with the same key, as such is permitted by
the software for certain keys.
* `null` may be used to override/shadow a value that
is defined elsewhere and hides the corresponding key.
Those "important settings" that have previously been
defined as dedicated options are still defined as such,
but they have been renamed to match their
corresponding key names in the configuration file.
There is a notable exception:
"Our" boolean option `genPasswd` influences the "real"
option `passwordaccess', but the latter one is
uncomfortable to use and might lead
to undesirable outcome if used the wrong way.
So it seems advisable to keep the boolean option
and the warning in its description.
To this end, the value of `getPasswd` itself is
later filtered out when the config file is generated.
The tsm-backup service module and the vm test are adapted.
Migration code will be added in a separate
commit to permit easy reversal later, when the
migration code is no longer deemed necessary.
2023-08-23 15:00:32 +01:00
|
|
|
options.tcpserveraddress = mkOption {
|
2021-12-05 12:52:06 +00:00
|
|
|
type = nonEmptyStr;
|
2019-05-15 17:17:30 +01:00
|
|
|
example = "tsmserver.company.com";
|
|
|
|
description = lib.mdDoc ''
|
|
|
|
Host/domain name or IP address of the IBM TSM server.
|
|
|
|
'';
|
|
|
|
};
|
nixos/tsm-client: use `freeformType` for server config
`tsm-client` uses a global configuration
file that must contain coordinates for each
server that it is supposed to contact.
This configuration consists of text
lines with key-value pairs.
In the NixOS module, these servers may be declared
with an attribute set, where the attribute name
defines an alias for the server, and the value
is again an attribute set with the settings for
the respective server.
This is organized as an option of type `attrsOf submodule...`.
Before this commit:
Important settings have their own option within
the submodule. For everything else, there is
the "catch-all" option `extraConfig` that may
be used to declare any key-value pairs.
There is also `text` that can be used to
add arbitrary text to each server's
section in the global config file.
After this commit:
`extraConfig` and `text` are gone,
the attribute names and values of each server's attribute
set are translated directly into key-value pairs,
with the following notable rules:
* Lists are translated into multiple lines
with the same key, as such is permitted by
the software for certain keys.
* `null` may be used to override/shadow a value that
is defined elsewhere and hides the corresponding key.
Those "important settings" that have previously been
defined as dedicated options are still defined as such,
but they have been renamed to match their
corresponding key names in the configuration file.
There is a notable exception:
"Our" boolean option `genPasswd` influences the "real"
option `passwordaccess', but the latter one is
uncomfortable to use and might lead
to undesirable outcome if used the wrong way.
So it seems advisable to keep the boolean option
and the warning in its description.
To this end, the value of `getPasswd` itself is
later filtered out when the config file is generated.
The tsm-backup service module and the vm test are adapted.
Migration code will be added in a separate
commit to permit easy reversal later, when the
migration code is no longer deemed necessary.
2023-08-23 15:00:32 +01:00
|
|
|
options.tcpport = mkOption {
|
2019-05-15 17:17:30 +01:00
|
|
|
type = addCheck port (p: p<=32767);
|
|
|
|
default = 1500; # official default
|
|
|
|
description = lib.mdDoc ''
|
|
|
|
TCP port of the IBM TSM server.
|
|
|
|
TSM does not support ports above 32767.
|
|
|
|
'';
|
|
|
|
};
|
nixos/tsm-client: use `freeformType` for server config
`tsm-client` uses a global configuration
file that must contain coordinates for each
server that it is supposed to contact.
This configuration consists of text
lines with key-value pairs.
In the NixOS module, these servers may be declared
with an attribute set, where the attribute name
defines an alias for the server, and the value
is again an attribute set with the settings for
the respective server.
This is organized as an option of type `attrsOf submodule...`.
Before this commit:
Important settings have their own option within
the submodule. For everything else, there is
the "catch-all" option `extraConfig` that may
be used to declare any key-value pairs.
There is also `text` that can be used to
add arbitrary text to each server's
section in the global config file.
After this commit:
`extraConfig` and `text` are gone,
the attribute names and values of each server's attribute
set are translated directly into key-value pairs,
with the following notable rules:
* Lists are translated into multiple lines
with the same key, as such is permitted by
the software for certain keys.
* `null` may be used to override/shadow a value that
is defined elsewhere and hides the corresponding key.
Those "important settings" that have previously been
defined as dedicated options are still defined as such,
but they have been renamed to match their
corresponding key names in the configuration file.
There is a notable exception:
"Our" boolean option `genPasswd` influences the "real"
option `passwordaccess', but the latter one is
uncomfortable to use and might lead
to undesirable outcome if used the wrong way.
So it seems advisable to keep the boolean option
and the warning in its description.
To this end, the value of `getPasswd` itself is
later filtered out when the config file is generated.
The tsm-backup service module and the vm test are adapted.
Migration code will be added in a separate
commit to permit easy reversal later, when the
migration code is no longer deemed necessary.
2023-08-23 15:00:32 +01:00
|
|
|
options.nodename = mkOption {
|
2021-12-05 12:52:06 +00:00
|
|
|
type = nonEmptyStr;
|
2019-05-15 17:17:30 +01:00
|
|
|
example = "MY-TSM-NODE";
|
|
|
|
description = lib.mdDoc ''
|
|
|
|
Target node name on the IBM TSM server.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
options.genPasswd = mkEnableOption (lib.mdDoc ''
|
|
|
|
automatic client password generation.
|
nixos/tsm-client: use `freeformType` for server config
`tsm-client` uses a global configuration
file that must contain coordinates for each
server that it is supposed to contact.
This configuration consists of text
lines with key-value pairs.
In the NixOS module, these servers may be declared
with an attribute set, where the attribute name
defines an alias for the server, and the value
is again an attribute set with the settings for
the respective server.
This is organized as an option of type `attrsOf submodule...`.
Before this commit:
Important settings have their own option within
the submodule. For everything else, there is
the "catch-all" option `extraConfig` that may
be used to declare any key-value pairs.
There is also `text` that can be used to
add arbitrary text to each server's
section in the global config file.
After this commit:
`extraConfig` and `text` are gone,
the attribute names and values of each server's attribute
set are translated directly into key-value pairs,
with the following notable rules:
* Lists are translated into multiple lines
with the same key, as such is permitted by
the software for certain keys.
* `null` may be used to override/shadow a value that
is defined elsewhere and hides the corresponding key.
Those "important settings" that have previously been
defined as dedicated options are still defined as such,
but they have been renamed to match their
corresponding key names in the configuration file.
There is a notable exception:
"Our" boolean option `genPasswd` influences the "real"
option `passwordaccess', but the latter one is
uncomfortable to use and might lead
to undesirable outcome if used the wrong way.
So it seems advisable to keep the boolean option
and the warning in its description.
To this end, the value of `getPasswd` itself is
later filtered out when the config file is generated.
The tsm-backup service module and the vm test are adapted.
Migration code will be added in a separate
commit to permit easy reversal later, when the
migration code is no longer deemed necessary.
2023-08-23 15:00:32 +01:00
|
|
|
This option does *not* cause a line in
|
|
|
|
{file}`dsm.sys` by itself, but generates a
|
|
|
|
corresponding `passwordaccess` directive.
|
2019-05-15 17:17:30 +01:00
|
|
|
The password will be stored in the directory
|
nixos/tsm-client: use `freeformType` for server config
`tsm-client` uses a global configuration
file that must contain coordinates for each
server that it is supposed to contact.
This configuration consists of text
lines with key-value pairs.
In the NixOS module, these servers may be declared
with an attribute set, where the attribute name
defines an alias for the server, and the value
is again an attribute set with the settings for
the respective server.
This is organized as an option of type `attrsOf submodule...`.
Before this commit:
Important settings have their own option within
the submodule. For everything else, there is
the "catch-all" option `extraConfig` that may
be used to declare any key-value pairs.
There is also `text` that can be used to
add arbitrary text to each server's
section in the global config file.
After this commit:
`extraConfig` and `text` are gone,
the attribute names and values of each server's attribute
set are translated directly into key-value pairs,
with the following notable rules:
* Lists are translated into multiple lines
with the same key, as such is permitted by
the software for certain keys.
* `null` may be used to override/shadow a value that
is defined elsewhere and hides the corresponding key.
Those "important settings" that have previously been
defined as dedicated options are still defined as such,
but they have been renamed to match their
corresponding key names in the configuration file.
There is a notable exception:
"Our" boolean option `genPasswd` influences the "real"
option `passwordaccess', but the latter one is
uncomfortable to use and might lead
to undesirable outcome if used the wrong way.
So it seems advisable to keep the boolean option
and the warning in its description.
To this end, the value of `getPasswd` itself is
later filtered out when the config file is generated.
The tsm-backup service module and the vm test are adapted.
Migration code will be added in a separate
commit to permit easy reversal later, when the
migration code is no longer deemed necessary.
2023-08-23 15:00:32 +01:00
|
|
|
given by the option {option}`passworddir`.
|
2019-05-15 17:17:30 +01:00
|
|
|
*Caution*:
|
|
|
|
If this option is enabled and the server forces
|
|
|
|
to renew the password (e.g. on first connection),
|
|
|
|
a random password will be generated and stored
|
|
|
|
'');
|
nixos/tsm-client: use `freeformType` for server config
`tsm-client` uses a global configuration
file that must contain coordinates for each
server that it is supposed to contact.
This configuration consists of text
lines with key-value pairs.
In the NixOS module, these servers may be declared
with an attribute set, where the attribute name
defines an alias for the server, and the value
is again an attribute set with the settings for
the respective server.
This is organized as an option of type `attrsOf submodule...`.
Before this commit:
Important settings have their own option within
the submodule. For everything else, there is
the "catch-all" option `extraConfig` that may
be used to declare any key-value pairs.
There is also `text` that can be used to
add arbitrary text to each server's
section in the global config file.
After this commit:
`extraConfig` and `text` are gone,
the attribute names and values of each server's attribute
set are translated directly into key-value pairs,
with the following notable rules:
* Lists are translated into multiple lines
with the same key, as such is permitted by
the software for certain keys.
* `null` may be used to override/shadow a value that
is defined elsewhere and hides the corresponding key.
Those "important settings" that have previously been
defined as dedicated options are still defined as such,
but they have been renamed to match their
corresponding key names in the configuration file.
There is a notable exception:
"Our" boolean option `genPasswd` influences the "real"
option `passwordaccess', but the latter one is
uncomfortable to use and might lead
to undesirable outcome if used the wrong way.
So it seems advisable to keep the boolean option
and the warning in its description.
To this end, the value of `getPasswd` itself is
later filtered out when the config file is generated.
The tsm-backup service module and the vm test are adapted.
Migration code will be added in a separate
commit to permit easy reversal later, when the
migration code is no longer deemed necessary.
2023-08-23 15:00:32 +01:00
|
|
|
options.passwordaccess = mkOption {
|
|
|
|
type = enum [ "generate" "prompt" ];
|
|
|
|
visible = false;
|
|
|
|
};
|
|
|
|
options.passworddir = mkOption {
|
|
|
|
type = nullOr path;
|
|
|
|
default = null;
|
2019-05-15 17:17:30 +01:00
|
|
|
example = "/home/alice/tsm-password";
|
|
|
|
description = lib.mdDoc ''
|
|
|
|
Directory that holds the TSM
|
|
|
|
node's password information.
|
|
|
|
'';
|
|
|
|
};
|
nixos/tsm-client: use `freeformType` for server config
`tsm-client` uses a global configuration
file that must contain coordinates for each
server that it is supposed to contact.
This configuration consists of text
lines with key-value pairs.
In the NixOS module, these servers may be declared
with an attribute set, where the attribute name
defines an alias for the server, and the value
is again an attribute set with the settings for
the respective server.
This is organized as an option of type `attrsOf submodule...`.
Before this commit:
Important settings have their own option within
the submodule. For everything else, there is
the "catch-all" option `extraConfig` that may
be used to declare any key-value pairs.
There is also `text` that can be used to
add arbitrary text to each server's
section in the global config file.
After this commit:
`extraConfig` and `text` are gone,
the attribute names and values of each server's attribute
set are translated directly into key-value pairs,
with the following notable rules:
* Lists are translated into multiple lines
with the same key, as such is permitted by
the software for certain keys.
* `null` may be used to override/shadow a value that
is defined elsewhere and hides the corresponding key.
Those "important settings" that have previously been
defined as dedicated options are still defined as such,
but they have been renamed to match their
corresponding key names in the configuration file.
There is a notable exception:
"Our" boolean option `genPasswd` influences the "real"
option `passwordaccess', but the latter one is
uncomfortable to use and might lead
to undesirable outcome if used the wrong way.
So it seems advisable to keep the boolean option
and the warning in its description.
To this end, the value of `getPasswd` itself is
later filtered out when the config file is generated.
The tsm-backup service module and the vm test are adapted.
Migration code will be added in a separate
commit to permit easy reversal later, when the
migration code is no longer deemed necessary.
2023-08-23 15:00:32 +01:00
|
|
|
options.inclexcl = mkOption {
|
|
|
|
type = coercedTo lines
|
|
|
|
(pkgs.writeText "inclexcl.dsm.sys")
|
|
|
|
(nullOr path);
|
|
|
|
default = null;
|
2019-05-15 17:17:30 +01:00
|
|
|
example = ''
|
|
|
|
exclude.dir /nix/store
|
|
|
|
include.encrypt /home/.../*
|
|
|
|
'';
|
|
|
|
description = lib.mdDoc ''
|
nixos/tsm-client: use `freeformType` for server config
`tsm-client` uses a global configuration
file that must contain coordinates for each
server that it is supposed to contact.
This configuration consists of text
lines with key-value pairs.
In the NixOS module, these servers may be declared
with an attribute set, where the attribute name
defines an alias for the server, and the value
is again an attribute set with the settings for
the respective server.
This is organized as an option of type `attrsOf submodule...`.
Before this commit:
Important settings have their own option within
the submodule. For everything else, there is
the "catch-all" option `extraConfig` that may
be used to declare any key-value pairs.
There is also `text` that can be used to
add arbitrary text to each server's
section in the global config file.
After this commit:
`extraConfig` and `text` are gone,
the attribute names and values of each server's attribute
set are translated directly into key-value pairs,
with the following notable rules:
* Lists are translated into multiple lines
with the same key, as such is permitted by
the software for certain keys.
* `null` may be used to override/shadow a value that
is defined elsewhere and hides the corresponding key.
Those "important settings" that have previously been
defined as dedicated options are still defined as such,
but they have been renamed to match their
corresponding key names in the configuration file.
There is a notable exception:
"Our" boolean option `genPasswd` influences the "real"
option `passwordaccess', but the latter one is
uncomfortable to use and might lead
to undesirable outcome if used the wrong way.
So it seems advisable to keep the boolean option
and the warning in its description.
To this end, the value of `getPasswd` itself is
later filtered out when the config file is generated.
The tsm-backup service module and the vm test are adapted.
Migration code will be added in a separate
commit to permit easy reversal later, when the
migration code is no longer deemed necessary.
2023-08-23 15:00:32 +01:00
|
|
|
Text lines with `include.*` and `exclude.*` directives
|
|
|
|
to be used when sending files to the IBM TSM server,
|
|
|
|
or an absolute path pointing to a file with such lines.
|
2019-05-15 17:17:30 +01:00
|
|
|
'';
|
|
|
|
};
|
nixos/tsm-client: use `freeformType` for server config
`tsm-client` uses a global configuration
file that must contain coordinates for each
server that it is supposed to contact.
This configuration consists of text
lines with key-value pairs.
In the NixOS module, these servers may be declared
with an attribute set, where the attribute name
defines an alias for the server, and the value
is again an attribute set with the settings for
the respective server.
This is organized as an option of type `attrsOf submodule...`.
Before this commit:
Important settings have their own option within
the submodule. For everything else, there is
the "catch-all" option `extraConfig` that may
be used to declare any key-value pairs.
There is also `text` that can be used to
add arbitrary text to each server's
section in the global config file.
After this commit:
`extraConfig` and `text` are gone,
the attribute names and values of each server's attribute
set are translated directly into key-value pairs,
with the following notable rules:
* Lists are translated into multiple lines
with the same key, as such is permitted by
the software for certain keys.
* `null` may be used to override/shadow a value that
is defined elsewhere and hides the corresponding key.
Those "important settings" that have previously been
defined as dedicated options are still defined as such,
but they have been renamed to match their
corresponding key names in the configuration file.
There is a notable exception:
"Our" boolean option `genPasswd` influences the "real"
option `passwordaccess', but the latter one is
uncomfortable to use and might lead
to undesirable outcome if used the wrong way.
So it seems advisable to keep the boolean option
and the warning in its description.
To this end, the value of `getPasswd` itself is
later filtered out when the config file is generated.
The tsm-backup service module and the vm test are adapted.
Migration code will be added in a separate
commit to permit easy reversal later, when the
migration code is no longer deemed necessary.
2023-08-23 15:00:32 +01:00
|
|
|
config.commmethod = mkDefault "v6tcpip"; # uses v4 or v6, based on dns lookup result
|
|
|
|
config.passwordaccess = if config.genPasswd then "generate" else "prompt";
|
2023-08-23 20:29:29 +01:00
|
|
|
# XXX migration code for freeform settings, these can be removed in 2025:
|
|
|
|
options.warnings = optionsGlobal.warnings;
|
|
|
|
options.assertions = optionsGlobal.assertions;
|
|
|
|
imports = let inherit (lib.modules) mkRemovedOptionModule mkRenamedOptionModule; in [
|
|
|
|
(mkRemovedOptionModule [ "extraConfig" ] "Please just add options directly to the server attribute set, cf. the description of `programs.tsmClient.servers`.")
|
|
|
|
(mkRemovedOptionModule [ "text" ] "Please just add options directly to the server attribute set, cf. the description of `programs.tsmClient.servers`.")
|
|
|
|
(mkRenamedOptionModule [ "name" ] [ "servername" ])
|
|
|
|
(mkRenamedOptionModule [ "server" ] [ "tcpserveraddress" ])
|
|
|
|
(mkRenamedOptionModule [ "port" ] [ "tcpport" ])
|
|
|
|
(mkRenamedOptionModule [ "node" ] [ "nodename" ])
|
|
|
|
(mkRenamedOptionModule [ "passwdDir" ] [ "passworddir" ])
|
|
|
|
(mkRenamedOptionModule [ "includeExclude" ] [ "inclexcl" ])
|
|
|
|
];
|
2019-05-15 17:17:30 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
options.programs.tsmClient = {
|
|
|
|
enable = mkEnableOption (lib.mdDoc ''
|
2023-08-15 10:12:07 +01:00
|
|
|
IBM Storage Protect (Tivoli Storage Manager, TSM)
|
2019-05-15 17:17:30 +01:00
|
|
|
client command line applications with a
|
|
|
|
client system-options file "dsm.sys"
|
|
|
|
'');
|
|
|
|
servers = mkOption {
|
2023-08-21 15:45:31 +01:00
|
|
|
type = attrsOf (submodule serverOptions);
|
2019-05-15 17:17:30 +01:00
|
|
|
default = {};
|
|
|
|
example.mainTsmServer = {
|
nixos/tsm-client: use `freeformType` for server config
`tsm-client` uses a global configuration
file that must contain coordinates for each
server that it is supposed to contact.
This configuration consists of text
lines with key-value pairs.
In the NixOS module, these servers may be declared
with an attribute set, where the attribute name
defines an alias for the server, and the value
is again an attribute set with the settings for
the respective server.
This is organized as an option of type `attrsOf submodule...`.
Before this commit:
Important settings have their own option within
the submodule. For everything else, there is
the "catch-all" option `extraConfig` that may
be used to declare any key-value pairs.
There is also `text` that can be used to
add arbitrary text to each server's
section in the global config file.
After this commit:
`extraConfig` and `text` are gone,
the attribute names and values of each server's attribute
set are translated directly into key-value pairs,
with the following notable rules:
* Lists are translated into multiple lines
with the same key, as such is permitted by
the software for certain keys.
* `null` may be used to override/shadow a value that
is defined elsewhere and hides the corresponding key.
Those "important settings" that have previously been
defined as dedicated options are still defined as such,
but they have been renamed to match their
corresponding key names in the configuration file.
There is a notable exception:
"Our" boolean option `genPasswd` influences the "real"
option `passwordaccess', but the latter one is
uncomfortable to use and might lead
to undesirable outcome if used the wrong way.
So it seems advisable to keep the boolean option
and the warning in its description.
To this end, the value of `getPasswd` itself is
later filtered out when the config file is generated.
The tsm-backup service module and the vm test are adapted.
Migration code will be added in a separate
commit to permit easy reversal later, when the
migration code is no longer deemed necessary.
2023-08-23 15:00:32 +01:00
|
|
|
tcpserveraddress = "tsmserver.company.com";
|
|
|
|
nodename = "MY-TSM-NODE";
|
|
|
|
compression = "yes";
|
2019-05-15 17:17:30 +01:00
|
|
|
};
|
|
|
|
description = lib.mdDoc ''
|
|
|
|
Server definitions ("stanzas")
|
|
|
|
for the client system-options file.
|
nixos/tsm-client: use `freeformType` for server config
`tsm-client` uses a global configuration
file that must contain coordinates for each
server that it is supposed to contact.
This configuration consists of text
lines with key-value pairs.
In the NixOS module, these servers may be declared
with an attribute set, where the attribute name
defines an alias for the server, and the value
is again an attribute set with the settings for
the respective server.
This is organized as an option of type `attrsOf submodule...`.
Before this commit:
Important settings have their own option within
the submodule. For everything else, there is
the "catch-all" option `extraConfig` that may
be used to declare any key-value pairs.
There is also `text` that can be used to
add arbitrary text to each server's
section in the global config file.
After this commit:
`extraConfig` and `text` are gone,
the attribute names and values of each server's attribute
set are translated directly into key-value pairs,
with the following notable rules:
* Lists are translated into multiple lines
with the same key, as such is permitted by
the software for certain keys.
* `null` may be used to override/shadow a value that
is defined elsewhere and hides the corresponding key.
Those "important settings" that have previously been
defined as dedicated options are still defined as such,
but they have been renamed to match their
corresponding key names in the configuration file.
There is a notable exception:
"Our" boolean option `genPasswd` influences the "real"
option `passwordaccess', but the latter one is
uncomfortable to use and might lead
to undesirable outcome if used the wrong way.
So it seems advisable to keep the boolean option
and the warning in its description.
To this end, the value of `getPasswd` itself is
later filtered out when the config file is generated.
The tsm-backup service module and the vm test are adapted.
Migration code will be added in a separate
commit to permit easy reversal later, when the
migration code is no longer deemed necessary.
2023-08-23 15:00:32 +01:00
|
|
|
The name of each entry will be used for
|
|
|
|
the internal `servername` by default.
|
|
|
|
Each attribute will be transformed into a line
|
|
|
|
with a key-value pair within the server's stanza.
|
|
|
|
Integers as values will be
|
|
|
|
canonically turned into strings.
|
|
|
|
The boolean value `true` will be turned
|
|
|
|
into a line with just the attribute's name.
|
|
|
|
The value `null` will not generate a line.
|
|
|
|
A list as values generates an entry for
|
|
|
|
each value, according to the rules above.
|
2019-05-15 17:17:30 +01:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
defaultServername = mkOption {
|
|
|
|
type = nullOr servernameType;
|
|
|
|
default = null;
|
|
|
|
example = "mainTsmServer";
|
|
|
|
description = lib.mdDoc ''
|
|
|
|
If multiple server stanzas are declared with
|
|
|
|
{option}`programs.tsmClient.servers`,
|
|
|
|
this option may be used to name a default
|
|
|
|
server stanza that IBM TSM uses in the absence of
|
|
|
|
a user-defined {file}`dsm.opt` file.
|
|
|
|
This option translates to a
|
|
|
|
`defaultserver` configuration line.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
dsmSysText = mkOption {
|
|
|
|
type = lines;
|
|
|
|
readOnly = true;
|
|
|
|
description = lib.mdDoc ''
|
|
|
|
This configuration key contains the effective text
|
|
|
|
of the client system-options file "dsm.sys".
|
|
|
|
It should not be changed, but may be
|
|
|
|
used to feed the configuration into other
|
|
|
|
TSM-depending packages used on the system.
|
|
|
|
'';
|
|
|
|
};
|
2023-11-27 00:19:27 +00:00
|
|
|
package = mkPackageOption pkgs "tsm-client" {
|
|
|
|
example = "tsm-client-withGui";
|
|
|
|
extraDescription = ''
|
2022-10-17 00:31:05 +01:00
|
|
|
It will be used with `.override`
|
2019-05-15 17:17:30 +01:00
|
|
|
to add paths to the client system-options file.
|
|
|
|
'';
|
|
|
|
};
|
2023-11-18 12:55:36 +00:00
|
|
|
wrappedPackage = mkPackageOption pkgs "tsm-client" {
|
|
|
|
default = null;
|
|
|
|
extraDescription = ''
|
|
|
|
This option is to provide the effective derivation,
|
|
|
|
wrapped with the path to the
|
|
|
|
client system-options file "dsm.sys".
|
|
|
|
It should not be changed, but exists
|
2019-05-15 17:17:30 +01:00
|
|
|
for other modules that want to call TSM executables.
|
|
|
|
'';
|
2023-11-18 12:55:36 +00:00
|
|
|
} // { readOnly = true; };
|
2019-05-15 17:17:30 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
cfg = config.programs.tsmClient;
|
nixos/tsm-client: use `freeformType` for server config
`tsm-client` uses a global configuration
file that must contain coordinates for each
server that it is supposed to contact.
This configuration consists of text
lines with key-value pairs.
In the NixOS module, these servers may be declared
with an attribute set, where the attribute name
defines an alias for the server, and the value
is again an attribute set with the settings for
the respective server.
This is organized as an option of type `attrsOf submodule...`.
Before this commit:
Important settings have their own option within
the submodule. For everything else, there is
the "catch-all" option `extraConfig` that may
be used to declare any key-value pairs.
There is also `text` that can be used to
add arbitrary text to each server's
section in the global config file.
After this commit:
`extraConfig` and `text` are gone,
the attribute names and values of each server's attribute
set are translated directly into key-value pairs,
with the following notable rules:
* Lists are translated into multiple lines
with the same key, as such is permitted by
the software for certain keys.
* `null` may be used to override/shadow a value that
is defined elsewhere and hides the corresponding key.
Those "important settings" that have previously been
defined as dedicated options are still defined as such,
but they have been renamed to match their
corresponding key names in the configuration file.
There is a notable exception:
"Our" boolean option `genPasswd` influences the "real"
option `passwordaccess', but the latter one is
uncomfortable to use and might lead
to undesirable outcome if used the wrong way.
So it seems advisable to keep the boolean option
and the warning in its description.
To this end, the value of `getPasswd` itself is
later filtered out when the config file is generated.
The tsm-backup service module and the vm test are adapted.
Migration code will be added in a separate
commit to permit easy reversal later, when the
migration code is no longer deemed necessary.
2023-08-23 15:00:32 +01:00
|
|
|
servernames = map (s: s.servername) (attrValues cfg.servers);
|
2019-05-15 17:17:30 +01:00
|
|
|
|
nixos/tsm-client: use `freeformType` for server config
`tsm-client` uses a global configuration
file that must contain coordinates for each
server that it is supposed to contact.
This configuration consists of text
lines with key-value pairs.
In the NixOS module, these servers may be declared
with an attribute set, where the attribute name
defines an alias for the server, and the value
is again an attribute set with the settings for
the respective server.
This is organized as an option of type `attrsOf submodule...`.
Before this commit:
Important settings have their own option within
the submodule. For everything else, there is
the "catch-all" option `extraConfig` that may
be used to declare any key-value pairs.
There is also `text` that can be used to
add arbitrary text to each server's
section in the global config file.
After this commit:
`extraConfig` and `text` are gone,
the attribute names and values of each server's attribute
set are translated directly into key-value pairs,
with the following notable rules:
* Lists are translated into multiple lines
with the same key, as such is permitted by
the software for certain keys.
* `null` may be used to override/shadow a value that
is defined elsewhere and hides the corresponding key.
Those "important settings" that have previously been
defined as dedicated options are still defined as such,
but they have been renamed to match their
corresponding key names in the configuration file.
There is a notable exception:
"Our" boolean option `genPasswd` influences the "real"
option `passwordaccess', but the latter one is
uncomfortable to use and might lead
to undesirable outcome if used the wrong way.
So it seems advisable to keep the boolean option
and the warning in its description.
To this end, the value of `getPasswd` itself is
later filtered out when the config file is generated.
The tsm-backup service module and the vm test are adapted.
Migration code will be added in a separate
commit to permit easy reversal later, when the
migration code is no longer deemed necessary.
2023-08-23 15:00:32 +01:00
|
|
|
assertions =
|
2023-08-23 15:56:55 +01:00
|
|
|
[
|
|
|
|
{
|
|
|
|
assertion = allUnique (map toLower servernames);
|
|
|
|
message = ''
|
|
|
|
TSM server names
|
|
|
|
(option `programs.tsmClient.servers`)
|
|
|
|
contain duplicate name
|
|
|
|
(note that server names are case insensitive).
|
|
|
|
'';
|
|
|
|
}
|
|
|
|
{
|
|
|
|
assertion = (cfg.defaultServername!=null)->(elem cfg.defaultServername servernames);
|
|
|
|
message = ''
|
|
|
|
TSM default server name
|
|
|
|
`programs.tsmClient.defaultServername="${cfg.defaultServername}"`
|
|
|
|
not found in server names in
|
|
|
|
`programs.tsmClient.servers`.
|
|
|
|
'';
|
|
|
|
}
|
|
|
|
] ++ (mapAttrsToList (name: serverCfg: {
|
|
|
|
assertion = all (key: null != match "[^[:space:]]+" key) (attrNames serverCfg);
|
2019-05-15 17:17:30 +01:00
|
|
|
message = ''
|
2023-08-23 15:56:55 +01:00
|
|
|
TSM server setting names in
|
|
|
|
`programs.tsmClient.servers.${name}.*`
|
|
|
|
contain spaces, but that's not allowed.
|
2019-05-15 17:17:30 +01:00
|
|
|
'';
|
2023-08-23 15:56:55 +01:00
|
|
|
}) cfg.servers) ++ (mapAttrsToList (name: serverCfg: {
|
|
|
|
assertion = allUnique (map toLower (attrNames serverCfg));
|
nixos/tsm-client: use `freeformType` for server config
`tsm-client` uses a global configuration
file that must contain coordinates for each
server that it is supposed to contact.
This configuration consists of text
lines with key-value pairs.
In the NixOS module, these servers may be declared
with an attribute set, where the attribute name
defines an alias for the server, and the value
is again an attribute set with the settings for
the respective server.
This is organized as an option of type `attrsOf submodule...`.
Before this commit:
Important settings have their own option within
the submodule. For everything else, there is
the "catch-all" option `extraConfig` that may
be used to declare any key-value pairs.
There is also `text` that can be used to
add arbitrary text to each server's
section in the global config file.
After this commit:
`extraConfig` and `text` are gone,
the attribute names and values of each server's attribute
set are translated directly into key-value pairs,
with the following notable rules:
* Lists are translated into multiple lines
with the same key, as such is permitted by
the software for certain keys.
* `null` may be used to override/shadow a value that
is defined elsewhere and hides the corresponding key.
Those "important settings" that have previously been
defined as dedicated options are still defined as such,
but they have been renamed to match their
corresponding key names in the configuration file.
There is a notable exception:
"Our" boolean option `genPasswd` influences the "real"
option `passwordaccess', but the latter one is
uncomfortable to use and might lead
to undesirable outcome if used the wrong way.
So it seems advisable to keep the boolean option
and the warning in its description.
To this end, the value of `getPasswd` itself is
later filtered out when the config file is generated.
The tsm-backup service module and the vm test are adapted.
Migration code will be added in a separate
commit to permit easy reversal later, when the
migration code is no longer deemed necessary.
2023-08-23 15:00:32 +01:00
|
|
|
message = ''
|
2023-08-23 15:56:55 +01:00
|
|
|
TSM server setting names in
|
|
|
|
`programs.tsmClient.servers.${name}.*`
|
|
|
|
contain duplicate names
|
|
|
|
(note that setting names are case insensitive).
|
nixos/tsm-client: use `freeformType` for server config
`tsm-client` uses a global configuration
file that must contain coordinates for each
server that it is supposed to contact.
This configuration consists of text
lines with key-value pairs.
In the NixOS module, these servers may be declared
with an attribute set, where the attribute name
defines an alias for the server, and the value
is again an attribute set with the settings for
the respective server.
This is organized as an option of type `attrsOf submodule...`.
Before this commit:
Important settings have their own option within
the submodule. For everything else, there is
the "catch-all" option `extraConfig` that may
be used to declare any key-value pairs.
There is also `text` that can be used to
add arbitrary text to each server's
section in the global config file.
After this commit:
`extraConfig` and `text` are gone,
the attribute names and values of each server's attribute
set are translated directly into key-value pairs,
with the following notable rules:
* Lists are translated into multiple lines
with the same key, as such is permitted by
the software for certain keys.
* `null` may be used to override/shadow a value that
is defined elsewhere and hides the corresponding key.
Those "important settings" that have previously been
defined as dedicated options are still defined as such,
but they have been renamed to match their
corresponding key names in the configuration file.
There is a notable exception:
"Our" boolean option `genPasswd` influences the "real"
option `passwordaccess', but the latter one is
uncomfortable to use and might lead
to undesirable outcome if used the wrong way.
So it seems advisable to keep the boolean option
and the warning in its description.
To this end, the value of `getPasswd` itself is
later filtered out when the config file is generated.
The tsm-backup service module and the vm test are adapted.
Migration code will be added in a separate
commit to permit easy reversal later, when the
migration code is no longer deemed necessary.
2023-08-23 15:00:32 +01:00
|
|
|
'';
|
2023-08-23 20:29:29 +01:00
|
|
|
}) cfg.servers)
|
|
|
|
# XXX migration code for freeform settings, this can be removed in 2025:
|
|
|
|
++ (enrichMigrationInfos "assertions" (addText: { assertion, message }: { inherit assertion; message = addText message; }));
|
2019-05-15 17:17:30 +01:00
|
|
|
|
nixos/tsm-client: use `freeformType` for server config
`tsm-client` uses a global configuration
file that must contain coordinates for each
server that it is supposed to contact.
This configuration consists of text
lines with key-value pairs.
In the NixOS module, these servers may be declared
with an attribute set, where the attribute name
defines an alias for the server, and the value
is again an attribute set with the settings for
the respective server.
This is organized as an option of type `attrsOf submodule...`.
Before this commit:
Important settings have their own option within
the submodule. For everything else, there is
the "catch-all" option `extraConfig` that may
be used to declare any key-value pairs.
There is also `text` that can be used to
add arbitrary text to each server's
section in the global config file.
After this commit:
`extraConfig` and `text` are gone,
the attribute names and values of each server's attribute
set are translated directly into key-value pairs,
with the following notable rules:
* Lists are translated into multiple lines
with the same key, as such is permitted by
the software for certain keys.
* `null` may be used to override/shadow a value that
is defined elsewhere and hides the corresponding key.
Those "important settings" that have previously been
defined as dedicated options are still defined as such,
but they have been renamed to match their
corresponding key names in the configuration file.
There is a notable exception:
"Our" boolean option `genPasswd` influences the "real"
option `passwordaccess', but the latter one is
uncomfortable to use and might lead
to undesirable outcome if used the wrong way.
So it seems advisable to keep the boolean option
and the warning in its description.
To this end, the value of `getPasswd` itself is
later filtered out when the config file is generated.
The tsm-backup service module and the vm test are adapted.
Migration code will be added in a separate
commit to permit easy reversal later, when the
migration code is no longer deemed necessary.
2023-08-23 15:00:32 +01:00
|
|
|
makeDsmSysLines = key: value:
|
|
|
|
# Turn a key-value pair from the server options attrset
|
|
|
|
# into zero (value==null), one (scalar value) or
|
|
|
|
# more (value is list) configuration stanza lines.
|
|
|
|
if isList value then map (makeDsmSysLines key) value else # recurse into list
|
|
|
|
if value == null then [ ] else # skip `null` value
|
|
|
|
[ (" ${key}${
|
|
|
|
if value == true then "" else # just output key if value is `true`
|
|
|
|
if isInt value then " ${builtins.toString value}" else
|
|
|
|
if path.check value then " \"${value}\"" else # enclose path in ".."
|
|
|
|
if singleLineStr.check value then " ${value}" else
|
|
|
|
throw "assertion failed: cannot convert type" # should never happen
|
|
|
|
}") ];
|
|
|
|
|
|
|
|
makeDsmSysStanza = {servername, ... }@serverCfg:
|
|
|
|
let
|
|
|
|
# drop special values that should not go into server config block
|
2023-08-23 20:29:29 +01:00
|
|
|
attrs = removeAttrs serverCfg [ "servername" "genPasswd"
|
|
|
|
# XXX migration code for freeform settings, these can be removed in 2025:
|
|
|
|
"assertions" "warnings"
|
|
|
|
"extraConfig" "text"
|
|
|
|
"name" "server" "port" "node" "passwdDir" "includeExclude"
|
|
|
|
];
|
nixos/tsm-client: use `freeformType` for server config
`tsm-client` uses a global configuration
file that must contain coordinates for each
server that it is supposed to contact.
This configuration consists of text
lines with key-value pairs.
In the NixOS module, these servers may be declared
with an attribute set, where the attribute name
defines an alias for the server, and the value
is again an attribute set with the settings for
the respective server.
This is organized as an option of type `attrsOf submodule...`.
Before this commit:
Important settings have their own option within
the submodule. For everything else, there is
the "catch-all" option `extraConfig` that may
be used to declare any key-value pairs.
There is also `text` that can be used to
add arbitrary text to each server's
section in the global config file.
After this commit:
`extraConfig` and `text` are gone,
the attribute names and values of each server's attribute
set are translated directly into key-value pairs,
with the following notable rules:
* Lists are translated into multiple lines
with the same key, as such is permitted by
the software for certain keys.
* `null` may be used to override/shadow a value that
is defined elsewhere and hides the corresponding key.
Those "important settings" that have previously been
defined as dedicated options are still defined as such,
but they have been renamed to match their
corresponding key names in the configuration file.
There is a notable exception:
"Our" boolean option `genPasswd` influences the "real"
option `passwordaccess', but the latter one is
uncomfortable to use and might lead
to undesirable outcome if used the wrong way.
So it seems advisable to keep the boolean option
and the warning in its description.
To this end, the value of `getPasswd` itself is
later filtered out when the config file is generated.
The tsm-backup service module and the vm test are adapted.
Migration code will be added in a separate
commit to permit easy reversal later, when the
migration code is no longer deemed necessary.
2023-08-23 15:00:32 +01:00
|
|
|
in
|
|
|
|
''
|
|
|
|
servername ${servername}
|
|
|
|
${concatLines (concatLists (mapAttrsToList makeDsmSysLines attrs))}
|
|
|
|
'';
|
|
|
|
|
2019-05-15 17:17:30 +01:00
|
|
|
dsmSysText = ''
|
2023-08-15 10:12:07 +01:00
|
|
|
**** IBM Storage Protect (Tivoli Storage Manager)
|
2019-05-15 17:17:30 +01:00
|
|
|
**** client system-options file "dsm.sys".
|
|
|
|
**** Do not edit!
|
|
|
|
**** This file is generated by NixOS configuration.
|
|
|
|
|
|
|
|
${optionalString (cfg.defaultServername!=null) "defaultserver ${cfg.defaultServername}"}
|
|
|
|
|
nixos/tsm-client: use `freeformType` for server config
`tsm-client` uses a global configuration
file that must contain coordinates for each
server that it is supposed to contact.
This configuration consists of text
lines with key-value pairs.
In the NixOS module, these servers may be declared
with an attribute set, where the attribute name
defines an alias for the server, and the value
is again an attribute set with the settings for
the respective server.
This is organized as an option of type `attrsOf submodule...`.
Before this commit:
Important settings have their own option within
the submodule. For everything else, there is
the "catch-all" option `extraConfig` that may
be used to declare any key-value pairs.
There is also `text` that can be used to
add arbitrary text to each server's
section in the global config file.
After this commit:
`extraConfig` and `text` are gone,
the attribute names and values of each server's attribute
set are translated directly into key-value pairs,
with the following notable rules:
* Lists are translated into multiple lines
with the same key, as such is permitted by
the software for certain keys.
* `null` may be used to override/shadow a value that
is defined elsewhere and hides the corresponding key.
Those "important settings" that have previously been
defined as dedicated options are still defined as such,
but they have been renamed to match their
corresponding key names in the configuration file.
There is a notable exception:
"Our" boolean option `genPasswd` influences the "real"
option `passwordaccess', but the latter one is
uncomfortable to use and might lead
to undesirable outcome if used the wrong way.
So it seems advisable to keep the boolean option
and the warning in its description.
To this end, the value of `getPasswd` itself is
later filtered out when the config file is generated.
The tsm-backup service module and the vm test are adapted.
Migration code will be added in a separate
commit to permit easy reversal later, when the
migration code is no longer deemed necessary.
2023-08-23 15:00:32 +01:00
|
|
|
${concatLines (map makeDsmSysStanza (attrValues cfg.servers))}
|
2019-05-15 17:17:30 +01:00
|
|
|
'';
|
|
|
|
|
2023-08-23 20:29:29 +01:00
|
|
|
# XXX migration code for freeform settings, this can be removed in 2025:
|
|
|
|
enrichMigrationInfos = what: how: concatLists (
|
|
|
|
mapAttrsToList
|
|
|
|
(name: serverCfg: map (how (text: "In `programs.tsmClient.servers.${name}`: ${text}")) serverCfg."${what}")
|
|
|
|
cfg.servers
|
|
|
|
);
|
|
|
|
|
2019-05-15 17:17:30 +01:00
|
|
|
in
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
inherit options;
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
inherit assertions;
|
|
|
|
programs.tsmClient.dsmSysText = dsmSysText;
|
|
|
|
programs.tsmClient.wrappedPackage = cfg.package.override rec {
|
|
|
|
dsmSysCli = pkgs.writeText "dsm.sys" cfg.dsmSysText;
|
|
|
|
dsmSysApi = dsmSysCli;
|
|
|
|
};
|
|
|
|
environment.systemPackages = [ cfg.wrappedPackage ];
|
2023-08-23 20:29:29 +01:00
|
|
|
# XXX migration code for freeform settings, this can be removed in 2025:
|
|
|
|
warnings = enrichMigrationInfos "warnings" (addText: addText);
|
2019-05-15 17:17:30 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
meta.maintainers = [ lib.maintainers.yarny ];
|
|
|
|
|
|
|
|
}
|