Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nixos cups: support for socket activation [WIP] #40491

Closed
wants to merge 2 commits into from

Conversation

peterhoeg
Copy link
Member

Motivation for this change

With printing enabled, the cups services would start eagerly on boot despite only being needed when printing.

With this PR, cups only start when needed so it takes a few seconds for the print dialog to show.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option build-use-sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

Peter Hoeg and others added 2 commits May 14, 2018 18:34
Also:
1) no longer force the cups-browsed service to run (which can increase
boot times) if Avahi is enabled by making it configurable.
2) enable socket activation by default
@GrahamcOfBorg
Copy link

Success on x86_64-linux (full log)

Attempted: cups

Partial log (click to expand)

/nix/store/cvl545hn3r7cv2307pw7rfkj5pnhs9jc-cups-2.2.6

@GrahamcOfBorg
Copy link

Success on aarch64-linux (full log)

Attempted: cups

Partial log (click to expand)

/nix/store/sz3z7caf0r0yipall262hd57vwj1gz0l-cups-2.2.6

Copy link
Member

@Mic92 Mic92 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have not tested the pull request, but I agree with the idea.

@peterhoeg peterhoeg changed the title nixos cups: support for socket activation nixos cups: support for socket activation [WIP] May 14, 2018
@peterhoeg
Copy link
Member Author

I've been running with this for the last year or so so I know it works but I realized that this PR needs a little cleaning up so I have changed the title to WIP.

type = types.bool;
default = true;
description = ''
Start CUPS processes on demand.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Specifying expected extra latency on a specific piece of hardware would be useful. Something like

On my Intel-<specific model> this delays a printing dialog by 2.4 seconds.

fi
# Then, populate it with static files
cd ${rootdir}/etc/cups
for i in *; do
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

* needs to be ./*.

done

#update path reference
[ -L /var/lib/cups/path ] && \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are many references to /var/lib/cups. Can a variable be introduced to eliminate the repetition?

$server->waitForUnit("cups.service");
$client->waitForUnit("cups.service");
$client->sleep(10); # wait until cups is fully initialized
$server->waitForUnit("sockets.target");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't both configurations (socket activated and not socket activated) be tested? (I can see the old test was not reliable and your test is better.)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed they should - that is one of the 2 issues I want to clean up before this gets merged.

@mmahut
Copy link
Member

mmahut commented Aug 25, 2019

Are there any updates on this pull request, please?

@worldofpeace
Copy link
Contributor

I believe this was implemented in #65040.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants