DavHau / nix-portable

Nix - Static, Permissionless, Installation-free, Pre-configured
MIT License
904 stars 33 forks source link

How to use a nix profile #129

Open leath-dub opened 4 months ago

leath-dub commented 4 months ago

I would like to be able to use a flake with a simple symlinkJoin package:

{
  description = "dotfiles";

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
    systems.url = "github:nix-systems/default";
  };

  outputs = inputs@{ nixpkgs, systems, ... }: let
    forAllSystems = fn:
      nixpkgs.lib.genAttrs (import systems) (system: fn {
        pkgs = nixpkgs.legacyPackages.${system};
        inherit system;
      });
    in {
      packages = forAllSystems ({ pkgs, ... }: {
        default = pkgs.symlinkJoin {
          name = "pkgs";
          paths = with pkgs; [
            # Tools
            yash
            neovim
            zoxide
            gopls
            zellij
            lazygit
            ripgrep
            tealdeer
            pandoc          # For markdown
            texliveMinimal #
            eza

            # Language servers
            lua-language-server
            nixd
            marksman
            ltex-ls

            # Languages
            hare
            harec
            rustup

          ];
        };
      });
    };
}

However when I build this the result/ symlink does not seem to be reachable, I assume this is a namespacing issue as it is only not reachable because it points to /nix/store explicitly.

Additionally if I nix profile install, this works however I cannot . $HOME/.nix-profile/etc/profile.d/nix.sh