michalrus / std

The Nix Flakes framework for perfectionists with deadlines [maintainer=@blaggacao]

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Standard

Ship today with architecture for tomorrow

Standard is THE opinionated, generic, Nix Flakes framework that will allow you to grow and cultivate Nix Cells with ease.

Nix Cells are the fine art of code organization using flakes.

As a Nix Cell Cultivator, you can focus on building for your use cases and ride on the marvels of nix flakes while wasting virtually no thoughts on boilerplate code organization.

Because Standard is a proper framework, you benefit from continued performance and feature upgrades over time with minimum effort. ✨

Code Organization

Standard has a pre-defined place for all your code. Packages, applications, functions, libraries, modules, profiles: they all have a home.

Developer Experience

Standard projects are as declarative as possible; we eliminate most boilerplate; zero-config workflows... everything Just Works™.

DevOps Professionals,nix-loving

Standard doesn't just throw more options at you. It gives you and your team something much more valuable: guidance.

How it's organized

Standard places all the code in a directory of your choice.

Related code is grouped into Cells that can be composed together to form any functionality you can imagine.

A Cell provides functionality through Organelles of Clade:

  • Runnables
  • Installables
  • Functions
  • Data

The built-in default Organelles are:

  • Applications (Runnables)

    Instructions that can be run. For example: cd, ls, and cat are applications.

  • Packages (Installables)

    Contents (files and/or directories) generated in a pure and reproducible way, also known as derivations.

  • Libraries (Functions)

    Instructions on how to turn the given inputs into something else.

    They act like a library that you and others can use in order to abstract, share and re-use code.

A potential alternative to the default Organelle types could be:

  • NixOS Modules (Functions)
  • NixOS Profiles (Functions)
  • DevShell Profiles (Functions)
  • Just Tasks (Runnables)
  • Entrypoints (Runnables)

Hello World application

Standard features a special project structure that brings some awesome innovation to this often overlooked (but important) part of your project. With the default Organelles, an app.nix file tells Standard that we are creating an Application. flake.nix is in charge of explicitly defining the inputs of your project.

  • /my/project

    • /flake.nix

      {
        inputs.std.url = "github:divnix/std";
      
        outputs = { std, ... } @ inputs:
          std.grow {
            inherit inputs;
            cellsFrom = ./cells;
          };
      }
    • /cells

      • /hello

        • /app.nix

          { inputs
          , cell
          }:
          inputs.nixpkgs.stdenv.mkDerivation rec {
            pname = "hello";
            version = "2.10";
            src = inputs.nixpkgs.fetchurl {
              url = "mirror://gnu/hello/${pname}-${version}.tar.gz";
              sha256 = "0ssi1wpaf7plaswqqjwigppsg5fyh99vdlb9kzl7c9lng89ndq1i";
            };
          }
$ nix run /my/project#hello
Hello, world!

You see? from nothing to running your first application in just a few seconds ✨

Examples

If you'd like to see some examples of what a Standard project looks like, take a look at the following:

🚧 Work in progress, would like to help us extend this section?

Contributions

Please get ourself the appropriate environment:

With direnv

direnv allow

Without direnv

nix develop ./devshell -c $SHELL
menu

About

The Nix Flakes framework for perfectionists with deadlines [maintainer=@blaggacao]


Languages

Language:Nix 62.9%Language:Scheme 33.6%Language:Shell 3.5%