summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2018-09-08 14:52:32 +0200
committerGregor Kleen <gkleen@yggdrasil.li>2018-09-08 14:52:32 +0200
commite1b6b84568be92ac0c09876b58906d9cc13874b7 (patch)
tree47c4cd4684439e64e8fdeb942ce61270fa70b5bc
parent25c2f7d63ec570d97d84cf77f2299b6d42412266 (diff)
downloadnixos-e1b6b84568be92ac0c09876b58906d9cc13874b7.tar
nixos-e1b6b84568be92ac0c09876b58906d9cc13874b7.tar.gz
nixos-e1b6b84568be92ac0c09876b58906d9cc13874b7.tar.bz2
nixos-e1b6b84568be92ac0c09876b58906d9cc13874b7.tar.xz
nixos-e1b6b84568be92ac0c09876b58906d9cc13874b7.zip
...
-rw-r--r--custom/bar-service.nix6
-rw-r--r--custom/thermoprint-service.nix19
2 files changed, 20 insertions, 5 deletions
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 {
52 }; 52 };
53 }; 53 };
54 54
55 config = mkIf cfg.enable { 55 imports = mkIf cfg.enable [ ./thermoprint-service.nix ];
56 imports = [ ./thermoprint-service.nix ];
57 56
57 config = mkIf cfg.enable {
58 assertions = [ 58 assertions = [
59 { assertion = config.services.postgresql.enable; 59 { assertion = config.services.postgresql.enable;
60 message = "bar requires PostgreSQL"; 60 message = "bar requires PostgreSQL";
61 } 61 }
62 ]; 62 ];
63 63
64 packages.thermoprint.enable = true;
65
64 users.users."${cfg.user}" = { 66 users.users."${cfg.user}" = {
65 group = cfg.group; 67 group = cfg.group;
66 description = "User for the Bar Inventory System"; 68 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 @@
2 2
3with lib; 3with lib;
4 4
5{ 5let
6 config = { 6 pCfg = config.packages.thermoprint;
7in {
8 options = {
9 packages.thermoprint = {
10 enable = mkEnableOption "thermoprint packages";
11
12 extraServerPackages = mkOption {
13 type = types.unspecified;
14 default = p: [];
15 };
16 };
17 };
18
19 config = mkIf pCfg.enable {
7 nixpkgs.overlays = [(selfPkgs: superPkgs: { 20 nixpkgs.overlays = [(selfPkgs: superPkgs: {
8 haskellPackages = superPkgs.haskellPackages.extend (selfH: superH: 21 haskellPackages = superPkgs.haskellPackages.extend (selfH: superH:
9 import ./custom/thermoprint { 22 import ./custom/thermoprint {
10 callPackage = superPkgs.lib.callPackageWith (selfH // { inherit (superPkgs) stdenv makeWrapper runCommand; }); 23 callPackage = superPkgs.lib.callPackageWith (selfH // { inherit (superPkgs) stdenv makeWrapper runCommand; });
11 extraPackages = (p: []); 24 extraPackages = pCfg.extraServerPackages;
12 } 25 }
13 ); 26 );
14 27