Compare commits

...

4 Commits

Author SHA1 Message Date
raf 0a38bafada
Merge aa62e904d6 into efd8b44ce1 2024-05-06 20:30:54 +00:00
NotAShelf aa62e904d6
flake/tests: pass testProfile as a shared arg 2024-05-06 23:30:48 +03:00
raf efd8b44ce1
Merge pull request #284 from FrothyMarrow/del-dupl-telescope
utility/telescope: remove duplicate telescope module
2024-05-06 12:53:12 +00:00
Frothy 9fe96ce010 utility/telescope: remove duplicate telescope module 2024-05-06 08:46:04 -04:00
4 changed files with 42 additions and 93 deletions

View File

@ -2,6 +2,7 @@
inputs,
nixosTest,
homeManagerModules,
testProfile,
...
}:
nixosTest {
@ -10,8 +11,8 @@ nixosTest {
nodes.machine = {
imports = [
testProfile
inputs.home-manager.nixosModules.home-manager
../profiles/minimal.nix
];
config = {
@ -28,39 +29,5 @@ nixosTest {
};
};
testScript = ''
import subprocess
machine.wait_for_unit("default.target")
def check_errs(process):
# Check for errors
print("Connecting to Neovim process")
# Capture stdout and stderr
stdout, stderr = process.communicate()
# Print captured stdout and stderr
if stdout:
print("Captured stdout:")
print(stdout.decode('utf-8'))
if stderr:
print("Captured stderr:")
print(stderr.decode('utf-8'))
def run_neovim_headless():
print("Running Neovim in headless mode.")
# Run Neovim in headless mode
nvim_process = subprocess.Popen(['nvim', '--headless'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
check_errs(nvim_process)
# Load configuration file
nvim_process.stdin.write(b':NonExistentCommand\n')
nvim_process.stdin.flush()
# run Neovim in headless mode
# and expect it to return sucessfully
machine.succeed(run_neovim_headless())
'';
testScript = "";
}

View File

@ -1,6 +1,7 @@
{
nixosTest,
nixosModules,
testProfile,
...
}:
nixosTest {
@ -8,8 +9,8 @@ nixosTest {
nodes.machine = {
imports = [
testProfile
nixosModules.nvf
../profiles/minimal.nix
];
config = {
@ -17,5 +18,39 @@ nixosTest {
};
};
testScript = "";
testScript = ''
import subprocess
machine.wait_for_unit("default.target")
def check_errs(process):
# Check for errors
print("Connecting to Neovim process")
# Capture stdout and stderr
stdout, stderr = process.communicate()
# Print captured stdout and stderr
if stdout:
print("Captured stdout:")
print(stdout.decode('utf-8'))
if stderr:
print("Captured stderr:")
print(stderr.decode('utf-8'))
def run_neovim_headless():
print("Running Neovim in headless mode.")
# Run Neovim in headless mode
nvim_process = subprocess.Popen(['nvim', '--headless'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
check_errs(nvim_process)
# Load configuration file
nvim_process.stdin.write(b':NonExistentCommand\n')
nvim_process.stdin.flush()
# run Neovim in headless mode
# and expect it to return sucessfully
machine.succeed(run_neovim_headless())
'';
}

View File

@ -16,20 +16,20 @@
defaultInherits = {
inherit (config.flake) homeManagerModules nixosModules;
inherit inputs;
testProfile = ./profiles/minimal.nix;
};
callPackage = callPackageWith (recursiveUpdate pkgs defaultInherits);
in {
checks = packagesFromDirectoryRecursive {
inherit callPackage;
testProfile = ../profiles/minimal.nix;
directory = ./checks;
};
# expose checks as packages to be built
packages = {
test-home-manager-module = self'.checks.homeManagerModule.driverInteractive;
test-nixos-module = self'.checks.nixosModule.driverInteractive;
# test-nixos-module = self'.checks.nixosModule.driverInteractive;
};
};
}

View File

@ -1,53 +0,0 @@
{
pkgs,
lib,
...
}: let
inherit (lib) mkMappingOption mkEnableOption mkOption types;
in {
options.vim.telescope = {
mappings = {
findProjects = mkMappingOption "Find files [Telescope]" "<leader>fp";
findFiles = mkMappingOption "Find files [Telescope]" "<leader>ff";
liveGrep = mkMappingOption "Live grep [Telescope]" "<leader>fg";
buffers = mkMappingOption "Buffers [Telescope]" "<leader>fb";
helpTags = mkMappingOption "Help tags [Telescope]" "<leader>fh";
open = mkMappingOption "Open [Telescope]" "<leader>ft";
gitCommits = mkMappingOption "Git commits [Telescope]" "<leader>fvcw";
gitBufferCommits = mkMappingOption "Git buffer commits [Telescope]" "<leader>fvcb";
gitBranches = mkMappingOption "Git branches [Telescope]" "<leader>fvb";
gitStatus = mkMappingOption "Git status [Telescope]" "<leader>fvs";
gitStash = mkMappingOption "Git stash [Telescope]" "<leader>fvx";
lspDocumentSymbols = mkMappingOption "LSP Document Symbols [Telescope]" "<leader>flsb";
lspWorkspaceSymbols = mkMappingOption "LSP Workspace Symbols [Telescope]" "<leader>flsw";
lspReferences = mkMappingOption "LSP References [Telescope]" "<leader>flr";
lspImplementations = mkMappingOption "LSP Implementations [Telescope]" "<leader>fli";
lspDefinitions = mkMappingOption "LSP Definitions [Telescope]" "<leader>flD";
lspTypeDefinitions = mkMappingOption "LSP Type Definitions [Telescope]" "<leader>flt";
diagnostics = mkMappingOption "Diagnostics [Telescope]" "<leader>fld";
treesitter = mkMappingOption "Treesitter [Telescope]" "<leader>fs";
};
enable = mkEnableOption "telescope.nvim: multi-purpose search and picker utility";
vimgrep_arguments = mkOption {
description = "Arguments to use for the grep command";
type = types.listOf types.str;
default = [
"${pkgs.ripgrep}/bin/rg"
"--color=never"
"--no-heading"
"--with-filename"
"--line-number"
"--column"
"--smart-case"
"--hidden"
"--no-ignore"
];
};
};
}