Flakes: Difference between revisions

imported>Jcsims
m Update link due to christine.website redirect
imported>Erikarvstedt
Example flake: Update to default features to new format
Line 152: Line 152:
   packages."<system>"."<name>" = derivation;
   packages."<system>"."<name>" = derivation;
   # Executed by `nix build .`
   # Executed by `nix build .`
   # From nix >= 2.7, this is now 'packages.<system>.default'
   packages."<system>".default = derivation;
  defaultPackage."<system>" = derivation;
   # Executed by `nix run .#<name>`
   # Executed by `nix run .#<name>`
   apps."<system>"."<name>" = {
   apps."<system>"."<name>" = {
Line 160: Line 159:
   };
   };
   # Executed by `nix run . -- <args?>`
   # Executed by `nix run . -- <args?>`
   # From nix >= 2.7, this is now 'apps.<system>.default'
   apps."<system>".default = { type = "app"; program = "..."; };
  defaultApp."<system>" = { type = "app"; program = "..."; };
 
 
   # Used for nixpkgs packages, also accessible via `nix build .#<name>`
   # Used for nixpkgs packages, also accessible via `nix build .#<name>`
   legacyPackages."<system>"."<name>" = derivation;
   legacyPackages."<system>"."<name>" = derivation;
   # Default overlay, consumed by other flakes
   # Overlay, consumed by other flakes
   overlay = final: prev: { };
   overlays."<name>" = final: prev: { };
   # Same idea as overlay but a list or attrset of them.
   # Default overlay
   overlays = {};
   overlays.default = {};
   # Default module, consumed by other flakes
   # Nixos module, consumed by other flakes
   nixosModule = { config }: { options = {}; config = {}; };
   nixosModules."<name>" = { config }: { options = {}; config = {}; };
   # Same idea as nixosModule but a list or attrset of them.
   # Default module
   nixosModules = {};
   nixosModules.default = {};
   # Used with `nixos-rebuild --flake .#<hostname>`
   # Used with `nixos-rebuild --flake .#<hostname>`
   # nixosConfigurations."<hostname>".config.system.build.toplevel must be a derivation
   # nixosConfigurations."<hostname>".config.system.build.toplevel must be a derivation
   nixosConfigurations."<hostname>" = {};
   nixosConfigurations."<hostname>" = {};
  # Used by `nix develop`
  # From nix >= 2.7, this is now 'devShells.<system>.default'
  devShell."<system>" = derivation;
   # Used by `nix develop .#<name>`
   # Used by `nix develop .#<name>`
   devShells."<system>"."<name>" = derivation;
   devShells."<system>"."<name>" = derivation;
  # Used by `nix develop`
  devShells."<system>".default = derivation;
   # Hydra build jobs
   # Hydra build jobs
   hydraJobs."<attr>"."<system>" = derivation;
   hydraJobs."<attr>"."<system>" = derivation;
   # Used by `nix flake init -t <flake>`
   # Used by `nix flake init -t <flake>#<name>`
   defaultTemplate = {
   templates."<name>" = {
     path = "<store-path>";
     path = "<store-path>";
     description = "template description goes here?";
     description = "template description goes here?";
   };
   };
   # Used by `nix flake init -t <flake>#<name>`
   # Used by `nix flake init -t <flake>`
   templates."<name>" = { path = "<store-path>"; description = ""; };
   templates.default = { path = "<store-path>"; description = ""; };
}
}
</syntaxHighlight>
</syntaxHighlight>