improve module
This commit is contained in:
parent
c8ce4db2a2
commit
3289b801f5
2 changed files with 20 additions and 4 deletions
19
flake.nix
19
flake.nix
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
runtimeInputs = with pkgs; [sane-backends brscan5 ghostscript];
|
||||
|
||||
text = builtins.readFile ./scanbuddy.bash;
|
||||
text = builtins.readFile ./scanbuddy.sh;
|
||||
};
|
||||
|
||||
# Returns an attribute set that can be passed to `buildPythonPackage`.
|
||||
|
|
@ -66,10 +66,20 @@
|
|||
lib,
|
||||
...
|
||||
}: {
|
||||
options = {
|
||||
service.scanbuddy = lib.mkEnableOption "Enable the scanbuddy server";
|
||||
options = let
|
||||
inherit (lib) mkOption mkEnableOption types;
|
||||
in {
|
||||
services.scanbuddy = {
|
||||
enable = mkEnableOption "Enable the scanbuddy server";
|
||||
environment = mkOption {
|
||||
type = types.attrsOf (types.nullOr (types.oneOf [types.str types.path types.package]));
|
||||
default = {};
|
||||
};
|
||||
};
|
||||
};
|
||||
config = {
|
||||
config = let
|
||||
cfg = config.services.scanbuddy;
|
||||
in {
|
||||
systemd.services.scanbuddy = lib.mkIf config.service.scanbuddy {
|
||||
description = "The scanbuddy webservice";
|
||||
wantedBy = ["multi-user.target"];
|
||||
|
|
@ -78,6 +88,7 @@
|
|||
Path = ["${scanbuddy-pkg}/bin"];
|
||||
WorkingDirectory = "/var/lib/scanbuddy";
|
||||
};
|
||||
environment = cfg.environment;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue