mirror of
https://github.com/nix-community/home-manager
synced 2024-12-27 04:09:47 +01:00
5f433eb164
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
44 lines
1 KiB
Nix
44 lines
1 KiB
Nix
{ config, lib, pkgs, ... }:
|
|
|
|
with lib;
|
|
|
|
let
|
|
|
|
cfg = config.programs.abook;
|
|
|
|
in {
|
|
options.programs.abook = {
|
|
enable = mkEnableOption "Abook";
|
|
|
|
extraConfig = mkOption {
|
|
type = types.lines;
|
|
default = "";
|
|
example = ''
|
|
field pager = Pager
|
|
view CONTACT = name, email
|
|
set autosave=true
|
|
'';
|
|
description = ''
|
|
Extra lines added to <filename>$HOME/.config/abook/abookrc</filename>.
|
|
Available configuration options are described in the abook repository:
|
|
<link xlink:href="https://sourceforge.net/p/abook/git/ci/master/tree/sample.abookrc" />.
|
|
'';
|
|
};
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
assertions =
|
|
[ (hm.assertions.assertPlatform "programs.abook" pkgs platforms.linux) ];
|
|
|
|
home.packages = [ pkgs.abook ];
|
|
|
|
xdg.configFile."abook/abookrc" = mkIf (cfg.extraConfig != "") {
|
|
text = ''
|
|
# Generated by Home Manager.
|
|
# See http://abook.sourceforge.net/
|
|
|
|
${cfg.extraConfig}
|
|
'';
|
|
};
|
|
};
|
|
}
|