flake.nix.md

Flake-parts example

{
  description = "Nix flake";

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    flake-parts.url = "github:hercules-ci/flake-parts";
  };

  outputs = inputs: inputs.flake-parts.lib.mkFlake { inherit inputs; } {

    systems = [ 
      "x86_64-linux"
      "aarch64-linux"
      "x86_64-darwin"
      "aarch64-darwin"
    ];

    flake.nixosConfigurations.HOSTNAME = inputs.nixpkgs.lib.nixosSystem {
      modules = [
        ./configuration.nix
      ];
    };

    perSystem = { pkgs, ... }: {

      packages.default = pkgs.vim;

      devShells.default = pkgs.mkShell {
        packages = with pkgs; [
          git
          vim
        ];
      };

    };
  };
}

Activate the development shell

$ nix develop

Build the package

$ nix build

Run the package

$ nix run