Open golddranks opened 1 year ago
Your the second one, so I will have to agree, the README needs updating on that front. Thanks for letting me know! However, in general, you should just check the flake.nix for what it is exporting, then your answer should have been relatively obvious, granted that you have some understanding of Nix (the language) and flakes:
Just replace vscode-server.nixosModules.default
with vscode-server.homeModules.default
or vscode-server.nixosModules.home
.
That does not invalidate that indeed the docs need improving, so I am going to keep the issue open, such that I remember to update the README. And I should probably see if I can make the default for importing modules, not just always be nixos, but maybe I can detect when it is being imported from Home Manager and import the home module(s) instead.
Thanks, seems to work now. Oh, I was close! I'm still a bit new both to flakes and home-manager, so I easily get lost.
Would you be willing to test whether check if the README is sufficiently updated? And test whether your old code would just work as you had it?
The branch that contains the changes is here: https://github.com/nix-community/nixos-vscode-server/tree/hm-module-import
The only change in your old code would need to be: vscode-server.url = "github:nix-community/nixos-vscode-server";
to vscode-server.url = "github:nix-community/nixos-vscode-server/hm-module-import";
That should let you use that branch instead. I have not sufficiently tested the code yet, hence the separate branch, but the intention is that it now should import either the NixOS or HM module depending on whether you import it in a NixOS or HM configuration.
Thanks! I tried it, but it says that this gets called with with unexpected argument 'config':
$ home-manager switch
error: anonymous function at /nix/store/15nzw95lskfcl959zhhndq866590q6i7-source/modules/vscode-server/default.nix:1:1 called with unexpected argument 'config'
at /nix/store/qxgp86sdhxwzj0k89kz2aaw0xw7d8f6i-source/lib/modules.nix:519:8:
518| # works.
519| in f (args // extraArgs);
| ^
520|
(use '--show-trace' to show detailed location information)
The call site seems to be this: https://github.com/NixOS/nixpkgs/blob/master/lib/modules.nix#L513
The README seems to show how to install
vscode-server
as a system-level module, with flakes or channels. I'm trying to install it to just one user, with home-manager managed as a flake.I expect that I need to specify
vscode-server.url = "github:nix-community/nixos-vscode-server";
as my input in.config/home-manager/flake.nix
. The next problem is, how am I supposed to "install" or enable the module to be able to enable the service in~/.config/nixpkgs/home.nix
? I tried to add it to themodules
list, but got a "vscode-server
is a flake" error. Next, I reasoned that the module is an output of the flake, but this backfires too.I'm lost how to proceed, please help. (And let's possibly, update the README too, I think that using flakes with home-manager is getting more and more common!)