-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
vivid: add module #6045
base: master
Are you sure you want to change the base?
vivid: add module #6045
Conversation
0f07e4f
to
2b9f396
Compare
@folliehiyuki Hej, I just wanted to check if the PR is alright. It is my first in the |
modules/programs/vivid.nix
Outdated
"set -gx LS_COLORS (${lib.getExe pkgs.vivid} generate ${theme})"; | ||
nushellLine = theme: "${lib.getExe pkgs.vivid} generate ${theme}"; | ||
zshLine = bashLine; | ||
in { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can put a with lib;
declaration here, so usages of lib
afterward can be shorten.
modules/programs/vivid.nix
Outdated
}; | ||
|
||
theme = lib.mkOption { | ||
type = lib.types.nullOr lib.types.str; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
type = lib.types.nullOr lib.types.str; | |
type = with types; nullOr str; |
assuming that with lib;
was declared above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same goes for the other options as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have rewritten the module with with lib;
.
I checked it multiple times, so there shouldn't be anything missing.
Can you also write a couple of assert tests for |
Do you have any examples on how to write those tests? I am not that experienced.
In Nix and put it in the |
295e83d
to
04b689f
Compare
You can look into https://github.com/nix-community/home-manager/tree/master/tests/modules/programs for referenced assert test cases and how to write them.
I mean defining them in an assert test. You write the sample theme inside Nix and assert the generated theme file with expected value. |
6422963
to
2ea1b62
Compare
I looked into the new ghostty PR and took that init as a base to design the tests (plus some other modules as you suggested!). All of the tests pass on my device, I also went a bit overboard with the config, but I wanted to see if it works correctly! Hit me up if I need to reduce it :) I also fixed a small type in generating the |
@folliehiyuki sorry for the tag, but I wanted finish this PR so it can be integrated until the |
@rycee Hi, sorry for the ping, but I wanted to ask if someone could review the PR in march/april :) maybe you know someone, who has time on their hands, since Hoang seems to be busy. |
im not a reviewer, but my thoughts: this is a very simple program that generates static output based on the given theme name. and there is just a lot here to go over and maybe why there is a problem in getting a reviewer. the testing seems overkill. the test should be specific to the implementation of the nixos module working, not every aspect of the program itself -- that should be in upstream. I implement it like this: sessionVariables =
let
lsColors = builtins.readFile (
pkgs.runCommand "vivid-ls-colors" { } ''
${lib.getExe pkgs.vivid} generate dracula > $out
''
);
in
{
LS_COLORS = "${lsColors}";
} this allows nix build to run the vivid command to output LS_COLORS and stores it. it runs once on the build machine, not requiring the vivid binary to be copied to each host and to be run each time a login shell is executed. also this uses hope this helps |
@sedlund Thanks for the feedback! What would you recommend to focus the testing on? I am still new in that regard to nixos and home-manager. I just implemented the recommended changes using Just tried to do it at work and nuked my branch with a reset... But I should still have the files on my laptop at home! Afterwards I will reopen the PR or create a new one if I can't reopen this one! |
Reopening it |
be19dd8
to
96509d3
Compare
Sorry for the spam! As for the tests, I would refactor them if you have some suggestions or even an example. Should I just make the files smaller, like a minimal working example, and use that as a test? |
My thought is that the current test is only testing if I tested creating a small vivid generate mytheme this tests and verifies the
and exits 1 This would be output now during build with your recent changes - and I think the output would be more useful. Nothing stands out to me what more could be tested. |
Description
Add module for https://github.com/sharkdp/vivid.
Previous PRs #2194 and #3705 addressed this, but never merged.
The
themes
andfiletypes
section were taken from #2194.The shell integrations are used since the variable name
LS_COLORS
needs to be set to the output of the commandvivid generate <theme>
. One could utilize what #2194 used:but this wouldn't work for
fish
andnushell
.Checklist
Change is backwards compatible.
Code formatted with
./format
.Code tested through
nix-shell --pure tests -A run.all
ornix develop --ignore-environment .#all
using Flakes.Test cases updated/added. See example.
Commit messages are formatted like
See CONTRIBUTING for more information and recent commit messages for examples.
If this PR adds a new module
Maintainer CC