Author: amiddelk
Date: Wed Feb  1 22:06:49 2012
New Revision: 31958
URL: https://nixos.org/websvn/nix/?rev=31958&sc=1

Log:
Makes a .desktop startup item from a .desktop menu entry.

Added:
   nixpkgs/trunk/pkgs/build-support/make-startupitem/
   nixpkgs/trunk/pkgs/build-support/make-startupitem/default.nix

Added: nixpkgs/trunk/pkgs/build-support/make-startupitem/default.nix
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ nixpkgs/trunk/pkgs/build-support/make-startupitem/default.nix       Wed Feb 
 1 22:06:49 2012        (r31958)
@@ -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
_______________________________________________
nix-commits mailing list
[email protected]
http://lists.science.uu.nl/mailman/listinfo/nix-commits

Reply via email to