nixpkgs/nixos/modules/programs/freetds.nix
Silvan Mosberger 4f0dadbf38 treewide: format all inactive Nix files
After final improvements to the official formatter implementation,
this commit now performs the first treewide reformat of Nix files using it.
This is part of the implementation of RFC 166.

Only "inactive" files are reformatted, meaning only files that
aren't being touched by any PR with activity in the past 2 months.
This is to avoid conflicts for PRs that might soon be merged.
Later we can do a full treewide reformat to get the rest,
which should not cause as many conflicts.

A CI check has already been running for some time to ensure that new and
already-formatted files are formatted, so the files being reformatted here
should also stay formatted.

This commit was automatically created and can be verified using

    nix-build a08b3a4d19.tar.gz \
      --argstr baseRev b32a094368
    result/bin/apply-formatting $NIXPKGS_PATH
2024-12-10 20:26:33 +01:00

65 lines
1.4 KiB
Nix

# Global configuration for freetds environment.
{
config,
lib,
pkgs,
...
}:
let
cfg = config.environment.freetds;
in
{
###### interface
options = {
environment.freetds = lib.mkOption {
type = lib.types.attrsOf lib.types.str;
default = { };
example = lib.literalExpression ''
{ MYDATABASE = '''
host = 10.0.2.100
port = 1433
tds version = 7.2
''';
}
'';
description = ''
Configure freetds database entries. Each attribute denotes
a section within freetds.conf, and the value (a string) is the config
content for that section. When at least one entry is configured
the global environment variables FREETDSCONF, FREETDS and SYBASE
will be configured to allow the programs that use freetds to find the
library and config.
'';
};
};
###### implementation
config = lib.mkIf (builtins.length (builtins.attrNames cfg) > 0) {
environment.variables.FREETDSCONF = "/etc/freetds.conf";
environment.variables.FREETDS = "/etc/freetds.conf";
environment.variables.SYBASE = "${pkgs.freetds}";
environment.etc."freetds.conf" = {
text = (
lib.concatStrings (
lib.mapAttrsToList (name: value: ''
[${name}]
${value}
'') cfg
)
);
};
};
}