Skip to content

Instantly share code, notes, and snippets.

@Mic92
Created August 28, 2016 17:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Mic92/b7fe5e0ad4d3b834c192bd6ecd763b99 to your computer and use it in GitHub Desktop.
Save Mic92/b7fe5e0ad4d3b834c192bd6ecd763b99 to your computer and use it in GitHub Desktop.
let
userservice = args: {
name = args.name;
value = {
wantedBy = [ "default.target" ];
enable = true;
serviceConfig = {
RestartSec="500ms";
Restart="always";
ExecStart="/run/current-system/sw/bin/sh -c '" +
"export GTK_DATA_PREFIX=/run/current-system/sw;" +
"export PATH=$PATH:/var/setuid-wrappers:%h/.nix-profile/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin:/run/current-system/sw/sbin;
" +
"exec ${args.command}'";
};
};
};
in {
systemd.user.services = (builtins.listToAttrs (map userservice [
{ name = "chromium"; command = "${pkgs.chromium}/bin/chromium"; }
{ name = "claws-mail"; command = "${pkgs.claws-mail}/bin/claws-mail"; }
{ name = "gajim"; command = "${pkgs.gajim}/bin/gajim"; }
{ name = "gpg-agent"; command = "${pkgs.gnupg1compat}/bin/gpg-agent"; }
{ name = "copyq"; command = "${pkgs.copyq}/bin/copyq"; }
{ name = "xautolock"; command = "${pkgs.xautolock}/bin/xautolock -time 20 -locker %h/bin/i3lock.sh"; }
{ name = "mpd"; command = "${pkgs.mpd}/bin/mpd"; }
]));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment