systemd: Reident the expression file

The indenting is a bit weird to follow, especially at the end of the
file (right brace without indent, but the opening brace is indented by
two spaces).

No functional change and I've verified this by building it with this
change and without and both lead to the same store paths.

Signed-off-by: aszlig <aszlig@nix.build>
Cc: @fpletz, @edolstra

aszlig ae7efee4 618ac296

+173 -177
+173 -177
pkgs/os-specific/linux/systemd/default.nix
··· 16 16 let 17 17 pythonLxmlEnv = python3Packages.python.withPackages ( ps: with ps; [ python3Packages.lxml ]); 18 18 19 - in 19 + in stdenv.mkDerivation rec { 20 + version = "237"; 21 + name = "systemd-${version}"; 20 22 21 - stdenv.mkDerivation rec { 22 - version = "237"; 23 - name = "systemd-${version}"; 23 + src = fetchFromGitHub { 24 + owner = "NixOS"; 25 + repo = "systemd"; 26 + rev = "1e8830dfa77a7dc6976509f4a6edb7e012c50792"; 27 + sha256 = "1cw1k0i68azmzpqzi3r8jm6mbi2wqlql78fhcg0vvnv1ly8bf7vq"; 28 + }; 24 29 25 - src = fetchFromGitHub { 26 - owner = "NixOS"; 27 - repo = "systemd"; 28 - rev = "1e8830dfa77a7dc6976509f4a6edb7e012c50792"; 29 - sha256 = "1cw1k0i68azmzpqzi3r8jm6mbi2wqlql78fhcg0vvnv1ly8bf7vq"; 30 - }; 30 + outputs = [ "out" "lib" "man" "dev" ]; 31 31 32 - outputs = [ "out" "lib" "man" "dev" ]; 32 + nativeBuildInputs = 33 + [ pkgconfig intltool gperf libxslt gettext docbook_xsl docbook_xml_dtd_42 docbook_xml_dtd_45 34 + ninja meson 35 + coreutils # meson calls date, stat etc. 36 + pythonLxmlEnv glibcLocales 37 + patchelf getent 38 + ]; 39 + buildInputs = 40 + [ linuxHeaders libcap kmod xz pam acl 41 + /* cryptsetup */ libuuid m4 glib libgcrypt libgpgerror libidn2 42 + libmicrohttpd kexectools libseccomp libffi audit lz4 bzip2 libapparmor 43 + iptables gnu-efi 44 + ]; 33 45 34 - nativeBuildInputs = 35 - [ pkgconfig intltool gperf libxslt gettext docbook_xsl docbook_xml_dtd_42 docbook_xml_dtd_45 36 - ninja meson 37 - coreutils # meson calls date, stat etc. 38 - pythonLxmlEnv glibcLocales 39 - patchelf getent 40 - ]; 41 - buildInputs = 42 - [ linuxHeaders libcap kmod xz pam acl 43 - /* cryptsetup */ libuuid m4 glib libgcrypt libgpgerror libidn2 44 - libmicrohttpd kexectools libseccomp libffi audit lz4 bzip2 libapparmor 45 - iptables gnu-efi 46 - ]; 46 + #dontAddPrefix = true; 47 47 48 - #dontAddPrefix = true; 48 + mesonFlags = [ 49 + "-Dloadkeys-path=${kbd}/bin/loadkeys" 50 + "-Dsetfont-path=${kbd}/bin/setfont" 51 + "-Dtty-gid=3" # tty in NixOS has gid 3 52 + # "-Dtests=" # TODO 53 + "-Dlz4=true" 54 + "-Dhostnamed=true" 55 + "-Dnetworkd=true" 56 + "-Dsysusers=false" 57 + "-Dtimedated=true" 58 + "-Dtimesyncd=true" 59 + "-Dfirstboot=false" 60 + "-Dlocaled=true" 61 + "-Dresolve=true" 62 + "-Dsplit-usr=false" 63 + "-Dlibcurl=false" 64 + "-Dlibidn=false" 65 + "-Dlibidn2=true" 66 + "-Dquotacheck=false" 67 + "-Dldconfig=false" 68 + "-Dsmack=true" 69 + "-Dsystem-uid-max=499" #TODO: debug why awking around in /etc/login.defs doesn't work 70 + "-Dsystem-gid-max=499" 71 + # "-Dtime-epoch=1" 49 72 50 - mesonFlags = [ 51 - "-Dloadkeys-path=${kbd}/bin/loadkeys" 52 - "-Dsetfont-path=${kbd}/bin/setfont" 53 - "-Dtty-gid=3" # tty in NixOS has gid 3 54 - # "-Dtests=" # TODO 55 - "-Dlz4=true" 56 - "-Dhostnamed=true" 57 - "-Dnetworkd=true" 58 - "-Dsysusers=false" 59 - "-Dtimedated=true" 60 - "-Dtimesyncd=true" 61 - "-Dfirstboot=false" 62 - "-Dlocaled=true" 63 - "-Dresolve=true" 64 - "-Dsplit-usr=false" 65 - "-Dlibcurl=false" 66 - "-Dlibidn=false" 67 - "-Dlibidn2=true" 68 - "-Dquotacheck=false" 69 - "-Dldconfig=false" 70 - "-Dsmack=true" 71 - "-Dsystem-uid-max=499" #TODO: debug why awking around in /etc/login.defs doesn't work 72 - "-Dsystem-gid-max=499" 73 - # "-Dtime-epoch=1" 73 + (if stdenv.isArm || !hostPlatform.isEfi then "-Dgnu-efi=false" else "-Dgnu-efi=true") 74 + "-Defi-libdir=${toString gnu-efi}/lib" 75 + "-Defi-includedir=${toString gnu-efi}/include/efi" 76 + "-Defi-ldsdir=${toString gnu-efi}/lib" 74 77 75 - (if stdenv.isArm || !hostPlatform.isEfi then "-Dgnu-efi=false" else "-Dgnu-efi=true") 76 - "-Defi-libdir=${toString gnu-efi}/lib" 77 - "-Defi-includedir=${toString gnu-efi}/include/efi" 78 - "-Defi-ldsdir=${toString gnu-efi}/lib" 78 + "-Dsysvinit-path=" 79 + "-Dsysvrcnd-path=" 80 + ]; 79 81 80 - "-Dsysvinit-path=" 81 - "-Dsysvrcnd-path=" 82 - ]; 82 + preConfigure = '' 83 + mesonFlagsArray+=(-Dntp-servers="0.nixos.pool.ntp.org 1.nixos.pool.ntp.org 2.nixos.pool.ntp.org 3.nixos.pool.ntp.org") 84 + mesonFlagsArray+=(-Ddbuspolicydir=$out/etc/dbus-1/system.d) 85 + mesonFlagsArray+=(-Ddbussessionservicedir=$out/share/dbus-1/services) 86 + mesonFlagsArray+=(-Ddbussystemservicedir=$out/share/dbus-1/system-services) 87 + mesonFlagsArray+=(-Dpamconfdir=$out/etc/pam.d) 88 + mesonFlagsArray+=(-Dsysconfdir=$out/etc) 89 + mesonFlagsArray+=(-Drootprefix=$out) 90 + mesonFlagsArray+=(-Dlibdir=$lib/lib) 91 + mesonFlagsArray+=(-Drootlibdir=$lib/lib) 92 + mesonFlagsArray+=(-Dmandir=$man/lib) 93 + mesonFlagsArray+=(-Dincludedir=$dev/include) 94 + mesonFlagsArray+=(-Dpkgconfiglibdir=$dev/lib/pkgconfig) 95 + mesonFlagsArray+=(-Dpkgconfigdatadir=$dev/share/pkgconfig) 83 96 84 - preConfigure = 85 - '' 86 - mesonFlagsArray+=(-Dntp-servers="0.nixos.pool.ntp.org 1.nixos.pool.ntp.org 2.nixos.pool.ntp.org 3.nixos.pool.ntp.org") 87 - mesonFlagsArray+=(-Ddbuspolicydir=$out/etc/dbus-1/system.d) 88 - mesonFlagsArray+=(-Ddbussessionservicedir=$out/share/dbus-1/services) 89 - mesonFlagsArray+=(-Ddbussystemservicedir=$out/share/dbus-1/system-services) 90 - mesonFlagsArray+=(-Dpamconfdir=$out/etc/pam.d) 91 - mesonFlagsArray+=(-Dsysconfdir=$out/etc) 92 - mesonFlagsArray+=(-Drootprefix=$out) 93 - mesonFlagsArray+=(-Dlibdir=$lib/lib) 94 - mesonFlagsArray+=(-Drootlibdir=$lib/lib) 95 - mesonFlagsArray+=(-Dmandir=$man/lib) 96 - mesonFlagsArray+=(-Dincludedir=$dev/include) 97 - mesonFlagsArray+=(-Dpkgconfiglibdir=$dev/lib/pkgconfig) 98 - mesonFlagsArray+=(-Dpkgconfigdatadir=$dev/share/pkgconfig) 97 + # FIXME: Why aren't includedir and libdir picked up from mesonFlags while other options are? 98 + substituteInPlace meson.build \ 99 + --replace "includedir = join_paths(prefixdir, get_option('includedir'))" \ 100 + "includedir = '$dev/include'" \ 101 + --replace "libdir = join_paths(prefixdir, get_option('libdir'))" \ 102 + "libdir = '$lib/lib'" 99 103 100 - # FIXME: Why aren't includedir and libdir picked up from mesonFlags while other options are? 101 - substituteInPlace meson.build \ 102 - --replace "includedir = join_paths(prefixdir, get_option('includedir'))" \ 103 - "includedir = '$dev/include'" \ 104 - --replace "libdir = join_paths(prefixdir, get_option('libdir'))" \ 105 - "libdir = '$lib/lib'" 106 - 107 - export LC_ALL="en_US.UTF-8"; 108 - # FIXME: patch this in systemd properly (and send upstream). 109 - # already fixed in f00929ad622c978f8ad83590a15a765b4beecac9: (u)mount 110 - for i in src/remount-fs/remount-fs.c src/core/mount.c src/core/swap.c src/fsck/fsck.c units/emergency.service.in units/rescue.service.in src/journal/cat.c src/core/shutdown.c src/nspawn/nspawn.c src/shared/generator.c; do 111 - test -e $i 112 - substituteInPlace $i \ 113 - --replace /usr/bin/getent ${getent}/bin/getent \ 114 - --replace /sbin/swapon ${utillinux.bin}/sbin/swapon \ 115 - --replace /sbin/swapoff ${utillinux.bin}/sbin/swapoff \ 116 - --replace /sbin/fsck ${utillinux.bin}/sbin/fsck \ 117 - --replace /bin/echo ${coreutils}/bin/echo \ 118 - --replace /bin/cat ${coreutils}/bin/cat \ 119 - --replace /sbin/sulogin ${utillinux.bin}/sbin/sulogin \ 120 - --replace /usr/lib/systemd/systemd-fsck $out/lib/systemd/systemd-fsck \ 121 - --replace /bin/plymouth /run/current-system/sw/bin/plymouth # To avoid dependency 122 - done 104 + export LC_ALL="en_US.UTF-8"; 105 + # FIXME: patch this in systemd properly (and send upstream). 106 + # already fixed in f00929ad622c978f8ad83590a15a765b4beecac9: (u)mount 107 + for i in src/remount-fs/remount-fs.c src/core/mount.c src/core/swap.c src/fsck/fsck.c units/emergency.service.in units/rescue.service.in src/journal/cat.c src/core/shutdown.c src/nspawn/nspawn.c src/shared/generator.c; do 108 + test -e $i 109 + substituteInPlace $i \ 110 + --replace /usr/bin/getent ${getent}/bin/getent \ 111 + --replace /sbin/swapon ${utillinux.bin}/sbin/swapon \ 112 + --replace /sbin/swapoff ${utillinux.bin}/sbin/swapoff \ 113 + --replace /sbin/fsck ${utillinux.bin}/sbin/fsck \ 114 + --replace /bin/echo ${coreutils}/bin/echo \ 115 + --replace /bin/cat ${coreutils}/bin/cat \ 116 + --replace /sbin/sulogin ${utillinux.bin}/sbin/sulogin \ 117 + --replace /usr/lib/systemd/systemd-fsck $out/lib/systemd/systemd-fsck \ 118 + --replace /bin/plymouth /run/current-system/sw/bin/plymouth # To avoid dependency 119 + done 123 120 124 - for i in tools/xml_helper.py tools/make-directive-index.py tools/make-man-index.py test/sys-script.py; do 125 - substituteInPlace $i \ 126 - --replace "#!/usr/bin/env python" "#!${pythonLxmlEnv}/bin/python" 127 - done 121 + for i in tools/xml_helper.py tools/make-directive-index.py tools/make-man-index.py test/sys-script.py; do 122 + substituteInPlace $i \ 123 + --replace "#!/usr/bin/env python" "#!${pythonLxmlEnv}/bin/python" 124 + done 128 125 129 - for i in src/basic/generate-gperfs.py src/resolve/generate-dns_type-gperf.py src/test/generate-sym-test.py ; do 130 - substituteInPlace $i \ 131 - --replace "#!/usr/bin/env python" "#!${python3Packages.python}/bin/python" 132 - done 126 + for i in src/basic/generate-gperfs.py src/resolve/generate-dns_type-gperf.py src/test/generate-sym-test.py ; do 127 + substituteInPlace $i \ 128 + --replace "#!/usr/bin/env python" "#!${python3Packages.python}/bin/python" 129 + done 133 130 134 - substituteInPlace src/journal/catalog.c \ 135 - --replace /usr/lib/systemd/catalog/ $out/lib/systemd/catalog/ 136 - ''; 131 + substituteInPlace src/journal/catalog.c \ 132 + --replace /usr/lib/systemd/catalog/ $out/lib/systemd/catalog/ 133 + ''; 137 134 138 - # These defines are overridden by CFLAGS and would trigger annoying 139 - # warning messages 140 - postConfigure = '' 141 - substituteInPlace config.h \ 142 - --replace "POLKIT_AGENT_BINARY_PATH" "_POLKIT_AGENT_BINARY_PATH" \ 143 - --replace "SYSTEMD_BINARY_PATH" "_SYSTEMD_BINARY_PATH" \ 144 - --replace "SYSTEMD_CGROUP_AGENT_PATH" "_SYSTEMD_CGROUP_AGENT_PATH" 145 - ''; 135 + # These defines are overridden by CFLAGS and would trigger annoying 136 + # warning messages 137 + postConfigure = '' 138 + substituteInPlace config.h \ 139 + --replace "POLKIT_AGENT_BINARY_PATH" "_POLKIT_AGENT_BINARY_PATH" \ 140 + --replace "SYSTEMD_BINARY_PATH" "_SYSTEMD_BINARY_PATH" \ 141 + --replace "SYSTEMD_CGROUP_AGENT_PATH" "_SYSTEMD_CGROUP_AGENT_PATH" 142 + ''; 146 143 147 - hardeningDisable = [ "stackprotector" ]; 144 + hardeningDisable = [ "stackprotector" ]; 148 145 149 - NIX_CFLAGS_COMPILE = 150 - [ # Can't say ${polkit.bin}/bin/pkttyagent here because that would 151 - # lead to a cyclic dependency. 152 - "-UPOLKIT_AGENT_BINARY_PATH" "-DPOLKIT_AGENT_BINARY_PATH=\"/run/current-system/sw/bin/pkttyagent\"" 146 + NIX_CFLAGS_COMPILE = 147 + [ # Can't say ${polkit.bin}/bin/pkttyagent here because that would 148 + # lead to a cyclic dependency. 149 + "-UPOLKIT_AGENT_BINARY_PATH" "-DPOLKIT_AGENT_BINARY_PATH=\"/run/current-system/sw/bin/pkttyagent\"" 153 150 154 - # Set the release_agent on /sys/fs/cgroup/systemd to the 155 - # currently running systemd (/run/current-system/systemd) so 156 - # that we don't use an obsolete/garbage-collected release agent. 157 - "-USYSTEMD_CGROUP_AGENT_PATH" "-DSYSTEMD_CGROUP_AGENT_PATH=\"/run/current-system/systemd/lib/systemd/systemd-cgroups-agent\"" 151 + # Set the release_agent on /sys/fs/cgroup/systemd to the 152 + # currently running systemd (/run/current-system/systemd) so 153 + # that we don't use an obsolete/garbage-collected release agent. 154 + "-USYSTEMD_CGROUP_AGENT_PATH" "-DSYSTEMD_CGROUP_AGENT_PATH=\"/run/current-system/systemd/lib/systemd/systemd-cgroups-agent\"" 158 155 159 - "-USYSTEMD_BINARY_PATH" "-DSYSTEMD_BINARY_PATH=\"/run/current-system/systemd/lib/systemd/systemd\"" 160 - ]; 156 + "-USYSTEMD_BINARY_PATH" "-DSYSTEMD_BINARY_PATH=\"/run/current-system/systemd/lib/systemd/systemd\"" 157 + ]; 161 158 162 - postInstall = 163 - '' 164 - # sysinit.target: Don't depend on 165 - # systemd-tmpfiles-setup.service. This interferes with NixOps's 166 - # send-keys feature (since sshd.service depends indirectly on 167 - # sysinit.target). 168 - mv $out/lib/systemd/system/sysinit.target.wants/systemd-tmpfiles-setup-dev.service $out/lib/systemd/system/multi-user.target.wants/ 159 + postInstall = '' 160 + # sysinit.target: Don't depend on 161 + # systemd-tmpfiles-setup.service. This interferes with NixOps's 162 + # send-keys feature (since sshd.service depends indirectly on 163 + # sysinit.target). 164 + mv $out/lib/systemd/system/sysinit.target.wants/systemd-tmpfiles-setup-dev.service $out/lib/systemd/system/multi-user.target.wants/ 169 165 170 - mkdir -p $out/example/systemd 171 - mv $out/lib/{modules-load.d,binfmt.d,sysctl.d,tmpfiles.d} $out/example 172 - mv $out/lib/systemd/{system,user} $out/example/systemd 166 + mkdir -p $out/example/systemd 167 + mv $out/lib/{modules-load.d,binfmt.d,sysctl.d,tmpfiles.d} $out/example 168 + mv $out/lib/systemd/{system,user} $out/example/systemd 173 169 174 - rm -rf $out/etc/systemd/system 170 + rm -rf $out/etc/systemd/system 175 171 176 - # Install SysV compatibility commands. 177 - mkdir -p $out/sbin 178 - ln -s $out/lib/systemd/systemd $out/sbin/telinit 179 - for i in init halt poweroff runlevel reboot shutdown; do 180 - ln -s $out/bin/systemctl $out/sbin/$i 181 - done 172 + # Install SysV compatibility commands. 173 + mkdir -p $out/sbin 174 + ln -s $out/lib/systemd/systemd $out/sbin/telinit 175 + for i in init halt poweroff runlevel reboot shutdown; do 176 + ln -s $out/bin/systemctl $out/sbin/$i 177 + done 182 178 183 - # Fix reference to /bin/false in the D-Bus services. 184 - for i in $out/share/dbus-1/system-services/*.service; do 185 - substituteInPlace $i --replace /bin/false ${coreutils}/bin/false 186 - done 179 + # Fix reference to /bin/false in the D-Bus services. 180 + for i in $out/share/dbus-1/system-services/*.service; do 181 + substituteInPlace $i --replace /bin/false ${coreutils}/bin/false 182 + done 187 183 188 - rm -rf $out/etc/rpm 184 + rm -rf $out/etc/rpm 189 185 190 - # "kernel-install" shouldn't be used on NixOS. 191 - find $out -name "*kernel-install*" -exec rm {} \; 186 + # "kernel-install" shouldn't be used on NixOS. 187 + find $out -name "*kernel-install*" -exec rm {} \; 192 188 193 - # Keep only libudev and libsystemd in the lib output. 194 - mkdir -p $out/lib 195 - mv $lib/lib/security $lib/lib/libnss* $out/lib/ 196 - ''; # */ 189 + # Keep only libudev and libsystemd in the lib output. 190 + mkdir -p $out/lib 191 + mv $lib/lib/security $lib/lib/libnss* $out/lib/ 192 + ''; # */ 197 193 198 - enableParallelBuilding = true; 194 + enableParallelBuilding = true; 199 195 200 - # The rpath to the shared systemd library is not added by meson. The 201 - # functionality was removed by a nixpkgs patch because it would overwrite 202 - # the existing rpath. 203 - postFixup = '' 204 - sharedLib=libsystemd-shared-${version}.so 205 - for prog in `find $out -type f -executable`; do 206 - (patchelf --print-needed $prog | grep $sharedLib > /dev/null) && ( 207 - patchelf --set-rpath `patchelf --print-rpath $prog`:"$out/lib/systemd" $prog 208 - ) || true 209 - done 210 - ''; 196 + # The rpath to the shared systemd library is not added by meson. The 197 + # functionality was removed by a nixpkgs patch because it would overwrite 198 + # the existing rpath. 199 + postFixup = '' 200 + sharedLib=libsystemd-shared-${version}.so 201 + for prog in `find $out -type f -executable`; do 202 + (patchelf --print-needed $prog | grep $sharedLib > /dev/null) && ( 203 + patchelf --set-rpath `patchelf --print-rpath $prog`:"$out/lib/systemd" $prog 204 + ) || true 205 + done 206 + ''; 211 207 212 - # The interface version prevents NixOS from switching to an 213 - # incompatible systemd at runtime. (Switching across reboots is 214 - # fine, of course.) It should be increased whenever systemd changes 215 - # in a backwards-incompatible way. If the interface version of two 216 - # systemd builds is the same, then we can switch between them at 217 - # runtime; otherwise we can't and we need to reboot. 218 - passthru.interfaceVersion = 2; 208 + # The interface version prevents NixOS from switching to an 209 + # incompatible systemd at runtime. (Switching across reboots is 210 + # fine, of course.) It should be increased whenever systemd changes 211 + # in a backwards-incompatible way. If the interface version of two 212 + # systemd builds is the same, then we can switch between them at 213 + # runtime; otherwise we can't and we need to reboot. 214 + passthru.interfaceVersion = 2; 219 215 220 - meta = { 221 - homepage = http://www.freedesktop.org/wiki/Software/systemd; 222 - description = "A system and service manager for Linux"; 223 - platforms = stdenv.lib.platforms.linux; 224 - maintainers = [ stdenv.lib.maintainers.eelco ]; 225 - }; 216 + meta = { 217 + homepage = http://www.freedesktop.org/wiki/Software/systemd; 218 + description = "A system and service manager for Linux"; 219 + platforms = stdenv.lib.platforms.linux; 220 + maintainers = [ stdenv.lib.maintainers.eelco ]; 221 + }; 226 222 }