Flakes: Difference between revisions

imported>Artturin
pinning registry
imported>Artturin
Replace input schema section with links
Line 79: Line 79:
=== Input schema ===
=== Input schema ===


This is not a complete schema but should be enough to get you started:
[https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-flake.html#flake-inputs The nix flake inputs manual].
 
[https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-flake.html#flake-references The nix flake references manual].
<syntaxHighlight lang=nix>
{
  inputs = {
    # use release 23.05 branch of the GitHub repository as input, this is the most common input format
    nixpkgs.url = "github:NixOS/nixpkgs/release-23.05";
    # Git URL, can be used for any Git repository based on https/ssh protocol
    git-example.url = "git+https://git.somehost.tld/user/path?ref=branch&rev=fdc8ef970de2b4634e1b3dca296e1ed918459a9e";
 
    # Local directories (for absolute paths you can omit 'path:'), this will also copy .git
    directory-example.url = "path:/path/to/repo";
    #  To avoid copying .git (for shallow clones, add `?shallow=1` at the end)
    git-directory-example.url = "git+file:/path/to/repo";
    # You have a local copy of a git fork and are working on a new branch
    forked-git-flake.url = "git+file:/home/user/forked-flake?branch=feat/myNewFeature"
 
    bar = {
      url = "github:foo/bar/branch";
      # if the input is not a flake, you need to set flake=false
      flake = false;
    };
 
    sops-nix = {
      url = "github:Mic92/sops-nix";
      # The `follows` keyword in inputs is used for inheritance.
      # Here, `inputs.nixpkgs` of sops-nix is kept consistent with the `inputs.nixpkgs` of
      # the current flake, to avoid problems caused by different versions of nixpkgs.
      inputs.nixpkgs.follows = "nixpkgs";
    };
 
    # Pin flakes to a specific revision
    nix-doom-emacs = {
      url = "github:vlaci/nix-doom-emacs?rev=238b18d7b2c8239f676358634bfb32693d3706f3";
      flake = false;
    };
 
    # To use a subdirectory of a repo, pass `dir=xxx`
    nixpkgs.url = "github:foo/bar?dir=shu";
  }
}
</syntaxHighlight>
Also see [https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-flake.html#flake-references the nix flake manual].
 
The bar input is then passed to the output schema


=== Output schema ===
=== Output schema ===