mirror of
https://github.com/ryan4yin/nixos-and-flakes-book.git
synced 2024-12-25 16:19:04 +01:00
chore: bump nixpkgs to 24.11 (#199)
This commit is contained in:
parent
3848665274
commit
c49e0d4892
@ -92,7 +92,7 @@ below:
|
||||
```nix{11-34}
|
||||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
|
||||
|
||||
# ...
|
||||
};
|
||||
|
@ -79,7 +79,7 @@ need to add a Module in `flake.nix`, as shown below:
|
||||
description = "NixOS running on LicheePi 4A";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
|
||||
};
|
||||
|
||||
outputs = inputs@{ self, nixpkgs, ... }: {
|
||||
@ -136,7 +136,7 @@ cross-compilation, as shown below:
|
||||
description = "NixOS running on LicheePi 4A";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
|
||||
};
|
||||
|
||||
outputs = inputs@{ self, nixpkgs, ... }: {
|
||||
@ -243,7 +243,7 @@ So how to use this method in Flakes? The example `flake.nix` is as follows:
|
||||
description = "NixOS running on LicheePi 4A";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11-small";
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11-small";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, ... }:
|
||||
@ -280,7 +280,7 @@ follows:
|
||||
description = "NixOS running on LicheePi 4A";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11-small";
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11-small";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, ... }: let
|
||||
|
@ -115,7 +115,7 @@ Here is a `flake.nix` that defines a development environment with Node.js 18 ins
|
||||
description = "A Nix-flake-based Node.js development environment";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
|
||||
};
|
||||
|
||||
outputs = { self , nixpkgs ,... }: let
|
||||
@ -159,7 +159,7 @@ Here is an example:
|
||||
description = "A Nix-flake-based Node.js development environment";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
|
||||
};
|
||||
|
||||
outputs = { self , nixpkgs ,... }: let
|
||||
@ -210,7 +210,7 @@ Example:
|
||||
description = "A Nix-flake-based Node.js development environment";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
|
||||
};
|
||||
|
||||
outputs = { self , nixpkgs ,... }: let
|
||||
@ -283,8 +283,8 @@ the `dev-shell` command, which is the special feature of `pkgs.runCommand` compa
|
||||
|
||||
Related source code:
|
||||
|
||||
- [pkgs/build-support/trivial-builders/default.nix - runCommand](https://github.com/NixOS/nixpkgs/blob/nixos-23.11/pkgs/build-support/trivial-builders/default.nix#L21-L49)
|
||||
- [pkgs/build-support/setup-hooks/make-wrapper.sh](https://github.com/NixOS/nixpkgs/blob/nixos-23.11/pkgs/build-support/setup-hooks/make-wrapper.sh)
|
||||
- [pkgs/build-support/trivial-builders/default.nix - runCommand](https://github.com/NixOS/nixpkgs/blob/nixos-24.11/pkgs/build-support/trivial-builders/default.nix#L21-L49)
|
||||
- [pkgs/build-support/setup-hooks/make-wrapper.sh](https://github.com/NixOS/nixpkgs/blob/nixos-24.11/pkgs/build-support/setup-hooks/make-wrapper.sh)
|
||||
|
||||
## Enter the build environment of any Nix package
|
||||
|
||||
|
@ -9,7 +9,7 @@ An example of kernel development with `flake.nix`.
|
||||
description = "NixOS running on LicheePi 4A";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11-small";
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11-small";
|
||||
|
||||
# custom kernel's source
|
||||
thead-kernel = {
|
||||
|
@ -16,10 +16,10 @@ packaging.
|
||||
- [nix-init](https://github.com/nix-community/nix-init): Generate Nix packages from URLs
|
||||
with hash prefetching, dependency inference, license detection, and more
|
||||
- Source Code:
|
||||
- [pkgs/build-support/trivial-builders/default.nix - runCommand](https://github.com/NixOS/nixpkgs/blob/nixos-23.11/pkgs/build-support/trivial-builders/default.nix#L21-L49)
|
||||
- [pkgs/build-support/setup-hooks/make-wrapper.sh](https://github.com/NixOS/nixpkgs/blob/nixos-23.11/pkgs/build-support/setup-hooks/make-wrapper.sh)
|
||||
- [pkgs/build-support/trivial-builders/default.nix - runCommand](https://github.com/NixOS/nixpkgs/blob/nixos-24.11/pkgs/build-support/trivial-builders/default.nix#L21-L49)
|
||||
- [pkgs/build-support/setup-hooks/make-wrapper.sh](https://github.com/NixOS/nixpkgs/blob/nixos-24.11/pkgs/build-support/setup-hooks/make-wrapper.sh)
|
||||
- FHS related
|
||||
- [pkgs/build-support/build-fhsenv-bubblewrap/buildFHSEnv.nix](https://github.com/NixOS/nixpkgs/blob/nixos-23.11/pkgs/build-support/build-fhsenv-bubblewrap/buildFHSEnv.nix):
|
||||
- [pkgs/build-support/build-fhsenv-bubblewrap/buildFHSEnv.nix](https://github.com/NixOS/nixpkgs/blob/nixos-24.11/pkgs/build-support/build-fhsenv-bubblewrap/buildFHSEnv.nix):
|
||||
`pkgs.buildFHSEnvBubblewrap`
|
||||
- [pkgs/build-support/build-fhsenv-chroot/default.nix](https://github.com/NixOS/nixpkgs/blob/nixos-23.11/pkgs/build-support/build-fhsenv-bubblewrap/buildFHSEnv.nix):
|
||||
- [pkgs/build-support/build-fhsenv-chroot/default.nix](https://github.com/NixOS/nixpkgs/blob/nixos-24.11/pkgs/build-support/build-fhsenv-bubblewrap/buildFHSEnv.nix):
|
||||
`pkgs.buildFHSEnvChroot`
|
||||
|
@ -139,7 +139,7 @@ The second method is to configure `substituters` and `trusted-public-keys` using
|
||||
};
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
|
||||
|
||||
# omitting several configurations...
|
||||
};
|
||||
@ -227,7 +227,7 @@ In other words, you can use it like this:
|
||||
};
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
|
||||
|
||||
# omitting several configurations...
|
||||
};
|
||||
|
@ -17,8 +17,8 @@ commit or branch:
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
|
||||
# Latest stable branch of nixpkgs, used for version rollback
|
||||
# The current latest version is 23.11
|
||||
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-23.11";
|
||||
# The current latest version is 24.11
|
||||
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-24.11";
|
||||
|
||||
# You can also use a specific git commit hash to lock the version
|
||||
nixpkgs-fd40cef8d.url = "github:nixos/nixpkgs/fd40cef8d797670e203a27a91e4b8e6decf0b90c";
|
||||
|
@ -276,7 +276,7 @@ project:
|
||||
```nix{10-38}
|
||||
# flake.nix
|
||||
{
|
||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
|
||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
|
||||
outputs = {nixpkgs, ...}: {
|
||||
nixosConfigurations = {
|
||||
"my-nixos" = nixpkgs.lib.nixosSystem {
|
||||
@ -325,7 +325,7 @@ strings, single-line strings, and lists. Let's test the results:
|
||||
```bash
|
||||
# Example 1: multiline string merging
|
||||
› echo $(nix eval .#nixosConfigurations.my-nixos.config.programs.bash.shellInit)
|
||||
trace: warning: system.stateVersion is not set, defaulting to 23.11. Read why this matters on https://nixos.org/manual/nixos/stable/options.html#opt-system.stateVersio
|
||||
trace: warning: system.stateVersion is not set, defaulting to 24.11. Read why this matters on https://nixos.org/manual/nixos/stable/options.html#opt-system.stateVersio
|
||||
n.
|
||||
"echo 'insert before default'
|
||||
|
||||
@ -362,4 +362,4 @@ order of definition.
|
||||
## References
|
||||
|
||||
- [Nix modules: Improving Nix's discoverability and usability](https://cfp.nixcon.org/nixcon2020/talk/K89WJY/)
|
||||
- [Module System - Nixpkgs](https://github.com/NixOS/nixpkgs/blob/nixos-23.11/doc/module-system/module-system.chapter.md)
|
||||
- [Module System - Nixpkgs](https://github.com/NixOS/nixpkgs/blob/nixos-24.11/doc/module-system/module-system.chapter.md)
|
||||
|
@ -54,9 +54,9 @@ automatically injected, and declaration-free parameters** provided by the module
|
||||
`nixpkgs.legacyPackages."${system}"`, and the value of `pkgs` can be customized
|
||||
through the `nixpkgs.pkgs` option.
|
||||
5. `modulesPath`: A parameter available only in NixOS, which is a path pointing to
|
||||
[nixpkgs/nixos/modules](https://github.com/NixOS/nixpkgs/tree/nixos-23.11/nixos/modules).
|
||||
[nixpkgs/nixos/modules](https://github.com/NixOS/nixpkgs/tree/nixos-24.11/nixos/modules).
|
||||
- It is defined in
|
||||
[nixpkgs/nixos/lib/eval-config-minimal.nix#L43](https://github.com/NixOS/nixpkgs/blob/nixos-23.11/nixos/lib/eval-config-minimal.nix#L43).
|
||||
[nixpkgs/nixos/lib/eval-config-minimal.nix#L43](https://github.com/NixOS/nixpkgs/blob/nixos-24.11/nixos/lib/eval-config-minimal.nix#L43).
|
||||
- It is typically used to import additional NixOS modules and can be found in most
|
||||
NixOS auto-generated `hardware-configuration.nix` files.
|
||||
|
||||
@ -77,11 +77,11 @@ to understand. If readers are interested, I will include the links here:
|
||||
Nixpkgs Manual.
|
||||
- Nixpkgs Manual: [Module System - Nixpkgs]
|
||||
- NixOS Manual:
|
||||
[nixpkgs/nixos-23.11/nixos/doc/manual/development/option-types.section.md#L237-L244]
|
||||
[nixpkgs/nixos-24.11/nixos/doc/manual/development/option-types.section.md#L237-L244]
|
||||
1. `_module.args`:
|
||||
- NixOS Manual:
|
||||
[Appendix A. Configuration Options](https://nixos.org/manual/nixos/stable/options#opt-_module.args)
|
||||
- Source Code: [nixpkgs/nixos-23.11/lib/modules.nix - _module.args]
|
||||
- Source Code: [nixpkgs/nixos-24.11/lib/modules.nix - _module.args]
|
||||
|
||||
In short, `specialArgs` and `_module.args` both require an attribute set as their value,
|
||||
and they serve the same purpose, passing all parameters in the attribute set to all
|
||||
@ -105,7 +105,7 @@ Suppose you want to pass a certain dependency to a submodule for use. You can us
|
||||
```nix{13}
|
||||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
|
||||
another-input.url = "github:username/repo-name/branch-name";
|
||||
};
|
||||
|
||||
@ -129,7 +129,7 @@ Or you can achieve the same effect using the `_module.args` option:
|
||||
```nix{14}
|
||||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
|
||||
another-input.url = "github:username/repo-name/branch-name";
|
||||
};
|
||||
outputs = inputs@{ self, nixpkgs, another-input, ... }: {
|
||||
@ -184,7 +184,7 @@ First, add the helix input data source to `flake.nix`:
|
||||
```nix{6,12,18}
|
||||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
|
||||
|
||||
# helix editor, use the master branch
|
||||
helix.url = "github:helix-editor/helix/master";
|
||||
@ -278,12 +278,12 @@ the following official/semi-official documents:
|
||||
|
||||
[nix flake - Nix Manual]:
|
||||
https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-flake#flake-inputs
|
||||
[nixpkgs/flake.nix]: https://github.com/NixOS/nixpkgs/tree/nixos-23.11/flake.nix
|
||||
[nixpkgs/flake.nix]: https://github.com/NixOS/nixpkgs/tree/nixos-24.11/flake.nix
|
||||
[nixpkgs/nixos/lib/eval-config.nix]:
|
||||
https://github.com/NixOS/nixpkgs/tree/nixos-23.11/nixos/lib/eval-config.nix
|
||||
https://github.com/NixOS/nixpkgs/tree/nixos-24.11/nixos/lib/eval-config.nix
|
||||
[Module System - Nixpkgs]:
|
||||
https://github.com/NixOS/nixpkgs/blob/23.11/doc/module-system/module-system.chapter.md
|
||||
[nixpkgs/nixos-23.11/lib/modules.nix - _module.args]:
|
||||
https://github.com/NixOS/nixpkgs/blob/nixos-23.11/lib/modules.nix#L122-L184
|
||||
[nixpkgs/nixos-23.11/nixos/doc/manual/development/option-types.section.md#L237-L244]:
|
||||
https://github.com/NixOS/nixpkgs/blob/nixos-23.11/nixos/doc/manual/development/option-types.section.md?plain=1#L237-L244
|
||||
https://github.com/NixOS/nixpkgs/blob/24.11/doc/module-system/module-system.chapter.md
|
||||
[nixpkgs/nixos-24.11/lib/modules.nix - _module.args]:
|
||||
https://github.com/NixOS/nixpkgs/blob/nixos-24.11/lib/modules.nix#L122-L184
|
||||
[nixpkgs/nixos-24.11/nixos/doc/manual/development/option-types.section.md#L237-L244]:
|
||||
https://github.com/NixOS/nixpkgs/blob/nixos-24.11/nixos/doc/manual/development/option-types.section.md?plain=1#L237-L244
|
||||
|
@ -12,8 +12,8 @@ dependencies of this flake. These dependencies will be passed as arguments to th
|
||||
```nix{2-5,7}
|
||||
{
|
||||
inputs = {
|
||||
# NixOS official package source, using the nixos-23.11 branch here
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
|
||||
# NixOS official package source, using the nixos-24.11 branch here
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, ... }@inputs: {
|
||||
@ -45,8 +45,8 @@ results of the flake:
|
||||
description = "A simple NixOS flake";
|
||||
|
||||
inputs = {
|
||||
# NixOS official package source, here using the nixos-23.11 branch
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
|
||||
# NixOS official package source, here using the nixos-24.11 branch
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, ... }@inputs: {
|
||||
@ -141,8 +141,8 @@ definition includes the `lib` attribute, and in our example, we use the `lib` at
|
||||
```nix{8-13}
|
||||
{
|
||||
inputs = {
|
||||
# NixOS official package source, here using the nixos-23.11 branch
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
|
||||
# NixOS official package source, here using the nixos-24.11 branch
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, ... }@inputs: {
|
||||
@ -173,14 +173,14 @@ source code, and study its implementation.
|
||||
|
||||
[nix flake - Nix Manual]:
|
||||
https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-flake#flake-inputs
|
||||
[nixpkgs/flake.nix]: https://github.com/NixOS/nixpkgs/tree/nixos-23.11/flake.nix
|
||||
[nixpkgs/flake.nix]: https://github.com/NixOS/nixpkgs/tree/nixos-24.11/flake.nix
|
||||
[nixpkgs/nixos/lib/eval-config.nix]:
|
||||
https://github.com/NixOS/nixpkgs/tree/nixos-23.11/nixos/lib/eval-config.nix
|
||||
https://github.com/NixOS/nixpkgs/tree/nixos-24.11/nixos/lib/eval-config.nix
|
||||
[Module System - Nixpkgs]:
|
||||
https://github.com/NixOS/nixpkgs/blob/23.11/doc/module-system/module-system.chapter.md
|
||||
[nixpkgs/nixos-23.11/lib/modules.nix - _module.args]:
|
||||
https://github.com/NixOS/nixpkgs/blob/nixos-23.11/lib/modules.nix#L122-L184
|
||||
[nixpkgs/nixos-23.11/nixos/doc/manual/development/option-types.section.md#L237-L244]:
|
||||
https://github.com/NixOS/nixpkgs/blob/nixos-23.11/nixos/doc/manual/development/option-types.section.md?plain=1#L237-L244
|
||||
https://github.com/NixOS/nixpkgs/blob/24.11/doc/module-system/module-system.chapter.md
|
||||
[nixpkgs/nixos-24.11/lib/modules.nix - _module.args]:
|
||||
https://github.com/NixOS/nixpkgs/blob/nixos-24.11/lib/modules.nix#L122-L184
|
||||
[nixpkgs/nixos-24.11/nixos/doc/manual/development/option-types.section.md#L237-L244]:
|
||||
https://github.com/NixOS/nixpkgs/blob/nixos-24.11/nixos/doc/manual/development/option-types.section.md?plain=1#L237-L244
|
||||
|
||||
|
||||
|
@ -79,8 +79,8 @@ Flakes. Here's an example of the content:
|
||||
description = "A simple NixOS flake";
|
||||
|
||||
inputs = {
|
||||
# NixOS official package source, using the nixos-23.11 branch here
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
|
||||
# NixOS official package source, using the nixos-24.11 branch here
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, ... }@inputs: {
|
||||
@ -146,12 +146,12 @@ bring.
|
||||
|
||||
[nix flake - Nix Manual]:
|
||||
https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-flake#flake-inputs
|
||||
[nixpkgs/flake.nix]: https://github.com/NixOS/nixpkgs/tree/nixos-23.11/flake.nix
|
||||
[nixpkgs/flake.nix]: https://github.com/NixOS/nixpkgs/tree/nixos-24.11/flake.nix
|
||||
[nixpkgs/nixos/lib/eval-config.nix]:
|
||||
https://github.com/NixOS/nixpkgs/tree/nixos-23.11/nixos/lib/eval-config.nix
|
||||
https://github.com/NixOS/nixpkgs/tree/nixos-24.11/nixos/lib/eval-config.nix
|
||||
[Module System - Nixpkgs]:
|
||||
https://github.com/NixOS/nixpkgs/blob/23.11/doc/module-system/module-system.chapter.md
|
||||
[nixpkgs/nixos-23.11/lib/modules.nix - _module.args]:
|
||||
https://github.com/NixOS/nixpkgs/blob/nixos-23.11/lib/modules.nix#L122-L184
|
||||
[nixpkgs/nixos-23.11/nixos/doc/manual/development/option-types.section.md#L237-L244]:
|
||||
https://github.com/NixOS/nixpkgs/blob/nixos-23.11/nixos/doc/manual/development/option-types.section.md?plain=1#L237-L244
|
||||
https://github.com/NixOS/nixpkgs/blob/24.11/doc/module-system/module-system.chapter.md
|
||||
[nixpkgs/nixos-24.11/lib/modules.nix - _module.args]:
|
||||
https://github.com/NixOS/nixpkgs/blob/nixos-24.11/lib/modules.nix#L122-L184
|
||||
[nixpkgs/nixos-24.11/nixos/doc/manual/development/option-types.section.md#L237-L244]:
|
||||
https://github.com/NixOS/nixpkgs/blob/nixos-24.11/nixos/doc/manual/development/option-types.section.md?plain=1#L237-L244
|
||||
|
@ -164,7 +164,7 @@ Here's an example of its contents:
|
||||
# You can update home Manager without changing this value. See
|
||||
# the home Manager release notes for a list of state version
|
||||
# changes in each release.
|
||||
home.stateVersion = "23.11";
|
||||
home.stateVersion = "24.11";
|
||||
|
||||
# Let home Manager install and manage itself.
|
||||
programs.home-manager.enable = true;
|
||||
@ -186,10 +186,10 @@ After adjusting the parameters, the content of `/etc/nixos/flake.nix` is as foll
|
||||
description = "NixOS configuration";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
|
||||
# home-manager, used for managing user configuration
|
||||
home-manager = {
|
||||
url = "github:nix-community/home-manager/release-23.11";
|
||||
url = "github:nix-community/home-manager/release-24.11";
|
||||
# The `follows` keyword in inputs is used for inheritance.
|
||||
# Here, `inputs.nixpkgs` of home-manager is kept consistent with
|
||||
# the `inputs.nixpkgs` of the current flake,
|
||||
|
@ -4,10 +4,10 @@ In our previous NixOS configurations, we set various values for `options` to con
|
||||
NixOS or Home Manager. These `options` are actually defined in two locations:
|
||||
|
||||
- NixOS:
|
||||
[nixpkgs/nixos/modules](https://github.com/NixOS/nixpkgs/tree/23.11/nixos/modules),
|
||||
[nixpkgs/nixos/modules](https://github.com/NixOS/nixpkgs/tree/24.11/nixos/modules),
|
||||
where all NixOS options visible on <https://search.nixos.org/options> are defined.
|
||||
- Home Manager:
|
||||
[home-manager/modules](https://github.com/nix-community/home-manager/blob/release-23.11/modules),
|
||||
[home-manager/modules](https://github.com/nix-community/home-manager/blob/release-24.11/modules),
|
||||
where you can find all its options at
|
||||
<https://nix-community.github.io/home-manager/options.xhtml>.
|
||||
|
||||
@ -217,7 +217,7 @@ Let's start with a simple example:
|
||||
# ./flake.nix
|
||||
{
|
||||
description = "NixOS Flake for Test";
|
||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
|
||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
|
||||
|
||||
outputs = {nixpkgs, ...}: {
|
||||
nixosConfigurations = {
|
||||
@ -331,7 +331,7 @@ The first thought might be to directly use `imports` in `config = { ... };`, lik
|
||||
# ./flake.nix
|
||||
{
|
||||
description = "NixOS Flake for Test";
|
||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
|
||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
|
||||
|
||||
outputs = {nixpkgs, ...}: {
|
||||
nixosConfigurations = {
|
||||
@ -396,7 +396,7 @@ Let's look at an example directly:
|
||||
# ./flake.nix
|
||||
{
|
||||
description = "NixOS Flake for Test";
|
||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
|
||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
|
||||
|
||||
outputs = {nixpkgs, ...}: {
|
||||
nixosConfigurations = {
|
||||
@ -446,14 +446,14 @@ section
|
||||
- [Module System - Nixpkgs]
|
||||
- [Writing NixOS Modules - Nixpkgs]
|
||||
|
||||
[lib/modules.nix]: https://github.com/NixOS/nixpkgs/blob/23.11/lib/modules.nix#L995
|
||||
[lib/modules.nix]: https://github.com/NixOS/nixpkgs/blob/24.11/lib/modules.nix#L995
|
||||
[Module System - Nixpkgs]:
|
||||
https://github.com/NixOS/nixpkgs/blob/23.11/doc/module-system/module-system.chapter.md
|
||||
https://github.com/NixOS/nixpkgs/blob/24.11/doc/module-system/module-system.chapter.md
|
||||
[Writing NixOS Modules - Nixpkgs]:
|
||||
https://github.com/NixOS/nixpkgs/blob/nixos-23.11/nixos/doc/manual/development/writing-modules.chapter.md
|
||||
https://github.com/NixOS/nixpkgs/blob/nixos-24.11/nixos/doc/manual/development/writing-modules.chapter.md
|
||||
[Option Definitions - NixOS]:
|
||||
https://github.com/NixOS/nixpkgs/blob/nixos-23.11/nixos/doc/manual/development/option-def.section.md
|
||||
https://github.com/NixOS/nixpkgs/blob/nixos-24.11/nixos/doc/manual/development/option-def.section.md
|
||||
[Option Declarations - NixOS]:
|
||||
https://github.com/NixOS/nixpkgs/blob/nixos-23.11/nixos/doc/manual/development/option-declarations.section.md
|
||||
https://github.com/NixOS/nixpkgs/blob/nixos-24.11/nixos/doc/manual/development/option-declarations.section.md
|
||||
[Options Types - NixOS]:
|
||||
https://github.com/NixOS/nixpkgs/blob/nixos-23.11/nixos/doc/manual/development/option-types.section.md
|
||||
https://github.com/NixOS/nixpkgs/blob/nixos-24.11/nixos/doc/manual/development/option-types.section.md
|
||||
|
@ -73,7 +73,7 @@ ssh-add ~/.ssh/your-private-key
|
||||
```nix{11-34}
|
||||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
|
||||
|
||||
# ...
|
||||
};
|
||||
|
@ -71,7 +71,7 @@ Module,示例如下:
|
||||
description = "NixOS running on LicheePi 4A";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
|
||||
};
|
||||
|
||||
outputs = inputs@{ self, nixpkgs, ... }: {
|
||||
@ -125,7 +125,7 @@ Module,示例如下:
|
||||
description = "NixOS running on LicheePi 4A";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
|
||||
};
|
||||
|
||||
outputs = inputs@{ self, nixpkgs, ... }: {
|
||||
@ -217,7 +217,7 @@ nix-repl> pkgs.pkgsCross.riscv64.stdenv.cc
|
||||
description = "NixOS running on LicheePi 4A";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11-small";
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11-small";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, ... }:
|
||||
@ -252,7 +252,7 @@ nix-repl> pkgs.pkgsCross.riscv64.stdenv.cc
|
||||
description = "NixOS running on LicheePi 4A";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11-small";
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11-small";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, ... }: let
|
||||
|
@ -118,7 +118,7 @@ stdenv.mkDerivation ({
|
||||
description = "A Nix-flake-based Node.js development environment";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
|
||||
};
|
||||
|
||||
outputs = { self , nixpkgs ,... }: let
|
||||
@ -162,7 +162,7 @@ stdenv.mkDerivation ({
|
||||
description = "A Nix-flake-based Node.js development environment";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
|
||||
};
|
||||
|
||||
outputs = { self , nixpkgs ,... }: let
|
||||
@ -212,7 +212,7 @@ wrapper,比如 `pkgs.runCommand`.
|
||||
description = "A Nix-flake-based Node.js development environment";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
|
||||
};
|
||||
|
||||
outputs = { self , nixpkgs ,... }: let
|
||||
@ -280,8 +280,8 @@ session,可以在其中正常使用 `node` `pnpm` 命令.
|
||||
|
||||
相关源代码:
|
||||
|
||||
- [pkgs/build-support/trivial-builders/default.nix - runCommand](https://github.com/NixOS/nixpkgs/blob/nixos-23.11/pkgs/build-support/trivial-builders/default.nix#L21-L49)
|
||||
- [pkgs/build-support/setup-hooks/make-wrapper.sh](https://github.com/NixOS/nixpkgs/blob/nixos-23.11/pkgs/build-support/setup-hooks/make-wrapper.sh)
|
||||
- [pkgs/build-support/trivial-builders/default.nix - runCommand](https://github.com/NixOS/nixpkgs/blob/nixos-24.11/pkgs/build-support/trivial-builders/default.nix#L21-L49)
|
||||
- [pkgs/build-support/setup-hooks/make-wrapper.sh](https://github.com/NixOS/nixpkgs/blob/nixos-24.11/pkgs/build-support/setup-hooks/make-wrapper.sh)
|
||||
|
||||
## 进入任何 Nix 包的构建环境
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
description = "NixOS running on LicheePi 4A";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11-small";
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11-small";
|
||||
|
||||
# custom kernel's source
|
||||
thead-kernel = {
|
||||
|
@ -15,12 +15,12 @@ WIP 未完成,目前请移步如下参考文档学习 Nix 打包。
|
||||
- [nix-init](https://github.com/nix-community/nix-init): Generate Nix packages from URLs
|
||||
with hash prefetching, dependency inference, license detection, and more
|
||||
- Source Code:
|
||||
- [pkgs/build-support/trivial-builders/default.nix - runCommand](https://github.com/NixOS/nixpkgs/blob/nixos-23.11/pkgs/build-support/trivial-builders/default.nix#L21-L49)
|
||||
- [pkgs/build-support/setup-hooks/make-wrapper.sh](https://github.com/NixOS/nixpkgs/blob/nixos-23.11/pkgs/build-support/setup-hooks/make-wrapper.sh)
|
||||
- [pkgs/build-support/trivial-builders/default.nix - runCommand](https://github.com/NixOS/nixpkgs/blob/nixos-24.11/pkgs/build-support/trivial-builders/default.nix#L21-L49)
|
||||
- [pkgs/build-support/setup-hooks/make-wrapper.sh](https://github.com/NixOS/nixpkgs/blob/nixos-24.11/pkgs/build-support/setup-hooks/make-wrapper.sh)
|
||||
- FHS related
|
||||
- [pkgs/build-support/build-fhsenv-bubblewrap/buildFHSEnv.nix](https://github.com/NixOS/nixpkgs/blob/nixos-23.11/pkgs/build-support/build-fhsenv-bubblewrap/buildFHSEnv.nix):
|
||||
- [pkgs/build-support/build-fhsenv-bubblewrap/buildFHSEnv.nix](https://github.com/NixOS/nixpkgs/blob/nixos-24.11/pkgs/build-support/build-fhsenv-bubblewrap/buildFHSEnv.nix):
|
||||
`pkgs.buildFHSEnvBubblewrap`
|
||||
- [pkgs/build-support/build-fhsenv-chroot/default.nix](https://github.com/NixOS/nixpkgs/blob/nixos-23.11/pkgs/build-support/build-fhsenv-bubblewrap/buildFHSEnv.nix):
|
||||
- [pkgs/build-support/build-fhsenv-chroot/default.nix](https://github.com/NixOS/nixpkgs/blob/nixos-24.11/pkgs/build-support/build-fhsenv-bubblewrap/buildFHSEnv.nix):
|
||||
`pkgs.buildFHSEnvChroot`
|
||||
|
||||
---
|
||||
|
@ -127,7 +127,7 @@ Nix 中通过如下几个 options 来配置缓存服务器:
|
||||
};
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
|
||||
|
||||
# 省略若干配置...
|
||||
};
|
||||
@ -209,7 +209,7 @@ Nix 提供了
|
||||
};
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
|
||||
|
||||
# 省略若干配置...
|
||||
};
|
||||
|
@ -20,8 +20,8 @@ commit.
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||
|
||||
# 最新 stable 分支的 nixpkgs,用于回退个别软件包的版本
|
||||
# 当前最新版本为 23.11
|
||||
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-23.11";
|
||||
# 当前最新版本为 24.11
|
||||
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-24.11";
|
||||
|
||||
# 另外也可以使用 git commit hash 来锁定版本,这是最彻底的锁定方式
|
||||
nixpkgs-fd40cef8d.url = "github:nixos/nixpkgs/fd40cef8d797670e203a27a91e4b8e6decf0b90c";
|
||||
|
@ -224,7 +224,7 @@ Nix Flakes 对目录结构没有任何要求,你可以参考上面的例子,
|
||||
```nix{10-38}
|
||||
# flake.nix
|
||||
{
|
||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
|
||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
|
||||
outputs = {nixpkgs, ...}: {
|
||||
nixosConfigurations = {
|
||||
"my-nixos" = nixpkgs.lib.nixosSystem {
|
||||
@ -273,7 +273,7 @@ Nix Flakes 对目录结构没有任何要求,你可以参考上面的例子,
|
||||
```bash
|
||||
# 示例一:多行字符串合并
|
||||
› echo $(nix eval .#nixosConfigurations.my-nixos.config.programs.bash.shellInit)
|
||||
trace: warning: system.stateVersion is not set, defaulting to 23.11. Read why this matters on https://nixos.org/manual/nixos/stable/options.html#opt-system.stateVersio
|
||||
trace: warning: system.stateVersion is not set, defaulting to 24.11. Read why this matters on https://nixos.org/manual/nixos/stable/options.html#opt-system.stateVersio
|
||||
n.
|
||||
"echo 'insert before default'
|
||||
|
||||
@ -308,5 +308,5 @@ echo 'insert after default';"
|
||||
## References
|
||||
|
||||
- [Nix modules: Improving Nix's discoverability and usability ](https://cfp.nixcon.org/nixcon2020/talk/K89WJY/)
|
||||
- [Module System - Nixpkgs](https://github.com/NixOS/nixpkgs/blob/nixos-23.11/doc/module-system/module-system.chapter.md)
|
||||
- [Module System - Nixpkgs](https://github.com/NixOS/nixpkgs/blob/nixos-24.11/doc/module-system/module-system.chapter.md)
|
||||
- [Misterio77/nix-starter-configs](https://github.com/Misterio77/nix-starter-configs)
|
||||
|
@ -48,9 +48,9 @@ Nix 代码的模块化系统。
|
||||
- 入门阶段可以认为它的默认值为 `nixpkgs.legacyPackages."${system}"`,可通过
|
||||
`nixpkgs.pkgs` 这个 option 来自定义 `pkgs` 的值
|
||||
5. `modulesPath`: 一个只在 NixOS 中可用的参数,是一个 Path,指向
|
||||
[nixpkgs/nixos/modules](https://github.com/NixOS/nixpkgs/tree/nixos-23.11/nixos/modules)
|
||||
[nixpkgs/nixos/modules](https://github.com/NixOS/nixpkgs/tree/nixos-24.11/nixos/modules)
|
||||
- 它在
|
||||
[nixpkgs/nixos/lib/eval-config-minimal.nix#L43](https://github.com/NixOS/nixpkgs/blob/nixos-23.11/nixos/lib/eval-config-minimal.nix#L43)
|
||||
[nixpkgs/nixos/lib/eval-config-minimal.nix#L43](https://github.com/NixOS/nixpkgs/blob/nixos-24.11/nixos/lib/eval-config-minimal.nix#L43)
|
||||
中被定义
|
||||
- 通常被用于导入一些额外的 NixOS 模块,NixOS 自动生成的 `hardware-configuration.nix` 中
|
||||
基本都能看到它
|
||||
@ -69,11 +69,11 @@ Nixpkgs 的模块系统提供了两种方式来传递非默认参数:
|
||||
1. `specialArgs`: NixOS Manual 跟 Nixpkgs Manual 中分别有与它有关的只言片语
|
||||
- Nixpkgs Manual: [Module System - Nixpkgs]
|
||||
- NixOS Manual:
|
||||
[nixpkgs/nixos-23.11/nixos/doc/manual/development/option-types.section.md#L237-L244]
|
||||
[nixpkgs/nixos-24.11/nixos/doc/manual/development/option-types.section.md#L237-L244]
|
||||
1. `_module.args`:
|
||||
- NixOS Manual:
|
||||
[Appendix A. Configuration Options](https://nixos.org/manual/nixos/stable/options#opt-_module.args)
|
||||
- Source Code: [nixpkgs/nixos-23.11/lib/modules.nix - _module.args]
|
||||
- Source Code: [nixpkgs/nixos-24.11/lib/modules.nix - _module.args]
|
||||
|
||||
总之,`specialArgs` 与 `_module.args` 需要的值都是一个 attribute set,它们的功能也相同,都
|
||||
是将其 attribute set 中的所有参数传递到所有子模块中。这两者的区别在于:
|
||||
@ -96,7 +96,7 @@ NixOS 社区比较推荐优先使用 `_module.args` 这个 options,仅在无
|
||||
```nix{13}
|
||||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
|
||||
another-input.url = "github:username/repo-name/branch-name";
|
||||
};
|
||||
|
||||
@ -120,7 +120,7 @@ NixOS 社区比较推荐优先使用 `_module.args` 这个 options,仅在无
|
||||
```nix{15}
|
||||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
|
||||
another-input.url = "github:username/repo-name/branch-name";
|
||||
};
|
||||
|
||||
@ -173,7 +173,7 @@ helix 的 master 分支。
|
||||
```nix{6,12,18}
|
||||
{
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
|
||||
|
||||
# helix editor, use the master branch
|
||||
helix.url = "github:helix-editor/helix/master";
|
||||
@ -259,12 +259,12 @@ nix run github:helix-editor/helix/master
|
||||
|
||||
[nix flake - Nix Manual]:
|
||||
https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-flake#flake-inputs
|
||||
[nixpkgs/flake.nix]: https://github.com/NixOS/nixpkgs/tree/nixos-23.11/flake.nix
|
||||
[nixpkgs/flake.nix]: https://github.com/NixOS/nixpkgs/tree/nixos-24.11/flake.nix
|
||||
[nixpkgs/nixos/lib/eval-config.nix]:
|
||||
https://github.com/NixOS/nixpkgs/tree/nixos-23.11/nixos/lib/eval-config.nix
|
||||
https://github.com/NixOS/nixpkgs/tree/nixos-24.11/nixos/lib/eval-config.nix
|
||||
[Module System - Nixpkgs]:
|
||||
https://github.com/NixOS/nixpkgs/blob/23.11/doc/module-system/module-system.chapter.md
|
||||
[nixpkgs/nixos-23.11/lib/modules.nix - _module.args]:
|
||||
https://github.com/NixOS/nixpkgs/blob/nixos-23.11/lib/modules.nix#L122-L184
|
||||
[nixpkgs/nixos-23.11/nixos/doc/manual/development/option-types.section.md#L237-L244]:
|
||||
https://github.com/NixOS/nixpkgs/blob/nixos-23.11/nixos/doc/manual/development/option-types.section.md?plain=1#L237-L244
|
||||
https://github.com/NixOS/nixpkgs/blob/24.11/doc/module-system/module-system.chapter.md
|
||||
[nixpkgs/nixos-24.11/lib/modules.nix - _module.args]:
|
||||
https://github.com/NixOS/nixpkgs/blob/nixos-24.11/lib/modules.nix#L122-L184
|
||||
[nixpkgs/nixos-24.11/nixos/doc/manual/development/option-types.section.md#L237-L244]:
|
||||
https://github.com/NixOS/nixpkgs/blob/nixos-24.11/nixos/doc/manual/development/option-types.section.md?plain=1#L237-L244
|
||||
|
@ -11,8 +11,8 @@
|
||||
```nix{2-5,7}
|
||||
{
|
||||
inputs = {
|
||||
# NixOS 官方软件源,这里使用 nixos-23.11 分支
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
|
||||
# NixOS 官方软件源,这里使用 nixos-24.11 分支
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, ... }@inputs: {
|
||||
@ -42,8 +42,8 @@ attribute set,这个返回的 attribute set 即为该 flake 的构建结果:
|
||||
description = "A simple NixOS flake";
|
||||
|
||||
inputs = {
|
||||
# NixOS 官方软件源,这里使用 nixos-23.11 分支
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
|
||||
# NixOS 官方软件源,这里使用 nixos-24.11 分支
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, ... }@inputs: {
|
||||
@ -125,8 +125,8 @@ outputs 定义中有返回 `lib` 这个属性,我们的例子中就使用了 `
|
||||
```nix{8-13}
|
||||
{
|
||||
inputs = {
|
||||
# NixOS 官方软件源,这里使用 nixos-23.11 分支
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
|
||||
# NixOS 官方软件源,这里使用 nixos-24.11 分支
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, ... }@inputs: {
|
||||
@ -158,14 +158,14 @@ outputs 定义中有返回 `lib` 这个属性,我们的例子中就使用了 `
|
||||
|
||||
[nix flake - Nix Manual]:
|
||||
https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-flake#flake-inputs
|
||||
[nixpkgs/flake.nix]: https://github.com/NixOS/nixpkgs/tree/nixos-23.11/flake.nix
|
||||
[nixpkgs/flake.nix]: https://github.com/NixOS/nixpkgs/tree/nixos-24.11/flake.nix
|
||||
[nixpkgs/nixos/lib/eval-config.nix]:
|
||||
https://github.com/NixOS/nixpkgs/tree/nixos-23.11/nixos/lib/eval-config.nix
|
||||
https://github.com/NixOS/nixpkgs/tree/nixos-24.11/nixos/lib/eval-config.nix
|
||||
[Module System - Nixpkgs]:
|
||||
https://github.com/NixOS/nixpkgs/blob/23.11/doc/module-system/module-system.chapter.md
|
||||
[nixpkgs/nixos-23.11/lib/modules.nix - _module.args]:
|
||||
https://github.com/NixOS/nixpkgs/blob/nixos-23.11/lib/modules.nix#L122-L184
|
||||
[nixpkgs/nixos-23.11/nixos/doc/manual/development/option-types.section.md#L237-L244]:
|
||||
https://github.com/NixOS/nixpkgs/blob/nixos-23.11/nixos/doc/manual/development/option-types.section.md?plain=1#L237-L244
|
||||
https://github.com/NixOS/nixpkgs/blob/24.11/doc/module-system/module-system.chapter.md
|
||||
[nixpkgs/nixos-24.11/lib/modules.nix - _module.args]:
|
||||
https://github.com/NixOS/nixpkgs/blob/nixos-24.11/lib/modules.nix#L122-L184
|
||||
[nixpkgs/nixos-24.11/nixos/doc/manual/development/option-types.section.md#L237-L244]:
|
||||
https://github.com/NixOS/nixpkgs/blob/nixos-24.11/nixos/doc/manual/development/option-types.section.md?plain=1#L237-L244
|
||||
|
||||
|
||||
|
@ -69,8 +69,8 @@ cat flake.nix
|
||||
description = "A simple NixOS flake";
|
||||
|
||||
inputs = {
|
||||
# NixOS 官方软件源,这里使用 nixos-23.11 分支
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
|
||||
# NixOS 官方软件源,这里使用 nixos-24.11 分支
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, ... }@inputs: {
|
||||
@ -124,12 +124,12 @@ cat flake.nix
|
||||
|
||||
[nix flake - Nix Manual]:
|
||||
https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-flake#flake-inputs
|
||||
[nixpkgs/flake.nix]: https://github.com/NixOS/nixpkgs/tree/nixos-23.11/flake.nix
|
||||
[nixpkgs/flake.nix]: https://github.com/NixOS/nixpkgs/tree/nixos-24.11/flake.nix
|
||||
[nixpkgs/nixos/lib/eval-config.nix]:
|
||||
https://github.com/NixOS/nixpkgs/tree/nixos-23.11/nixos/lib/eval-config.nix
|
||||
https://github.com/NixOS/nixpkgs/tree/nixos-24.11/nixos/lib/eval-config.nix
|
||||
[Module System - Nixpkgs]:
|
||||
https://github.com/NixOS/nixpkgs/blob/23.11/doc/module-system/module-system.chapter.md
|
||||
[nixpkgs/nixos-23.11/lib/modules.nix - _module.args]:
|
||||
https://github.com/NixOS/nixpkgs/blob/nixos-23.11/lib/modules.nix#L122-L184
|
||||
[nixpkgs/nixos-23.11/nixos/doc/manual/development/option-types.section.md#L237-L244]:
|
||||
https://github.com/NixOS/nixpkgs/blob/nixos-23.11/nixos/doc/manual/development/option-types.section.md?plain=1#L237-L244
|
||||
https://github.com/NixOS/nixpkgs/blob/24.11/doc/module-system/module-system.chapter.md
|
||||
[nixpkgs/nixos-24.11/lib/modules.nix - _module.args]:
|
||||
https://github.com/NixOS/nixpkgs/blob/nixos-24.11/lib/modules.nix#L122-L184
|
||||
[nixpkgs/nixos-24.11/nixos/doc/manual/development/option-types.section.md#L237-L244]:
|
||||
https://github.com/NixOS/nixpkgs/blob/nixos-24.11/nixos/doc/manual/development/option-types.section.md?plain=1#L237-L244
|
||||
|
@ -163,7 +163,7 @@ manager 作为 NixOS 模块安装,首先需要创建 `/etc/nixos/home.nix`,
|
||||
# You can update Home Manager without changing this value. See
|
||||
# the Home Manager release notes for a list of state version
|
||||
# changes in each release.
|
||||
home.stateVersion = "23.11";
|
||||
home.stateVersion = "24.11";
|
||||
|
||||
# Let Home Manager install and manage itself.
|
||||
programs.home-manager.enable = true;
|
||||
@ -184,10 +184,10 @@ nix flake new example -t github:nix-community/home-manager#nixos
|
||||
description = "NixOS configuration";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-23.11";
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
|
||||
# home-manager, used for managing user configuration
|
||||
home-manager = {
|
||||
url = "github:nix-community/home-manager/release-23.11";
|
||||
url = "github:nix-community/home-manager/release-24.11";
|
||||
# The `follows` keyword in inputs is used for inheritance.
|
||||
# Here, `inputs.nixpkgs` of home-manager is kept consistent with
|
||||
# the `inputs.nixpkgs` of the current flake,
|
||||
|
@ -4,10 +4,10 @@
|
||||
`options` 实际都在这两个位置定义:
|
||||
|
||||
- NixOS:
|
||||
[nixpkgs/nixos/modules](https://github.com/NixOS/nixpkgs/tree/23.11/nixos/modules), 我们
|
||||
[nixpkgs/nixos/modules](https://github.com/NixOS/nixpkgs/tree/24.11/nixos/modules), 我们
|
||||
在 <https://search.nixos.org/options> 中能看到的所有 NixOS options 都是在这里定义的。
|
||||
- Home Manager:
|
||||
[home-manager/modules](https://github.com/nix-community/home-manager/blob/release-23.11/modules):
|
||||
[home-manager/modules](https://github.com/nix-community/home-manager/blob/release-24.11/modules):
|
||||
可在 <https://nix-community.github.io/home-manager/options.xhtml> 中找到其所有的options.
|
||||
|
||||
> 如果你还使用 nix-darwin,那么它的配置也是类似的,其模块系统的实现位于
|
||||
@ -196,7 +196,7 @@ foo 的自定义配置了,示例:
|
||||
# ./flake.nix
|
||||
{
|
||||
description = "NixOS Flake for Test";
|
||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
|
||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
|
||||
|
||||
outputs = {nixpkgs, ...}: {
|
||||
nixosConfigurations = {
|
||||
@ -293,7 +293,7 @@ options 的声明与类型检查。
|
||||
# ./flake.nix
|
||||
{
|
||||
description = "NixOS Flake for Test";
|
||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
|
||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
|
||||
|
||||
outputs = {nixpkgs, ...}: {
|
||||
nixosConfigurations = {
|
||||
@ -355,7 +355,7 @@ options 的声明与类型检查。
|
||||
# ./flake.nix
|
||||
{
|
||||
description = "NixOS Flake for Test";
|
||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
|
||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
|
||||
|
||||
outputs = {nixpkgs, ...}: {
|
||||
nixosConfigurations = {
|
||||
@ -404,14 +404,14 @@ options 的声明与类型检查。
|
||||
- [Module System - Nixpkgs][Module System - Nixpkgs]
|
||||
- [Writing NixOS Modules - Nixpkgs][Writing NixOS Modules - Nixpkgs]
|
||||
|
||||
[lib/modules.nix]: https://github.com/NixOS/nixpkgs/blob/23.11/lib/modules.nix#L995
|
||||
[lib/modules.nix]: https://github.com/NixOS/nixpkgs/blob/24.11/lib/modules.nix#L995
|
||||
[Module System - Nixpkgs]:
|
||||
https://github.com/NixOS/nixpkgs/blob/23.11/doc/module-system/module-system.chapter.md
|
||||
https://github.com/NixOS/nixpkgs/blob/24.11/doc/module-system/module-system.chapter.md
|
||||
[Writing NixOS Modules - Nixpkgs]:
|
||||
https://github.com/NixOS/nixpkgs/blob/nixos-23.11/nixos/doc/manual/development/writing-modules.chapter.md
|
||||
https://github.com/NixOS/nixpkgs/blob/nixos-24.11/nixos/doc/manual/development/writing-modules.chapter.md
|
||||
[Option Definitions - NixOS]:
|
||||
https://github.com/NixOS/nixpkgs/blob/nixos-23.11/nixos/doc/manual/development/option-def.section.md
|
||||
https://github.com/NixOS/nixpkgs/blob/nixos-24.11/nixos/doc/manual/development/option-def.section.md
|
||||
[Option Declarations - NixOS]:
|
||||
https://github.com/NixOS/nixpkgs/blob/nixos-23.11/nixos/doc/manual/development/option-declarations.section.md
|
||||
https://github.com/NixOS/nixpkgs/blob/nixos-24.11/nixos/doc/manual/development/option-declarations.section.md
|
||||
[Options Types - NixOS]:
|
||||
https://github.com/NixOS/nixpkgs/blob/nixos-23.11/nixos/doc/manual/development/option-types.section.md
|
||||
https://github.com/NixOS/nixpkgs/blob/nixos-24.11/nixos/doc/manual/development/option-types.section.md
|
||||
|
@ -75,16 +75,16 @@
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1701802827,
|
||||
"narHash": "sha256-wTn0lpV75Uv6tU6haEypNsmnJJPb0hpaMIy/4uf5AiQ=",
|
||||
"lastModified": 1731755305,
|
||||
"narHash": "sha256-v5P3dk5JdiT+4x69ZaB18B8+Rcu3TIOrcdG4uEX7WZ8=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "a804fc878d7ba1558b960b4c64b0903da426ac41",
|
||||
"rev": "057f63b6dc1a2c67301286152eb5af20747a9cb4",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-23.11",
|
||||
"ref": "nixos-24.11",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
description = "A Nix-flake-based Node.js development environment";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
pre-commit-hooks.url = "github:cachix/pre-commit-hooks.nix";
|
||||
};
|
||||
@ -17,7 +17,7 @@
|
||||
overlays = [
|
||||
(self: super: rec {
|
||||
nodejs = super.nodejs_20;
|
||||
pnpm = super.nodePackages.pnpm;
|
||||
pnpm = super.pnpm.override {inherit nodejs;};
|
||||
yarn = super.yarn.override {inherit nodejs;};
|
||||
prettier = super.nodePackages.prettier;
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user