Commit Graph

50 Commits

Author SHA1 Message Date
Donovan Glover
939002e2f6
chore: Improve formatting 2024-09-01 14:12:17 -04:00
Donovan Glover
71b252d810
tests: Simplify machine imports 2024-09-01 13:43:36 -04:00
Donovan Glover
d188a89b6e
tests: Remove defaults.documentation.enable
Removed defaults.documentation.enable since it seems better to replicate
the environment as much as possible.

Also simplified specialArgs usage since we should never have to pass any
other args to the test machine.
2024-09-01 13:37:24 -04:00
Donovan Glover
d1a7f76d4f
tests: Remove useless parentheses
Tests seem to work fine without the `.config.result` part.
2024-09-01 13:34:53 -04:00
Donovan Glover
3bbb4befc2
tests: Remove useless import
Not needed when we have `self`.
2024-09-01 13:34:36 -04:00
Donovan Glover
64eb60a1ab
meta: Inline tests lib
The tests lib wasn't doing that much anyway and Nix flake checks are
just derivations that build successfully.
2024-09-01 12:52:23 -04:00
Donovan Glover
1c668bde68
chore: Format with nix fmt
nixfmt-rfc-style collapses lists like these.
2024-08-03 15:27:04 -04:00
Donovan Glover
8ece3e2812
treewide: Format remaining files with nixfmt-rfc-style 2024-08-03 14:49:00 -04:00
Donovan Glover
ce67ffbf73
meta: Rename homeManagerModules attribute to homeModules
This fixes an issue where previously homeManagerModules would be an
unknown flake output. Note that this change is a part of Nix 2.22.3
but not Nix 2.23.3.
2024-07-18 19:43:11 -04:00
Donovan Glover
e077bb8ff4
tests(neovim): Increase wait time
The addition of the neovim plugins made the initial time to open longer
than 5 seconds and thus failed the tests.

Note that using an alternative method like machine.wait_for_text() is
probably better in the long run to avoid flaky tests.
2024-05-20 13:42:48 -04:00
Donovan Glover
b5b20c7b19
tests: Test neovim with config
Fixes an issue where previously the home-manager config for neovim
wasn't actually being tested.
2024-05-19 00:45:55 -04:00
Donovan Glover
240cf74584
tests: Test neovim properly
This seems to work.
2024-05-12 21:59:48 -04:00
Donovan Glover
d1f759441a
tests: Remove hyprland
Might have been too large for the CI.
2024-05-12 21:59:06 -04:00
Donovan Glover
7b564db92d
meta(nix): Move test lib to separate directory 2024-04-09 08:02:31 -04:00
Donovan Glover
30e0239cf7
flake.nix: Dynamically import tests
Makes it possible to add new test files to the tests directory and have
everything instantly working.
2024-04-08 10:33:18 -04:00
Donovan Glover
7a8fdd7259
chore: Improve formatting 2024-04-05 19:01:41 -04:00
Donovan Glover
41ce56718b
chore: Simplify tests
Removes the redundant `self`.
2024-04-05 11:53:40 -04:00
Donovan Glover
22e31ff60b
chore: Format with nixpkgs-fmt
Note that we will continue to use nixpkgs-fmt for the time being here
since nixfmt-rfc-style breaks string syntax highlighting and comments
like `/* this */` get turned into `# this`.

The conversion from lisp-like formatting to something else in flake.nix
is a bit unfortunate, but I'd rather have a singular style for the
entire code base to make things easier.
2024-04-05 11:40:23 -04:00
Donovan Glover
59f557a3e5
feat: Pass nix-config as self to avoid infinite recursion
This change makes it possible to use this nix-config in all the
different ways imaginable (containers, bare metal, tests, and as a
separate flake input) *without* running into infinite recursion
issues with self.

