Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is it possible to use this with home-manager without using flakes? #30

Closed
ex-nix opened this issue Jul 6, 2023 · 7 comments
Closed

Comments

@ex-nix
Copy link

ex-nix commented Jul 6, 2023

#29 mentions home-manager, however only when using flakes. I currently have no interest in using flakes, so I hope it's possible to use it with a traditional config.
Thanks 馃槃

@ex-nix ex-nix changed the title Is it possible to use this with home-mananger without using flakes? Is it possible to use this with home-manager without using flakes? Jul 7, 2023
@DrymarchonShaun
Copy link

I don't have a nixos system available at the moment but I think this might be what you are looking for?

@ex-nix
Copy link
Author

ex-nix commented Jul 8, 2023

Does that indeed apply to home-manager? I'm not very knowledgeable on the Nix language so I have no idea how to translate that to something else.

For example, how do I use that piece of code in something like this:

programs.vscode = {
  enable = true;
  package = pkgs.vscodium;
  extensions = with pkgs.vscode-extensions; [
    dracula-theme.theme-dracula
    vscodevim.vim
    yzhang.markdown-all-in-one
  ];
};

Basically, how would I use the extensions from this repo in this extensions list?

@deemp
Copy link
Collaborator

deemp commented Jul 10, 2023

Hi, @hyperspace01!

I don't use home manager. I suggest you first explore the extensions attrset in repl.

nix-repl> t = (import (builtins.fetchGit {
            url = "https://github.com/nix-community/nix-vscode-extensions";
            ref = "refs/heads/master";
            rev = "c43d9089df96cf8aca157762ed0e2ddca9fcd71e";
          })).extensions

nix-repl> t.x86_64-linux.<TAB>
t.x86_64-linux.forVSCodeVersion            t.x86_64-linux.open-vsx-release            t.x86_64-linux.vscode-marketplace-release
t.x86_64-linux.open-vsx                    t.x86_64-linux.vscode-marketplace

If you use overlays.default on nixpkgs, you should have a pkgs.vscode-extensions and other attrsets.

nix-repl> t = (import (builtins.fetchGit {                                                            
                      url = "https://github.com/nix-community/nix-vscode-extensions";
                      ref = "refs/heads/master";
                      rev = "c43d9089df96cf8aca157762ed0e2ddca9fcd71e";
                    }))
nix-repl> t.overlays.defaultlambda @ /nix/store/3n6lyzv4jvpaq34qa5j89c9cjmk38dwi-source/flake.nix:33:19nix-repl> pkgs = import <nixpkgs> {system = builtins.currentSystem; overlays = [t.overlays.default];}
nix-repl> pkgs.vscod<TAB>
pkgs.vscode                        pkgs.vscode-langservers-extracted  pkgs.vscode-with-extensions
pkgs.vscode-extensions             pkgs.vscode-marketplace            pkgs.vscodium
pkgs.vscode-fhs                    pkgs.vscode-marketplace-release    pkgs.vscodium-fhs
pkgs.vscode-fhsWithPackages        pkgs.vscode-utils                  pkgs.vscodium-fhsWithPackages

Choose the necessary attrset and use like with pkgs.vscode-marketplace;

@ex-nix
Copy link
Author

ex-nix commented Jul 13, 2023

I genuinely don't know what's going on here. Is it a nix thing, or is it more likely to be a home-manager thing? I tried googling but I didn't get helpful results. Can you help me out? :)

programs.vscode = {
      enable = true;
      t = (import (builtins.fetchGit {
        url = "https://github.com/nix-community/nix-vscode-extensions";
        ref = "refs/heads/master";
        rev = "c43d9089df96cf8aca157762ed0e2ddca9fcd71e";
      })).extensions
      extensions = [
        t.x86_64-linux.vscodevim.vim
      ];
    };

Error:

syntax error, unexpected '=', expecting ';'

       at /etc/nixos/configuration.nix:153:18:

          152|       })).extensions
          153|       extensions = [
             |                  ^
          154|         t.x86_64-linux.vscodevim.vim

@jcszymansk
Copy link

jcszymansk commented Jul 13, 2023

@hyperspace01 You forgot ; at the end of line 152.

But I'd try something like:

extensions = 
  with (import (builtins.fetchGit {
        url = "https://github.com/nix-community/nix-vscode-extensions";
        ref = "refs/heads/master";
        rev = "c43d9089df96cf8aca157762ed0e2ddca9fcd71e";
  })).extensions.x86_64-linux; [
  vscodevim.vim
 ];

@deemp
Copy link
Collaborator

deemp commented Jul 13, 2023

@hyperspace01 , you'll be more productive if you study the Nix language basics
https://nixos.org/manual/nix/stable/language/constructs.html#language-constructs

@ex-nix
Copy link
Author

ex-nix commented Jul 15, 2023

Alright, thanks a lot everyone!

@ex-nix ex-nix closed this as completed Jul 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants