-
-
Notifications
You must be signed in to change notification settings - Fork 283
treewide: allow re-running test code and simplify testbeds #1662
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
base: master
Are you sure you want to change the base?
treewide: allow re-running test code and simplify testbeds #1662
Conversation
1e3df8b to
0a8661c
Compare
b9e3c74 to
a5a8c41
Compare
a5a8c41 to
0042265
Compare
|
Important This patchset should be |
0xda157
left a comment
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.
generally lgtm, just some small things
| name = name'; | ||
| }; | ||
|
|
||
| name' = "stylix-testbed" + lib.optionalString (name != "") "-${name}"; |
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 would prefer putting name' at the top of the let in because it's used by other things in the let in block
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 would prefer putting
name'at the top of thelet inbecause it's used by other things in thelet inblock
The let application name' in order was already previously present.
Personally, I prefer uniformly sorting non-special constructs lexicographically to avoid ambiguous cases, while keeping the set of special constructs as small as possible.
For example, keeping the
╭-------a-------╮
| |
╭---aa---╮ ╭---ab---╮
| | | |
aaa aab aba abb
dependency tree declarations in DFS order (a aa aaa aab ab aba abb) without tooling (which is practically non-existent) is a lot more effort than simply lexicographically sorting them. Note that the recursive DFS order falls apart when dealing with general DAGs, as in aaa also depends on aba in the previous graph. Since most modern languages, including Nix, no longer require declaration before use, identifiers can be arbitrarily ordered within the same scope, in which case I prefer lexicographical sorting.
Special Nix constructs include imports options config declarations and conventional fetchFrom* { owner repo rev hash } argument sorting.
I am fine with moving name' to the top, but we can also just leave it as-is.
0042265 to
92ee46f
Compare
|
The x86_64-linux Zathura testbeds keep failing because of https://nix-community.cachix.org:
Are we rate limiting the cache because all of the testbeds in this PR are new? Note that the aarch64-linux job succeeded on the second CI attempt. Running just nix build .#checks.x86_64-linux.testbed:zathura:{dark,imageless,cursorless}locally also causes the same errors... For reference, CI was still passing on v7. CC: @danth |
Fixes: 8b898ca ("sxiv: avoid downloading custom file in testbed (nix-community#1641)")
Co-authored-by: awwpotato <[email protected]>
Allow re-running test code via deskop items and stylix-testbed-${name}
CLIs.
Simplify and standardize testbeds by replacing
config.stylix.testbed.ui.application declarations with
config.stylix.testbed.ui.command, and replacing
stylix.testbed.ui.command = {
packages = [ package ];
text = package.meta.mainProgram;
};
with
stylix.testbed.ui.command.packages = [ package ];
by trivially deducing config.stylix.testbed.ui.command.text from
config.stylix.testbed.ui.command.packages.
Leverage the default programs."<PACKAGE>".package value to simplify
let
package = pkgs."<PACKAGE>";
in
{
stylix.testbed.ui.command.packages = [ package ];
home-manager.sharedModules = lib.singleton {
programs."<PACKAGE>" = {
inherit package;
enable = true;
};
};
}
to
{
stylix.testbed.ui.command.text = "<PACKAGE_META_MAIN_PROGRAM>";
home-manager.sharedModules = lib.singleton {
programs."<PACKAGE>".enable = true;
};
}
Minor stylistic changes are made to standardize testbed declarations.
Simplify the testbed interface by renaming stylix.testbed.ui.command.useTerminal to stylix.testbed.ui.command.terminal.
92ee46f to
85a5792
Compare
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.
$ nix build .#testbed:obsidian:dark error: [...] error: Package ‘obsidian-1.10.3’ in /nix/store/c9asdiqw1rf5qwdjz26f57hp68ppb8fc-source/pkgs/by-name/ob/obsidian/package.nix:18 has an unfree license (‘obsidian’), refusing to evaluate. a) To temporarily allow unfree packages, you can use an environment variable for a single invocation of the nix tools. $ export NIXPKGS_ALLOW_UNFREE=1 Note: When using `nix shell`, `nix build`, `nix develop`, etc with a flake, then pass `--impure` in order to allow use of environment variables. b) For `nixos-rebuild` you can set { nixpkgs.config.allowUnfree = true; } in configuration.nix to override this. Alternatively you can configure a predicate to allow specific packages: { nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ "obsidian" ]; } c) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add { allowUnfree = true; } to ~/.config/nixpkgs/config.nix.
Why does setting programs.obsidian.package to its supposedly default value resolve the error:
diff --git a/modules/obsidian/testbeds/obsidian.nix b/modules/obsidian/testbeds/obsidian.nix
index d648e67a..c2bff776 100644
--- a/modules/obsidian/testbeds/obsidian.nix
+++ b/modules/obsidian/testbeds/obsidian.nix
@@ -1,4 +1,4 @@
-{ lib, ... }:
+{ lib, pkgs, ... }:
{
stylix.testbed.ui.command.text = "obsidian";
@@ -14,6 +14,7 @@
programs.obsidian = {
enable = true;
+ package = pkgs.obsidian;
vaults.${vault}.enable = true;
};
};Why does
stylix/modules/obsidian/testbeds/obsidian.nix
Lines 5 to 6 in 85a5792
| nixpkgs.config.allowUnfreePredicate = | |
| pkg: builtins.elem (lib.getName pkg) [ "obsidian" ]; |
seemingly have no impact, although it does for the following instances:
stylix/modules/discord/testbeds/vencord.nix
Lines 19 to 23 in 89f99bf
nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ "discord" ]; stylix/modules/spicetify/testbeds/spicetify.nix
Lines 19 to 23 in 89f99bf
nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ "spotify" ];
Changelog
v9: 85a5792
v8: 92ee46f
v7: 0042265
treewide: simplify and standardize testbedsprograms."<PACKAGE">.packagetypo in commit message withprograms."<PACKAGE>".package./modules/spicetify/testbeds/spicetify.nixformatting, as suggested in treewide: allow re-running test code and simplify testbeds #1662 (comment).v6: a5a8c41
treewide: simplify and standardize testbedsstylix.testbed.ui.command.textusage in/modules/spicetify/testbeds/spicetify.nix.v5: b9e3c74
treewide: simplify and standardize testbedsstylix.testbed.ui.command.packages = [ pkgs.kitty ];in/modules/kde/testbeds/plasma5.nixto avoid enabling GNOME.v4: 2b4754f
treewide: simplify and standardize testbedspackagesvariable inthrow.v3: 303cef8
treewide: simplify and standardize testbedsthrowcall.multiline = false;because we arethrowing and no longer curating assertion errors.v2: 1a8885e
treewide: simplify and standardize testbedsnullaccess by inlining assertion and using local variables.v1: 0a8661c
treewide: optionally apply lib.getExe to stylix.testbed.ui.command.gnome-text-editorin favor of the new committreewide: simplify and standardize testbeds.sxiv/testbed: remove trailing Bash semicolonstylix/testbed/modules/application: allow re-running test codestylix/testbed/modules/application: conveniently install dependenciestreewide: rename stylix.testbed.ui.command.{useTerminal => terminal}v0: 1e3df8b
treewide: simplify and standardize testbedshas only been partially tested.Notify Maintainers