From baf9e2c7ae5ef4706122a19a7ff5236fdfb9defa Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Sat, 17 Oct 2015 21:40:51 +0200 Subject: Added thermoprint-servant to bragi --- .gitmodules | 3 +++ bragi.nix | 18 ++++++++++++++++++ custom/thermoprint | 1 + custom/thermoprint.nix | 23 +++++++++++++++++++++++ 4 files changed, 45 insertions(+) create mode 160000 custom/thermoprint create mode 100644 custom/thermoprint.nix diff --git a/.gitmodules b/.gitmodules index 00f4bdeb..51c669ec 100644 --- a/.gitmodules +++ b/.gitmodules @@ -22,3 +22,6 @@ [submodule "utils"] path = utils url = git://git.yggdrasil.li/utils +[submodule "custom/thermoprint"] + path = custom/thermoprint + url = git://git.yggdrasil.li/thermoprint diff --git a/bragi.nix b/bragi.nix index ee35f378..842302ed 100644 --- a/bragi.nix +++ b/bragi.nix @@ -2,6 +2,7 @@ let trivmixService = opts: (pkgs.callPackage ./custom/trivmix-service.nix opts).out; + thermoprint-servant = (pkgs.callPackage ./custom/thermoprint {}).thermoprint-servant; in { imports = [ @@ -239,4 +240,21 @@ in { inherit (template) shell; openssh.authorizedKeys.keyFiles = template.openssh.authorizedKeys.keyFiles; }; + + users.extraUsers."thermoprint" = { + name = "thermoprint"; + group = "lp"; + isSystemUser = true; + createHome = true; + home = "/var/thermoprint"; + }; + + systemd.services."thermoprint" = { + serviceConfig = { + Type = "simple"; + ExecStart = ''${thermoprint-servant}/bin/thermoprint --database /var/thermoprint/database.sqlite''; + User = "thermoprint"; + Group = "lp"; + }; + }; } diff --git a/custom/thermoprint b/custom/thermoprint new file mode 160000 index 00000000..e65e1eaa --- /dev/null +++ b/custom/thermoprint @@ -0,0 +1 @@ +Subproject commit e65e1eaac335a4738abb9e8ee8da7a229f96c2c0 diff --git a/custom/thermoprint.nix b/custom/thermoprint.nix new file mode 100644 index 00000000..733da6c3 --- /dev/null +++ b/custom/thermoprint.nix @@ -0,0 +1,23 @@ +{ stdenv ? (import {}).stdenv +, haskellPackages ? (import {}).haskellPackages +}: + +let + override = stdenv.lib.overrideDerivation; + callPackage = haskellPackages.callPackage; + tprint = callPackage ./thermoprint/tprint/tprint.nix { + inherit thermoprint-servant thermoprint bbcode; + }; + bbcode = callPackage ./thermoprint/bbcode/bbcode.nix { + inherit thermoprint; + }; + thermoprint-servant = callPackage ./thermoprint/servant/servant.nix { + inherit thermoprint; + }; + thermoprint = callPackage ./thermoprint/thermoprint/thermoprint.nix {}; +in rec { + tprint = override tprint (oldAttrs: { src = ./thermoprint/tprint; }); + bbcode = override bbcode (oldAttrs: { src = ./thermoprint/bbcode; }); + thermoprint-servant = override thermoprint-servant (oldAttrs: { src = ./thermoprint/servant; }); + thermoprint = override thermoprint (oldAttrs: { src = ./thermoprint/thermoprint; }); +} -- cgit v1.2.3