Merge pull request #196477 from MatthewCroughan/mc/stateless-cups

This commit is contained in:
Sandro 2022-10-18 23:22:12 +02:00 committed by GitHub
commit e188e93b8f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 2 deletions

View file

@ -134,6 +134,15 @@ in
'';
};
stateless = mkOption {
type = types.bool;
default = false;
description = lib.mdDoc ''
If set, all state directories relating to CUPS will be removed on
startup of the service.
'';
};
startWhenNeeded = mkOption {
type = types.bool;
default = true;
@ -343,8 +352,9 @@ in
path = [ cups.out ];
preStart =
''
preStart = lib.optionalString cfg.stateless ''
rm -rf /var/cache/cups /var/lib/cups /var/spool/cups
'' + ''
mkdir -m 0700 -p /var/cache/cups
mkdir -m 0700 -p /var/spool/cups
mkdir -m 0755 -p ${cfg.tempDir}

View file

@ -4,6 +4,7 @@ import ./make-test-python.nix ({pkgs, ... }:
let
printingServer = startWhenNeeded: {
services.printing.enable = true;
services.printing.stateless = true;
services.printing.startWhenNeeded = startWhenNeeded;
services.printing.listenAddresses = [ "*:631" ];
services.printing.defaultShared = true;