diff options
author | Alyssa Ross <hi@alyssa.is> | 2022-05-31 09:59:33 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2022-05-31 09:59:57 +0000 |
commit | 9ff36293d1e428cd7bf03e8d4b03611b6d361c28 (patch) | |
tree | 1ab51a42b868c55b83f6ccdb80371b9888739dd9 /nixos/modules/services/databases/firebird.nix | |
parent | 1c4fcd0d4b0541e674ee56ace1053e23e562cc80 (diff) | |
parent | ddc3c396a51918043bb0faa6f676abd9562be62c (diff) | |
download | nixpkgs-9ff36293d1e428cd7bf03e8d4b03611b6d361c28.tar nixpkgs-9ff36293d1e428cd7bf03e8d4b03611b6d361c28.tar.gz nixpkgs-9ff36293d1e428cd7bf03e8d4b03611b6d361c28.tar.bz2 nixpkgs-9ff36293d1e428cd7bf03e8d4b03611b6d361c28.tar.lz nixpkgs-9ff36293d1e428cd7bf03e8d4b03611b6d361c28.tar.xz nixpkgs-9ff36293d1e428cd7bf03e8d4b03611b6d361c28.tar.zst nixpkgs-9ff36293d1e428cd7bf03e8d4b03611b6d361c28.zip |
Last good Nixpkgs for Weston+nouveau? archive
I came this commit hash to terwiz[m] on IRC, who is trying to figure out what the last version of Spectrum that worked on their NUC with Nvidia graphics is.
Diffstat (limited to 'nixos/modules/services/databases/firebird.nix')
-rw-r--r-- | nixos/modules/services/databases/firebird.nix | 168 |
1 files changed, 168 insertions, 0 deletions
diff --git a/nixos/modules/services/databases/firebird.nix b/nixos/modules/services/databases/firebird.nix new file mode 100644 index 00000000000..4e3130bea22 --- /dev/null +++ b/nixos/modules/services/databases/firebird.nix @@ -0,0 +1,168 @@ +{ config, lib, pkgs, ... }: + +# TODO: This may file may need additional review, eg which configuartions to +# expose to the user. +# +# I only used it to access some simple databases. + +# test: +# isql, then type the following commands: +# CREATE DATABASE '/var/db/firebird/data/test.fdb' USER 'SYSDBA' PASSWORD 'masterkey'; +# CONNECT '/var/db/firebird/data/test.fdb' USER 'SYSDBA' PASSWORD 'masterkey'; +# CREATE TABLE test ( text varchar(100) ); +# DROP DATABASE; +# +# Be careful, virtuoso-opensource also provides a different isql command ! + +# There are at least two ways to run firebird. superserver has been choosen +# however there are no strong reasons to prefer this or the other one AFAIK +# Eg superserver is said to be most efficiently using resources according to +# http://www.firebirdsql.org/manual/qsg25-classic-or-super.html + +with lib; + +let + + cfg = config.services.firebird; + + firebird = cfg.package; + + dataDir = "${cfg.baseDir}/data"; + systemDir = "${cfg.baseDir}/system"; + +in + +{ + + ###### interface + + options = { + + services.firebird = { + + enable = mkEnableOption "the Firebird super server"; + + package = mkOption { + default = pkgs.firebird; + defaultText = literalExpression "pkgs.firebird"; + type = types.package; + example = literalExpression "pkgs.firebird_3"; + description = '' + Which Firebird package to be installed: <code>pkgs.firebird_3</code> + For SuperServer use override: <code>pkgs.firebird_3.override { superServer = true; };</code> + ''; + }; + + port = mkOption { + default = 3050; + type = types.port; + description = '' + Port Firebird uses. + ''; + }; + + user = mkOption { + default = "firebird"; + type = types.str; + description = '' + User account under which firebird runs. + ''; + }; + + baseDir = mkOption { + default = "/var/lib/firebird"; + type = types.str; + description = '' + Location containing data/ and system/ directories. + data/ stores the databases, system/ stores the password database security2.fdb. + ''; + }; + + }; + + }; + + + ###### implementation + + config = mkIf config.services.firebird.enable { + + environment.systemPackages = [cfg.package]; + + systemd.tmpfiles.rules = [ + "d '${dataDir}' 0700 ${cfg.user} - - -" + "d '${systemDir}' 0700 ${cfg.user} - - -" + ]; + + systemd.services.firebird = + { description = "Firebird Super-Server"; + + wantedBy = [ "multi-user.target" ]; + + # TODO: moving security2.fdb into the data directory works, maybe there + # is a better way + preStart = + '' + if ! test -e "${systemDir}/security2.fdb"; then + cp ${firebird}/security2.fdb "${systemDir}" + fi + + if ! test -e "${systemDir}/security3.fdb"; then + cp ${firebird}/security3.fdb "${systemDir}" + fi + + if ! test -e "${systemDir}/security4.fdb"; then + cp ${firebird}/security4.fdb "${systemDir}" + fi + + chmod -R 700 "${dataDir}" "${systemDir}" /var/log/firebird + ''; + + serviceConfig.User = cfg.user; + serviceConfig.LogsDirectory = "firebird"; + serviceConfig.LogsDirectoryMode = "0700"; + serviceConfig.ExecStart = "${firebird}/bin/fbserver -d"; + + # TODO think about shutdown + }; + + environment.etc."firebird/firebird.msg".source = "${firebird}/firebird.msg"; + + # think about this again - and eventually make it an option + environment.etc."firebird/firebird.conf".text = '' + # RootDirectory = Restrict ${dataDir} + DatabaseAccess = Restrict ${dataDir} + ExternalFileAccess = Restrict ${dataDir} + # what is this? is None allowed? + UdfAccess = None + # "Native" = traditional interbase/firebird, "mixed" is windows only + Authentication = Native + + # defaults to -1 on non Win32 + #MaxUnflushedWrites = 100 + #MaxUnflushedWriteTime = 100 + + # show trace if trouble occurs (does this require debug build?) + # BugcheckAbort = 0 + # ConnectionTimeout = 180 + + #RemoteServiceName = gds_db + RemoteServicePort = ${cfg.port} + + # randomly choose port for server Event Notification + #RemoteAuxPort = 0 + # rsetrict connections to a network card: + #RemoteBindAddress = + # there are some additional settings which should be reviewed + ''; + + users.users.firebird = { + description = "Firebird server user"; + group = "firebird"; + uid = config.ids.uids.firebird; + }; + + users.groups.firebird.gid = config.ids.gids.firebird; + + }; +} |