From acda2c1967274b710d922d783ed7ab0d14acaffd Mon Sep 17 00:00:00 2001 From: Arie Middelkoop Date: Wed, 1 Feb 2012 22:06:49 +0000 Subject: Makes a .desktop startup item from a .desktop menu entry. svn path=/nixpkgs/trunk/; revision=31958 --- pkgs/build-support/make-startupitem/default.nix | 34 +++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 pkgs/build-support/make-startupitem/default.nix (limited to 'pkgs/build-support/make-startupitem/default.nix') diff --git a/pkgs/build-support/make-startupitem/default.nix b/pkgs/build-support/make-startupitem/default.nix new file mode 100644 index 00000000000..07cdee600d4 --- /dev/null +++ b/pkgs/build-support/make-startupitem/default.nix @@ -0,0 +1,34 @@ +# given a pakcage with a $name.desktop file, makes a copy +# as autostart item. + +{stdenv, lib}: +{ name # name of the desktop file (without .desktop) +, package # package where the desktop file resides in +, after ? null +, condition ? null +, phase ? "2" +}: + +# the builder requires that +# $package/share/applications/$name.desktop +# exists as file. + +stdenv.mkDerivation { + name = "autostart-${name}"; + priority = 5; + + buildCommand = '' + ensureDir $out/share/autostart + target=${name}.desktop + cp ${package}/share/applications/${name}.desktop $target + chmod +rw $target + echo "X-KDE-autostart-phase=${phase}" >> $target + ${lib.optionalString (after != null) ''echo "${after}" >> $target''} + ${lib.optionalString (condition != null) ''echo "${condition}" >> $target''} + cp $target $out/share/autostart + ''; + + # this will automatically put 'package' in the environment when you + # put its startup item in there. + propagatedBuildInputs = [ package ]; +} \ No newline at end of file -- cgit 1.4.1