It does this by using a trick similar to JavaScript in which
`var self = this;`, thus enabling the usage of "this" (or self, in
Nix's case) where it wouldn't otherwise be possible.

Note that this *only* works if the input for this repository is named
nix-config. This makes it impractical to combine with multiple
configurations that employ the same strategy.
2024-04-05 10:20:06 -04:00
Donovan Glover
b368817c52
feat: Simplify imports by importing with specialArgs
This change makes it possible to import the modules that are required
from the flake inputs in the output modules themselves, thus preventing
users from having to manually import those modules.

This simplifies things overall and was made possible by the specialArgs
option that allowed these flake inputs to be passed into our container.
2024-04-05 09:37:30 -04:00
Donovan Glover
267dda3224
chore: Add missing imports to tests
Necessary since system now depends on home-manager and desktop depends
on stylix, which also depends on home-manager.

Note that since conditional imports can't be used and we include the
system module inside of our containers which don't have access to self,
importing the required modules inside the module itself cannot be used.
2024-04-05 09:07:28 -04:00
Donovan Glover
3946ea52fb
chore: Update test imports 2024-04-04 17:31:01 -04:00
Donovan Glover
95b10ec3ef
meta: Begin writing tests in Nix
Now that I've figured out how to dynamically import modules and use
those modules as outputs, the next step is to ensure that these modules
work as intended when being used by end users.

NixOS offers a built-in testing solution that enables us to conveniently
spin up virtual machines with a given configuration, then verify their
correctness through python scripting.

The lib.nix file in particular is based on Jörg Thalheim's very useful
blog post that explains how to use the built-in testing functionality
with Nix flakes, which isn't covered in official documentation.

See: https://blog.thalheim.io/2023/01/08/how-to-use-nixos-testing-framework-with-flakes/
2024-04-02 05:20:42 -04:00
Donovan Glover
a193c91cd6
meta: Drop deno tests
These shouldn't be needed anymore now that I know how to dynamically
import modules and declare attribute sets with the built-in nix
functions.
2024-04-01 09:31:51 -04:00
Donovan Glover
98e88cd6a7
tests: Improve internal docs 2024-03-30 08:33:53 -04:00
Donovan Glover
771a97ef39
tests: Add option to exclude files from imports
Note that these tests were originally made to prevent dead code from
being in the repository, although a proper coverage solution would
likely be more useful long-term.
2024-03-30 08:32:41 -04:00
Donovan Glover
f315ce42f6
chore: Run deno fmt 2023-08-31 11:53:43 -04:00
Donovan Glover
824b710eb9
tests: Abstract logic into separate file 2023-08-31 11:50:27 -04:00
Donovan Glover
0f9ea294c2
tests: Complete migration to TypeScript/Deno
Well, that was easy.
2023-08-31 11:48:26 -04:00
Donovan Glover
0976968977
tests: Abstract assertion functionality
Also uses "async function" since I personally find that easier to skim
and know that it's a function.
2023-08-31 11:43:21 -04:00
Donovan Glover
fb7694a844
meta: Begin re-writing tests in TypeScript/Deno
2 months ago, I figured out how to make Crystal work on NixOS and made
an upstream PR to fix Crystal being unable to find -lpcre. Unfortunately,
that change hasn't been merged yet and I even encountered a core dumped
error when trying to build Crystal myself recently.

Although people may be busy, I am concerned about the popularity of
Crystal relative to other languages. It could be the case that the build
was broken for so long precisely because no one used Crystal, and that
the language isn't popular enough to generate comments on the patch either.

In any case, JavaScript/TypeScript is here to stay, and it certainly has
better tooling and community support than Crystal at the moment. Deno
has been going strong for a few years now, and now that I know Rust, I
can also contribute to it if I want to.
2023-08-31 11:31:37 -04:00
Donovan Glover
6e0d28e24a
tests: Remove unused requires 2023-07-16 18:17:02 -04:00
Donovan Glover
a3ca695d4e
tests: Remove hint
At some point this broke, although imports should be changed
infrequently enough that any failures should be trivial to resolve.
2023-07-09 22:25:51 -04:00
Donovan Glover
ef7cac947e
tests: Remove unused import 2023-07-09 17:47:51 -04:00
Donovan Glover
44b6e345d1
tests: Remove rofi check 2023-07-06 21:43:02 -04:00
Donovan Glover
1c15106231
tests: Remove joshuto check
No longer needed since v0.9.5 was released.
2023-07-04 18:59:21 -04:00
Donovan Glover
79f4ae0296
tests: Add tests for containers and specializations 2023-06-22 07:26:19 -04:00
Donovan Glover
92f057929a
meta: Flatten tests directory 2023-06-22 07:25:13 -04:00
Donovan Glover
181ea09092
meta: Use separate directory for home-manager modules 2023-06-16 08:13:34 -04:00
Donovan Glover
e492d80d0b
tests: Differentiate between local and online tests 2023-06-10 20:07:39 -04:00
Donovan Glover
9dacce9704
tests: Split methods into separate files 2023-06-10 10:24:47 -04:00
Donovan Glover
80e2052651
tests: Add tests for overlays 2023-06-10 09:48:14 -04:00
Donovan Glover
c91d02adc0
tests: Modularize import checker 2023-06-10 09:37:52 -04:00
Donovan Glover
36ddba7e9b
tests: Only import modules that exist 2023-06-10 09:27:36 -04:00
Donovan Glover
59c19f1e7c
tests: Add test for rofi overlay 2023-06-09 09:06:04 -04:00
Donovan Glover
b79b1d3672
tests: Simplify 2023-06-08 20:58:08 -04:00
Donovan Glover
6f32f06b3d
tests: Use more descriptive descriptions 2023-06-08 19:58:18 -04:00
Donovan Glover
bf2cdf2ec2
tests: Show hints after suite
This prevents interfering with the test output while tests are running.
2023-06-08 19:48:02 -04:00
Donovan Glover
cfcb2033a8
tests: Ensure latest joshuto commit 2023-06-08 19:11:40 -04:00
Donovan Glover
d137d3342c
meta: Add tests
Tests help guarantee that I don't forget to do something that I should
have done, such as importing a certain nix module.
2023-06-08 17:15:58 -04:00