initial commit
This commit is contained in:
commit
2a7e98a865
|
@ -0,0 +1,4 @@
|
|||
if ! has nix_direnv_version || ! nix_direnv_version 3.0.4; then
|
||||
source_url "https://raw.githubusercontent.com/nix-community/nix-direnv/3.0.4/direnvrc" "sha256-DzlYZ33mWF/Gs8DDeyjr8mnVmQGx7ASYqA5WlxwvBG4="
|
||||
fi
|
||||
use flake
|
|
@ -0,0 +1,27 @@
|
|||
name: Build & Push
|
||||
|
||||
run-name: Build and push OCI image
|
||||
|
||||
on:
|
||||
push:
|
||||
|
||||
jobs:
|
||||
build-push:
|
||||
name: Build & Push
|
||||
runs-on: debian-docker
|
||||
env:
|
||||
GITEA_REGISTRY: gitea.antoine-langlois.net
|
||||
|
||||
steps:
|
||||
- name: Log into Gitea registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.GITEA_REGISTRY }}
|
||||
username: ${{ gitea.repository_owner }}
|
||||
password: ${{ secrets.REGISTRY_TOKEN }}
|
||||
|
||||
- name: Build & push
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
push: true
|
||||
tags: ${{ env.GITEA_REGISTRY }}/${{ gitea.repository_owner }}/${{ gitea.repository }}:latest
|
|
@ -0,0 +1,2 @@
|
|||
/.direnv
|
||||
/site
|
|
@ -0,0 +1,18 @@
|
|||
FROM rust:1 as builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
RUN cargo install --root . miniserve
|
||||
|
||||
FROM gcr.io/distroless/cc-debian12
|
||||
|
||||
WORKDIR /docs
|
||||
|
||||
COPY --from=builder /app/bin/miniserve /miniserve
|
||||
COPY site/ .
|
||||
|
||||
ENV MINISERVE_INDEX="index.html"
|
||||
ENV MINISERVE_PORT=80
|
||||
|
||||
CMD ["/miniserve", "--pretty-urls", "/docs"]
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
---
|
||||
hide:
|
||||
- navigation
|
||||
---
|
||||
|
||||
# Welcome to MkDocs
|
||||
|
||||
For full documentation visit [mkdocs.org](https://www.mkdocs.org).
|
||||
|
||||
## Commands
|
||||
|
||||
* `mkdocs new [dir-name]` - Create a new project.
|
||||
* `mkdocs serve` - Start the live-reloading docs server.
|
||||
* `mkdocs build` - Build the documentation site.
|
||||
* `mkdocs -h` - Print help message and exit.
|
||||
|
||||
## Project layout
|
||||
|
||||
mkdocs.yml # The configuration file.
|
||||
docs/
|
||||
index.md # The documentation homepage.
|
||||
... # Other markdown pages, images and other files.
|
|
@ -0,0 +1,93 @@
|
|||
# Builtins
|
||||
|
||||
- **`toString`:** Converts a value to its string representation.
|
||||
```nix
|
||||
builtins.toString 42 # Output: "42"
|
||||
```
|
||||
|
||||
- **`length`:** Returns the number of elements in a list or string.
|
||||
```nix
|
||||
builtins.length [1 2 3] # Output: 3
|
||||
builtins.length "Hello" # Output: 5
|
||||
```
|
||||
|
||||
- **`elem`:** Checks if an element is present in a list or string.
|
||||
```nix
|
||||
builtins.elem 2 [1 2 3] # Output: true
|
||||
builtins.elem "o" "Hello" # Output: true
|
||||
```
|
||||
|
||||
- **`head`:** Returns the first element of a list.
|
||||
```nix
|
||||
builtins.head [1 2 3] # Output: 1
|
||||
```
|
||||
|
||||
- **`tail`:** Returns all but the first element of a list.
|
||||
```nix
|
||||
builtins.tail [1 2 3] # Output: [2 3]
|
||||
```
|
||||
|
||||
- **`map`:** Applies a function to each element of a list.
|
||||
```nix
|
||||
builtins.map (x: x * 2) [1 2 3] # Output: [2 4 6]
|
||||
```
|
||||
|
||||
- **`filter`:** Filters a list based on a predicate function.
|
||||
```nix
|
||||
builtins.filter (x: x > 2) [1 2 3] # Output: [3]
|
||||
```
|
||||
|
||||
- **`foldl`:** Performs a left fold on a list.
|
||||
```nix
|
||||
builtins.foldl (x: y: x + y) 0 [1 2 3] # Output: 6
|
||||
```
|
||||
|
||||
- **`concatLists`:** Concatenates multiple lists into a single list.
|
||||
```nix
|
||||
builtins.concatLists [[1 2] [3 4]] # Output: [1 2 3 4]
|
||||
```
|
||||
|
||||
- **`split`:** Splits a string into a list of substrings based on a delimiter.
|
||||
```nix
|
||||
builtins.split ":" "foo:bar:baz" # Output: ["foo" "bar" "baz"]
|
||||
```
|
||||
|
||||
- **`elemAt`:** Retrieves the element at a specific index in a list.
|
||||
```nix
|
||||
builtins.elemAt 1 [10 20 30] # Output: 20
|
||||
```
|
||||
|
||||
- **`intersectAttrs`:** Finds the intersection of attributes in two sets.
|
||||
```nix
|
||||
builtins.intersectAttrs { a = 1; b = 2; } { b = 2; c = 3; } # Output: { b = 2; }
|
||||
```
|
||||
|
||||
- **`sub`:** Subtracts one integer from another.
|
||||
```nix
|
||||
builtins.sub 10 5 # Output: 5
|
||||
```
|
||||
|
||||
- **`mul`:** Multiplies two integers.
|
||||
```nix
|
||||
builtins.mul 5 2 # Output: 10
|
||||
```
|
||||
|
||||
- **`div`:** Divides one integer by another.
|
||||
```nix
|
||||
builtins.div 10 2 # Output: 5
|
||||
```
|
||||
|
||||
- **`mod`:** Returns the remainder of dividing one integer by another.
|
||||
```nix
|
||||
builtins.mod 10 3 # Output: 1
|
||||
```
|
||||
|
||||
- **`parseDrvName`:** Parses a Nix store path and returns a derivation name.
|
||||
```nix
|
||||
builtins.parseDrvName "/nix/store/abcdefg.drv" # Output: "abcdefg"
|
||||
```
|
||||
|
||||
- **`toString`:** Converts a value to its string representation.
|
||||
```nix
|
||||
builtins.toString true # Output: "true"
|
||||
```
|
|
@ -0,0 +1,51 @@
|
|||
# Fetchers
|
||||
|
||||
`Nix` and `Nixpkgs` have multiple fetchers function to retrieve information (files, repository) and store them inside the `nix store`.
|
||||
|
||||
## Available fetchers
|
||||
|
||||
As stated above, 2 types of fetchers exit. `builtins` ones and those from `Nixpkgs`.
|
||||
Key differences are:
|
||||
|
||||
1. `builtins` are runned at evaluation time. While `Nixpkgs` are runned at build time.
|
||||
2. `builtins` produced a `path` to downloaded content. While `Nixpkgs` produced a `derivation`.
|
||||
|
||||
!!! info "Argument convention"
|
||||
|
||||
### Icons
|
||||
- :material-alert:{ .alert-icon } : Required argument
|
||||
- :octicons-question-24:{.optional-icon} : Optional argument
|
||||
|
||||
### Content
|
||||
- `hash`: Must be a valid [`SRI`](https://developer.mozilla.org/fr/docs/Web/Security/Subresource_Integrity) hash. You can replace the argument `hash` by any supported hash algorithm (sha256, sha512, etc), and its content doesn't need to be a [`SRI`](https://developer.mozilla.org/fr/docs/Web/Security/Subresource_Integrity). By convention, `hash` is preferred.
|
||||
|
||||
### `Nixpkgs` fetchers
|
||||
|
||||
| Function | Description | Arguments |
|
||||
| --- | --- | --- |
|
||||
| [`fetchurl`](https://nixos.org/manual/nixpkgs/stable/#fetchurl){:target="_blank"} | Fetch remote resource without modification. | - :material-alert:{.alert-icon} `hash` <br /> - :material-alert:{.alert-icon} `url` |
|
||||
| [`fetchzip`](https://nixos.org/manual/nixpkgs/stable/#fetchurl){:target="_blank"} | Fetch remote resource and extract it (tarball or zip). | - :material-alert:{.alert-icon} `hash` <br /> - :material-alert:{.alert-icon} `url` |
|
||||
| [`fetchpatch`](https://nixos.org/manual/nixpkgs/stable/#fetchpatch){:target="_blank"} | Fetch remote `patch` file and normalize its content (remove comments or any other unstable parts). | - :material-alert:{.alert-icon} `hash` <br /> - :material-alert:{.alert-icon} `url` |
|
||||
| [`fetchDebianPatch`](https://nixos.org/manual/nixpkgs/stable/#fetchdebianpatch){:target="_blank"} | Fetch `patch` file from <https://sources.debian.org> | - :material-alert:{.alert-icon} `pname` <br /> - :material-alert:{.alert-icon} `version` <br /> - :material-alert:{.alert-icon} `hash` <br /> - :material-alert:{.alert-icon} `patch` <br /> - :octicons-question-24:{.optional-icon} `debianRevision` <br /> - :octicons-question-24:{.optional-icon} `name` (default to `patch` arg) <br /> - :octicons-question-24:{.optional-icon} `area` (default to `main`) |
|
||||
| [`fetchsvn`](https://nixos.org/manual/nixpkgs/stable/#fetchsvn){:target="_blank"} | Fetch resource from [`SVN`](https://subversion.apache.org/). | - :material-alert:{.alert-icon} `hash` <br /> - :material-alert:{.alert-icon} `url` <br /> - :octicons-question-24:{.optional-icon} rev (default to `HEAD`) <br /> |
|
||||
| [`fetchgit`](https://nixos.org/manual/nixpkgs/stable/#fetchgit){:target="_blank"} | | |
|
||||
| [`fetchfosille`](https://nixos.org/manual/nixpkgs/stable/#fetchfosille){:target="_blank"} | | |
|
||||
| [`fetchcvs`](https://nixos.org/manual/nixpkgs/stable/#fetchcvs){:target="_blank"} | | |
|
||||
| [`fetchhg`](https://nixos.org/manual/nixpkgs/stable/#fetchhg){:target="_blank"} | | |
|
||||
| [`fetchFromGitea`](https://nixos.org/manual/nixpkgs/stable/#fetchfromgitea){:target="_blank"} | | |
|
||||
| [`fetchFromGitHub`](https://nixos.org/manual/nixpkgs/stable/#fetchfromgithub){:target="_blank"} | | |
|
||||
| [`fetchFromGitLab`](https://nixos.org/manual/nixpkgs/stable/#fetchfromgitlab){:target="_blank"} | | |
|
||||
| [`fetchFromGitiles`](https://nixos.org/manual/nixpkgs/stable/#fetchfromgitiles){:target="_blank"} | | |
|
||||
| [`fetchFromBitbucket`](https://nixos.org/manual/nixpkgs/stable/#fetchfrombitbucket){:target="_blank"} | | |
|
||||
| [`fetchFromSavannah`](https://nixos.org/manual/nixpkgs/stable/#fetchfromsavannah){:target="_blank"} | | |
|
||||
| [`fetchFromRepoOrCz`](https://nixos.org/manual/nixpkgs/stable/#fetchfromrepoorcz){:target="_blank"} | | |
|
||||
| [`fetchfromsourcehut`](https://nixos.org/manual/nixpkgs/stable/#fetchfromsourcehut){:target="_blank"} | | |
|
||||
| [`requireFile`](https://nixos.org/manual/nixpkgs/stable/#requirefile){:target="_blank"} | | |
|
||||
| [`fetchtorrent`](https://nixos.org/manual/nixpkgs/stable/#fetchtorrent){:target="_blank"} | | |
|
||||
|
||||
### `builtins` fetchers
|
||||
|
||||
| Function | Description | Arguments |
|
||||
| --- | --- | --- |
|
||||
| [`fetchClosure`](https://nixos.org/manual/nix/stable/language/builtins#builtins-fetchClosure) | | |
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
# Nix
|
||||
|
||||
Nix is a powerful package manager and build system that offers a unique approach to managing software dependencies and environments. Unlike traditional package managers, Nix employs a purely functional paradigm, which ensures reproducibility, atomic upgrades, and precise dependency management. This overview provides insight into the fundamental concepts and features of Nix.
|
||||
|
||||
## Nix - Package manager
|
||||
|
||||
As stated above, `Nix` is mainly a package manager available for every major operating system (`MacOS`, `Linux`, `Windows`) but it also provides a [Docker](https://www.docker.com) image.
|
||||
|
||||
You can find the detailed steps and available options on [nixos.org](https://nixos.org/download)
|
||||
|
||||
## NixOS - Linux based operating system
|
||||
|
||||
On the other hand, `Nix` comes as a `Linux` based operating system. It diverges from traditional distributions by embracing the principles of Nix, a purely functional package manager and build system. NixOS provides a novel approach to system configuration and package management, offering declarative, reproducible, and atomic system configurations.
|
||||
Everything is declared in a `configuration.nix` file. Every bit of the configured system is reproducible on any other `NixOS` installation by importing the `configuration.nix` onto it.
|
||||
|
||||
To install `NixOS`, go to [nixos.org](https://nixos.org/download), download either the `Graphical ISO image` for a complete system (choose your DE in the list) or the `Minimal ISO image`.
|
||||
Note, `NixOS` also comes in a [Virtual Box](https://www.virtualbox.org/) image. Cool, right ? As this wasn't enough, they give you a CLI command to spawn an [EC2](https://aws.amazon.com/fr/ec2/) instance.
|
||||
|
||||
## Nix-Darwin - NixOS layer for MacOS
|
||||
|
||||
[nix-darwin](https://github.com/LnL7/nix-darwin) is a project that brings the power of the Nix package manager and the declarative configuration style of NixOS to macOS systems. It allows macOS users to manage their system configuration, install software, and maintain their environment using Nix principles. This overview provides insight into the key concepts, features, and components of nix-darwin.
|
|
@ -0,0 +1,7 @@
|
|||
.alert-icon {
|
||||
color: #E73E4A
|
||||
}
|
||||
|
||||
.optional-icon {
|
||||
color: #1C68B3
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"inputs": {
|
||||
"systems": "systems"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1710146030,
|
||||
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1710669607,
|
||||
"narHash": "sha256-kNj0Ka1/rkQRcigYTa1c5B6IcFuxDgM3s9jYuKUhxyM=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "6af7e814afb3b62171eee1edc31989ee61528d25",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
},
|
||||
"systems": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
description = "A basic flake with a shell";
|
||||
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||
inputs.flake-utils.url = "github:numtide/flake-utils";
|
||||
|
||||
outputs = { nixpkgs, flake-utils, ... }:
|
||||
flake-utils.lib.eachDefaultSystem (system:
|
||||
let
|
||||
pkgs = nixpkgs.legacyPackages.${system};
|
||||
in
|
||||
{
|
||||
devShells.default = pkgs.mkShell {
|
||||
packages = with pkgs; [
|
||||
(python3.withPackages (pypkgs: with pypkgs; [
|
||||
mkdocs-material
|
||||
]))
|
||||
];
|
||||
};
|
||||
});
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
site_name: Documentation registry
|
||||
|
||||
repo_url: https://gitea.antoine-langlois.net/DataHearth/global-docs
|
||||
repo_name: DataHearth/global-docs
|
||||
edit_uri: _edit/main/docs
|
||||
|
||||
theme:
|
||||
name: material
|
||||
custom_dir: overrides
|
||||
icon:
|
||||
repo: simple/gitea
|
||||
edit: material/pencil
|
||||
view: material/eye
|
||||
|
||||
features:
|
||||
- navigation.tabs
|
||||
- navigation.indexes
|
||||
- navigation.top
|
||||
- content.code.copy
|
||||
- content.code.annotate
|
||||
- content.action.edit
|
||||
- content.action.view
|
||||
|
||||
nav:
|
||||
- Home: index.md
|
||||
- Nix:
|
||||
- nix/index.md
|
||||
- nix/fetchers.md
|
||||
- API references:
|
||||
- nix/api_references/builtins.md
|
||||
|
||||
markdown_extensions:
|
||||
- pymdownx.highlight:
|
||||
anchor_linenums: true
|
||||
line_spans: __span
|
||||
pygments_lang_class: true
|
||||
- pymdownx.emoji:
|
||||
emoji_generator: !!python/name:material.extensions.emoji.to_svg
|
||||
emoji_index: !!python/name:material.extensions.emoji.twemoji
|
||||
- pymdownx.inlinehilite
|
||||
- pymdownx.snippets
|
||||
- pymdownx.superfences
|
||||
- pymdownx.details
|
||||
- attr_list
|
||||
- md_in_html
|
||||
- admonition
|
||||
|
||||
extra_css:
|
||||
- stylesheets/extra.css
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
<a
|
||||
href="{{ config.repo_url }}"
|
||||
title="{{ lang.t('source') }}"
|
||||
class="md-source"
|
||||
>
|
||||
<div class="md-source__icon md-icon">
|
||||
{% set icon = config.theme.icon.repo or "fontawesome/brands/git-alt" %}
|
||||
{% include ".icons/" ~ icon ~ ".svg" %}
|
||||
</div>
|
||||
<div class="md-source__repository">
|
||||
{{ config.repo_name }}
|
||||
</div>
|
||||
</a>
|
Loading…
Reference in New Issue