mirror of
https://github.com/ryan4yin/nixos-and-flakes-book.git
synced 2024-11-22 08:03:26 +01:00
feat: sync content in English & Chinese
This commit is contained in:
parent
3398689b90
commit
351b649294
@ -35,6 +35,8 @@
|
|||||||
|
|
||||||
# 使用 `dir` 参数指定某个子目录
|
# 使用 `dir` 参数指定某个子目录
|
||||||
nixpkgs.url = "github:foo/bar?dir=shu";
|
nixpkgs.url = "github:foo/bar?dir=shu";
|
||||||
}
|
};
|
||||||
|
|
||||||
|
outputs = { self, ... }@inputs: { ... };
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
@ -18,49 +18,54 @@
|
|||||||
NixOS Wiki 中给出的使用案例:
|
NixOS Wiki 中给出的使用案例:
|
||||||
|
|
||||||
```nix
|
```nix
|
||||||
{ self, ... }@inputs:
|
|
||||||
{
|
{
|
||||||
# Executed by `nix flake check`
|
inputs = {
|
||||||
checks."<system>"."<name>" = derivation;
|
# ......
|
||||||
# Executed by `nix build .#<name>`
|
|
||||||
packages."<system>"."<name>" = derivation;
|
|
||||||
# Executed by `nix build .`
|
|
||||||
packages."<system>".default = derivation;
|
|
||||||
# Executed by `nix run .#<name>`
|
|
||||||
apps."<system>"."<name>" = {
|
|
||||||
type = "app";
|
|
||||||
program = "<store-path>";
|
|
||||||
};
|
};
|
||||||
# Executed by `nix run . -- <args?>`
|
|
||||||
apps."<system>".default = { type = "app"; program = "..."; };
|
|
||||||
|
|
||||||
# Formatter (alejandra, nixfmt or nixpkgs-fmt)
|
outputs = { self, ... }@inputs: {
|
||||||
formatter."<system>" = derivation;
|
# Executed by `nix flake check`
|
||||||
# Used for nixpkgs packages, also accessible via `nix build .#<name>`
|
checks."<system>"."<name>" = derivation;
|
||||||
legacyPackages."<system>"."<name>" = derivation;
|
# Executed by `nix build .#<name>`
|
||||||
# Overlay, consumed by other flakes
|
packages."<system>"."<name>" = derivation;
|
||||||
overlays."<name>" = final: prev: { };
|
# Executed by `nix build .`
|
||||||
# Default overlay
|
packages."<system>".default = derivation;
|
||||||
overlays.default = {};
|
# Executed by `nix run .#<name>`
|
||||||
# Nixos module, consumed by other flakes
|
apps."<system>"."<name>" = {
|
||||||
nixosModules."<name>" = { config }: { options = {}; config = {}; };
|
type = "app";
|
||||||
# Default module
|
program = "<store-path>";
|
||||||
nixosModules.default = {};
|
};
|
||||||
# Used with `nixos-rebuild --flake .#<hostname>`
|
# Executed by `nix run . -- <args?>`
|
||||||
# nixosConfigurations."<hostname>".config.system.build.toplevel must be a derivation
|
apps."<system>".default = { type = "app"; program = "..."; };
|
||||||
nixosConfigurations."<hostname>" = {};
|
|
||||||
# Used by `nix develop .#<name>`
|
# Formatter (alejandra, nixfmt or nixpkgs-fmt)
|
||||||
devShells."<system>"."<name>" = derivation;
|
formatter."<system>" = derivation;
|
||||||
# Used by `nix develop`
|
# Used for nixpkgs packages, also accessible via `nix build .#<name>`
|
||||||
devShells."<system>".default = derivation;
|
legacyPackages."<system>"."<name>" = derivation;
|
||||||
# Hydra build jobs
|
# Overlay, consumed by other flakes
|
||||||
hydraJobs."<attr>"."<system>" = derivation;
|
overlays."<name>" = final: prev: { };
|
||||||
# Used by `nix flake init -t <flake>#<name>`
|
# Default overlay
|
||||||
templates."<name>" = {
|
overlays.default = {};
|
||||||
path = "<store-path>";
|
# Nixos module, consumed by other flakes
|
||||||
description = "template description goes here?";
|
nixosModules."<name>" = { config }: { options = {}; config = {}; };
|
||||||
|
# Default module
|
||||||
|
nixosModules.default = {};
|
||||||
|
# Used with `nixos-rebuild --flake .#<hostname>`
|
||||||
|
# nixosConfigurations."<hostname>".config.system.build.toplevel must be a derivation
|
||||||
|
nixosConfigurations."<hostname>" = {};
|
||||||
|
# Used by `nix develop .#<name>`
|
||||||
|
devShells."<system>"."<name>" = derivation;
|
||||||
|
# Used by `nix develop`
|
||||||
|
devShells."<system>".default = derivation;
|
||||||
|
# Hydra build jobs
|
||||||
|
hydraJobs."<attr>"."<system>" = derivation;
|
||||||
|
# Used by `nix flake init -t <flake>#<name>`
|
||||||
|
templates."<name>" = {
|
||||||
|
path = "<store-path>";
|
||||||
|
description = "template description goes here?";
|
||||||
|
};
|
||||||
|
# Used by `nix flake init -t <flake>`
|
||||||
|
templates.default = { path = "<store-path>"; description = ""; };
|
||||||
};
|
};
|
||||||
# Used by `nix flake init -t <flake>`
|
|
||||||
templates.default = { path = "<store-path>"; description = ""; };
|
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
Loading…
Reference in New Issue
Block a user