NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.4k stars 14.35k forks source link

`clang-tools_17` undefined variable #273744

Closed LamprosPitsillos closed 11 months ago

LamprosPitsillos commented 11 months ago

Describe the bug

Even though the package is in the NixPackages search , while building it is an error: undefined variable 'clang-tools_17'

Steps To Reproduce

Steps to reproduce the behavior:

  1. add clang-tools_17 to packages
  2. try to build

Expected behavior

Clang tools 17 to be installed

Screenshots

2023-12-11_13-54-29_clang

Additional context

Add any other context about the problem here. https://github.com/LamprosPitsillos/nixos-config/blob/main/flake.lock My flake lock along with the rest of my conf

Notify maintainers

@Patryk27

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.


❯ nix-info -m
 - system: `"x86_64-linux"`
 - host os: `Linux 6.1.65, NixOS, 24.05 (Uakari), 24.05.20231204.2c7f3c0`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.1`
 - channels(root): `"nixos-23.05"`
 - nixpkgs: `/nix/store/aiv01710wqn2b7hms2253d1cq89kdzh8-source`

Add a :+1: reaction to issues you find important.

Patryk27 commented 11 months ago

I think you're using an older version of nixpkgs that didn't have this package yet - try:

nix flake lock --update-input nixpkgs

... and then rebuild your system again.

LamprosPitsillos commented 11 months ago

nix flake lock --update-input nixpkgs

will do and report back. Shouldnt nix flake update be enough ? I updated a few days ago

Patryk27 commented 11 months ago

Shouldnt nix flake update be enough ? I updated a few days ago

It would be enough, but llvm17 has been merged just 5 days ago, so you've probably run that command 6 days ago or more 👀

LamprosPitsillos commented 11 months ago

It's now , fixed thanks!

donottellmetonottellyou commented 8 months ago

This issue exists again for clang_17 and clang-tools_17. Same problem and expected result as above.

nix-info -m
 - system: `"x86_64-linux"`
 - host os: `Linux 6.1.64, NixOS, 23.11 (Tapir), 23.11pre-git`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.1`
 - channels(root): `""`
 - nixpkgs: `/nix/store/m9anmz1n512blbd582kw46pxyns3pvah-nixos-stable-20240326`
