From d490797179a02167e7617da367916bd6a4722e0d Mon Sep 17 00:00:00 2001 From: Robert Helgesson Date: Fri, 6 Aug 2021 22:55:57 +0200 Subject: [PATCH] nix-index: use dummy fish package in tests --- .../nix-index/assert-on-command-not-found.nix | 18 +++++++++++++++--- .../programs/nix-index/integrations.nix | 17 ++++++++++++++--- 2 files changed, 29 insertions(+), 6 deletions(-) diff --git a/tests/modules/programs/nix-index/assert-on-command-not-found.nix b/tests/modules/programs/nix-index/assert-on-command-not-found.nix index 757ac65b5..b3b869cb8 100644 --- a/tests/modules/programs/nix-index/assert-on-command-not-found.nix +++ b/tests/modules/programs/nix-index/assert-on-command-not-found.nix @@ -1,4 +1,6 @@ -{ pkgs, ... }: { +{ lib, pkgs, ... }: + +{ config = { programs.bash.enable = true; programs.fish.enable = true; @@ -6,8 +8,18 @@ programs.command-not-found.enable = true; - nixpkgs.overlays = - [ (self: super: { zsh = pkgs.writeScriptBin "dummy-zsh" ""; }) ]; + # Needed to avoid error with dummy fish package. + xdg.dataFile."fish/home-manager_generated_completions".source = + lib.mkForce (builtins.toFile "empty" ""); + + nixpkgs.overlays = [ + (self: super: + let dummy = pkgs.writeScriptBin "dummy" ""; + in { + zsh = dummy; + fish = dummy; + }) + ]; programs.nix-index.enable = true; diff --git a/tests/modules/programs/nix-index/integrations.nix b/tests/modules/programs/nix-index/integrations.nix index 6da5fd049..33a5de2dc 100644 --- a/tests/modules/programs/nix-index/integrations.nix +++ b/tests/modules/programs/nix-index/integrations.nix @@ -1,4 +1,5 @@ -{ pkgs, ... }: +{ lib, pkgs, ... }: + let fishRegex = '' function __fish_command_not_found_handler --on-event fish_command_not_found @@ -11,8 +12,18 @@ in { programs.fish.enable = true; programs.zsh.enable = true; - nixpkgs.overlays = - [ (self: super: { zsh = pkgs.writeScriptBin "dummy-zsh" ""; }) ]; + # Needed to avoid error with dummy fish package. + xdg.dataFile."fish/home-manager_generated_completions".source = + lib.mkForce (builtins.toFile "empty" ""); + + nixpkgs.overlays = [ + (self: super: + let dummy = pkgs.writeScriptBin "dummy" ""; + in { + zsh = dummy; + fish = dummy; + }) + ]; programs.nix-index.enable = true;