From 45d259cb3e000d5936462c19576ea11f0440fb50 Mon Sep 17 00:00:00 2001 From: Daiderd Jordan Date: Fri, 28 Jul 2017 23:17:53 +0200 Subject: [PATCH] add programs.nix-index module --- default.nix | 1 + modules/programs/nix-index/default.nix | 33 ++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 modules/programs/nix-index/default.nix diff --git a/default.nix b/default.nix index 44d9f11a..a7a175bb 100644 --- a/default.nix +++ b/default.nix @@ -52,6 +52,7 @@ let ./modules/programs/fish.nix ./modules/programs/man.nix ./modules/programs/info + ./modules/programs/nix-index ./modules/programs/nix-script.nix ./modules/programs/tmux.nix ./modules/programs/vim.nix diff --git a/modules/programs/nix-index/default.nix b/modules/programs/nix-index/default.nix new file mode 100644 index 00000000..8faa1477 --- /dev/null +++ b/modules/programs/nix-index/default.nix @@ -0,0 +1,33 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + cfg = config.programs.nix-index; +in + +{ + options = { + programs.nix-index.enable = mkOption { + type = types.bool; + default = false; + description = "Whether to enable nix-index and it's command-not-found helper."; + }; + + programs.nix-index.package = mkOption { + type = types.package; + default = pkgs.nix-index; + defaultText = "pkgs.nix-index"; + description = "This option specifies the nix-index package to use."; + }; + }; + + + config = mkIf config.programs.nix-index.enable { + + environment.systemPackages = [ cfg.package ]; + + environment.interactiveShellInit = "source ${cfg.package}/etc/profile.d/command-not-found.sh"; + + }; +}