1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-11-27 05:29:46 +01:00
home-manager/modules/services/plan9port.nix
Robert Helgesson 5f433eb164
Move platform check into modules
Before, loading a module would be guarded by an optional platform
condition. This made it possible to avoid loading and evaluating a
module if it did not support the host platform.

Unfortunately, this made it impossible to share a single configuration
between GNU/Linux and Darwin hosts, which some wish to do.

This removes the conditional load and instead inserts host platform
assertions in the modules that are platform specific.

Fixes #1906
2021-07-18 20:43:22 +02:00

38 lines
1 KiB
Nix

{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.plan9port;
in {
meta.maintainers = [ maintainers.ehmry ];
options.services.plan9port = {
fontsrv.enable =
mkEnableOption "the Plan 9 file system access to host fonts";
plumber.enable =
mkEnableOption "the Plan 9 file system for interprocess messaging";
};
config = mkIf (cfg.fontsrv.enable || cfg.plumber.enable) {
assertions = [
(hm.assertions.assertPlatform "services.plan9port" pkgs platforms.linux)
];
systemd.user.services.fontsrv = mkIf cfg.fontsrv.enable {
Unit.Description = "the Plan 9 file system access to host fonts";
Install.WantedBy = [ "default.target" ];
Service.ExecStart = "${pkgs.plan9port}/bin/9 fontsrv";
};
systemd.user.services.plumber = mkIf cfg.plumber.enable {
Unit.Description = "file system for interprocess messaging";
Install.WantedBy = [ "default.target" ];
Service.ExecStart = "${pkgs.plan9port}/bin/9 plumber -f";
};
};
}