diff options
author | Jan Tojnar <jtojnar@gmail.com> | 2023-12-25 17:06:05 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-25 17:06:05 +0100 |
commit | 4c10797e5b7b729169af78b8d03cc99913b6aba6 (patch) | |
tree | a214fb512ca023f8f9bc914b663790a531079adc /pkgs | |
parent | 12501c64d619bee24b4f24dc65bf9789c5c801f8 (diff) | |
parent | 8ef5fcf4f5aa1a862a6787ea765e5bec8c5eb648 (diff) |
Merge pull request #268535 from jtojnar/destdir-hack-cleanups
gnome.gdm, upower: Simplify DESTDIR hack
Diffstat (limited to 'pkgs')
-rw-r--r-- | pkgs/desktops/gnome/core/gdm/default.nix | 35 | ||||
-rw-r--r-- | pkgs/os-specific/linux/upower/default.nix | 32 |
2 files changed, 36 insertions, 31 deletions
diff --git a/pkgs/desktops/gnome/core/gdm/default.nix b/pkgs/desktops/gnome/core/gdm/default.nix index f44278f896c3c..25f9fe8c63401 100644 --- a/pkgs/desktops/gnome/core/gdm/default.nix +++ b/pkgs/desktops/gnome/core/gdm/default.nix @@ -5,7 +5,6 @@ , substituteAll , meson , ninja -, rsync , pkg-config , glib , itstool @@ -70,7 +69,6 @@ stdenv.mkDerivation (finalAttrs: { meson ninja pkg-config - rsync gobject-introspection ]; @@ -131,33 +129,36 @@ stdenv.mkDerivation (finalAttrs: { ''; preInstall = '' - install -D ${override} $DESTDIR/$out/share/glib-2.0/schemas/org.gnome.login-screen.gschema.override + install -D ${override} "$DESTDIR/$out/share/glib-2.0/schemas/org.gnome.login-screen.gschema.override" ''; postInstall = '' # Move stuff from DESTDIR to proper location. - # We use rsync to merge the directories. - rsync --archive "$DESTDIR/etc" "$out" - rm --recursive "$DESTDIR/etc" for o in $(getAllOutputNames); do + # debug is created later by _separateDebugInfo hook. if [[ "$o" = "debug" ]]; then continue; fi - rsync --archive "$DESTDIR/''${!o}" "$(dirname "''${!o}")" - rm --recursive "$DESTDIR/''${!o}" + mv "$DESTDIR''${!o}" "$(dirname "''${!o}")" done - # Ensure the DESTDIR is removed. - rmdir "$DESTDIR/nix/store" "$DESTDIR/nix" "$DESTDIR" + + mv "$DESTDIR/etc" "$out" + + # Ensure we did not forget to install anything. + rmdir --parents --ignore-fail-on-non-empty "$DESTDIR${builtins.storeDir}" + ! test -e "$DESTDIR" # We are setting DESTDIR so the post-install script does not compile the schemas. glib-compile-schemas "$out/share/glib-2.0/schemas" ''; - # HACK: We want to install configuration files to $out/etc - # but GDM should read them from /etc on a NixOS system. - # With autotools, it was possible to override Make variables - # at install time but Meson does not support this - # so we need to convince it to install all files to a temporary - # location using DESTDIR and then move it to proper one in postInstall. - DESTDIR = "${placeholder "out"}/dest"; + env = { + # HACK: We want to install configuration files to $out/etc + # but GDM should read them from /etc on a NixOS system. + # With autotools, it was possible to override Make variables + # at install time but Meson does not support this + # so we need to convince it to install all files to a temporary + # location using DESTDIR and then move it to proper one in postInstall. + DESTDIR = "dest"; + }; separateDebugInfo = true; diff --git a/pkgs/os-specific/linux/upower/default.nix b/pkgs/os-specific/linux/upower/default.nix index 36d8a3b9c45f8..b0b7b4f6776c0 100644 --- a/pkgs/os-specific/linux/upower/default.nix +++ b/pkgs/os-specific/linux/upower/default.nix @@ -3,7 +3,6 @@ , fetchFromGitLab , makeWrapper , pkg-config -, rsync , libxslt , meson , ninja @@ -69,7 +68,6 @@ stdenv.mkDerivation (finalAttrs: { libxslt makeWrapper pkg-config - rsync glib ] ++ lib.optionals withIntrospection [ gobject-introspection @@ -138,7 +136,6 @@ stdenv.mkDerivation (finalAttrs: { # Our gobject-introspection patches make the shared library paths absolute # in the GIR files. When running tests, the library is not yet installed, # though, so we need to replace the absolute path with a local one during build. - # We are using a symlink that will be overwitten during installation. mkdir -p "$out/lib" ln -s "$PWD/libupower-glib/libupower-glib.so" "$out/lib/libupower-glib.so.3" ''; @@ -159,21 +156,28 @@ stdenv.mkDerivation (finalAttrs: { # meson rebuild during install and it is not used at runtime anyway. sed -Ei 's~#!.+/bin/python3~#!/usr/bin/python3~' \ ../src/linux/integration-test.py + + # Undo preCheck installation since DESTDIR hack expects outputs to not exist. + rm "$out/lib/libupower-glib.so.3" + rmdir "$out/lib" "$out" ''; postInstall = '' # Move stuff from DESTDIR to proper location. - # We use rsync to merge the directories. - for dir in etc var; do - rsync --archive "$DESTDIR/$dir" "$out" - rm --recursive "$DESTDIR/$dir" - done - for o in out dev installedTests; do - rsync --archive "$DESTDIR/''${!o}" "$(dirname "''${!o}")" - rm --recursive "$DESTDIR/''${!o}" + for o in $(getAllOutputNames); do + # devdoc is created later by _multioutDocs hook. + if [[ "$o" = "devdoc" ]]; then continue; fi + mv "$DESTDIR''${!o}" "$(dirname "''${!o}")" done - # Ensure the DESTDIR is removed. - rmdir "$DESTDIR/nix/store" "$DESTDIR/nix" "$DESTDIR" + + mv "$DESTDIR/var" "$out" + # The /etc already exist so we need to merge it. + cp --recursive "$DESTDIR/etc" "$out" + rm --recursive "$DESTDIR/etc" + + # Ensure we did not forget to install anything. + rmdir --parents --ignore-fail-on-non-empty "$DESTDIR${builtins.storeDir}" + ! test -e "$DESTDIR" ''; postFixup = '' @@ -194,7 +198,7 @@ stdenv.mkDerivation (finalAttrs: { # at install time but Meson does not support this # so we need to convince it to install all files to a temporary # location using DESTDIR and then move it to proper one in postInstall. - DESTDIR = "${placeholder "out"}/dest"; + DESTDIR = "dest"; }; passthru = { |