1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-12-25 19:29:47 +01:00
home-manager/tests/modules/programs/gnome-shell/gnome-shell.nix
Matthieu Coudron e526fd2b1a
gnome-shell: fix extensions' default (#6199)
Else I get a
===

       … while calling the 'throw' builtin
         at /nix/store/afpmddfrmx5df3h16bdh00yy8i7db8w4-source/pkgs/desktops/gnome/default.nix:96:28:
           95|   gnome-shell = throw "The ‘gnome.gnome-shell’ was moved to top-level. Please use ‘pkgs.gnome-shell’ directly."; # Added on 2024-08-28.
           96|   gnome-shell-extensions = throw "The ‘gnome.gnome-shell-extensions’ was moved to top-level. Please use ‘pkgs.gnome-shell-extensions’ directly."; # Added on 2024-08-11.
             |                            ^
           97|   gnome-software = throw "The ‘gnome.gnome-software’ was moved to top-level. Please use ‘pkgs.gnome-software’ directly."; # Added on 2024-08-11.

       error: The ‘gnome.gnome-shell-extensions’ was moved to top-level. Please use ‘pkgs.gnome-shell-extensions’ directly.
===

on rebuild
2024-12-12 21:58:33 +01:00

90 lines
2.5 KiB
Nix

{ config, lib, pkgs, ... }:
with lib;
let
dummy-gnome-shell-extensions = pkgs.runCommand "dummy-package" { } ''
mkdir -p $out/share/gnome-shell/extensions/dummy-package
touch $out/share/gnome-shell/extensions/dummy-package/test
'';
test-extension = pkgs.runCommand "test-extension" { } ''
mkdir -p $out/share/gnome-shell/extensions/test-extension
touch $out/share/gnome-shell/extensions/test-extension/test
'';
test-extension-uuid = pkgs.runCommand "test-extension-uuid" {
passthru.extensionUuid = "test-extension-uuid";
} ''
mkdir -p $out/share/gnome-shell/extensions/test-extension-uuid
touch $out/share/gnome-shell/extensions/test-extension-uuid/test
'';
test-theme = pkgs.runCommand "test-theme" { } ''
mkdir -p $out/share/themes/Test/gnome-shell
touch $out/share/themes/Test/gnome-shell/test
'';
expectedEnabledExtensions = [
"user-theme@gnome-shell-extensions.gcampax.github.com"
"test-extension"
"test-extension-uuid"
];
actualEnabledExtensions = catAttrs "value"
config.dconf.settings."org/gnome/shell".enabled-extensions.value;
in {
nixpkgs.overlays = [
(final: prev: { gnome-shell-extensions = dummy-gnome-shell-extensions; })
];
programs.gnome-shell.enable = true;
programs.gnome-shell.extensions = [
{
id = "test-extension";
package = test-extension;
}
{ package = test-extension-uuid; }
];
programs.gnome-shell.theme = {
name = "Test";
package = test-theme;
};
assertions = [
{
assertion =
config.dconf.settings."org/gnome/shell".disable-user-extensions
== false;
message = "Expected disable-user-extensions to be false.";
}
{
assertion =
all (e: elem e actualEnabledExtensions) expectedEnabledExtensions;
message = ''
Expected enabled-extensions to contain all of:
${toString expectedEnabledExtensions}
But it was:
${toString actualEnabledExtensions}
'';
}
{
assertion =
config.dconf.settings."org/gnome/shell/extensions/user-theme".name
== "Test";
message = "Expected extensions/user-theme/name to be 'Test'.";
}
];
test.stubs.dconf = { };
nmt.script = ''
assertFileExists home-path/share/gnome-shell/extensions/dummy-package/test
assertFileExists home-path/share/gnome-shell/extensions/test-extension/test
assertFileExists home-path/share/gnome-shell/extensions/test-extension-uuid/test
assertFileExists home-path/share/themes/Test/gnome-shell/test
'';
}