Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at netboot-syslinux-multiplatform 35 lines 1.1 kB view raw
1# given a pakcage with a $name.desktop file, makes a copy 2# as autostart item. 3 4{stdenv, lib}: 5{ name # name of the desktop file (without .desktop) 6, package # package where the desktop file resides in 7, srcPrefix ? "" # additional prefix that the desktop file may have in the 'package' 8, after ? null 9, condition ? null 10, phase ? "2" 11}: 12 13# the builder requires that 14# $package/share/applications/$name.desktop 15# exists as file. 16 17stdenv.mkDerivation { 18 name = "autostart-${name}"; 19 priority = 5; 20 21 buildCommand = '' 22 mkdir -p $out/etc/xdg/autostart 23 target=${name}.desktop 24 cp ${package}/share/applications/${srcPrefix}${name}.desktop $target 25 chmod +rw $target 26 echo "X-KDE-autostart-phase=${phase}" >> $target 27 ${lib.optionalString (after != null) ''echo "${after}" >> $target''} 28 ${lib.optionalString (condition != null) ''echo "${condition}" >> $target''} 29 cp $target $out/etc/xdg/autostart 30 ''; 31 32 # this will automatically put 'package' in the environment when you 33 # put its startup item in there. 34 propagatedBuildInputs = [ package ]; 35}