Compare commits

...

11 Commits

Author SHA1 Message Date
raf dc2f8221e3
Merge 2bfedb14dc into 2759b9caae 2024-06-24 17:00:12 +03:00
raf 2759b9caae
Merge pull request #310 from jacekpoz/orgmode
plugins/orgmode: remove deprecated ts setup call
2024-06-23 17:05:04 +00:00
jacekpoz abdcb62941
flake: bump nixpkgs input 2024-06-23 19:02:40 +02:00
jacekpoz d873bc0667
plugins/orgmode: remove deprecated ts setup call 2024-06-23 15:14:10 +02:00
raf f66c40b687
Merge pull request #309 from FrothyMarrow/nixpkgs-branch
flake: switch nixpkgs branch to nixpkgs-unstable
2024-06-22 23:45:01 +00:00
Frothy ad22bca3d7 flake: switch nixpkgs branch to nixpkgs-unstable 2024-06-22 19:28:54 -04:00
NotAShelf 2bfedb14dc
flake/tests: also expose nixos machine tests as a package 2024-05-09 00:54:29 +03:00
NotAShelf aa62e904d6
flake/tests: pass testProfile as a shared arg 2024-05-06 23:30:48 +03:00
NotAShelf c3c76afda4
flake/tests: initial test script 2024-05-06 17:25:58 +03:00
NotAShelf 198a36f3d4
flake/tests: add missing imports 2024-05-06 16:43:05 +03:00
NotAShelf 3aa02e8524
flake: add machine tests 2024-05-06 16:13:38 +03:00
8 changed files with 172 additions and 8 deletions

1
.gitignore vendored
View File

@ -2,6 +2,7 @@
result
result/
.direnv
.nixos-test-history
# Ignore files generated by common IDEs
.vscode/*

View File

@ -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": [
@ -114,16 +134,16 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1718910271,
"narHash": "sha256-vft9UIECxL4FtfX5UsTEE2XvvH9z9/BeP8pACAYEbwY=",
"lastModified": 1719082008,
"narHash": "sha256-jHJSUH619zBQ6WdC21fFAlDxHErKVDJ5fpN0Hgx4sjs=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "19cd1c918369d89128bcb6a6da87137bdf42e997",
"rev": "9693852a2070b398ee123a329e68f0dab5526681",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable-small",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
@ -1749,6 +1769,7 @@
"inputs": {
"flake-parts": "flake-parts",
"flake-utils": "flake-utils",
"home-manager": "home-manager",
"nil": "nil",
"nixpkgs": "nixpkgs",
"nmd": "nmd",

View File

@ -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
@ -77,7 +79,7 @@
# Flake inputs
inputs = {
## Basic Inputs
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable-small";
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
flake-utils.url = "github:numtide/flake-utils";
systems.url = "github:nix-systems/default";
@ -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";

View 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 = "";
}

View 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
View 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;
};
};
}

View 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 = "";
};
}

View File

@ -22,9 +22,6 @@ in {
};
luaConfigRC.orgmode = entryAnywhere ''
-- Load custom treesitter grammar for org filetype
require('orgmode').setup_ts_grammar()
-- Treesitter configuration
require('nvim-treesitter.configs').setup {