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

module: add Lorri service #204

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions modules/module-list.nix
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
./services/emacs.nix
./services/khd
./services/kwm
./services/lorri.nix
./services/mail/offlineimap.nix
./services/mopidy.nix
./services/nix-daemon.nix
Expand Down
35 changes: 35 additions & 0 deletions modules/services/lorri.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{ config, lib, pkgs, ... }:

with lib;

let

cfg = config.services.lorri;

in {

options = {
services.lorri = {
enable = mkOption {
type = types.bool;
default = false;
description = "Whether to enable to Lorri Daemon.";
};

package = mkOption {
type = types.path;
default = pkgs.lorri;
description = "This option specifies the lorri package to use.";
};
};
};

config = mkIf cfg.enable {
environment.systemPackages = [ cfg.package ];
launchd.user.agents.lorri = {
Copy link
Owner

Choose a reason for hiding this comment

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

From what I recall the lorri daemon runs evaluation, which means in order to evaluate expressions with builtins.fetchTarball or fetchGit it will need access to tar/git. There's a path option for launchd services which provides a convenient way to expose binaries.

Copy link
Contributor

Choose a reason for hiding this comment

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

So I guess you can just add this:

Suggested change
launchd.user.agents.lorri = {
launchd.user.agents.lorri = {
path = with pkgs; [ nix gitMinimal gnutar gzip ];

command = "${cfg.package}/bin/lorri daemon";
serviceConfig.KeepAlive = true;
};

};
}
1 change: 1 addition & 0 deletions release.nix
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ let
tests.services-activate-system = makeTest ./tests/services-activate-system.nix;
tests.services-activate-system-changed-label-prefix = makeTest ./tests/services-activate-system-changed-label-prefix.nix;
tests.services-buildkite-agent = makeTest ./tests/services-buildkite-agent.nix;
tests.services-lorri = makeTest ./tests/services-lorri.nix;
tests.services-nix-daemon = makeTest ./tests/services-nix-daemon.nix;
tests.sockets-nix-daemon = makeTest ./tests/sockets-nix-daemon.nix;
tests.services-dnsmasq = makeTest ./tests/services-dnsmasq.nix;
Expand Down
11 changes: 11 additions & 0 deletions tests/services-lorri.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{ config, pkgs, ... }:

{
services.lorri.enable = true;

test = ''
echo >&2 "checking lorri service in ~/Library/LaunchAgents"
grep "org.nixos.lorri" ${config.out}/user/Library/LaunchAgents/org.nixos.lorri.plist
grep "${pkgs.lorri}/bin/lorri" ${config.out}/user/Library/LaunchAgents/org.nixos.lorri.plist
'';
}