fork/home-manager

git clone https://git.julia.blue/fork/home-manager

Robert HelgessonMerge branch 'literalExpression' [#2371]4fa1ba72

master
1.2 KiB51 linesraw
1{ config, lib, pkgs, ... }:
2
3with lib;
4
5let
6
7  cfg = config.programs.octant;
8
9  mkPluginEnv = packages:
10    let
11      pluginDirs = map (pkg: "${pkg}/bin") packages;
12      plugins = concatMapStringsSep " " (p: "${p}/*") pluginDirs;
13    in pkgs.runCommandLocal "octant-plugins" { } ''
14      mkdir $out
15      [[ '${plugins}' ]] || exit 0
16      for plugin in ${plugins}; do
17        ln -s "$plugin" $out/
18      done
19    '';
20
21in {
22  meta.maintainers = with maintainers; [ jk ];
23
24  options = {
25    programs.octant = {
26      enable = mkEnableOption "octant";
27
28      package = mkOption {
29        type = types.package;
30        default = pkgs.octant;
31        defaultText = literalExpression "pkgs.octant";
32        example = literalExpression "pkgs.octant-other";
33        description = "The Octant package to use.";
34      };
35
36      plugins = mkOption {
37        default = [ ];
38        example = literalExpression "[ pkgs.starboard-octant-plugin ]";
39        description = "Optional Octant plugins.";
40        type = types.listOf types.package;
41      };
42    };
43  };
44
45  config = mkIf cfg.enable {
46    home.packages = [ cfg.package ];
47
48    xdg.configFile."octant/plugins" =
49      mkIf (cfg.plugins != [ ]) { source = mkPluginEnv cfg.plugins; };
50  };
51}