# Installation Npins - GLF-OS

**URL:** <https://forum.glfos.org/t/installation-npins-glf-os/178>\
**Category:** Configuration et personnalisation\
**Created:** [Septembre 26, 2026, 10:17 UTC](https://forum.glfos.org/t/installation-npins-glf-os/178 "2026-09-26T22:17:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kuraudo-Kouro](https://forum.glfos.org/user_avatar/forum.glfos.org/kuraudo-kouro/32/159_2.png) [@Kuraudo-Kouro](https://forum.glfos.org/u/Kuraudo-Kouro)\
**Post date:** [Septembre 26, 2026, 10:17 UTC](https://forum.glfos.org/t/installation-npins-glf-os/178/1 "2026-09-26T22:17:20Z")

</div>

# Installation Npins - GLF-OS

Gère les sources GitHub custom (pins / sha256) pour GLF-OS.  
Utile pour Hytale, Star Citizen (npins), ClamUI, Antigravity, etc.

Retour Hytale (npins) : [allez ici](https://forum.glfos.org/t/installation-hytale-glf-os/177)  
Star Citizen (npins) : [allez ici](https://forum.glfos.org/t/installation-star-citizen-npins-glf-os/193)  
Sous-dossiers `customConfig/` : ranger (tuto à venir)

Fichiers joints :

- `sources.nix` : expose les pins aux modules
- `verify-sources.nix` : init npins + maj auto + `glf-sha`

Les pins se déclarent dans une liste `expectedPins` : tu ajoutes / retires une ligne, `glf-sha` synchronise.

* * *

## Auto maj

Timer (via `verify-sources.nix`) :

- 3 min après le boot
- puis toutes les 12 h

Sync des pins (`add` / `remove`) puis `npins update`.  
Si `glfos-update` tourne, il attend.

Pris en compte au **prochain** rebuild (`glf-update` ou auto maj GLF).

Forcer maintenant (sync + update + rebuild) :

```bash
glf-sha

```

* * *

1. 
## Ouvrir le terminal

 ![Capture d’écran du 2026-09-20 18-24-33](https://forum.glfos.org/uploads/default/original/1X/7596d6093af5c0233811a8a74c63f65444d3683c.png)

* * *

1. 
## Créer `sources.nix`

```bash
sudo nano /etc/nixos/customConfig/sources.nix

```

Recopiez/collez le code.  
(Clic droit dans le terminal, puis Coller.)

> **Code à recopier - sources.nix**
>
> ```nix
> # ------ sources.nix ------
> # Registre des sources externes (npins).
> # Maj des sha : glf-sha
> #
> # ---- ajouter une app ----
> # 1. Ajoute le pin dans verify-sources.nix (expectedPins)
> # 2. glf-sha
> # 3. Expose ici : mon-app = sources.nom-du-repo or null;
> # 4. Dans ton module : sources.mon-app
> #
> # ---- virer une app ----
> # 1. Commente / retire la ligne dans expectedPins
> # 2. Commente / retire le bloc ici
> # 3. glf-sha
> #
> { pkgs }:
> 
> let
> sources = if builtins.pathExists ./npins
> then import ./npins {}
> else {};
> in
> {
> # ------ Hytale ------
> # hytale-launcher = sources.hytale-launcher-nix or null;
> 
> # ------ Star Citizen ------
> # nix-citizen = sources.nix-citizen or null;
> 
> # ------ ClamUI ------
> # clamui = sources.clamui or null;
> 
> # ------ Antigravity CLI ------
> # antigravity-cli = sources.antigravity-cli-nix or null;
> 
> # ------ Autre ------
> # mon-app = sources.mon-repo or null;
> }
> 
> ```

Ctrl + X, puis O, puis Entrée

> Si tu ranges en `system/` : vois le tuto ranger (à venir) (`./npins` devient `../npins`).

* * *

1. 
## Créer `verify-sources.nix`

```bash
sudo nano /etc/nixos/customConfig/verify-sources.nix

```

Recopiez/collez le code.

> **Code à recopier - verify-sources.nix**
>
> ```nix
> # ------ verify-sources.nix ------
> # Sha256 des sources custom (npins).
> # Boot : glf-npins-init puis timer (3 min).
> # Manuel : glf-sha
> # Logs : journalctl -u glf-verify-sources
> #
> # expectedPins = la liste des repos à pinnner.
> # Tu ajoutes une ligne → glf-sha l’ajoute.
> # Tu retires une ligne → glf-sha la vire de sources.json.
> #
> { config, pkgs, lib, ... }:
> 
> let
> npins = pkgs.npins;
> 
> # ------ Pins ------
> # Une ligne = un repo. Commenter = pin retiré à la prochaine maj / glf-sha.
> #
> # name = nom du pin (souvent le nom du repo GitHub)
> # addArgs = arguments de : npins add ...
> expectedPins = [
> # --- Hytale ---
> # { name = "hytale-launcher-nix"; addArgs = "github JPyke3 hytale-launcher-nix --branch main"; }
> 
> # --- Star Citizen ---
> # { name = "nix-citizen"; addArgs = "github LovingMelody nix-citizen --branch main"; }
> 
> # --- ClamUI ---
> # { name = "clamui"; addArgs = "github linx-systems clamui --branch master"; }
> 
> # --- Antigravity CLI ---
> # { name = "antigravity-cli-nix"; addArgs = "github xsen antigravity-cli-nix --branch master"; }
> 
> # --- Autre ---
> # { name = "mon-repo"; addArgs = "github Owner mon-repo --branch main"; }
> ];
> 
> expectedNames = lib.concatMapStringsSep " " (p: p.name) expectedPins;
> 
> npinsEnsureFormat = pkgs.writeShellScript "npins-ensure-format" ''
> set -euo pipefail
> err="$(${npins}/bin/npins show 2>&1 >/dev/null)" && exit 0
> if echo "$err" | ${pkgs.gnugrep}/bin/grep -qiE 'too old|run upgrade|Failed to deserialize|Unsupported format'; then
> echo "[INFO] Format sources.json obsolete : npins upgrade..." >&2
> ${npins}/bin/npins upgrade
> exit 0
> fi
> echo "$err" >&2
> exit 1
> '';
> 
> npinsSync = pkgs.writeShellScript "npins-sync" ''
> set -euo pipefail
> cd /etc/nixos/customConfig
> 
> if [! -d npins]; then
> ${npins}/bin/npins init --bare
> fi
> 
> ${npinsEnsureFormat} || true
> 
> EXPECTED="${expectedNames}"
> 
> ${lib.concatMapStringsSep "\n" (p: ''
> if ! ${pkgs.gnugrep}/bin/grep -q '"${p.name}"' npins/sources.json 2>/dev/null; then
> echo "[INFO] Ajout pin ${p.name}..." >&2
> ${npins}/bin/npins add ${p.addArgs}
> fi
> '') expectedPins}
> 
> if [-f npins/sources.json]; then
> while IFS= read -r name; do
> [-z "$name"] && continue
> keep=0
> for e in $EXPECTED; do
> ["$name" = "$e"] && keep=1 && break
> done
> if ["$keep" -eq 0]; then
> echo "[INFO] Retrait pin obsolete: $name" >&2
> ${npins}/bin/npins remove "$name" || true
> fi
> done < <(${npins}/bin/npins show --plain 2>/dev/null || true)
> fi
> '';
> 
> npinsUpdateIfAny = pkgs.writeShellScript "npins-update-if-any" ''
> set -euo pipefail
> cd /etc/nixos/customConfig
> if ! pins="$(${npins}/bin/npins show --plain)"; then
> echo "[ERREUR] npins show a echoue." >&2
> exit 1
> fi
> if ! printf '%s\n' "$pins" | ${pkgs.gnugrep}/bin/grep -q '[^[:space:]]'; then
> echo "[INFO] Aucun pin, mise a jour npins ignoree." >&2
> exit 0
> fi
> echo "[INFO] npins update..." >&2
> ${npins}/bin/npins update
> '';
> in
> {
> environment.systemPackages = [
> npins
> (pkgs.writeShellScriptBin "glf-sha" ''
> set -euo pipefail
> cd /etc/nixos/customConfig
> sudo ${npinsSync}
> sudo ${npinsUpdateIfAny}
> exec glf-update
> '')
> ];
> 
> systemd.services."glf-npins-init" = {
> description = "Initialisation npins sources custom GLF-OS";
> wantedBy = ["multi-user.target"];
> after = ["network-online.target"];
> wants = ["network-online.target"];
> unitConfig.FailureAction = "none";
> path = [npins pkgs.coreutils pkgs.bash pkgs.gnugrep pkgs.nix pkgs.nix-prefetch-scripts];
> serviceConfig = {
> Type = "oneshot";
> RemainAfterExit = true;
> ExecStart = pkgs.writeShellScript "glf-npins-init" ''
> echo "[INFO] Initialisation npins..." >&2
> ${npinsSync}
> echo "[INFO] npins pret." >&2
> '';
> };
> };
> 
> systemd.services."glf-verify-sources" = {
> description = "Mise a jour sha256 des sources custom (npins)";
> wantedBy = [];
> after = ["network-online.target" "glf-npins-init.service"];
> wants = ["network-online.target" "glf-npins-init.service"];
> unitConfig.FailureAction = "none";
> path = with pkgs; [
> npins coreutils bash libnotify shadow curl nix nix-prefetch-scripts systemd gnugrep
> ];
> serviceConfig = {
> Type = "oneshot";
> RemainAfterExit = true;
> User = "root";
> ExecStart = pkgs.writeShellScript "glf-verify-sources" ''
> echo "[INFO] Mise a jour sha256 sources custom..." >&2
> cd /etc/nixos/customConfig
> 
> _notify() {
> local urgency="$1" summary="$2" body="$3"
> for userpath in /run/user/*; do
> uid="$(basename "$userpath")"
> user="$(id -nu "$uid" 2>/dev/null)" || continue
> /run/current-system/sw/bin/runuser -u "$user" -- env \
> XDG_RUNTIME_DIR="/run/user/$uid" \
> DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/$uid/bus" \
> ${pkgs.libnotify}/bin/notify-send \
> -u "$urgency" -a "GLF-Custom" \
> --hint string:x-kde-persist:true \
> "$summary" "$body" 2>/dev/null || true
> done
> }
> 
> if ${pkgs.systemd}/bin/systemctl cat glfos-update.service >/dev/null 2>&1; then
> WAITED=0
> while ${pkgs.systemd}/bin/systemctl is-active --quiet glfos-update.service; do
> ["$WAITED" -eq 0] && echo "[INFO] glfos-update actif, attente..." >&2
> ["$WAITED" -ge 7200] && { echo "[ERREUR] timeout attente glfos-update" >&2; exit 0; }
> sleep 15
> WAITED=$((WAITED + 15))
> done
> fi
> 
> BEFORE="$(cat npins/sources.json 2>/dev/null || echo "")"
> 
> echo "[INFO] Attente connectivite GitHub..." >&2
> TRIES=0
> until ${pkgs.curl}/bin/curl -sf --max-time 5 https://github.com > /dev/null 2>&1; do
> TRIES=$((TRIES + 1))
> if ["$TRIES" -ge 12]; then
> echo "[ERREUR] GitHub injoignable apres 60s." >&2
> _notify critical "Echec mise a jour sources" "GitHub injoignable au boot."
> exit 0
> fi
> sleep 5
> done
> 
> echo "[INFO] Sync pins (add/remove)..." >&2
> if ! ${npinsSync}; then
> echo "[ERREUR] npins sync a echoue." >&2
> _notify critical "Echec mise a jour sources" "npins sync a echoue."
> exit 0
> fi
> 
> if ! ${npinsUpdateIfAny}; then
> echo "[ERREUR] npins update a echoue." >&2
> _notify critical "Echec mise a jour sources" "npins update a echoue."
> exit 0
> fi
> 
> AFTER="$(cat npins/sources.json 2>/dev/null || echo "")"
> 
> if ["$BEFORE" = "$AFTER"]; then
> echo "[INFO] Sources deja a jour." >&2
> exit 0
> fi
> 
> echo "[INFO] sources.json mis a jour (prochain rebuild)." >&2
> _notify normal "Sources custom mises a jour" "Pins / sha256 sync, pris en compte au prochain rebuild."
> exit 0
> '';
> };
> };
> 
> systemd.timers."glf-verify-sources" = {
> description = "Mise a jour des sha256 sources custom";
> wantedBy = ["timers.target"];
> timerConfig = {
> OnBootSec = "3min";
> OnUnitActiveSec = "12h";
> Persistent = true;
> Unit = "glf-verify-sources.service";
> };
> };
> }
> 
> ```

Ctrl + X, puis O, puis Entrée

> Si le fichier existe déjà : garde ton contenu, ajoute juste tes lignes dans `expectedPins`.

* * *

1. 
## Import dans `default.nix`

```bash
sudo nano /etc/nixos/customConfig/default.nix

```

Dans `imports` :

```nix
  ./verify-sources.nix

```

`sources.nix` n’est **pas** un module : ne l’importe pas ici.  
(Les apps font : `import ./sources.nix { inherit pkgs; }`)

Ctrl + X, puis O, puis Entrée

* * *

1. 
## Rebuild

```bash
glf-update --switch

```

Ça installe `glf-sha` + le timer.  
Les pins sont encore commentés : rien n’est pinné tant que tu ne décommente pas.

* * *

1. 
## Activer un pin (exemple Hytale)

Tu prépares le pin ici. L’app se fait dans son tuto ([Hytale](https://forum.glfos.org/t/installation-hytale-glf-os/176)).

### A) `verify-sources.nix`

```bash
sudo nano /etc/nixos/customConfig/verify-sources.nix

```

Dans `expectedPins`, décommente :

```nix
    { name = "hytale-launcher-nix"; addArgs = "github JPyke3 hytale-launcher-nix --branch main"; }

```

Ctrl + X, puis O, puis Entrée

### B) `sources.nix`

```bash
sudo nano /etc/nixos/customConfig/sources.nix

```

Décommente :

```nix
  hytale-launcher = sources.hytale-launcher-nix or null;

```

Ctrl + X, puis O, puis Entrée

### C) Sync

```bash
glf-sha

```

Crée `customConfig/npins/`, ajoute le pin, maj le sha, rebuild.

Vérifier :

```bash
npins show

```

Ensuite suis le tuto de l’app.

* * *

## Ajouter une autre app

Exemple Star Citizen ([tuto](https://forum.glfos.org/t/installation-star-citizen-npins-glf-os/193)) :

**1.** `verify-sources.nix` → dans `expectedPins` :

```nix
    { name = "nix-citizen"; addArgs = "github LovingMelody nix-citizen --branch main"; }

```

**2.** `sources.nix` :

```nix
  nix-citizen = sources.nix-citizen or null;

```

**3.**

```bash
glf-sha

```

**4.** Module de l’app + import dans `default.nix` (voir le tuto de l’app).

Ne touche pas `npins/sources.json` à la main.

| Étape | Fichier | Action |
| --- | --- | --- |
| 1 | `verify-sources.nix` | ligne dans `expectedPins` |
| 2 | `sources.nix` | `mon-app = sources.nom-repo or null;` |
| 3 | terminal | `glf-sha` |
| 4 | module + `default.nix` | import de l’app |

* * *

## Retirer une app

1. Commente / supprime la ligne dans `expectedPins`
2. Commente / supprime le bloc dans `sources.nix`
3. Retire l’import du module dans `default.nix`
4. `glf-sha`

* * *

## Commandes

```bash
glf-sha

```

Logs :

```bash
journalctl -u glf-verify-sources
journalctl -u glf-npins-init

```

Liste des pins :

```bash
npins show

```

* * *

## Désinstallation

Retire `./verify-sources.nix` de `default.nix`, puis :

```bash
sudo rm -f /etc/nixos/customConfig/sources.nix
sudo rm -f /etc/nixos/customConfig/verify-sources.nix
sudo rm -rf /etc/nixos/customConfig/npins
glf-update --switch

```

(Les apps en version npins devront passer en version sans npins, ou être retirées.)
