From e1b6b84568be92ac0c09876b58906d9cc13874b7 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Sat, 8 Sep 2018 14:52:32 +0200 Subject: ... --- custom/bar-service.nix | 6 ++++-- custom/thermoprint-service.nix | 19 ++++++++++++++++--- 2 files changed, 20 insertions(+), 5 deletions(-) (limited to 'custom') diff --git a/custom/bar-service.nix b/custom/bar-service.nix index 9a48d960..a5bb9626 100644 --- a/custom/bar-service.nix +++ b/custom/bar-service.nix @@ -52,15 +52,17 @@ in { }; }; - config = mkIf cfg.enable { - imports = [ ./thermoprint-service.nix ]; + imports = mkIf cfg.enable [ ./thermoprint-service.nix ]; + config = mkIf cfg.enable { assertions = [ { assertion = config.services.postgresql.enable; message = "bar requires PostgreSQL"; } ]; + packages.thermoprint.enable = true; + users.users."${cfg.user}" = { group = cfg.group; description = "User for the Bar Inventory System"; diff --git a/custom/thermoprint-service.nix b/custom/thermoprint-service.nix index 8773706c..30588d43 100644 --- a/custom/thermoprint-service.nix +++ b/custom/thermoprint-service.nix @@ -2,13 +2,26 @@ with lib; -{ - config = { +let + pCfg = config.packages.thermoprint; +in { + options = { + packages.thermoprint = { + enable = mkEnableOption "thermoprint packages"; + + extraServerPackages = mkOption { + type = types.unspecified; + default = p: []; + }; + }; + }; + + config = mkIf pCfg.enable { nixpkgs.overlays = [(selfPkgs: superPkgs: { haskellPackages = superPkgs.haskellPackages.extend (selfH: superH: import ./custom/thermoprint { callPackage = superPkgs.lib.callPackageWith (selfH // { inherit (superPkgs) stdenv makeWrapper runCommand; }); - extraPackages = (p: []); + extraPackages = pCfg.extraServerPackages; } ); -- cgit v1.2.3