summary refs log tree commit diff
path: root/pkgs/build-support/make-startupitem/default.nix
diff options
context:
space:
mode:
authorArie Middelkoop <amiddelk@gmail.com>2012-02-01 22:06:49 +0000
committerArie Middelkoop <amiddelk@gmail.com>2012-02-01 22:06:49 +0000
commitacda2c1967274b710d922d783ed7ab0d14acaffd (patch)
treea44e62495b5cc553d012521082e7c766fa5be20b /pkgs/build-support/make-startupitem/default.nix
parent4b45a0bfc395451bcaafebeae2eeba1d5a2235a3 (diff)
downloadnixpkgs-acda2c1967274b710d922d783ed7ab0d14acaffd.tar
nixpkgs-acda2c1967274b710d922d783ed7ab0d14acaffd.tar.gz
nixpkgs-acda2c1967274b710d922d783ed7ab0d14acaffd.tar.bz2
nixpkgs-acda2c1967274b710d922d783ed7ab0d14acaffd.tar.lz
nixpkgs-acda2c1967274b710d922d783ed7ab0d14acaffd.tar.xz
nixpkgs-acda2c1967274b710d922d783ed7ab0d14acaffd.tar.zst
nixpkgs-acda2c1967274b710d922d783ed7ab0d14acaffd.zip
Makes a .desktop startup item from a .desktop menu entry.
svn path=/nixpkgs/trunk/; revision=31958
Diffstat (limited to 'pkgs/build-support/make-startupitem/default.nix')
-rw-r--r--pkgs/build-support/make-startupitem/default.nix34
1 files changed, 34 insertions, 0 deletions
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