aleeusgr / nix-things

a toolbox
1 stars 0 forks source link

Nix from First Principles: Flake Edition #6

Closed aleeusgr closed 1 year ago

aleeusgr commented 1 year ago

https://tonyfinn.com/blog/nix-from-first-principles-flake-edition/

aleeusgr commented 1 year ago

nix profile install nixpkgs#ripgrep

NobbZ — Today at 17:33 It inherits the same problems that come from imperative package management. [17:33] It doesn't have the weird version handling that nix-env has though. So it is better, but I wouldn't use it either. [17:33] You can as well just use apt or brew then, doesn't make any difference…

aleeusgr commented 1 year ago

https://tonyfinn.com/blog/nix-from-first-principles-flake-edition/nix-4-just-enough-nixlang/ nix repl path datatype set ~ dict Functional P, currying Let, With, Inherit

aleeusgr commented 1 year ago

The Nix language is

domain-specific

It only exists for the Nix package manager: to describe packages and configurations as well as their variants and compositions. It is not intended for general purpose use.

declarative

There is no notion of executing sequential steps. Dependencies between operations are established only through data.

pure

Values cannot change during computation. Functions always produce the same output if their input does not change.

functional

Functions are like any other value. Functions can be assigned to names, taken as arguments, or returned by functions.

lazy

Expressions are only evaluated when their value is needed.

dynamically typed

Type errors are only detected when expressions are evaluated.

aleeusgr commented 1 year ago

Derivations

A Nix derivation is a special type of set created from the derivation function which describes how to obtain and build a package.