nixos-config/tests/lib/builders.nix
Gabriel Arazas 11806b9c4b
lib: init builders subset
Most of it is specifically for NixOS usage but in case that it is
possible for independent desktop sessions entirely made in home-manager
especially in non-NixOS systems, it will be... nice.
2024-07-10 19:19:48 +08:00

68 lines
2.1 KiB
Nix

{ pkgs, lib, self }:
let
sampleDesktopName = "horizontal-hunger";
in
lib.runTests {
testsBuilderMakeSampleXDGAssociationList = {
expr =
let
xdgAssociations = self.builders.makeXDGMimeAssociationList {
defaultApplications = {
"application/pdf" = "firefox.desktop";
};
};
in builtins.readFile "${xdgAssociations}/share/applications/mimeapps.list";
expected =
builtins.readFile ./data/fixtures/xdg-mime-sample-mimeapps.list;
};
# This should only create the "Default Applications" section of the
# specific-desktop mimeapps.list.
testsBuilderMakeSampleDesktopSpecificXDGAssociationList = {
expr =
let
xdgAssociations = self.builders.makeXDGMimeAssociationList {
desktopName = sampleDesktopName;
defaultApplications = {
"application/pdf" = "firefox.desktop";
};
};
in builtins.readFile "${xdgAssociations}/share/applications/${sampleDesktopName}-mimeapps.list";
expected =
builtins.readFile ./data/fixtures/xdg-mime-sample-desktop-specific-mimeapps.list;
};
testsBuilderMakeSampleXDGPortalCommonConfig = {
expr =
let
xdgPortalConf = self.builders.makeXDGPortalConfiguration {
config.preferred = {
default = "gtk";
"org.freedesktop.impl.portal.Screencast" = "gnome";
};
};
in
builtins.readFile "${xdgPortalConf}/share/xdg-desktop-portal/portals.conf";
expected =
builtins.readFile ./data/fixtures/xdg-portal.conf;
};
# We're just testing out if the destination is correct at this point.
testsBuilderMakeSampleXDGPortalDesktopSpecificConfig = {
expr =
let
xdgPortalConf = self.builders.makeXDGPortalConfiguration {
desktopName = sampleDesktopName;
config.preferred = {
default = "gtk";
"org.freedesktop.impl.portal.Screencast" = "gnome";
};
};
in
builtins.readFile "${xdgPortalConf}/share/xdg-desktop-portal/${sampleDesktopName}-portals.conf";
expected =
builtins.readFile ./data/fixtures/xdg-portal.conf;
};
}