mirror of
https://github.com/NotAShelf/neovim-flake.git
synced 2024-11-14 05:55:59 +01:00
Compare commits
6 commits
6c0f1bb8fb
...
18f759690b
Author | SHA1 | Date | |
---|---|---|---|
|
18f759690b | ||
2bfedb14dc | |||
aa62e904d6 | |||
c3c76afda4 | |||
198a36f3d4 | |||
3aa02e8524 |
7 changed files with 167 additions and 0 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -2,6 +2,7 @@
|
|||
result
|
||||
result/
|
||||
.direnv
|
||||
.nixos-test-history
|
||||
|
||||
# Ignore files generated by common IDEs
|
||||
.vscode/*
|
||||
|
|
21
flake.lock
21
flake.lock
|
@ -67,6 +67,26 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"home-manager": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1714981474,
|
||||
"narHash": "sha256-b3/U21CJjCjJKmA9WqUbZGZgCvospO3ArOUTgJugkOY=",
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"rev": "6ebe7be2e67be7b9b54d61ce5704f6fb466c536f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-community",
|
||||
"repo": "home-manager",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"naersk": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
|
@ -1749,6 +1769,7 @@
|
|||
"inputs": {
|
||||
"flake-parts": "flake-parts",
|
||||
"flake-utils": "flake-utils",
|
||||
"home-manager": "home-manager",
|
||||
"nil": "nil",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"nmd": "nmd",
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
imports = [
|
||||
# add lib to module args
|
||||
{_module.args = {inherit (nixpkgs) lib;};}
|
||||
|
||||
./flake/tests # machine tests for nvf
|
||||
./flake/apps.nix
|
||||
./flake/legacyPackages.nix
|
||||
./flake/overlays.nix
|
||||
|
@ -88,6 +90,12 @@
|
|||
flake = false;
|
||||
};
|
||||
|
||||
# Primarily used for testing nvf.
|
||||
home-manager = {
|
||||
url = "github:nix-community/home-manager";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
# TODO: get zig from the zig overlay instead of nixpkgs
|
||||
zig.url = "github:mitchellh/zig-overlay";
|
||||
|
||||
|
|
33
flake/tests/checks/homeManagerModule.nix
Normal file
33
flake/tests/checks/homeManagerModule.nix
Normal file
|
@ -0,0 +1,33 @@
|
|||
{
|
||||
inputs,
|
||||
nixosTest,
|
||||
homeManagerModules,
|
||||
testProfile,
|
||||
...
|
||||
}:
|
||||
nixosTest {
|
||||
name = "home-manager-test";
|
||||
skipLint = true;
|
||||
|
||||
nodes.machine = {
|
||||
imports = [
|
||||
testProfile
|
||||
inputs.home-manager.nixosModules.home-manager
|
||||
];
|
||||
|
||||
config = {
|
||||
home-manager = {
|
||||
sharedModules = [
|
||||
homeManagerModules.nvf
|
||||
];
|
||||
|
||||
users.test = {
|
||||
home.stateVersion = "24.05";
|
||||
programs.nvf.enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
testScript = "";
|
||||
}
|
56
flake/tests/checks/nixosModule.nix
Normal file
56
flake/tests/checks/nixosModule.nix
Normal file
|
@ -0,0 +1,56 @@
|
|||
{
|
||||
nixosTest,
|
||||
nixosModules,
|
||||
testProfile,
|
||||
...
|
||||
}:
|
||||
nixosTest {
|
||||
name = "nixos-test";
|
||||
|
||||
nodes.machine = {
|
||||
imports = [
|
||||
testProfile
|
||||
nixosModules.nvf
|
||||
];
|
||||
|
||||
config = {
|
||||
programs.nvf.enable = true;
|
||||
};
|
||||
};
|
||||
|
||||
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())
|
||||
'';
|
||||
}
|
35
flake/tests/default.nix
Normal file
35
flake/tests/default.nix
Normal file
|
@ -0,0 +1,35 @@
|
|||
{
|
||||
inputs,
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
perSystem = {
|
||||
pkgs,
|
||||
self',
|
||||
...
|
||||
}: let
|
||||
inherit (lib.filesystem) packagesFromDirectoryRecursive;
|
||||
inherit (lib.customisation) callPackageWith;
|
||||
inherit (lib.attrsets) recursiveUpdate;
|
||||
|
||||
defaultInherits = {
|
||||
inherit (config.flake) homeManagerModules nixosModules;
|
||||
inherit inputs;
|
||||
testProfile = ./profiles/minimal.nix;
|
||||
};
|
||||
|
||||
callPackage = callPackageWith (recursiveUpdate pkgs defaultInherits);
|
||||
in {
|
||||
checks = packagesFromDirectoryRecursive {
|
||||
inherit callPackage;
|
||||
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;
|
||||
};
|
||||
};
|
||||
}
|
13
flake/tests/profiles/minimal.nix
Normal file
13
flake/tests/profiles/minimal.nix
Normal file
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
# he's a thicc boi
|
||||
virtualisation = {
|
||||
cores = 2;
|
||||
memorySize = 2048;
|
||||
qemu.options = ["-vga none -enable-kvm -device virtio-gpu-pci,xres=720,yres=1440"];
|
||||
};
|
||||
|
||||
users.users.test = {
|
||||
isNormalUser = true;
|
||||
password = "";
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue