Flakes: Difference between revisions

imported>Ryan4yin
No edit summary
imported>Ryan4yin
feat: update flake's input schema
Line 82: Line 82:
{
{
   inputs = {
   inputs = {
     # GitHub example, also supports GitLab:
     # use master branch of the GitHub repository as input, this is the most common input format
     nixpkgs.url = "github:Mic92/nixpkgs/master";
     nixpkgs.url = "github:Mic92/nixpkgs/master";
     # Git urls
     # 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";
     git-example.url = "git+https://git.somehost.tld/user/path?ref=branch&rev=fdc8ef970de2b4634e1b3dca296e1ed918459a9e";
    # The example above will also copy .git, use this for (shallow) local Git repos
    git-directory-example.url = "git+file:/path/to/repo?shallow=1";
     # Local directories (for absolute paths you can omit 'path:')
     # Local directories (for absolute paths you can omit 'path:')
     directory-example.url = "path:/path/to/repo";
     directory-example.url = "path:/path/to/repo";
    # The above url will also copy .git, use this for (shallow) local Git repos
 
     git-directory-example.url = "git+file:/path/to/repo?shallow=1"
     bar = {
    # Use this for non-flakes
      url = "github:foo/bar/branch";
    bar.url = "github:foo/bar/branch";
      # if the input is not a flake, you need to set flake=false
    bar.flake = false;
      flake = false;
     # Overwrite inputs in a flake
     };
    # This is useful to use the same nixpkgs version in both flakes
 
     sops-nix.url = "github:Mic92/sops-nix";
     sops-nix = {
    sops-nix.inputs.nixpkgs.follows = "nixpkgs";
      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
     # Pin flakes to a specific revision
     nix-doom-emacs.url = "github:vlaci/nix-doom-emacs?rev=238b18d7b2c8239f676358634bfb32693d3706f3";
     nix-doom-emacs = {
    nix-doom-emacs.flake = false;
      url = "github:vlaci/nix-doom-emacs?rev=238b18d7b2c8239f676358634bfb32693d3706f3";
     # To use a subdirectory of a repo, pass dir=
      flake = false;
    };
 
     # To use a subdirectory of a repo, pass `dir=xxx`
     nixpkgs.url = "github:foo/bar?dir=shu";
     nixpkgs.url = "github:foo/bar?dir=shu";
   }
   }