WEYL WEYL
← Back to Weyl Standard
guides

Your First Flake

Create your first conformant flake with Weyl Standard.

Your First Flake

The Minimal Conformant Flake

{
description = "My weyl-std project";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
weyl-std.url = "github:weyl-ai/weyl-std";
};
outputs = inputs@{ flake-parts, weyl-std, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
imports = [ weyl-std.flakeModules.default ];
systems = [ "x86_64-linux" "aarch64-linux" ];
perSystem = { pkgs, ... }: {
packages.default = pkgs.hello;
devShells.default = pkgs.mkShell {
packages = [ pkgs.hello ];
};
};
};
nixConfig = {
extra-substituters = [ "https://weyl-ai.cachix.org" ];
extra-trusted-public-keys = [
"weyl-ai.cachix.org-1:cR0SpSAPw7wejZ21ep4SLojE77gp5F2os260eEWqTTw="
];
};
}

What weyl-std Provides

When you import weyl-std.flakeModules.default, you get:

ModuleDescription
formattertreefmt with nixfmt, ruff, shfmt, etc.
nixpkgsCentral nixpkgs config with CUDA support
stdOverlays and library functions
devshellDevelopment shell utilities

Adding a Package

Create nix/packages/my-tool.nix:

{ lib, stdenv }:
stdenv.mkDerivation (finalAttrs: {
pname = "my-tool";
version = "0.1.0";
src = ../../src;
meta = {
description = "My tool";
license = lib.licenses.mit;
mainProgram = "my-tool";
};
})

Then in your flake module:

perSystem = { pkgs, ... }: {
packages.my-tool = pkgs.callPackage ./nix/packages/my-tool.nix { };
};

Enabling CUDA

imports = [ weyl-std.flakeModules.default ];
weyl-std.nixpkgs.cuda.enable = true;

This configures nixpkgs with:

Next Steps