NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.37k stars 13.6k forks source link

Documentation: nixpkgs Install the specified version #337617

Closed eqfae closed 1 week ago

eqfae commented 2 weeks ago

Problem

图片 过去我遇到了两个错误 64gram和wezterm 更新失败 当时不得不移除了他们 不知道怎么固定版本 网上的教程还是一头雾水 使用https://github.com/XNM1/linux-nixos-hyprland-config-dotfiles 为基础

In the past I've had two errors, 64gram and wezterm update failure, and had to remove them at the time. I don't know how to fix the version, and the online tutorials are still confusing. Use https://github.com/XNM1/linux-nixos-hyprland-config-dotfiles as a base.

https://www.nixhub.io/packages/linuxKernel.packages.linux_lqx.zfs 图片 想使用2.2.5-6.9.11 这是zfs最新支持的内核 相关配置在https://github.com/XNM1/linux-nixos-hyprland-config-dotfiles/blob/main/nixos/linux-kernel.nix Would like to use 2.2.5-6.9.11 This is the latest supported kernel for zfs The relevant configuration is at https://github.com/XNM1/linux-nixos-hyprland-config-dotfiles/blob/main/nixos/linux-kernel.nix 希望有针对linuxKernel.packages.linux_lqx指定版本 和 64gram这类普通软件包的示例 I'd like to see examples for linuxKernel.packages.linux_lqx for specific versions and 64gram for common packages.

Proposal

Checklist


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

jian-lin commented 2 weeks ago

@eqfae those comments about downloading "gcc" are phishing, be careful


In nix, fixing version of a package can be done by either fixing the commit of Nixpkgs or fixing only the version of package. The former is easy to do but has disadvantages such as not getting security updates. The latter is done with overrideAttrs. Here is its doc in the Nixpkgs manual: https://nixos.org/manual/nixpkgs/unstable/#sec-pkg-overrideAttrs. Note that Rust packages does not support finalAttrs yet. In addition, it is a bit tricky to use overrideAttrs for a Rust package for now. There is an example in NixOS wiki: https://wiki.nixos.org/wiki/Rust#Using_overrideArgs_with_Rust_Packages. Note that the overlay used there is optional. I would say both of these documents are not very beginner-friendly😅. So yes, we need to improve the documentation.

Meanwhile, you can ask questions in discourse. There is even a dedicated space for Chinese users. You can also ask questions in Matrix rooms such as Nix / NixOS and NixOS 中文. These rooms are quite active.


FYI, there is a workaround for wezterm.

eqfae commented 2 weeks ago

@eqfae those comments about downloading "gcc" are phishing, be careful

In nix, fixing version of a package can be done by either fixing the commit of Nixpkgs or fixing only the version of package. The former is easy to do but has disadvantages such as not getting security updates. The latter is done with overrideAttrs. Here is its doc in the Nixpkgs manual: https://nixos.org/manual/nixpkgs/unstable/#sec-pkg-overrideAttrs. Note that Rust packages does not support finalAttrs yet. In addition, it is a bit tricky to use overrideAttrs for a Rust package for now. There is an example in NixOS wiki: https://wiki.nixos.org/wiki/Rust#Using_overrideArgs_with_Rust_Packages. Note that the overlay used there is optional. I would say both of these documents are not very beginner-friendly😅. So yes, we need to improve the documentation.

Meanwhile, you can ask questions in discourse. There is even a dedicated space for Chinese users. You can also ask questions in Matrix rooms such as Nix / NixOS and NixOS 中文. These rooms are quite active.

FYI, there is a workaround for wezterm.

https://github.com/NixOS/nixpkgs/issues/36266#issuecomment-926999085 版本提供的信息只有 The only information provided by the versionnixpkgs/0cb2fd7c59fed0cd82ef858cbcbdb552b9a33465#linuxKernel.packages.linux_lqx.zfs

  reallyOld = import (pkgs.fetchFromGitHub {
    owner = "NixOS";
    repo = "nixpkgs";
    rev = "0cb2fd7c59fed0cd82ef858cbcbdb552b9a33465";
    sha256 = "?";
  }) {};

There's a lot missing.

图片 This only teaches name change. Change the version to find this

coqPackages.multinomials.override {
  version = "1.5.1";
}

最好基于 https://github.com/XNM1/linux-nixos-hyprland-config-dotfiles 的修改示例 以后能照着样子改 It's better to base the modification example on https://github.com/XNM1/linux-nixos-hyprland-config-dotfiles I'll be able to change it in the future.

SuperSandro2000 commented 1 week ago

dupe of #93327