From 62587f43ddf884335f2ed0ee83673d9ffa9a2465 Mon Sep 17 00:00:00 2001 From: worldofpeace Date: Mon, 27 Apr 2020 22:35:31 -0400 Subject: [PATCH 1/4] nixos-artwork: add file path attributes This makes things so much easier, and we install to the path that both gnome-backgrounds and elementary-wallpapers install to. --- .../services/x11/desktop-managers/gnome3.nix | 4 ++-- .../services/x11/display-managers/lightdm.nix | 6 +++++- nixos/modules/system/boot/loader/grub/grub.nix | 2 +- pkgs/data/misc/nixos-artwork/wallpapers.nix | 14 +++++++++++++- .../elementary-default-settings/default.nix | 2 +- .../desktop/elementary-greeter/default.nix | 4 ++-- 6 files changed, 24 insertions(+), 8 deletions(-) diff --git a/nixos/modules/services/x11/desktop-managers/gnome3.nix b/nixos/modules/services/x11/desktop-managers/gnome3.nix index bbc7feb2d049..50ee048802e3 100644 --- a/nixos/modules/services/x11/desktop-managers/gnome3.nix +++ b/nixos/modules/services/x11/desktop-managers/gnome3.nix @@ -37,10 +37,10 @@ let chmod -R a+w $out/share/gsettings-schemas/nixos-gsettings-overrides cat - > $out/share/gsettings-schemas/nixos-gsettings-overrides/glib-2.0/schemas/nixos-defaults.gschema.override <<- EOF [org.gnome.desktop.background] - picture-uri='file://${pkgs.nixos-artwork.wallpapers.simple-dark-gray}/share/artwork/gnome/nix-wallpaper-simple-dark-gray.png' + picture-uri='file://${pkgs.nixos-artwork.wallpapers.simple-dark-gray.gnomeFilePath}' [org.gnome.desktop.screensaver] - picture-uri='file://${pkgs.nixos-artwork.wallpapers.simple-dark-gray-bottom}/share/artwork/gnome/nix-wallpaper-simple-dark-gray_bottom.png' + picture-uri='file://${pkgs.nixos-artwork.wallpapers.simple-dark-gray-bottom.gnomeFilePath}' [org.gnome.shell] favorite-apps=[ 'org.gnome.Epiphany.desktop', 'org.gnome.Geary.desktop', 'org.gnome.Music.desktop', 'org.gnome.Photos.desktop', 'org.gnome.Nautilus.desktop', 'org.gnome.Software.desktop' ] diff --git a/nixos/modules/services/x11/display-managers/lightdm.nix b/nixos/modules/services/x11/display-managers/lightdm.nix index 479548863b47..1ebc4b5930e9 100644 --- a/nixos/modules/services/x11/display-managers/lightdm.nix +++ b/nixos/modules/services/x11/display-managers/lightdm.nix @@ -133,7 +133,8 @@ in background = mkOption { type = types.str; - default = "${pkgs.nixos-artwork.wallpapers.simple-dark-gray-bottom}/share/artwork/gnome/nix-wallpaper-simple-dark-gray_bottom.png"; + # Manual cannot depend on packages, we are actually setting the default in config below. + defaultText = "pkgs.nixos-artwork.wallpapers.simple-dark-gray-bottom.gnomeFilePath"; description = '' The background image or color to use. ''; @@ -212,6 +213,9 @@ in } ]; + # Keep in sync with the defaultText value from the option definition. + services.xserver.displayManager.lightdm.background = mkDefault pkgs.nixos-artwork.wallpapers.simple-dark-gray-bottom.gnomeFilePath; + # Set default session in session chooser to a specified values – basically ignore session history. # Auto-login is already covered by a config value. services.xserver.displayManager.job.preStart = optionalString (!cfg.autoLogin.enable && dmcfg.defaultSession != null) '' diff --git a/nixos/modules/system/boot/loader/grub/grub.nix b/nixos/modules/system/boot/loader/grub/grub.nix index c775632a4aa0..e38bafabb02b 100644 --- a/nixos/modules/system/boot/loader/grub/grub.nix +++ b/nixos/modules/system/boot/loader/grub/grub.nix @@ -83,7 +83,7 @@ let ] ++ (optional (cfg.fontSize!=null) "--size ${toString cfg.fontSize}"))) ); - defaultSplash = "${pkgs.nixos-artwork.wallpapers.simple-dark-gray-bootloader}/share/artwork/gnome/nix-wallpaper-simple-dark-gray_bootloader.png"; + defaultSplash = pkgs.nixos-artwork.wallpapers.simple-dark-gray-bootloader.gnomeFilePath; in { diff --git a/pkgs/data/misc/nixos-artwork/wallpapers.nix b/pkgs/data/misc/nixos-artwork/wallpapers.nix index a6a368e26e07..6e6b6e92678e 100644 --- a/pkgs/data/misc/nixos-artwork/wallpapers.nix +++ b/pkgs/data/misc/nixos-artwork/wallpapers.nix @@ -3,12 +3,18 @@ let mkNixBackground = { name, src, description }: - stdenv.mkDerivation { + let + pkg = stdenv.mkDerivation { inherit name src; dontUnpack = true; installPhase = '' + # GNOME + mkdir -p $out/share/backgrounds/nixos + ln -s $src $out/share/backgrounds/nixos/${src.name} + + # TODO: is this path still needed? mkdir -p $out/share/artwork/gnome ln -s $src $out/share/artwork/gnome/${src.name} @@ -22,6 +28,11 @@ X-KDE-PluginInfo-Name=${name} _EOF ''; + passthru = { + gnomeFilePath = "${pkg}/share/backgrounds/nixos/${src.name}"; + kdeFilePath = "${pkg}/share/wallpapers/${name}/contents/images/${src.name}"; + }; + meta = with stdenv.lib; { inherit description; homepage = "https://github.com/NixOS/nixos-artwork"; @@ -29,6 +40,7 @@ _EOF platforms = platforms.all; }; }; +in pkg; in diff --git a/pkgs/desktops/pantheon/desktop/elementary-default-settings/default.nix b/pkgs/desktops/pantheon/desktop/elementary-default-settings/default.nix index 4e8d8bfeb150..3215c001a5e7 100644 --- a/pkgs/desktops/pantheon/desktop/elementary-default-settings/default.nix +++ b/pkgs/desktops/pantheon/desktop/elementary-default-settings/default.nix @@ -62,7 +62,7 @@ stdenv.mkDerivation rec { mesonFlags = [ "--sysconfdir=${placeholder "out"}/etc" - "-Ddefault-wallpaper=${nixos-artwork.wallpapers.simple-dark-gray}/share/artwork/gnome/nix-wallpaper-simple-dark-gray.png" + "-Ddefault-wallpaper=${nixos-artwork.wallpapers.simple-dark-gray.gnomeFilePath}" "-Dplank-dockitems=false" ]; diff --git a/pkgs/desktops/pantheon/desktop/elementary-greeter/default.nix b/pkgs/desktops/pantheon/desktop/elementary-greeter/default.nix index 64c4509280a0..c460d45dfeee 100644 --- a/pkgs/desktops/pantheon/desktop/elementary-greeter/default.nix +++ b/pkgs/desktops/pantheon/desktop/elementary-greeter/default.nix @@ -89,7 +89,7 @@ stdenv.mkDerivation rec { # Needed until https://github.com/elementary/greeter/issues/360 is fixed (substituteAll { src = ./hardcode-fallback-background.patch; - default_wallpaper = "${nixos-artwork.wallpapers.simple-dark-gray}/share/artwork/gnome/nix-wallpaper-simple-dark-gray.png"; + default_wallpaper = "${nixos-artwork.wallpapers.simple-dark-gray.gnomeFilePath}"; }) ]; @@ -113,7 +113,7 @@ stdenv.mkDerivation rec { # Use NixOS default wallpaper substituteInPlace $out/etc/lightdm/io.elementary.greeter.conf \ --replace "#default-wallpaper=/usr/share/backgrounds/elementaryos-default" \ - "default-wallpaper=${nixos-artwork.wallpapers.simple-dark-gray}/share/artwork/gnome/nix-wallpaper-simple-dark-gray.png" + "default-wallpaper=${nixos-artwork.wallpapers.simple-dark-gray.gnomeFilePath}" substituteInPlace $out/share/xgreeters/io.elementary.greeter.desktop \ --replace "Exec=io.elementary.greeter" "Exec=$out/bin/io.elementary.greeter" From 3d1706c28df08ca09e9502ef9e17322ea71a70a4 Mon Sep 17 00:00:00 2001 From: Jan Tojnar Date: Wed, 29 Apr 2020 05:33:04 +0200 Subject: [PATCH 2/4] nixos/lightdm: change background type to path --- nixos/modules/services/x11/display-managers/lightdm.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nixos/modules/services/x11/display-managers/lightdm.nix b/nixos/modules/services/x11/display-managers/lightdm.nix index 1ebc4b5930e9..678cade44427 100644 --- a/nixos/modules/services/x11/display-managers/lightdm.nix +++ b/nixos/modules/services/x11/display-managers/lightdm.nix @@ -132,7 +132,7 @@ in }; background = mkOption { - type = types.str; + type = types.path; # Manual cannot depend on packages, we are actually setting the default in config below. defaultText = "pkgs.nixos-artwork.wallpapers.simple-dark-gray-bottom.gnomeFilePath"; description = '' From 7f3bc5b8fabb325c9378094d445762dfd44439f9 Mon Sep 17 00:00:00 2001 From: worldofpeace Date: Mon, 27 Apr 2020 22:36:56 -0400 Subject: [PATCH 3/4] nixos/gnome3: install nixos wallpapers --- nixos/modules/services/x11/desktop-managers/gnome3.nix | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nixos/modules/services/x11/desktop-managers/gnome3.nix b/nixos/modules/services/x11/desktop-managers/gnome3.nix index 50ee048802e3..803419f5d6c6 100644 --- a/nixos/modules/services/x11/desktop-managers/gnome3.nix +++ b/nixos/modules/services/x11/desktop-managers/gnome3.nix @@ -320,6 +320,8 @@ in gnome-shell gnome-shell-extensions gnome-themes-extra + nixos-artwork.wallpapers.simple-dark-gray + nixos-artwork.wallpapers.simple-dark-gray-bottom pkgs.gnome-user-docs pkgs.orca pkgs.glib # for gsettings From 5100e4f250833d42dffd9c55e3fda82303b606fd Mon Sep 17 00:00:00 2001 From: worldofpeace Date: Mon, 27 Apr 2020 22:38:10 -0400 Subject: [PATCH 4/4] nixos/pantheon: install nixos wallpaper Fixes #86146 --- nixos/modules/services/x11/desktop-managers/pantheon.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/nixos/modules/services/x11/desktop-managers/pantheon.nix b/nixos/modules/services/x11/desktop-managers/pantheon.nix index 01fe230b8a43..cf2c578450f7 100644 --- a/nixos/modules/services/x11/desktop-managers/pantheon.nix +++ b/nixos/modules/services/x11/desktop-managers/pantheon.nix @@ -180,6 +180,7 @@ in gtk3.out hicolor-icon-theme lightlocker + nixos-artwork.wallpapers.simple-dark-gray onboard qgnomeplatform shared-mime-info