pkgs.nixos: Add example to inline documentation
This commit is contained in:
parent
863a795281
commit
c3a7194843
@ -22097,38 +22097,53 @@ with pkgs;
|
|||||||
|
|
||||||
nixops-dns = callPackage ../tools/package-management/nixops/nixops-dns.nix { };
|
nixops-dns = callPackage ../tools/package-management/nixops/nixops-dns.nix { };
|
||||||
|
|
||||||
/*
|
/* Evaluate a NixOS configuration using this evaluation of Nixpkgs.
|
||||||
* Evaluate a NixOS configuration using this evaluation of Nixpkgs.
|
|
||||||
*
|
With this function you can write, for example, a package that
|
||||||
* With this function you can write, for example, a package that
|
depends on a custom virtual machine image.
|
||||||
* depends on a custom virtual machine image.
|
|
||||||
*
|
Parameter: A module, path or list of those that represent the
|
||||||
* Parameter: A module, path or list of those that represent the
|
configuration of the NixOS system to be constructed.
|
||||||
* configuration of the NixOS system to be constructed.
|
|
||||||
*
|
Result: An attribute set containing packages produced by this
|
||||||
* Result: An attribute set containing packages produced by this
|
evaluation of NixOS, such as toplevel, kernel and
|
||||||
* evaluation of NixOS, such as toplevel, kernel and
|
initialRamdisk.
|
||||||
* initialRamdisk.
|
The result can be extended in the modules by defining
|
||||||
* The result can be extended in the modules by defining
|
extra attributes in system.build.
|
||||||
* extra options in system.build.
|
|
||||||
*
|
Example:
|
||||||
* Unlike in plain NixOS, the nixpkgs.config, nixpkgs.overlays and
|
|
||||||
* nixpkgs.system options will be ignored by default. Instead,
|
let
|
||||||
* nixpkgs.pkgs will have the default value of pkgs as it was
|
myOS = pkgs.nixos ({ lib, pkgs, config, ... }: {
|
||||||
* constructed right after invoking the nixpkgs function (e.g. the
|
|
||||||
* value of import <nixpkgs> { overlays = [./my-overlay.nix]; }
|
config.services.nginx = {
|
||||||
* but not the value of (import <nixpkgs> {} // { extra = ...; }).
|
enable = true;
|
||||||
*
|
# ...
|
||||||
* If you do want to use the config.nixpkgs options, you are
|
};
|
||||||
* probably better off by calling nixos/lib/eval-config.nix
|
|
||||||
* directly, even though it is possible to set config.nixpkgs.pkgs.
|
# This exports a runner for nginx
|
||||||
*
|
config.system.build.run-nginx = config.systemd.services.nginx.runner;
|
||||||
* For more information about writing NixOS modules, see
|
});
|
||||||
* https://nixos.org/nixos/manual/index.html#sec-writing-modules
|
in
|
||||||
*
|
myOS.run-nginx
|
||||||
* Note that you will need to have called Nixpkgs with the system
|
|
||||||
* parameter set to the right value for your deployment target.
|
Unlike in plain NixOS, the nixpkgs.config, nixpkgs.overlays and
|
||||||
*/
|
nixpkgs.system options will be ignored by default. Instead,
|
||||||
|
nixpkgs.pkgs will have the default value of pkgs as it was
|
||||||
|
constructed right after invoking the nixpkgs function (e.g. the
|
||||||
|
value of import <nixpkgs> { overlays = [./my-overlay.nix]; }
|
||||||
|
but not the value of (import <nixpkgs> {} // { extra = ...; }).
|
||||||
|
|
||||||
|
If you do want to use the config.nixpkgs options, you are
|
||||||
|
probably better off by calling nixos/lib/eval-config.nix
|
||||||
|
directly, even though it is possible to set config.nixpkgs.pkgs.
|
||||||
|
|
||||||
|
For more information about writing NixOS modules, see
|
||||||
|
https://nixos.org/nixos/manual/index.html#sec-writing-modules
|
||||||
|
|
||||||
|
Note that you will need to have called Nixpkgs with the system
|
||||||
|
parameter set to the right value for your deployment target.
|
||||||
|
*/
|
||||||
nixos = configuration:
|
nixos = configuration:
|
||||||
(import (self.path + "/nixos/lib/eval-config.nix") {
|
(import (self.path + "/nixos/lib/eval-config.nix") {
|
||||||
inherit (pkgs.stdenv.hostPlatform) system;
|
inherit (pkgs.stdenv.hostPlatform) system;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user