lol

Simple nixos module to enable configuration of freetds and setup the expected environment variables

+62
+1
nixos/modules/module-list.nix
··· 58 58 ./programs/ssmtp.nix 59 59 ./programs/venus.nix 60 60 ./programs/wvdial.nix 61 + ./programs/freetds.nix 61 62 ./programs/zsh/zsh.nix 62 63 ./programs/screen.nix 63 64 ./rename.nix
+61
nixos/modules/programs/freetds.nix
··· 1 + # Global configuration for freetds environment. 2 + 3 + { config, lib, pkgs, ... }: 4 + 5 + with lib; 6 + 7 + let 8 + 9 + cfg = config.environment.freetds; 10 + 11 + in 12 + { 13 + ###### interface 14 + 15 + options = { 16 + 17 + environment.freetds = mkOption { 18 + type = types.attrsOf types.str; 19 + default = {}; 20 + example = { 21 + MYDATABASE = 22 + '' 23 + host = 10.0.2.100 24 + port = 1433 25 + tds version = 7.2 26 + ''; 27 + }; 28 + description = 29 + '' 30 + Configure freetds database entries. Each attribute denotes 31 + a section within freetds.conf, and the value (a string) is the config 32 + content for that section. When at least one entry is configured 33 + the global environment variables FREETDSCONF, FREETDS and SYBASE 34 + will be configured to allow the programs that use freetds to find the 35 + library and config. 36 + ''; 37 + 38 + }; 39 + 40 + }; 41 + 42 + ###### implementation 43 + 44 + config = mkIf (length (attrNames cfg) > 0) { 45 + 46 + environment.variables.FREETDSCONF = "/etc/freetds.conf"; 47 + environment.variables.FREETDS = "/etc/freetds.conf"; 48 + environment.variables.SYBASE = "${pkgs.freetds}"; 49 + 50 + environment.etc."freetds.conf" = { text = 51 + (concatStrings (mapAttrsToList (name: value: 52 + '' 53 + [${name}] 54 + ${value} 55 + '' 56 + ) cfg)); 57 + }; 58 + 59 + }; 60 + 61 + }