From 771ffc489a060f8be42934a4795bc4813c1bf8c8 Mon Sep 17 00:00:00 2001 From: Charlotte Van Petegem Date: Fri, 8 May 2020 13:44:37 +0200 Subject: [PATCH] Use nix-index for command-not-found --- configurations/zsh/default.nix | 4 +--- profiles/common/default.nix | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/configurations/zsh/default.nix b/configurations/zsh/default.nix index c03a8d92..d88d66f6 100644 --- a/configurations/zsh/default.nix +++ b/configurations/zsh/default.nix @@ -1,8 +1,6 @@ { ... }: { - programs.command-not-found.enable = true; - home-manager.users.charlotte = { pkgs, ... }: { home.packages = [ pkgs.autojump ]; programs.zsh = { @@ -15,13 +13,13 @@ path = "\$HOME/.config/zsh/zsh_history"; }; initExtra = '' + source ${pkgs.nix-index}/etc/profile.d/command-not-found.sh ${pkgs.any-nix-shell}/bin/any-nix-shell zsh --info-right | source /dev/stdin ''; oh-my-zsh = { enable = true; plugins = [ "autojump" - "command-not-found" "common-aliases" "extract" "history-substring-search" diff --git a/profiles/common/default.nix b/profiles/common/default.nix index fc7d6666..2dacc35f 100644 --- a/profiles/common/default.nix +++ b/profiles/common/default.nix @@ -44,12 +44,36 @@ htop inotify-tools ncdu + nix-index (import ../../programs/pass/default.nix { inherit pkgs; }) (import ../../programs/ssh/default.nix { inherit pkgs; }) ripgrep unzip youtube-dl ]; + systemd.user = { + services.nix-index = { + Unit = { + Description = "Service to run nix-index"; + }; + Service = { + Type = "oneshot"; + ExecStart = "${pkgs.nix-index}/bin/nix-index"; + }; + }; + timers.nix-index = { + Unit = { + Description = "Timer that starts nix-index every two hours"; + PartOf = [ "nix-index.service" ]; + }; + Timer = { + OnCalendar = "00/2:30"; + }; + Install = { + WantedBy = [ "default.target" ]; + }; + }; + }; }; services = {