```nix # Edit this configuration file to define what should be installed on # your system. Help is available in the configuration.nix(5) man page # and in the NixOS manual (accessible by running ‘nixos-help’). { config, pkgs, lib, ... }: let # Central source of truth for system version channel = "23.11"; # Declaratively set home-manager and nixpkgs versions nixos-stable = builtins.fetchGit { name = "nixos-stable-20240326"; # Add date later with script url = "https://github.com/nixos/nixpkgs/"; ref = "refs/heads/nixos-${channel}"; # `git ls-remote https://github.com/nixos/nixpkgs channel` rev = "7c6e3666e2040fb64d43b209b84f65898ea3095d"; }; home-manager = builtins.fetchGit { name = "home-manager-20240326"; # Add date later with script url = "https://github.com/nix-community/home-manager/"; ref = "refs/heads/release-${channel}"; # `git ls-remote https://github.com/nix-community/home-manager release-channel` rev = "f33900124c23c4eca5831b9b5eb32ea5894375ce"; }; # Unstable for Chrome and other update-sensitive applications unstableTarball = builtins.fetchTarball https://github.com/NixOS/nixpkgs/archive/nixos-unstable.tar.gz ; in { imports = [ ./hardware-configuration.nix (import "${home-manager}/nixos") ]; # Declaratively set nixpkgs nix.nixPath = [ "nixpkgs=${nixos-stable}" "nixos-config=/etc/nixos/configuration.nix" ]; # Bootloader. boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; boot.initrd.luks.devices."luks-63396ee7-4502-48b9-a523-66cce561e35f".device = "/dev/disk/by-uuid/63396ee7-4502-48b9-a523-66cce561e35f"; networking.hostName = "ananda"; # Define your hostname. # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. # Configure network proxy if necessary # networking.proxy.default = "http://user:password@proxy:port/"; # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; # Enable networking networking.networkmanager.enable = true; environment.etc."NetworkManager/conf.d/custom.conf".text = '' [connection] wifi.powersave = 2 ''; # Set your time zone. time.timeZone = "America/Detroit"; # Select internationalisation properties. i18n.defaultLocale = "en_US.UTF-8"; i18n.extraLocaleSettings = { LC_ADDRESS = "en_US.UTF-8"; LC_IDENTIFICATION = "en_US.UTF-8"; LC_MEASUREMENT = "en_US.UTF-8"; LC_MONETARY = "en_US.UTF-8"; LC_NAME = "en_US.UTF-8"; LC_NUMERIC = "en_US.UTF-8"; LC_PAPER = "en_US.UTF-8"; LC_TELEPHONE = "en_US.UTF-8"; LC_TIME = "en_US.UTF-8"; }; # Enable the X11 windowing system with XFCE services.xserver = { enable = true; displayManager.sddm.enable = true; desktopManager.plasma5.enable = true; # Configure keymap in X11 layout = "us"; xkbVariant = ""; # Remove xterm excludePackages = with pkgs; [ xterm ]; }; # Disable suspend on laptop lid close services.logind.lidSwitchExternalPower = "ignore"; # Enable CUPS to print documents. services.printing.enable = true; # Enable sound with pipewire. sound.enable = true; hardware.pulseaudio.enable = false; security.rtkit.enable = true; services.pipewire = { enable = true; alsa.enable = true; alsa.support32Bit = true; pulse.enable = true; # If you want to use JACK applications, uncomment this #jack.enable = true; # use the example session manager (no others are packaged yet so this is enabled by default, # no need to redefine it in your config for now) #media-session.enable = true; }; # ==================== # SYSTEM MAINTENANCE # ==================== # Garbage collection and optimization nix = { gc = { automatic = true; dates = "3:00"; options = "--delete-older-than 30d"; randomizedDelaySec = "1h"; }; settings = { auto-optimise-store = true; max-jobs = 2; }; }; # ================= # GLOBAL PACKAGES # ================= # Enable the OpenSSH daemon. services.openssh.enable = true; # Open ports in the firewall. # networking.firewall.allowedTCPPorts = [ ... ]; # networking.firewall.allowedUDPPorts = [ ... ]; # Or disable the firewall altogether. # networking.firewall.enable = false; nixpkgs.config = { # Allow unfree packages allowUnfree = true; # Add unstable packages packageOverrides = pkgs: { unstable = import unstableTarball { config = config.nixpkgs.config; }; }; }; # Mumble chat server services.murmur = { enable = true; openFirewall = true; }; # Steam configuration programs.steam = { enable = true; # localNetworkGameTransfers.openFirewall = true; # future config }; # Improve bash command history search programs.bash = { interactiveShellInit = '' # Bind up and down arrow keys for history search bind '"\e[A": history-search-backward' bind '"\e[B": history-search-forward' ''; }; # Default git configuration programs.git = { enable = true; config.init.defaultBranch = "main"; }; # Some programs need SUID wrappers, can be configured further or are # started in user sessions. # programs.mtr.enable = true; programs.gnupg.agent = { enable = true; enableSSHSupport = true; }; # List packages installed in system profile. To search, run: # $ nix search wget environment.systemPackages = with pkgs; [ # Neofetch alternative fastfetch # Default browser, updated with unstable unstable.firefox # Office suite libreoffice # General programming tools fira-code git micro neovim ]; # ======= # USERS # ======= # Install in /etc/profiles instead of $HOME/.nix-profile home-manager.useUserPackages = true; # Use global pkgs home-manager.useGlobalPkgs = true; # MAIN USER users.users.jadelynnmasker = { isNormalUser = true; description = "Jade Lynn Masker"; extraGroups = [ "networkmanager" "wheel" ]; }; home-manager.users.jadelynnmasker = { pkgs, ... }: { programs.git = { enable = true; userName = "Jade Lynn Masker"; userEmail = "donottellmetonottellyou@gmail.com"; extraConfig = { # Editor/pager core = { editor = "code --wait"; pager = "less -F -X"; }; # Diff/merge tools diff.tool = "vscode"; difftool.vscode.cmd = "code --wait --diff $LOCAL $REMOTE"; merge.tool = "vscode"; mergetool = { prompt = false; vscode.cmd = "code --wait $MERGED"; }; # Signing user.signingKey = "BDA496D2B8AFE0B087AC49B60EFCE08AB6147F98"; commit.gpgSign = true; push.gpgSign = "if-asked"; tag.gpgSign = true; }; }; home.packages = with pkgs; [ # Personal web browser unstable.google-chrome # Chat discord mumble slack zoom-us # Games itch prismlauncher # C/C++ clang_17 clang-tools_17 cppcheck # CSharp dotnet-sdk_8 # Nix nixd nixpkgs-fmt # NodeJS nodejs_20 # Rust rustup # Personal text editor (with extensions) (vscode-with-extensions.override { vscodeExtensions = with vscode-extensions; [ # C++ ms-vscode.cpptools xaver.clang-format # CSharp ms-dotnettools.csharp # Markdown yzhang.markdown-all-in-one stkb.rewrap # Nix jnoortheen.nix-ide # Rust rust-lang.rust-analyzer tamasfe.even-better-toml serayuzgur.crates ] ++ pkgs.vscode-utils.extensionsFromVscodeMarketplace [ # C/C++ { name = "c-cpp-flylint"; publisher = "jbenden"; version = "1.14.0"; sha256 = "HOcFx8jjLPGW7LHq8t0mNmnuhFS+JtkD3+gCtV6eBCo="; } # Godot { name = "godot-tools"; publisher = "geequlim"; version = "2.0.0"; sha256 = "6lSpx6GooZm6SfUOjooP8mHchu8w38an8Bc2tjYaVfw="; } ]; }) ]; home.stateVersion = "23.11"; }; # This value determines the NixOS release from which the default # settings for stateful data, like file locations and database versions # on your system were taken. It‘s perfectly fine and recommended to leave # this value at the release version of the first install of this system. # Before changing this value read the documentation for this option # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). system.stateVersion = "23.11"; # Did you read the comment? } ```
Patryk27 commented 8 months ago

@donottellmetonottellyou, you're actually facing the same issue the original author did, i.e. you're using too old Nixpkgs.

7c6e3666e2040fb64d43b209b84f65898ea3095d is from Nov 29, 2023 - I'm guessing at some point you've just updated name inside the call to fetchGit, but it's rev which matters the most there.

donottellmetonottellyou commented 8 months ago

Wait what? What am I doing wrong here:

git ls-remote https://github.com/nixos/nixpkgs 23.11
7c6e3666e2040fb64d43b209b84f65898ea3095d        refs/tags/23.11

Oof, it looks like I was targeting the 23.11 tag, not the proper nixos branch:

git ls-remote https://github.com/nixos/nixpkgs nixos-23.11
219951b495fc2eac67b1456824cc1ec1fd2ee659        refs/heads/nixos-23.11

I officially feel like an idiot.

Yes, I had been checking the rev, and had been absentmindedly not noticing that it wasn't changing...

Posting this here so if anyone makes the same mistake (probably not) they see this.