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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose home-manager-built programs #5747

Open
noteed opened this issue Aug 17, 2024 · 0 comments
Open

Expose home-manager-built programs #5747

noteed opened this issue Aug 17, 2024 · 0 comments
Assignees

Comments

@noteed
Copy link

noteed commented Aug 17, 2024

Description

I'd like to write a derivation that exposes, say, the neovim configured by the home-manager module system (without actually using home-manager to manage my home directory).

In practice, I can use something like

let
  sources = import ./nix/sources.nix;
  pkgs = import sources.nixpkgs { };
  home-manager = import "${sources.home-manager}/home-manager/home-manager.nix" {
    inherit pkgs;
    confPath = ./conf.nix; # Contains mostly `programs.neovim.enable = true;`
  };
in
{ 
  neovim = pkgs.stdenv.mkDerivation {
    name = "home-manager-neovim";
    src = ./.;
    installPhase = ''
      mkdir -p $out/bin
      cp ${home-manager.activationPackage}/home-path/bin/nvim $out/bin/
    '';
  };
}

but I feel like accessing cfg.programs.neovim.finalPackage would be cleaner than going through ${home-manager.activationPackage}/home-path.

Would it be possible to add function in the top-level default.nix file of this repository to achieve this ?

Note: I think this is similar to this issue #2633.

Note: As for additional context, I was reading this blog post https://wickstrom.tech/2024-08-12-a-flexible-minimalist-neovim.html and was initially puzzled by how neovim was configured, as I couldn't find those options in NixOS. It's only later that I noticed the author was actually using home-manager. I was interested in trying the author's advices, but I'm not a home-manager user.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants