-
-
Couldn't load subscription status.
- Fork 93
Add option to enable the service for all users #83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
a04361c
b5a62ed
af14d64
725f14e
97a3960
c7d960e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,55 @@ | ||
| import ./module.nix ({ | ||
| name, | ||
| description, | ||
| serviceConfig, | ||
| }: { | ||
| systemd.user.services.${name} = { | ||
| inherit description serviceConfig; | ||
| wantedBy = [ "default.target" ]; | ||
| }; | ||
| }) | ||
| import ./module.nix ( | ||
| { name | ||
| , description | ||
| , serviceConfig | ||
| , lib | ||
| , config | ||
| , cfg | ||
| }: lib.mkMerge [ | ||
| { | ||
| systemd.user.services.${name} = { | ||
| inherit description serviceConfig; | ||
| wantedBy = [ "default.target" ]; | ||
| }; | ||
| } | ||
| (lib.mkIf cfg.enableForUsers.enable { | ||
| systemd.tmpfiles.settings = | ||
| let | ||
| forEachUser = ({ path, file }: builtins.listToAttrs | ||
| (builtins.map | ||
| (username: let user = config.users.users.${username}; in { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm still unable to get this to work as expected both There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you please expand on how it "doesn't work as expected"? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I have giving "fsnkty" breaks in the same way, the string "main" can be used but that's non ideal and doesn't behave similarly to any other option that Ive encountered which expects a list of users. this workaround in using the user attribute name as a string instead of its given name is non ideal because now changing that value is separate from changing it anywhere else a user is specified or named |
||
| name = "${user.home}/${path}"; | ||
| value = file user.name; | ||
| }) | ||
| cfg.enableForUsers.users)); | ||
| homeDirectory = (path: forEachUser { | ||
| inherit path; | ||
| file = (username: { | ||
| "d" = { | ||
| user = username; | ||
| group = "users"; | ||
| mode = "0755"; | ||
| }; | ||
| }); | ||
| }); | ||
| in | ||
| { | ||
| # We need to create each of the folders before the next file otherwise parents get owned by root | ||
| "80-vscode-server-enable-for-users-create-config-folder" = homeDirectory ".config"; | ||
| "81-vscode-server-enable-for-users-create-systemd-folder" = homeDirectory ".config/systemd"; | ||
| "82-vscode-server-enable-for-users-create-systemd-user-folder" = homeDirectory ".config/systemd/user"; | ||
| "83-vscode-server-enable-for-users-enable-auto-fix-vscode-server-service" = forEachUser { | ||
| path = ".config/systemd/user/auto-fix-vscode-server.service"; | ||
| file = (username: { | ||
| "L+" = { | ||
| user = username; | ||
| group = "users"; | ||
| # This path is made available by `services.vscode-server.enable = true;` | ||
| argument = "/run/current-system/etc/systemd/user/auto-fix-vscode-server.service"; | ||
| }; | ||
| }); | ||
| }; | ||
| }; | ||
| }) | ||
| ] | ||
| ) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,17 +1,26 @@ | ||
| import ./module.nix ({ | ||
| name, | ||
| description, | ||
| serviceConfig, | ||
| }: { | ||
| systemd.user.services.${name} = { | ||
| Unit = { | ||
| Description = description; | ||
| }; | ||
| import ./module.nix ( | ||
| { name | ||
| , description | ||
| , serviceConfig | ||
| , cfg | ||
| , ... | ||
| }: | ||
| { | ||
| systemd.user.services.${name} = { | ||
| Unit = { | ||
| Description = description; | ||
| }; | ||
|
|
||
| Service = serviceConfig; | ||
| Service = serviceConfig; | ||
|
|
||
| Install = { | ||
| WantedBy = [ "default.target" ]; | ||
| Install = { | ||
| WantedBy = [ "default.target" ]; | ||
| }; | ||
| }; | ||
| }; | ||
| }) | ||
|
|
||
| assertions = [{ | ||
| assertion = !cfg.enableForUsers.enable; | ||
| message = "enableForUsers.enable=true doesn't make sense when using nixos-vscode-server as a home-manager module"; | ||
| }]; | ||
| } | ||
| ) |
Uh oh!
There was an error while loading. Please reload this page.