Issue installing certain packages using Nix

Hi, all. I’m currently daily driving Bazzite and installed Nix to manage packages instead of using Homebrew. Specifically, I’m using home-manager and flakes to manage everything, and it has mostly been working great. Installing packages like eza, jq, and ripgrep works without a hitch. However, one issue I’ve run into is that if I try to install packages like Go or Node, I get an error like so:

error: opening file '/nix/store/dbgxyznjpwxrsxykdnlh15q1g9xv3lvr-go-1.22.3.drv': No such file or directory

My understanding is that this derivation file should be generated when resolving my configuration. One thing I thought is perhaps this is getting put in the wrong directory, so I tried searching for any file with go-1.22.3 in its name across my system but there is nothing to be found.

Interestingly enough, if I use devenv to set up a development shell and specify these languages to be installed, it works perfectly.

Has anyone else come across this issue? I can’t quite understand why the files don’t get generated/ don’t exist. Below I’ve pasted my flake.nix and home.nix.

flake.nix

{
  description = "Atomic Nix";

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
    home-manager = {
      url = "github:nix-community/home-manager";
      inputs.nixpkgs.follows = "nixpkgs";
    };
  };
  outputs = {
    nixpkgs,
    home-manager,
    ...
  }: let
    # system = "aarch64-linux"; If you are running on ARM powered computer
    system = "x86_64-linux";
    pkgs = nixpkgs.legacyPackages.${system};
  in {
    homeConfigurations = {
      "jh" = home-manager.lib.homeManagerConfiguration {
        inherit pkgs;
        modules = [
          ./home-manager/home.nix
        ];
      };
    };
  };
}

home.nix

{ config, pkgs, ... }:

{
  # Home Manager needs a bit of information about you and the paths it should
  # manage.
  home.username = "jh";
  home.homeDirectory = "/var/home/jh";

  # This value determines the Home Manager release that your configuration is
  # compatible with. This helps avoid breakage when a new Home Manager release
  # introduces backwards incompatible changes.
  #
  # You should not change this value, even if you update Home Manager. If you do
  # want to update the value, then make sure to first check the Home Manager
  # release notes.
  home.stateVersion = "24.05"; # Please read the comment before changing.

  # The home.packages option allows you to install Nix packages into your
  # environment.
  home.packages = with pkgs; [
    # # Adds the 'hello' command to your environment. It prints a friendly
    # # "Hello, world!" when run.
    firefox
    neovim
    bat
    eza
    ripgrep
    fd
    jq
    yq
    xclip
    wl-clipboard
    devenv
    zellij
    go
    # # It is sometimes useful to fine-tune packages, for example, by applying
    # # overrides. You can do that directly here, just don't forget the
    # # parentheses. Maybe you want to install Nerd Fonts with a limited number of
    # # fonts?
    # (pkgs.nerdfonts.override { fonts = [ "FantasqueSansMono" ]; })

    # # You can also create simple shell scripts directly inside your
    # # configuration. For example, this adds a command 'my-hello' to your
    # # environment:
    # (pkgs.writeShellScriptBin "my-hello" ''
    #   echo "Hello, ${config.home.username}!"
    # '')
  ];

  # Home Manager is pretty good at managing dotfiles. The primary way to manage
  # plain files is through 'home.file'.
  home.file = {
    # # Building this configuration will create a copy of 'dotfiles/screenrc' in
    # # the Nix store. Activating the configuration will then make '~/.screenrc' a
    # # symlink to the Nix store copy.
    # ".screenrc".source = dotfiles/screenrc;

    # # You can also set the file content immediately.
    # ".gradle/gradle.properties".text = ''
    #   org.gradle.console=verbose
    #   org.gradle.daemon.idletimeout=3600000
    # '';
  };

  # Home Manager can also manage your environment variables through
  # 'home.sessionVariables'. These will be explicitly sourced when using a
  # shell provided by Home Manager. If you don't want to manage your shell
  # through Home Manager then you have to manually source 'hm-session-vars.sh'
  # located at either
  #
  #  ~/.nix-profile/etc/profile.d/hm-session-vars.sh
  #
  # or
  #
  #  ~/.local/state/nix/profiles/profile/etc/profile.d/hm-session-vars.sh
  #
  # or
  #
  #  /etc/profiles/per-user/jh/etc/profile.d/hm-session-vars.sh
  #
  home.sessionVariables = {
    # EDITOR = "nvim";
  };

  # Let Home Manager install and manage itself.
  programs.home-manager.enable = true;

}

Oh! you can use devenv on Bazzite? That’s so cool. I may want to do that.
I’m new to Atomic desktops and still learning where the edges are.

wrt your compiler problem, I wonder if you need to use home-manager or Flatseal to grant access to … something?

Yup! It’s quite awesome.

As for my problem with Nix, I’m still at a loss. I would think it would create the derivation and place it where every other package gets placed but it just doesn’t seem to work. I have the same problem with direnv btw.

Maybe I’m missing something with how Nix interacts with Silverblue, but it’s just weird how some packages work fine and others don’t.

1 Like

Hey, all. I just wanted to update that I finally got everything working. I’m still not sure why there was a problem, however my solution was basically to just uninstall nix + home-manager and re-install.

Since I installed using the nix determinate installer, I followed their instructions to uninstall, rebooted, and then reinstalled. I then ran nix run nixpkgs#home-manager -- switch --flake nix/#$USER to reinstall home-manager while pointing to my flake in my ~/nix directory. It prompted me that there were conflicts with my home-manager profiles, so I deleted them all and tried again. (the installer prompts you which files to remove). After that, I was able to build successfully!

Hope this helps some one else in the future.

4 Likes