{"action":"created","issue":{"url":"https://api.github.com/repos/rycee/home-manager/issues/299","repository_url":"https://api.github.com/repos/rycee/home-manager","labels_url":"https://api.github.com/repos/rycee/home-manager/issues/299/labels{/name}","comments_url":"https://api.github.com/repos/rycee/home-manager/issues/299/comments","events_url":"https://api.github.com/repos/rycee/home-manager/issues/299/events","html_url":"https://github.com/rycee/home-manager/issues/299","id":337254208,"node_id":"MDU6SXNzdWUzMzcyNTQyMDg=","number":299,"title":"Feature Request: Emacs service","user":{"login":"Targuinius","id":9700425,"node_id":"MDQ6VXNlcjk3MDA0MjU=","avatar_url":"https://avatars3.githubusercontent.com/u/9700425?v=4","gravatar_id":"","url":"https://api.github.com/users/Targuinius","html_url":"https://github.com/Targuinius","followers_url":"https://api.github.com/users/Targuinius/followers","following_url":"https://api.github.com/users/Targuinius/following{/other_user}","gists_url":"https://api.github.com/users/Targuinius/gists{/gist_id}","starred_url":"https://api.github.com/users/Targuinius/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Targuinius/subscriptions","organizations_url":"https://api.github.com/users/Targuinius/orgs","repos_url":"https://api.github.com/users/Targuinius/repos","events_url":"https://api.github.com/users/Targuinius/events{/privacy}","received_events_url":"https://api.github.com/users/Targuinius/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-07-01T01:02:24Z","updated_at":"2018-07-05T19:53:44Z","closed_at":null,"author_association":"NONE","body":"Currenly there doesn't seem to be a service to start an Emacs daemon with the packages configured in programs.emacs.extraPackages. I have tried to write my own service, but failed miserably, as I am not very good with Nix.\r\n\r\nThere is also a unit file in the system-wide configuration, but I don't think that can use the home-manager instance of Emacs."},"comment":{"url":"https://api.github.com/repos/rycee/home-manager/issues/comments/402834403","html_url":"https://github.com/rycee/home-manager/issues/299#issuecomment-402834403","issue_url":"https://api.github.com/repos/rycee/home-manager/issues/299","id":402834403,"node_id":"MDEyOklzc3VlQ29tbWVudDQwMjgzNDQwMw==","user":{"login":"rycee","id":798147,"node_id":"MDQ6VXNlcjc5ODE0Nw==","avatar_url":"https://avatars2.githubusercontent.com/u/798147?v=4","gravatar_id":"","url":"https://api.github.com/users/rycee","html_url":"https://github.com/rycee","followers_url":"https://api.github.com/users/rycee/followers","following_url":"https://api.github.com/users/rycee/following{/other_user}","gists_url":"https://api.github.com/users/rycee/gists{/gist_id}","starred_url":"https://api.github.com/users/rycee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rycee/subscriptions","organizations_url":"https://api.github.com/users/rycee/orgs","repos_url":"https://api.github.com/users/rycee/repos","events_url":"https://api.github.com/users/rycee/events{/privacy}","received_events_url":"https://api.github.com/users/rycee/received_events","type":"User","site_admin":false},"created_at":"2018-07-05T19:53:44Z","updated_at":"2018-07-05T19:53:44Z","author_association":"OWNER","body":"Hi. Yeah, you are right on both accounts, there is no Emacs daemon module for HM yet and the NixOS module cannot be used (easily) with the Emacs package produced by HM. I think making a simple systemd service for Emacs shouldn't be terribly tricky. I found a [service file](https://www.emacswiki.org/emacs/EmacsAsDaemon#toc2) on the EmacsWiki and maybe a semi-straight translation like\r\n\r\n```nix\r\n\r\n{\r\n  systemd.user.services.emacs-daemon = {\r\n    Unit = {\r\n      Description = \"Emacs text editor\";\r\n      Documentation = \"info:emacs man:emacs(1) https://gnu.org/software/emacs/\";\r\n    };\r\n\r\n    Service = {\r\n      Type = \"simple\";\r\n      ExecStart = \"${pkgs.stdenv.shell} -l -c 'exec %h/.nix-profile/bin/emacs --fg-daemon'\";\r\n      ExecStop = \"%h/.nix-profile/bin/emacsclient --eval '(kill-emacs)'\";\r\n      Restart = \"on-failure\";\r\n    };\r\n\r\n    Install = {\r\n      WantedBy = \"default.target\";\r\n    };\r\n  };\r\n}\r\n```\r\n\r\nmight work (note this is completely untested). The only difference from the service from EmacsWiki (beside the paths to the emacs binaries) is that I replaced the `Environment` field by instead running the emacs daemon in a Bash login shell (which should set up your session variables correctly).\r\n\r\nSo try putting this in your `home.nix` and see how it goes. Like I said it's completely untested so you might have to tweak it a bit.\r\n\r\nEventually I hope we'll have a bundled `services.emacs` module but hopefully you can live with something like this until then. If you clean it up and make a full module of it feel free to open a PR! 🙂"}}
{"actor":{"display_login":"rycee"}}