nami alpha Docs

Examples

The 113 examples nami comes with, each with its files. None is built in: they're copied, and then they're yours.

Packages and sets

Package folders: a program's setup (cups, tailscale), a recipe (hello, jq-patched), or a set of packages and settings (namios, printing). nami new copies the ones a computer uses into the repo's packages/, where they're yours to change; list one by its name, - <name>.

accountsservice: the people on the computer, for the login screen and Settings.

package.nami
# accountsservice: the people on the computer, for the login screen and Settings.
services:
  - accounts-daemon.service

avahi

2 files

avahi: names on the local network (computer.local) and the printers and scanners there. nixpkgs' avahi has no services of its own (NixOS writes them), so they're here. resolved leaves .local to it.

package.nami
# avahi: names on the local network (computer.local) and the printers and
# scanners there. nixpkgs' avahi has no services of its own (NixOS writes
# them), so they're here. resolved leaves .local to it.
services:
  - avahi-daemon.service
files:
  /etc/sysusers.d/avahi.conf: |
    u avahi - "avahi" /var/empty
  /etc/systemd/resolved.conf.d/avahi.conf: |
    [Resolve]
    MulticastDNS=no
  /etc/systemd/system/avahi-daemon.socket: |
    [Unit]
    Description=Avahi mDNS/DNS-SD Stack Activation Socket
    [Socket]
    ListenStream=/run/avahi-daemon/socket
    [Install]
    WantedBy=sockets.target
  /etc/systemd/system/avahi-daemon.service: |
    [Unit]
    Description=Avahi mDNS/DNS-SD Stack
    Requires=avahi-daemon.socket
    [Service]
    Type=dbus
    BusName=org.freedesktop.Avahi
    NotifyAccess=main
    ExecStart=/run/current-system/sw/bin/avahi-daemon --syslog
    RuntimeDirectory=avahi-daemon
    RuntimeDirectoryPreserve=yes
    [Install]
    WantedBy=multi-user.target
    Also=avahi-daemon.socket
checks.nami
# How to tell avahi works, on a computer nami made (tests/usb.sh runs these).
"network printers and scanners: avahi runs":
  run: systemctl is-active avahi-daemon
  expect: "^active"

backup

3 files

Backups of what's yours on this computer: everyone's homes, the data services keep (/var/lib) and the computer's nami files. Your nami files bring the computer back (apps, settings, people); this brings back what you made on it. restic does it: encrypted, each file once however many days have it, to a USB disk, another computer or a cloud bucket. packages: - ../shared/packages/backup files: /etc/nami-backup.conf: to: disk:Backups # a USB disk, by its label: backs up when it's plugged in # to: sftp:ada@nas:/backups/laptop another computer (root's SSH key) # to: b2:my-bucket:laptop a bucket (restic's names: s3:, b2:, rest:, rclone:...) when: daily # or hourly, weekly keep: { daily: 7, weekly: 4, monthly: 12 } leave-out: [~/Downloads, ~/Videos] # Without it nobody can read the backups (you neither: keep a copy). /run/nami/secrets/backup-password: !secret "YWdl..." # A bucket's keys, if it needs them (AWS_ACCESS_KEY_ID=..., B2_ACCOUNT_KEY=...). /run/nami/secrets/backup-env: !secret "YWdl..." Left out: caches, the trash, Docker's and Podman's images, and what nami builds again (apps, /nix). A disk keeps them in nami-backup/<hostname>. How it runs: every hour, root's nami-backup.service backs up when one is due, and when a disk is plugged in. "Back up now" in the window (or sudo systemctl start nami-backup-now) doesn't wait. After a week without one, everyone at the desktop is told why. A computer made again from the same nami files, at its first login, offers to bring back your home as the newest backup from before has it. Restoring: sudo nami-backup restore 2026-10-20 /home/ada/Documents, or the window's Backups page; nami-backup status says what there is.

package.nami
# Backups of what's yours on this computer: everyone's homes, the data
# services keep (/var/lib) and the computer's nami files. Your nami files
# bring the computer back (apps, settings, people); this brings back what
# you made on it. restic does it: encrypted, each file once however many
# days have it, to a USB disk, another computer or a cloud bucket.
#
#   packages:
#     - ../shared/packages/backup
#   files:
#     /etc/nami-backup.conf:
#       to: disk:Backups          # a USB disk, by its label: backs up when it's plugged in
#       # to: sftp:ada@nas:/backups/laptop    another computer (root's SSH key)
#       # to: b2:my-bucket:laptop              a bucket (restic's names: s3:, b2:, rest:, rclone:...)
#       when: daily               # or hourly, weekly
#       keep: { daily: 7, weekly: 4, monthly: 12 }
#       leave-out: [~/Downloads, ~/Videos]
#     # Without it nobody can read the backups (you neither: keep a copy).
#     /run/nami/secrets/backup-password: !secret "YWdl..."
#     # A bucket's keys, if it needs them (AWS_ACCESS_KEY_ID=..., B2_ACCOUNT_KEY=...).
#     /run/nami/secrets/backup-env: !secret "YWdl..."
#
# Left out: caches, the trash, Docker's and Podman's images, and what nami
# builds again (apps, /nix). A disk keeps them in nami-backup/<hostname>.
#
# How it runs: every hour, root's nami-backup.service backs up when one
# is due, and when a disk is plugged in. "Back up now" in the window (or
# `sudo systemctl start nami-backup-now`) doesn't wait. After a week
# without one, everyone at the desktop is told why. A computer made again
# from the same nami files, at its first login, offers to bring back
# your home as the newest backup from before has it.
#
# Restoring: `sudo nami-backup restore 2026-10-20 /home/ada/Documents`,
# or the window's Backups page; `nami-backup status` says what there is.
name: backup
version: "1"
source:
  path: ./src
deps: [restic, jq]
install: |
  mkdir -p $out/bin
  sed -e "s|@restic@|$(command -v restic)|" -e "s|@jq@|$(command -v jq)|" nami-backup > $out/bin/nami-backup
  chmod +x $out/bin/nami-backup
# The desktop's notices read nami-backup's status with it.
packages:
  - jq
services:
  - nami-backup.timer
  # Each person's, in their desktop session.
  - nami-backup-notice.service: { per-person: true }
  - nami-backup-notice.path: { per-person: true }
files:
  # The settings: none here; computer.nami's backup.conf is its content.
  /etc/nami-backup.conf:
    content: {}
  /etc/systemd/system/nami-backup.service: |
    [Unit]
    Description=Backs up this computer, when a backup is due
    Wants=network-online.target
    After=network-online.target
    [Service]
    Type=oneshot
    ExecStart=/run/current-system/sw/bin/nami-backup run
    Nice=19
    IOSchedulingClass=idle
  /etc/systemd/system/nami-backup-now.service: |
    [Unit]
    Description=Backs up this computer now
    Wants=network-online.target
    After=network-online.target
    [Service]
    Type=oneshot
    ExecStart=/run/current-system/sw/bin/nami-backup run --now
  /etc/systemd/system/nami-backup.timer: |
    [Unit]
    Description=Backs up this computer when a backup is due (it looks every hour)
    [Timer]
    OnBootSec=5min
    OnCalendar=hourly
    RandomizedDelaySec=5min
    Persistent=true
    [Install]
    WantedBy=timers.target
  # A disk plugged in: maybe the backup disk (nami-backup looks).
  /etc/udev/rules.d/90-nami-backup.rules: |
    ACTION=="add", SUBSYSTEM=="block", ENV{ID_FS_LABEL}=="?*", TAG+="systemd", ENV{SYSTEMD_WANTS}+="nami-backup.service"
  /etc/nami-os/backup/notice:
    mode: "0755"
    content: |
      #!/bin/sh
      # In each person's desktop session: at login, and after each try.
      # A computer made again: bring back your home from before? Once.
      # No backup for a week: why.
      status=$(nami-backup status 2>/dev/null) || exit 0
      at() { printf '%s' "$status" | jq -r "$1"; }
      [ "$(at .to)" != null ] || exit 0
      mine=${XDG_STATE_HOME:-$HOME/.local/state}/nami-backup
      mkdir -p "$mine"
      # The desktop shows notifications once it's up.
      i=0
      until busctl --user status org.freedesktop.Notifications >/dev/null 2>&1; do
        i=$((i + 1)); [ $i -lt 120 ] || exit 0; sleep 1
      done
      id=$(at '.before.id // empty')
      if [ -n "$id" ] && [ ! -e "$mine/offered" ]; then
        touch "$mine/offered"
        day=$(date -d "$(at .before.time)" '+%B %-d' 2>/dev/null || at .before.time)
        a=$(notify-send --app-name=Backups --icon=document-revert --action=restore="Bring it back" --wait \
          "Your files from $day are in a backup" "This computer was made again. Bring back your home as it was then?")
        if [ "$a" = restore ]; then
          if pkexec /run/current-system/sw/bin/nami-backup restore "$id" "$HOME"; then
            notify-send --app-name=Backups --icon=document-revert "Your files are back" "Log out and in again for your apps to see them."
          else
            notify-send --app-name=Backups --icon=dialog-error "Your files couldn't be brought back" "sudo nami-backup restore $id $HOME says why."
          fi
        fi
        exit 0
      fi
      last=$(at '.done // .since // empty')
      [ -n "$last" ] || exit 0
      days=$(( ($(date +%s) - last) / 86400 ))
      [ "$days" -ge 7 ] || exit 0
      # Once a day.
      [ "$(cat "$mine/told" 2>/dev/null)" = "$(date +%F)" ] && exit 0
      date +%F > "$mine/told"
      said=$(at .said)
      notify-send --app-name=Backups --icon=dialog-warning "Not backed up for $days days" "Last time: $said."
  /etc/systemd/user/nami-backup-notice.service: |
    [Unit]
    Description=Tells you about your backups (none for a week; your files from before)
    PartOf=graphical-session.target
    After=graphical-session.target
    ConditionUser=!@system
    [Service]
    ExecStart=/etc/nami-os/backup/notice
    [Install]
    WantedBy=graphical-session.target
  /etc/systemd/user/nami-backup-notice.path: |
    [Unit]
    Description=Watches this computer's backups
    PartOf=graphical-session.target
    ConditionUser=!@system
    [Path]
    PathChanged=/var/lib/nami-backup/said
    Unit=nami-backup-notice.service
    [Install]
    WantedBy=graphical-session.target
checks.nami
# How to tell backups work, on a computer nami made (tests/usb.sh runs these).
"backups: nami-backup, with restic":
  run: $(sed -n 's/^restic=//p' $(command -v nami-backup)) version
  expect: "^restic [0-9]"
"backups: they're looked for every hour":
  run: systemctl is-enabled nami-backup.timer
  expect: "^enabled"
"backups: a backup and a restore (of a folder of their own)":
  run: (t=$(mktemp -d); mkdir -p $t/data/docs; echo hello > $t/data/docs/a.txt; echo pw > $t/pw; printf 'to = %s\n' $t/repo > $t/conf; export NAMI_BACKUP_CONF=$t/conf NAMI_BACKUP_STATE=$t/state NAMI_BACKUP_PASSWORD=$t/pw NAMI_BACKUP_CACHE=$t/cache NAMI_BACKUP_PATHS=$t/data NAMI_BACKUP_TARGET=$t/out; nami-backup run >/dev/null && echo changed > $t/data/docs/a.txt && nami-backup restore latest $t/data/docs >/dev/null; echo "brought back $(cat $t/out$t/data/docs/a.txt) ($(nami-backup status | jq '.days | length') day)"; rm -rf $t)
  expect: "brought back hello \\(1 day\\)"
"backups: Back up now (as computer.nami says: backed up, or why not)":
  run: timeout 300 systemctl start --no-ask-password nami-backup-now.service 2>/dev/null; nami-backup status | jq -r .said
  expect: "backed up|isn't plugged in|no password|^$"
src/nami-backup
#!/bin/sh
# nami-backup: this computer's backups (restic), as /etc/nami-backup.conf says.
#
#   nami-backup run [--now]           back up, when one is due (--now: anyway)
#   nami-backup status                the last backup, and the days to restore from (JSON)
#   nami-backup restore [DAY] [PATH]  bring files back as they were that day
#                                     (DAY: latest, 2026-10-20 or a snapshot's id;
#                                     PATH: everyone's homes and /var/lib, without one)
#
# run and restore are root's (the password is); status is anyone's.
set -eu
restic=@restic@
jq=@jq@
PATH=/run/current-system/sw/bin:$PATH
conf=${NAMI_BACKUP_CONF:-/etc/nami-backup.conf}
state=${NAMI_BACKUP_STATE:-/var/lib/nami-backup}
export RESTIC_PASSWORD_FILE=${NAMI_BACKUP_PASSWORD:-/run/nami/secrets/backup-password}
export RESTIC_CACHE_DIR=${NAMI_BACKUP_CACHE:-/var/cache/nami-backup}
# What's backed up, and where a restore goes (nami doctor's check: a folder of its own).
paths=${NAMI_BACKUP_PATHS:-/home /var/lib /etc/nami}
target=${NAMI_BACKUP_TARGET:-/}
# A cloud bucket's keys (AWS_ACCESS_KEY_ID=..., B2_ACCOUNT_ID=...), sealed in computer.nami.
if [ -r /run/nami/secrets/backup-env ]; then set -a; . /run/nami/secrets/backup-env; set +a; fi

# A setting before any [section]; a list is a line each.
get() { awk -v k="$1" '/^\[/ { exit } { i = index($0, " = "); if (i && substr($0, 1, i - 1) == k) print substr($0, i + 3) }' "$conf" 2>/dev/null || true; }
# One in [keep].
kept() { awk -v k="$1" '/^\[/ { on = ($0 == "[keep]"); next } on { i = index($0, " = "); if (i && substr($0, 1, i - 1) == k) print substr($0, i + 3) }' "$conf" 2>/dev/null || true; }
to=$(get to | head -n 1)
when=$(get when | head -n 1)
host=$(hostname)

# What the last try said, for the window and the desktop's notices.
note() {
  mkdir -p "$state"
  [ -s "$state/since" ] || date +%s > "$state/since"
  date +%s > "$state/tried"
  [ "$1" = ok ] && date +%s > "$state/done"
  printf '%s\n' "$2" > "$state/said.new" && mv "$state/said.new" "$state/said"
  echo "$2"
}

# Where the backups are (RESTIC_REPOSITORY), or why it can't be reached now.
# A disk is opened at /run/nami-backup/disk while it's used.
mnt=
reach() {
  case $to in
    disk:*)
      label=${to#disk:}
      dev=$(blkid -L "$label" 2>/dev/null) || { why="the disk $label isn't plugged in"; return 1; }
      mnt=/run/nami-backup/disk
      mkdir -p "$mnt"
      mountpoint -q "$mnt" || mount "$dev" "$mnt" || { why="the disk $label couldn't be opened"; mnt=; return 1; }
      export RESTIC_REPOSITORY="$mnt/nami-backup/$host"
      # (A disk tray backed up to: its folder, as it is.)
      [ -e "$RESTIC_REPOSITORY" ] || [ ! -d "$mnt/tray-backup/$host" ] || RESTIC_REPOSITORY="$mnt/tray-backup/$host"
      ;;
    *) export RESTIC_REPOSITORY="$to" ;;
  esac
}
let_go() { [ -z "$mnt" ] || umount "$mnt" 2>/dev/null || true; }

# The days there are, from the newest: what status shows.
look() {
  $restic snapshots --json --host "$host" > "$state/days.new" 2>/dev/null && mv "$state/days.new" "$state/days" || rm -f "$state/days.new"
}

case ${1:-} in
run)
  [ -n "$to" ] || { echo "no backups set up: /etc/nami-backup.conf says where to (to:)"; exit 0; }
  mkdir -p "$state"
  [ -r "$RESTIC_PASSWORD_FILE" ] || { note failed "there's no password for the backups (/run/nami/secrets/backup-password)"; exit 0; }
  # Due: a day (an hour, a week) since the last one, give or take ten minutes.
  case $when in hourly) every=3600 ;; weekly) every=604800 ;; *) every=86400 ;; esac
  last=$(cat "$state/done" 2>/dev/null || echo 0)
  if [ "${2:-}" != --now ] && [ $(( $(date +%s) - last )) -lt $(( every - 600 )) ] && [ -s "$state/days" ]; then
    echo "not due yet (the last was $(date -d "@$last" '+%F %R'))"
    exit 0
  fi
  reach || { note waiting "$why"; exit 0; }
  trap let_go EXIT
  if ! $restic cat config >/dev/null 2>&1; then
    echo "starting the backups at $to"
    $restic init >/dev/null || { note failed "the backups couldn't be started at $to"; exit 1; }
  fi
  # This computer's first backup: the newest from before it (the same
  # computer, made again), to offer bringing back.
  if [ ! -e "$state/before" ]; then
    look
    $jq -c 'last | if . then {id: .short_id, time: .time} else null end' "$state/days" > "$state/before" 2>/dev/null || echo null > "$state/before"
  fi
  # What's yours: everyone's homes, services' data, the computer's nami files.
  # Not what nami builds again (apps, /nix), caches or the trash.
  ex=$state/leave-out
  {
    printf '%s\n' '/home/*/.cache' '/home/*/.local/share/Trash' '/home/*/.local/state/nami' '/home/*/.nix-profile' \
      /var/lib/docker /var/lib/containers /var/lib/systemd/coredump /var/lib/nami-backup
    get leave-out | sed 's|^~/|/home/*/|'
  } > "$ex"
  set --
  for p in $paths; do [ -e "$p" ] && set -- "$@" "$p"; done
  rc=0
  $restic backup --one-file-system --exclude-caches --exclude-file "$ex" --host "$host" --tag nami "$@" || rc=$?
  # 3: a few files couldn't be read; the rest is backed up.
  case $rc in
    0) ;;
    3) echo "(some files couldn't be read)" ;;
    *) look; note failed "the backup didn't finish (restic: $rc)"; exit 1 ;;
  esac
  $restic forget --host "$host" --prune --keep-daily "$(kept daily | grep . || echo 7)" --keep-weekly "$(kept weekly | grep . || echo 4)" \
    --keep-monthly "$(kept monthly | grep . || echo 12)" >/dev/null || echo "(the old days weren't cleared out this time)"
  look
  note ok "backed up"
  ;;
status)
  # {"to": ..., "when": ..., "done": seconds, "tried": seconds, "since": the first try, seconds, "said": ...,
  #  "before": the newest backup from before this computer ({"id", "time"}) or null,
  #  "days": [{"id", "time", "files", "bytes"}], newest first}
  r() { cat "$state/$1" 2>/dev/null || echo "${2-null}"; }
  $jq -n --arg to "$to" --arg when "${when:-daily}" --argjson done "$(r done)" --argjson tried "$(r tried)" \
    --argjson since "$(r since)" --argjson before "$(r before)" --arg said "$(r said '')" --slurpfile days "$(if [ -s "$state/days" ]; then echo "$state/days"; else echo /dev/null; fi)" \
    '{to: (if $to == "" then null else $to end), when: $when, done: $done, tried: $tried, since: $since, before: $before, said: $said,
      days: (($days[0] // []) | map({id: .short_id, time: .time, files: (.summary.total_files_processed // null), bytes: (.summary.total_bytes_processed // null)}) | reverse)}'
  ;;
restore)
  [ -n "$to" ] || { echo "no backups set up: /etc/nami-backup.conf says where they are (to:)" >&2; exit 1; }
  day=${2:-latest}
  [ $# -gt 2 ] && shift 2 || set --
  reach || { echo "$why" >&2; exit 1; }
  trap let_go EXIT
  # A date: that day's newest.
  case $day in
    ????-??-??)
      id=$($restic snapshots --json --host "$host" | $jq -r --arg d "$day" '[.[] | select(.time | startswith($d))] | last | .short_id // empty')
      [ -n "$id" ] || { echo "there's no backup from $day" >&2; exit 1; }
      day=$id ;;
  esac
  [ $# -gt 0 ] || set -- /home /var/lib
  echo "bringing back $* as of $day"
  for p in "$@"; do set -- "$@" --include "$p"; shift; done
  exec $restic restore "$day" --host "$host" --target "$target" "$@"
  ;;
*)
  sed -n '2,11s/^# \{0,1\}//p' "$0"
  exit 2
  ;;
esac

base

2 files

What every computer nami makes has, with a desktop or without one: desktop lists it first (a server's computer.nami: - base). Leave one out with without: [name] in your computer.nami. Sound and graphics devices, for everyone.

package.nami
# What every computer nami makes has, with a desktop or without one:
# desktop lists it first (a server's computer.nami: `- base`).
# Leave one out with `without: [name]` in your computer.nami.
# Sound and graphics devices, for everyone.
groups:
  audio: everyone
  video: everyone
packages:
  # Starting up and running: systemd, logins, the shell, the basics.
  - systemd
  - util-linux.bin
  - util-linux.login
  - bash
  - coreutils
  - hostname-debian
  - kmod
  - shadow
  - shadow.su
  - linux-pam
  - e2fsprogs.bin
  - dosfstools
  - fuse3
  - dbus
  - dbus-broker
  - sudo
  - nsncd
  - procps
  - kbd
  - glibcLocales
  - tzdata
  - cacert
  - openssl.bin
  # The processor's fixes (microcode), loaded first thing, as on Ubuntu.
  - microcode-intel
  - microcode-amd
  - wireless-regdb
  # The network: NetworkManager (Wi-Fi, cable, VPN), names on the local
  # network (avahi), phones and modems.
  - networkmanager
  - wpa_supplicant
  - iproute2
  - iputils
  - iw
  - avahi
  - nssmdns
  - wireguard-tools
  - modemmanager
  - usb-modeswitch
  - openssh
  - curl
  - git
  # Hardware: Bluetooth, Thunderbolt, firmware updates, keeping cool.
  - bluez
  - bolt
  - fwupd
  - thermald
  - pciutils
  # Devices' names (lspci, nami doctor --about, the window's This computer).
  - hwdata
  - usbutils
  # Command-line tools Ubuntu has.
  - gnugrep
  - gnused
  - gawk
  - findutils
  - diffutils
  - less
  - nano
  - which
  - getent
  - file
  - man
  - ncurses
  - gzip
  - xz
  - zstd
  - gnutar
  - unzip
  - zip
  - rsync
  - bc
  - wget
  - lsof
  - strace
  - psmisc
  - vim
  - gnupg
  - python3
  - perl
  - glibc.bin
  - traceroute
  - mtr
  - netcat-openbsd
  - dnsutils.dnsutils
  - dnsutils.host
  - nftables
  # Encrypted disks (nami install-to --encrypt).
  - cryptsetup
  # The firmware's boot menu (nami install-to adds the disk to it).
  - efibootmgr
  # Next to Windows (nami install-to --next-to-windows): NTFS, for making
  # C: smaller, and Windows' files readable from here.
  - ntfs3g
  # Secure Boot, and swapping to compressed memory.
  - secure-boot
  - zram-swap
  # Programs built for other distributions (prebuilt ones from GitHub, npm, pip):
  # their loader at /lib64, and the libraries they link to.
  - other-linuxes
drivers:
  # The kernel's firmware, for Wi-Fi, graphics and the rest (compressed).
  firmware: [linux-firmware]
boot:
  microcode: [intel-ucode.img, amd-ucode.img]
# Updates by themselves: once a day the newest catalog, and a new version
# of the system for the next start if anything changed. Nothing changes
# under anyone working; the version before stays in the boot menu, and
# starts by itself if the new one can't. Off: `mask: [nami-update.timer]`.
services:
  - nami-update.timer
files:
  # Names on the local network come from avahi (mDNS, computer.local), as
  # on a Mac: not also LLMNR, Windows' older way, which answers anyone on
  # the network who asks for a name (and can be lied to, to catch
  # passwords). Off, it listens on no port.
  /etc/systemd/resolved.conf.d/llmnr.conf: |
    [Resolve]
    LLMNR=no
  # Where the kernel's own code is in memory isn't shown to everyone (it
  # helps an attack get round the kernel's defences), as on Ubuntu.
  /etc/sysctl.d/10-nami-hardening.conf: |
    kernel.kptr_restrict = 1
  # Where systemd looks for the locales (`localectl list-locales`, the
  # languages a computer can be set to): glibc's, every language's.
  /etc/tmpfiles.d/locale.conf: |
    L+ /usr/lib/locale/locale-archive - - - - /run/current-system/sw/lib/locale/locale-archive
  # A new version is kept once it has started fine; that's written on
  # the boot partition, which may be mounted a moment after the rest
  # (it's nofail): wait for it.
  /etc/systemd/system/systemd-bless-boot.service.d/nami.conf: |
    [Unit]
    RequiresMountsFor=/boot
  /etc/systemd/system/nami-update.service: |
    [Unit]
    Description=Updates for this computer, for its next start
    Wants=network-online.target
    After=network-online.target
    [Service]
    Type=oneshot
    ExecStart=/nix/var/nami/bin/nami os-update
    Nice=19
    IOSchedulingClass=idle
    TimeoutStartSec=3h
  /etc/systemd/system/nami-update.timer: |
    [Unit]
    Description=Updates for this computer, daily
    [Timer]
    OnCalendar=daily
    RandomizedDelaySec=2h
    Persistent=true
    [Install]
    WantedBy=timers.target
checks.nami
# How to tell base works, on a computer nami made (tests/usb.sh runs these).
"the command-line tools an Ubuntu install has":
  run: m=; for c in zip bc wget lsof strace killall vi gpg python3 perl locale ldd traceroute mtr nc dig host nft; do command -v $c >/dev/null || m="$m $c"; done; echo "MISSING:$m."
  expect: "^MISSING:\\.$"
"programs built for other distributions find their loader (/lib64)":
  run: /lib64/ld-linux-x86-64.so.2 --version | head -1
  expect: "ld\\.so|GLIBC|GNU C"
"every language's locale, for Settings' language list (locale -a)":
  run: locale -a | grep -c utf8 | sed 's/^/N=/'
  expect: "N=[1-9][0-9][0-9]"
"every language's locale, for systemd too (localectl list-locales)":
  run: localectl list-locales | grep -ciE 'utf-?8' | sed 's/^/N=/'
  expect: "N=[1-9][0-9][0-9]"
"people join their groups (sound, for everyone)":
  run: getent group audio
  expect: "^audio:x:[0-9]+:[a-z_]"
"next to Windows: NTFS and the firmware's boot menu":
  run: command -v ntfsresize ntfs-3g.probe efibootmgr | wc -l | sed 's/^/N=/'
  expect: "N=3"
"the whole computer in one file (/etc/nami/computer.flat.nami)":
  run: f=/etc/nami/computer.flat.nami; head -1 $f | grep -q '^# Generated by nami' && grep -q "$(hostname)" $f && echo FLAT-OK
  expect: "^FLAT-OK$"
"updates by themselves (daily)":
  run: systemctl is-enabled nami-update.timer
  expect: "^enabled"
"the processor's microcode, in the boot archive":
  run: grep -aoE 'kernel/x86/microcode/[A-Za-z]+.bin' /run/booted-system/initrd | sort -u
  expect: "GenuineIntel.bin"
"everyone's own user IDs for containers, as you (rootless podman)":
  run: cat /etc/subuid /etc/subgid | grep -c ':65536$' | sed 's/^/N=/'
  expect: "N=[1-9]"

bat-bin

1 file

A prebuilt vendor binary (the pattern for unfree apps like VS Code or Chrome): autoPatchelfHook rewrites its ELF interpreter and RPATH to nixpkgs libraries.

package.nami
# A prebuilt vendor binary (the pattern for unfree apps like VS Code or Chrome):
# autoPatchelfHook rewrites its ELF interpreter and RPATH to nixpkgs libraries.
name: bat-bin
version: 0.24.0
source:
  url: https://github.com/sharkdp/bat/releases/download/v0.24.0/bat-v0.24.0-x86_64-unknown-linux-gnu.tar.gz
  sha256: 0faf5d51b85bf81b92495dc93bf687d5c904adc9818b16f61ec2e7a4f925c77a
build-deps: [autoPatchelfHook]
deps: [libgcc.lib]    # libgcc_s.so.1
install: |
  install -Dm755 bat $out/bin/bat
  install -Dm644 bat.1 $out/share/man/man1/bat.1

bluez

2 files

Bluetooth: started when the computer has an adapter.

package.nami
# Bluetooth: started when the computer has an adapter.
services:
  - bluetooth.service
files:
  /etc/tmpfiles.d/bluetooth.conf: |
    d /var/lib/bluetooth 0700 root root -
checks.nami
# How to tell bluez works, on a computer nami made (tests/usb.sh runs these).
"Bluetooth starts with an adapter":
  run: systemctl is-enabled bluetooth
  expect: "enabled"

bolt

2 files

bolt: Thunderbolt devices, allowed in Settings (started by D-Bus).

package.nami
# bolt: Thunderbolt devices, allowed in Settings (started by D-Bus).
checks.nami
# How to tell bolt works, on a computer nami made (tests/usb.sh runs these).
"Thunderbolt: bolt answers":
  run: timeout 30 busctl --system get-property org.freedesktop.bolt /org/freedesktop/bolt org.freedesktop.bolt1.Manager Version
  expect: "^u [0-9]"

brltty

2 files

Braille displays, as Ubuntu has them (brltty): plug one in (USB, or Bluetooth) and udev starts BRLTTY for it, which shows the text console on it and gives it to Orca on the desktop (BrlAPI). Nothing runs without a braille display. desktop lists this.

package.nami
# Braille displays, as Ubuntu has them (brltty): plug one in (USB, or
# Bluetooth) and udev starts BRLTTY for it, which shows the text console
# on it and gives it to Orca on the desktop (BrlAPI). Nothing runs
# without a braille display. desktop lists this.
packages:
  - brltty
files:
  # Only the displays brltty knows by name: its generic
  # list also takes USB serial adapters (Arduino boards, FTDI and CH341
  # cables) that aren't braille displays at all.
  /etc/udev/rules.d/90-brltty-usb-generic.rules: |
    # Left out (90-brltty-usb-customized.rules has the displays).
checks.nami
# How to tell brltty works, on a computer nami made (tests/usb.sh runs these).
"braille displays: brltty, started by udev for one (none here: not running)":
  run: echo BRLTTY=$(brltty -V 2>&1 | grep -c "^BRLTTY [0-9]") RULES=$(ls /etc/udev/rules.d/ | grep -c brltty) GENERIC=$(grep -c SYSTEMD_WANTS /etc/udev/rules.d/90-brltty-usb-generic.rules) RUNNING=$(systemctl list-units --no-legend 'brltty*' | wc -l)
  expect: "^BRLTTY=[1-9] RULES=[1-9][0-9]* GENERIC=0 RUNNING=0$"

Claude Desktop: Anthropic's app, with its Chat, Cowork and Code tabs. Unfree: this recipe takes Anthropic's own Linux build (the .deb its apt repository serves to Ubuntu and Debian) at build time, pinned by its hash; the app itself is never in this repo, and what it builds is for you alone (Anthropic's terms: it can't be passed on). nami unpacks the .deb itself and points its programs at nixpkgs' libraries; nothing of its maintainer scripts runs (they write an apt source and an AppArmor profile, which a nami computer has no use for). packages: - claude-desktop # in computer.nami (or a person's user.nami) - kvm # computer.nami: for Cowork (or nami install ./claude-desktop, this folder). Then Claude is in the launcher. Signing in opens the browser, and the browser hands claude:// back to the app (the menu entry registers it). The sign-in is kept in the keyring (gnome-keyring on namiOS). Cowork runs its tasks in a small VM, with QEMU and KVM, as on Ubuntu. The app looks for QEMU and its firmware at Debian's paths (/usr/bin/qemu-system-x86_64, /usr/share/OVMF), and its helper (a static Go program) starts QEMU at the path the app found: the helper runs in a view of / where those paths are nixpkgs' QEMU and firmware (bubblewrap, a /usr of its own; the rest of the computer as it is), and the app finds them there too (debian-paths.so, below: its look for them, access(), and nothing else). It also needs /dev/kvm and /dev/vhost-vsock: on namiOS, the kvm package (- kvm in computer.nami). A new version: the newest in Anthropic's signed index, https://downloads.claude.ai/claude-desktop/apt/stable/dists/stable/main/binary-amd64/Packages (its InRelease is signed by 31DD DE24 DDFA B679 F42D 7BD2 BAA9 29FF 1A7E CACE); its Filename, Version and SHA256 go below.

package.nami
# Claude Desktop: Anthropic's app, with its Chat, Cowork and Code tabs.
# Unfree: this recipe takes Anthropic's own Linux build (the .deb its apt
# repository serves to Ubuntu and Debian) at build time, pinned by its hash;
# the app itself is never in this repo, and what it builds is for you alone
# (Anthropic's terms: it can't be passed on). nami unpacks the .deb itself
# and points its programs at nixpkgs' libraries; nothing of its maintainer
# scripts runs (they write an apt source and an AppArmor profile, which a
# nami computer has no use for).
#
#   packages:
#     - claude-desktop     # in computer.nami (or a person's user.nami)
#     - kvm                # computer.nami: for Cowork
#
# (or `nami install ./claude-desktop`, this folder).
#
# Then Claude is in the launcher. Signing in opens the browser, and the
# browser hands claude:// back to the app (the menu entry registers it).
# The sign-in is kept in the keyring (gnome-keyring on namiOS).
#
# Cowork runs its tasks in a small VM, with QEMU and KVM, as on Ubuntu.
# The app looks for QEMU and its firmware at Debian's paths
# (/usr/bin/qemu-system-x86_64, /usr/share/OVMF), and its helper (a static
# Go program) starts QEMU at the path the app found: the helper runs in a
# view of / where those paths are nixpkgs' QEMU and firmware (bubblewrap,
# a /usr of its own; the rest of the computer as it is), and the app finds
# them there too (debian-paths.so, below: its look for them, access(), and
# nothing else). It also needs /dev/kvm and /dev/vhost-vsock: on namiOS,
# the kvm package (`- kvm` in computer.nami).
#
# A new version: the newest in Anthropic's signed index,
#   https://downloads.claude.ai/claude-desktop/apt/stable/dists/stable/main/binary-amd64/Packages
# (its InRelease is signed by 31DD DE24 DDFA B679 F42D 7BD2 BAA9 29FF 1A7E CACE);
# its Filename, Version and SHA256 go below.
name: claude-desktop
version: 4.16336.0
source:
  url: https://downloads.claude.ai/claude-desktop/apt/stable/pool/main/c/claude-desktop/claude-desktop_4.16336.0_amd64.deb
  sha256: 3810733e93792f70eae921175d13e53d1cc6bdce9dc23117f0588087521a64bc
deps:
  - alsa-lib             # libasound.so.2
  - at-spi2-core         # libatk-1.0.so.0, libatk-bridge-2.0.so.0, libatspi.so.0
  - cairo                # libcairo.so.2
  - cups.lib             # libcups.so.2
  - dbus.lib             # libdbus-1.so.3
  - expat                # libexpat.so.1
  - glib                 # libgio-2.0.so.0, libglib-2.0.so.0, libgobject-2.0.so.0
  - gtk3                 # libgtk-3.so.0
  - libgbm               # libgbm.so.1
  - libgcc.lib           # libgcc_s.so.1, libstdc++.so.6
  - libseccomp.lib       # libseccomp.so.2 (the bundled virtiofsd)
  - libcap_ng            # libcap-ng.so.0 (the bundled virtiofsd)
  - libx11               # libX11.so.6
  - libxcb               # libxcb.so.1
  - libxcomposite        # libXcomposite.so.1
  - libxdamage           # libXdamage.so.1
  - libxext              # libXext.so.6
  - libxfixes            # libXfixes.so.3
  - libxkbcommon         # libxkbcommon.so.0
  - libxrandr            # libXrandr.so.2
  - nspr                 # libnspr4.so
  - nss                  # libnss3.so, libnssutil3.so, libsmime3.so
  - pango                # libpango-1.0.so.0
  - pipewire             # libpipewire-0.3.so.0
  - systemdLibs          # libudev.so.1
# What Chromium opens by name as it runs (dlopen).
runtime-deps:
  - libglvnd             # libEGL.so.1, libGL.so.1, libGLESv2.so.2
  - wayland              # libwayland-client.so.0
  - libsecret            # libsecret-1.so.0: the keyring
  - libnotify            # libnotify.so.4
  - libayatana-appindicator  # its icon by the clock
  - libpulseaudio        # libpulse.so.0
  - libxcursor           # libXcursor.so.1
  - libxtst              # libXtst.so.6
  - gdk-pixbuf           # libgdk_pixbuf-2.0.so.0
  - gtk4                 # libgtk-4.so.1 (Chromium's GTK 4 file chooser, when asked)
  - fontconfig           # libfontconfig.so.1
  - curl                 # libcurl.so.4
  - krb5.lib             # libgssapi_krb5.so.2
  - libdrm               # libdrm.so.2
  - libuuid.lib          # libuuid.so.1
# Cowork's VM (see above), and the programs the app starts by name when the
# computer has none: the browser opener, bubblewrap and socat (Claude Code's
# sandbox), ssh (remote sessions).
build-deps: [qemu_kvm, OVMF.fd, bubblewrap, socat, openssh, xdg-utils]
install: |
  runHook preInstall
  mkdir -p $out
  cp -a . $out/
  app=$out/lib/claude-desktop
  # A setuid helper; the store can't hold setuid files. Chromium uses user
  # namespaces for its sandbox instead (what it does on Ubuntu 24.04 too).
  rm -f $app/chrome-sandbox

  # Its window buttons on the left, as every window's on namiOS: its main window has a frame,
  # so niri draws its bar with namiOS's three buttons over the app's own top row. As Anthropic
  # builds it, that window has no frame and Electron draws minimize, maximize and close over the
  # page itself; on the left, as GTK's layout puts them, they cover the page's menu, since
  # Electron tells the page its title area starts at the window's left edge whichever side they
  # are on. One word of the app's own code, its length kept (an asar lists where each file
  # starts): the window's title bar style goes unread, and the frame is Electron's default.
  # (Electron checks an asar's contents only on macOS and Windows.) A version without it
  # fails here, rather than coming with its buttons over its menu.
  grep -aq 'titleBarStyle:"hidden",titleBarOverlay:!0,trafficLightPosition' $app/resources/app.asar ||
    { echo "claude-desktop: its main window's title bar style isn't where it was (see the recipe)"; exit 1; }
  sed -i 's/titleBarStyle:"hidden",titleBarOverlay:!0,trafficLightPosition/titleBarStylX:"hidden",titleBarOverlay:!0,trafficLightPosition/' $app/resources/app.asar

  qemu=$(command -v qemu-system-x86_64)
  ovmf=
  for p in $nativeBuildInputs; do [ -e "$p/FV/OVMF_CODE.fd" ] && ovmf=$p/FV; done
  [ -n "$ovmf" ] || { echo "no OVMF firmware"; exit 1; }
  bwrap=$(command -v bwrap)
  tools=$(dirname "$(command -v xdg-open)"):$(dirname "$bwrap"):$(dirname "$(command -v socat)"):$(dirname "$(command -v ssh)")

  # Cowork's helper, in a / whose /usr has QEMU and its firmware where the
  # app expects them, and the rest of the computer's /usr as it is. Links,
  # not mounts: QEMU finds its ROMs next to where it really is. Not
  # needed where the computer has them there itself (Ubuntu with qemu).
  mv $app/resources/cowork-linux-helper $app/resources/.cowork-linux-helper-real
  cat > $app/resources/cowork-linux-helper <<EOF
  #!$SHELL
  real=$app/resources/.cowork-linux-helper-real
  if [ -x /usr/bin/qemu-system-x86_64 ] && [ -e /usr/share/OVMF/OVMF_CODE_4M.fd -o -e /usr/share/OVMF/OVMF_CODE.fd ]; then
    exec "\$real" "\$@"
  fi
  args="--dev-bind / / --tmpfs /usr"
  for d in /usr/*/* /usr/*; do
    [ -e "\$d" ] || [ -L "\$d" ] || continue
    case "\$d" in /usr/bin|/usr/share|/usr/libexec|/usr/bin/qemu-system-x86_64|/usr/share/OVMF) continue ;; esac
    case "\$d" in /usr/bin/*|/usr/share/*|/usr/libexec/*) ;; */*/*) continue ;; esac
    if [ -L "\$d" ]; then args="\$args --symlink \$(readlink "\$d") \$d"; else args="\$args --dev-bind \$d \$d"; fi
  done
  exec $bwrap \$args \\
    --symlink $qemu /usr/bin/qemu-system-x86_64 \\
    --symlink $ovmf /usr/share/OVMF \\
    -- "\$real" "\$@"
  EOF
  chmod +x $app/resources/cowork-linux-helper

  # Where the app looks for QEMU and its firmware, when they aren't there:
  # nixpkgs'. For the app's own process alone (it takes itself out of
  # LD_PRELOAD as it loads): Chromium's sandbox won't start its zygote
  # with a library like this in it (nor with libredirect, which nami uses
  # for a .deb's own paths), and the programs the app starts don't need it.
  mkdir -p $out/lib/claude-desktop-nami
  cat > debian-paths.c <<EOF
  #define _GNU_SOURCE
  #include <dlfcn.h>
  #include <errno.h>
  #include <stdio.h>
  #include <stdlib.h>
  #include <string.h>
  static const char *map[][2] = {
    { "/usr/bin/qemu-system-x86_64", "$qemu" },
    { "/usr/share/OVMF/", "$ovmf/" },
    { 0, 0 },
  };
  static const char *to(const char *p, char *buf, size_t n) {
    for (int i = 0; p && map[i][0]; i++) {
      size_t l = strlen(map[i][0]);
      if (strncmp(p, map[i][0], l) == 0 && (map[i][0][l - 1] == '/' || p[l] == 0)) {
        snprintf(buf, n, "%s%s", map[i][1], p + l);
        return buf;
      }
    }
    return 0;
  }
  /* The path itself first; nixpkgs' where it isn't there. */
  #define TRY(call) do { int r = call; char b[4096]; if (r == 0 || errno != ENOENT || !to(p, b, sizeof b)) return r; p = b; return call; } while (0)
  int access(const char *p, int m) { static int (*f)(const char *, int); if (!f) f = dlsym(RTLD_NEXT, "access"); TRY(f(p, m)); }
  int euidaccess(const char *p, int m) { static int (*f)(const char *, int); if (!f) f = dlsym(RTLD_NEXT, "euidaccess"); TRY(f(p, m)); }
  int eaccess(const char *p, int m) { return euidaccess(p, m); }
  int faccessat(int d, const char *p, int m, int fl) { static int (*f)(int, const char *, int, int); if (!f) f = dlsym(RTLD_NEXT, "faccessat"); TRY(f(d, p, m, fl)); }
  __attribute__((constructor)) static void out_of_ld_preload(void) {
    const char *v = getenv("LD_PRELOAD");
    if (!v) return;
    char *keep = calloc(1, strlen(v) + 1), *copy = strdup(v), *save = 0;
    for (char *t = strtok_r(copy, ": ", &save); t; t = strtok_r(0, ": ", &save))
      if (!strstr(t, "/debian-paths.so")) { if (*keep) strcat(keep, ":"); strcat(keep, t); }
    if (*keep) setenv("LD_PRELOAD", keep, 1); else unsetenv("LD_PRELOAD");
    free(copy); free(keep);
  }
  EOF
  $CC -O2 -shared -fPIC -o $out/lib/claude-desktop-nami/debian-paths.so debian-paths.c -ldl
  rm debian-paths.c

  # The program: the menu's, and a terminal's claude-desktop.
  rm $out/bin/claude-desktop
  cat > $out/bin/claude-desktop <<EOF
  #!$SHELL
  if [ ! -x /usr/bin/qemu-system-x86_64 ] || [ ! -e /usr/share/OVMF/OVMF_CODE.fd -a ! -e /usr/share/OVMF/OVMF_CODE_4M.fd ]; then
    export LD_PRELOAD="$out/lib/claude-desktop-nami/debian-paths.so\${LD_PRELOAD:+:\$LD_PRELOAD}"
  fi
  export PATH="\${PATH:+\$PATH:}$tools"
  exec -a "\$0" $app/claude-desktop "\$@"
  EOF
  chmod +x $out/bin/claude-desktop

  sed -i "s|^Exec=claude-desktop|Exec=$out/bin/claude-desktop|" $out/share/applications/com.anthropic.Claude.desktop
  # Its own file types (.mcpb, .skill), as its maintainer script registers them.
  install -Dm644 $app/resources/linux-mime/com.anthropic.Claude.xml $out/share/mime/packages/com.anthropic.Claude.xml
  runHook postInstall

coding

1 file

Writing code: an editor, containers and git (with gnome-keyring's SSH agent on the desktop). Others: zed-editor, podman, gnome-builder, dbeaver-bin, bruno.

package.nami
# Writing code: an editor, containers and git (with gnome-keyring's SSH
# agent on the desktop). Others: zed-editor, podman, gnome-builder,
# dbeaver-bin, bruno.
packages:
  - vscode
  - docker
  - git
  - gh               # GitHub from the command line
  - meld             # comparing files and folders

colord

2 files

colord: colour profiles for screens, printers and scanners.

package.nami
# colord: colour profiles for screens, printers and scanners.
files:
  /etc/tmpfiles.d/colord.conf: |
    d /var/lib/colord 0755 colord colord -
checks.nami
# How to tell colord works, on a computer nami made (tests/usb.sh runs these).
"colour profiles: colord answers (started by D-Bus)":
  run: timeout 30 busctl --system get-property org.freedesktop.ColorManager /org/freedesktop/ColorManager org.freedesktop.ColorManager DaemonVersion
  expect: "^s \""

cryptsetup

2 files

Encrypted disks (LUKS): nami install-to --encrypt makes one, and the initrd unlocks it as the computer starts, asking for its password. The device mapper's udev rules (lvm2 has them, as on Ubuntu): an unlocked disk gets its /dev/disk links, and cryptsetup hears that udev is done with it (without them, cryptsetup open waits forever).

package.nami
# Encrypted disks (LUKS): `nami install-to --encrypt` makes one, and the
# initrd unlocks it as the computer starts, asking for its password.
# The device mapper's udev rules (lvm2 has them, as on Ubuntu): an
# unlocked disk gets its /dev/disk links, and cryptsetup hears that
# udev is done with it (without them, `cryptsetup open` waits forever).
packages:
  - lvm2
boot:
  initrd-programs: [bin/cryptsetup]
  # cbc first: encrypted-keys (which dm-crypt needs) wants it as it loads,
  # and the boot archive can't fetch modules by itself.
  initrd-modules: [cbc, dm_crypt, xts, aesni_intel, aes_generic, algif_skcipher]
checks.nami
# How to tell cryptsetup works, on a computer nami made (tests/usb.sh runs these).
"encrypted disks: cryptsetup, in the boot archive":
  run: grep -ac 'cryptsetup' /run/booted-system/initrd | sed 's/^/N=/'
  expect: "N=[1-9]"
"encrypted disks: the device mapper's udev rules":
  run: ls /etc/udev/rules.d/
  expect: "10-dm.rules"

cups

2 files

CUPS on a computer: its user and folders, its settings (real files: cupsd won't read links), started when something prints (the socket) or a job is waiting (the path).

package.nami
# CUPS on a computer: its user and folders, its settings (real files: cupsd
# won't read links), started when something prints (the socket) or a job
# is waiting (the path).
services:
  - cups.socket
  - cups.path
# Printing for everyone; admins manage the printers.
groups:
  lp: everyone
  lpadmin: admins
files:
  # CUPS's user, and its folders.
  /etc/sysusers.d/cups.conf: |
    u lp 7 "Printing" /var/spool/cups
  /etc/tmpfiles.d/cups.conf: |
    d /etc/cups 0755 root lp -
    d /etc/cups/ppd 0755 root lp -
    d /etc/cups/ssl 0700 root lp -
    d /var/cache/cups 0770 root lp -
    d /var/spool/cups 0710 root lp -
    d /var/spool/cups/tmp 1770 root lp -
  # Real files with their own mode: cupsd won't read them otherwise.
  /etc/cups/cups-files.conf:
    mode: "0640"
    content: |
      SystemGroup root wheel
      ServerBin /run/current-system/sw/lib/cups
      DataDir /run/current-system/sw/share/cups
      DocumentRoot /run/current-system/sw/share/doc/cups
      ServerRoot /etc/cups
      StateDir /run/cups
      CacheDir /var/cache/cups
      RequestRoot /var/spool/cups
      TempDir /var/spool/cups/tmp
      AccessLog syslog
      ErrorLog syslog
      PageLog syslog
  # Printing for everyone; adding and changing printers for admins.
  /etc/cups/cupsd.conf:
    mode: "0640"
    content: |
      LogLevel warn
      Listen localhost:631
      Listen /run/cups/cups.sock
      Browsing On
      BrowseLocalProtocols dnssd
      DefaultAuthType Basic
      WebInterface Yes
      <Location />
        Order allow,deny
      </Location>
      <Location /admin>
        Order allow,deny
      </Location>
      <Location /admin/conf>
        AuthType Default
        Require user @SYSTEM
        Order allow,deny
      </Location>
      <Policy default>
        JobPrivateAccess default
        JobPrivateValues default
        SubscriptionPrivateAccess default
        SubscriptionPrivateValues default
        <Limit Create-Job Print-Job Print-URI Validate-Job>
          Order deny,allow
        </Limit>
        <Limit Send-Document Send-URI Hold-Job Release-Job Restart-Job Purge-Jobs Set-Job-Attributes Create-Job-Subscription Renew-Subscription Cancel-Subscription Get-Notifications Reprocess-Job Cancel-Current-Job Suspend-Current-Job Resume-Job Cancel-My-Jobs Close-Job CUPS-Move-Job CUPS-Get-Document>
          Require user @OWNER @SYSTEM
          Order deny,allow
        </Limit>
        <Limit CUPS-Add-Modify-Printer CUPS-Delete-Printer CUPS-Add-Modify-Class CUPS-Delete-Class CUPS-Set-Default CUPS-Get-Devices>
          AuthType Default
          Require user @SYSTEM
          Order deny,allow
        </Limit>
        <Limit Pause-Printer Resume-Printer Enable-Printer Disable-Printer Pause-Printer-After-Current-Job Hold-New-Jobs Release-Held-New-Jobs Deactivate-Printer Activate-Printer Restart-Printer Shutdown-Printer Startup-Printer Promote-Job Schedule-Job-After Cancel-Jobs CUPS-Accept-Jobs CUPS-Reject-Jobs>
          AuthType Default
          Require user @SYSTEM
          Order deny,allow
        </Limit>
        <Limit Cancel-Job CUPS-Authenticate-Job>
          Require user @OWNER @SYSTEM
          Order deny,allow
        </Limit>
        <Limit All>
          Order deny,allow
        </Limit>
      </Policy>
checks.nami
# How to tell cups works, on a computer nami made (tests/usb.sh runs these).
"printing: CUPS runs":
  run: lpstat -r
  expect: "scheduler is running"
"printing: set up as a real file (its user, cupsd.conf)":
  run: id -u lp; stat -c '%F %a' /etc/cups/cupsd.conf
  expect: "regular file 640"

desktop

2 files

What any desktop needs (niri's, and any other): the services desktops talk to, sound, fonts and a browser. Printing, scanning, power, fingerprint login, parental controls, running out of memory, being told of updates, the boot splash, braille displays and a VM's guest tools are each a file of its own, listed here (without: leaves one out).

package.nami
# What any desktop needs (niri's, and any other): the
# services desktops talk to, sound, fonts and a browser. Printing,
# scanning, power, fingerprint login, parental controls, running out of
# memory, being told of updates, the boot splash, braille displays and a
# VM's guest tools are each a file of its own, listed here (`without:`
# leaves one out).
packages:
  - base
  - printing
  - scanning
  - power
  - fprintd
  - parental-controls
  - oomd
  - update-notify
  - plymouth
  - brltty
  - vm-guest
  # Apps built for other distributions (a downloaded tarball, an AppImage, a game):
  # their libraries, and Files starting them.
  - other-linuxes-desktop
  # nami's window: apps, people, settings, history, making a USB drive.
  - nami-gui
  # The services behind every desktop.
  - accountsservice
  - polkit
  # An admin's password for a change for everyone (nami's daemon asks it).
  - nami-polkit
  - rtkit
  - geoclue2
  - colord
  - at-spi2-core
  # Graphics and input.
  - mesa
  - xwayland
  - libinput
  - gtk3
  - gtk4
  # Drives, settings.
  - udisks
  - gvfs
  # Windows computers on the network, in Files' Other Locations (gvfs
  # starts it to look).
  - wsdd
  - dconf
  # GSettings' way to dconf, for programs nobody wrapped with it (gsettings itself,
  # Java's and Electron's GTK look, apps from elsewhere): else they read only the
  # defaults, never what's set (dark, fonts).
  - dconf.lib
  - glib.bin
  - glib-networking
  - gsettings-desktop-schemas
  - xdg-desktop-portal
  - xdg-desktop-portal-gtk
  - xdg-user-dirs
  # Sound.
  - pipewire
  - wireplumber
  - sound-theme-freedesktop
  # Icons, pictures and thumbnails.
  - adwaita-icon-theme
  - hicolor-icon-theme
  - shared-mime-info
  - librsvg
  - gdk-pixbuf
  - webp-pixbuf-loader
  - libheif
  - ffmpegthumbnailer
  # Fonts, every language's writing, and spell checking.
  - cantarell-fonts
  - adwaita-fonts
  - dejavu_fonts
  - noto-fonts
  - noto-fonts-color-emoji
  - noto-fonts-cjk-sans
  # Arial, Times New Roman and Courier New's sizes, for documents from
  # Windows (fonts-liberation).
  - liberation_ttf
  - fontconfig.out
  - fontconfig.bin
  - hunspell
  - hunspellDicts.en_US
  # A browser.
  - firefox
  # What scripts and apps run on a desktop: opening a file or link in its
  # app (xdg-open), notifications, dialogs, and the sound card's tools.
  - xdg-utils
  - libnotify
  - zenity
  - alsa-utils
  # Playing video and music (what Ubuntu's restricted extras add, too).
  - gst_all_1.gstreamer
  - gst_all_1.gst-plugins-base
  - gst_all_1.gst-plugins-good
  - gst_all_1.gst-plugins-bad
  - gst_all_1.gst-plugins-ugly
  - gst_all_1.gst-libav
  # Laptops: screen rotation.
  - iio-sensor-proxy
drivers:
  # The graphics drivers for every GPU but NVIDIA's (nvidia adds those).
  graphics: [mesa]
# Where the desktop's programs find their plugins, and what's built below.
env:
  NIX_GSETTINGS_OVERRIDES_DIR: /etc/nami-os/schemas
  GDK_PIXBUF_MODULE_FILE: /etc/nami-os/gdk-pixbuf-loaders.cache
  GIO_EXTRA_MODULES: /run/current-system/sw/lib/gio/modules
  XCURSOR_PATH: /etc/nami-os/icons:/run/current-system/sw/share/icons
  GST_PLUGIN_SYSTEM_PATH_1_0: /run/current-system/sw/lib/gstreamer-1.0
  NAUTILUS_4_EXTENSION_DIR: /run/current-system/sw/lib/nautilus/extensions-4
  GTK_PATH: /run/current-system/sw/lib/gtk-3.0:/run/current-system/sw/lib/gtk-4.0
  QT_PLUGIN_PATH: /run/current-system/sw/lib/qt-6/plugins
  QML2_IMPORT_PATH: /run/current-system/sw/lib/qt-6/qml:/etc/nami-os/qml
  NIXPKGS_QT6_QML_IMPORT_PATH: /run/current-system/sw/lib/qt-6/qml:/etc/nami-os/qml
files:
  # What an admin at the computer does without a password, as on Ubuntu
  # (policykit-desktop-privileges): open the computer's own drives in
  # Files, set the clock and time zone (and so the automatic time zone),
  # and the computer's language.
  /etc/polkit-1/rules.d/20-desktop.rules: |
    polkit.addRule(function(action, subject) {
      // Joining a Wi-Fi network: everyone's in this group, and it shouldn't take an admin's password.
      if (subject.local && subject.active && subject.isInGroup("networkmanager") && action.id.indexOf("org.freedesktop.NetworkManager.") == 0) return polkit.Result.YES;
      if (!subject.local || !subject.active || !subject.isInGroup("wheel")) return polkit.Result.NOT_HANDLED;
      var id = action.id;
      if (id.indexOf("org.freedesktop.udisks2.filesystem-mount") == 0 || id == "org.freedesktop.udisks2.encrypted-unlock-system" ||
          id == "org.freedesktop.udisks2.filesystem-fstab" || id.indexOf("org.freedesktop.timedate1.") == 0 ||
          id == "org.freedesktop.locale1.set-locale")
        return polkit.Result.YES;
      return polkit.Result.NOT_HANDLED;
    });
  # The cursor programs get when they ask for "default" (niri, X11 apps).
  /etc/nami-os/icons/default/index.theme: |
    [Icon Theme]
    Name=Default
    Inherits=Adwaita
  # Every installed font (fontconfig's own settings come with it): the computer's, and the
  # ones a person installs for themselves (fonts in their user.nami).
  /etc/fonts/conf.d/00-nami-fonts.conf: |
    <?xml version='1.0'?>
    <!DOCTYPE fontconfig SYSTEM 'urn:fontconfig:fonts.dtd'>
    <fontconfig><dir>/run/current-system/sw/share/fonts</dir><dir>~/.local/state/nami/profile/share/fonts</dir><cachedir>/var/cache/fontconfig</cachedir></fontconfig>
  # Made from what's installed, as the system is put together.
  # Every package's settings schemas, compiled into one.
  /etc/nami-os/schemas:
    tools: [glib.dev]
    script: |
      shopt -s nullglob
      mkdir -p "$out"
      for p in $packages; do
        for f in "$p"/share/glib-2.0/schemas/*.{xml,override} "$p"/share/gsettings-schemas/*/glib-2.0/schemas/*.{xml,override}; do
          [ -e "$out/${f##*/}" ] || cp "$f" "$out/"
        done
      done
      glib-compile-schemas "$out"
  # Which program opens which kind of file.
  /etc/nami-os/share/mime:
    tools: [shared-mime-info]
    script: |
      shopt -s nullglob
      mkdir -p "$out/packages"
      for p in $packages; do
        for f in "$p"/share/mime/packages/*; do
          [ -e "$out/packages/${f##*/}" ] || cp "$f" "$out/packages/"
        done
      done
      XDG_DATA_DIRS= update-mime-database "$out"
  # QML modules of packages that are only a list of others (nixpkgs'
  # kdePackages.kirigami is one: KDE's apps'
  # building blocks), next to everyone's in sw/lib/qt-6/qml.
  /etc/nami-os/qml:
    script: |
      shopt -s nullglob
      mkdir -p "$out"
      # (Two steps down: the list names the -dev outputs, theirs the rest.)
      for p in $packages; do
        [ -e "$p/lib" ] || [ ! -e "$p/nix-support/propagated-build-inputs" ] && continue
        for q in $(cat "$p/nix-support/propagated-build-inputs"); do
          for r in "$q" $(cat "$q/nix-support/propagated-build-inputs" 2>/dev/null || true); do
            if [ -d "$r/lib/qt-6/qml" ]; then cp -rsn "$r/lib/qt-6/qml/." "$out/"; fi
          done
        done
      done
  # Every installed image loader (SVG, WebP, HEIC...), in one list.
  /etc/nami-os/gdk-pixbuf-loaders.cache:
    tools: [gdk-pixbuf.dev]
    script: |
      shopt -s nullglob
      loaders=()
      # (each a link into its package; or the folder is one, with one package)
      for l in sw/lib/gdk-pixbuf-2.0/2.10.0/loaders/*.so; do loaders+=("$(readlink "$l" || readlink -f "$l")"); done
      gdk-pixbuf-query-loaders "${loaders[@]}" > "$out"
checks.nami
# How to tell desktop works, on a computer nami made (tests/usb.sh runs these).
"video and music: the codecs (H.264, MP3, VP9)":
  run: gst-inspect-1.0 avdec_h264 >/dev/null && gst-inspect-1.0 mpg123audiodec >/dev/null && gst-inspect-1.0 vp9dec >/dev/null && echo CODECS
  expect: "CODECS"
"pictures: WebP and HEIC":
  run: grep -c 'webp\|heif' "$GDK_PIXBUF_MODULE_FILE" | sed 's/^/N=/'
  expect: "N=[1-9]"
"Chinese, Japanese, Korean fonts":
  run: fc-list :lang=ja | wc -l | sed 's/^/N=/'
  expect: "N=[1-9]"
"documents from Windows: Arial's and Times New Roman's stand-ins":
  run: fc-match Arial; fc-match "Times New Roman"
  expect: "Liberation Sans"
"what scripts run on a desktop: xdg-open, notify-send, zenity":
  run: command -v xdg-open notify-send zenity aplay | wc -l | sed 's/^/N=/'
  expect: "N=4"
"Windows computers in Files' Other Locations (wsdd)":
  run: command -v wsdd
  expect: "/wsdd$"
"spell checking (English, and the computer's language: language:)":
  run: ls /run/current-system/sw/share/hunspell/
  expect: "en_US.dic"

docker

2 files

Docker, as on Ubuntu after apt install docker.io docker-compose-v2 docker-buildx and usermod -aG docker you: - docker in computer.nami. docker compose and docker buildx come with it (and your own CLI plugins, in ~/.docker/cli-plugins). Who runs docker without sudo, and Docker's settings, are plain keys of computer.nami. The admins are in the docker group already (below: they're root's equals anyway, as the group makes whoever's in it); someone else, by name: users: anna: { groups: [docker] } # the docker group files: /etc/docker/daemon.json: content: # daemon.json's keys, as JSON registry-mirrors: [https://mirror.example.org] log-driver: local log-opts: { max-size: 10m, max-file: "3" } # (text: quote numbers) data-root: /home/docker # images, containers, volumes restart: docker.service # nami apply restarts dockerd when it changes Whoever is in the docker group can do as root does on the computer, through dockerd, as on Ubuntu; anyone else: sudo docker. When dockerd restarts, containers with a restart policy start again; volumes stay. Not here: rootless Docker (dockerd as you, dockerd-rootless, its own user service); the user IDs it needs (/etc/subuid) and setuid newuidmap are on every nami computer. nami adds no firewall (Ubuntu has none on either): a published port (-p 8080:80) is open to the network, through Docker's own rules, as on Ubuntu. Docker's daemon on a computer nami made, whenever the docker package is on it (as apt install docker.io starts it on Ubuntu): dockerd, through its socket (/run/docker.sock, root's and the docker group's) and with the computer, so containers with a restart policy come back after a restart. Images, containers and volumes are in /var/lib/docker, kept through updates. nixpkgs' package brings Docker's own docker.socket and docker.service, dockerd with iptables, nftables underneath, on its PATH, and a docker command that finds compose and buildx. One difference from Ubuntu: dockerd runs its own containerd (the one nixpkgs bundles, as NixOS runs it), not a containerd.service next to it, so there's no ctr.

package.nami
# Docker, as on Ubuntu after `apt install docker.io docker-compose-v2
# docker-buildx` and `usermod -aG docker you`: `- docker` in
# computer.nami. `docker compose` and `docker buildx` come with it (and your
# own CLI plugins, in ~/.docker/cli-plugins). Who runs docker without
# sudo, and Docker's settings, are plain keys of computer.nami. The admins
# are in the docker group already (below: they're root's equals anyway, as
# the group makes whoever's in it); someone else, by name:
#
#   users:
#     anna: { groups: [docker] }        # the docker group
#   files:
#     /etc/docker/daemon.json:
#       content:                       # daemon.json's keys, as JSON
#         registry-mirrors: [https://mirror.example.org]
#         log-driver: local
#         log-opts: { max-size: 10m, max-file: "3" }   # (text: quote numbers)
#         data-root: /home/docker      # images, containers, volumes
#       restart: docker.service        # `nami apply` restarts dockerd when it changes
#
# Whoever is in the docker group can do as root does on the computer,
# through dockerd, as on Ubuntu; anyone else: `sudo docker`. When dockerd
# restarts, containers with a restart policy start again; volumes stay.
#
# Not here: rootless Docker (dockerd as you, `dockerd-rootless`, its own
# user service); the user IDs it needs (/etc/subuid) and setuid
# newuidmap are on every nami computer. nami adds no firewall (Ubuntu has none on
# either): a published port (`-p 8080:80`) is open to the network, through
# Docker's own rules, as on Ubuntu.
#
# Docker's daemon on a computer nami made, whenever the docker package is
# on it (as `apt install docker.io` starts it on Ubuntu): dockerd, through
# its socket (/run/docker.sock, root's and the docker group's) and with the
# computer, so containers with a restart policy come back after a
# restart. Images, containers and volumes are in /var/lib/docker, kept
# through updates. nixpkgs' package brings Docker's own docker.socket and
# docker.service, dockerd with iptables, nftables underneath, on its PATH,
# and a docker command that finds compose and buildx. One difference from
# Ubuntu: dockerd runs its own containerd (the one nixpkgs bundles, as
# NixOS runs it), not a containerd.service next to it, so there's no
# `ctr`.
services:
  - docker.socket
  - docker.service
# The admins run docker without sudo (the first person on a computer for
# anyone too, set up at its first start, whom no file names yet).
groups:
  docker: admins
files:
  # The socket's group: whoever's in it runs docker without sudo.
  /etc/sysusers.d/docker.conf: |
    g docker -
  # The storage driver's file system, and the bridge's packets through
  # the firewall (dockerd loads them itself too; here they're ready).
  /etc/modules-load.d/docker.conf: |
    overlay
    br_netfilter
  /etc/systemd/system/docker.service.d/nami.conf: |
    [Service]
    # Its own containerd: no --containerd= (there's no containerd.service).
    ExecStart=
    ExecStart=/run/current-system/sw/bin/dockerd -H fd://
checks.nami
# How to tell docker works, on a computer nami made (tests/usb.sh runs these).
"Docker: dockerd runs, and listens on its socket":
  run: echo $(systemctl is-active docker.socket docker.service) $(stat -c '%a %G' /run/docker.sock)
  expect: "^active active 660 docker$"
"Docker: its kernel modules":
  run: echo $(lsmod | grep -oE '^(overlay|br_netfilter) ' | sort)
  expect: "^br_netfilter overlay$"
"Docker: docker without sudo, for the docker group (overlay storage, systemd's cgroups)":
  run: docker info --format '{{.ServerVersion}} {{.Driver}} {{.CgroupDriver}}'
  expect: "^[0-9]+\\.[0-9.]+ overlay(2|fs) systemd$"
"Docker: docker compose and docker buildx":
  run: echo $(docker compose version) / $(docker buildx version)
  expect: "^Docker Compose version v?[0-9]+\\.[0-9.]+ / github.com/docker/buildx v[0-9]"
"Docker: daemon.json, if computer.nami gives one, is one dockerd takes":
  run: if [ -e /etc/docker/daemon.json ]; then dockerd --validate --config-file /etc/docker/daemon.json; else echo "configuration OK (none)"; fi
  expect: "^configuration OK"
"Docker: its data on the disk, kept through updates":
  run: d=$(docker info --format '{{.DockerRootDir}}'); echo $d $(findmnt -no FSTYPE -T $d)
  expect: "^/[^ ]+ (ext4|btrfs|xfs)$"

firewall

2 files

The firewall, as a Mac's or Windows' is: nothing from outside connects to this computer unless it's allowed. What this computer starts (a web page, an update, a call) gets its answers as always. Settings' Privacy & Security turns it on and off and says what's allowed in; that's written in computer.nami, as: files: /etc/firewall/firewall.conf: on: true allow: LocalSend: [tcp 53317, udp 53317] Remote login (SSH): tcp 22 A package whose program others connect to brings its own file in /etc/firewall/allow.d (tailscale's, steam's, KDE Connect's), with the same [allow] lines: name = tcp 22, name = udp 5000-5010. Always let in, firewall or not: this computer itself; its own containers, VMs and tailnet (Docker's and Podman's bridges, libvirt's, tailscale0: what's on them is this computer's or yours, and Tailscale's own rules say who's on the tailnet); ping and IPv6's own messages; the names of printers and computers on the network (mDNS), and devices there answering when asked (UPnP, WS-Discovery); an address from the network (DHCP); and what sharing this connection (a hotspot) needs. nftables, a table of its own (inet nami_firewall): Docker's, Tailscale's and others' tables stay theirs. firewall.service loads it before the network comes up, and again whenever nami apply changes what's allowed.

package.nami
# The firewall, as a Mac's or Windows' is: nothing from outside connects
# to this computer unless it's allowed. What this computer starts (a web
# page, an update, a call) gets its answers as always. Settings' Privacy
# & Security turns it on and off and says what's allowed in; that's
# written in computer.nami, as:
#
#   files:
#     /etc/firewall/firewall.conf:
#       on: true
#       allow:
#         LocalSend: [tcp 53317, udp 53317]
#         Remote login (SSH): tcp 22
#
# A package whose program others connect to brings its own file in
# /etc/firewall/allow.d (tailscale's, steam's, KDE Connect's), with the
# same [allow] lines: `name = tcp 22`, `name = udp 5000-5010`.
#
# Always let in, firewall or not: this computer itself; its own containers,
# VMs and tailnet (Docker's and Podman's bridges, libvirt's, tailscale0:
# what's on them is this computer's or yours, and Tailscale's own rules
# say who's on the tailnet); ping and IPv6's own messages; the names of
# printers and computers on the network (mDNS), and devices there
# answering when asked (UPnP, WS-Discovery); an address from the network
# (DHCP); and what sharing this connection (a hotspot) needs.
#
# nftables, a table of its own (inet nami_firewall): Docker's, Tailscale's
# and others' tables stay theirs. firewall.service loads it before the
# network comes up, and again whenever `nami apply` changes what's allowed.
packages:
  - nftables
services:
  - firewall.service
files:
  /etc/firewall/firewall.conf:
    content:
      on: true
      allow: {}
    restarts: firewall.service
  /etc/firewall/firewall.sh: |
    # firewall.service: the firewall's rules, from firewall.conf and what
    # packages allow in allow.d. `stop`: none; `print`: the rules, not
    # loaded. (FIREWALL_CONF and FIREWALL_DIR: other files, to try.)
    set -eu
    PATH=/run/current-system/sw/bin:$PATH
    conf=${FIREWALL_CONF:-/etc/firewall/firewall.conf}
    dir=${FIREWALL_DIR:-/etc/firewall/allow.d}
    what=${1:-start}
    off() { nft delete table inet nami_firewall 2>/dev/null || true; }
    if [ "$what" = stop ]; then off; exit 0; fi
    # (Before any [section]: `on = false` turns it off.)
    on=$(awk '/^\[/ { exit } { i = index($0, " = ") } i && substr($0, 1, i - 1) == "on" { v = substr($0, i + 3) } END { print v }' "$conf" 2>/dev/null || true)
    if [ "$on" = false ]; then
      echo "off: $conf says on = false"
      [ "$what" = print ] || off
      exit 0
    fi
    # What's allowed in: `name = tcp 22` in an [allow] section. Anything
    # else is said, and left out: one wrong line never leaves it open.
    allowed() {
      for f in "$conf" "$dir"/*.conf; do
        [ -r "$f" ] || continue
        awk -v file="$f" '
          /^\[/ { on = ($0 == "[allow]"); next }
          !on || !index($0, " = ") { next }
          {
            i = index($0, " = "); name = substr($0, 1, i - 1); said = substr($0, i + 3)
            n = split(said, w, " "); lo = w[2]; hi = w[2]
            if (index(lo, "-")) { hi = substr(lo, index(lo, "-") + 1); lo = substr(lo, 1, index(lo, "-") - 1) }
            if (n != 2 || (w[1] != "tcp" && w[1] != "udp") || lo !~ /^[0-9]+$/ || hi !~ /^[0-9]+$/ || lo + 0 < 1 || hi + 0 > 65535 || lo + 0 > hi + 0) {
              printf "%s: not understood, left out: %s\n", file, $0 > "/dev/stderr"; next
            }
            gsub(/["\\]/, "", name)
            printf "    %s dport %s accept comment \"%s\"\n", w[1], (lo == hi ? lo : lo "-" hi), substr(name, 1, 100)
          }' "$f"
      done
    }
    rules=$(allowed)
    private4="10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, 169.254.0.0/16"
    private6="fe80::/10, fc00::/7"
    ruleset() {
      cat <<RULES
    table inet nami_firewall
    delete table inet nami_firewall
    table inet nami_firewall {
      chain input {
        type filter hook input priority filter; policy drop;
        ct state established,related accept
        ct state invalid drop
        iif lo accept
        iifname "tailscale0" accept comment "the tailnet"
        iifname "docker0" accept comment "containers"
        iifname "br-*" accept comment "containers"
        iifname "podman*" accept comment "containers"
        iifname "virbr*" accept comment "virtual machines"
        meta l4proto { 1, 2, 58 } accept comment "ping, and the network's own messages (ICMP, IGMP, ICMPv6)"
        udp dport 5353 accept comment "names of computers and printers on the network (mDNS)"
        udp sport 67 udp dport 68 accept comment "an address from the network (DHCP)"
        ip6 saddr fe80::/10 udp sport 547 udp dport 546 accept comment "an address from the network (DHCPv6)"
        ip saddr { $private4 } udp sport { 1900, 3702, 5353 } accept comment "devices on the network answering (UPnP, WS-Discovery, mDNS)"
        ip6 saddr { $private6 } udp sport { 1900, 3702, 5353 } accept comment "devices on the network answering (UPnP, WS-Discovery, mDNS)"
        udp dport 67 accept comment "sharing this connection (hotspot): addresses"
        ip saddr { $private4 } meta l4proto { tcp, udp } th dport 53 accept comment "sharing this connection (hotspot): names"
    $rules
        counter comment "blocked"
      }
    }
    RULES
    }
    if [ "$what" = print ]; then ruleset; exit 0; fi
    ruleset | nft -f -
    echo "on: incoming connections only for what's allowed ($(printf '%s\n' "$rules" | grep -c accept || true) allowed)"
  /etc/systemd/system/firewall.service: |
    [Unit]
    Description=The firewall: incoming connections only for what's allowed
    DefaultDependencies=no
    After=local-fs.target
    Before=network-pre.target shutdown.target
    Wants=network-pre.target
    Conflicts=shutdown.target
    [Service]
    Type=oneshot
    RemainAfterExit=yes
    ExecStart=/run/current-system/sw/bin/sh /etc/firewall/firewall.sh start
    ExecReload=/run/current-system/sw/bin/sh /etc/firewall/firewall.sh start
    ExecStop=/run/current-system/sw/bin/sh /etc/firewall/firewall.sh stop
    [Install]
    WantedBy=multi-user.target
checks.nami
# How to tell the firewall works, on a computer nami made (tests/usb.sh and nami doctor run these).
"firewall: on, its rules in place":
  run: systemctl is-active firewall
  expect: "^active"
"firewall: what it lets in, as it reads it, is all understood":
  run: sh /etc/firewall/firewall.sh print 2>&1 >/dev/null | grep -c "not understood" | sed "s/^/wrong=/"
  expect: "^wrong=0$"

flatpak

2 files

Flatpak, with Flathub: the thousands of apps their makers put there (commercial ones too: Spotify, Zoom, Slack...), each in a sandbox of its own. Each person's are their own, as the rest of their user.nami is: - flathub:com.spotify.Client under their packages, or Install on one from Flathub in Your Apps (Settings). nami installs it with flatpak --user into ~/.local/share/flatpak (no admin's password, and nobody else gets it), takes off what's taken off the list, and keeps each change in their history (nami history, nami undo). What's set up here, for that: - Flatpak itself; its helper for installs for the whole computer (by hand: flatpak install --system) with polkit's rules for admins, and the user flatpak it runs as (its sysusers.d). - Flathub, for those installs too (remotes.d); nami adds it for each person from the same file. - The portals sandboxed apps ask for files, links, printing and settings (light or dark, fonts, the cursor): xdg-desktop-portal with GTK's, and niri's GNOME's. - Their menu entries and icons in XDG_DATA_DIRS (after the computer's and the person's own: an app from nixpkgs comes first), for the launcher and the dock. - Fonts and icons, the cursor's too: nixpkgs' Flatpak shows its apps /run/current-system/sw/share/X11/fonts and share/icons (nami makes the fonts folder when Flatpak is on the computer). - GTK 3's look in the sandbox: adw-gtk3 and adw-gtk3-dark from Flathub, with a person's first app (the GTK 4 apps follow light and dark by the portal). - Updates: with the rest in Updates (nami upgrade), and by themselves once a day (nami-flathub-update.timer, each person's; a step of their history when a version changes).

package.nami
# Flatpak, with Flathub: the thousands of apps their makers put there
# (commercial ones too: Spotify, Zoom, Slack...), each in a sandbox of
# its own. Each person's are their own, as the rest of their user.nami is:
# `- flathub:com.spotify.Client` under their packages, or Install on one
# from Flathub in Your Apps (Settings). nami installs it with `flatpak
# --user` into ~/.local/share/flatpak (no admin's password, and nobody
# else gets it), takes off what's taken off the list, and keeps each change
# in their history (`nami history`, `nami undo`).
#
# What's set up here, for that:
# - Flatpak itself; its helper for installs for the whole computer (by
#   hand: `flatpak install --system`) with polkit's rules for admins, and
#   the user `flatpak` it runs as (its sysusers.d).
# - Flathub, for those installs too (remotes.d); nami adds it for each
#   person from the same file.
# - The portals sandboxed apps ask for files, links, printing and settings
#   (light or dark, fonts, the cursor): xdg-desktop-portal with GTK's, and
#   niri's GNOME's.
# - Their menu entries and icons in XDG_DATA_DIRS (after the computer's
#   and the person's own: an app from nixpkgs comes first), for the
#   launcher and the dock.
# - Fonts and icons, the cursor's too: nixpkgs' Flatpak shows its apps
#   /run/current-system/sw/share/X11/fonts and share/icons (nami makes the
#   fonts folder when Flatpak is on the computer).
# - GTK 3's look in the sandbox: adw-gtk3 and adw-gtk3-dark from Flathub,
#   with a person's first app (the GTK 4 apps follow light and dark by the
#   portal).
# - Updates: with the rest in Updates (`nami upgrade`), and by themselves
#   once a day (nami-flathub-update.timer, each person's; a step of their
#   history when a version changes).
packages:
  - xdg-desktop-portal
  - xdg-desktop-portal-gtk
services:
  - nami-flathub-update.timer: { per-person: true }
files:
  /etc/flatpak/remotes.d/flathub.flatpakrepo: |
    [Flatpak Repo]
    Title=Flathub
    Url=https://dl.flathub.org/repo/
    Homepage=https://flathub.org/
    Comment=Central repository of Flatpak applications
    Description=Central repository of Flatpak applications
    Icon=https://dl.flathub.org/repo/logo.svg
    GPGKey=mQINBFlD2sABEADsiUZUOYBg1UdDaWkEdJYkTSZD68214m8Q1fbrP5AptaUfCl8KYKFMNoAJRBXn9FbE6q6VBzghHXj/rSnA8WPnkbaEWR7xltOqzB1yHpCQ1l8xSfH5N02DMUBSRtD/rOYsBKbaJcOgW0K21sX+BecMY/AI2yADvCJEjhVKrjR9yfRX+NQEhDcbXUFRGt9ZT+TI5yT4xcwbvvTu7aFUR/dH7+wjrQ7lzoGlZGFFrQXSs2WI0WaYHWDeCwymtohXryF8lcWQkhH8UhfNJVBJFgCY8Q6UHkZG0FxMu8xnIDBMjBmSZKwKQn0nwzwM2afskZEnmNPYDI8nuNsSZBZSAw+ThhkdCZHZZRwzmjzyRuLLVFpOj3XryXwZcSefNMPDkZAuWWzPYjxS80cm2hG1WfqrG0Gl8+iX69cbQchb7gbEb0RtqNskTo9DDmO0bNKNnMbzmIJ3/rTbSahKSwtewklqSP/01o0WKZiy+n/RAkUKOFBprjJtWOZkc8SPXV/rnoS2dWsJWQZhuPPtv3tefdDiEyp7ePrfgfKxuHpZES0IZRiFI4J/nAUP5bix+srcIxOVqAam68CbAlPvWTivRUMRVbKjJiGXIOJ78wAMjqPg3QIC0GQ0EPAWwAOzzpdgbnG7TCQetaVV8rSYCuirlPYN+bJIwBtkOC9SWLoPMVZTwQARAQABtC5GbGF0aHViIFJlcG8gU2lnbmluZyBLZXkgPGZsYXRodWJAZmxhdGh1Yi5vcmc+iQJUBBMBCAA+FiEEblwF2XnHba+TwIE1QYTdTZB6fK4FAllD2sACGwMFCRLMAwAFCwkIBwIGFQgJCgsCBBYCAwECHgECF4AACgkQQYTdTZB6fK5RJQ/+Ptd4sWxaiAW91FFk7+wmYOkEe1NY2UDNJjEEz34PNP/1RoxveHDt43kYJQ23OWaPJuZAbu+fWtjRYcMBzOsMCaFcRSHFiDIC9aTp4ux/mo+IEeyarYt/oyKb5t5lta6xaAqg7rwt65jW5/aQjnS4h7eFZ+dAKta7Y/fljNrOznUp81/SMcx4QA5G2Pw0hs4Xrxg59oONOTFGBgA6FF8WQghrpR7SnEe0FSEOVsAjwQ13Cfkfa7b70omXSWp7GWfUzgBKyoWxKTqzMN3RQHjjhPJcsQnrqH5enUu4Pcb2LcMFpzimHnUgb9ft72DP5wxfzHGAWOUiUXHbAekfq5iFks8cha/RST6wkxG3Rf44Zn09aOxh1btMcGL+5xb1G0BuCQnA0fP/kDYIPwh9z22EqwRQOspIcvGeLVkFeIfubxpcMdOfQqQnZtHMCabV5Q/Rk9K1ZGc8M2hlg8gHbXMFch2xJ0Wu72eXbA/UY5MskEeBgawTQnQOK/vNm7t0AJMpWK26Qg6178UmRghmeZDj9uNRc3EI1nSbgvmGlpDmCxaAGqaGL1zW4KPW5yN25/qeqXcgCvUjZLI9PNq3Kvizp1lUrbx7heRiSoazCucvHQ1VHUzcPVLUKKTkoTP8okThnRRRsBcZ1+jI4yMWIDLOCT7IW3FePr+3xyuy5eEo9a25Ag0EWUPa7AEQALT/CmSyZ8LWlRYQZKYw417p7Z2hxqd6TjwkwM3IQ1irumkWcTZBZIbBgrSOg6CcXD2oWydCQHWi9qaxhuhEl2bJL5LskmBcMxVdQeD0LLHd8QUnbnnIby8ocvWN1alPfvJFjCUTrmD22U1ycOzRw2lIe4kiQONbOZtdWrVImQQSndjFlisitbmlWHvHm2lOOYy8+GJB7YffVV193hmnBSJffCy4bvkuLxsI+n1DhOzc7MPV3z6HGk4HiEcF0yyt9tCYhpsxHFdBoq2h771HfAcS0s98EVAqYMFnf9em+4cnYpdI6mhIfS1FQiKl6DBAYA8tT3ggla00DurPo0JwX/zN+PaO5h/6O9aCZwV7G6rbkgMuqMergXaf8oP38gr0z+MqWnkfM63Bodq68GP4l4hd02BoFBbDf38TMuGQB14+twJMdfbAxo2MbgluvQgfwHfZ2ca6gyEY+9s/YD1gugLjV+S6CB51WkFNe1z4tAPgJZNxUcKCbeaHNbthl8Hks/pY9RCEseX/EdfzF18epbSjJMPh4DPQXbUoFwmyuYcoBOPmvZHNl9hK7B/1RP8w1ZrXk8qdupC0SNbafX7270B7lMMVImzZetGsM9ypXJ6llhp3FwW09iseNyGJGPsr/dvTMGDXqOPfU/9SAS1LSTY4K9PbRtdrBE318YX8mIk5ABEBAAGJBHIEGAEIACYWIQRuXAXZecdtr5PAgTVBhN1NkHp8rgUCWUPa7AIbAgUJEswDAAJACRBBhN1NkHp8rsF0IAQZAQgAHRYhBFSmzd2JGfsgQgDYrFYnAunj7X7oBQJZQ9rsAAoJEFYnAunj7X7oR6AP/0KYmiAFeqx14Z43/6s2gt3VhxlSd8bmcVV7oJFbMhdHBIeWBp2BvsUf00I0Zl14ZkwCKfLwbbORC2eIxvzJ+QWjGfPhDmS4XUSmhlXxWnYEveSek5Tde+fmu6lqKM8CHg5BNx4GWIX/vdLi1wWJZyhrUwwICAxkuhKxuP2Z1An48930eslTD2GGcjByc27+9cIZjHKa07I/aLffo04V+oMT9/tgzoquzgpVV4jwekADo2MJjhkkPveSNI420bgT+Q7Fi1l0X1aFUniBvQMsaBa27PngWm6xE2ZYvh7nWCdd5g0c0eLIHxWwzV1lZ4Ryx4ITO/VL25ItECcjhTRdYa64sA62MYSaB0x3eR+SihpgP3wSNPFu3MJo6FKTFdi4CBAEmpWHFW7FcRmd+cQXeFrHLN3iNVWryy0HK/CUEJmiZEmpNiXecl4vPIIuyF0zgSCztQtKoMr+injpmQGC/rF/ELBVZTUSLNB350S0Ztvw0FKWDAJSxFmoxt3xycqvvt47rxTrhi78nkk6jATKGyvP55sO+K7Q7Wh0DXA69hvPrYW2eu8jGCdVGxi6HX7L1qcfEd0378S71dZ3g9o6KKl1OsDWWQ6MJ6FGBZedl/ibRfs8p5+sbCX3lQSjEFy3rx6n0rUrXx8U2qb+RCLzJlmC5MNBOTDJwHPcX6gKsUcXZrEQALmRHoo3SrewO41RCr+5nUlqiqV3AohBMhnQbGzyHf2+drutIaoh7Rj80XRh2bkkuPLwlNPf+bTXwNVGse4bej7B3oV6Ae1N7lTNVF4Qh+1OowtGjmfJPWo0z1s6HFJVxoIof9z58Msvgao0zrKGqaMWaNQ6LUeC9g9Aj/9Uqjbo8X54aLiYs8Z1WNc06jKP+gv8AWLtv6CR+l2kLez1YMDucjm7v6iuCMVAmZdmxhg5I/X2+OM3vBsqPDdQpr2TPDLX3rCrSBiS0gOQ6DwN5N5QeTkxmY/7QO8bgLo/Wzu1iilH4vMKW6LBKCaRx5UEJxKpL4wkgITsYKneIt3NTHo5EOuaYk+y2+Dvt6EQFiuMsdbfUjs3seIHsghX/cbPJa4YUqZAL8C4OtVHaijwGo0ymt9MWvS9yNKMyT0JhN2/BdeOVWrHk7wXXJn/ZjpXilicXKPx4udCF76meE+6N2u/T+RYZ7fP1QMEtNZNmYDOfA6sViuPDfQSHLNbauJBo/n1sRYAsL5mcG22UDchJrlKvmK3EOADCQg+myrm8006LltubNB4wWNzHDJ0Ls2JGzQZCd/xGyVmUiidCBUrD537WdknOYE4FD7P0cHaM9brKJ/M8LkEH0zUlo73bY4XagbnCqve6PvQb5G2Z55qhWphd6f4B6DGed86zJEa/RhS
  # (The computer's and the person's own come first: an app installed both
  # ways is the one from nixpkgs.)
  /etc/profile.d/flatpak.sh: |
    case ":$XDG_DATA_DIRS:" in
      *":${XDG_DATA_HOME:-$HOME/.local/share}/flatpak/exports/share:"*) ;;
      *) XDG_DATA_DIRS="${XDG_DATA_DIRS:+$XDG_DATA_DIRS:}${XDG_DATA_HOME:-$HOME/.local/share}/flatpak/exports/share:/var/lib/flatpak/exports/share" ;;
    esac
    export XDG_DATA_DIRS
  # Installing for the whole computer: an admin at it, without a password
  # (as Flatpak's own rules say; here where polkit reads them).
  /etc/polkit-1/rules.d/30-flatpak.rules: |
    polkit.addRule(function(action, subject) {
      if ((action.id == "org.freedesktop.Flatpak.app-install" || action.id == "org.freedesktop.Flatpak.runtime-install" ||
           action.id == "org.freedesktop.Flatpak.app-uninstall" || action.id == "org.freedesktop.Flatpak.runtime-uninstall" ||
           action.id == "org.freedesktop.Flatpak.modify-repo") &&
          subject.active && subject.local && subject.isInGroup("wheel"))
        return polkit.Result.YES;
      return polkit.Result.NOT_HANDLED;
    });
  /etc/systemd/user/nami-flathub-update.service: |
    [Unit]
    Description=Your apps from Flathub, to their newest
    ConditionUser=!@system
    ConditionPathIsDirectory=%h/.local/share/flatpak/app
    After=network-online.target
    [Service]
    Type=oneshot
    Nice=10
    IOSchedulingClass=idle
    ExecStart=/nix/var/nami/bin/nami upgrade --flathub
  /etc/systemd/user/nami-flathub-update.timer: |
    [Unit]
    Description=Your apps from Flathub, to their newest, once a day
    ConditionUser=!@system
    [Timer]
    OnStartupSec=15min
    OnUnitActiveSec=1d
    RandomizedDelaySec=30min
    [Install]
    WantedBy=timers.target
checks.nami
# How to tell flatpak works, on a computer nami made (tests/usb.sh and
# tests/vm-quick.sh tests/namios run these). Installing an app from Flathub
# is tests/lib/namios-flatpak-check.sh's (it downloads: NAMI_VM_FLATPAK=1).
"Flatpak: there, with Flathub for the computer":
  # (Flatpak takes it in as root, the first time something's installed for the computer.)
  run: echo $(flatpak --version) $(sed -n 's|^Url=https://dl.flathub.org/repo/$|flathub|p' /etc/flatpak/remotes.d/flathub.flatpakrepo)
  expect: "^Flatpak [0-9.]+ flathub"
"Flatpak: installs for the computer go through its helper, admins without a password":
  run: pkaction --action-id org.freedesktop.Flatpak.app-install >/dev/null && ls /run/current-system/sw/share/dbus-1/system-services/org.freedesktop.Flatpak.SystemHelper.service /etc/static/polkit-1/rules.d/30-flatpak.rules >/dev/null && getent passwd flatpak >/dev/null && echo HELPER
  expect: "^HELPER"
"Flatpak: the computer's fonts, where its apps see them":
  run: find -L /run/current-system/sw/share/X11/fonts -name '*.ttf' -o -name '*.otf' | wc -l | sed 's/^/N=/'
  expect: "N=[1-9][0-9]"
"Flatpak: each person's apps update once a day":
  run: systemctl --user is-enabled nami-flathub-update.timer
  expect: "^enabled"
"in the desktop: Flatpak's apps are in the menus (XDG_DATA_DIRS)":
  run: tr '\0' '\n' < /proc/$(pgrep -u "$USER" -x nami-desktop | head -1)/environ | sed -n 's/^XDG_DATA_DIRS=//p' | tr ':' '\n' | grep -c 'flatpak/exports/share' | sed 's/^/N=/'
  expect: "N=2"

fprintd

2 files

fprintd: logging in with a finger, as Ubuntu does (libpam-fprintd), once one is enrolled (Settings, Users, Fingerprint Login). The login and lock screens ask for it next to the password box (each login screen's own service for it, as gdm-fingerprint); sudo, su and the admin questions try it first (10 seconds), then ask for the password; the text console asks for the password alone. Without a reader, or with no finger enrolled, it steps aside at once: the password is asked as before.

package.nami
# fprintd: logging in with a finger, as Ubuntu does (libpam-fprintd), once
# one is enrolled (Settings, Users, Fingerprint Login). The login and
# lock screens ask for it next to the password box (each login screen's
# own service for it, as gdm-fingerprint); sudo, su and the admin questions try it first (10
# seconds), then ask for the password; the text console asks for the
# password alone. Without a reader, or with no finger enrolled, it steps
# aside at once: the password is asked as before.
login:
  all:
    - auth sufficient /run/current-system/sw/lib/security/pam_fprintd.so max-tries=1 timeout=10
checks.nami
# How to tell fprintd works, on a computer nami made (tests/usb.sh runs these).
"fingerprint login: fprintd answers (started by D-Bus)":
  run: timeout 30 busctl --system call net.reactivated.Fprint /net/reactivated/Fprint/Manager net.reactivated.Fprint.Manager GetDevices
  expect: "^ao "
"fingerprint login: tried first by sudo and the admin questions, not by the text console":
  run: grep -c pam_fprintd /etc/pam.d/sudo /etc/pam.d/polkit-1 /etc/pam.d/login | tr '\n' ' '
  expect: "sudo:1 .*polkit-1:1 .*login:0"
"fingerprint login: without a reader, the password is asked at once":
  run: "timeout 30 sh -c 'echo wrong | sudo -S -k -p \"\" true' 2>&1 | tail -3"
  expect: "incorrect password|try again"

fuse3

1 file

FUSE: file systems run as you (network shares, phones, AppImages).

package.nami
# FUSE: file systems run as you (network shares, phones, AppImages).
setuid: [bin/fusermount3]

fwupd

2 files

Firmware updates (Settings, GNOME Firmware): the list of updates is fetched now and then.

package.nami
# Firmware updates (Settings, GNOME Firmware): the list of updates is
# fetched now and then.
services:
  - fwupd-refresh.timer
checks.nami
# How to tell fwupd works, on a computer nami made (tests/usb.sh runs these).
"firmware updates: fwupd":
  run: fwupdmgr --version 2>&1 | grep -m1 fwupd
  expect: "fwupd"
"firmware updates: the daemon answers, with LVFS (Linux Vendor Firmware Service) on":
  run: timeout 60 fwupdmgr get-remotes 2>&1 | grep -A2 'Remote ID. *lvfs$' | grep -c 'Enabled. *true' | sed 's/^/N=/'
  expect: "N=1"

gamemode

2 files

GameMode (Feral Interactive's): while a game runs, the computer is set for it, with the processor's fast governor and the screensaver held back. - gamemode in computer.nami, then in Steam a game's launch options: gamemoderun %command%. gamemoded starts by itself, for whoever asks (D-Bus starts it). It changes the governor through polkit's pkexec, which lets the gamemode group do it without a password: everyone is in it.

package.nami
# GameMode (Feral Interactive's): while a game runs, the computer is set
# for it, with the processor's fast governor and the screensaver held
# back. `- gamemode` in computer.nami, then in Steam a game's launch
# options: `gamemoderun %command%`.
#
# gamemoded starts by itself, for whoever asks (D-Bus starts it). It
# changes the governor through polkit's pkexec, which lets the gamemode
# group do it without a password: everyone is in it.
groups:
  gamemode: everyone
files:
  /etc/polkit-1/rules.d/50-gamemode.rules: |
    polkit.addRule(function (action, subject) {
      if ((action.id == "com.feralinteractive.GameMode.governor-helper" ||
           action.id == "com.feralinteractive.GameMode.gpu-helper" ||
           action.id == "com.feralinteractive.GameMode.cpu-helper" ||
           action.id == "com.feralinteractive.GameMode.procsys-helper") &&
          subject.isInGroup("gamemode")) {
        return polkit.Result.YES;
      }
    });
checks.nami
# How to tell gamemode works, on a computer nami made (tests/usb.sh runs these).
"GameMode: on while a game runs (gamemoded, started by D-Bus)":
  run: gamemoded -r >/dev/null 2>&1 & sleep 3; gamemoded -s; kill $!
  expect: "gamemode is active"
"GameMode: it may change the governor without a password":
  run: pkcheck --action-id com.feralinteractive.GameMode.governor-helper --process $$ && echo allowed
  expect: "^allowed"

gaming

1 file

Games: Steam and the other stores, and GameMode while a game runs. - gaming in computer.nami; the window offers it under "What it's for". Take one out with without: [mangohud]; add more by name (lutris, bottles, prismlauncher, retroarch).

package.nami
# Games: Steam and the other stores, and GameMode while a game runs.
# `- gaming` in computer.nami; the window offers it under "What it's for".
# Take one out with `without: [mangohud]`; add more by name (lutris,
# bottles, prismlauncher, retroarch).
packages:
  - steam            # Steam, with its 32-bit drivers and controllers
  - heroic           # Epic, GOG and Amazon games
  - protonup-qt      # more Proton builds, for Steam and Heroic
  - gamemode         # the computer set for the game while it runs
  - mangohud         # frame rate and temperatures over the game

gdm

2 files

GDM, the login screen: its users, its login rules, its settings, and the environment it hands the desktops it starts. Its greeter is GNOME's shell, in a session of its own.

package.nami
# GDM, the login screen: its users, its login rules, its settings, and the
# environment it hands the desktops it starts.
# Its greeter is GNOME's shell, in a session of its own.
packages:
  - gnome-session
  - gnome-session.sessions
  - gnome-shell
  - mutter
  - gnome-settings-daemon
files:
  # Its own user, and the users its login screens run as.
  /etc/sysusers.d/gdm.conf: |
    u gdm 132 "GDM" /run/gdm
    u gdm-greeter 60578:gdm "GDM greeter" /run/gdm/home/gdm-greeter
    u gdm-greeter-2 60579:gdm "GDM greeter" /run/gdm/home/gdm-greeter-2
    u gdm-greeter-3 60580:gdm "GDM greeter" /run/gdm/home/gdm-greeter-3
    u gdm-greeter-4 60581:gdm "GDM greeter" /run/gdm/home/gdm-greeter-4
    u gdm-greeter-5 60582:gdm "GDM greeter" /run/gdm/home/gdm-greeter-5
  /etc/tmpfiles.d/gdm.conf: |
    d /var/lib/gdm 0750 gdm gdm -
  /etc/gdm/custom.conf: |
    [daemon]
    WaylandEnable=true
  # The login screen's settings: everyone's (os.settings: the keyboard,
  # the look), then GDM's own defaults.
  /etc/dconf/profile/gdm: |
    user-db:user
    system-db:local
    file-db:/run/current-system/sw/share/gdm/greeter-dconf-defaults
  # Where things are, for the desktops it starts (its own unit has the rest).
  /etc/systemd/system/gdm.service.d/nami.conf: |
    [Unit]
    After=systemd-user-sessions.service
    [Service]
    EnvironmentFile=/etc/nami-os/environment
settings:
  org.gnome.login-screen:
    logo: ""
login:
  # The password box, and the finger next to it (once one is enrolled:
  # fprintd).
  gdm-password: password
  gdm-fingerprint: |
    auth required /run/current-system/sw/lib/security/pam_fprintd.so
    account required /run/current-system/sw/lib/security/pam_unix.so
    password required /run/current-system/sw/lib/security/pam_deny.so
    session required /run/current-system/sw/lib/security/pam_env.so conffile=/etc/pam/environment readenv=0
    session required /run/current-system/sw/lib/security/pam_unix.so
    session optional /run/current-system/sw/lib/security/pam_loginuid.so
    session optional /run/current-system/sw/lib/security/pam_keyinit.so force revoke
    session optional /run/current-system/sw/lib/security/pam_systemd.so
    session optional /run/current-system/sw/lib/security/pam_gnome_keyring.so auto_start
  gdm-autologin: login
  # The login screen itself, as one of GDM's users: no password.
  gdm-launch-environment: |
    auth required /run/current-system/sw/lib/security/pam_succeed_if.so audit quiet_success user ingroup gdm
    auth optional /run/current-system/sw/lib/security/pam_permit.so
    account required /run/current-system/sw/lib/security/pam_succeed_if.so audit quiet_success user ingroup gdm
    account sufficient /run/current-system/sw/lib/security/pam_unix.so
    password required /run/current-system/sw/lib/security/pam_deny.so
    session required /run/current-system/sw/lib/security/pam_succeed_if.so audit quiet_success user ingroup gdm
    session required /run/current-system/sw/lib/security/pam_env.so conffile=/etc/pam/environment readenv=0
    session optional /run/current-system/sw/lib/security/pam_systemd.so
    session optional /run/current-system/sw/lib/security/pam_keyinit.so force revoke
    session optional /run/current-system/sw/lib/security/pam_permit.so
checks.nami
# How to tell gdm works, on a computer nami made (tests/usb.sh runs these).
"the login screen":
  run: systemctl is-active display-manager
  expect: "^active"
"GDM: the finger next to the password box, the password alone in it":
  run: grep -c pam_fprintd /etc/pam.d/gdm-fingerprint /etc/pam.d/gdm-password | tr '\n' ' '
  expect: "gdm-fingerprint:1 .*gdm-password:0"
"GDM: each person starts in the first desktop (AccountsService)":
  run: u=$(busctl --system call org.freedesktop.Accounts /org/freedesktop/Accounts org.freedesktop.Accounts FindUserByName s "$(id -un)" | cut -d'"' -f2); s=$(busctl --system get-property org.freedesktop.Accounts "$u" org.freedesktop.Accounts.User Session); [ "$s" = "s \"$(cat /run/current-system/default-session)\"" ] && echo SAME || echo "$s"
  expect: "^SAME"

geoclue2

1 file

Where the computer is (for the time zone and maps), from Wi-Fi networks.

package.nami
# Where the computer is (for the time zone and maps), from Wi-Fi networks.
files:
  /etc/sysusers.d/geoclue.conf: |
    u geoclue - "geoclue" /var/lib/geoclue
  /etc/tmpfiles.d/geoclue.conf: |
    d /var/lib/geoclue 0755 geoclue geoclue -

The keyring: passwords for Wi-Fi, accounts and apps, unlocked by your login password (the login rules hand it over, after pam_unix read it). And an SSH agent, as on Ubuntu: gcr's, holding the keys ssh-add gives it, in each person's session ($SSH_AUTH_SOCK, from its socket).

package.nami
# The keyring: passwords for Wi-Fi, accounts and apps, unlocked by your
# login password (the login rules hand it over, after pam_unix read it).
# And an SSH agent, as on Ubuntu: gcr's, holding the keys `ssh-add` gives
# it, in each person's session ($SSH_AUTH_SOCK, from its socket).
packages:
  - gcr_4
services:
  - gcr-ssh-agent.socket: { per-person: true }
# Electron's apps (Element, VS Code, Claude Desktop, Slack, …) and Chromium keep their
# passwords in the keyring only on desktops they know by name: GNOME's, KDE's and a few
# more (XDG_CURRENT_DESKTOP). On niri they'd keep them in a file
# instead, or not open at all ("start with --password-store=gnome-libsecret"). This says
# a GNOME keyring is here, as gnome-session does: Chromium looks at it only when it
# doesn't know the desktop's name, so the name stays the desktop's own (the portals,
# Qt's look and the menus go by that).
env:
  GNOME_DESKTOP_SESSION_ID: this-is-deprecated
login:
  all:
    - auth optional /run/current-system/sw/lib/security/pam_gnome_keyring.so
    - password optional /run/current-system/sw/lib/security/pam_gnome_keyring.so use_authtok
    - session optional /run/current-system/sw/lib/security/pam_gnome_keyring.so auto_start
checks.nami
# How to tell gnome-keyring works, on a computer nami made (tests/usb.sh runs these).
"an SSH agent in each person's session (gcr's)":
  run: echo $(systemctl --user show-environment | grep -o '^SSH_AUTH_SOCK=.*gcr/ssh') $(SSH_AUTH_SOCK=$XDG_RUNTIME_DIR/gcr/ssh ssh-add -l >/dev/null 2>&1; echo answers=$?)
  expect: "^SSH_AUTH_SOCK=/run/user/[0-9]+/gcr/ssh answers=1$"
"in the desktop: Electron's apps and Chromium are told the keyring's here, whatever the desktop's name":
  run: systemctl --user show-environment | grep -E '^GNOME_DESKTOP_SESSION_ID='
  expect: "^GNOME_DESKTOP_SESSION_ID=."

greetd

2 files

greetd, a small login manager: it starts a greeter (the login screen a package that lists greetd brings, with its /etc/greetd/config.toml) and, once someone's in, their desktop. On the first screen (tty1), as NixOS's module sets it up.

package.nami
# greetd, a small login manager: it starts a greeter (the login screen a
# package that lists greetd brings, with its /etc/greetd/config.toml) and,
# once someone's in, their desktop. On the first screen (tty1), as NixOS's
# module sets it up.
files:
  /etc/systemd/system/greetd.service: |
    [Unit]
    Description=greetd, the login manager
    Wants=systemd-user-sessions.service
    After=systemd-user-sessions.service getty@tty1.service plymouth-quit.service
    Conflicts=getty@tty1.service
    [Service]
    ExecStart=/run/current-system/sw/bin/greetd --config /etc/greetd/config.toml
    EnvironmentFile=/etc/nami-os/environment
    Restart=on-success
    IgnoreSIGPIPE=no
    SendSIGHUP=yes
    TimeoutStopSec=30s
    KeyringMode=shared
    Type=idle
login:
  # Logging in, and the greeter's own session (no password: it's greetd's).
  greetd: login
checks.nami
# How to tell greetd works, on a computer nami made.
"the login screen":
  run: systemctl is-active display-manager
  expect: "^active"

greeting

1 file

Depends on another recipe (../zcat-lite) and a nixpkgs package (cowsay), with a custom install phase and no source at all.

package.nami
# Depends on another recipe (../zcat-lite) and a nixpkgs package (cowsay),
# with a custom install phase and no source at all.
name: greeting
version: "1.0"
deps: [../zcat-lite, cowsay]
install: |
  mkdir -p $out/bin
  cat > $out/bin/greeting <<SCRIPT
  #!/bin/sh
  echo "\$($(command -v cowsay) hej)" | gzip | $(command -v zcat-lite)
  SCRIPT
  chmod +x $out/bin/greeting

hello

1 file

GNU hello, built from source with nixpkgs' stdenv (autotools: configure/make/install).

package.nami
# GNU hello, built from source with nixpkgs' stdenv (autotools: configure/make/install).
name: hello
version: 2.12.1
source:
  url: https://ftp.gnu.org/gnu/hello/hello-2.12.1.tar.gz
  sha256: 8d99142afd92576f30b0cd7cb42a8dc6809998bc5d607d88761f512e26c7db20

nixpkgs' hello at an older version: same definition, different source.

package.nami
# nixpkgs' hello at an older version: same definition, different source.
extends: hello
version: 2.12.1
source:
  url: https://ftp.gnu.org/gnu/hello/hello-2.12.1.tar.gz
  sha256: 8d99142afd92576f30b0cd7cb42a8dc6809998bc5d607d88761f512e26c7db20

hplip

2 files

HP's printers and scanners.

package.nami
# HP's printers and scanners.
checks.nami
# How to tell hplip works, on a computer nami made (tests/usb.sh runs these).
"HP's scanner driver":
  run: SANE_DEBUG_DLL=4 timeout 60 scanimage -L 2>&1 | grep -c 'libsane-hpaio' | sed 's/^/N=/'
  expect: "N=[1-9]"

ibus

1 file

IBus, typing in other languages: its engines (input-cjk's, or any package that brings one) are wherever the computer's packages are, not in IBus's own folder, where it would look by itself.

package.nami
# IBus, typing in other languages: its engines (input-cjk's, or
# any package that brings one) are wherever the computer's packages are,
# not in IBus's own folder, where it would look by itself.
env:
  IBUS_COMPONENT_PATH: /run/current-system/sw/share/ibus/component

input-cjk

2 files

Typing Chinese, Japanese and Korean: IBus's engines for each, as Ubuntu's Language Support installs them for a language: Intelligent Pinyin (and Bopomofo) for Chinese, Mozc for Japanese, Hangul for Korean. Add one in Settings, Keyboard, Input Sources (+, then the language); Super+Space switches between them. The fonts are in every desktop (desktop). Not in by default (Ubuntu adds a language's engine when you pick that language; these are about 0.1 GB together): - input-cjk (next to namios) in computer.nami adds them.

package.nami
# Typing Chinese, Japanese and Korean: IBus's engines for each, as Ubuntu's
# Language Support installs them for a language: Intelligent Pinyin (and
# Bopomofo) for Chinese, Mozc for Japanese, Hangul for Korean. Add one in
# Settings, Keyboard, Input Sources (+, then the language); Super+Space
# switches between them. The fonts are in every desktop (desktop).
# Not in by default (Ubuntu adds a language's engine when you pick that
# language; these are about 0.1 GB together): `- input-cjk` (next to namios)
# in computer.nami adds them.
packages:
  - ibus
  - ibus-engines.libpinyin
  - ibus-engines.mozc
  - ibus-engines.hangul
checks.nami
# How to tell input-cjk works, on a computer nami made (tests/usb.sh runs these).
"typing Chinese, Japanese and Korean: IBus lists their engines":
  run: ibus-daemon --daemonize --replace --panel=disable --cache=none 2>/dev/null; for i in $(seq 30); do ibus list-engine >/dev/null 2>&1 && break; sleep 1; done; ibus list-engine | grep -oE '^ +(libpinyin|mozc-jp|hangul) ' | sort -u | wc -l | sed 's/^/ENGINES=/'; ibus exit >/dev/null 2>&1
  expect: "^ENGINES=3$"

jq-patched

2 files

nixpkgs' jq, plus one patch. Everything else (dependencies, build steps, its five outputs) comes from the nixpkgs definition; only jq is rebuilt.

package.nami
# nixpkgs' jq, plus one patch. Everything else (dependencies, build steps,
# its five outputs) comes from the nixpkgs definition; only jq is rebuilt.
extends: jq
name: jq-patched
patches: [./nami-help.patch]
nami-help.patch
--- a/src/main.c
+++ b/src/main.c
@@ -54,6 +54,7 @@
 
   int ret = fprintf(f,
     "jq - commandline JSON processor [version %s]\n"
+    "\nPatched by nami (extends: jq).\n"
     "\nUsage:\tjq [options] <jq filter> [file...]\n"
     "\tjq [options] --args <jq filter> [strings...]\n"
     "\tjq [options] --jsonargs <jq filter> [JSON_TEXTS...]\n\n"

The XanMod kernel, its long-term line: Linux tuned for desktops and games, on the same version as nixpkgs' default. Drivers built for a kernel (nvidia's) come built for this one. kernel-xanmod-latest is its newest line.

package.nami
# The XanMod kernel, its long-term line: Linux tuned for desktops and
# games, on the same version as nixpkgs' default. Drivers built for a
# kernel (nvidia's) come built for this one. kernel-xanmod-latest is its
# newest line.
boot:
  kernel: linux_xanmod
checks.nami
# How to tell it's the XanMod kernel, on a computer nami made (tests/usb.sh runs these).
"the XanMod kernel is running":
  run: uname -r
  expect: "xanmod"

The XanMod kernel, its newest line (kernel-xanmod is its long-term one). Drivers built for a kernel (nvidia's) come built for this one.

package.nami
# The XanMod kernel, its newest line (kernel-xanmod is its long-term one).
# Drivers built for a kernel (nvidia's) come built for this one.
boot:
  kernel: linux_xanmod_latest
checks.nami
# How to tell it's the XanMod kernel, on a computer nami made (tests/usb.sh runs these).
"the XanMod kernel is running":
  run: uname -r
  expect: "xanmod"

kernel-zen

2 files

The zen kernel: Linux tuned for desktops and games (quicker to answer under load), as Arch's linux-zen and CachyOS start from. Its own version (newer than nixpkgs' default); drivers built for a kernel (nvidia's) come built for this one.

package.nami
# The zen kernel: Linux tuned for desktops and games (quicker to answer
# under load), as Arch's linux-zen and CachyOS start from. Its own version
# (newer than nixpkgs' default); drivers built for a kernel (nvidia's)
# come built for this one.
boot:
  kernel: linux_zen
checks.nami
# How to tell it's the zen kernel, on a computer nami made (tests/usb.sh runs these).
"the zen kernel is running":
  run: uname -r
  expect: "-zen"

kvm

2 files

Virtual machines for everyone on the computer, as Ubuntu has them after usermod -aG kvm you: /dev/kvm (the processor's virtualization) and /dev/vhost-vsock (talking to what runs inside), for QEMU run by people, not root. Claude Desktop's Cowork runs its tasks in such a VM; GNOME Boxes, virt-manager's user session, Android's emulator and nami try use /dev/kvm too. - kvm in computer.nami. Both are the kvm group's (systemd's rules); everyone is in it. The processor's module (kvm_intel or kvm_amd) loads by itself; vhost_vsock loads at start-up, so /dev/vhost-vsock is there before an app looks (Cowork looks once, when it starts). Virtualization must be on in the computer's firmware (Intel VT-x, AMD-V): without it there's no /dev/kvm.

package.nami
# Virtual machines for everyone on the computer, as Ubuntu has them after
# `usermod -aG kvm you`: /dev/kvm (the processor's virtualization) and
# /dev/vhost-vsock (talking to what runs inside), for QEMU run by people,
# not root. Claude Desktop's Cowork runs its tasks in such a VM; GNOME
# Boxes, virt-manager's user session, Android's emulator and
# `nami try` use /dev/kvm too. `- kvm` in computer.nami.
#
# Both are the kvm group's (systemd's rules); everyone is in it. The
# processor's module (kvm_intel or kvm_amd) loads by itself; vhost_vsock
# loads at start-up, so /dev/vhost-vsock is there before an app looks
# (Cowork looks once, when it starts). Virtualization must be on in the
# computer's firmware (Intel VT-x, AMD-V): without it there's no /dev/kvm.
groups:
  kvm: everyone
files:
  /etc/modules-load.d/kvm.conf: |
    vhost_vsock
checks.nami
# How to tell kvm works, on a computer nami made (tests/vm-quick.sh tests/namios runs these;
# its VM has KVM of its own, nested, when the computer running it does).
"kvm: everyone is in the kvm group":
  run: "getent group kvm | cut -d: -f4"
  expect: "jens"
"kvm: /dev/vhost-vsock is there, the kvm group's to open":
  run: "stat -c '%G %A' /dev/vhost-vsock"
  expect: "^kvm crw-rw-"
"kvm: /dev/kvm is the kvm group's to open (when the processor has virtualization)":
  run: "if [ -e /dev/kvm ]; then stat -c '%G %A' /dev/kvm; else echo 'kvm none (no virtualization here)'; fi"
  expect: "^kvm (crw-rw-|none)"

learning

1 file

Learning: flash cards, maths, the stars, and games for children. Others: tuxpaint.

package.nami
# Learning: flash cards, maths, the stars, and games for children.
# Others: tuxpaint.
packages:
  - anki
  - geogebra6
  - stellarium
  - gcompris

linux-pam

1 file

PAM: the password check the screen lock and others use as you.

package.nami
# PAM: the password check the screen lock and others use as you.
setuid: [bin/unix_chkpwd]

making

1 file

3D and making: model in 3D, print it, design parts and circuits. Others: orca-slicer, kicad, librecad.

package.nami
# 3D and making: model in 3D, print it, design parts and circuits.
# Others: orca-slicer, kicad, librecad.
packages:
  - blender
  - freecad
  - prusa-slicer
  - openscad

modemmanager: mobile broadband modems.

package.nami
# modemmanager: mobile broadband modems.
services:
  - ModemManager.service
checks.nami
# How to tell modemmanager works, on a computer nami made (tests/usb.sh runs these).
"mobile broadband (ModemManager)":
  run: mmcli -L 2>&1
  expect: "modems"

nami-gui

2 files

nami's window: your apps and setup, the computer's apps, people and settings for admins, every step to go back to, and making a USB drive. Built with each nami release (packaging/gui-release.sh writes the version and checksum here); desktop lists it, so every desktop has it.

package.nami
# nami's window: your apps and setup, the computer's apps, people and
# settings for admins, every step to go back to, and making a USB drive.
# Built with each nami release (packaging/gui-release.sh writes the version
# and checksum here); `desktop` lists it, so every desktop has it.
name: nami-gui
version: 0.18.9
source:
  url: https://namios.dev/releases/0.18.9/nami-gui-0.18.9-x86_64-linux.tar.gz
  sha256: ebd67be1d162e380c5a0f5a9113af46c86431aa3f775415e3abfebc74d0f19b9
build-deps: [autoPatchelfHook]
deps: [libgcc.lib, fontconfig, freetype, libxkbcommon, libxcb]
# gpui opens these as it starts: Vulkan to draw, Wayland or X11 to show it.
runtime-deps: [vulkan-loader, wayland, libxkbcommon]
install: |
  install -Dm755 nami-gui $out/bin/nami-gui
  install -Dm755 nami-desktop $out/bin/nami-desktop
  install -Dm644 nami-gui.desktop $out/share/applications/nami-gui.desktop
  install -Dm644 nami-gui.svg $out/share/icons/hicolor/scalable/apps/nami-gui.svg
  install -Dm644 nami-settings.svg $out/share/icons/hicolor/scalable/apps/nami-settings.svg
  install -Dm644 nami-monitor.svg $out/share/icons/hicolor/scalable/apps/nami-monitor.svg
  # On other desktops (GNOME, KDE Plasma...) the window is nami, next to their own Settings:
  # its entry and mark. (Releases before 0.18.6 don't have them.)
  if [ -e nami.desktop ]; then
    install -Dm644 nami.desktop $out/share/applications/nami.desktop
    install -Dm644 nami.svg $out/share/icons/hicolor/scalable/apps/nami.svg
  fi
  # On namiOS: Settings as it is on another distribution (Ubuntu, Fedora...), to see Move to
  # namiOS and the rest there. TryExec keeps it out of other distributions' menus.
  cat > $out/share/applications/nami-gui-other-linux.desktop <<'EOF'
  [Desktop Entry]
  Type=Application
  Name=nami (as on Other Distributions)
  Comment=Preview nami's window as it looks on Ubuntu, Fedora and other Linux systems
  Exec=nami-gui --as-other-linux
  TryExec=/etc/namios/windows
  Icon=nami-gui
  Terminal=false
  Categories=System;
  Keywords=preview;other linux;ubuntu;fedora;move to namios;
  EOF
checks.nami
# How to tell nami's window is there, on a computer nami made (tests/usb.sh runs these).
"nami's window: nami-gui, in the app list":
  run: command -v nami-gui && ls /run/current-system/sw/share/applications/nami-gui.desktop
  expect: "nami-gui.desktop$"
# (Root's to write: nami changes it for them, once they've given their password; tests/vm-quick.sh
# tries that, with tests/lib/namios-admin-check.sh.)
"in the desktop: an admin reads the computer's file, which is root's to write and the admins' alone":
  run: f=/etc/nami/computer.nami; head -1 $f >/dev/null && printf "reads "; [ -w $f ] || printf "root's "; stat -c %a:%U:%G $f
  expect: "reads root's 640:root:wheel$"
"in the desktop: Install edits a file's text as applied, not the file (only that app goes on; other changes stay waiting)":
  run: f=~/user.nami; b=$(cat $f); printf 'packages:\n  - cowsay\n' | nami config json '{"add":{"path":["packages"],"value":"xeyes"}}' --file - | tr '\n' ' '; [ "$(cat $f)" = "$b" ] && echo same
  expect: "cowsay +- xeyes +same$"
"in the desktop: Settings is one window, opened by its key's command, and not twice":
  run: ( export NIRI_SOCKET=$(ls /run/user/$(id -u)/niri.*.sock | head -1); o() { niri msg -j windows | jq '[.[] | select(.title == "Settings")] | length'; }; a=$(o); nami-desktop settings; sleep 5; nami-desktop settings; sleep 2; b=$(o); echo "before=$a after=$b" )
  expect: "after=1$"
"in the desktop: Settings started again while it's still opening is still one window":
  run: ( export NIRI_SOCKET=$(ls /run/user/$(id -u)/niri.*.sock | head -1); o() { niri msg -j windows | jq '[.[] | select(.app_id == "nami-gui" and .title == "Settings")] | length'; }; for w in $(niri msg -j windows | jq '.[] | select(.app_id == "nami-gui" and .title == "Settings") | .id'); do niri msg action close-window --id "$w"; done; sleep 3; nami-desktop settings; niri msg action spawn -- nami-gui; sleep 1; nami-desktop settings; niri msg action spawn -- nami-gui --apps; sleep 25; echo "settings=$(o) running=$(pgrep -u "$(id -u)" -xa nami-gui | grep -vc -- --welcome)" )
  expect: "^settings=1 running=1$"

What a change for everyone on the computer asks for: an admin's password, there and then (polkit's action org.namios.change-computer). nami's daemon asks it before it changes the computer's file for an admin (Settings' switches, People, apps for everyone, going back a step): the desktop's box asks, or the terminal. Once it's given, the next few minutes' changes (the rest of the same change) don't ask again. desktop lists it.

package.nami
# What a change for everyone on the computer asks for: an admin's password,
# there and then (polkit's action org.namios.change-computer). nami's daemon
# asks it before it changes the computer's file for an admin (Settings'
# switches, People, apps for everyone, going back a step): the desktop's box
# asks, or the terminal. Once it's given, the next few minutes' changes
# (the rest of the same change) don't ask again. `desktop` lists it.
name: nami-polkit
version: "1.0"
source:
  path: ./actions
install: |
  install -Dm644 org.namios.change-computer.policy $out/share/polkit-1/actions/org.namios.change-computer.policy
  # tray's name for it, until 1.0: a tray daemon still running (before the
  # update restarts it) asks for this one.
  install -Dm644 org.trayos.change-computer.policy $out/share/polkit-1/actions/org.trayos.change-computer.policy
actions/org.namios.change-computer.policy
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE policyconfig PUBLIC "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN" "http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
<policyconfig>
  <vendor>nami</vendor>
  <vendor_url>https://namios.dev</vendor_url>
  <action id="org.namios.change-computer">
    <description>Change something for everyone on this computer</description>
    <message>Something is changing for everyone on this computer.</message>
    <defaults>
      <allow_any>auth_admin</allow_any>
      <allow_inactive>auth_admin</allow_inactive>
      <allow_active>auth_admin_keep</allow_active>
    </defaults>
  </action>
</policyconfig>
actions/org.trayos.change-computer.policy
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE policyconfig PUBLIC "-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN" "http://www.freedesktop.org/standards/PolicyKit/1/policyconfig.dtd">
<policyconfig>
  <vendor>nami</vendor>
  <vendor_url>https://namios.dev</vendor_url>
  <action id="org.trayos.change-computer">
    <description>Change something for everyone on this computer</description>
    <message>Something is changing for everyone on this computer.</message>
    <defaults>
      <allow_any>auth_admin</allow_any>
      <allow_inactive>auth_admin</allow_inactive>
      <allow_active>auth_admin_keep</allow_active>
    </defaults>
  </action>
</policyconfig>

namios

3 files

namiOS, nami's own, batteries included: niri, with nami's own desktop and look, the apps for each job, and a terminal set up for developers (zsh, starship and the tools around them). namios-bare is the same without the apps and the tools. An example of putting a computer together: use it with - namios in your computer.nami, or list its parts yourself and change any of them; what your file says wins.

package.nami
# namiOS, nami's own, batteries included: niri, with nami's own desktop and
# look, the apps for each job, and a terminal set up for developers
# (zsh, starship and the tools around them). namios-bare is the same
# without the apps and the tools. An example of putting a computer
# together: use it with `- namios` in your
# computer.nami, or list its parts yourself and change any of them; what
# your file says wins.
packages:
  - niri
  # Its login screen, namiOS's own (nearer than niri's GDM).
  - namios-greeter
  # Its start: nami's mark, no text.
  - namios-boot
  - namios-look
  # More wallpapers to choose (Settings → Appearance).
  - namios-wallpapers
  # Nothing from outside connects in unless it's allowed, as on a Mac.
  - firewall
  # Everyone's files every hour, to go back in time to, as a Mac's Time Machine.
  - namios-backups
  - namios-apps
  - namios-dev
icon.svg
<svg xmlns="http://www.w3.org/2000/svg" width="96" height="96" viewBox="0 0 24 24"><rect width="24" height="24" rx="6" fill="#18181b"/><rect x="4.8" y="4.8" width="14.4" height="14.4" rx="3.7" fill="none" stroke="#fafafa" stroke-width="1.6"/><rect x="11.2" y="11.2" width="5" height="5" rx="1.4" fill="#fafafa"/></svg>
preview.svg
<svg xmlns="http://www.w3.org/2000/svg" width="640" height="400" viewBox="0 0 320 200">
  <defs><linearGradient id="w" x1="0.37" y1="0" x2="0.63" y2="1"><stop offset="0" stop-color="#45577a"/><stop offset="0.52" stop-color="#2a3650"/><stop offset="1" stop-color="#2c2f38"/></linearGradient><radialGradient id="s" cx="0.18" cy="0" r="0.75"><stop offset="0" stop-color="#8ea3c4" stop-opacity="0.9"/><stop offset="0.7" stop-color="#8ea3c4" stop-opacity="0"/></radialGradient><radialGradient id="d" cx="1" cy="1" r="0.6"><stop offset="0" stop-color="#6f84aa" stop-opacity="0.45"/><stop offset="0.8" stop-color="#6f84aa" stop-opacity="0"/></radialGradient></defs>
  <rect width="320" height="200" fill="url(#w)"/><rect width="320" height="200" fill="url(#s)"/><rect width="320" height="200" fill="url(#d)"/>
  <rect x="4" y="4" width="312" height="12" rx="6" fill="#10141c" fill-opacity="0.55" stroke="none"/>
  <rect x="9" y="8.5" width="9" height="3" rx="1.5" fill="#ececef"/><rect x="21" y="8.5" width="5" height="3" rx="1.5" fill="#d4d4d8"/>
  <rect x="140" y="8.5" width="40" height="3" rx="1.5" fill="#a1a1aa"/>
  <rect x="262" y="8.5" width="8" height="3" rx="1.5" fill="#71717a"/><rect x="274" y="8.5" width="8" height="3" rx="1.5" fill="#71717a"/><rect x="286" y="8.5" width="24" height="3" rx="1.5" fill="#71717a"/>
  <rect x="8" y="22" width="150" height="170" rx="6" fill="#121216" stroke="#f2f2f5" stroke-width="1"/>
  <g font-family="Geist Mono, monospace" font-size="6.2">
    <text x="16" y="36" fill="#ececef" font-weight="700">~/code/app</text><text x="56" y="36" fill="#a1a1aa">main</text>
    <text x="16" y="45" fill="#ececef">› ll</text>
    <text x="16" y="54" fill="#a9bad6">src</text><text x="16" y="62" fill="#a9bad6">tests</text><text x="16" y="70" fill="#ececef">project.nami</text><text x="16" y="78" fill="#ececef">README.md</text>
    <text x="16" y="90" fill="#ececef">› nami run test</text>
    <text x="16" y="99" fill="#9cc4a4">✓ 42 passed</text>
    <text x="16" y="111" fill="#ececef">› git diff</text>
    <text x="16" y="120" fill="#e08a8a">- let x = 1;</text><text x="16" y="128" fill="#9cc4a4">+ let x = 2;</text>
    <text x="16" y="140" fill="#ececef">› </text><text x="22" y="140" fill="#6f6f78">lazygit</text>
  </g>
  <rect x="164" y="22" width="150" height="170" rx="6" fill="#ffffff" stroke="#f2f2f5" stroke-width="1"/>
  <rect x="164" y="22" width="150" height="14" rx="6" fill="#f4f4f5"/>
  <rect x="176" y="27" width="96" height="4" rx="2" fill="#e4e4e7"/>
  <rect x="176" y="46" width="70" height="7" rx="2" fill="#18181b"/>
  <rect x="176" y="60" width="126" height="3" rx="1.5" fill="#d4d4d8"/><rect x="176" y="67" width="116" height="3" rx="1.5" fill="#d4d4d8"/><rect x="176" y="74" width="122" height="3" rx="1.5" fill="#d4d4d8"/>
  <rect x="176" y="86" width="126" height="56" rx="4" fill="#e9edf4"/>
  <rect x="176" y="150" width="120" height="3" rx="1.5" fill="#d4d4d8"/><rect x="176" y="157" width="100" height="3" rx="1.5" fill="#d4d4d8"/>
</svg>

The apps namiOS starts with: few, each the one for its job: Firefox, Files, a text editor, a calculator, pictures, videos, documents, a calendar, archives and disks. (The terminal, Ghostty, comes with namios-look.)

package.nami
# The apps namiOS starts with: few, each the one for its job: Firefox,
# Files, a text editor, a calculator, pictures, videos, documents, a
# calendar, archives and disks. (The terminal, Ghostty, comes with
# namios-look.)
packages:
  - niri
  - firefox
  - gnome-text-editor
  - gnome-calculator
  - loupe
  # Markup: a screenshot's preview, clicked, opens in it, to draw on (a Mac's Markup).
  - satty
  - showtime
  - papers
  - gnome-calendar
  - file-roller
  - gnome-disk-utility
  # Working with files: Quick Look, thumbnails, what opens what, Open in
  # Terminal, search.
  - namios-files
  # And any app from Flathub, each person's own (`- flathub:<app id>` in
  # their user.nami, or Install in Your Apps).
  - flatpak

Each person's files, backed up every hour, so anything can go back to how it was, as a Mac's Time Machine does: kept hourly for a day, daily for a month and weekly after that. restic keeps them (each piece of a file once, however many backups have it; only what changed is read again), on this computer in /var/lib/namios-backups/<login> (theirs alone, and root's), and also on a drive when one's chosen and plugged in. On ext4 as on anything. Settings → Backups, or in your user.nami: namios: backups: on: true # (on by itself) to: disk:Backups # also onto this drive (its label), or a folder leave-out: [~/.cache, ~/Videos, node_modules, "*.iso"] Without leave-out, what's made again by itself is left out (caches, the Trash, downloaded packages, Nix's, virtual machines' disks; folders that say they're a cache, as Rust's target/ does). nami backup status says it all. Going back: Files' right-click menu, Browse Backups… (a folder) and Restore an Earlier Version… (a file); the launcher's Go Back in Time; or nami backup restore ~/Documents/report.pdf --from yesterday. What it costs: the timer runs hourly as root, and each person's backup as them, at the lowest CPU and disk priority, in a slice of its own with a small share of both; not on a battery under 20%, nor on a disk under 10% free (they're told, once a day). An hour with nothing changed reads no file.

package.nami
# Each person's files, backed up every hour, so anything can go back to how
# it was, as a Mac's Time Machine does: kept hourly for a day, daily for a
# month and weekly after that. restic keeps them (each piece of a file once,
# however many backups have it; only what changed is read again), on this
# computer in /var/lib/namios-backups/<login> (theirs alone, and root's), and
# also on a drive when one's chosen and plugged in. On ext4 as on anything.
#
# Settings → Backups, or in your user.nami:
#   namios:
#     backups:
#       on: true                 # (on by itself)
#       to: disk:Backups         # also onto this drive (its label), or a folder
#       leave-out: [~/.cache, ~/Videos, node_modules, "*.iso"]
#
# Without leave-out, what's made again by itself is left out (caches, the
# Trash, downloaded packages, Nix's, virtual machines' disks; folders that say
# they're a cache, as Rust's target/ does). `nami backup status` says it all.
#
# Going back: Files' right-click menu, Browse Backups… (a folder) and Restore
# an Earlier Version… (a file); the launcher's Go Back in Time; or
# `nami backup restore ~/Documents/report.pdf --from yesterday`.
#
# What it costs: the timer runs hourly as root, and each person's backup as
# them, at the lowest CPU and disk priority, in a slice of its own with a
# small share of both; not on a battery under 20%, nor on a disk under 10%
# free (they're told, once a day). An hour with nothing changed reads no file.
packages:
  - restic
services:
  - namios-backups.timer
files:
  /etc/systemd/system/namios-backups.slice: |
    [Unit]
    Description=Backups of people's files, kept out of the way
    [Slice]
    CPUWeight=10
    IOWeight=10
    MemoryHigh=1G
  /etc/systemd/system/namios-backups.service: |
    [Unit]
    Description=Backs up each person's files (when an hour has gone by)
    After=local-fs.target
    [Service]
    Type=oneshot
    Slice=namios-backups.slice
    ExecStart=/nix/var/nami/bin/nami backup run
    Environment=PATH=/run/current-system/sw/bin
    Nice=19
    CPUSchedulingPolicy=batch
    IOSchedulingClass=idle
    # (What each run cost: systemctl show namios-backups -p CPUUsageNSec -p IOReadBytes.)
    IOAccounting=yes
  /etc/systemd/system/namios-backups.timer: |
    [Unit]
    Description=Backs up each person's files every hour
    [Timer]
    OnBootSec=3min
    OnCalendar=hourly
    RandomizedDelaySec=4min
    Persistent=true
    [Install]
    WantedBy=timers.target
  # Files' right-click menu: Browse Backups… (a folder, or the one you're in) and Restore an
  # Earlier Version… (a file).
  /etc/nami-os/share/nautilus-python/extensions/namios-backups.py: |
    from gi.repository import Nautilus, GObject, Gio


    def go(_item, args):
        Gio.Subprocess.new(["nami-gui"] + args, Gio.SubprocessFlags.NONE)


    def path_of(f):
        loc = f.get_location()
        return loc.get_path() if loc else None


    class NamiBackups(GObject.GObject, Nautilus.MenuProvider):
        def get_file_items(self, files):
            if len(files) != 1:
                return []
            f = files[0]
            path = path_of(f)
            if not path:
                return []
            if f.is_directory():
                item = Nautilus.MenuItem(name="NamiBackups::browse-folder", label="Browse Backups…", icon="document-revert")
                item.connect("activate", go, ["--go-back", path])
            else:
                item = Nautilus.MenuItem(name="NamiBackups::versions", label="Restore an Earlier Version…", icon="document-revert")
                item.connect("activate", go, ["--versions", path])
            return [item]

        def get_background_items(self, folder):
            path = path_of(folder)
            if not path:
                return []
            item = Nautilus.MenuItem(name="NamiBackups::browse", label="Browse Backups…", icon="document-revert")
            item.connect("activate", go, ["--go-back", path])
            return [item]
  # Its icon: Lucide's history, in the light line the desktop's icons have (1.5), on the
  # tile nami's own apps have. (GNOME's document-revert, which it had, isn't in the theme:
  # the launcher drew a "G" for it.)
  /etc/namios/go-back.svg: |
    <svg xmlns="http://www.w3.org/2000/svg" width="128" height="128" viewBox="0 0 128 128"><rect x="8" y="8" width="112" height="112" rx="26" fill="#33394a"/><g transform="translate(31 31) scale(2.75)" fill="none" stroke="#cdd3de" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"/><path d="M3 3v5h5"/><path d="M12 7v5l4 2"/></g></svg>
  # The launcher's: your home as the backups have it.
  /etc/nami-os/share/applications/namios-go-back.desktop: |
    [Desktop Entry]
    Type=Application
    Name=Go Back in Time
    Comment=Your files as they were: restore what changed or went
    Keywords=backup;backups;restore;time machine;history;earlier version;undelete;
    Exec=nami-gui --go-back
    Icon=/etc/namios/go-back.svg
    Categories=Utility;
    StartupWMClass=nami-go-back
checks.nami
# How to tell each person's backups work, on a computer nami made (tests/usb.sh runs these).
"time machine: restic, and the hourly timer":
  run: restic version | cut -d' ' -f1-2 | tr '\n' ' '; systemctl is-enabled namios-backups.timer
  expect: "^restic [0-9.]+ enabled"
# In a folder of their own: two backups, a file changed and one deleted between them; the
# deleted one back, the old version next to the new, both versions found, the caches and
# node_modules left out.
"time machine: back up, change, delete, and bring both back":
  run: 't=$(mktemp -d); export HOME=$t/home NAMI_BACKUPS_DIR=$t/b NAMI_BACKUPS_FLOOR_GB=0; nami=/nix/var/nami/bin/nami; mkdir -p $HOME/Docs $HOME/.cache/x $HOME/proj/node_modules $NAMI_BACKUPS_DIR/$(id -un); echo one > $HOME/Docs/a.txt; echo keep > $HOME/Docs/b.txt; echo c > $HOME/.cache/x/c; echo n > $HOME/proj/node_modules/n; echo m > $HOME/proj/main.rs; $nami backup now >/dev/null && first=$($nami backup list --json | jq -r ''.[0].id'') && sleep 1 && echo two > $HOME/Docs/a.txt && rm $HOME/Docs/b.txt && $nami backup now >/dev/null && $nami backup restore $HOME/Docs/b.txt >/dev/null && $nami backup restore $HOME/Docs/a.txt --from $first >/dev/null; echo "back: $(cat $HOME/Docs/b.txt) $(cat $HOME/Docs/a.txt) $(cat $HOME/Docs/a\ \(*\).txt), $($nami backup list --json | jq length) backups, $($nami backup versions $HOME/Docs/a.txt --json | jq length) versions, cache $($nami backup ls $HOME --from latest | jq -r ''map(.name) | index(".cache")''), proj $($nami backup ls $HOME/proj --from latest | jq -r ''map(.name) | join(",")'')"; rm -rf $t'
  expect: "back: keep two one, 2 backups, 2 versions, cache null, proj main.rs"

namiOS, barebones: niri with nami's own desktop and look, Ghostty, Files and Firefox, and nothing else; add what you want. namios is the same with the apps for each job and a terminal set up for developers.

package.nami
# namiOS, barebones: niri with nami's own desktop and look, Ghostty,
# Files and Firefox, and nothing else; add what you want. namios is the
# same with the apps for each job and a terminal set up for developers.
packages:
  - niri
  # Its login screen, namiOS's own (nearer than niri's GDM).
  - namios-greeter
  # Its start: nami's mark, no text.
  - namios-boot
  - namios-look
  # Nothing from outside connects in unless it's allowed, as on a Mac.
  - firewall
  - firefox
icon.svg
<svg xmlns="http://www.w3.org/2000/svg" width="96" height="96" viewBox="0 0 24 24"><rect width="24" height="24" rx="6" fill="#18181b"/><rect x="4.8" y="4.8" width="14.4" height="14.4" rx="3.7" fill="none" stroke="#fafafa" stroke-width="1.6"/><rect x="11.2" y="11.2" width="5" height="5" rx="1.4" fill="#fafafa"/></svg>
preview.svg
<svg xmlns="http://www.w3.org/2000/svg" width="640" height="400" viewBox="0 0 320 200">
  <defs><linearGradient id="w" x1="0.37" y1="0" x2="0.63" y2="1"><stop offset="0" stop-color="#45577a"/><stop offset="0.52" stop-color="#2a3650"/><stop offset="1" stop-color="#2c2f38"/></linearGradient><radialGradient id="s" cx="0.18" cy="0" r="0.75"><stop offset="0" stop-color="#8ea3c4" stop-opacity="0.9"/><stop offset="0.7" stop-color="#8ea3c4" stop-opacity="0"/></radialGradient><radialGradient id="d" cx="1" cy="1" r="0.6"><stop offset="0" stop-color="#6f84aa" stop-opacity="0.45"/><stop offset="0.8" stop-color="#6f84aa" stop-opacity="0"/></radialGradient></defs>
  <rect width="320" height="200" fill="url(#w)"/><rect width="320" height="200" fill="url(#s)"/><rect width="320" height="200" fill="url(#d)"/>
  <rect x="4" y="4" width="312" height="12" rx="6" fill="#10141c" fill-opacity="0.55" stroke="none"/>
  <rect x="9" y="8.5" width="9" height="3" rx="1.5" fill="#ececef"/><rect x="21" y="8.5" width="5" height="3" rx="1.5" fill="#52525b"/>
  <rect x="140" y="8.5" width="40" height="3" rx="1.5" fill="#a1a1aa"/>
  <rect x="262" y="8.5" width="8" height="3" rx="1.5" fill="#71717a"/><rect x="274" y="8.5" width="8" height="3" rx="1.5" fill="#71717a"/><rect x="286" y="8.5" width="24" height="3" rx="1.5" fill="#71717a"/>
</svg>

namiOS's start, with no text on the screen: from the firmware's logo straight to nami's mark on slate (plymouth, its own theme), small, a thin bar filling under it, until the login screen comes in over it, on the same slate, its mark fading where this one was. No cursor blinking either. The serial console still has it all, and Esc shows the messages behind the mark. Going off or restarting shows the mark too, over the kernel's last words.

package.nami
# namiOS's start, with no text on the screen: from the firmware's logo
# straight to nami's mark on slate (plymouth, its own theme), small, a
# thin bar filling under it, until the login screen comes in over it, on
# the same slate, its mark fading where this one was. No
# cursor blinking either. The serial console still has it all, and Esc
# shows the messages behind the mark. Going off or restarting shows the
# mark too, over the kernel's last words.
packages:
  - ../plymouth
boot:
  kernel-options: [plymouth.splash=nami, vt.global_cursor_default=0]
files:
  # The mark as it goes off, once the desktop has let go of the screen.
  /etc/systemd/system/plymouth-poweroff.service.d/namios.conf: |
    [Unit]
    After=greetd.service
    [Service]
    ExecStart=
    ExecStart=/run/current-system/sw/bin/plymouthd --mode=shutdown --attach-to-session --ignore-serial-consoles
  /etc/systemd/system/plymouth-halt.service.d/namios.conf: |
    [Unit]
    After=greetd.service
    [Service]
    ExecStart=
    ExecStart=/run/current-system/sw/bin/plymouthd --mode=shutdown --attach-to-session --ignore-serial-consoles
  /etc/systemd/system/plymouth-reboot.service.d/namios.conf: |
    [Unit]
    After=greetd.service
    [Service]
    ExecStart=
    ExecStart=/run/current-system/sw/bin/plymouthd --mode=reboot --attach-to-session --ignore-serial-consoles
  /etc/systemd/system/poweroff.target.d/plymouth.conf: |
    [Unit]
    Wants=plymouth-poweroff.service
  /etc/systemd/system/halt.target.d/plymouth.conf: |
    [Unit]
    Wants=plymouth-halt.service
  /etc/systemd/system/reboot.target.d/plymouth.conf: |
    [Unit]
    Wants=plymouth-reboot.service
  # plymouth's themes, and nami's among them (the mark drawn as PNGs at the
  # sizes it's shown at, each its own ring, and the bar's round ends,
  # written out as it starts).
  /etc/systemd/system/plymouth-start.service.d/namios.conf: |
    [Service]
    ExecStartPre=/run/current-system/sw/bin/sh /etc/namios/boot/theme.sh
  /etc/namios/boot/theme.sh: |
    PATH=/run/current-system/sw/bin
    t=/run/plymouth/themes
    [ -L $t ] && rm $t
    mkdir -p $t/nami
    for d in /run/current-system/sw/share/plymouth/themes/*; do [ -e "$t/${d##*/}" ] || ln -s "$d" "$t/"; done
    cp /etc/namios/boot/nami.plymouth /etc/namios/boot/nami.script $t/nami/
    for f in /etc/namios/boot/*.b64; do n=${f##*/}; base64 -d $f > $t/nami/${n%.b64}.png; done
  /etc/namios/boot/nami.plymouth: |
    [Plymouth Theme]
    Name=namiOS
    Description=nami's mark on slate
    ModuleName=script

    [script]
    ImageDir=/run/plymouth/themes/nami
    ScriptFile=/run/plymouth/themes/nami/nami.script
  /etc/namios/boot/nami.script: |
    # The login screen's slate (#2a3650), and nami's mark small in the middle,
    # where the wallpaper has it: 56 px on a 1440p screen, in proportion to the
    # screen's height (40 at the least), its ring set for its size. Starting, a
    # thin bar under it fills as plymouth reckons the start along (by the last
    # one's length), as a Mac's does; until it's sure, or going off, the inner
    # square breathes instead (0.6 to 1 and back in 1.6 s). Nothing spins.
    Window.SetBackgroundTopColor(0.165, 0.212, 0.314);
    Window.SetBackgroundBottomColor(0.165, 0.212, 0.314);
    W = Window.GetWidth();
    H = Window.GetHeight();
    want = H * 56 / 1440;
    v = 40;
    if (want >= 44) v = 48;
    if (want >= 52) v = 56;
    if (want >= 64) v = 72;
    if (want >= 78) v = 84;
    if (want >= 98) v = 112;
    h = 4;
    if (v >= 72) h = 6;
    if (v >= 112) h = 8;
    cx = Window.GetX() + Math.Int(W / 2);
    cy = Window.GetY() + Math.Int(H / 2);
    mx = cx - v / 2;
    my = cy - v / 2;
    ring = Sprite(Image("ring-" + v + ".png"));
    ring.SetPosition(mx, my, 1);
    inner = Sprite(Image("inner-" + v + ".png"));
    inner.SetPosition(mx, my, 2);

    # The bar: 2.5 times the mark across, its ends round (half dots either
    # side of a stretched pixel), the track faint and the fill soft white.
    bw = Math.Int(v * 1.25) * 2;
    bx = cx - bw / 2;
    by = my + v + Math.Int(v * 0.85);
    left = Image("cap-left-" + h + ".png");
    right = Image("cap-right-" + h + ".png");
    dot = Image("dot.png");
    track_l = Sprite(left);
    track_l.SetPosition(bx, by, 1);
    track_m = Sprite(dot.Scale(bw - h, h));
    track_m.SetPosition(bx + h / 2, by, 1);
    track_r = Sprite(right);
    track_r.SetPosition(bx + bw - h / 2, by, 1);
    fill_l = Sprite(left);
    fill_l.SetPosition(bx, by, 2);
    fill_m = Sprite();
    fill_m.SetPosition(bx + h / 2, by, 2);
    fill_r = Sprite(right);
    fill_r.SetPosition(bx + h / 2, by, 2);

    t = 0;
    # Going off is quick: the mark's there at once, and no bar (plymouth
    # reckons that too, but there's nothing to wait for).
    starting = 1;
    if (Plymouth.GetMode() != "boot") {
      t = 20;
      starting = 0;
    }
    reckoned = 0;
    shown = 0;
    bar = 0;
    drawn = -1;

    fun draw() {
      come = Math.Min(t / 20, 1);
      come = 1 - (1 - come) * (1 - come);
      # The inner square's breath, gone once the bar's there.
      breath = (0.5 - 0.5 * Math.Cos(t * 2 * Math.Pi / 80)) * 0.4 * (1 - bar);
      ring.SetOpacity(0.92 * come);
      inner.SetOpacity(0.92 * come * (1 - breath));
      track = 0.16 * bar * come;
      track_l.SetOpacity(track);
      track_m.SetOpacity(track);
      track_r.SetOpacity(track);
      len = Math.Int(shown * (bw - h));
      if (len != drawn) {
        if (len >= 1)
          fill_m.SetImage(dot.Scale(len, h));
        fill_r.SetX(bx + h / 2 + len);
        global.drawn = len;
      }
      full = 0.85 * bar * come;
      fill_l.SetOpacity(full);
      fill_r.SetOpacity(full);
      if (len >= 1)
        fill_m.SetOpacity(full);
      else
        fill_m.SetOpacity(0);
    }

    fun refresh() {
      global.t = t + 1;
      # The bar after a second, and only once plymouth has a reckoning.
      if (starting && t > 50 && reckoned > 0.02)
        global.bar = Math.Min(bar + 1 / 15, 1);
      # Never back, and eased toward where plymouth says.
      if (reckoned > shown)
        global.shown = shown + (reckoned - shown) * 0.08;
      draw();
    }

    fun progress(duration, fraction) {
      if (fraction > reckoned)
        global.reckoned = Math.Min(fraction, 1);
    }

    # The login screen's coming: the bar full as it goes, and the picture kept.
    fun quit() {
      if (bar > 0) {
        global.shown = 1;
        draw();
      }
    }

    draw();
    Plymouth.SetRefreshFunction(refresh);
    Plymouth.SetBootProgressFunction(progress);
    Plymouth.SetQuitFunction(quit);
  /etc/namios/boot/cap-left-4.b64: |
    iVBORw0KGgoAAAANSUhEUgAAAAIAAAAECAYAAACk7+45AAAABmJLR0QA/wD/AP+gvaeTAAAAIUlE
    QVQImTXBQREAIAwDsB7udvhXUHyE15Lg4gWFk4VBP7LhFi6lJwe0AAAAAElFTkSuQmCC
  /etc/namios/boot/cap-left-6.b64: |
    iVBORw0KGgoAAAANSUhEUgAAAAMAAAAGCAYAAAAG5SQMAAAABmJLR0QA/wD/AP+gvaeTAAAALklE
    QVQImTXMMRHAIADAwBxDtVMd1VZsPAtk+yXhwYsVplNYF6PSaVTfRWcw8W8Wti3V3SYK4wAAAABJ
    RU5ErkJggg==
  /etc/namios/boot/cap-left-8.b64: |
    iVBORw0KGgoAAAANSUhEUgAAAAQAAAAICAYAAADeM14FAAAABmJLR0QA/wD/AP+gvaeTAAAAP0lE
    QVQImV3NsQ2AMBQDUSt7ULM7YgVGChJZ4NEE9OE6nyU7SYIFO8YTuklmo4pRRcuPluT4GKw4341y
    u+G6AQcLU6bXlNlfAAAAAElFTkSuQmCC
  /etc/namios/boot/cap-right-4.b64: |
    iVBORw0KGgoAAAANSUhEUgAAAAIAAAAECAYAAACk7+45AAAABmJLR0QA/wD/AP+gvaeTAAAAIUlE
    QVQImTXBQQEAIAgEsNN02L8BBBkvt2DwDiSZmw+NWnkZEy0nKNA7AAAAAElFTkSuQmCC
  /etc/namios/boot/cap-right-6.b64: |
    iVBORw0KGgoAAAANSUhEUgAAAAMAAAAGCAYAAAAG5SQMAAAABmJLR0QA/wD/AP+gvaeTAAAALUlE
    QVQImWP4////0////3f8//+fjfH/////GSCgE5nzgokBAf4icxYzIBsAAFvoH+SVcwpVAAAAAElF
    TkSuQmCC
  /etc/namios/boot/cap-right-8.b64: |
    iVBORw0KGgoAAAANSUhEUgAAAAQAAAAICAYAAADeM14FAAAABmJLR0QA/wD/AP+gvaeTAAAAPUlE
    QVQImV3MoQ2AMABFwQ9zFM3sBIFmp4aELnCVhZ584gUNF/YkieHBtkCGcw5tzZ853N9pRQleHChJ
    0gGN6z63Ot03mQAAAABJRU5ErkJggg==
  /etc/namios/boot/dot.b64: |
    iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAABmJLR0QA/wD/AP+gvaeTAAAAFElE
    QVQImWP8//8/AwwwMSAB3BwAlm4DBQNtaHsAAAAASUVORK5CYII=
  /etc/namios/boot/inner-112.b64: |
    iVBORw0KGgoAAAANSUhEUgAAAHAAAABwCAYAAADG4PRLAAAABmJLR0QA/wD/AP+gvaeTAAAB/ElE
    QVR4nO3bsWpUURDG8W+yARsLg6RKWguxUB/APIiCT+AL2AhW6WzMI1jY2mpnsBcEwTaIkliJFoKa
    z+KusAQtdDcze4b/7wHuzJxvz3Lv5R4JAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABI
    Ud1ABtvXJe1J2pG0tcylJJ1IOpL0PCKOVtAe/sT2hu3btt/5/BzavlU9azu2t2y/OMfgznpse7N6
    7hbm4b1NDO+3Z7Zn1fMPzdPfZubOO2u/eg2GZvtOYXi2/cP2tcyZNzKLJXhQXH8m6X5mwTaPEZ4e
    FV5X9yHpq6TtiPiWUazTDtyrbmDuoqQbWcU6Bbhb3cCCtF46BXipuoEFy7zt+SedAlwnafcWBDg4
    AhwcAQ6OAAdHgIMjwMER4OAIcHAEODgCHBwBDo4AB0eAg+sU4Gl1Awt+ZhXqFOCn6gYWnGQV6hTg
    On3mntZLp4+adjUtXPVMHyXtRIQzirXZgRHxXtKr6j4kPc0KT6r/ta6Up4MmLwtb+CLpSkQcZxVs
    swMlKSIOJR0UtnAvM7yWbG96OmiS7WH17G3Yntnet/09IbjPtu9Wz9yS7au2n8wXedU+2H5ke7ty
    xlY3MX9j+4Kkm5qOWF9e4lKnko41Pa68iYh1evsDAAAAAAAAAAAAAAAAAAAAAPgvvwBfP+Ju29bc
    2QAAAABJRU5ErkJggg==
  /etc/namios/boot/inner-40.b64: |
    iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAABmJLR0QA/wD/AP+gvaeTAAAAoklE
    QVRYhe3UMQ4BURSF4TMmodDMSigsQiL2YF3WoRQ1YQ0SBbEEVL8NTOK+uIzE+eqTd//qSWZmZmZm
    9iOAObAHHrS7AEug6SouagfU3w48FAQCzCLv9hIbR4X7cWSUGdgv3A8io8zAj3Dgu/4q8Fq4P0dG
    mYGrgu1d0ibx9mtAA2wDH/QNWETfrZIja0lTSRNJw5bJUdK6qqpT5l0zM+vQE7AcxvDy1AOuAAAA
    AElFTkSuQmCC
  /etc/namios/boot/inner-48.b64: |
    iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAABmJLR0QA/wD/AP+gvaeTAAAAyklE
    QVRoge3WMQ6CUBAE0FkarWw8gT0V9l7DzttZewwbDwCewXgBEscCsDDBsMDyYzKv/pudKX6ygIiI
    iIiIiIj8JYteQDIHUABY9zypAdwBXM3sFZ1nMJIbkhcOdyO5S537wxm+U5Jcpc4OkvmI8J2TZ1cW
    1KGYMLv3PI4q0PdhZ5+NKrAYFUhNBVKLKlAvNRtVoJowW86WYiySWXvbeD1IblPnBwCQ3LW3jSf8
    wbsn9Jxmc5gd0ZwHv87pCsDZzJ6ReURERES+vAE3cDPXQ+k36gAAAABJRU5ErkJggg==
  /etc/namios/boot/inner-56.b64: |
    iVBORw0KGgoAAAANSUhEUgAAADgAAAA4CAYAAACohjseAAAABmJLR0QA/wD/AP+gvaeTAAAA50lE
    QVRoge3Xu20CQRSF4TOWLFkbGEIyu4ItgEWiEVwBDdECRZgiXIEDUhYHzhwcAiAExGV2Vmv9Xzz3
    caRJrgQAAAAAAAAA+FdSyWG2J5KWkhpJrzeet5I2klYppZ+ud3uY7bntve+3tV33vf9VtifBcGff
    tqvI7KfcYS5YSho/UP8m6SNSWCrgNEOPJlJUKuAoQ4/QDygVsDcEHDoCDh0Bh65UwDZDj12kqFTA
    TYYenxl6dMP2+HQVRH3Zfu47x1W269NVEAn3Hp1b+uCtJC0kzSS93Hj+q+PXXqeU/rreDQAAAMCd
    DhkeGgd9cjVXAAAAAElFTkSuQmCC
  /etc/namios/boot/inner-72.b64: |
    iVBORw0KGgoAAAANSUhEUgAAAEgAAABICAYAAABV7bNHAAAABmJLR0QA/wD/AP+gvaeTAAABK0lE
    QVR4nO3ZMUoEQRSE4WoRczEwcPEAJl5g81XwHnuNvYbnMDbSvYIYeYB1A1NhsAxak016oF/bjfxf
    PsXrYuiBNxIAAAAAAAAAAAAAAACA/yr1HuCQ7WtJN5IWkk7mPCJpJ2kr6TGlNDUcrx/b57YfXOfV
    9rL3WcL9lPNWWc6vT9ur3mcK5fo359De9mnEbEcRITWc75y74NgzSeuIoO4FKV/ILdxGhIxQ0KJR
    7mVEyAgFzfmUd8sdoaChUVABBRVQUAEFFVBQAQUVUFDBCAV9jZw7QkHvjXJ3ESEjFLRtlPvUKPdv
    2T523gRGmmxf9T5bGNtL501glE3vM4WzvXLeBNaYbG9sh/2MGOqvhvOadK287LrQ/Pk+JD1Luk8p
    vTQaDwAAAAAAAMA3XDsEqgaZTxoAAAAASUVORK5CYII=
  /etc/namios/boot/inner-84.b64: |
    iVBORw0KGgoAAAANSUhEUgAAAFQAAABUCAYAAAAcaxDBAAAABmJLR0QA/wD/AP+gvaeTAAABjElE
    QVR4nO3ZvY5OYRSG4WdJZCKmoNJM5a/RTus4hEqp0yl0GofhCEQcBy3TaT8RQsTEIDK3YqZSSL6x
    3tnvx33Ve6+13mf/Zu9EkiRJkiRJkiRJkiRJkiRJkiRpgFp6gHUAW0l2klxYc9f3SVZV9bN/qg0E
    7ALPgK+c3EfgCXB56fUsBijgEXD4F0H+7htwd+m1LeI4zBEOgTsjZp72HgrsJnmRcTPuJ7laVe86
    i57pLNbsYcYe8O0k97uLTnmGcvQ0/5Tk3OBWe1V1o7PgrGfoTsaHmSTXgNYMZg103ffMkzqb5Hxn
    wVkD3VgG2sxAmxloMwNtZqDNDLSZgTYz0GYG2mzWQNnUXrMG+uGU+hxU1X5nwVkDXeXo891or7oL
    Thno8d/J56fQ6ml3wSk/MCcJcCXJ6yRbg1q8TXL9f7nkU1VvktzLmAfUjyS3usPcCMBt4EvjH88V
    cHPpdS0KuAQ8BvaA7ycI8QB4CTwAtkfOOu099E+Ai2tsflhVn4cNI0mSJEmSJEmS9O/7BYeJ1r88
    0Xp7AAAAAElFTkSuQmCC
  /etc/namios/boot/ring-112.b64: |
    iVBORw0KGgoAAAANSUhEUgAAAHAAAABwCAYAAADG4PRLAAAABmJLR0QA/wD/AP+gvaeTAAAGZUlE
    QVR4nO3d26sVZRzG8ecdlDTb24yQPEsHFY268dzJDMIoy9ASirwoVKQbo+u68A8IL7sxRNGdJnTC
    EM9UEFndiacoUUvBPO691VLh28WsLZt3vWvtdZiZtV/X73PlGud939+axzWzZuZdjlOOgKGSZkua
    JWmqpCmSJkrqkDRC0n15jl+gXknXJPVIOi3puKQTkg5JOuScu53XwC7rDoFRkt6UtETS07p7QmpU
    r6QfJH0labtz7kqWnWcWIDBf0lpJiyUNy6rfu8y/kr6RtN4591MWHTYdILBQ0keSFjRdTXs5IGmd
    c+5gM500HCAwXtJ6SUtrbHJO6bHhD0kXlB4vcjs2FGyI0uP6g5IekTRN0kM1tv1C0gfOub9zqq0c
    sAboobpLwAbgLWBMYcUNEsBY4G3gs9K2qKYbWF1EUZ3AtgGK2QssBe7JvaBIAMOAZcC+AbZdF9CZ
    VxGTgWNVBt8JzMll8LsIMA/YVWU7HgUmZj3odOBMhQH/AlZkOmAbABYDJyts07PAk1kN9DhwscJA
    m4B2P89rGNABbKmwbS8CM5odYHLpE+b7D3g3o/fR9oBVwM3Adj5Do7tT0i8soWNeD/Bixu+h7QGL
    gN7A9j4CdDTSYejbZg8wN4f6jdKrWRVC3FpvR2sq7Dbtk5cz4KUKu9OVtXYwgfBJuh3zCgKsDmz/
    bmBsLY13BBp3FVC36QfYXHcOwMJAo5PAiILqNiWkpxinA3k8W63RwUCDxQXWbfohvSTp21Np5fmB
    lXcWXLPxALsDuZSfCQDbAyvatc0Wq/DB+txfaRRwo6aPqikcsN/L5jowUpKS0jrLVT4N4tNCqzTV
    +FkMl7TszivKb29cwu7nDRqk9xMvexl92/eXQyk/cd/Q4pqNB9joZXQVGJIonbfp3xLa14IaTXV+
    Jp2SZiZKJ936DuRfj6nT/sCy2YnSGdP9nXPOnSugIFOH0qy1897iKaEAjxdTkmmAn83URNJ4b+Hv
    BRVj6nfCez0xUXow7O9SQcWY+l32XnckSmcU99dbUDGmfj3e645E6Vl9f9cLKsbUz/9wjUiUw0/M
    TGFcMvA6ZjCzACNnAUbOAoycBRg5CzByFmDkLMDIWYCRswAjZwFGzgKMnAUYOQswchZg5CzAyFmA
    kbMAI2cBRs4CjJwFGDkLMHIWYOQswMhZgJGzACNnAUbOAoycBRg5CzByFmDkLMDIWYCRswAjZwFG
    zgKMnAUYOQswchZg5CzAyFmAkbMAI2cBRs4CjJwFGDkLMHIWYOQSSbS6CNMwEkk3vIX3tqISUxP/
    AS3XEgX+H+aCijH187PpSSR1ewsfKKgYUz8/m+5E0hlv4aMFFWPq95j3+nSi8odJ+E9yMYOHn82J
    RNIxb+EYanleuSkUMF7SaG/x8UTSr4H1n8+/JFOnFwLLDiWSDqn8gRKhlU1rLfRed0v6TZIEfBd4
    BKv/TF3TIsBw4EroEax9l9K+9tqMkvRKoVWaal6VNNJb9uWdPwH3Bx5Dbo9hHSSAg4HHkHf6K22j
    3LwW1WxKgKcDuXSFVpwXWHFXC2o2/QB7A7nMqbTy/sDKrxdcsykB3gzksbtagwWBBqcAu8BdMKAT
    OBPI45mBGm4PNNpWUN2mBNgSyGFLLQ3HAd2BxqsKqNtIAt4PbP+rwJhaO1gd6OAmsCjn2tse8DJw
    K7D936u3o65AJ73A/Jxqb3vAU8C1wHbf3EhnncCRCiHaJzFjpU9eKLzDgD+VouZOJxH+JnQTWJ3x
    e2hbpMe80G7zNDCh2c5nABcDnQNsxU4xGlbay4WugAFcAKZnNdD00r+GkL+BFZkM1EaAxaTn2CFn
    gSeyHnAi4WNin93YF5wBkV7bDF0e63OYZnebVQbvIN1tVrMfeAO7n3gHMAxYTvldBd9mGv3CUmdB
    K0lPLKu5DGwE3gHG5V7UIAOMB1YAmyi/Geu7Sr3neSWuiQLHSvpE0vIam5yXdFTSn5L+UTqh+Faj
    4w8yQ5VOuh0t6WFJ01Q+AamSLkkfOufONTJwwwH2AZ6V9LFsHk299kha55z7sZlOmg6wDzBX0lpJ
    r0my41/YDaXTV9Y7537OosPMAuwDjJS0TNISSc/JfmvRLel7pXNYdjjn/J8yNCXzAPsDhkiaJWmm
    0uPCFEmTlP7KpkPlv7aJVa/SY3qvpFNKZ7sfk/SLpF+dc7fzGvh/CSSSKnQ9RzwAAAAASUVORK5C
    YII=
  /etc/namios/boot/ring-40.b64: |
    iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAABmJLR0QA/wD/AP+gvaeTAAACGElE
    QVRYhe2ZP08UQQBH3+5VWHCHVGqDcNLrl9BooolWWhLkoxD1W2hli4nglxATsfBPQ3FgJf5JALtn
    sXMwN+wZyMJNs6+Zm9nZ23czO7t7vy0YgzoF3AMeADeBK8Dlcf3PyB7wHdgE1oD1oigOT7Wn2lFX
    1B0nx0BdVjupT5HI9YDXwO2k3xdgG/hz5rGqpwvMAYtJ+wbwuCiK3yf2UHvqp+hX7aur6vVzkqo7
    5rz6TD2IjruldtOOHfVd1OnjRYqNEd2Kjr8xMt1W51wsNz0puchhOpFcHm645PGC2J/kyNVILkTT
    PVCnUB9F1qu55CLJ55HPQ9RXUUO20YsEFyKfl0Qr93NuuSHq1+F6KIGroX07o1PKdiivlUAvVH7l
    callL5QzJcd3EzPJ1DF0KcqsGqegFWxKK9iUVrAprWBTWsGmtIJNaQWbUhI9e+UUSTh6Ri2Bn6Ey
    k0mmjtlQ7pXAbqjM5XGpZS6UuyXwIVQW1fk8PseofaAfqpslVT435OnklU6wEn1eQ50KMYMhdsg2
    impfPRyJPsKG5ejf/Fam8KjraPy3FG/sqOuJ5MIE5fqJ3Fu1TDt1HY2/DkKQc2GiIYd5EU2rVvHf
    UYCZRsBdqgj4TvJd36jiiPNKH3pUl5IbSfs68KQ2Ao4kO+GcHDg5BuqS6bTyn9ub1Qq6C9wHblG9
    hpgd1/+M/KB6DfEeeEP1GuJvXcd/21jR6EmibUIAAAAASUVORK5CYII=
  /etc/namios/boot/ring-48.b64: |
    iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAABmJLR0QA/wD/AP+gvaeTAAACjUlE
    QVRoge2au24TQRSG/1mHNhbE4iIU0kKJQp6ABiGFhgKQFXHpEM8BFkVCyOURkGho7KDQgkWHaMkL
    EAORIKaJi3g/it2VJ6Ndr21ij4v9Omtm1t+Zy+7qnDXKAShLui1pWdI1SRclnZcU5I0dklDSL0kt
    Sd8kNSTtGmPaI10NqADrQAd/dIA1YC7L02TIr0jakjSbMVOjzUo+ZaWvbFvSM2PMm76jgQB46cxC
    F6gDD4F5oDQO8/j/S/F/PAIaQGh5hEANyN66KfIfgevjEs4DWAQ+OU61rM4rTscNYGbCzmleM8Cm
    sxJVt1MFaFudXnvyzQTYsvwOgYrduO5sG+8z7xKvRNPyfJU0lOndKrs+93we8ZlIDnYHKAt4YEVV
    9y2ZB7Bj+d4LFD1hE975EhsC23FZwFcronlvWgMCLFi+XwT8iH8cM8aH1GkRH+bj2Hlf8cEFOPAt
    NyjAQTLpgXrvHl2fUkOSuJZO+5V44hQB+KYIwDdFAL4pAvBNEYBvigB8UwTgmyIA3xQB+CZQlO+X
    pKnPSFgkrl0BLSutOHU5UZc4rZJkUr4HimpSUrQalzy6Dcpl9bZ+K1BUUEu4OXmfobEd9wJF1cCE
    uxOWGQXbseGm10Ng0ZtaDsCSlV4/AmaThjUrYdqcxsMMnAE+W56rduNZ4LfVuOHRNRVg2/L7g1s7
    BqqcLGtuTsNKxDNvy4fA/azONU7SBG5M2Nn2WXK2DcDzfgOCOAi3wLwDPAaujHNViB5SC8AT4H2K
    xwucQnfWpwZVSduKSv8uPj41OJT01BjzduArAXNEdyefH3scAavAuSzP1BVwAilLuiXpjqSril43
    LmTM1P8QSvopaV/SnqS6pA/GmL/9Bv0DOrj0A4dES70AAAAASUVORK5CYII=
  /etc/namios/boot/ring-56.b64: |
    iVBORw0KGgoAAAANSUhEUgAAADgAAAA4CAYAAACohjseAAAABmJLR0QA/wD/AP+gvaeTAAAC80lE
    QVRoge2aT08TQRyG39kmxoMmehGQondJDH+uwEHRRKDg5zCRQPhAGkK8Q0HPGr0aBMNZhQI3SITE
    qOXxsNv4Y2jpP7rbTfY5bX8zs3nfnc5Mm32dGgS4J2lO0rikQUl9km43Or5NjiTtS9qR9EHSqnNu
    90ruDIwA74Ay3UMZ2ACG2jHWB7wBzhK1cjllYAXoqeXD1TA3KmlVUr/XdCBpTdInSSVJh5J+tfwU
    G+O6pN5Iy5ikgsLlYdmV9Nw597nu3YBZ4NR7Ul+AKSC4avXNAgTANLDlaTwFCvUGj3rm/gDz3WDM
    JzK6EGm0JodrDegD9kznI+BRzLqbBpiMtFb4UXVNEm4oduYeJ6C3JSKTdiaX/Q4jnD8G5hPS2jLA
    otFfxh4hwFvTuNmNa64eQA7YNj7WKw33vdmbSlhrywAz3izmBbw0xRJQ9WxMA4Q7677x8yKQNGH6
    FJ1zJCWwXZxzZ5LWTWkikPTAFD7GK6kjWA+Dgc7/HDuIWUwnKJnrfCDphikcxiymE1gPNwNJOVP4
    HbOYTmA95FJ33jVLZjDtZAbTTmYw7WQG005mMO1kBtNOZjDtZAbTTmYw7WQG005mMO0Eksrm87Wk
    hFwh1kM5kHRiCr0xi+kENoHxM5C0Zwp3YxbTCayH3UBhPKrCWMxiOsG4ud4JFGa/Ksyl8fV1hUj7
    jCm9FzDgvcKeTkpguwAF7xV2f6VhwzRspXEWoxDCV+OjaBuHvFlcSFBrSwBL3uw99DusmA5/gWcJ
    aW0a4Anng0CvqnXqJYxBVTgCJhPQ2xTAU+DY6P4G3KnVeYSLYbxFIFd1QIJEa27Jm7kT6oVko53I
    j1NuE4ZsEt98CLMwBW9DqZi7cALUCsQOKwzEDnhNh5KKCqMaJYWpjDgCsX36H4idleSnCb8rDMRu
    NnxXoAdYpruy2j5l4DW11lyDRoeAdbrLaBko4h8FVWg4lwbkFX49JhSmo/KSbjVzjxZB0rHCPwU7
    kt5LWnPOlS4dFfEPVm9cFMPEumEAAAAASUVORK5CYII=
  /etc/namios/boot/ring-72.b64: |
    iVBORw0KGgoAAAANSUhEUgAAAEgAAABICAYAAABV7bNHAAAABmJLR0QA/wD/AP+gvaeTAAAESUlE
    QVR4nO2czW9VRRiHf3PCh/WCwaJgorgQDUpYsBITTUQMhn/ApYGo8WNFVDBEFyQ1JS4xuiG6sLhU
    QtyaNCxN3blAoCHGWndwS20LFU37uJh7Yc70XOb0tnfOuWWe1Zw5c+a8768zc98z6TtGXQLslbRf
    0j5JuyQ9Kakh6YFu+1wl/pF0U9KEpHFJY5IuGGN+7aYzs5zGwCOS3pV0WNIz3bywQsYljUg6Y4xp
    rmrPwCbgc2CO/mcWOAU0yvgeHEHAIUlfS3qiQ5M5SZckXZU0K2laEuWkX3WMpC2SHpK0U9Ju2Wlf
    xKSkt40xP3X1JsAAw8BiwV/hGnAaeBFY39ULIgCsB14CvgCuF/ixAAwBy1pq2h1/V9BhEzgKPNgj
    n3oG0AA+AKYK/BoB1pXtyHQQ53vg0R770XOAbcC5Av/OlhpJrWnlD8MPI9geFeAYS5ePodBDh1qC
    uOIcjmRzdIAjnkgLwMFOjTcBk56ia27k+AAfez5PUBQCYOOc3JpTgb3Rwa655z3fh/1GW7EBVJsm
    a2BBLguwnfyv2xz2q+FOg089BY9WaG8lYBdtl0/aNwww7ty4Rh/GOSsFGye5weTl9o29nnKnK7a1
    MoAvPS32ZJJe8drdF4tzB37wrg9kkp53Km5K+iWePbXjZ0m3nOt9maRnnYqLxpj/4tpUH4wx/8ru
    TLTZlUl63Kn4Pa5JteSqU96RSdrsVExHNqaO/O2UN2fK7yHfjmxMHZl3ygOZd7OqncA6kdPAFyjh
    kQQKkAQKkAQKkAQKkAQKkAQKkAQKkAQKkAQKkAQKkAQKkAQKkAQKkAQKkAQKkAQKkAQKkAQKkAQK
    kAQKkAQKkAQKkAQKkAQKkAQKkAQKkAQKkAQK4Au0vLSgtUlOg0w2x7PNxri21JIBpzyfyWYJttkS
    2Zg64mowk0n6y6nYGdmYOvK0U57MJF1xKnZT4xTLXgNsVP6/fscz2bzyNg3ZPPj7lRckuWkYY5mk
    C16j1+PZUzt830clScAVJz/hOiVzytcS2ITCpqPDJeluHDTitN0q6Z3oFlbP+5IGneuzd0rAIDDj
    qDcFbItuYkW0EupuOP7P5hLqWo1OealA5yqyNyqtfLkfPd8/K2rYAP70Gh6rwOaoACc8n/+gU0Ih
    8Br5tPBF4Ehck+MBvMnStPBXQw8NeYouAsdZ7vkWNaY1rU6w9GCBk2UfHmEp54HtEezvKcBjBWsO
    wLelBwGwroNIN4CP6MM4CRvnHAemO4hT7nATp0PTmm4LBR02sQmwLwMbeuTTigE2APuBr8gHgW0W
    gJP3GjllDlg6KOkb2TPKirgl6TfZbMVp1eOApYclPSXpOeW/rVwmJL1ljBld8VuxIcAw+WCyX5nB
    zoxSZwMs95C3QUnvSXpD+W2BfuCy7OfDGWPMVNmHuv7pBvZIOqC7xwTukM1/HbjXcxGYl90lnZTd
    6xqTNGqMudhNZ/8DAzP68E1SeO8AAAAASUVORK5CYII=
  /etc/namios/boot/ring-84.b64: |
    iVBORw0KGgoAAAANSUhEUgAAAFQAAABUCAYAAAAcaxDBAAAABmJLR0QA/wD/AP+gvaeTAAAEvklE
    QVR4nO2dz28UZRjHv++YEFqKGkEQqVz5YUKLXBWKGu8aIb3J0aPxP9BELyQWOREkIVwsEo0Hg5Gg
    aNPEBBJIjTFRT4ZWhGBCC22Jh/bj4d3V2XdntrO7786P7fs5dbbP+84zn51339mZnWeMugR4TNKo
    pDFJI5L2SBqWtEnS49323yMeSFqSNCvpN0kzkn6QNGOMWe2mY9NpQ+CgpOOSxiVt7SaJEnFP0qSk
    88aYm7msEXgZuEr/8y0w1q6fzHsosEvSSUmvZwhfkjQv6Z92E8qJjZKekP1YWosvJL1jjJnztnZg
    HHjQ4t28BrwHvArs8LbiHgPsqOX8PnC9xfYtAMd8rDACTqWsZBH4CNjtYdtKAbAHOAkspWzzBBB1
    2vkG4GJCpyvAaaBfJqImgG3AJ7VtdbkAbGi3wyhF5i3gxR5tR+kADgGzKVKz76kkD/MpYEsP8y8l
    wFZgOmn4Z+1gPKHxV8DGHudeWoAB4FKCl6NrNdxF82w+tZ5l1qlJdffUeWC4VaMvnQaz9PHk0y7A
    U8AfjqOLacGvOIErrKMJKCvYiWrVcXU4KfB7J+h0AflWAuCs4+qKG3DQCVgMQz0dYDvNB/8HJKl+
    LHXcaXPGGPN3rllWCGPMXUlnnZffkmTPZwL3HNt983WyVwB7HWd3gChpuF8rOtmqANxw3I1Gsmfa
    41wuILeq8o2zfCSSvWwRZyqnZPoB19VIJHsNKM4vOSXTD7iudgu4HT9cKiStigIYYDnmby6StDkW
    M19UclXEGIManW2OJA3GXljON6W+ID6qhyL9f3AvSV1dk16nxJ1FnV0fCaQShHomCPVMEOqZINQz
    QahnglDPBKGeCUI9E4R6Jgj1TBDqmSDUM0GoZ4JQzwShnglCPROEeiYI9UwQ6pkg1DNBqGeCUM8E
    oZ4JQj0ThHomCPVMEOqZINQzQahnglDPBKGeCUI9E4R
…
checks.nami
# How to tell namiOS's start and stop are smooth, on a computer nami made.
"the login screen comes without sitting out a timer (idle's is 6 seconds)":
  run: a=$(systemctl show -P InactiveExitTimestampMonotonic plymouth-quit-wait); b=$(systemctl show -P ActiveEnterTimestampMonotonic plymouth-quit-wait); echo WAIT=$(( (b - a) / 1000000 ))
  expect: "^WAIT=[0-4]$"
"the mark shows when the computer goes off or restarts":
  run: systemctl show -P Wants poweroff.target; systemctl show -P Wants reboot.target
  expect: "plymouth-reboot.service"

namios-dev

2 files

namiOS for developers: a shell that's good from the start and the tools around it. zsh in the terminal, with suggestions as you type and commands in colour as you write them, starship's prompt, zoxide (z proj jumps to a folder you've been in), fzf (Ctrl-R, Ctrl-T), eza, bat, ripgrep, fd, git with delta's diffs, lazygit and jq. And a project's tools as you cd into it (its project.nami, by nami hook): no setup, no nami shell. bash gets the prompt, zoxide, fzf and the hook too (its commands left as they are: logins and scripts expect them).

package.nami
# namiOS for developers: a shell that's good from the start and the tools
# around it. zsh in the terminal, with suggestions as you type and
# commands in colour as you write them, starship's prompt, zoxide (`z proj` jumps to a folder
# you've been in), fzf (Ctrl-R, Ctrl-T), eza, bat, ripgrep, fd, git with
# delta's diffs, lazygit and jq. And a project's tools as you cd into it
# (its project.nami, by `nami hook`): no setup, no `nami shell`.
# bash gets the prompt, zoxide, fzf and the hook too (its commands left
# as they are: logins and scripts expect them).
packages:
  - zsh
  - zsh-autosuggestions
  - zsh-syntax-highlighting
  - starship
  - zoxide
  - fzf
  - eza
  - bat
  - ripgrep
  - fd
  - git
  - delta
  - lazygit
  - jq
env:
  STARSHIP_CONFIG: /etc/starship.toml
  # (man pages through bat, coloured)
  MANPAGER: sh -c 'col -bx | bat -l man -p'
files:
  # (namios-look's Ghostty includes it)
  /etc/namios/ghostty/dev: |
    command = zsh
  /etc/zshrc.d/namios-dev.zsh: |
    eval "$(starship init zsh)"
    eval "$(zoxide init zsh)"
    source <(fzf --zsh)
    (( $+commands[nami] )) && eval "$(nami hook zsh)"
    alias ls='eza --group-directories-first' ll='eza -l --git --group-directories-first' la='eza -la --git --group-directories-first' tree='eza --tree' cat='bat -pp'
    for f in /run/current-system/sw/share/zsh-autosuggestions/zsh-autosuggestions.zsh /run/current-system/sw/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh; do [[ -r $f ]] && source $f; done; unset f
    ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE='fg=#6f6f78'
  /etc/bashrc.d/namios-dev.sh: |
    eval "$(starship init bash)"
    eval "$(zoxide init bash)"
    eval "$(fzf --bash)"
    eval "$(nami hook bash)"
  # A quiet prompt: the folder, git, the project's languages, and how long
  # a slow command took; one line, a › that turns red when one failed.
  /etc/starship.toml:
    add_newline: false
    format: $directory$git_branch$git_status$nodejs$python$rust$golang$java$nix_shell$cmd_duration$line_break$character
    character:
      success_symbol: '[›](bold white)'
      error_symbol: '[›](bold red)'
    directory:
      style: 'bold #ececef'
      truncation_length: 3
      read_only: ''
    git_branch:
      format: '[$branch]($style) '
      style: '#a1a1aa'
    git_status:
      style: '#a1a1aa'
    cmd_duration:
      format: '[$duration]($style) '
      style: '#8b8b94'
    nodejs:
      format: '[node $version]($style) '
      style: '#8b8b94'
    python:
      format: '[py $version]($style) '
      style: '#8b8b94'
    rust:
      format: '[rust $version]($style) '
      style: '#8b8b94'
    golang:
      format: '[go $version]($style) '
      style: '#8b8b94'
    java:
      format: '[java $version]($style) '
      style: '#8b8b94'
    nix_shell:
      disabled: true
  # git's diffs through delta, side by side when there's room.
  /etc/gitconfig:
    core:
      pager: delta
    interactive:
      diffFilter: delta --color-only
    delta:
      navigate: true
      line-numbers: true
      syntax-theme: Visual Studio Dark+
    merge:
      conflictStyle: zdiff3
    init:
      defaultBranch: main
checks.nami
# How to tell namios-dev works, on a computer nami made (tests/vm-quick.sh tests/namios runs these).
"the shell: zsh with starship, zoxide, its plugins and nami's project hook":
  run: "zsh -ic 'whence -w z _nami_hook _zsh_autosuggest_start _zsh_highlight prompt_starship_precmd' 2>&1 | grep -c 'function$' | sed 's/^/N=/'"
  expect: "N=5"
"bash gets the same (/etc/bashrc.d)":
  run: bash -ic 'type z >/dev/null && echo ZOXIDE' 2>&1
  expect: "ZOXIDE"
"git's diffs through delta":
  run: git config --system core.pager
  expect: "^delta"
"the tools":
  run: command -v rg fd bat eza lazygit jq | wc -l | sed 's/^/N=/'
  expect: "N=6"

The dock: each person's own, drawn by nami-desktop from namios: dock: in their ~/user.nami, where Settings in nami's window changes it too: on or off, size, magnification, position, hiding, what's open, what's pinned; and how windows minimize. Off is the start; floating windows turn it on (namios-windows). namios-look lists it.

package.nami
# The dock: each person's own, drawn by nami-desktop from `namios: dock:` in their
# ~/user.nami, where Settings in nami's window changes it too: on or off, size,
# magnification, position, hiding, what's open, what's pinned; and how windows
# minimize. Off is the start; floating windows turn it on (namios-windows).
# namios-look lists it.
files:
  /etc/namios/dock:
    mode: "0755"
    content: |
      #!/bin/sh
      # nami-dock: this person's dock, in their ~/user.nami.
      #
      #   nami-dock on       the dock
      #   nami-dock off      none (the start)
      #   nami-dock status   which it is
      #   nami-dock set size small|medium|large
      #   nami-dock set magnification off|small|large
      #   nami-dock set position bottom|left|right
      #   nami-dock set hide on|off
      #   nami-dock set open-apps on|off
      #   nami-dock set effect genie|scale     how windows minimize
      set -eu
      PATH=/run/current-system/sw/bin:/nix/var/nami/bin
      edit() { # the path, as JSON; the value, as JSON
        said=$(printf '{"set":{"path":%s,"value":%s}}' "$1" "$2" | nami config json - --file "$HOME/user.nami" 2>&1) || { echo "$said" >&2; exit 1; }
      }
      flag() { case "$1" in on) echo true ;; off) echo false ;; *) echo "on or off, not $1" >&2; exit 2 ;; esac; }
      case "${1:-status}" in
        on) edit '["namios","dock","on"]' true ;;
        off) edit '["namios","dock","on"]' false ;;
        status) nami-desktop setting dock.on ;;
        set)
          case "${2:-} ${3:-}" in
            "size small"|"size medium"|"size large"|"magnification off"|"magnification small"|"magnification large"|"position bottom"|"position left"|"position right")
              edit "[\"namios\",\"dock\",\"$2\"]" "\"$3\"" ;;
            "hide on"|"hide off"|"open-apps on"|"open-apps off") edit "[\"namios\",\"dock\",\"$2\"]" "$(flag "$3")" ;;
            "effect genie"|"effect scale") edit '["namios","minimize"]' "\"$3\"" ;;
            *) echo "usage: nami-dock set size|magnification|position|hide|open-apps|effect <value>" >&2; exit 2 ;;
          esac
          ;;
        *) echo "usage: nami-dock on|off|status|set" >&2; exit 2 ;;
      esac
checks.nami
# How to tell namios-dock works, on a computer nami made (tests/vm-quick.sh
# tests/namios runs these).
"in the desktop: the dock is off at the start, comes on from the person's file, and off":
  run: ( export NIRI_SOCKET=$(ls /run/user/$(id -u)/niri.*.sock | head -1); was=$(/etc/namios/dock status); /etc/namios/dock off; sleep 3; a=$(niri msg layers | grep -c 'nami-desktop:dock'); /etc/namios/dock on; sleep 3; b=$(niri msg layers | grep -c 'nami-desktop:dock'); c=$(grep -c 'on:.true' ~/user.nami); /etc/namios/dock "$was"; echo "off=$a on=$b file=$c" )
  expect: "^off=0 on=1 file=[1-9]"
"in the desktop: the dock's settings go in the person's file, and how windows minimize reaches niri":
  run: ( export NIRI_SOCKET=$(ls /run/user/$(id -u)/niri.*.sock | head -1); d=/etc/namios/dock; cp ~/user.nami /tmp/dock-check.$$; $d on; $d set size large; $d set position left; $d set effect scale; sleep 3; n=$(grep -cE 'size:.large|position:.left|minimize:.scale' ~/user.nami); e=$(grep -c '"scale"' ~/.local/state/nami/desktop.kdl); l=$(niri msg layers | grep -c 'nami-desktop:dock'); cat /tmp/dock-check.$$ > ~/user.nami; rm -f /tmp/dock-check.$$; sleep 3; g=$(grep -c '"scale"' ~/.local/state/nami/desktop.kdl); echo "file=$n effect=$e dock=$l back=$g" )
  expect: "^file=3 effect=1 dock=1 back=0$"

namios-files

10 files

Working with files on namiOS, as a stock OS does it: in Files (GNOME's), Space shows a file without opening it (Quick Look: sushi, in namiOS's look, Markdown as it reads, the arrow keys going on to the next); pictures, videos, PDFs, fonts and AppImages show as themselves (thumbnails); opening a file opens it in the app for it (Pictures, Papers, Videos, Music, Text Editor, Fonts; an archive is unpacked where it is); the right-click menu has Open in Terminal and Compress…; searching finds what's in files too (LocalSearch's index). namios-apps lists it.

package.nami
# Working with files on namiOS, as a stock OS does it: in Files (GNOME's),
# Space shows a file without opening it (Quick Look: sushi, in namiOS's
# look, Markdown as it reads, the arrow keys going on to the next); pictures,
# videos, PDFs, fonts and AppImages show as themselves (thumbnails);
# opening a file opens it in the app for it (Pictures, Papers, Videos,
# Music, Text Editor, Fonts; an archive is unpacked where it is); the
# right-click menu has Open in Terminal and Compress…; searching finds
# what's in files too (LocalSearch's index). namios-apps lists it.
name: namios-files
version: "1.0"
source:
  path: ./files
# (The AppImage thumbnailer reads the picture out of one, without starting it.)
deps: [squashfs-tools, librsvg, coreutils]
install: |
  mkdir -p $out/libexec $out/share/thumbnailers $out/share/mime/packages
  path=$(dirname "$(command -v unsquashfs)"):$(dirname "$(command -v rsvg-convert)"):$(dirname "$(command -v od)")
  sed "s|@path@|$path|" appimage-thumbnailer > $out/libexec/appimage-thumbnailer
  chmod +x $out/libexec/appimage-thumbnailer
  sed "s|@out@|$out|g" appimage.thumbnailer > $out/share/thumbnailers/appimage.thumbnailer
  cp nami-files.xml $out/share/mime/packages/
  # Quick Look's own: namiOS's look with Sushi's viewers (GJS_PATH, below); Markdown, and each
  # file at its size, as plugins of Sushi 51's (plugins-1, linked into each person's own:
  # nami-quick-look.service).
  mkdir -p $out/share/nami-sushi
  cp -r sushi/. $out/share/nami-sushi/
packages:
  # Quick Look: Space in Files.
  - sushi
  # Fonts: their thumbnails, and what opens one.
  - gnome-font-viewer
  # Music: what opens a song (Videos is Showtime, namios-apps').
  - decibels
  # Files' extensions in Python: Open in Terminal (below).
  - nautilus-python
  # Search: what's in files, not only their names; and the launcher's (LocalSearch's index).
  - localsearch
  - tinysparql
# Quick Look (Sushi before 51) finds namiOS's look here, with its own viewers (files/sushi:
# nothing else of GJS's looks in a viewers folder).
env:
  GJS_PATH: /run/current-system/sw/share/nami-sushi
services:
  # Each person's: their folders in Files' sidebar.
  - nami-files-places.service: { per-person: true }
  # Each person's: Quick Look's Markdown as it reads, and each file at its own size.
  - nami-quick-look.service: { per-person: true }
settings:
  org.gnome.nautilus.preferences:
    # Thumbnails for files on other computers and drives too, up to 50 MB.
    show-image-thumbnails: always
files:
  # Documents, Downloads, Pictures, Music and Videos in Files' sidebar (under Home,
  # Recent and Starred; drives, Network and Trash after), as GNOME's
  # xdg-user-dirs-gtk puts them: once, for someone who has no bookmarks yet. Theirs
  # to change after (drag a folder there; right-click, Remove).
  /etc/systemd/user/nami-files-places.service: |
    [Unit]
    Description=Your folders in Files' sidebar, for someone who has none yet
    After=xdg-user-dirs.service
    Before=graphical-session-pre.target
    ConditionUser=!@system
    ConditionPathExists=!%h/.config/gtk-3.0/bookmarks
    [Service]
    Type=oneshot
    ExecStart=/run/current-system/sw/bin/sh /etc/namios/files-places.sh
    [Install]
    WantedBy=graphical-session-pre.target
  /etc/namios/files-places.sh: |
    # (xdg-user-dirs made the folders, in this person's language.)
    xdg-user-dirs-update 2>/dev/null
    f=$HOME/.config/gtk-3.0/bookmarks
    [ -e "$f" ] && exit 0
    mkdir -p "${f%/*}"
    for d in DOCUMENTS DOWNLOAD PICTURES MUSIC VIDEOS; do
      p=$(xdg-user-dir "$d")
      # (Not Home itself, where a folder isn't set.)
      [ -n "$p" ] && [ "$p" != "$HOME" ] && [ -d "$p" ] || continue
      printf 'file://%s\n' "$(printf %s "$p" | sed 's/%/%25/g; s/ /%20/g')"
    done > "$f.new" && mv "$f.new" "$f"
  # Sushi 51 takes plugins from its own folder (in the store) and each person's alone: namiOS's
  # (Markdown as it reads; each file at its own size, niri asked) are linked into theirs at each
  # login (where they are in the system now). Only nami's own there; anything of theirs stays.
  /etc/systemd/user/nami-quick-look.service: |
    [Unit]
    Description=namiOS's Quick Look: Markdown as it reads, each file at its size
    Before=graphical-session-pre.target
    ConditionUser=!@system
    [Service]
    Type=oneshot
    # (Kept "active": an update that brings another is started again, as it's changed.)
    RemainAfterExit=yes
    ExecStart=/run/current-system/sw/bin/sh -c 'mkdir -p %h/.local/share/sushi/plugins-1 && ln -sf /run/current-system/sw/share/nami-sushi/plugins-1/nami-*.js %h/.local/share/sushi/plugins-1/'
    [Install]
    WantedBy=graphical-session-pre.target
  # Search's index: started as Files or the launcher first asks it (D-Bus), then it keeps up
  # with the person's folders (Documents, Downloads, Pictures, Music, Videos, Desktop;
  # Home's own files) in the background: about 50 MB, and a second of work for a new home.
  # It's meant to wait for GNOME's session to say it's a person's; niri's doesn't say.
  /etc/systemd/user/localsearch-3.service.d/nami.conf: |
    [Unit]
    ConditionEnvironment=
    ConditionUser=!@system
  # What opens what, for everyone (each person's choices in Settings come first:
  # ~/.config/mimeapps.list). Scripts open as text: they're kinds of programs, so
  # without this a .py would be started as a downloaded program. An archive is Files'
  # own: opening one unpacks it next to it (Archive Manager is in Open With). A
  # tarball (.tar.gz, .tar.xz, .tar.zst) is looked into first, where other-linuxes-desktop
  # is: one with a program in it shows in Settings, to install; one of plain files is
  # unpacked next to it all the same.
  /etc/xdg/mimeapps.list: |
    [Default Applications]
    inode/directory=org.gnome.Nautilus.desktop
    image/png=org.gnome.Loupe.desktop
    image/jpeg=org.gnome.Loupe.desktop
    image/gif=org.gnome.Loupe.desktop
    image/webp=org.gnome.Loupe.desktop
    image/bmp=org.gnome.Loupe.desktop
    image/tiff=org.gnome.Loupe.desktop
    image/svg+xml=org.gnome.Loupe.desktop
    image/heic=org.gnome.Loupe.desktop
    image/heif=org.gnome.Loupe.desktop
    image/avif=org.gnome.Loupe.desktop
    image/jxl=org.gnome.Loupe.desktop
    image/vnd.microsoft.icon=org.gnome.Loupe.desktop
    image/x-icon=org.gnome.Loupe.desktop
    application/pdf=org.gnome.Papers.desktop
    application/postscript=org.gnome.Papers.desktop
    video/mp4=org.gnome.Showtime.desktop
    video/webm=org.gnome.Showtime.desktop
    video/x-matroska=org.gnome.Showtime.desktop
    video/quicktime=org.gnome.Showtime.desktop
    video/x-msvideo=org.gnome.Showtime.desktop
    video/mpeg=org.gnome.Showtime.desktop
    video/ogg=org.gnome.Showtime.desktop
    video/x-ogm+ogg=org.gnome.Showtime.desktop
    video/3gpp=org.gnome.Showtime.desktop
    video/x-flv=org.gnome.Showtime.desktop
    audio/mpeg=org.gnome.Decibels.desktop
    audio/flac=org.gnome.Decibels.desktop
    audio/ogg=org.gnome.Decibels.desktop
    audio/x-vorbis+ogg=org.gnome.Decibels.desktop
    audio/x-opus+ogg=org.gnome.Decibels.desktop
    audio/opus=org.gnome.Decibels.desktop
    audio/wav=org.gnome.Decibels.desktop
    audio/x-wav=org.gnome.Decibels.desktop
    audio/mp4=org.gnome.Decibels.desktop
    audio/x-m4a=org.gnome.Decibels.desktop
    audio/aac=org.gnome.Decibels.desktop
    audio/webm=org.gnome.Decibels.desktop
    text/plain=org.gnome.TextEditor.desktop
    text/markdown=org.gnome.TextEditor.desktop
    text/x-nami=org.gnome.TextEditor.desktop
    application/yaml=org.gnome.TextEditor.desktop
    application/json=org.gnome.TextEditor.desktop
    application/xml=org.gnome.TextEditor.desktop
    application/toml=org.gnome.TextEditor.desktop
    text/csv=org.gnome.TextEditor.desktop
    text/x-log=org.gnome.TextEditor.desktop
    text/x-csrc=org.gnome.TextEditor.desktop
    text/x-chdr=org.gnome.TextEditor.desktop
    text/x-c++src=org.gnome.TextEditor.desktop
    text/rust=org.gnome.TextEditor.desktop
    text/x-go=org.gnome.TextEditor.desktop
    text/javascript=org.gnome.TextEditor.desktop
    text/css=org.gnome.TextEditor.desktop
    text/x-python=org.gnome.TextEditor.desktop
    text/x-python3=org.gnome.TextEditor.desktop
    text/x-shellscript=org.gnome.TextEditor.desktop
    application/x-shellscript=org.gnome.TextEditor.desktop
    application/x-perl=org.gnome.TextEditor.desktop
    application/x-ruby=org.gnome.TextEditor.desktop
    text/x-lua=org.gnome.TextEditor.desktop
    text/x-awk=org.gnome.TextEditor.desktop
    text/x-sed=org.gnome.TextEditor.desktop
    text/x-csh=org.gnome.TextEditor.desktop
    text/x-vala=org.gnome.TextEditor.desktop
    application/typescript=org.gnome.TextEditor.desktop
    application/x-fishscript=org.gnome.TextEditor.desktop
    application/x-nuscript=org.gnome.TextEditor.desktop
    application/zip=org.gnome.Nautilus.desktop
    application/x-tar=org.gnome.Nautilus.desktop
    application/x-compressed-tar=nami-install-app.desktop;org.gnome.Nautilus.desktop;
    application/x-bzip2-compressed-tar=org.gnome.Nautilus.desktop
    application/x-xz-compressed-tar=nami-install-app.desktop;org.gnome.Nautilus.desktop;
    application/x-zstd-compressed-tar=nami-install-app.desktop;org.gnome.Nautilus.desktop;
    application/x-7z-compressed=org.gnome.Nautilus.desktop
    application/vnd.rar=org.gnome.Nautilus.desktop
    application/gzip=org.gnome.Nautilus.desktop
    application/x-gzip=org.gnome.Nautilus.desktop
    application/x-xz=org.gnome.Nautilus.desktop
    application/zstd=org.gnome.Nautilus.desktop
    application/x-bzip=org.gnome.Nautilus.desktop
    font/ttf=org.gnome.font-viewer.desktop
    font/otf=org.gnome.font-viewer.desktop
    font/woff=org.gnome.font-viewer.desktop
    font/woff2=org.gnome.font-viewer.desktop
    application/x-font-ttf=org.gnome.font-viewer.desktop
  # Open in Terminal, in Files' right-click menu: the folder (or the folder a file is
  # in) in a new terminal window, Ghostty, else whatever xdg-terminal-exec picks.
  # (Named as Ghostty's own, which says "Open in Ghostty", so this one is used.)
  /etc/nami-os/share/nautilus-python/extensions/ghostty.py: |
    import shutil
    from gi.repository import Nautilus, GObject, Gio


    def open_terminal(_item, paths):
        for path in paths:
            if shutil.which("ghostty"):
                Gio.Subprocess.new(["ghostty", f"--working-directory={path}", "--gtk-single-instance=false"], Gio.SubprocessFlags.NONE)
            else:
                launcher = Gio.SubprocessLauncher.new(Gio.SubprocessFlags.NONE)
                launcher.set_cwd(path)
                launcher.spawnv(["xdg-terminal-exec"])


    def folders(files):
        paths = []
        for f in files:
            place = f.get_location() if f.is_directory() else f.get_parent_location()
            path = place.get_path() if place else None
            if path and path not in paths:
                paths.append(path)
        # (Not a window for each of many folders picked by mistake.)
        return paths if len(paths) <= 10 else []


    def items(name, files):
        paths = folders(files)
        if not paths:
            return []
        item = Nautilus.MenuItem(name=name, label="Open in Terminal", icon="utilities-terminal")
        item.connect("activate", open_terminal, paths)
        return [item]


    class NamiOpenInTerminal(GObject.GObject, Nautilus.MenuProvider):
        def get_file_items(self, files):
            return items("NamiOpenInTerminal::files", files)

        def get_background_items(self, folder):
            return items("NamiOpenInTerminal::folder", [folder])
checks.nami
# How to tell namios-files works, on a computer nami made (tests/vm-quick.sh
# tests/namios runs these; tests/lib/namios-files-check.sh does what takes Files open).
"apps say what kinds of file they open (mimeinfo.cache), as GLib needs to know it":
  run: grep -c '^text/plain=.*org.gnome.TextEditor.desktop' /run/current-system/sw/share/applications/mimeinfo.cache | sed 's/^/N=/'
  expect: "^N=1$"
"in the desktop: each kind of file opens in its app":
  run: for t in image/jpeg application/pdf video/mp4 audio/mpeg text/plain text/x-python application/zip font/ttf text/x-nami inode/directory; do gio mime $t | head -1 | sed 's/.*:[[:space:]]//'; done | tr '\n' ' '
  expect: "^org.gnome.Loupe.desktop org.gnome.Papers.desktop org.gnome.Showtime.desktop org.gnome.Decibels.desktop org.gnome.TextEditor.desktop org.gnome.TextEditor.desktop org.gnome.Nautilus.desktop org.gnome.font-viewer.desktop org.gnome.TextEditor.desktop org.gnome.Nautilus.desktop $"
"in the desktop: a .nami file is a nami file, text":
  run: printf 'packages:\n' > /tmp/check-$$.nami; gio info -a standard::content-type /tmp/check-$$.nami | sed -n 's/.*content-type:[[:space:]]//p'; rm -f /tmp/check-$$.nami
  expect: "^text/x-nami$"
"Quick Look (sushi), and thumbnails for videos, PDFs, fonts and AppImages":
  run: ( s=/run/current-system/sw/share; ls $s/dbus-1/services/org.gnome.NautilusPreviewer.service >/dev/null && echo -n 'sushi '; for t in ffmpegthumbnailer papers gnome-font-viewer appimage; do ls $s/thumbnailers/$t.thumbnailer >/dev/null 2>&1 && echo -n "$t "; done; echo )
  expect: "^sushi ffmpegthumbnailer papers gnome-font-viewer appimage $"
"in the desktop: Documents, Downloads, Pictures, Music and Videos in Files' sidebar":
  run: sed 's|file://'"$HOME"'/||' ~/.config/gtk-3.0/bookmarks | tr '\n' ' '
  expect: "^Documents Downloads Pictures Music Videos $"
"in the desktop: Files' Open in Terminal (Python extensions, nami's in place of Ghostty's own)":
  run: ls /run/current-system/sw/lib/nautilus/extensions-4/libnautilus-python.so >/dev/null && grep -c 'label="Open in Terminal"' /etc/nami-os/share/nautilus-python/extensions/ghostty.py | sed 's/^/N=/'
  expect: "^N=1$"
"in the desktop: a nami bundle is told by what's in it, without its executable bit or a name that says so":
  run: f=/tmp/check-bundle-$$; printf '\177ELF\002\001\001\000\000TRAYBUN\003\000' > $f; head -c 4000 /dev/zero >> $f; gio info -a standard::content-type $f | sed -n 's/.*content-type:[[:space:]]//p'; rm -f $f
  expect: "^application/x-tray-bundle$"
files/appimage-thumbnailer
#!/bin/sh
# An AppImage's own picture as its thumbnail in Files, read from inside it
# (its .DirIcon) without starting it: the squashfs after its ELF runtime.
# usage: appimage-thumbnailer <AppImage> <out.png> <size>
PATH=@path@
in=$1 out=$2 size=${3:-256}
u() { od -An -t "u$1" -j "$2" -N "$1" "$in" | tr -d ' \n'; }
# Only the ELF kind (type 2, every AppImage of the last years).
[ "$(od -An -c -j 1 -N 3 "$in" | tr -d ' \n')" = ELF ] || exit 1
# (The squashfs starts where the section headers end.)
off=$(( $(u 8 40) + $(u 2 58) * $(u 2 60) ))
tmp=$(mktemp -d) || exit 1
trap 'rm -rf "$tmp"' EXIT
name=.DirIcon
# .DirIcon is often a link to the picture (a link to a link, sometimes).
for _ in 1 2 3 4; do
  unsquashfs -q -n -f -o "$off" -d "$tmp/r" "$in" "$name" >/dev/null 2>&1 || exit 1
  [ -L "$tmp/r/$name" ] || break
  to=$(readlink "$tmp/r/$name")
  case $to in /*) name=${to#/} ;; *) name=$(dirname "$name")/$to ;; esac
  name=${name#./}
done
pic=$tmp/r/$name
[ -s "$pic" ] || exit 1
case $(od -An -c -N 4 "$pic" | tr -d ' \n') in
  # (Files makes it the size it wants.)
  *PNG*) cp "$pic" "$out" ;;
  *) rsvg-convert -w "$size" -h "$size" -a -o "$out" "$pic" ;;
esac
files/appimage.thumbnailer
[Thumbnailer Entry]
TryExec=@out@/libexec/appimage-thumbnailer
Exec=@out@/libexec/appimage-thumbnailer %i %o %s
MimeType=application/vnd.appimage;application/x-iso9660-appimage;
files/nami-files.xml
<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
  <!-- nami's own files (computer.nami, user.nami, a theme): text, YAML. -->
  <mime-type type="text/x-nami">
    <comment>nami file</comment>
    <sub-class-of type="application/yaml"/>
    <generic-icon name="text-x-generic"/>
    <glob pattern="*.nami"/>
  </mime-type>
  <!-- An app in one file, `nami bundle`'s: a program, marked in its ELF
       header's padding (bytes 9 to 15, which nothing reads), so it's told
       by what's in it, whatever it's called and with or without its
       executable bit (a download has none). Opening one shows it in
       Settings, to install (other-linuxes-desktop's nami-install-app). -->
  <mime-type type="application/x-tray-bundle">
    <comment>App in one file</comment>
    <generic-icon name="application-x-executable"/>
    <magic priority="80">
      <match type="string" offset="0" value="\177ELF">
        <match type="string" offset="9" value="TRAYBUN"/>
      </match>
    </magic>
  </mime-type>
</mime-info>
files/sushi/plugins-1/nami-each-its-size.js
// Each file at its own size in Quick Look, as the arrow keys go from one to the next (a Mac's
// Quick Look's): Sushi asks GTK for the new size, but niri keeps a floating window at the size
// it's at, so niri's asked for it too, in the middle. Loaded with Sushi 51's plugins (it shows
// no kind of file itself); it only adds to Sushi: anything here that fails leaves it as it was.

import GLib from 'gi://GLib';

// niri, asked: its windows, or to do something to one.
function niri(args) {
    try {
        const [ok, out] = GLib.spawn_sync(null, ['niri', 'msg', ...args], null, GLib.SpawnFlags.SEARCH_PATH, null);
        return ok ? new TextDecoder().decode(out) : '';
    } catch {
        return '';
    }
}

function eachItsSize(MainWindow) {
    const own = MainWindow.prototype._resizeWindow;
    if (typeof own !== 'function')
        return;
    MainWindow.prototype._resizeWindow = function () {
        own.call(this);
        const [, nat] = this.get_preferred_size();
        if (!this.get_mapped() || nat.width <= 0 || nat.height <= 0)
            return;
        let ours;
        try {
            ours = JSON.parse(niri(['-j', 'windows']) || '[]').find(w => w.app_id === 'org.gnome.NautilusPreviewer');
        } catch {
            return;
        }
        if (!ours?.layout)
            return;
        const [w, h] = ours.layout.window_size ?? [0, 0];
        if (Math.abs(w - nat.width) <= 4 && Math.abs(h - nat.height) <= 4)
            return;
        const id = String(ours.id);
        niri(['action', 'set-window-width', '--id', id, String(nat.width)]);
        niri(['action', 'set-window-height', '--id', id, String(nat.height)]);
        // (In the middle once it's that size: niri centres what it has.)
        GLib.timeout_add(GLib.PRIORITY_DEFAULT, 160, () => {
            niri(['action', 'center-window', '--id', id]);
            return GLib.SOURCE_REMOVE;
        });
    };
}

// Once Sushi's own modules are loaded: this is loaded while they are (its main window's module
// waits on the plugins), so it's looked up after.
if (GLib.getenv('NIRI_SOCKET')) {
    GLib.idle_add(GLib.PRIORITY_DEFAULT, () => {
        import('resource:///org/gnome/NautilusPreviewer/js/core/mainWindow.js')
            .then(m => eachItsSize(m.MainWindow))
            .catch(e => console.warn(`namiOS: each file at its size: ${e}`));
        return GLib.SOURCE_REMOVE;
    });
}
files/sushi/plugins-1/nami-markdown.js
// Markdown in Quick Look (Space in Files: GNOME's Sushi), as it reads: headings, emphasis, lists,
// quotes, code, links, pictures and tables, in Geist and namiOS's colours, light or dark as the
// desktop is. Sushi shows it as text otherwise. A link opens in its app, not in here.
// A plugin of Sushi 51's (its plugin-api-1): each person's ~/.local/share/sushi/plugins-1 has
// it (namios-files' nami-quick-look.service), as Sushi looks nowhere else that isn't its own.

import Adw from 'gi://Adw';
import Gdk from 'gi://Gdk';
import Gio from 'gi://Gio';
import GObject from 'gi://GObject';

import {Renderer} from 'resource:///org/gnome/NautilusPreviewer/plugin-api-1.js';

let WebKit;
try {
    WebKit = (await import('gi://WebKit?version=6.0')).default;
} catch {
    /* none: Sushi's text viewer shows it */
}

// What's read of it at most: a long file shows its start.
const MOST = 512 * 1024;

function escape(text) {
    return text.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
}

// A line's own marks: code, pictures, links, bold and italics, struck out, plain addresses.
function inline(text) {
    let codes = [];
    text = text.replace(/`([^`]+)`/g, (_m, c) => {
        codes.push(`<code>${escape(c)}</code>`);
        return `\u0000${codes.length - 1}\u0000`;
    });
    text = escape(text);
    text = text.replace(/!\[([^\]]*)\]\(([^)\s]+)(?:\s+&quot;[^&]*&quot;)?\)/g, '<img alt="$1" src="$2">');
    text = text.replace(/\[([^\]]+)\]\(([^)\s]+)(?:\s+&quot;[^&]*&quot;)?\)/g, '<a href="$2">$1</a>');
    text = text.replace(/&lt;(https?:\/\/[^\s&]+)&gt;/g, '<a href="$1">$1</a>');
    text = text.replace(/\*\*([^*]+)\*\*|__([^_]+)__/g, (_m, a, b) => `<strong>${a || b}</strong>`);
    text = text.replace(/(^|[^*\w])\*([^*\s][^*]*)\*/g, '$1<em>$2</em>');
    text = text.replace(/(^|[^_\w])_([^_\s][^_]*)_(?!\w)/g, '$1<em>$2</em>');
    text = text.replace(/~~([^~]+)~~/g, '<del>$1</del>');
    return text.replace(/\u0000(\d+)\u0000/g, (_m, n) => codes[Number(n)]);
}

function cells(line) {
    return line.trim().replace(/^\||\|$/g, '').split('|').map(c => c.trim());
}

// Markdown as a page: CommonMark's common parts, line by line.
function toHtml(source) {
    let lines = source.replace(/\r\n?/g, '\n').split('\n');
    let out = [];
    let para = [];
    let lists = [];
    const flush = () => {
        if (para.length) {
            out.push(`<p>${inline(para.join(' '))}</p>`);
            para = [];
        }
    };
    const closeLists = (depth = 0) => {
        while (lists.length > depth)
            out.push(`</li></${lists.pop().tag}>`);
    };
    for (let i = 0; i < lines.length; i++) {
        let line = lines[i];
        let fence = line.match(/^\s*(```|~~~)\s*([\w+-]*)/);
        if (fence) {
            flush();
            closeLists();
            let code = [];
            while (++i < lines.length && !lines[i].trim().startsWith(fence[1]))
                code.push(lines[i]);
            out.push(`<pre><code>${escape(code.join('\n'))}</code></pre>`);
            continue;
        }
        if (!line.trim()) {
            flush();
            continue;
        }
        let heading = line.match(/^(#{1,6})\s+(.*?)\s*#*\s*$/);
        if (heading) {
            flush();
            closeLists();
            out.push(`<h${heading[1].length}>${inline(heading[2])}</h${heading[1].length}>`);
            continue;
        }
        if (/^\s*([-*_])(\s*\1){2,}\s*$/.test(line)) {
            flush();
            closeLists();
            out.push('<hr>');
            continue;
        }
        if (/^\s*>/.test(line)) {
            flush();
            closeLists();
            let quoted = [];
            for (; i < lines.length && /^\s*>/.test(lines[i]); i++)
                quoted.push(lines[i].replace(/^\s*>\s?/, ''));
            i--;
            out.push(`<blockquote>${toHtml(quoted.join('\n'))}</blockquote>`);
            continue;
        }
        if (line.includes('|') && i + 1 < lines.length && /^\s*\|?\s*:?-+:?\s*(\|\s*:?-+:?\s*)*\|?\s*$/.test(lines[i + 1])) {
            flush();
            closeLists();
            let head = cells(line);
            i += 2;
            let rows = [];
            for (; i < lines.length && lines[i].includes('|') && lines[i].trim(); i++)
                rows.push(cells(lines[i]));
            i--;
            out.push(`<table><thead><tr>${head.map(c => `<th>${inline(c)}</th>`).join('')}</tr></thead><tbody>${
                rows.map(r => `<tr>${r.map(c => `<td>${inline(c)}</td>`).join('')}</tr>`).join('')}</tbody></table>`);
            continue;
        }
        let item = line.match(/^(\s*)([-*+]|\d+[.)])\s+(.*)$/);
        if (item) {
            flush();
            let depth = Math.floor(item[1].replace(/\t/g, '    ').length / 2) + 1;
            let tag = /\d/.test(item[2]) ? 'ol' : 'ul';
            if (depth > lists.length + 1)
                depth = lists.length + 1;
            if (lists.length >= depth) {
                closeLists(depth);
                if (lists.length === depth && lists[depth - 1].tag !== tag) {
                    closeLists(depth - 1);
                }
            }
            let text = item[3];
            let task = text.match(/^\[([ xX])\]\s+(.*)$/);
            if (task)
                text = `<input type="checkbox" disabled${task[1] !== ' ' ? ' checked' : ''}> ${inline(task[2])}`;
            else
                text = inline(text);
            if (lists.length === depth)
                out.push(`</li><li>${text}`);
            else {
                lists.push({ tag });
                out.push(`<${tag}><li>${text}`);
            }
            continue;
        }
        if (lists.length && /^\s+\S/.test(line)) {
            out.push(` ${inline(line.trim())}`);
            continue;
        }
        closeLists();
        para.push(line.trim());
    }
    flush();
    closeLists();
    return out.join('\n');
}

function page(body, dark) {
    const c = dark ? {
        ground: '#13161d', text: '#e4e6eb', muted: '#9aa2b2', line: '#2a3040', soft: '#212634', link: '#a9bad6', head: '#c2cfe4',
    } : {
        ground: '#ffffff', text: '#18181b', muted: '#71717a', line: '#e4e4e7', soft: '#f4f4f5', link: '#45577a', head: '#2a3650',
    };
    return `<!doctype html><html><head><meta charset="utf-8"><style>
html { background: ${c.ground}; color-scheme: ${dark ? 'dark' : 'light'}; }
body { margin: 0 auto; max-width: 720px; padding: 28px 36px 48px; font: 15px/1.6 "Geist", sans-serif; color: ${c.text}; }
h1, h2, h3, h4, h5, h6 { color: ${c.head}; line-height: 1.25; margin: 1.4em 0 0.5em; font-weight: 600; }
h1 { font-size: 1.9em; margin-top: 0.4em; } h2 { font-size: 1.45em; } h3 { font-size: 1.2em; } h4, h5, h6 { font-size: 1em; }
h1, h2 { padding-bottom: 0.3em; border-bottom: 1px solid ${c.line}; }
p, ul, ol, blockquote, pre, table { margin: 0 0 1em; }
a { color: ${c.link}; text-decoration: none; } a:hover { text-decoration: underline; }
code { font: 0.88em "Geist Mono", monospace; background: ${c.soft}; border-radius: 5px; padding: 0.1em 0.35em; }
pre { background: ${c.soft}; border-radius: 10px; padding: 12px 14px; overflow-x: auto; }
pre code { background: none; padding: 0; font-size: 0.85em; line-height: 1.5; }
blockquote { margin-left: 0; padding: 0 0 0 14px; border-left: 3px solid ${c.link}; color: ${c.muted}; }
hr { border: none; border-top: 1px solid ${c.line}; margin: 1.6em 0; }
img { max-width: 100%; border-radius: 8px; }
table { border-collapse: collapse; } th, td { border: 1px solid ${c.line}; padding: 6px 10px; text-align: left; }
th { background: ${c.soft}; font-weight: 600; }
li { margin: 0.2em 0; } input[type=checkbox] { margin: 0 0.4em 0 0; accent-color: ${c.link}; }
del { color: ${c.muted}; }
</style></head><body>${body}</body></html>`;
}

export const Klass = WebKit === undefined ? undefined : class NamiMarkdownRenderer extends Adw.Bin {
    static {
        GObject.registerClass({Implements: [Renderer]}, this);
    }

    constructor(file, _fileInfo, constructProperties = {}) {
        super(constructProperties);
        const view = new WebKit.WebView({hexpand: true, vexpand: true});
        this.set_child(view);
        view.connect('context-menu', () => true);
        // A link opens in its app; the page itself is all that's shown here.
        view.connect('decide-policy', (_view, decision, type) => {
            if (type !== WebKit.PolicyDecisionType.NAVIGATION_ACTION)
                return false;
            const action = decision.get_navigation_action();
            if (action.get_navigation_type() !== WebKit.NavigationType.LINK_CLICKED)
                return false;
            const uri = action.get_request().get_uri();
            decision.ignore();
            Gio.AppInfo.launch_default_for_uri_async(uri, null, null, null);
            return true;
        });
        view.get_settings().enable_javascript = false;
        const dark = Adw.StyleManager.get_default().dark;
        view.set_background_color(new Gdk.RGBA({red: dark ? 0.075 : 1, green: dark ? 0.086 : 1, blue: dark ? 0.114 : 1, alpha: 1}));
        view.connect('load-failed', (_view, _event, _uri, error) => this.markFailed(error));
        file.load_contents_async(this.cancellable, (f, res) => {
            try {
                const [, bytes] = f.load_contents_finish(res);
                const text = new TextDecoder().decode(bytes.length > MOST ? bytes.slice(0, MOST) : bytes);
                const folder = f.get_parent();
                view.load_html(page(toHtml(text), dark), folder ? `${folder.get_uri()}/` : null);
                this.markReady();
            } catch (e) {
                this.markFailed(e);
            }
        });
    }

    get topBarStyle() {
        return Adw.ToolbarStyle.RAISED_BORDER;
    }
};

export const contentTypes = WebKit === undefined ? [] : ['text/markdown', 'text/x-markdown'];
files/sushi/styles/nami-dark.style-scheme.xml
<?xml version="1.0" encoding="UTF-8"?>
<!-- Code in Quick Look, dark: namiOS's slate tints, its green and violet; no sand. -->
<style-scheme id="nami-dark" name="namiOS dark" version="1.0">
  <author>namiOS</author>
  <description>namiOS's colours for code, dark</description>
  <color name="text" value="#e4e6eb"/>
  <color name="ground" value="#13161d"/>
  <color name="faint" value="#5d6476"/>
  <color name="comment" value="#6f7686"/>
  <color name="slate" value="#a9bad6"/>
  <color name="pale" value="#c2cfe4"/>
  <color name="soft" value="#1f2738"/>
  <color name="green" value="#9cc4a4"/>
  <color name="violet" value="#c2acd6"/>
  <color name="teal" value="#97c2c9"/>
  <style name="text" foreground="text" background="ground"/>
  <style name="selection" foreground="#ffffff" background="#2f3646"/>
  <style name="cursor" foreground="slate"/>
  <style name="current-line" background="#171b23"/>
  <style name="line-numbers" foreground="faint" background="ground"/>
  <style name="current-line-number" background="ground"/>
  <style name="bracket-match" foreground="pale" background="soft" bold="true"/>
  <style name="bracket-mismatch" foreground="#13161d" background="#e08a8a"/>
  <style name="search-match" background="soft"/>
  <style name="def:comment" foreground="comment" italic="true"/>
  <style name="def:shebang" foreground="comment" bold="true"/>
  <style name="def:doc-comment-element" italic="true"/>
  <style name="def:constant" foreground="violet"/>
  <style name="def:special-constant" foreground="violet"/>
  <style name="def:floating-point" foreground="violet"/>
  <style name="def:decimal" foreground="violet"/>
  <style name="def:base-n-integer" foreground="violet"/>
  <style name="def:boolean" foreground="violet"/>
  <style name="def:string" foreground="green"/>
  <style name="def:special-char" foreground="teal"/>
  <style name="def:function" foreground="slate"/>
  <style name="def:identifier" foreground="text"/>
  <style name="def:statement" foreground="pale" bold="true"/>
  <style name="def:keyword" foreground="pale" bold="true"/>
  <style name="def:type" foreground="slate" bold="true"/>
  <style name="def:preprocessor" foreground="teal"/>
  <style name="def:error" foreground="#13161d" background="#e08a8a"/>
  <style name="def:note" foreground="slate" bold="true"/>
  <style name="def:underlined" italic="true" underline="true"/>
  <style name="def:emphasis" italic="true"/>
  <style name="def:strong-emphasis" bold="true"/>
  <style name="def:heading" foreground="pale" bold="true"/>
  <style name="def:link-text" foreground="slate"/>
  <style name="def:link-destination" foreground="slate" underline="true"/>
  <style name="def:inline-code" foreground="teal"/>
  <style name="def:insertion" foreground="green"/>
  <style name="def:deletion" foreground="#e08a8a"/>
  <style name="diff:added-line" foreground="green"/>
  <style name="diff:removed-line" foreground="#e08a8a"/>
  <style name="diff:location" foreground="slate"/>
</style-scheme>
files/sushi/styles/nami-light.style-scheme.xml
<?xml version="1.0" encoding="UTF-8"?>
<!-- Code in Quick Look, light: namiOS's slate, its green and violet; no sand. -->
<style-scheme id="nami-light" name="namiOS light" version="1.0">
  <author>namiOS</author>
  <description>namiOS's colours for code, light</description>
  <color name="text" value="#18181b"/>
  <color name="ground" value="#ffffff"/>
  <color name="faint" value="#a1a1aa"/>
  <color name="comment" value="#8b8b93"/>
  <color name="slate" value="#45577a"/>
  <color name="deep" value="#2a3650"/>
  <color name="soft" value="#eef2f8"/>
  <color name="green" value="#4f7a5a"/>
  <color name="violet" value="#6c5a8a"/>
  <color name="teal" value="#3f6f78"/>
  <style name="text" foreground="text" background="ground"/>
  <style name="selection" foreground="text" background="#d5dceb"/>
  <style name="cursor" foreground="slate"/>
  <style name="current-line" background="#f7f8fa"/>
  <style name="line-numbers" foreground="faint" background="ground"/>
  <style name="current-line-number" background="ground"/>
  <style name="bracket-match" foreground="deep" background="soft" bold="true"/>
  <style name="bracket-mismatch" foreground="#ffffff" background="#b3443c"/>
  <style name="search-match" background="soft"/>
  <style name="def:comment" foreground="comment" italic="true"/>
  <style name="def:shebang" foreground="comment" bold="true"/>
  <style name="def:doc-comment-element" italic="true"/>
  <style name="def:constant" foreground="violet"/>
  <style name="def:special-constant" foreground="violet"/>
  <style name="def:floating-point" foreground="violet"/>
  <style name="def:decimal" foreground="violet"/>
  <style name="def:base-n-integer" foreground="violet"/>
  <style name="def:boolean" foreground="violet"/>
  <style name="def:string" foreground="green"/>
  <style name="def:special-char" foreground="teal"/>
  <style name="def:function" foreground="slate"/>
  <style name="def:identifier" foreground="text"/>
  <style name="def:statement" foreground="deep" bold="true"/>
  <style name="def:keyword" foreground="deep" bold="true"/>
  <style name="def:type" foreground="slate" bold="true"/>
  <style name="def:preprocessor" foreground="teal"/>
  <style name="def:error" foreground="#ffffff" background="#b3443c"/>
  <style name="def:note" foreground="slate" bold="true"/>
  <style name="def:underlined" italic="true" underline="true"/>
  <style name="def:emphasis" italic="true"/>
  <style name="def:strong-emphasis" bold="true"/>
  <style name="def:heading" foreground="deep" bold="true"/>
  <style name="def:link-text" foreground="slate"/>
  <style name="def:link-destination" foreground="slate" underline="true"/>
  <style name="def:inline-code" foreground="teal"/>
  <style name="def:insertion" foreground="green"/>
  <style name="def:deletion" foreground="#b3443c"/>
  <style name="diff:added-line" foreground="green"/>
  <style name="diff:removed-line" foreground="#b3443c"/>
  <style name="diff:location" foreground="slate"/>
</style-scheme>
files/sushi/viewers/namiLook.js
// namiOS's look for Quick Look (Space in Files: GNOME's Sushi), loaded with Sushi's own viewers
// (namios-files puts this folder on GJS_PATH): light or dark as the desktop is, not always dark;
// Geist; the window's header, its Open With button and its round close button in namiOS's
// slate; the controls over a video, a song or a PDF as namiOS's panels; code in namiOS's
// colours (nami-light and nami-dark, next to this); and each file at its own size as the arrow
// keys go on to the next. It only adds to Sushi: anything here that fails leaves it as it was.

const {Gdk, Gio, GLib, Gtk} = imports.gi;

// (This folder's parent: where the colours for code are.)
const HERE = (GLib.getenv('GJS_PATH') || '').split(':')
    .find(p => p && GLib.file_test(`${p}/styles`, GLib.FileTest.IS_DIR)) || '';

let _interface = null;
function _settings() {
    if (!_interface) {
        try {
            _interface = new Gio.Settings({ schema_id: 'org.gnome.desktop.interface' });
        } catch (e) {
            _interface = null;
        }
    }
    return _interface;
}

// Dark, as the desktop is (Settings writes both).
function dark() {
    let s = _settings();
    if (!s)
        return false;
    return s.get_string('color-scheme') === 'prefer-dark' || s.get_string('gtk-theme').endsWith('-dark');
}

function _css(d) {
    const c = d ? {
        ground: '#13161d', text: '#e4e6eb', muted: '#9aa2b2', header: '#191d26', line: '#2a3040',
        soft: '#212634', button: '#45577a', buttonHover: '#52668c', buttonDown: '#2a3650', buttonText: '#ffffff',
        close: '#2a3040', closeHover: '#3a4152', closeText: '#cdd3de',
        osd: 'rgba(25, 29, 38, 0.92)', track: '#2a3040', fill: '#a9bad6',
    } : {
        ground: '#fafafa', text: '#18181b', muted: '#71717a', header: '#ffffff', line: '#e4e4e7',
        soft: '#f4f4f5', button: '#45577a', buttonHover: '#3b4b6a', buttonDown: '#2a3650', buttonText: '#ffffff',
        close: '#eef2f8', closeHover: '#dfe5f0', closeText: '#45577a',
        osd: 'rgba(255, 255, 255, 0.94)', track: '#e4e4e7', fill: '#45577a',
    };
    return `
window, window.background { background-color: ${c.ground}; color: ${c.text}; font-family: "Geist", sans-serif; }
window decoration { border-radius: 12px 12px 0 0; }
headerbar, headerbar:backdrop {
    background: ${c.header}; color: ${c.text}; border: none; border-bottom: 1px solid ${c.line};
    box-shadow: none; min-height: 44px; padding: 0 8px; border-radius: 12px 12px 0 0;
}
headerbar .title { font-family: "Geist", sans-serif; font-weight: 600; font-size: 13px; color: ${c.text}; }
headerbar button.text-button, headerbar button.text-button:backdrop {
    background: ${c.button}; color: ${c.buttonText}; border: none; box-shadow: none; text-shadow: none;
    border-radius: 8px; padding: 2px 12px; min-height: 28px; font-weight: 500; font-size: 12.5px;
    transition: background-color 150ms ease-out;
}
headerbar button.text-button label { color: ${c.buttonText}; }
headerbar button.text-button:hover { background: ${c.buttonHover}; }
headerbar button.text-button:active { background: ${c.buttonDown}; }
headerbar button.titlebutton, headerbar button.titlebutton:backdrop {
    background: ${c.close}; color: ${c.closeText}; border: none; box-shadow: none; border-radius: 9999px;
    min-width: 22px; min-height: 22px; padding: 2px; margin: 0 4px;
    transition: background-color 150ms ease-out;
}
headerbar button.titlebutton:hover { background: ${c.closeHover}; }
headerbar button.titlebutton image { color: ${c.closeText}; }
toolbar.osd, .osd toolbar {
    background-color: ${c.osd}; color: ${c.text}; border: 1px solid ${c.line}; border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.16);
}
.osd button, toolbar.osd button { background: none; border: none; box-shadow: none; color: ${c.text}; border-radius: 8px; }
.osd button:hover, toolbar.osd button:hover { background: ${c.soft}; }
.osd label, toolbar.osd label { color: ${c.text}; font-feature-settings: "tnum"; }
scale trough { background-color: ${c.track}; border: none; min-height: 4px; border-radius: 4px; }
scale highlight { background-color: ${c.fill}; border: none; border-radius: 4px; }
scale slider { background-color: ${c.header}; border: 1px solid ${c.line}; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2); }
textview, textview text { font-family: "Geist Mono", monospace; font-size: 11pt; }
scrolledwindow, viewport { background-color: ${c.ground}; }
label { font-family: "Geist", sans-serif; }
`;
}

// Code in namiOS's colours, light or dark: what Sushi asks for (Builder's dark) is ours.
function _codeColours() {
    if (!HERE)
        return;
    let GtkSource;
    try {
        GtkSource = imports.gi.GtkSource;
    } catch (e) {
        return;
    }
    const proto = GtkSource.StyleSchemeManager.prototype;
    const own = proto.get_scheme;
    let added = false;
    proto.get_scheme = function (id) {
        if (id === 'builder-dark') {
            if (!added) {
                this.prepend_search_path(`${HERE}/styles`);
                added = true;
            }
            let ours = own.call(this, dark() ? 'nami-dark' : 'nami-light');
            if (ours)
                return ours;
        }
        return own.call(this, id);
    };
}

// niri, asked: its window's id, and to do something to it.
function _niri(args) {
    try {
        let [ok, out] = GLib.spawn_sync(null, ['niri', 'msg', ...args], null, GLib.SpawnFlags.SEARCH_PATH, null);
        return ok ? new TextDecoder().decode(out) : '';
    } catch (e) {
        return '';
    }
}

// Each file at its own size, as the arrow keys go from one to the next (a Mac's Quick Look's):
// niri keeps a floating window at the size it's at, so it's asked for the new one, in the middle.
function _eachItsSize() {
    if (!GLib.getenv('NIRI_SOCKET'))
        return;
    const MainWindow = imports.ui.mainWindow.MainWindow;
    const own = MainWindow.prototype._resizeWindow;
    MainWindow.prototype._resizeWindow = function () {
        let before = (this._lastWindowSize || [0, 0]).slice();
        own.call(this);
        let after = this._lastWindowSize || [0, 0];
        if (before[0] <= 0 || !this.get_mapped() || (Math.abs(before[0] - after[0]) <= 4 && Math.abs(before[1] - after[1]) <= 4))
            return;
        let ours;
        try {
            ours = JSON.parse(_niri(['-j', 'windows']) || '[]').find(w => w.app_id === pkg.name);
        } catch (e) {
            return;
        }
        if (!ours)
            return;
        let id = String(ours.id);
        _niri(['action', 'set-window-width', '--id', id, String(after[0])]);
        _niri(['action', 'set-window-height', '--id', id, String(after[1])]);
        // (In the middle once it's that size: niri centres what it has.)
        GLib.timeout_add(GLib.PRIORITY_DEFAULT, 120, () => {
            _niri(['action', 'center-window', '--id', id]);
            return GLib.SOURCE_REMOVE;
        });
    };
}

let _provider = null;
function _apply() {
    let d = dark();
    Gtk.Settings.get_default().gtk_application_prefer_dark_theme = d;
    _provider.load_from_data(new TextEncoder().encode(_css(d)));
}

try {
    _codeColours();
} catch (e) {
    logError(e, 'namiOS: code colours');
}

// Once Sushi's begun (its window comes after): it says dark, this says as the desktop is.
GLib.idle_add(GLib.PRIORITY_HIGH, () => {
    try {
        _eachItsSize();
    } catch (e) {
        logError(e, 'namiOS: each file at its size');
    }
    try {
        let screen = Gdk.Screen.get_default();
        if (screen) {
            _provider = new Gtk.CssProvider();
            // (Over the person's own GTK styles: these are Quick Look's alone.)
            Gtk.StyleContext.add_provider_for_screen(screen, _provider, Gtk.STYLE_PROVIDER_PRIORITY_USER + 1);
            _apply();
            let s = _settings();
            if (s)
                s.connect('changed', (_s, key) => {
                    if (key === 'color-scheme' || key === 'gtk-theme')
                        _apply();
                });
        }
    } catch (e) {
        logError(e, 'namiOS: the look');
    }
    return GLib.SOURCE_REMOVE;
});

namiOS's login screen, on greetd: nami's own, as the rest of its desktop (nami-desktop greeter, nami-gui's), drawn by niri, the lock screen's look. Quiet, on the person's wallpaper: the time, then the person and their password (or, for several, who's there), and sleep, restart, shut down. Each person starts in the desktop they last picked; the first in the computer file's. On a computer with nobody yet (an image for anyone, nami usb --for-anyone), it sets it up first: language, keyboard and time zone (a Bluetooth mouse or keyboard on the way, with the keyboard alone), Wi-Fi when there's no cable, the look (light or dark, accent colour, frosted glass, how windows go, the keys), then who you are; nami first-person with a bar for how far it is, and a welcome as it logs you in. What the namiOS Installer was told (its seed) it offers first, and finishes after.

package.nami
# namiOS's login screen, on greetd: nami's own, as the rest of its desktop
# (`nami-desktop greeter`, nami-gui's), drawn by niri, the lock screen's look.
# Quiet, on the person's wallpaper: the time, then the person and their password (or,
# for several, who's there), and sleep, restart, shut down. Each person
# starts in the desktop they last picked; the first in the computer file's.
# On a computer with nobody yet (an image for anyone, `nami usb
# --for-anyone`), it sets it up first: language, keyboard and time zone (a
# Bluetooth mouse or keyboard on the way, with the keyboard alone), Wi-Fi
# when there's no cable, the look (light or dark, accent colour, frosted
# glass, how windows go, the keys), then who you are; `nami first-person`
# with a bar for how far it is, and a welcome as it logs you in. What the
# namiOS Installer was told (its seed) it offers first, and finishes after.
packages:
  - ../greetd
  # nami's niri (the niri folder), and the screen itself (nami-desktop).
  - niri
  - nami-gui
  # The keyboards' names, for the first start's setup.
  - xkeyboard_config
  # The pointer, as on the desktop.
  - namios-pointer
  # bluetoothctl, for a mouse or keyboard at the first start.
  - bluez
# The namiOS Installer's seed, taken as the computer starts and finished once there's a
# network (below).
services:
  - nami-seed-take.service
  - nami-seed.service
# Logging in: the password alone. (As on a Mac, the finger unlocks the screen, not the
# first login: the keyring wants the password, and a finger tried first would hold the
# password back for seconds.) The greeter's own session as greetd has it.
login:
  namios-greeter: password
files:
  /etc/greetd/config.toml:
    terminal:
      vt: 1
    general:
      service: namios-greeter
    default_session:
      user: greeter
      command: /run/current-system/sw/bin/sh /etc/namios/greeter/start.sh
      service: greetd
  # niri, with the computer's keyboard: its settings are a copy the screen
  # may change (the setup's keyboard, at once: niri reads it again).
  /etc/namios/greeter/start.sh: |
    PATH=/run/current-system/sw/bin
    c=/var/lib/namios-greeter/niri.kdl
    layout=$(sed -n 's/.*"XkbLayout" *"\([^"]*\)".*/\1/p' /etc/X11/xorg.conf.d/00-keyboard.conf 2>/dev/null)
    { printf 'input {\n    keyboard {\n        xkb {\n            layout "%s"\n        }\n    }\n}\n' "${layout:-us}"; cat /etc/namios/greeter/niri.kdl; } > "$c"
    # Its messages in the journal, not on the screen behind it.
    exec systemd-cat -t namios-greeter niri -c "$c"
  # Before the login screen (as root): a GPU first, since niri won't draw on
  # the firmware's screen alone (simpledrm, with no render node), and a GPU
  # that loads firmware (AMD's) can come seconds after it. Its drivers are
  # loaded as their devices are found: once that's done and a render node
  # is there, or after 20 seconds. Then the boot screen goes, its last
  # picture kept until niri draws over it (as GDM does), so no text shows.
  /etc/systemd/system/greetd.service.d/namios.conf: |
    [Unit]
    Conflicts=plymouth-quit.service
    [Service]
    # Not idle (greetd's own): the start waits for the splash to go, and
    # the splash goes here, so idle would sit out systemd's 6 second limit.
    Type=simple
    ExecStartPre=-/run/current-system/sw/bin/sh /etc/namios/greeter/before.sh
  /etc/namios/greeter/before.sh: |
    PATH=/run/current-system/sw/bin
    udevadm settle -t 10 2>/dev/null
    i=0
    while ! ls /dev/dri/renderD* >/dev/null 2>&1 && [ $i -lt 50 ]; do sleep 0.2; i=$((i + 1)); done
    plymouth quit --retain-splash 2>/dev/null
    exit 0
  /etc/namios/greeter/keyboard.sh: |
    # The screen's keyboard, now: $1 (an xkb layout).
    case $1 in *[!a-z0-9_]*|"") exit 1 ;; esac
    /run/current-system/sw/bin/sed -i "s/^\( *layout \)\".*\"/\1\"$1\"/" /var/lib/namios-greeter/niri.kdl
  # What the setup offers, a line each: languages, keyboards, time zones
  # (with the country each is in, for the language's).
  /etc/namios/greeter/choices.sh: |
    PATH=/run/current-system/sw/bin
    localectl list-locales 2>/dev/null | sed 's/^/language\t/'
    for f in /run/current-system/sw/share/X11/xkb/rules/base.lst /run/current-system/sw/share/xkeyboard-config-2/rules/base.lst; do
      [ -r "$f" ] || continue
      sed -n '/^! layout/,/^$/{/^ /p}' "$f" | sed 's/^ *\([^ ]*\) *\(.*\)/keyboard\t\1\t\2/'
      break
    done
    for z in /etc/zoneinfo /run/current-system/sw/share/zoneinfo /usr/share/zoneinfo; do
      [ -r "$z/zone1970.tab" ] || continue
      grep -v '^#' "$z/zone1970.tab" | awk -F'\t' '{ n = split($1, cc, ","); for (i = 1; i <= n; i++) printf "zone\t%s\t%s\n", $3, cc[i] }'
      break
    done
    printf 'now\t%s\n' "$(readlink /etc/localtime | sed 's|.*zoneinfo/||')"
  # niri runs the screen and quits after it (greetd then starts the desktop).
  /etc/namios/greeter/niri.kdl: |
    hotkey-overlay {
        skip-at-startup
    }
    layout {
        background-color "#2a3650"
    }
    cursor {
        xcursor-theme "WhiteSur-cursors"
        xcursor-size 32
        hide-after-inactive-ms 5000
    }
    spawn-sh-at-startup "/run/current-system/sw/bin/nami-desktop greeter; /run/current-system/sw/bin/niri msg action quit --skip-confirmation"
  # Bluetooth's devices, for the first start's setup, a line each:
  # device, its address, kind (bluez's icon), paired, connected, name;
  # `none` when the computer has no Bluetooth.
  /etc/namios/greeter/bluetooth.sh: |
    PATH=/run/current-system/sw/bin
    [ -n "$(ls /sys/class/bluetooth 2>/dev/null)" ] || { echo none; exit 0; }
    bluetoothctl devices 2>/dev/null | while read -r _ mac _; do
      case $mac in [0-9A-F][0-9A-F]:*) ;; *) continue ;; esac
      info=$(bluetoothctl info "$mac" 2>/dev/null)
      get() { printf '%s\n' "$info" | sed -n "s/^[[:space:]]*$1: //p" | head -1; }
      printf 'device\t%s\t%s\t%s\t%s\t%s\n' "$mac" "$(get Icon)" "$(get Paired)" "$(get Connected)" "$(get Name)"
    done
  /etc/namios/greeter/about.sh: |
    # What namiOS's login screen shows, a line each: the computer's name, who
    # may log in (people, as AccountsService lists them: their picture, last
    # desktop, wallpaper and look as copied when they last logged out, their
    # password hint), the desktops, the first one and who logged in last.
    PATH=/run/current-system/sw/bin
    m=/var/lib/namios-greeter
    printf 'host\t%s\n' "$(cat /etc/hostname 2>/dev/null)"
    while IFS=: read -r user _ uid _ gecos _ shell; do
      [ "$uid" -ge 1000 ] && [ "$uid" -lt 60000 ] || continue
      case $shell in */nologin|*/false) continue ;; esac
      grep -qs '^SystemAccount=true' "/var/lib/AccountsService/users/$user" && continue
      icon=/var/lib/AccountsService/icons/$user
      [ -r "$icon" ] || icon=
      name=${gecos%%,*}
      wall=/var/lib/namios-greeter-walls/$user.png
      [ -r "$wall" ] || wall=
      look=$(sed -n 1p "/var/lib/namios-greeter-walls/$user.look" 2>/dev/null)
      [ -n "$look" ] || look=$(cat "/var/lib/namios-greeter-look/$user" 2>/dev/null)
      still=$(sed -n 2p "/var/lib/namios-greeter-walls/$user.look" 2>/dev/null)
      timeout 2 busctl call org.freedesktop.Accounts /org/freedesktop/Accounts org.freedesktop.Accounts FindUserByName s "$user" >/dev/null 2>&1 &&
        hint=$(timeout 2 busctl get-property org.freedesktop.Accounts "/org/freedesktop/Accounts/User$uid" org.freedesktop.Accounts.User PasswordHint 2>/dev/null | sed -n 's/^s "\(.*\)"$/\1/p' | tr -d '\t') || hint=
      printf 'person\t%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n' "$user" "${name:-$user}" "$icon" "$(cat "$m/$user.session" 2>/dev/null)" "$wall" "${look:-dark}" "$still" "$hint"
    done < /etc/passwd
    for f in /run/current-system/sessions/wayland-sessions/*.desktop; do
      [ -e "$f" ] || continue
      printf 'desktop\t%s\t%s\t%s\n' "$(basename "$f" .desktop)" "$(sed -n 's/^Name=//p' "$f" | head -1)" "$(sed -n 's/^Exec=//p' "$f" | head -1)"
    done
    printf 'default\t%s\n' "$(cat /run/current-system/default-session 2>/dev/null)"
    printf 'last\t%s\n' "$(cat $m/last 2>/dev/null)"
  # What the login screen shows of someone: their wallpaper (small, as nami-desktop
  # leaves it in their state folder) and light or dark, copied where only it can read
  # them. Root's, each time the login screen comes (it starts the service below); but
  # each read as them (setpriv), so it's only ever what they may read themselves; only
  # a PNG, and not too big.
  /etc/namios/greeter/walls.sh: |
    PATH=/run/current-system/sw/bin
    mkdir -p /var/lib/namios-greeter-walls && chgrp greeter /var/lib/namios-greeter-walls && chmod 0750 /var/lib/namios-greeter-walls
    awk -F: '$3 >= 1000 && $3 < 60000 { print $3 }' /etc/passwd | while read -r uid; do sh /etc/namios/greeter/wall.sh "$uid"; done
    exit 0
  /etc/namios/greeter/wall.sh: |
    PATH=/run/current-system/sw/bin
    uid=$1
    case $uid in ""|*[!0-9]*) exit 0 ;; esac
    [ "$uid" -ge 1000 ] && [ "$uid" -lt 60000 ] || exit 0
    entry=$(getent passwd "$uid") || exit 0
    user=${entry%%:*}
    home=$(printf %s "$entry" | cut -d: -f6)
    gid=$(printf %s "$entry" | cut -d: -f4)
    d=/var/lib/namios-greeter-walls
    s=$home/.local/state/nami
    as() { timeout 10 setpriv --reuid="$uid" --regid="$gid" --init-groups --inh-caps=-all -- "$@"; }
    put() {
      t=$(mktemp "$d/.new.XXXXXX") || return
      if as head -c "$2" -- "$s/$1" > "$t" 2>/dev/null && [ -s "$t" ] && $3 "$t"; then
        chgrp greeter "$t" && chmod 0640 "$t" && mv -f "$t" "$d/$4" && return
      fi
      rm -f "$t"
      as test -e "$s/$1" 2>/dev/null || rm -f "$d/$4"
    }
    png() { [ "$(head -c 8 "$1" | od -An -tx1 | tr -d ' \n')" = 89504e470d0a1a0a ]; }
    look() { sed -n '1{/^\(light\|dark\)$/!q1};2{/^\(still\)\?$/!q1}' "$1" && [ "$(wc -l < "$1")" -le 2 ]; }
    put login-wallpaper.png 16000000 png "$user.png"
    put login-look 32 look "$user.look"
    exit 0
  /etc/systemd/system/namios-greeter-walls.service: |
    [Unit]
    Description=The people's wallpapers, for namiOS's login screen
    [Service]
    Type=oneshot
    TimeoutStartSec=60
    ExecStart=/run/current-system/sw/bin/sh /etc/namios/greeter/walls.sh
  # The login screen may start that, and nothing else.
  /etc/polkit-1/rules.d/20-namios-greeter-walls.rules: |
    polkit.addRule(function(action, subject) {
      if (action.id == "org.freedesktop.systemd1.manage-units" && action.lookup("unit") == "namios-greeter-walls.service" && action.lookup("verb") == "start" && subject.user == "greeter") {
        return polkit.Result.YES;
      }
    });
  # The first start's Wi-Fi, a network for the whole computer (as a Mac's login window joins
  # one): the login screen may look for networks and join one, and nothing else of
  # NetworkManager's past what anyone at the screen may.
  /etc/polkit-1/rules.d/20-namios-greeter-wifi.rules: |
    polkit.addRule(function(action, subject) {
      var wifi = ["org.freedesktop.NetworkManager.network-control", "org.freedesktop.NetworkManager.wifi.scan", "org.freedesktop.NetworkManager.enable-disable-wifi", "org.freedesktop.NetworkManager.settings.modify.system"];
      if (subject.user == "greeter" && subject.local && subject.active && wifi.indexOf(action.id) >= 0) {
        return polkit.Result.YES;
      }
    });
  # A seed (src/os/seed.rs): what the namiOS Installer was told for this computer, left on
  # the boot partition as nami-seed/ (a computer.nami, the first person's user.nami, or a
  # config repo's address). Taken off it as the computer starts, before the login screen, which
  # then offers what it says first (the look, the language and the like). After the setup's
  # first apply (offline, as ever), the rest once there's a network: the seed's computer with
  # the person's answers on it (nami-seed.service), the desktop saying how far it is. An admin
  # may start it again, from there, if it didn't work.
  # The boot partition only if it's there: waiting on its mount (RequiresMountsFor) held the
  # login screen up 90 seconds where there's none, or none by the name /etc/fstab gives it.
  /etc/systemd/system/nami-seed-take.service: |
    [Unit]
    Description=The namiOS Installer's seed, taken off the boot partition for the first start
    After=local-fs.target
    Before=greetd.service display-manager.service nami-seed.service
    [Service]
    Type=oneshot
    Environment=PATH=/run/current-system/sw/bin
    ExecStart=/run/current-system/sw/bin/sh -c 'b=$$(findmnt --fstab -no SOURCE /boot) && findfs "$$b" >/dev/null 2>&1 && systemctl start boot.mount; exec /nix/var/nami/bin/nami seed-take'
    [Install]
    WantedBy=multi-user.target
  /etc/systemd/system/nami-seed.service: |
    [Unit]
    Description=Finishing setting up the computer, as its Installer was told
    After=network-online.target nami-daemon.service nami-seed-take.service
    Wants=network-online.target
    ConditionPathExists=/var/lib/nami/seed/answers.json
    [Service]
    # (Not oneshot: it waits for a network as long as that takes, and the start waits for nothing.)
    Type=simple
    ExecStart=/nix/var/nami/bin/nami seed-finish
    [Install]
    WantedBy=multi-user.target
  /etc/polkit-1/rules.d/20-nami-seed.rules: |
    polkit.addRule(function(action, subject) {
      if (action.id == "org.freedesktop.systemd1.manage-units" && action.lookup("unit") == "nami-seed.service" && (action.lookup("verb") == "start" || action.lookup("verb") == "restart") && subject.isInGroup("wheel") && subject.local && subject.active) {
        return polkit.Result.YES;
      }
    });
  # Its user, who may use the screen, and what it remembers.
  /etc/sysusers.d/namios-greeter.conf: |
    u greeter - "namiOS's login screen" /var/lib/namios-greeter
    m greeter video
  /etc/tmpfiles.d/namios-greeter.conf: |
    d /var/lib/namios-greeter 0750 greeter greeter -
    d /var/lib/namios-greeter-look 0755 greeter greeter -
    d /var/lib/namios-greeter-walls 0750 root greeter -
checks.nami
# How to tell namiOS's login screen works, on a computer nami made.
"namiOS's login screen: greetd runs it, in niri":
  run: systemctl show -p Id --value display-manager; for i in $(seq 30); do pgrep -u greeter -f 'nami-desktop greeter' >/dev/null && break; sleep 2; done; pgrep -u greeter -a -f 'niri|nami-desktop greeter' | head -3
  expect: "nami-desktop greeter"
"namiOS's login screen: it stays up (not started over and over)":
  run: sleep 3; for p in $(pgrep -u greeter -x nami-greeter); do ps -o etimes= -p $p; done | awk '$1 >= 3 { n++ } END { print "UP=" n+0 }'
  expect: "^UP=1$"
"namiOS's login screen: who it lists, and the desktops":
  run: sh /etc/namios/greeter/about.sh | cut -f1 | sort -u | tr '\n' ' '
  expect: "desktop.*person"
"namiOS's login screen: the password alone (a finger unlocks the screen, not the first login)":
  run: echo "finger=$(grep -c pam_fprintd /etc/pam.d/namios-greeter) service=$(grep -c '"namios-greeter"' /etc/greetd/config.toml)"
  expect: "^finger=0 service=1$"
"namiOS's login screen: each person's wallpaper, copied where only it can read it":
  run: echo "$(stat -c '%a %U %G' /var/lib/namios-greeter-walls) $(ls /var/lib/namios-greeter-walls >/dev/null 2>&1 || echo private)"
  expect: "^750 root greeter private$"
"namiOS's login screen: no Quickshell, no QML":
  run: echo "qs=$(command -v quickshell || echo none) qml=$(ls /etc/namios/greeter/*.qml 2>/dev/null | wc -l)"
  expect: "^qs=none qml=0$"

namios-icons

17 files

namiOS's icons: GNOME's (Adwaita), with the folders in nami's slate instead of GNOME's blue. A theme of its own, "nami", that has only the folders and places (places/: Adwaita's, recoloured: #438de6 -> #45577a, #62a0ea -> #5d6f92, #a4caee -> #a9bad6, #afd4ff -> #c3cfe3, #c0d5ea -> #c9d2e0) and takes everything else from Adwaita, apps their own icons. Adwaita's icons are by the GNOME Project, CC BY-SA 3.0 or LGPLv3; these keep that licence. namios-look lists it. And the marks on a window's three buttons (namios-windows shows them as the pointer comes over the buttons): ×, − and +, the same as niri's title bars and namiOS's own apps draw.

package.nami
# namiOS's icons: GNOME's (Adwaita), with the folders in nami's slate
# instead of GNOME's blue. A theme of its own, "nami", that has only the
# folders and places (places/: Adwaita's, recoloured: #438de6 -> #45577a,
# #62a0ea -> #5d6f92, #a4caee -> #a9bad6, #afd4ff -> #c3cfe3,
# #c0d5ea -> #c9d2e0) and takes everything else from Adwaita, apps their
# own icons. Adwaita's icons are by the GNOME Project, CC BY-SA 3.0 or
# LGPLv3; these keep that licence. namios-look lists it.
# And the marks on a window's three buttons (namios-windows shows them as the
# pointer comes over the buttons): ×, − and +, the same as niri's title bars
# and namiOS's own apps draw.
name: namios-icons
version: "1.0"
source:
  path: ./places
runtime-deps: [adwaita-icon-theme, hicolor-icon-theme]
install: |
  d=$out/share/icons/nami
  mkdir -p $d/scalable/places
  cp *.svg $d/scalable/places/
  mkdir -p $d/symbolic/actions
  a=$d/symbolic/actions
  # (14 across, as the buttons are: drawn at that size, 1 to a pixel. − and + are bars 8 long
  # and 2 thick on whole pixels, 3 clear of each side, so they're crisp and in the middle; × is
  # two such, 2 thick, their ends 6 apart each way.)
  cat > $a/window-close-symbolic.svg <<'SVG'
  <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 14 14"><g fill="#2e3436"><rect x="2.757" y="6" width="8.485" height="2" transform="rotate(45 7 7)"/><rect x="2.757" y="6" width="8.485" height="2" transform="rotate(-45 7 7)"/></g></svg>
  SVG
  cat > $a/window-minimize-symbolic.svg <<'SVG'
  <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 14 14"><rect x="3" y="6" width="8" height="2" fill="#2e3436"/></svg>
  SVG
  cat > $a/window-maximize-symbolic.svg <<'SVG'
  <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 14 14"><path d="M3 6h3V3h2v3h3v2H8v3H6V8H3z" fill="#2e3436"/></svg>
  SVG
  cp $a/window-maximize-symbolic.svg $a/window-restore-symbolic.svg
  cat > $d/index.theme <<THEME
  [Icon Theme]
  Name=nami
  Comment=GNOME's icons, with folders in nami's slate
  Inherits=Adwaita,hicolor
  Directories=scalable/places,symbolic/actions

  [scalable/places]
  Context=Places
  Size=64
  MinSize=8
  MaxSize=512
  Type=Scalable

  [symbolic/actions]
  Context=Actions
  Size=16
  MinSize=8
  MaxSize=512
  Type=Scalable
  THEME
places/folder-documents.svg
<?xml version="1.0" encoding="UTF-8"?>
<svg height="128px" viewBox="0 0 128 128" width="128px" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
    <linearGradient id="a" gradientTransform="matrix(0.45451 0 0 0.455522 -1210.292114 616.172607)" gradientUnits="userSpaceOnUse" x1="2689.251953" x2="2918.069824" y1="-1106.802979" y2="-1106.802979">
        <stop offset="0" stop-color="#5d6f92"/>
        <stop offset="0.0576991" stop-color="#c3cfe3"/>
        <stop offset="0.122204" stop-color="#5d6f92"/>
        <stop offset="0.873306" stop-color="#5d6f92"/>
        <stop offset="0.955997" stop-color="#c9d2e0"/>
        <stop offset="1" stop-color="#5d6f92"/>
    </linearGradient>
    <path d="m 21.976562 12 c -5.527343 0 -9.976562 4.460938 -9.976562 10 v 86.03125 c 0 5.542969 4.449219 10 9.976562 10 h 84.042969 c 5.53125 0 9.980469 -4.457031 9.980469 -10 v -72.085938 c 0 -6.628906 -5.359375 -12 -11.972656 -12 h -46.027344 c -2.453125 0 -4.695312 -1.386718 -5.796875 -3.582031 l -1.503906 -2.992187 c -1.65625 -3.292969 -5.019531 -5.371094 -8.699219 -5.371094 z m 0 0" fill="#45577a"/>
    <path d="m 65.976562 36 c -2.746093 0 -5.226562 1.101562 -7.027343 2.890625 c -2.273438 2.253906 -5.382813 5.109375 -8.632813 5.109375 h -28.339844 c -5.527343 0 -9.976562 4.460938 -9.976562 10 v 54.03125 c 0 5.542969 4.449219 10 9.976562 10 h 84.042969 c 5.53125 0 9.980469 -4.457031 9.980469 -10 v -62.03125 c 0 -5.539062 -4.449219 -10 -9.980469 -10 z m 0 0" fill="url(#a)"/>
    <path d="m 65.976562 32 c -2.746093 0 -5.226562 1.101562 -7.027343 2.890625 c -2.273438 2.253906 -5.382813 5.109375 -8.632813 5.109375 h -28.339844 c -5.527343 0 -9.976562 4.460938 -9.976562 10 v 55.976562 c 0 5.539063 4.449219 10 9.976562 10 h 84.042969 c 5.53125 0 9.980469 -4.460937 9.980469 -10 v -63.976562 c 0 -5.539062 -4.449219 -10 -9.980469 -10 z m 0 0" fill="#a9bad6"/>
    <path d="m 58 60 c -3.289062 0 -6 2.710938 -6 6 v 20 c 0 3.289062 2.710938 6 6 6 h 12 c 3.289062 0 6 -2.710938 6 -6 v -17 c 0 -0.53125 -0.210938 -1.039062 -0.585938 -1.414062 l -7 -7 c -0.375 -0.375 -0.882812 -0.585938 -1.414062 -0.585938 z m 0 4 h 8 v 3 c 0 2 1 3 3 3 h 3 v 16 c 0 1.140625 -0.859375 2 -2 2 h -12 c -1.140625 0 -2 -0.859375 -2 -2 v -20 c 0 -1.140625 0.859375 -2 2 -2 z m 0 0" fill="#45577a"/>
</svg>
places/folder-download.svg
<?xml version="1.0" encoding="UTF-8"?>
<svg height="128px" viewBox="0 0 128 128" width="128px" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
    <linearGradient id="a" gradientTransform="matrix(0.45451 0 0 0.455522 -1210.292114 616.172607)" gradientUnits="userSpaceOnUse" x1="2689.251953" x2="2918.069824" y1="-1106.802979" y2="-1106.802979">
        <stop offset="0" stop-color="#5d6f92"/>
        <stop offset="0.0576991" stop-color="#c3cfe3"/>
        <stop offset="0.122204" stop-color="#5d6f92"/>
        <stop offset="0.873306" stop-color="#5d6f92"/>
        <stop offset="0.955997" stop-color="#c9d2e0"/>
        <stop offset="1" stop-color="#5d6f92"/>
    </linearGradient>
    <path d="m 21.976562 12 c -5.527343 0 -9.976562 4.460938 -9.976562 10 v 86.03125 c 0 5.542969 4.449219 10 9.976562 10 h 84.042969 c 5.53125 0 9.980469 -4.457031 9.980469 -10 v -72.085938 c 0 -6.628906 -5.359375 -12 -11.972656 -12 h -46.027344 c -2.453125 0 -4.695312 -1.386718 -5.796875 -3.582031 l -1.503906 -2.992187 c -1.65625 -3.292969 -5.019531 -5.371094 -8.699219 -5.371094 z m 0 0" fill="#45577a"/>
    <path d="m 65.976562 36 c -2.746093 0 -5.226562 1.101562 -7.027343 2.890625 c -2.273438 2.253906 -5.382813 5.109375 -8.632813 5.109375 h -28.339844 c -5.527343 0 -9.976562 4.460938 -9.976562 10 v 54.03125 c 0 5.542969 4.449219 10 9.976562 10 h 84.042969 c 5.53125 0 9.980469 -4.457031 9.980469 -10 v -62.03125 c 0 -5.539062 -4.449219 -10 -9.980469 -10 z m 0 0" fill="url(#a)"/>
    <path d="m 65.976562 32 c -2.746093 0 -5.226562 1.101562 -7.027343 2.890625 c -2.273438 2.253906 -5.382813 5.109375 -8.632813 5.109375 h -28.339844 c -5.527343 0 -9.976562 4.460938 -9.976562 10 v 55.976562 c 0 5.539063 4.449219 10 9.976562 10 h 84.042969 c 5.53125 0 9.980469 -4.460937 9.980469 -10 v -63.976562 c 0 -5.539062 -4.449219 -10 -9.980469 -10 z m 0 0" fill="#a9bad6"/>
    <path d="m 64 60 c -1.101562 0 -2 0.898438 -2 2 v 17.171875 l -4.585938 -4.585937 c -0.375 -0.375 -0.882812 -0.585938 -1.414062 -0.585938 s -1.039062 0.210938 -1.414062 0.585938 c -0.78125 0.78125 -0.78125 2.046874 0 2.828124 l 8 8 c 0.78125 0.78125 2.046874 0.78125 2.828124 0 l 8 -8 c 0.78125 -0.78125 0.78125 -2.046874 0 -2.828124 s -2.046874 -0.78125 -2.828124 0 l -4.585938 4.585937 v -17.171875 c 0 -1.101562 -0.898438 -2 -2 -2 z m -12 28 v 4 h 24 v -4 z m 0 0" fill="#45577a"/>
</svg>
places/folder-drag-accept.svg
<?xml version="1.0" encoding="UTF-8"?>
<svg height="128px" viewBox="0 0 128 128" width="128px" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
    <linearGradient id="a" gradientTransform="matrix(0.45451 0 0 0.455522 -1210.292114 616.172607)" gradientUnits="userSpaceOnUse" x1="2689.251953" x2="2918.069824" y1="-1106.802979" y2="-1106.802979">
        <stop offset="0" stop-color="#5d6f92"/>
        <stop offset="0.0576991" stop-color="#c3cfe3"/>
        <stop offset="0.122204" stop-color="#5d6f92"/>
        <stop offset="0.873306" stop-color="#5d6f92"/>
        <stop offset="0.955997" stop-color="#c9d2e0"/>
        <stop offset="1" stop-color="#5d6f92"/>
    </linearGradient>
    <path d="m 21.976562 12 c -5.527343 0 -9.976562 4.460938 -9.976562 10 v 86.03125 c 0 5.542969 4.449219 10 9.976562 10 h 84.042969 c 5.53125 0 9.980469 -4.457031 9.980469 -10 v -72.085938 c 0 -6.628906 -5.359375 -12 -11.972656 -12 h -46.027344 c -2.453125 0 -4.695312 -1.386718 -5.796875 -3.582031 l -1.503906 -2.992187 c -1.65625 -3.292969 -5.019531 -5.371094 -8.699219 -5.371094 z m 0 0" fill="#45577a"/>
    <path d="m 65.976562 36 c -2.746093 0 -5.226562 1.101562 -7.027343 2.890625 c -2.273438 2.253906 -5.382813 5.109375 -8.632813 5.109375 h -28.339844 c -5.527343 0 -9.976562 4.460938 -9.976562 10 v 54.03125 c 0 5.542969 4.449219 10 9.976562 10 h 84.042969 c 5.53125 0 9.980469 -4.457031 9.980469 -10 v -62.03125 c 0 -5.539062 -4.449219 -10 -9.980469 -10 z m 0 0" fill="url(#a)"/>
    <path d="m 65.976562 32 c -2.746093 0 -5.226562 1.101562 -7.027343 2.890625 c -2.273438 2.253906 -5.382813 5.109375 -8.632813 5.109375 h -28.339844 c -5.527343 0 -9.976562 4.460938 -9.976562 10 v 55.976562 c 0 5.539063 4.449219 10 9.976562 10 h 84.042969 c 5.53125 0 9.980469 -4.460937 9.980469 -10 v -63.976562 c 0 -5.539062 -4.449219 -10 -9.980469 -10 z m 0 0" fill="#a9bad6"/>
</svg>
places/folder-music.svg
<?xml version="1.0" encoding="UTF-8"?>
<svg height="128px" viewBox="0 0 128 128" width="128px" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
    <linearGradient id="a" gradientTransform="matrix(0.45451 0 0 0.455522 -1210.292114 616.172607)" gradientUnits="userSpaceOnUse" x1="2689.251953" x2="2918.069824" y1="-1106.802979" y2="-1106.802979">
        <stop offset="0" stop-color="#5d6f92"/>
        <stop offset="0.0576991" stop-color="#c3cfe3"/>
        <stop offset="0.122204" stop-color="#5d6f92"/>
        <stop offset="0.873306" stop-color="#5d6f92"/>
        <stop offset="0.955997" stop-color="#c9d2e0"/>
        <stop offset="1" stop-color="#5d6f92"/>
    </linearGradient>
    <path d="m 21.976562 12 c -5.527343 0 -9.976562 4.460938 -9.976562 10 v 86.03125 c 0 5.542969 4.449219 10 9.976562 10 h 84.042969 c 5.53125 0 9.980469 -4.457031 9.980469 -10 v -72.085938 c 0 -6.628906 -5.359375 -12 -11.972656 -12 h -46.027344 c -2.453125 0 -4.695312 -1.386718 -5.796875 -3.582031 l -1.503906 -2.992187 c -1.65625 -3.292969 -5.019531 -5.371094 -8.699219 -5.371094 z m 0 0" fill="#45577a"/>
    <path d="m 65.976562 36 c -2.746093 0 -5.226562 1.101562 -7.027343 2.890625 c -2.273438 2.253906 -5.382813 5.109375 -8.632813 5.109375 h -28.339844 c -5.527343 0 -9.976562 4.460938 -9.976562 10 v 54.03125 c 0 5.542969 4.449219 10 9.976562 10 h 84.042969 c 5.53125 0 9.980469 -4.457031 9.980469 -10 v -62.03125 c 0 -5.539062 -4.449219 -10 -9.980469 -10 z m 0 0" fill="url(#a)"/>
    <path d="m 65.976562 32 c -2.746093 0 -5.226562 1.101562 -7.027343 2.890625 c -2.273438 2.253906 -5.382813 5.109375 -8.632813 5.109375 h -28.339844 c -5.527343 0 -9.976562 4.460938 -9.976562 10 v 55.976562 c 0 5.539063 4.449219 10 9.976562 10 h 84.042969 c 5.53125 0 9.980469 -4.460937 9.980469 -10 v -63.976562 c 0 -5.539062 -4.449219 -10 -9.980469 -10 z m 0 0" fill="#a9bad6"/>
    <path d="m 66 64 c -3.289062 0 -6 2.710938 -6 6 v 8.679688 c -0.914062 -0.429688 -1.929688 -0.679688 -3 -0.679688 c -3.84375 0 -7 3.15625 -7 7 s 3.15625 7 7 7 c 3.828125 0 6.984375 -3.140625 7 -6.96875 c 0 -0.007812 0 -0.023438 0 -0.03125 v -15 c 0 -1.125 0.875 -2 2 -2 h 8 c 1.125 0 2 0.875 2 2 v 8.679688 c -0.914062 -0.429688 -1.929688 -0.679688 -3 -0.679688 c -3.84375 0 -7 3.15625 -7 7 s 3.15625 7 7 7 s 7 -3.15625 7 -7 v -15 c 0 -3.289062 -2.710938 -6 -6 -6 z m -9 18 c 1.679688 0 3 1.320312 3 3 v 0.03125 c -0.015625 1.664062 -1.328125 2.96875 -3 2.96875 c -1.679688 0 -3 -1.320312 -3 -3 s 1.320312 -3 3 -3 z m 16 0 c 1.679688 0 3 1.320312 3 3 s -1.320312 3 -3 3 s -3 -1.320312 -3 -3 s 1.320312 -3 3 -3 z m 0 0" fill="#45577a"/>
</svg>
places/folder-pictures.svg
<?xml version="1.0" encoding="UTF-8"?>
<svg height="128px" viewBox="0 0 128 128" width="128px" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
    <linearGradient id="a" gradientTransform="matrix(0.45451 0 0 0.455522 -1210.292114 616.172607)" gradientUnits="userSpaceOnUse" x1="2689.251953" x2="2918.069824" y1="-1106.802979" y2="-1106.802979">
        <stop offset="0" stop-color="#5d6f92"/>
        <stop offset="0.0576991" stop-color="#c3cfe3"/>
        <stop offset="0.122204" stop-color="#5d6f92"/>
        <stop offset="0.873306" stop-color="#5d6f92"/>
        <stop offset="0.955997" stop-color="#c9d2e0"/>
        <stop offset="1" stop-color="#5d6f92"/>
    </linearGradient>
    <path d="m 21.976562 12 c -5.527343 0 -9.976562 4.460938 -9.976562 10 v 86.03125 c 0 5.542969 4.449219 10 9.976562 10 h 84.042969 c 5.53125 0 9.980469 -4.457031 9.980469 -10 v -72.085938 c 0 -6.628906 -5.359375 -12 -11.972656 -12 h -46.027344 c -2.453125 0 -4.695312 -1.386718 -5.796875 -3.582031 l -1.503906 -2.992187 c -1.65625 -3.292969 -5.019531 -5.371094 -8.699219 -5.371094 z m 0 0" fill="#45577a"/>
    <path d="m 65.976562 36 c -2.746093 0 -5.226562 1.101562 -7.027343 2.890625 c -2.273438 2.253906 -5.382813 5.109375 -8.632813 5.109375 h -28.339844 c -5.527343 0 -9.976562 4.460938 -9.976562 10 v 54.03125 c 0 5.542969 4.449219 10 9.976562 10 h 84.042969 c 5.53125 0 9.980469 -4.457031 9.980469 -10 v -62.03125 c 0 -5.539062 -4.449219 -10 -9.980469 -10 z m 0 0" fill="url(#a)"/>
    <path d="m 65.976562 32 c -2.746093 0 -5.226562 1.101562 -7.027343 2.890625 c -2.273438 2.253906 -5.382813 5.109375 -8.632813 5.109375 h -28.339844 c -5.527343 0 -9.976562 4.460938 -9.976562 10 v 55.976562 c 0 5.539063 4.449219 10 9.976562 10 h 84.042969 c 5.53125 0 9.980469 -4.460937 9.980469 -10 v -63.976562 c 0 -5.539062 -4.449219 -10 -9.980469 -10 z m 0 0" fill="#a9bad6"/>
    <g fill="#45577a">
        <path d="m 60 72 c -1.101562 0 -2 0.898438 -2 2 s 0.898438 2 2 2 s 2 -0.898438 2 -2 s -0.898438 -2 -2 -2 z m 7 6 l -4 4 l -3 -2 l -4 4 v 1 c 0 1 1 1 1 1 h 14 s 0.945312 -0.070312 1 -1 v -2 z m 0 0"/>
        <path d="m 56 64 c -3.289062 0 -6 2.710938 -6 6 v 16 c 0 3.289062 2.710938 6 6 6 h 16 c 3.289062 0 6 -2.710938 6 -6 v -16 c 0 -3.289062 -2.710938 -6 -6 -6 z m 0 4 h 16 c 1.140625 0 2 0.859375 2 2 v 16 c 0 1.140625 -0.859375 2 -2 2 h -16 c -1.140625 0 -2 -0.859375 -2 -2 v -16 c 0 -1.140625 0.859375 -2 2 -2 z m 0 0"/>
    </g>
</svg>
places/folder-publicshare.svg
<?xml version="1.0" encoding="UTF-8"?>
<svg height="128px" viewBox="0 0 128 128" width="128px" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
    <linearGradient id="a" gradientTransform="matrix(0.45451 0 0 0.455522 -1210.292114 616.172607)" gradientUnits="userSpaceOnUse" x1="2689.251953" x2="2918.069824" y1="-1106.802979" y2="-1106.802979">
        <stop offset="0" stop-color="#5d6f92"/>
        <stop offset="0.0576991" stop-color="#c3cfe3"/>
        <stop offset="0.122204" stop-color="#5d6f92"/>
        <stop offset="0.873306" stop-color="#5d6f92"/>
        <stop offset="0.955997" stop-color="#c9d2e0"/>
        <stop offset="1" stop-color="#5d6f92"/>
    </linearGradient>
    <path d="m 21.976562 12 c -5.527343 0 -9.976562 4.460938 -9.976562 10 v 86.03125 c 0 5.542969 4.449219 10 9.976562 10 h 84.042969 c 5.53125 0 9.980469 -4.457031 9.980469 -10 v -72.085938 c 0 -6.628906 -5.359375 -12 -11.972656 -12 h -46.027344 c -2.453125 0 -4.695312 -1.386718 -5.796875 -3.582031 l -1.503906 -2.992187 c -1.65625 -3.292969 -5.019531 -5.371094 -8.699219 -5.371094 z m 0 0" fill="#45577a"/>
    <path d="m 65.976562 36 c -2.746093 0 -5.226562 1.101562 -7.027343 2.890625 c -2.273438 2.253906 -5.382813 5.109375 -8.632813 5.109375 h -28.339844 c -5.527343 0 -9.976562 4.460938 -9.976562 10 v 54.03125 c 0 5.542969 4.449219 10 9.976562 10 h 84.042969 c 5.53125 0 9.980469 -4.457031 9.980469 -10 v -62.03125 c 0 -5.539062 -4.449219 -10 -9.980469 -10 z m 0 0" fill="url(#a)"/>
    <path d="m 65.976562 32 c -2.746093 0 -5.226562 1.101562 -7.027343 2.890625 c -2.273438 2.253906 -5.382813 5.109375 -8.632813 5.109375 h -28.339844 c -5.527343 0 -9.976562 4.460938 -9.976562 10 v 55.976562 c 0 5.539063 4.449219 10 9.976562 10 h 84.042969 c 5.53125 0 9.980469 -4.460937 9.980469 -10 v -63.976562 c 0 -5.539062 -4.449219 -10 -9.980469 -10 z m 0 0" fill="#a9bad6"/>
    <path d="m 74 60 c -3.3125 0 -6 2.679688 -6 6 c 0 0.242188 0.023438 0.492188 0.054688 0.734375 l -9.890626 4.945313 c -1.117187 -1.078126 -2.609374 -1.679688 -4.164062 -1.679688 c -3.3125 0 -6 2.679688 -6 6 c 0 3.3125 2.6875 6 6 6 c 1.546875 -0.007812 3.039062 -0.617188 4.148438 -1.6875 l 9.90625 4.945312 c -0.03125 0.242188 -0.054688 0.492188 -0.054688 0.742188 c 0 3.3125 2.6875 6 6 6 s 6 -2.6875 6 -6 c 0 -3.320312 -2.6875 -6 -6 -6 c -1.546875 0 -3.039062 0.609375 -4.148438 1.6875 l -9.90625 -4.953125 c 0.03125 -0.242187 0.054688 -0.492187 0.054688 -0.734375 c 0 -0.25 -0.015625 -0.5 -0.046875 -0.742188 l 9.890625 -4.945312 c 1.117188 1.070312 2.609375 1.679688 4.15625 1.6875 c 3.3125 0 6 -2.6875 6 -6 c 0 -3.320312 -2.6875 -6 -6 -6 z m 0 0" fill="#45577a"/>
</svg>
places/folder-remote.svg
<?xml version="1.0" encoding="UTF-8"?>
<svg height="128px" viewBox="0 0 128 128" width="128px" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
    <linearGradient id="a" gradientTransform="matrix(0 -0.932866 -1 0 0.000045 -158.918314)" gradientUnits="userSpaceOnUse" x1="-280.623596" x2="-287.76535" y1="-66.117432" y2="-66.117432">
        <stop offset="0" stop-color="#313133"/>
        <stop offset="1" stop-color="#9a9996"/>
    </linearGradient>
    <linearGradient id="b" gradientTransform="matrix(0 -1 -1 0 0.000051 -160.000093)" gradientUnits="userSpaceOnUse" x1="-271.974609" x2="-266.414551" y1="-62.938477" y2="-62.938477">
        <stop offset="0" stop-color="#aeadab"/>
        <stop offset="1" stop-color="#aeadab" stop-opacity="0"/>
    </linearGradient>
    <linearGradient id="c" gradientTransform="matrix(2.381786 0 0 2.083491 -2851.15317 1648.156841)" gradientUnits="userSpaceOnUse" x1="1202" x2="1246" y1="-735" y2="-735">
        <stop offset="0" stop-color="#9a9996" stop-opacity="0"/>
        <stop offset="0.0909091" stop-color="#9a9996"/>
        <stop offset="0.909091" stop-color="#9a9996"/>
        <stop offset="1" stop-color="#9a9996" stop-opacity="0"/>
    </linearGradient>
    <linearGradient id="d" gradientTransform="matrix(0.25 0 0 0.166667 -163.999958 180.666578)" gradientUnits="userSpaceOnUse" x1="904" x2="904" y1="-340" y2="-385.948242">
        <stop offset="0" stop-color="#77767b"/>
        <stop offset="0.603496" stop-color="#c0bfbc"/>
        <stop offset="1" stop-color="#aeadab"/>
    </linearGradient>
    <linearGradient id="e" gradientTransform="matrix(0.45451 0 0 0.455522 -1210.292114 616.172607)" gradientUnits="userSpaceOnUse" x1="2689.251953" x2="2918.069824" y1="-1106.802979" y2="-1106.802979">
        <stop offset="0" stop-color="#5d6f92"/>
        <stop offset="0.0576991" stop-color="#c3cfe3"/>
        <stop offset="0.122204" stop-color="#5d6f92"/>
        <stop offset="0.873306" stop-color="#5d6f92"/>
        <stop offset="0.955997" stop-color="#c9d2e0"/>
        <stop offset="1" stop-color="#5d6f92"/>
    </linearGradient>
    <path d="m 21.976562 12 c -5.527343 0 -9.976562 4.460938 -9.976562 10 v 76 c 0 5.539062 4.449219 10 9.976562 10 h 84.042969 c 5.53125 0 9.980469 -4.460938 9.980469 -10 v -64 c 0 -6.628906 -5.359375 -12 -11.972656 -12 h -46.027344 c -2.480469 0 -4.78125 -1.304688 -6.0625 -3.4375 l -0.84375 -1.410156 c -1.921875 -3.195313 -5.371094 -5.152344 -9.09375 -5.152344 z m 0 0" fill="#45577a"/>
    <path d="m 68 117.210938 v -29.851563 h -8 v 29.851563 z m 0 0" fill="url(#a)"/>
    <path d="m 63.796875 117.210938 v -29.851563 h -1.796875 v 29.851563 z m 0 0" fill="url(#b)"/>
    <path d="m 8.179688 117.832031 h 111.945312 v 4.167969 h -111.945312 z m 0 0" fill="url(#c)"/>
    <path d="m 51.730469 116 h 24.539062 c 2.0625 0 3.730469 1.667969 3.730469 3.730469 v 0.539062 c 0 2.0625 -1.667969 3.730469 -3.730469 3.730469 h -24.539062 c -2.0625 0 -3.730469 -1.667969 -3.730469 -3.730469 v -0.539062 c 0 -2.0625 1.667969 -3.730469 3.730469 -3.730469 z m 0 0" fill="url(#d)"/>
    <path d="m 65.976562 36 c -2.746093 0 -5.226562 1.101562 -7.027343 2.890625 c -2.273438 2.253906 -5.382813 5.109375 -8.632813 5.109375 h -28.339844 c -5.527343 0 -9.976562 4.460938 -9.976562 10 v 44 c 0 5.539062 4.449219 10 9.976562 10 h 84.042969 c 5.53125 0 9.980469 -4.460938 9.980469 -10 v -52 c 0 -5.539062 -4.449219 -10 -9.980469 -10 z m 0 0" fill="url(#e)"/>
    <path d="m 65.976562 32 c -2.746093 0 -5.226562 1.101562 -7.027343 2.890625 c -2.273438 2.253906 -5.382813 5.109375 -8.632813 5.109375 h -28.339844 c -5.527343 0 -9.976562 4.460938 -9.976562 10 v 46 c 0 5.539062 4.449219 10 9.976562 10 h 84.042969 c 5.53125 0 9.980469 -4.460938 9.980469 -10 v -54 c 0 -5.539062 -4.449219 -10 -9.980469 -10 z m 0 0" fill="#a9bad6"/>
</svg>
places/folder-templates.svg
<?xml version="1.0" encoding="UTF-8"?>
<svg height="128px" viewBox="0 0 128 128" width="128px" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
    <linearGradient id="a" gradientTransform="matrix(0.45451 0 0 0.455522 -1210.292114 616.172607)" gradientUnits="userSpaceOnUse" x1="2689.251953" x2="2918.069824" y1="-1106.802979" y2="-1106.802979">
        <stop offset="0" stop-color="#5d6f92"/>
        <stop offset="0.0576991" stop-color="#c3cfe3"/>
        <stop offset="0.122204" stop-color="#5d6f92"/>
        <stop offset="0.873306" stop-color="#5d6f92"/>
        <stop offset="0.955997" stop-color="#c9d2e0"/>
        <stop offset="1" stop-color="#5d6f92"/>
    </linearGradient>
    <path d="m 21.976562 12 c -5.527343 0 -9.976562 4.460938 -9.976562 10 v 86.03125 c 0 5.542969 4.449219 10 9.976562 10 h 84.042969 c 5.53125 0 9.980469 -4.457031 9.980469 -10 v -72.085938 c 0 -6.628906 -5.359375 -12 -11.972656 -12 h -46.027344 c -2.453125 0 -4.695312 -1.386718 -5.796875 -3.582031 l -1.503906 -2.992187 c -1.65625 -3.292969 -5.019531 -5.371094 -8.699219 -5.371094 z m 0 0" fill="#45577a"/>
    <path d="m 65.976562 36 c -2.746093 0 -5.226562 1.101562 -7.027343 2.890625 c -2.273438 2.253906 -5.382813 5.109375 -8.632813 5.109375 h -28.339844 c -5.527343 0 -9.976562 4.460938 -9.976562 10 v 54.03125 c 0 5.542969 4.449219 10 9.976562 10 h 84.042969 c 5.53125 0 9.980469 -4.457031 9.980469 -10 v -62.03125 c 0 -5.539062 -4.449219 -10 -9.980469 -10 z m 0 0" fill="url(#a)"/>
    <path d="m 65.976562 32 c -2.746093 0 -5.226562 1.101562 -7.027343 2.890625 c -2.273438 2.253906 -5.382813 5.109375 -8.632813 5.109375 h -28.339844 c -5.527343 0 -9.976562 4.460938 -9.976562 10 v 55.976562 c 0 5.539063 4.449219 10 9.976562 10 h 84.042969 c 5.53125 0 9.980469 -4.460937 9.980469 -10 v -63.976562 c 0 -5.539062 -4.449219 -10 -9.980469 -10 z m 0 0" fill="#a9bad6"/>
    <path d="m 58 60 c -3.289062 0 -6 2.710938 -6 6 v 15.992188 h 2 v -1.992188 h 2 v -14 c 0 -1.140625 0.859375 -2 2 -2 h 8 v 3 c 0 2 1 3 3 3 h 3 v 16 h 2 v 2 h 2 v -19 c 0 -0.53125 -0.210938 -1.039062 -0.585938 -1.414062 l -7 -7 c -0.375 -0.375 -0.882812 -0.585938 -1.414062 -0.585938 z m 16 28 h -2 v 1.984375 h -2 v 2 h 2 v -1.984375 h 2 z m -4 1.984375 v -2 h -2 v 2 z m -2 0 h -2 v 2 h 2 z m -2 0 v -2 h -2 v 2 z m -2 0 h -2 v 2 h 2 z m -2 0 v -2 h -2 v 2 z m -2 0 h -2 v 2 h 2 z m -2 0 v -2 h -2 v 2 z m -2 0 h -2 v 2 h 2 z m -2 0 v -2 h -2 v 2 z m 0 -2 h 2 v -2 h -2 z m 0 -2 v -2 h -2 v 2 z m 0 -2 h 2 v -2 h -2 z m 0 0" fill="#45577a"/>
</svg>
places/folder-videos.svg
<?xml version="1.0" encoding="UTF-8"?>
<svg height="128px" viewBox="0 0 128 128" width="128px" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
    <linearGradient id="a" gradientTransform="matrix(0.45451 0 0 0.455522 -1210.292114 616.172607)" gradientUnits="userSpaceOnUse" x1="2689.251953" x2="2918.069824" y1="-1106.802979" y2="-1106.802979">
        <stop offset="0" stop-color="#5d6f92"/>
        <stop offset="0.0576991" stop-color="#c3cfe3"/>
        <stop offset="0.122204" stop-color="#5d6f92"/>
        <stop offset="0.873306" stop-color="#5d6f92"/>
        <stop offset="0.955997" stop-color="#c9d2e0"/>
        <stop offset="1" stop-color="#5d6f92"/>
    </linearGradient>
    <path d="m 21.976562 12 c -5.527343 0 -9.976562 4.460938 -9.976562 10 v 86.03125 c 0 5.542969 4.449219 10 9.976562 10 h 84.042969 c 5.53125 0 9.980469 -4.457031 9.980469 -10 v -72.085938 c 0 -6.628906 -5.359375 -12 -11.972656 -12 h -46.027344 c -2.453125 0 -4.695312 -1.386718 -5.796875 -3.582031 l -1.503906 -2.992187 c -1.65625 -3.292969 -5.019531 -5.371094 -8.699219 -5.371094 z m 0 0" fill="#45577a"/>
    <path d="m 65.976562 36 c -2.746093 0 -5.226562 1.101562 -7.027343 2.890625 c -2.273438 2.253906 -5.382813 5.109375 -8.632813 5.109375 h -28.339844 c -5.527343 0 -9.976562 4.460938 -9.976562 10 v 54.03125 c 0 5.542969 4.449219 10 9.976562 10 h 84.042969 c 5.53125 0 9.980469 -4.457031 9.980469 -10 v -62.03125 c 0 -5.539062 -4.449219 -10 -9.980469 -10 z m 0 0" fill="url(#a)"/>
    <path d="m 65.976562 32 c -2.746093 0 -5.226562 1.101562 -7.027343 2.890625 c -2.273438 2.253906 -5.382813 5.109375 -8.632813 5.109375 h -28.339844 c -5.527343 0 -9.976562 4.460938 -9.976562 10 v 55.976562 c 0 5.539063 4.449219 10 9.976562 10 h 84.042969 c 5.53125 0 9.980469 -4.460937 9.980469 -10 v -63.976562 c 0 -5.539062 -4.449219 -10 -9.980469 -10 z m 0 0" fill="#a9bad6"/>
    <g fill="#45577a">
        <path d="m 49.089844 71.960938 h -1.089844 v 16.0625 h 1.035156 l 10.203125 -8.023438 z m 0 0"/>
        <path d="m 62 68 c -3.289062 0 -6 2.710938 -6 6 v 12 c 0 3.289062 2.710938 6 6 6 h 12 c 3.289062 0 6 -2.710938 6 -6 v -12 c 0 -3.289062 -2.710938 -6 -6 -6 z m 0 4 h 12 c 1.140625 0 2 0.859375 2 2 v 12 c 0 1.140625 -0.859375 2 -2 2 h -12 c -1.140625 0 -2 -0.859375 -2 -2 v -12 c 0 -1.140625 0.859375 -2 2 -2 z m 0 0"/>
    </g>
</svg>
places/folder.svg
<?xml version="1.0" encoding="UTF-8"?>
<svg height="128px" viewBox="0 0 128 128" width="128px" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
    <linearGradient id="a" gradientTransform="matrix(0.45451 0 0 0.455522 -1210.292114 616.172607)" gradientUnits="userSpaceOnUse" x1="2689.251953" x2="2918.069824" y1="-1106.802979" y2="-1106.802979">
        <stop offset="0" stop-color="#5d6f92"/>
        <stop offset="0.0576991" stop-color="#c3cfe3"/>
        <stop offset="0.122204" stop-color="#5d6f92"/>
        <stop offset="0.873306" stop-color="#5d6f92"/>
        <stop offset="0.955997" stop-color="#c9d2e0"/>
        <stop offset="1" stop-color="#5d6f92"/>
    </linearGradient>
    <path d="m 21.976562 12 c -5.527343 0 -9.976562 4.460938 -9.976562 10 v 86.03125 c 0 5.542969 4.449219 10 9.976562 10 h 84.042969 c 5.53125 0 9.980469 -4.457031 9.980469 -10 v -72.085938 c 0 -6.628906 -5.359375 -12 -11.972656 -12 h -46.027344 c -2.453125 0 -4.695312 -1.386718 -5.796875 -3.582031 l -1.503906 -2.992187 c -1.65625 -3.292969 -5.019531 -5.371094 -8.699219 -5.371094 z m 0 0" fill="#45577a"/>
    <path d="m 65.976562 36 c -2.746093 0 -5.226562 1.101562 -7.027343 2.890625 c -2.273438 2.253906 -5.382813 5.109375 -8.632813 5.109375 h -28.339844 c -5.527343 0 -9.976562 4.460938 -9.976562 10 v 54.03125 c 0 5.542969 4.449219 10 9.976562 10 h 84.042969 c 5.53125 0 9.980469 -4.457031 9.980469 -10 v -62.03125 c 0 -5.539062 -4.449219 -10 -9.980469 -10 z m 0 0" fill="url(#a)"/>
    <path d="m 65.976562 32 c -2.746093 0 -5.226562 1.101562 -7.027343 2.890625 c -2.273438 2.253906 -5.382813 5.109375 -8.632813 5.109375 h -28.339844 c -5.527343 0 -9.976562 4.460938 -9.976562 10 v 55.976562 c 0 5.539063 4.449219 10 9.976562 10 h 84.042969 c 5.53125 0 9.980469 -4.460937 9.980469 -10 v -63.976562 c 0 -5.539062 -4.449219 -10 -9.980469 -10 z m 0 0" fill="#a9bad6"/>
</svg>
places/network-server.svg
<?xml version="1.0" encoding="UTF-8"?>
<svg height="128px" viewBox="0 0 128 128" width="128px" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
    <linearGradient id="a" gradientTransform="matrix(0 -0.932866 -1 0 -0.000006 -170.918221)" gradientUnits="userSpaceOnUse" x1="-280.623596" x2="-287.76535" y1="-66.117432" y2="-66.117432">
        <stop offset="0" stop-color="#313133"/>
        <stop offset="1" stop-color="#9a9996"/>
    </linearGradient>
    <linearGradient id="b" gradientTransform="matrix(0 -1 -1 0 0 -172)" gradientUnits="userSpaceOnUse" x1="-271.974609" x2="-266.414551" y1="-62.938477" y2="-62.938477">
        <stop offset="0" stop-color="#aeadab"/>
        <stop offset="1" stop-color="#aeadab" stop-opacity="0"/>
    </linearGradient>
    <linearGradient id="c" gradientTransform="matrix(2.381786 0 0 2.083491 -2851.15332 1636.15686)" gradientUnits="userSpaceOnUse" x1="1202" x2="1246" y1="-735" y2="-735">
        <stop offset="0" stop-color="#9a9996" stop-opacity="0"/>
        <stop offset="0.0909091" stop-color="#9a9996"/>
        <stop offset="0.909091" stop-color="#9a9996"/>
        <stop offset="1" stop-color="#9a9996" stop-opacity="0"/>
    </linearGradient>
    <linearGradient id="d" gradientTransform="matrix(0.25 0 0 0.166667 -164.000015 168.666656)" gradientUnits="userSpaceOnUse" x1="904" x2="904" y1="-340" y2="-385.948242">
        <stop offset="0" stop-color="#77767b"/>
        <stop offset="0.603496" stop-color="#c0bfbc"/>
        <stop offset="1" stop-color="#aeadab"/>
    </linearGradient>
    <linearGradient id="e" gradientTransform="matrix(0.232338 0 0 0.233165 -8.671706 198.782745)" gradientUnits="userSpaceOnUse" x1="88.595886" x2="536.595886" y1="-449.394012" y2="-449.394012">
        <stop offset="0" stop-color="#c4c4c6"/>
        <stop offset="0.0357143" stop-color="#f0f0ee"/>
        <stop offset="0.0713653" stop-color="#cfcfcd"/>
        <stop offset="0.928571" stop-color="#d5d5d5"/>
        <stop offset="0.964286" stop-color="#c0bfbc"/>
        <stop offset="1" stop-color="#77767b"/>
    </linearGradient>
    <linearGradient id="f" gradientUnits="userSpaceOnUse" x1="45.543945" x2="45.543945" y1="72.562012" y2="83.275391">
        <stop offset="0" stop-color="#77767b"/>
        <stop offset="1" stop-color="#c0bfbc"/>
    </linearGradient>
    <path d="m 68 105.210938 v -29.851563 h -8 v 29.851563 z m 0 0" fill="url(#a)"/>
    <path d="m 63.796875 105.210938 v -29.851563 h -1.796875 v 29.851563 z m 0 0" fill="url(#b)"/>
    <path d="m 8.179688 105.832031 h 111.945312 v 4.167969 h -111.945312 z m 0 0" fill="url(#c)"/>
    <path d="m 51.730469 104 h 24.539062 c 2.0625 0 3.730469 1.667969 3.730469 3.730469 v 0.539062 c 0 2.0625 -1.667969 3.730469 -3.730469 3.730469 h -24.539062 c -2.0625 0 -3.730469 -1.667969 -3.730469 -3.730469 v -0.539062 c 0 -2.0625 1.667969 -3.730469 3.730469 -3.730469 z m 0 0" fill="url(#d)"/>
    <path d="m 19.355469 23.117188 h 89.203125 c 4.109375 0 7.441406 3.339843 7.441406 7.460937 v 55.960937 c 0 4.121094 -3.332031 7.460938 -7.441406 7.460938 h -89.203125 c -4.109375 0 -7.441407 -3.339844 -7.441407 -7.460938 v -55.960937 c 0 -4.121094 3.332032 -7.460937 7.441407 -7.460937 z m 0 0" fill="url(#e)"/>
    <path d="m 19.5625 12 h 88.929688 c 4.148437 0 7.507812 3.359375 7.507812 7.507812 v 40.722657 c 0 4.148437 -3.359375 7.507812 -7.507812 7.507812 h -88.929688 c -4.144531 0 -7.507812 -3.359375 -7.507812 -7.507812 v -40.722657 c 0 -4.148437 3.363281 -7.507812 7.507812 -7.507812 z m 0 0" fill="#deddda"/>
    <g fill="#ff7800">
        <path d="m 104 84.996094 c 0 0.5625 -0.457031 1.023437 -1.023438 1.023437 c -0.5625 0 -1.019531 -0.460937 -1.019531 -1.023437 s 0.457031 -1.023438 1.019531 -1.023438 c 0.566407 0 1.023438 0.460938 1.023438 1.023438 z m 0 0"/>
        <path d="m 104 81.023438 c 0 0.5625 -0.457031 1.019531 -1.023438 1.019531 c -0.5625 0 -1.019531 -0.457031 -1.019531 -1.019531 c 0 -0.566407 0.457031 -1.023438 1.019531 -1.023438 c 0.566407 0 1.023438 0.457031 1.023438 1.023438 z m 0 0"/>
        <path d="m 104 77.039062 c 0 0.566407 -0.457031 1.023438 -1.023438 1.023438 c -0.5625 0 -1.019531 -0.457031 -1.019531 -1.023438 c 0 -0.5625 0.457031 -1.019531 1.019531 -1.019531 c 0.566407 0 1.023438 0.457031 1.023438 1.019531 z m 0 0"/>
    </g>
    <path d="m 11.914062 58.566406 v 1.859375 c 0 4.167969 3.347657 7.519531 7.507813 7.519531 h 89.066406 c 4.160157 0 7.511719 -3.351562 7.511719 -7.519531 v -1.859375 c 0 4.164063 -3.351562 7.519532 -7.511719 7.519532 h -89.066406 c -4.160156 0 -7.507813 -3.355469 -7.507813 -7.519532 z m 0 0" fill="#f6f5f4"/>
    <path d="m 101.011719 84.996094 c 0 0.5625 -0.457031 1.023437 -1.019531 1.023437 c -0.566407 0 -1.023438 -0.460937 -1.023438 -1.023437 s 0.457031 -1.023438 1.023438 -1.023438 c 0.5625 0 1.019531 0.460938 1.019531 1.023438 z m 0 0" fill="#c01c28"/>
    <path d="m 101.011719 81.023438 c 0 0.5625 -0.457031 1.019531 -1.019531 1.019531 c -0.566407 0 -1.023438 -0.457031 -1.023438 -1.019531 c 0 -0.566407 0.457031 -1.023438 1.023438 -1.023438 c 0.5625 0 1.019531 0.457031 1.019531 1.023438 z m 0 0" fill="#ff7800"/>
    <path d="m 101.011719 77.039062 c 0 0.566407 -0.457031 1.023438 -1.019531 1.023438 c -0.566407 0 -1.023438 -0.457031 -1.023438 -1.023438 c 0 -0.5625 0.457031 -1.019531 1.023438 -1.019531 c 0.5625 0 1.019531 0.457031 1.019531 1.019531 z m 0 0" fill="#c01c28"/>
    <path d="m 98.027344 84.996094 c 0 0.5625 -0.457032 1.023437 -1.023438 1.023437 c -0.5625 0 -1.019531 -0.460937 -1.019531 -1.023437 s 0.457031 -1.023438 1.019531 -1.023438 c 0.566406 0 1.023438 0.460938 1.023438 1.023438 z m 0 0" fill="#ff7800"/>
    <path d="m 98.027344 81.023438 c 0 0.5625 -0.457032 1.019531 -1.023438 1.019531 c -0.5625 0 -1.019531 -0.457031 -1.019531 -1.019531 c 0 -0.566407 0.457031 -1.023438 1.019531 -1.023438 c 0.566406 0 1.023438 0.457031 1.023438 1.023438 z m 0 0" fill="#c01c28"/>
    <path d="m 98.027344 77.039062 c 0 0.566407 -0.457032 1.023438 -1.023438 1.023438 c -0.5625 0 -1.019531 -0.457031 -1.019531 -1.023438 c 0 -0.5625 0.457031 -1.019531 1.019531 -1.019531 c 0.566406 0 1.023438 0.457031 1.023438 1.019531 z m 0 0" fill="#c01c28"/>
    <path d="m 65.421875 80.441406 c -0.511719 0.007813 -0.996094 0.214844 -1.355469 0.578125 l -3.644531 3.714844 c -0.742187 0.757813 -0.730469 1.972656 0.027344 2.714844 c 0.757812 0.742187 1.972656 0.730469 2.714843 -0.023438 l 3.644532 -3.71875 c 0.742187 -0.757812 0.730468 -1.972656 -0.023438 -2.714843 c -0.367187 -0.355469 -0.855468 -0.554688 -1.363281 -0.550782 z m -35.875 -8.375 c -0.507813 0.007813 -0.996094 0.214844 -1.351563 0.578125 l -3.644531 3.714844 c -0.742187 0.757813 -0.730469 1.972656 0.023438 2.714844 c 0.757812 0.746093 1.972656 0.734375 2.714843 -0.023438 l 3.648438 -3.71875 c 0.742188 -0.757812 0.730469 -1.972656 -0.027344 -2.714843 c -0.363281 -0.355469 -0.855468 -0.554688 -1.363281 -0.550782 z m 8.675781 -0.066406 c -0.511718 -0.003906 -1 0.195312 -1.363281 0.550781 l -12.285156 12.097657 c -0.757813 0.746093 -0.765625 1.960937 -0.023438 2.714843 c 0.746094 0.757813 1.960938 0.765625 2.714844 0.023438 l 12.289063 -12.097657 c 0.753906 -0.746093 0.765624 -1.960937 0.019531 -2.714843 c -0.355469 -0.363281 -0.84375 -0.570313 -1.351563 -0.574219 z m 9.117188 0 c -0.511719 -0.003906 -1 0.195312 -1.363282 0.550781 l -12.289062 12.097657 c -0.753906 0.746093 -0.761719 1.960937 -0.019531 2.714843 c 0.746093 0.757813 1.960937 0.765625 2.714843 0.023438 l 12.289063 -12.097657 c 0.753906 -0.746093 0.765625 -1.960937 0.019531 -2.714843 c -0.355468 -0.363281 -0.84375 -0.570313 -1.351562 -0.574219 z m 9.117187 0 c -0.507812 -0.003906 -0.996093 0.195312 -1.359375 0.550781 l -12.289062 12.097657 c -0.753906 0.746093 -0.765625 1.960937 -0.019532 2.714843 c 0.355469 0.363281 0.84375 0.570313 1.351563 0.574219 c 0.511719 0.003906 1 -0.195312 1.363281 -0.550781 l 12.289063 -12.097657 c 0.753906 -0.746093 0.761719 -1.960937 0.019531 -2.714843 c -0.359375 -0.363281 -0.84375 -0.570313 -1.355469 -0.574219 z m 7.757813 0.550781 l -12.285156 12.097657 c -0.753907 0.746093 -0.765626 1.960937 -0.019532 2.714843 c 0.742188 0.757813 1.957032 0.765625 2.714844 0.023438 l 12.285156 -12.097657 c 0.757813 -0.746093 0.765625 -1.960937 0.019532 -2.714843 c -0.742188 -0.757813 -1.957032 -0.765625 -2.714844 -0.023438 z m 0 0" fill="url(#f)"/>
</svg>
places/network-workgroup.svg
<?xml version="1.0" encoding="UTF-8"?>
<svg height="128px" viewBox="0 0 128 128" width="128px" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
    <clipPath id="a">
        <path d="m 32 51 h 36 v 39 h -36 z m 0 0"/>
    </clipPath>
    <clipPath id="b">
        <path d="m 31.351562 39.5625 h 37.296876 v 51.050781 h -37.296876 z m 28.242188 31.855469 c 0 -5.023438 -4.289062 -9.101563 -9.582031 -9.101563 c -5.289063 0 -9.578125 4.078125 -9.578125 9.101563 c 0 5.027343 4.289062 9.101562 9.578125 9.101562 c 5.292969 0 9.582031 -4.074219 9.582031 -9.101562 z m 0 0"/>
    </clipPath>
    <linearGradient id="c" gradientUnits="userSpaceOnUse">
        <stop offset="0" stop-color="#9a9996"/>
        <stop offset="0.0414257" stop-color="#c0bfbc"/>
        <stop offset="0.0815191" stop-color="#9a9996"/>
        <stop offset="0.899024" stop-color="#77767b"/>
        <stop offset="0.952865" stop-color="#c0bfbc"/>
        <stop offset="1" stop-color="#77767b"/>
    </linearGradient>
    <linearGradient id="d" gradientTransform="matrix(0.129522 0 0 0.12304 -20.172717 -8.276901)" x1="403.496033" x2="678.908813" xlink:href="#c" y1="793.565552" y2="793.565552"/>
    <clipPath id="e">
        <path d="m 32 50 h 36 v 39 h -36 z m 0 0"/>
    </clipPath>
    <clipPath id="f">
        <path d="m 31.351562 39.5625 h 37.296876 v 51.050781 h -37.296876 z m 28.242188 31.855469 c 0 -5.023438 -4.289062 -9.101563 -9.582031 -9.101563 c -5.289063 0 -9.578125 4.078125 -9.578125 9.101563 c 0 5.027343 4.289062 9.101562 9.578125 9.101562 c 5.292969 0 9.582031 -4.074219 9.582031 -9.101562 z m 0 0"/>
    </clipPath>
    <clipPath id="g">
        <path d="m 32 40 h 36 v 40 h -36 z m 0 0"/>
    </clipPath>
    <clipPath id="h">
        <path d="m 31.351562 39.5625 h 37.296876 v 51.050781 h -37.296876 z m 28.242188 31.855469 c 0 -5.023438 -4.289062 -9.101563 -9.582031 -9.101563 c -5.289063 0 -9.578125 4.078125 -9.578125 9.101563 c 0 5.027343 4.289062 9.101562 9.578125 9.101562 c 5.292969 0 9.582031 -4.074219 9.582031 -9.101562 z m 0 0"/>
    </clipPath>
    <linearGradient id="i" gradientUnits="userSpaceOnUse">
        <stop offset="0" stop-color="#3d3846"/>
        <stop offset="0.0279595" stop-color="#79718e"/>
        <stop offset="0.0654033" stop-color="#4e475a"/>
        <stop offset="0.938181" stop-color="#716881"/>
        <stop offset="0.971878" stop-color="#847a96"/>
        <stop offset="1" stop-color="#3d3846"/>
    </linearGradient>
    <linearGradient id="j" gradientTransform="matrix(0.224856 0 0 0.22209 -200.939247 25.114628)" x1="928.741516" x2="1302.490479" xlink:href="#i" y1="216.638611" y2="216.638611"/>
    <linearGradient id="k" gradientTransform="matrix(0.45451 0 0 0.455522 -1210.292114 612.172607)" gradientUnits="userSpaceOnUse" x1="2831.385498" x2="2732.762939" y1="-1295.160156" y2="-1196.75647">
        <stop offset="0" stop-color="#1a5fb4"/>
        <stop offset="1" stop-color="#14498a"/>
    </linearGradient>
    <clipPath id="l">
        <path d="m 60 81 h 36 v 39 h -36 z m 0 0"/>
    </clipPath>
    <clipPath id="m">
        <path d="m 59.351562 69.5625 h 37.296876 v 51.050781 h -37.296876 z m 28.242188 31.855469 c 0 -5.023438 -4.289062 -9.101563 -9.582031 -9.101563 c -5.289063 0 -9.578125 4.078125 -9.578125 9.101563 c 0 5.027343 4.289062 9.101562 9.578125 9.101562 c 5.292969 0 9.582031 -4.074219 9.582031 -9.101562 z m 0 0"/>
    </clipPath>
    <linearGradient id="n" gradientTransform="matrix(0.129522 0 0 0.12304 7.827283 21.723099)" x1="403.496033" x2="678.908813" xlink:href="#c" y1="793.565552" y2="793.565552"/>
    <clipPath id="o">
        <path d="m 60 80 h 36 v 39 h -36 z m 0 0"/>
    </clipPath>
    <clipPath id="p">
        <path d="m 59.351562 69.5625 h 37.296876 v 51.050781 h -37.296876 z m 28.242188 31.855469 c 0 -5.023438 -4.289062 -9.101563 -9.582031 -9.101563 c -5.289063 0 -9.578125 4.078125 -9.578125 9.101563 c 0 5.027343 4.289062 9.101562 9.578125 9.101562 c 5.292969 0 9.582031 -4.074219 9.582031 -9.101562 z m 0 0"/>
    </clipPath>
    <clipPath id="q">
        <path d="m 60 70 h 36 v 40 h -36 z m 0 0"/>
    </clipPath>
    <clipPath id="r">
        <path d="m 59.351562 69.5625 h 37.296876 v 51.050781 h -37.296876 z m 28.242188 31.855469 c 0 -5.023438 -4.289062 -9.101563 -9.582031 -9.101563 c -5.289063 0 -9.578125 4.078125 -9.578125 9.101563 c 0 5.027343 4.289062 9.101562 9.578125 9.101562 c 5.292969 0 9.582031 -4.074219 9.582031 -9.101562 z m 0 0"/>
    </clipPath>
    <linearGradient id="s" gradientTransform="matrix(0.224856 0 0 0.22209 -172.939247 55.114628)" x1="928.741516" x2="1302.490479" xlink:href="#i" y1="216.638611" y2="216.638611"/>
    <linearGradient id="t" gradientTransform="matrix(0.337063 0 0 0.330795 -867.055597 477.291929)" gradientUnits="userSpaceOnUse" x1="2704.463135" x2="2868.168457" y1="-1148.187378" y2="-1311.529175">
        <stop offset="0" stop-color="#1c71d8"/>
        <stop offset="1" stop-color="#5d6f92"/>
    </linearGradient>
    <g clip-path="url(#a)">
        <g clip-path="url(#b)">
            <path d="m 34.5625 51.777344 h 30.875 c 1.417969 0 2.5625 1.136718 2.5625 2.542968 v 33.136719 c 0 1.410157 -1.144531 2.542969 -2.5625 2.542969 h -30.875 c -1.417969 0 -2.5625 -1.132812 -2.5625 -2.542969 v -33.136719 c 0 -1.40625 1.144531 -2.542968 2.5625 -2.542968 z m 0 0" fill="url(#d)"/>
        </g>
    </g>
    <g clip-path="url(#e)">
        <g clip-path="url(#f)">
            <path d="m 34.5625 50.289062 h 30.875 c 1.417969 0 2.5625 1.132813 2.5625 2.542969 v 33.132813 c 0 1.410156 -1.144531 2.542968 -2.5625 2.542968 h -30.875 c -1.417969 0 -2.5625 -1.132812 -2.5625 -2.542968 v -33.132813 c 0 -1.410156 1.144531 -2.542969 2.5625 -2.542969 z m 0 0" fill="#77767b"/>
        </g>
    </g>
    <g clip-path="url(#g)">
        <g clip-path="url(#h)">
            <path d="m 32 40.175781 h 36 v 39.816407 h -36 z m 0 0" fill="#434348" fill-opacity="0.509804"/>
        </g>
    </g>
    <path d="m 92 15.105469 v 53.789062 c 0 3.921875 -3.175781 7.105469 -7.089844 7.105469 h -69.820312 c -3.914063 0 -7.089844 -3.183594 -7.089844 -7.105469 v -53.789062 c 0 -3.921875 3.175781 -7.105469 7.089844 -7.105469 h 69.820312 c 3.914063 0 7.089844 3.183594 7.089844 7.105469 z m 0 0" fill="url(#j)"/>
    <path d="m 92 15.105469 v 50.832031 c 0 3.925781 -3.175781 7.105469 -7.089844 7.105469 h -69.820312 c -3.914063 0 -7.089844 -3.179688 -7.089844 -7.105469 v -50.832031 c 0 -3.921875 3.175781 -7.105469 7.089844 -7.105469 h 69.820312 c 3.914063 0 7.089844 3.183594 7.089844 7.105469 z m 0 0" fill="#241f31"/>
    <path d="m 15.363281 10 h 69.183594 c 3.011719 0 5.453125 2.449219 5.453125 5.464844 v 50.070312 c 0 3.015625 -2.441406 5.464844 -5.453125 5.464844 h -69.183594 c -3.015625 0 -5.457031 -2.449219 -5.457031 -5.464844 v -50.070312 c 0 -3.015625 2.441406 -5.464844 5.457031 -5.464844 z m 0 0" fill="url(#k)"/>
    <g clip-path="url(#l)">
        <g clip-path="url(#m)">
            <path d="m 62.5625 81.777344 h 30.875 c 1.417969 0 2.5625 1.136718 2.5625 2.542968 v 33.136719 c 0 1.410157 -1.144531 2.542969 -2.5625 2.542969 h -30.875 c -1.417969 0 -2.5625 -1.132812 -2.5625 -2.542969 v -33.136719 c 0 -1.40625 1.144531 -2.542968 2.5625 -2.542968 z m 0 0" fill="url(#n)"/>
        </g>
    </g>
    <g clip-path="url(#o)">
        <g clip-path="url(#p)">
            <path d="m 62.5625 80.289062 h 30.875 c 1.417969 0 2.5625 1.132813 2.5625 2.542969 v 33.132813 c 0 1.410156 -1.144531 2.542968 -2.5625 2.542968 h -30.875 c -1.417969 0 -2.5625 -1.132812 -2.5625 -2.542968 v -33.132813 c 0 -1.410156 1.144531 -2.542969 2.5625 -2.542969 z m 0 0" fill="#77767b"/>
        </g>
    </g>
    <g clip-path="url(#q)">
        <g clip-path="url(#r)">
            <path d="m 60 70.175781 h 36 v 39.816407 h -36 z m 0 0" fill="#434348" fill-opacity="0.509804"/>
        </g>
    </g>
    <path d="m 120 45.105469 v 53.789062 c 0 3.921875 -3.175781 7.105469 -7.089844 7.105469 h -69.820312 c -3.914063 0 -7.089844 -3.183594 -7.089844 -7.105469 v -53.789062 c 0 -3.921875 3.175781 -7.105469 7.089844 -7.105469 h 69.820312 c 3.914063 0 7.089844 3.183594 7.089844 7.105469 z m 0 0" fill="url(#s)"/>
    <path d="m 120 45.105469 v 50.832031 c 0 3.925781 -3.175781 7.105469 -7.089844 7.105469 h -69.820312 c -3.914063 0 -7.089844 -3.179688 -7.089844 -7.105469 v -50.832031 c 0 -3.921875 3.175781 -7.105469 7.089844 -7.105469 h 69.820312 c 3.914063 0 7.089844 3.183594 7.089844 7.105469 z m 0 0" fill="#241f31"/>
    <path d="m 43.363281 40 h 69.183594 c 3.011719 0 5.453125 2.449219 5.453125 5.464844 v 50.070312 c 0 3.015625 -2.441406 5.464844 -5.453125 5.464844 h -69.183594 c -3.015625 0 -5.457031 -2.449219 -5.457031 -5.464844 v -50.070312 c 0 -3.015625 2.441406 -5.464844 5.457031 -5.464844 z m 0 0" fill="url(#t)"/>
</svg>
places/user-bookmarks.svg
<?xml version="1.0" encoding="UTF-8"?>
<svg height="128px" viewBox="0 0 128 128" width="128px" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
    <linearGradient id="a" gradientTransform="matrix(0.45451 0 0 0.455522 -1210.292114 616.172607)" gradientUnits="userSpaceOnUse" x1="2689.251953" x2="2918.069824" y1="-1106.802979" y2="-1106.802979">
        <stop offset="0" stop-color="#5d6f92"/>
        <stop offset="0.0576991" stop-color="#c3cfe3"/>
        <stop offset="0.122204" stop-color="#5d6f92"/>
        <stop offset="0.873306" stop-color="#5d6f92"/>
        <stop offset="0.955997" stop-color="#c9d2e0"/>
        <stop offset="1" stop-color="#5d6f92"/>
    </linearGradient>
    <path d="m 21.976562 12 c -5.527343 0 -9.976562 4.460938 -9.976562 10 v 86.03125 c 0 5.542969 4.449219 10 9.976562 10 h 84.042969 c 5.53125 0 9.980469 -4.457031 9.980469 -10 v -72.085938 c 0 -6.628906 -5.359375 -12 -11.972656 -12 h -46.027344 c -2.453125 0 -4.695312 -1.386718 -5.796875 -3.582031 l -1.503906 -2.992187 c -1.65625 -3.292969 -5.019531 -5.371094 -8.699219 -5.371094 z m 0 0" fill="#45577a"/>
    <path d="m 65.976562 36 c -2.746093 0 -5.226562 1.101562 -7.027343 2.890625 c -2.273438 2.253906 -5.382813 5.109375 -8.632813 5.109375 h -28.339844 c -5.527343 0 -9.976562 4.460938 -9.976562 10 v 54.03125 c 0 5.542969 4.449219 10 9.976562 10 h 84.042969 c 5.53125 0 9.980469 -4.457031 9.980469 -10 v -62.03125 c 0 -5.539062 -4.449219 -10 -9.980469 -10 z m 0 0" fill="url(#a)"/>
    <path d="m 65.976562 32 c -2.746093 0 -5.226562 1.101562 -7.027343 2.890625 c -2.273438 2.253906 -5.382813 5.109375 -8.632813 5.109375 h -28.339844 c -5.527343 0 -9.976562 4.460938 -9.976562 10 v 55.976562 c 0 5.539063 4.449219 10 9.976562 10 h 84.042969 c 5.53125 0 9.980469 -4.460937 9.980469 -10 v -63.976562 c 0 -5.539062 -4.449219 -10 -9.980469 -10 z m 0 0" fill="#a9bad6"/>
    <path d="m 57.9375 64 c -2.664062 0 -4.546875 1.632812 -5.289062 3.109375 c -0.742188 1.476563 -0.710938 2.890625 -0.710938 2.890625 l 0.0625 24.945312 l 11.992188 -4.804687 l 12.007812 4.804687 l -0.0625 -24.953124 c 0 -0.007813 0.023438 -1.414063 -0.710938 -2.882813 c -0.742187 -1.476563 -2.625 -3.109375 -5.289062 -3.109375 z m 0 4 h 12 c 1.390625 0.023438 2.007812 0.734375 2 2 l 0.046875 19.039062 l -7.992187 -3.203124 l -8.007813 3.203124 l -0.046875 -19.046874 c -0.015625 -1.296876 0.796875 -1.992188 2 -1.992188 z m 0 0" fill="#45577a"/>
</svg>
places/user-desktop.svg
<?xml version="1.0" encoding="UTF-8"?>
<svg height="128px" viewBox="0 0 128 128" width="128px" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
    <linearGradient id="a" gradientTransform="matrix(0.45451 0 0 0.455522 -1210.292114 616.172607)" gradientUnits="userSpaceOnUse" x1="2689.251953" x2="2918.069824" y1="-1106.802979" y2="-1106.802979">
        <stop offset="0" stop-color="#5d6f92"/>
        <stop offset="0.0576991" stop-color="#c3cfe3"/>
        <stop offset="0.122204" stop-color="#5d6f92"/>
        <stop offset="0.873306" stop-color="#5d6f92"/>
        <stop offset="0.955997" stop-color="#c9d2e0"/>
        <stop offset="1" stop-color="#5d6f92"/>
    </linearGradient>
    <path d="m 21.976562 12 c -5.527343 0 -9.976562 4.460938 -9.976562 10 v 86.03125 c 0 5.542969 4.449219 10 9.976562 10 h 84.042969 c 5.53125 0 9.980469 -4.457031 9.980469 -10 v -72.085938 c 0 -6.628906 -5.359375 -12 -11.972656 -12 h -46.027344 c -2.453125 0 -4.695312 -1.386718 -5.796875 -3.582031 l -1.503906 -2.992187 c -1.65625 -3.292969 -5.019531 -5.371094 -8.699219 -5.371094 z m 0 0" fill="#45577a"/>
    <path d="m 65.976562 36 c -2.746093 0 -5.226562 1.101562 -7.027343 2.890625 c -2.273438 2.253906 -5.382813 5.109375 -8.632813 5.109375 h -28.339844 c -5.527343 0 -9.976562 4.460938 -9.976562 10 v 54.03125 c 0 5.542969 4.449219 10 9.976562 10 h 84.042969 c 5.53125 0 9.980469 -4.457031 9.980469 -10 v -62.03125 c 0 -5.539062 -4.449219 -10 -9.980469 -10 z m 0 0" fill="url(#a)"/>
    <path d="m 65.976562 32 c -2.746093 0 -5.226562 1.101562 -7.027343 2.890625 c -2.273438 2.253906 -5.382813 5.109375 -8.632813 5.109375 h -28.339844 c -5.527343 0 -9.976562 4.460938 -9.976562 10 v 55.976562 c 0 5.539063 4.449219 10 9.976562 10 h 84.042969 c 5.53125 0 9.980469 -4.460937 9.980469 -10 v -63.976562 c 0 -5.539062 -4.449219 -10 -9.980469 -10 z m 0 0" fill="#a9bad6"/>
    <g fill="#45577a">
        <path d="m 50 70 v 2 h 16 v -2 z m 0 0"/>
        <path d="m 54 64 c -3.289062 0 -6 2.710938 -6 6 v 16 c 0 3.289062 2.710938 6 6 6 h 20 c 3.289062 0 6 -2.710938 6 -6 v -12 c 0 -3.289062 -2.710938 -6 -6 -6 h -7.171875 l -3.414063 -3.414062 c -0.375 -0.375 -0.882812 -0.585938 -1.414062 -0.585938 z m 0 4 h 7.171875 l 3.414063 3.414062 c 0.375 0.375 0.882812 0.585938 1.414062 0.585938 h 8 c 1.125 0 2 0.875 2 2 v 12 c 0 1.132812 -0.875 2 -2 2 h -20 c -1.125 0 -2 -0.867188 -2 -2 v -16 c 0 -1.125 0.875 -2 2 -2 z m 0 0"/>
    </g>
</svg>
places/user-home.svg
<?xml version="1.0" encoding="UTF-8"?>
<svg height="128px" viewBox="0 0 128 128" width="128px" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
    <linearGradient id="a" gradientTransform="matrix(0.45451 0 0 0.455522 -1210.292114 616.172607)" gradientUnits="userSpaceOnUse" x1="2689.251953" x2="2918.069824" y1="-1106.802979" y2="-1106.802979">
        <stop offset="0" stop-color="#5d6f92"/>
        <stop offset="0.0576991" stop-color="#c3cfe3"/>
        <stop offset="0.122204" stop-color="#5d6f92"/>
        <stop offset="0.873306" stop-color="#5d6f92"/>
        <stop offset="0.955997" stop-color="#c9d2e0"/>
        <stop offset="1" stop-color="#5d6f92"/>
    </linearGradient>
    <path d="m 21.976562 12 c -5.527343 0 -9.976562 4.460938 -9.976562 10 v 86.03125 c 0 5.542969 4.449219 10 9.976562 10 h 84.042969 c 5.53125 0 9.980469 -4.457031 9.980469 -10 v -72.085938 c 0 -6.628906 -5.359375 -12 -11.972656 -12 h -46.027344 c -2.453125 0 -4.695312 -1.386718 -5.796875 -3.582031 l -1.503906 -2.992187 c -1.65625 -3.292969 -5.019531 -5.371094 -8.699219 -5.371094 z m 0 0" fill="#45577a"/>
    <path d="m 65.976562 36 c -2.746093 0 -5.226562 1.101562 -7.027343 2.890625 c -2.273438 2.253906 -5.382813 5.109375 -8.632813 5.109375 h -28.339844 c -5.527343 0 -9.976562 4.460938 -9.976562 10 v 54.03125 c 0 5.542969 4.449219 10 9.976562 10 h 84.042969 c 5.53125 0 9.980469 -4.457031 9.980469 -10 v -62.03125 c 0 -5.539062 -4.449219 -10 -9.980469 -10 z m 0 0" fill="url(#a)"/>
    <path d="m 65.976562 32 c -2.746093 0 -5.226562 1.101562 -7.027343 2.890625 c -2.273438 2.253906 -5.382813 5.109375 -8.632813 5.109375 h -28.339844 c -5.527343 0 -9.976562 4.460938 -9.976562 10 v 55.976562 c 0 5.539063 4.449219 10 9.976562 10 h 84.042969 c 5.53125 0 9.980469 -4.460937 9.980469 -10 v -63.976562 c 0 -5.539062 -4.449219 -10 -9.980469 -10 z m 0 0" fill="#a9bad6"/>
    <path d="m 64.875 64 c -0.414062 0 -0.820312 0.132812 -1.164062 0.367188 l -14.878907 10 c -0.898437 0.648437 -1.109375 1.890624 -0.46875 2.789062 c 0.382813 0.53125 0.984375 0.84375 1.632813 0.835938 v 8.007812 c 0 3.289062 2.710937 6 6 6 h 18.003906 c 3.289062 0 6 -2.640625 6 -6 v -8.007812 c 0.648438 0.007812 1.25 -0.304688 1.632812 -0.835938 c 0.640626 -0.898438 0.429688 -2.140625 -0.46875 -2.789062 l -15.125 -10 c -0.34375 -0.234376 -0.75 -0.367188 -1.164062 -0.367188 z m 0 4.453125 l 11.125 7.140625 v 10.40625 c 0 1.125 -0.875 2 -2 2 h -8.003906 v -8 c 0 -1.109375 -0.890625 -2 -2 -2 h -2 c -1.109375 0 -2 0.890625 -2 2 v 8 h -4 c -1.125 0 -2 -0.875 -2 -2 v -10.40625 z m 0 0" fill="#45577a"/>
</svg>
places/user-trash.svg
<?xml version="1.0" encoding="UTF-8"?>
<svg height="128px" viewBox="0 0 128 128" width="128px" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
    <linearGradient id="a" gradientUnits="userSpaceOnUse" x1="17.999982" x2="109.999715" y1="70.999989" y2="70.999989">
        <stop offset="0" stop-color="#26a269"/>
        <stop offset="0.0394022" stop-color="#42d390"/>
        <stop offset="0.0869565" stop-color="#2ec27e"/>
        <stop offset="0.956524" stop-color="#2ec27e"/>
        <stop offset="1" stop-color="#26a168"/>
    </linearGradient>
    <clipPath id="b">
        <path d="m 18 32 h 92 v 82 h -92 z m 0 0"/>
    </clipPath>
    <clipPath id="c">
        <path d="m 26.65625 32 h 74.6875 c 4.78125 0 8.65625 3.875 8.65625 8.65625 v 64.6875 c 0 4.78125 -3.875 8.65625 -8.65625 8.65625 h -74.6875 c -4.78125 0 -8.65625 -3.875 -8.65625 -8.65625 v -64.6875 c 0 -4.78125 3.875 -8.65625 8.65625 -8.65625 z m 0 0"/>
    </clipPath>
    <filter id="d" height="100%" width="100%" x="0%" y="0%">
        <feColorMatrix in="SourceGraphic" type="matrix" values="0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0"/>
    </filter>
    <mask id="e">
        <g filter="url(#d)">
            <rect fill-opacity="0.2" height="128" width="128"/>
        </g>
    </mask>
    <clipPath id="f">
        <rect height="152" width="192"/>
    </clipPath>
    <linearGradient id="g" gradientTransform="matrix(1.043478 0 0 0.909091 -6.95654 -159.27274)" gradientUnits="userSpaceOnUse" x1="22" x2="114" y1="206" y2="206">
        <stop offset="0" stop-color="#deddda"/>
        <stop offset="0.0562887" stop-color="#eeedec"/>
        <stop offset="0.117776" stop-color="#deddda"/>
        <stop offset="0.892135" stop-color="#deddda"/>
        <stop offset="0.945937" stop-color="#efeeed"/>
        <stop offset="1" stop-color="#c3c2bc"/>
    </linearGradient>
    <clipPath id="h">
        <path d="m 20 12 h 6 v 24 h -6 z m 0 0"/>
    </clipPath>
    <clipPath id="i">
        <path d="m 24 12 h 80 c 2.210938 0 4 1.789062 4 4 v 16 c 0 2.210938 -1.789062 4 -4 4 h -80 c -2.210938 0 -4 -1.789062 -4 -4 v -16 c 0 -2.210938 1.789062 -4 4 -4 z m 0 0"/>
    </clipPath>
    <linearGradient id="j" gradientTransform="matrix(1.043478 0 0 0.873303 -46.695677 -45.017061)" gradientUnits="userSpaceOnUse" x1="63.916664" x2="75.416664" y1="79.029953" y2="79.029953">
        <stop offset="0" stop-color="#77767b"/>
        <stop offset="1" stop-color="#77767b" stop-opacity="0"/>
    </linearGradient>
    <clipPath id="k">
        <path d="m 20 12 h 88 v 24 h -88 z m 0 0"/>
    </clipPath>
    <clipPath id="l">
        <path d="m 24 12 h 80 c 2.210938 0 4 1.789062 4 4 v 16 c 0 2.210938 -1.789062 4 -4 4 h -80 c -2.210938 0 -4 -1.789062 -4 -4 v -16 c 0 -2.210938 1.789062 -4 4 -4 z m 0 0"/>
    </clipPath>
    <mask id="m">
        <g filter="url(#d)">
            <rect fill-opacity="0.317" height="128" width="128"/>
        </g>
    </mask>
    <linearGradient id="n" gradientTransform="matrix(-1.043478 0 0 0.873303 182.695658 -29.017061)" gradientUnits="userSpaceOnUse" x1="63.916672" x2="75.416672" y1="76.739799" y2="76.739799">
        <stop offset="0" stop-color="#ffffff"/>
        <stop offset="1" stop-color="#e8e7e8" stop-opacity="0"/>
    </linearGradient>
    <clipPath id="o">
        <rect height="152" width="192"/>
    </clipPath>
    <linearGradient id="p" gradientUnits="userSpaceOnUse">
        <stop offset="0" stop-color="#deddda"/>
        <stop offset="1" stop-color="#ffffff"/>
    </linearGradient>
    <linearGradient id="q" x1="80.428823" x2="80.499478" xlink:href="#p" y1="90.759449" y2="83.384449"/>
    <linearGradient id="r" x1="45.608907" x2="53.124498" xlink:href="#p" y1="89.499714" y2="93.999714"/>
    <linearGradient id="s" x1="64.374326" x2="57.932443" xlink:href="#p" y1="60.000004" y2="62.777791"/>
    <path d="m 26 34 h 76 c 4.417969 0 8 3.582031 8 8 v 66 c 0 4.417969 -3.582031 8 -8 8 h -76 c -4.417969 0 -8 -3.582031 -8 -8 v -66 c 0 -4.417969 3.582031 -8 8 -8 z m 0 0" fill="#26a269"/>
    <path d="m 26 30 h 76 c 4.417969 0 8 3.582031 8 8 v 68 c 0 4.417969 -3.582031 8 -8 8 h -76 c -4.417969 0 -8 -3.582031 -8 -8 v -68 c 0 -4.417969 3.582031 -8 8 -8 z m 0 0" fill="url(#a)"/>
    <g clip-path="url(#b)">
        <g clip-path="url(#c)">
            <g clip-path="url(#f)" mask="url(#e)" transform="matrix(1 0 0 1 -8 -16)">
                <path d="m 31.882812 26 h 80.234376 c 4.355468 0 7.882812 3.527344 7.882812 7.882812 v 24.234376 c 0 4.355468 -3.527344 7.882812 -7.882812 7.882812 h -80.234376 c -4.355468 0 -7.882812 -3.527344 -7.882812 -7.882812 v -24.234376 c 0 -4.355468 3.527344 -7.882812 7.882812 -7.882812 z m 0 0"/>
            </g>
        </g>
    </g>
    <path d="m 24 8 h 80 c 4.417969 0 8 3.582031 8 8 v 24 c 0 4.417969 -3.582031 8 -8 8 h -80 c -4.417969 0 -8 -3.582031 -8 -8 v -24 c 0 -4.417969 3.582031 -8 8 -8 z m 0 0" fill="url(#g)"/>
    <path d="m 24 8 h 80 c 4.417969 0 8 3.582031 8 8 v 16 c 0 4.417969 -3.582031 8 -8 8 h -80 c -4.417969 0 -8 -3.582031 -8 -8 v -16 c 0 -4.417969 3.582031 -8 8 -8 z m 0 0" fill="#f6f5f4"/>
    <path d="m 24 12 h 80 c 2.210938 0 4 1.789062 4 4 v 16 c 0 2.210938 -1.789062 4 -4 4 h -80 c -2.210938 0 -4 -1.789062 -4 -4 v -16 c 0 -2.210938 1.789062 -4 4 -4 z m 0 0" fill="#9a9996"/>
    <g clip-path="url(#h)">
        <g clip-path="url(#i)">
            <path d="m 26 12 h -6 v 24 h 6 z m 0 0" fill="url(#j)"/>
        </g>
    </g>
    <g clip-path="url(#k)">
        <g clip-path="url(#l)">
            <g clip-path="url(#o)" mask="url(#m)" transform="matrix(1 0 0 1 -8 -16)">
                <path d="m 110 28 v 24 h 6 v -24 z m 0 0" fill="url(#n)"/>
            </g>
        </g>
    </g>
    <g fill-rule="evenodd">
        <path d="m 73.804688 81.410156 l 10.390624 -6 l 3 5.199219 c 1.070313 1.855469 1.070313 4.140625 0 6 l -3 5.195313 l -2.195312 3.800781 l -6.929688 -11.996094 z m 0 0" fill="url(#q)"/>
        <path d="m 58 88 v 12 h -6 c -2.144531 0 -4.125 -1.144531 -5.195312 -3 l -3 -5.195312 l -2.195313 -3.804688 z m 0 0" fill="url(#r)"/>
        <path d="m 60.195312 72.195312 l -10.390624 -6 l 3 -5.195312 c 1.070312 -1.855469 3.050781 -3 5.195312 -3 h 10.390625 l -6.925781 12 z m 0 0" fill="url(#s)"/>
        <path d="m 64 58 l -4.390625 0.003906 l 6.925781 11.996094 l 1.269532 2.195312 l -3.464844 2 l 12.660156 1.929688 l 4.660156 -11.929688 l -3.464844 2 l -3 -5.195312 c -1.070312 -1.855469 -3.050781 -3 -5.195312 -3 z m 0 0" fill="#ffffff"/>
        <path d="m 70 84 l -8 10 l 8 10 v -4 h 6 c 2.144531 0 4.125 -1.144531 5.195312 -3 l 3 -5.195312 l 2.195313 -3.804688 h -16.390625 z m 0 0" fill="#ffffff"/>
        <path d="m 53 71.484375 l -12.660156 1.925781 l 3.464844 2 l -3 5.195313 c -1.070313 1.859375 -1.070313 4.144531 0 6 l 2.996093 5.199219 l 2.199219 3.800781 l 6.925781 -12 l 1.269531 -2.195313 l 3.464844 2 z m 0 0" fill="#ffffff"/>
    </g>
</svg>

nami's own look, on niri: nami-desktop (from nami-gui) for the bar, the launcher, notifications, the dock and the control center, and nami's theme: light windows on a quiet slate wallpaper, the greys of nami's website with one soft slate-blue accent, Geist and Geist Mono, GNOME's icons with folders in slate (namios-icons), a slim black pointer (WhiteSur's, as a Mac's, busy the colour wheel; namios-pointer, at every size Settings has), Ghostty (dark) as the terminal, and a wallpaper drawn for nami: slate blue, lighter above, a softer slate in a corner. niri reads /etc/niri/config.kdl below until someone writes their own ~/.config/niri/config.kdl; Ghostty starts with nami's theme (/etc/namios), copied into each person's own settings at their first login, theirs to change after. What they change in Settings is namios: in their user.nami.

package.nami
# nami's own look, on niri: nami-desktop (from nami-gui) for the bar, the launcher,
# notifications, the dock and the control center, and nami's
# theme: light windows on a quiet slate wallpaper, the greys of nami's
# website with one soft slate-blue accent, Geist and Geist Mono, GNOME's
# icons with folders in slate (namios-icons), a slim black pointer (WhiteSur's, as
# a Mac's, busy the colour wheel; namios-pointer, at every size Settings has), Ghostty
# (dark) as the terminal, and a wallpaper drawn for nami: slate blue, lighter above, a softer slate in a corner. niri reads /etc/niri/config.kdl below until
# someone writes their own ~/.config/niri/config.kdl; Ghostty starts with
# nami's theme (/etc/namios), copied into each person's own settings at their
# first login, theirs to change after. What they change in Settings is `namios:`
# in their user.nami.
packages:
  - niri
  - nami-gui
  # The warmer screen at night; going away when nobody's there; what's copied; a sound.
  - wlsunset
  - swayidle
  - sound-theme-freedesktop
  - wl-clipboard
  # What the emoji picker and a key held for its accents type into apps (nami-desktop).
  - wtype
  # What's playing, in the control center and its keys.
  - playerctl
  # Plugins fetched by their git address, in Settings.
  - git
  - cliphist
  - geist-font
  - namios-icons
  # A second screen: mirror, extend (Super+P).
  - namios-screens
  # Windows that tile or float, each person's (Super+Shift+T).
  - namios-windows
  - namios-dock
  - namios-pointer
  - adw-gtk3
  # Recording the screen (Super+Shift+R, Super+Shift+5), and a picture from a recording.
  - wf-recorder
  - ffmpeg_8
  # The terminal, whatever asks for one: apps through xdg-terminal-exec, and GNOME's apps.
  - ghostty
  - xdg-terminal-exec
  # Screen Sharing (Settings, General, Sharing): this screen from a Mac, an iPhone, anything with VNC.
  - wayvnc
  # And another computer's screen from here: Connect to Screen (nami-desktop) opens it in Connections.
  - gnome-connections
env:
  TERMINAL: ghostty
  # Qt's apps: on Wayland where they can, with GTK's fonts and dialogs (Qt 6: light and dark too).
  QT_QPA_PLATFORM: wayland;xcb
  QT_QPA_PLATFORMTHEME: gtk3
  # Java's apps (GeoGebra, IntelliJ, …): niri doesn't put a frame around windows, and Java
  # draws an empty window unless it's told so.
  _JAVA_AWT_WM_NONREPARENTING: "1"
  # The pointer, for what doesn't ask GTK's settings (X11's apps, Qt's, Electron's) and isn't
  # started by niri, which says the person's size to what it starts.
  XCURSOR_THEME: WhiteSur-cursors
  XCURSOR_SIZE: "32"
settings:
  org.gnome.desktop.default-applications.terminal:
    exec: ghostty
  org.gnome.desktop.interface:
    color-scheme: default
    gtk-theme: adw-gtk3
    icon-theme: nami
    cursor-theme: WhiteSur-cursors
    cursor-size: 32
    font-name: Geist 11
    document-font-name: Geist 11
    monospace-font-name: Geist Mono 11
    accent-color: slate
  # The window buttons on the left, as in every way windows go (namios-windows): Scrolling's
  # close alone (its windows don't minimize); Tiling and Floating have all three.
  org.gnome.desktop.wm.preferences:
    button-layout: "close:"
  org.gnome.desktop.peripherals.touchpad:
    tap-to-click: true
  # Files: smaller icons, more of them in a window.
  org.gnome.nautilus.icon-view:
    default-zoom-level: small-plus
  # Connections: straight to the screen asked for, not its tour first.
  org.gnome.Connections:
    first-run: false
login:
  # The lock screen's password: the password alone, so it never waits on a fingerprint
  # reader; the finger beside it, in its own (asked only once one's enrolled: fprintd).
  namios-lock: password
  namios-lock-finger: |
    auth required /run/current-system/sw/lib/security/pam_fprintd.so max-tries=3 timeout=30
    account required /run/current-system/sw/lib/security/pam_unix.so
  # Screen Sharing's sign-in: the person's own name and password.
  wayvnc: password
services:
  - nami-namios-look.service: { per-person: true }
  - nami-welcome.service: { per-person: true }
  # The time zone found by itself, when the computer's file says `timezone: auto`.
  - namios-timezone.timer
files:
  # Tools for developers and libraries' demos: not in the launcher.
  /etc/nami-os/share/applications/gtk3-demo.desktop: |
    [Desktop Entry]
    Type=Application
    Name=GTK Demo
    NoDisplay=true
  /etc/nami-os/share/applications/gtk3-icon-browser.desktop: |
    [Desktop Entry]
    Type=Application
    Name=Icon Browser
    NoDisplay=true
  /etc/nami-os/share/applications/gtk3-widget-factory.desktop: |
    [Desktop Entry]
    Type=Application
    Name=Widget Factory
    NoDisplay=true
  /etc/nami-os/share/applications/org.gtk.Demo4.desktop: |
    [Desktop Entry]
    Type=Application
    Name=GTK Demo
    NoDisplay=true
  /etc/nami-os/share/applications/org.gtk.gtk4.NodeEditor.desktop: |
    [Desktop Entry]
    Type=Application
    Name=Node Editor
    NoDisplay=true
  /etc/nami-os/share/applications/org.gtk.PrintEditor4.desktop: |
    [Desktop Entry]
    Type=Application
    Name=Print Editor
    NoDisplay=true
  /etc/nami-os/share/applications/org.gtk.Shaper.desktop: |
    [Desktop Entry]
    Type=Application
    Name=Icon Editor
    NoDisplay=true
  /etc/nami-os/share/applications/org.gtk.WidgetFactory4.desktop: |
    [Desktop Entry]
    Type=Application
    Name=Widget Factory
    NoDisplay=true
  /etc/nami-os/share/applications/org.gnome.Zenity.desktop: |
    [Desktop Entry]
    Type=Application
    Name=Zenity
    NoDisplay=true
  /etc/nami-os/share/applications/cups.desktop: |
    [Desktop Entry]
    Type=Application
    Name=Printers
    NoDisplay=true
  /etc/nami-os/share/applications/geoclue-where-am-i.desktop: |
    [Desktop Entry]
    Type=Application
    Name=Where Am I
    NoDisplay=true
  # namiOS's welcome (nami-gui --welcome): its own name and mark in the bar and the dock,
  # not Settings'. Not in the launcher: Settings opens it again (Welcome).
  /etc/nami-os/share/applications/nami-welcome.desktop: |
    [Desktop Entry]
    Type=Application
    Name=Welcome
    Comment=A few short pages to find your way in namiOS
    Exec=nami-gui --welcome
    Icon=nami-gui
    NoDisplay=true
  # Screenshots and recording, in the launcher too (Super+Shift+5).
  /etc/nami-os/share/applications/nami-screenshot.desktop: |
    [Desktop Entry]
    Type=Application
    Name=Screenshot
    GenericName=Screenshots and screen recording
    Comment=A picture of the screen, a window or an area, or a recording of it (Super+Shift+5)
    Keywords=screen;capture;grab;print;record;recording;video;snip;
    Icon=/etc/namios/screenshot.svg
    Exec=/run/current-system/sw/bin/nami-desktop capture
    Categories=Utility;
  /etc/namios/screenshot.svg: |
    <svg xmlns="http://www.w3.org/2000/svg" width="128" height="128" viewBox="0 0 128 128"><rect x="8" y="8" width="112" height="112" rx="26" fill="#33394a"/><g fill="none" stroke="#cdd3de" stroke-width="7" stroke-linecap="round"><path d="M30 46V38a8 8 0 0 1 8-8h8M82 30h8a8 8 0 0 1 8 8v8M98 82v8a8 8 0 0 1-8 8h-8M46 98h-8a8 8 0 0 1-8-8v-8"/></g><circle cx="64" cy="64" r="13" fill="#e08a8a"/></svg>
  /etc/nami-os/share/applications/vim.desktop: |
    [Desktop Entry]
    Type=Application
    Name=Vim
    NoDisplay=true
  /etc/nami-os/share/applications/nami-monitor.desktop: |
    [Desktop Entry]
    Type=Application
    Name=System Monitor
    Comment=See what's running, and how the computer is doing
    Icon=nami-monitor
    Exec=/run/current-system/sw/bin/nami-desktop processes
    Terminal=false
    Categories=GTK;System;Monitor;
    Keywords=task manager activity processes cpu memory ram disk network kill htop;
  /etc/xdg/xdg-terminals.list: |
    com.mitchellh.ghostty.desktop
  # Geist for whatever asks for just "a font": Qt's apps, X11's, web pages that don't say.
  /etc/fonts/conf.d/50-namios-fonts.conf: |
    <?xml version='1.0'?>
    <!DOCTYPE fontconfig SYSTEM 'urn:fontconfig:fonts.dtd'>
    <fontconfig>
      <alias binding="same"><family>sans-serif</family><prefer><family>Geist</family></prefer></alias>
      <alias binding="same"><family>system-ui</family><prefer><family>Geist</family></prefer></alias>
      <alias binding="same"><family>monospace</family><prefer><family>Geist Mono</family></prefer></alias>
    </fontconfig>
  /etc/niri/config.kdl: |
    // namiOS: niri with nami-desktop, from nami's namios-look.
    // Yours to change: copy it to ~/.config/niri/config.kdl first.
    input {
        // (Num Lock, tap to click, natural scrolling: as this person has them, below.)
        focus-follows-mouse max-scroll-amount="0%"
    }

    layout {
        gaps 12
        center-focused-column "never"
        preset-column-widths {
            proportion 0.33333
            proportion 0.5
            proportion 0.66667
        }
        default-column-width { proportion 0.5; }
        // (nami-desktop has it follow light, dark and the accent: desktop.kdl, below.)
        focus-ring {
            width 2
            active-color "#8d95a5"
            inactive-color "#3f3f46"
        }
        border { off; }
        shadow { on; }
        // Where a window will land as it's dragged (and snaps, when it floats).
        insert-hint { color "#8d95a566"; }
    }

    // namiOS's desktop: the wallpaper, the bar, the dock and all that's around windows.
    // (If it ever stops, however it stops, it comes back for as long as there's a session;
    // the loop ends only when another desktop is the one running.)
    spawn-sh-at-startup "while [ -S \"$NIRI_SOCKET\" ]; do /run/current-system/sw/bin/nami-desktop; pgrep -xu \"$(id -u)\" nami-desktop >/dev/null && break; sleep 1; done"

    // The wallpaper behind the workspaces too, in the overview and as they move.
    layer-rule {
        match namespace="^nami-desktop:backdrop$"
        place-within-backdrop true
    }

    // Windows come and go quickly, from nearly their size (niri's own grows them from half of it).
    animations {
        window-open {
            duration-ms 130
            curve "ease-out-expo"
            custom-shader r"
                vec4 open_color(vec3 coords_geo, vec3 size_geo) {
                    float p = niri_clamped_progress;
                    float scale = mix(0.95, 1.0, p);
                    vec3 at = vec3((coords_geo.xy - vec2(0.5)) / scale + vec2(0.5), 1.0);
                    if (at.x < 0.0 || at.x > 1.0 || at.y < 0.0 || at.y > 1.0) return vec4(0.0);
                    return texture2D(niri_tex, (niri_geo_to_tex * at).st) * p;
                }
            "
        }
        window-close {
            duration-ms 110
            curve "ease-out-quad"
            custom-shader r"
                vec4 close_color(vec3 coords_geo, vec3 size_geo) {
                    float p = niri_clamped_progress;
                    float scale = mix(1.0, 0.96, p);
                    vec3 at = vec3((coords_geo.xy - vec2(0.5)) / scale + vec2(0.5), 1.0);
                    if (at.x < 0.0 || at.x > 1.0 || at.y < 0.0 || at.y > 1.0) return vec4(0.0);
                    return texture2D(niri_tex, (niri_geo_to_tex * at).st) * (1.0 - p);
                }
            "
        }
    }
    // Alt+Tab is the desktop's own (below): not niri's.
    recent-windows { off; }

    prefer-no-csd
    screenshot-path "~/Pictures/Screenshots/Screenshot from %Y-%m-%d %H-%M-%S.png"
    hotkey-overlay { skip-at-startup; }

    cursor {
        xcursor-theme "WhiteSur-cursors"
        xcursor-size 32
    }

    window-rule {
        geometry-corner-radius 12
        clip-to-geometry true
    }

    // Settings: a window of its own, in the middle.
    window-rule {
        match app-id="^nami-gui$"
        open-floating true
        default-column-width { fixed 980; }
        // (Its height its own: Settings asks for as tall as the sidebar wants, on a small screen
        // too, no taller than this. A height given here it's first drawn at, then made its own
        // after it's open: the window shrinking from the bottom, as if it went up.)
        max-height 780
    }

    // System Monitor: a window of its own, too.
    window-rule {
        match app-id="^nami-monitor$"
        open-floating true
        default-column-width { fixed 920; }
        default-window-height { fixed 640; }
    }

    // Files: wide enough for its sidebar, as a Finder window always has it (narrower, Files
    // lays its sidebar over the folder instead).
    window-rule {
        match app-id="^org\\.gnome\\.Nautilus$"
        default-column-width { fixed 960; }
        default-window-height { fixed 600; }
    }

    // Choosing a file, for any app: over what asked, not behind it.
    window-rule {
        match app-id="^org\\.gnome\\.Nautilus$" title="^(Choose|Open|Save|Select|Pick|Upload|Export|Import)"
        open-floating true
        default-column-width { fixed 860; }
        default-window-height { fixed 560; }
    }
    // Super+P's question, and any script's, floats in the middle, its own size.
    window-rule {
        match app-id="^(org\\.gnome\\.)?[Zz]enity$"
        open-floating true
    }
    // Quick Look (Space in Files) floats over Files, in the middle, as big as what it shows.
    window-rule {
        match app-id="^org\\.gnome\\.NautilusPreviewer$"
        open-floating true
    }
    // namiOS's welcome floats in the middle, its own size.
    window-rule {
        match app-id="^nami-welcome$"
        open-floating true
        default-column-width { fixed 720; }
        default-window-height { fixed 540; }
    }

    // What Super+Shift+/ lists: the titles here, in plain words.
    binds {
        // (The desktop's own list of them, made from these as niri has them: nami-desktop asks.)
        Mod+Shift+Slash hotkey-overlay-title="Keyboard shortcuts" { spawn "/run/current-system/sw/bin/nami-desktop" "keys"; }

        // The desktop
        Mod+Space hotkey-overlay-title="Find apps, files, settings, sums" { spawn "/run/current-system/sw/bin/nami-desktop" "launcher"; }
        Mod+D { spawn "/run/current-system/sw/bin/nami-desktop" "launcher"; }
        // Every app, in a grid over the screen (a Mac's Launchpad); its key on a Mac's keyboard too.
        Mod+Shift+A hotkey-overlay-title="All Apps" { spawn "/run/current-system/sw/bin/nami-desktop" "all-apps"; }
        XF86LaunchB { spawn "/run/current-system/sw/bin/nami-desktop" "all-apps"; }
        Mod+V hotkey-overlay-title="What you've copied" { spawn "/run/current-system/sw/bin/nami-desktop" "clipboard"; }
        Mod+N hotkey-overlay-title="Notifications" { spawn "/run/current-system/sw/bin/nami-desktop" "notifications"; }
        Mod+Shift+N hotkey-overlay-title="Do Not Disturb: on or off" { spawn "/run/current-system/sw/bin/nami-desktop" "focus"; }
        Mod+Comma hotkey-overlay-title="Settings" { spawn "/run/current-system/sw/bin/nami-desktop" "settings"; }
        Mod+A hotkey-overlay-title="Control center" { spawn "/run/current-system/sw/bin/nami-desktop" "controls"; }
        Mod+Shift+C hotkey-overlay-title="Calendar" { spawn "/run/current-system/sw/bin/nami-desktop" "calendar"; }
        Mod+Shift+M hotkey-overlay-title="The desktop's menu" { spawn "/run/current-system/sw/bin/nami-desktop" "desktop-menu"; }
        // The keys to the bar, as a Mac's Ctrl+F2: along it with the arrows, Enter opens.
        Ctrl+F2 hotkey-overlay-title="Go to the menu bar" { spawn "/run/current-system/sw/bin/nami-desktop" "menu-bar"; }
        Mod+Shift+Space hotkey-overlay-title="Next keyboard layout" { switch-layout "next"; }
        Mod+Period hotkey-overlay-title="Emoji and symbols" { spawn "/run/current-system/sw/bin/nami-desktop" "emoji"; }
        Ctrl+Shift+Escape hotkey-overlay-title="System Monitor" { spawn "/run/current-system/sw/bin/nami-desktop" "processes"; }
        Mod+P hotkey-overlay-title="Second screen: mirror, extend" { spawn "/etc/namios/screens" "pick"; }
        Mod+Shift+T hotkey-overlay-title="Windows: Scrolling, Tiling or Floating" { spawn "/etc/namios/windows" "toggle"; }
        XF86Display allow-when-locked=true { spawn "/etc/namios/screens" "next"; }
        Super+Alt+L hotkey-overlay-title="Lock the screen" { spawn "/run/current-system/sw/bin/nami-desktop" "lock"; }
        XF86AudioRaiseVolume allow-when-locked=true { spawn "/run/current-system/sw/bin/nami-desktop" "sound" "up"; }
        XF86AudioLowerVolume allow-when-locked=true { spawn "/run/current-system/sw/bin/nami-desktop" "sound" "down"; }
        XF86AudioMute allow-when-locked=true { spawn "/run/current-system/sw/bin/nami-desktop" "sound" "mute"; }
        XF86AudioPlay allow-when-locked=true { spawn "playerctl" "play-pause"; }
        XF86AudioNext allow-when-locked=true { spawn "playerctl" "next"; }
        XF86AudioPrev allow-when-locked=true { spawn "playerctl" "previous"; }
        XF86MonBrightnessUp allow-when-locked=true { spawn "/run/current-system/sw/bin/nami-desktop" "brightness" "up"; }
        XF86MonBrightnessDown allow-when-locked=true { spawn "/run/current-system/sw/bin/nami-desktop" "brightness" "down"; }
        // A quarter of a step, as a Mac's Option-Shift with them.
        Shift+Alt+XF86AudioRaiseVolume allow-when-locked=true { spawn "/run/current-system/sw/bin/nami-desktop" "sound" "up" "fine"; }
        Shift+Alt+XF86AudioLowerVolume allow-when-locked=true { spawn "/run/current-system/sw/bin/nami-desktop" "sound" "down" "fine"; }
        Shift+Alt+XF86MonBrightnessUp allow-when-locked=true { spawn "/run/current-system/sw/bin/nami-desktop" "brightness" "up" "fine"; }
        Shift+Alt+XF86MonBrightnessDown allow-when-locked=true { spawn "/run/current-system/sw/bin/nami-desktop" "brightness" "down" "fine"; }
        // The keyboard's light, where it has one.
        XF86KbdBrightnessUp allow-when-locked=true { spawn "/run/current-system/sw/bin/nami-desktop" "keyboard" "up"; }
        XF86KbdBrightnessDown allow-when-locked=true { spawn "/run/current-system/sw/bin/nami-desktop" "keyboard" "down"; }
        XF86KbdLightOnOff allow-when-locked=true { spawn "/run/current-system/sw/bin/nami-desktop" "keyboard" "toggle"; }

        // Apps
        Mod+T hotkey-overlay-title="Open a terminal" { spawn "ghostty"; }
        Mod+E hotkey-overlay-title="Open Files" { spawn "nautilus"; }
        Mod+B hotkey-overlay-title="Open Firefox" { spawn "firefox"; }

        // Windows
        Mod+O repeat=false hotkey-overlay-title="See all windows" { toggle-overview; }
        // Going between apps: held, Tab again for the next, Shift back; let go to go there.
        // With ` it's the app's windows. (niri's own, with pictures of the windows, is off.)
        Alt+Tab hotkey-overlay-title="Go between apps" { spawn "/run/current-system/sw/bin/nami-desktop" "switcher"; }
        Alt+Shift+Tab { spawn "/run/current-system/sw/bin/nami-desktop" "switcher" "back"; }
        Mod+Tab hotkey-overlay-title="Go between apps" { spawn "/run/current-system/sw/bin/nami-desktop" "switcher"; }
        Mod+Shift+Tab { spawn "/run/current-system/sw/bin/nami-desktop" "switcher" "back"; }
        Alt+grave hotkey-overlay-title="Go between the app's windows" { spawn "/run/current-system/sw/bin/nami-desktop" "switcher" "windows"; }
        Alt+Shift+grave { spawn "/run/current-system/sw/bin/nami-desktop" "switcher" "windows" "back"; }
        Mod+grave hotkey-overlay-title="Go between the app's windows" { spawn "/run/current-system/sw/bin/nami-desktop" "switcher" "windows"; }
        Mod+Shift+grave { spawn "/run/current-system/sw/bin/nami-desktop" "switcher" "windows" "back"; }
        // A floating window to half the screen, all of it (again: back), or as it was.
        Mod+Alt+Left  hotkey-overlay-title="Window: the left half" { snap-window "left"; }
        Mod+Alt+Right hotkey-overlay-title="Window: the right half" { snap-window "right"; }
        Mod+Alt+Up    hotkey-overlay-title="Window: fill the screen, or back" { snap-window "fill"; }
        Mod+Alt+Down  hotkey-overlay-title="Wi
…
checks.nami
# How to tell namios-look works, on a computer nami made (tests/usb.sh and
# tests/vm-quick.sh tests/namios run these).
"niri's config from namios-look is valid":
  run: niri validate -c /etc/niri/config.kdl 2>&1
  expect: "valid"
"the lock screen and what it needs are there (nami-desktop's own: no Quickshell)":
  # (Until the next start after an update, the running system hasn't got it.)
  run: ( n=$(ls -d /nix/var/nami/os/system-* | sort -t- -k2 -n | tail -1); [ "$(readlink -f /run/current-system)" = "$(readlink -f "$n")" ] || { echo there; exit 0; }; command -v nami-desktop swayidle wlsunset cliphist >/dev/null && ls /etc/pam.d/namios-lock >/dev/null && ! command -v quickshell >/dev/null && [ ! -e /etc/namios/lock ] && echo there )
  expect: "^there"
"nami's fonts: Geist and Geist Mono":
  run: "fc-list : family | grep -cE '^Geist( Mono)?(,|$)' | sed 's/^/N=/'"
  expect: "N=[1-9]"
"the light theme, the icons and the cursor":
  run: dconf read /org/gnome/desktop/interface/gtk-theme; dconf read /org/gnome/desktop/interface/icon-theme; ls -d /run/current-system/sw/share/icons/WhiteSur-cursors/cursors/wait /run/current-system/sw/share/themes/adw-gtk3 2>&1
  expect: "^'adw-gtk3'"
"in the desktop: the pointer is WhiteSur's, as a Mac's: GTK's, niri's, and what niri starts (X11's and Qt's apps read that), its busy ones too, drawn at every size Settings has (24, 32, 48, 64) and twice those":
  run: t=/run/current-system/sw/share/icons/WhiteSur-cursors/cursors; n=$(od -An -tu4 -j12 -N4 $t/left_ptr); echo "gtk=$(gsettings get org.gnome.desktop.interface cursor-theme) niri=$(tr '\0' '\n' < /proc/$(pgrep -u "$USER" -xo niri)/environ | sed -n 's/^XCURSOR_THEME=//p')/$(tr '\0' '\n' < /proc/$(pgrep -u "$USER" -xo niri)/environ | sed -n 's/^XCURSOR_SIZE=//p') busy=$(ls $t/watch $t/progress $t/left_ptr 2>/dev/null | wc -l) sizes=$(od -An -tu4 -j16 -N$((n * 12)) $t/left_ptr | tr -s ' ' '\n' | sed '/^$/d' | awk 'NR % 3 == 2' | sort -nu | tr '\n' ' ')"
  expect: "^gtk='WhiteSur-cursors' niri=WhiteSur-cursors/32 busy=3 sizes=24 30 32 36 48 64 72 96 128 $"
"the icons: nami's, GNOME's with folders in slate":
  run: echo "$(dconf read /org/gnome/desktop/interface/icon-theme) $(grep -c 45577a /run/current-system/sw/share/icons/nami/scalable/places/folder.svg)"
  expect: "^'nami' [1-9]"
# (One the theme hasn't got is drawn as its name's first letter: Go Back in Time's was a "G".)
"namiOS's own apps in the launcher each have an icon that's there":
  run: m=; for f in /etc/nami-os/share/applications/*.desktop; do grep -q '^NoDisplay=true' "$f" && continue; i=$(sed -n 's/^Icon=//p' "$f" | head -1); [ -n "$i" ] || continue; case $i in /*) [ -s "$i" ] && continue ;; *) for d in /etc/nami-os/share /run/current-system/sw/share; do ls $d/icons/*/*/*/"$i".* $d/pixmaps/"$i".* 2>/dev/null; done | grep -q . && continue ;; esac; m="$m $i"; done; echo "missing=$m"
  expect: "^missing=$"
"in the desktop: niri started, with its config":
  run: pgrep -u "$USER" -x niri >/dev/null && NIRI_SOCKET=$(ls /run/user/$(id -u)/niri.*.sock | head -1) niri msg outputs
  expect: "Output"
"Ghostty is the terminal ($TERMINAL, xdg-terminal-exec's list)":
  run: echo "TERMINAL=$TERMINAL"; cat /etc/xdg/xdg-terminals.list; command -v ghostty xdg-terminal-exec
  expect: "TERMINAL=ghostty"
"in the desktop: the welcome opened once, at the first login":
  # (It leaves this behind as it opens: the first login may have been an
  # earlier one, like the one right after a first start's setup.)
  run: for i in $(seq 30); do [ -e ~/.local/state/nami/welcomed ] && break; sleep 2; done; ls ~/.local/state/nami/welcomed
  expect: "/welcomed$"
"namiOS's own niri runs, not the catalog's":
  # (Until the next start after an update, the running system hasn't got it.)
  run: ( n=$(ls -d /nix/var/nami/os/system-* | sort -t- -k2 -n | tail -1); [ "$(readlink -f /run/current-system)" = "$(readlink -f "$n")" ] || { echo there; exit 0; }; readlink -f "$(command -v niri)" | grep -q "niri-26.04-nami" && echo there )
  expect: "^there"
"in the desktop: libadwaita's apps have nami's colours":
  run: grep -c namios/gtk-colors.css ~/.config/gtk-4.0/gtk.css
  expect: "^1$"
"in the desktop: GTK3's apps have the theme's colours, in light's theme and dark's, for open apps to change cleanly":
  run: ( t=~/.local/share/themes; l=$(sed -n 's/^@define-color window_bg_color \(.*\);/\1/p' $t/adw-gtk3/gtk-3.0/gtk.css); d=$(sed -n 's/^@define-color window_bg_color \(.*\);/\1/p' $t/adw-gtk3-dark/gtk-3.0/gtk.css); grep -q '@import url("file:///.*/themes/adw-gtk3-dark/gtk-3.0/gtk.css")' $t/adw-gtk3-dark/gtk-3.0/gtk.css && i=imports; [ -n "$l" ] && [ -n "$d" ] && [ "$l" != "$d" ] && c=two; echo "$(grep -c nami-theme.css ~/.config/gtk-3.0/gtk.css) $i $c" )
  expect: "^1 imports two$"
"Geist is the font when none is named":
  run: echo "$(fc-match -f '%{family}' sans-serif) / $(fc-match -f '%{family}' monospace)"
  expect: "^Geist.* / Geist Mono"
"in the desktop: the portal answers light or dark, with no GNOME Shell":
  run: busctl --user call org.freedesktop.portal.Desktop /org/freedesktop/portal/desktop org.freedesktop.portal.Settings ReadOne ss org.freedesktop.appearance color-scheme
  expect: "^v u [01]"
"in the desktop: namiOS's own bar is on each screen, and takes the room at the top":
  run: ( export NIRI_SOCKET=$(ls /run/user/$(id -u)/niri.*.sock | head -1); bars=$(niri msg layers | grep -c '"nami-desktop:bar"'); screens=$(niri msg -j outputs | jq 'length'); [ "$bars" = "$screens" ] && a=each; pgrep -u "$(id -u)" -x nami-desktop >/dev/null && b=running; echo "$a $b" )
  expect: "^each running$"
"in the desktop: namiOS's own desktop is the notification service":
  run: gdbus call --session --dest org.freedesktop.Notifications --object-path /org/freedesktop/Notifications --method org.freedesktop.Notifications.GetServerInformation
  expect: "nami-desktop"
"in the desktop: namiOS's own desktop opens its launcher, control center and power menu, and closes them":
  run: ( export NIRI_SOCKET=$(ls /run/user/$(id -u)/niri.*.sock | head -1); out=""; for w in launcher:launcher controls:controls power:power notifications:notification-list; do c=${w%%:*}; l=${w##*:}; nami-desktop "$c"; for i in 1 2 3 4 5 6 7 8; do sleep 1; a=$(niri msg layers | grep -c "nami-desktop:$l\""); [ "$a" = 0 ] || break; done; nami-desktop "$c"; for i in 1 2 3 4 5 6 7 8; do sleep 1; b=$(niri msg layers | grep -c "nami-desktop:$l\""); [ "$b" != 0 ] || break; done; out="$out $c=$a$b"; done; echo "$out" )
  expect: "launcher=10 controls=10 power=10 notifications=10"
"in the desktop: the sound keys change the sound a sixteenth, and show its level (in the island, the speakers by their name)":
  run: ( export NIRI_SOCKET=$(ls /run/user/$(id -u)/niri.*.sock | head -1); r=/run/user/$(id -u); w=$(wpctl get-volume @DEFAULT_AUDIO_SINK@); v=$(echo "$w" | awk '{print $2}'); m=0; case $w in *MUTED*) m=1 ;; esac; wpctl set-mute @DEFAULT_AUDIO_SINK@ 0; wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.5; rm -f $r/nami-desktop-level; nami-desktop sound down; sleep 1; b=$(wpctl get-volume @DEFAULT_AUDIO_SINK@ | awk '{print $2}'); s=$(cat $r/nami-desktop-level 2>/dev/null); nami-desktop sound up; sleep 3; a=$(wpctl get-volume @DEFAULT_AUDIO_SINK@ | awk '{print $2}'); g=$(niri msg layers | grep -c '"nami-desktop:level"'); wpctl set-volume @DEFAULT_AUDIO_SINK@ "$v"; wpctl set-mute @DEFAULT_AUDIO_SINK@ $m; echo "down=$b up=$a $s gone=$g" )
  expect: "^down=0.44 up=0.50 icon=volume-2 percent=44 muted=no in=island name=Speakers gone=0$"
"in the desktop: what's picked in Settings reaches niri, and niri accepts it":
  run: ( export NIRI_SOCKET=$(ls /run/user/$(id -u)/niri.*.sock | head -1); cp ~/user.nami /tmp/s.$$; printf '{"set":{"path":["namios","mouse","speed"],"value":"fast"}}' | nami config json - --file ~/user.nami >/dev/null 2>&1; printf '{"set":{"path":["namios","trackpad","tap"],"value":false}}' | nami config json - --file ~/user.nami >/dev/null 2>&1; printf '{"set":{"path":["namios","keyboard","rate"],"value":"fast"}}' | nami config json - --file ~/user.nami >/dev/null 2>&1; sleep 3; a=$(grep -c 'accel-speed 0.4' ~/.local/state/nami/desktop.kdl); b=$(grep -c 'tap false' ~/.local/state/nami/desktop.kdl); niri validate -c /etc/niri/config.kdl >/dev/null 2>&1 && v=valid; cat /tmp/s.$$ > ~/user.nami; rm -f /tmp/s.$$; sleep 3; echo "speed=$a tap=$b $v" )
  expect: "^speed=1 tap=0 valid$"
"in the desktop: the wallpaper is namiOS's own, on each screen":
  run: ( export NIRI_SOCKET=$(ls /run/user/$(id -u)/niri.*.sock | head -1); [ "$(niri msg layers | grep -c '"nami-desktop:wallpaper"')" = "$(niri msg -j outputs | jq 'length')" ] && echo each )
  expect: "^each$"
"in the desktop: it watches for being away, and keeps what's copied":
  run: pgrep -u "$USER" -x swayidle >/dev/null && echo away; pgrep -u "$USER" -f '^wl-paste --watch cliphist' >/dev/null && echo copied
  expect: "copied"
"in the desktop: what's copied can be got back":
  run: export WAYLAND_DISPLAY=$(basename "$(ls /run/user/$(id -u)/wayland-* | grep -v lock | head -1)"); printf 'nami-check-%s' "$$" | wl-copy; sleep 2; cliphist list | head -1
  expect: "nami-check-"
"in the desktop: polkit asks here":
  run: journalctl --user -b --no-pager 2>/dev/null | grep -c 'no polkit' | sed 's/^/refused=/'
  expect: "^refused=0$"
"joining a Wi-Fi network takes no admin's password":
  run: grep -c 'isInGroup("networkmanager") && action.id.indexOf("org.freedesktop.NetworkManager.")' /etc/static/polkit-1/rules.d/20-desktop.rules | sed 's/^/rule=/'
  expect: "^rule=1$"
"the shell before nami-desktop is gone":
  run: ( n=$(ls -d /nix/var/nami/os/system-* | sort -t- -k2 -n | tail -1); [ "$(readlink -f /run/current-system)" = "$(readlink -f "$n")" ] || { echo there; exit 0; }; command -v dms || echo there )
  expect: "^there"
"in the desktop: nothing it started is left unfinished":
  run: ps -o stat= --ppid "$(pgrep -xo nami-desktop)" | grep -c '^Z' | sed 's/^/zombies=/'
  expect: "^zombies=0$"
"in the desktop: it doesn't ask lsblk and wpctl every moment":
  run: ( p=$(pgrep -xo nami-desktop); a=$(awk '{print $16+$17}' /proc/$p/stat); sleep 20; b=$(awk '{print $16+$17}' /proc/$p/stat); [ $((b-a)) -lt 30 ] && echo calm || echo "busy=$((b-a))" )
  expect: "^calm$"
"in the desktop: a screenshot is saved in Pictures/Screenshots, copied, and shown in the corner for a moment":
  run: ( export NIRI_SOCKET=$(ls /run/user/$(id -u)/niri.*.sock | head -1) WAYLAND_DISPLAY=$(basename "$(ls /run/user/$(id -u)/wayland-* | grep -v lock | head -1)"); d=~/Pictures/Screenshots; a=$(ls "$d" 2>/dev/null | wc -l); niri msg action screenshot-screen; sleep 3; b=$(ls "$d" 2>/dev/null | wc -l); wl-paste -l | grep -qx image/png && c=copied; s=$(niri msg layers | grep -c '"nami-desktop:shot"'); sleep 9; g=$(niri msg layers | grep -c '"nami-desktop:shot"'); echo "saved=$((b-a)) $c shown=$s gone=$g" )
  expect: "^saved=1 copied shown=1 gone=0$"
"in the desktop: one a script takes somewhere else isn't shown":
  run: ( export NIRI_SOCKET=$(ls /run/user/$(id -u)/niri.*.sock | head -1); niri msg action screenshot-screen --path /tmp/nami-check-shot.png; sleep 3; s=$(niri msg layers | grep -c '"nami-desktop:shot"'); rm -f /tmp/nami-check-shot.png; echo "shown=$s" )
  expect: "^shown=0$"
"in the desktop: Super+Shift+5's tools open, and close":
  run: ( export NIRI_SOCKET=$(ls /run/user/$(id -u)/niri.*.sock | head -1); nami-desktop capture; sleep 2; a=$(niri msg layers | grep -c '"nami-desktop:capture"'); nami-desktop capture; sleep 2; b=$(niri msg layers | grep -c '"nami-desktop:capture"'); echo "open=$a closed=$b" )
  expect: "^open=1 closed=0$"
# (Shown in the corner for a few seconds as it stops: looked for then, not after.)
"in the desktop: recording the screen, and stopping it: a video, shown in the corner":
  run: ( export NIRI_SOCKET=$(ls /run/user/$(id -u)/niri.*.sock | head -1); nami-desktop record; sleep 5; r=$(pgrep -u "$(id -u)" -xc wf-recorder); nami-desktop record; l=0; for i in $(seq 50); do niri msg layers | grep -q '"nami-desktop:shot"' && { l=1; break; }; sleep 0.2; done; nami-desktop shot dismiss; sleep 1; s=$(pgrep -u "$(id -u)" -xc wf-recorder); f=$(ls -t ~/Videos/"Screen Recordings"/*.mp4 2>/dev/null | head -1); [ -s "$f" ] && ffmpeg -v error -i "$f" -f null - >/dev/null 2>&1 && v=video; echo "recording=$r stopped=$s $v shown=$l" )
  expect: "^recording=1 stopped=0 video shown=1$"
"in the desktop: where screenshots go, from Settings, reaches niri":
  run: ( cp ~/user.nami /tmp/s.$$; printf '{"set":{"path":["namios","screenshots","folder"],"value":"Desktop"}}' | nami config json - --file ~/user.nami >/dev/null 2>&1; sleep 3; a=$(grep -c 'screenshot-path "~/Desktop/' ~/.local/state/nami/desktop.kdl); niri validate -c /etc/niri/config.kdl >/dev/null 2>&1 && v=valid; cat /tmp/s.$$ > ~/user.nami; rm -f /tmp/s.$$; sleep 3; echo "folder=$a $v" )
  expect: "^folder=1 valid$"
"the lock screen: the password alone, the finger beside it in its own (fprintd's, once one's enrolled)":
  run: grep -c pam_fprintd /etc/pam.d/namios-lock /etc/pam.d/namios-lock-finger | tr '\n' ' '
  expect: "namios-lock:0 .*namios-lock-finger:1"
"in the desktop: the login screen's copy of the wallpaper, in your own state folder":
  run: f=~/.local/state/nami/login-wallpaper.png; [ "$(head -c 8 "$f" | od -An -tx1 | tr -d ' \n')" = 89504e470d0a1a0a ] && p=png; echo "$p $(sed -n 1p ~/.local/state/nami/login-look)"
  expect: "^png (light|dark)$"

namiOS's pointer: WhiteSur's (vinceliuice/WhiteSur-cursors, GPL-3.0, the same commit as nixpkgs' whitesur-cursors), a slim black arrow as a Mac's; busy is the spinning colour wheel, and busy while you can still click is the arrow with a small wheel under it. Drawn here from its own SVGs, at the sizes WhiteSur ships (24, 30, 36, 48) and at the ones it doesn't that Settings' pointer sizes ask for (Medium 32, Larger 64), and at twice each for a screen at 200% (72, 96, 128), so no size is a smaller one the program picked instead. The theme is still called WhiteSur-cursors. namios-look and namios-greeter list it.

package.nami
# namiOS's pointer: WhiteSur's (vinceliuice/WhiteSur-cursors, GPL-3.0, the
# same commit as nixpkgs' whitesur-cursors), a slim black arrow as a Mac's;
# busy is the spinning colour wheel, and busy while you can still click is
# the arrow with a small wheel under it. Drawn here from its own SVGs, at the
# sizes WhiteSur ships (24, 30, 36, 48) and at the ones it doesn't that
# Settings' pointer sizes ask for (Medium 32, Larger 64), and at twice each
# for a screen at 200% (72, 96, 128), so no size is a smaller one the program
# picked instead. The theme is still called WhiteSur-cursors. namios-look and
# namios-greeter list it.
name: namios-pointer
version: 0-unstable-2025-01-13
source:
  url: https://github.com/vinceliuice/WhiteSur-cursors/archive/c8759f13de18612051e7c1250946f54e49128b61.tar.gz
  name: WhiteSur-cursors-c8759f13.tar.gz
  sha256: 08d79c80d8f2ce12f2e8892ea63e1c32cf23a2205c3eaa4a59731dbe2f919f76
build-deps: [librsvg.out, xcursorgen]
install: |
  sizes="24 30 32 36 48 64 72 96 128"
  png=$PWD/png
  # WhiteSur's pictures are a third larger than the size they're for (24's is 32 across).
  for s in $sizes; do
    mkdir -p $png/$s
    w=$(( (s * 4 + 1) / 3 ))
    for f in src/svg/*.svg; do
      rsvg-convert -w $w -h $w "$f" -o $png/$s/$(basename "$f" .svg).png
    done
  done
  d=$out/share/icons/WhiteSur-cursors/cursors
  mkdir -p $d
  for c in src/config/*.cursor; do
    n=$(basename "$c" .cursor)
    # Each size's lines from WhiteSur's 48 (its largest, x2/: 64 across), each frame's time as
    # it is; the point that clicks WhiteSur's own at its sizes, in proportion at the others.
    awk -v sizes="$sizes" -v png=$png '
      $1 == 48 { lines[++k] = $0 }
      { n[$1]++; hx[$1, n[$1]] = $2; hy[$1, n[$1]] = $3 }
      END {
        m = split(sizes, s, " ")
        for (i = 1; i <= m; i++) for (j = 1; j <= k; j++) {
          split(lines[j], f, " ")
          w = int((s[i] * 4 + 1) / 3)
          sub(/^x2\//, "", f[4])
          x = int(f[2] * w / 64 + 0.5); y = int(f[3] * w / 64 + 0.5)
          if ((s[i], j) in hx) { x = hx[s[i], j]; y = hy[s[i], j] }
          printf "%d %d %d %s/%d/%s%s\n", s[i], x, y, png, s[i], f[4], (f[5] != "" ? " " f[5] : "")
        }
      }' "$c" > cfg
    xcursorgen cfg $d/$n
  done
  # Its other names (left_ptr, watch, hand2, ...), as WhiteSur's own build makes them.
  while read -r to from; do
    [ -e "$d/$to" ] || ln -s "$from" "$d/$to"
  done < src/cursorList
  printf '[Icon Theme]\nName=WhiteSur Cursors\n' > $out/share/icons/WhiteSur-cursors/index.theme

A second screen (a projector, a TV, a monitor) on niri, which can't mirror by itself: Super+P asks in the desktop (nami-desktop): Mirror, Extend, the other screen only or this one only (a laptop's screen key goes to the next). A screen plugged in for the first time asks the same; the answer is kept for that screen, so the next time it just happens. Mirroring is wl-mirror: this screen, scaled to fit, fullscreen on the other. A monitor's brightness, from Settings' Displays, is set over its cable (DDC/CI): ddcutil, through /dev/i2c-* (the i2c-dev module), which the i2c group may use; everyone is in it. A laptop's own is its backlight (brightnessctl, niri's). namios-look lists it, and binds the keys.

package.nami
# A second screen (a projector, a TV, a monitor) on niri, which can't
# mirror by itself: Super+P asks in the desktop (nami-desktop): Mirror, Extend,
# the other screen only or this one only (a laptop's screen key goes to the next). A
# screen plugged in for the first time asks the same; the answer is kept
# for that screen, so the next time it just happens.
# Mirroring is wl-mirror: this screen, scaled to fit, fullscreen on the other.
# A monitor's brightness, from Settings' Displays, is set over its cable
# (DDC/CI): ddcutil, through /dev/i2c-* (the i2c-dev module), which the i2c
# group may use; everyone is in it. A laptop's own is its backlight
# (brightnessctl, niri's).
# namios-look lists it, and binds the keys.
packages:
  - wl-mirror
  - jq
  - libnotify
  - procps
  - zenity
  - ddcutil
groups:
  i2c: everyone
services:
  # Each person's, in their desktop session: screens coming and going.
  - nami-screens.service: { per-person: true }
files:
  /etc/modules-load.d/i2c-dev.conf: |
    i2c-dev
  /etc/udev/rules.d/60-nami-i2c.rules: |
    KERNEL=="i2c-[0-9]*", GROUP="i2c", MODE="0660"
  /etc/namios/screens:
    mode: "0755"
    content: |
      #!/bin/sh
      # nami-screens: what a second screen (a projector, a TV, a monitor) shows,
      # on niri, which can't mirror by itself: wl-mirror shows this screen on
      # the other, scaled to fit.
      #
      #   nami-screens mirror     both show this screen
      #   nami-screens extend     the other screen is more room (niri's own)
      #   nami-screens external   only the other screen
      #   nami-screens internal   only this screen
      #   nami-screens pick       ask which of those, in a window (Super+P)
      #   nami-screens next       the next of those, said in a notification
      #   nami-screens watch      as screens come and go: what was picked for that
      #                           screen last time, or ask (each person's, at login)
      #
      # "This screen" is the built-in one (eDP, LVDS, DSI), or on a computer
      # without one, the one in use when this session first looked: a screen
      # plugged in later is never it, whatever its socket's name. Each screen's
      # pick is kept, by make, model and serial, in ~/.local/state/nami/screens.
      set -u
      PATH=/run/current-system/sw/bin
      state=${XDG_STATE_HOME:-$HOME/.local/state}/nami/screens
      run=${XDG_RUNTIME_DIR:-/tmp}/nami-screens
      mkdir -p "${state%/*}" "$run"
      touch "$state"

      outputs() { niri msg -j outputs; }
      # This screen, and the others, from niri's list.
      internal() {
        all=$(outputs)
        b=$(printf '%s' "$all" | jq -r '[keys[] | select(test("^(eDP|LVDS|DSI)"))][0] // empty')
        [ -z "$b" ] || { echo "$b"; return; }
        m=$(cat "$run/main" 2>/dev/null)
        printf '%s' "$all" | jq -e --arg m "$m" 'has($m)' >/dev/null || {
          m=$(niri msg -j focused-output | jq -r '.name // empty')
          [ -n "$m" ] || m=$(printf '%s' "$all" | jq -r 'keys[0] // empty')
          [ -z "$m" ] || echo "$m" > "$run/main"
        }
        echo "$m"
      }
      others() { i=$(internal); outputs | jq -r --arg i "$i" 'keys[] | select(. != $i)'; }
      key() { outputs | jq -r --arg o "$1" '.[$o] | [.make, .model, .serial // "-"] | map(gsub("\\s+"; "_")) | join("|")'; }

      # What Settings' Displays keeps for a screen, as niri reads it.
      kept() { sed -n "/^output \"$1\" {/,/^}/s/^ *$2\\b *//p" "${XDG_STATE_HOME:-$HOME/.local/state}/nami/desktop.kdl" 2>/dev/null; }
      kept_off() { sed -n "/^output \"$1\" {/,/^}/p" "${XDG_STATE_HOME:-$HOME/.local/state}/nami/desktop.kdl" 2>/dev/null | grep -qx ' *off'; }
      # Where it was put there, or wherever there's room.
      place() {
        p=$(kept "$1" position)
        case $p in
          x=*) y=${p#* y=}; x=${p%% *}; niri msg output "$1" position set "${x#x=}" "$y" ;;
          *) niri msg output "$1" position auto ;;
        esac
      }
      # Side by side, touching, in the order they're in: kept positions go stale when another
      # screen comes on that socket, and niri's pointer crosses only between screens that touch.
      close_up() {
        outputs | jq -r '[.[] | select(.logical)] as $on
          | if ([$on[].logical.y] | unique | length) != 1 then empty else
              reduce ($on | sort_by(.logical.x))[] as $o ({x: 0, out: []};
                .out += ["\($o.name) \(.x)"]
                | .x += (($o.modes[$o.current_mode] | if ($o.logical.transform | test("90|270")) then .height else .width end) / $o.logical.scale | round))
              | .out[] end' |
        while read -r n x; do niri msg output "$n" position set "$x" 0; done
      }
      # Never every screen dark: the one left was turned off, and the other's gone.
      light() {
        all=$(outputs) || return 0
        [ "$(printf '%s' "$all" | jq '[.[] | select(.logical)] | length')" = 0 ] || return 0
        x=$(printf '%s' "$all" | jq -r 'keys[0] // empty')
        [ -z "$x" ] || niri msg output "$x" on
      }

      unmirror() { pkill -u "$(id -u)" -x wl-mirror 2>/dev/null; rm -f "$run/mirror"; }
      # What's open on screen $1 comes to screen $2, or the copy would hide it.
      gather() {
        niri msg -j workspaces | jq -r --arg o "$1" '.[] | select(.output == $o) | .id' > "$run/spaces"
        for w in $(cat "$run/spaces"); do
          for id in $(niri msg -j windows | jq -r --argjson w "$w" '.[] | select(.workspace_id == $w) | .id'); do
            niri msg action move-window-to-monitor --id "$id" "$2"
          done
        done
        rm -f "$run/spaces"
      }

      apply() {
        mode=$1 i=$(internal) o=$(others)
        [ -n "$o" ] || { unmirror; [ -n "$i" ] && niri msg output "$i" on; echo extend > "$run/mode"; return; }
        unmirror
        case $mode in
          mirror)
            niri msg output "$i" on
            # (Set, or niri puts it right beside the other.)
            niri msg output "$i" position set 0 0
            for x in $o; do
              niri msg output "$x" on
              gather "$x" "$i"
              # Away from this screen, so the pointer can't wander onto it
              # (niri moves it only between screens that touch).
              niri msg output "$x" position set 100000 100000
              setsid wl-mirror --title "nami-screens mirror" --fullscreen-output "$x" "$i" >/dev/null 2>&1 &
              echo "$!" >> "$run/mirror"
            done
            sleep 1; niri msg action focus-monitor "$i" ;;
          extend) niri msg output "$i" on; place "$i"; for x in $o; do niri msg output "$x" on; place "$x"; done; close_up ;;
          external) for x in $o; do niri msg output "$x" on; place "$x"; done; niri msg output "$i" off ;;
          internal) niri msg output "$i" on; for x in $o; do niri msg output "$x" off; done ;;
          *) echo "nami-screens: mirror, extend, external or internal, not $mode" >&2; return 1 ;;
        esac
        echo "$mode" > "$run/mode"
        for x in $o; do remember "$(key "$x")" "$mode"; done
      }

      remember() { grep -vF "$1 " "$state" > "$state.new"; echo "$1 $2" >> "$state.new"; mv "$state.new" "$state"; }
      picked() { grep -F "$1 " "$state" | tail -1 | cut -d' ' -f2; }

      say() {
        case $1 in
          mirror) t="Mirror" b="Both screens show this one." ;;
          extend) t="Extend" b="The other screen is more room." ;;
          external) t="Only the other screen" b="This screen is off." ;;
          internal) t="Only this screen" b="The other screen is off." ;;
        esac
        notify-send -a Screens -i video-display -h string:x-canonical-private-synchronous:nami-screens "$t" "$b  Super+P for the next."
      }

      # What was picked, on stdout, or nothing. In namiOS's desktop, which runs
      # this script with the answer (nothing on stdout, then). Otherwise, in
      # someone's own desktop: one window at a time. (Its buttons show last to
      # first: Mirror on top.)
      ask() {
        nami-desktop screens "$1" 2>/dev/null && return 0
        p=$(cat "$run/asking" 2>/dev/null) && kill -0 "$p" 2>/dev/null && return 0
        echo $$ > "$run/asking"
        a=$(zenity --question --switch --no-wrap --title="Second screen" --text="$1" --extra-button="Only this screen" \
              --extra-button="Only the other screen" --extra-button="Extend" --extra-button="Mirror" 2>/dev/null)
        rm -f "$run/asking"
        case $a in
          Mirror) echo mirror ;; Extend) echo extend ;;
          "Only the other screen") echo external ;; "Only this screen") echo internal ;;
        esac
      }

      case ${1:-} in
        mirror|extend|external|internal) apply "$1" ;;
        pick)
          [ -n "$(others)" ] || { notify-send -a Screens -i video-display "One screen" "Plug in a projector or a screen first."; exit 0; }
          a=$(ask "What should the second screen show?")
          [ -z "$a" ] || apply "$a" ;;
        next)
          [ -n "$(others)" ] || { notify-send -a Screens -i video-display "One screen" "Plug in a projector or a screen first."; exit 0; }
          case $(cat "$run/mode" 2>/dev/null) in
            mirror) m=extend ;; extend) m=external ;; external) m=internal ;; *) m=mirror ;;
          esac
          apply "$m" && say "$m" ;;
        watch)
          unmirror; rm -f "$run/main"; seen=$(others)
          light; close_up
          look() {
            light
            now=$(others) || return 0
            [ "$now" = "$seen" ] && return 0
            new=$(printf '%s\n' $now | grep -vxF -e "$(printf '%s\n' $seen)" || true)
            seen=$now
            if [ -z "$now" ]; then apply internal; echo extend > "$run/mode"; return 0; fi
            for x in $new; do
              # (Turned off in Settings, it stays so.)
              kept_off "$x" && continue
              p=$(picked "$(key "$x")")
              if [ -n "$p" ]; then apply "$p"; say "$p"; continue; fi
              # A screen not seen before: niri extends onto it; ask.
              ( a=$(ask "A screen was connected. What should it show?"); [ -z "$a" ] || apply "$a" ) &
            done
          }
          # niri has no event for a screen coming or going, but its workspaces move with it:
          # looked at then (and every half minute anyway), not every moment, which would be
          # a dozen programs started every 2 seconds all day.
          niri msg -j event-stream 2>/dev/null | {
            while :; do
              if read -r -t 30 line; then
                case $line in '{"WorkspacesChanged"'*|'{"Output'*) ;; *) continue ;; esac
              elif [ $? -le 128 ]; then
                break
              fi
              look
            done
            # (No events from niri: every 2 seconds, as before.)
            while sleep 2; do look; done
          } ;;
        *) sed -n '2,15s/^# \{0,1\}//p' "$0"; exit 1 ;;
      esac
  /etc/systemd/user/nami-screens.service: |
    [Unit]
    Description=Mirror or extend onto a second screen as it's plugged in
    PartOf=graphical-session.target
    After=graphical-session.target
    ConditionUser=!@system
    [Service]
    ExecStart=/etc/namios/screens watch
    Restart=on-failure
    RestartSec=5
    [Install]
    WantedBy=graphical-session.target
  /etc/nami-os/share/applications/nami-screens.desktop: |
    [Desktop Entry]
    Type=Application
    Name=Second Screen
    Comment=Mirror or extend onto a projector or another screen (Super+P)
    Icon=video-display
    Exec=/etc/namios/screens pick
    Terminal=false
    Categories=GTK;System;Settings;
    Keywords=projector;mirror;duplicate;extend;display;monitor;screen;beamer;tv;
checks.nami
# How to tell namios-screens works, on a computer nami made (tests/usb.sh and
# tests/vm-quick.sh tests/namios run these).
"a second screen: Super+P's script, and wl-mirror to mirror onto it":
  run: test -x /etc/namios/screens && command -v wl-mirror >/dev/null && echo there
  expect: "^there"
"in the desktop: watching for a second screen":
  run: systemctl --user is-active nami-screens.service
  expect: "^active"
"in the desktop: mirroring onto a second screen: this screen stays, its windows come along, the pointer can't wander, and back":
  run: ( export NIRI_SOCKET=$(ls /run/user/$(id -u)/niri.*.sock | head -1); o() { niri msg -j outputs | jq -r 'keys[]'; }; if [ "$(o | wc -l)" -lt 2 ]; then echo "one screen, nothing to mirror onto"; else main=$(niri msg -j focused-output | jq -r .name); other=$(o | grep -vx "$main" | head -1); niri msg action focus-monitor "$other"; niri msg action spawn -- ghostty --title=screens-check; sleep 4; niri msg action focus-monitor "$main"; sleep 1; niri msg action spawn -- /etc/namios/screens mirror; sleep 5; niri msg -j workspaces > /tmp/s.$$; on=$(niri msg -j windows | jq -r --slurpfile s /tmp/s.$$ '.[] | select(.title == "screens-check") | .workspace_id as $w | ($s[0][] | select(.id == $w) | .output)' | head -1); rm -f /tmp/s.$$; [ "$on" = "$main" ] && a=here; ps -eo comm | grep -q wl-mirror && b=copying; [ "$(niri msg -j focused-output | jq -r .name)" = "$main" ] && c=focused; d=$(niri msg -j outputs | jq -r --arg o "$other" --arg m "$main" 'if (.[$o].logical.x - .[$m].logical.x) > 50000 then "apart" else "beside" end'); niri msg action spawn -- /etc/namios/screens extend; sleep 2; ps -eo comm | grep -q wl-mirror || e=stopped; for id in $(niri msg -j windows | jq -r '.[] | select(.title == "screens-check") | .id'); do niri msg action close-window --id "$id"; done; echo "$a $b $c $d $e"; fi )
  expect: "^(one screen, nothing to mirror onto|here copying focused apart stopped)$"
"Super+P can ask without namiOS's shell too: zenity":
  run: command -v zenity >/dev/null && echo there
  expect: "^there"
"The second screen's chooser is in namiOS's desktop":
  # (Until the next start after an update, the running system hasn't got it.)
  run: ( n=$(ls -d /nix/var/nami/os/system-* | sort -t- -k2 -n | tail -1); [ "$(readlink -f /run/current-system)" = "$(readlink -f "$n")" ] || { echo there; exit 0; }; grep -q 'nami-desktop screens' /etc/namios/screens && echo there )
  expect: "^there"

More wallpapers to choose in Settings → Appearance (each picture in /etc/backgrounds is one). NASA's photos, all public domain, each cut to the screen's shape: blue-marble.jpg: the whole Earth, from Apollo 17 on its way to the Moon on 7 December 1972 (NASA photo AS17-148-22727, "The Blue Marble"). city-lights.jpg: the United States' east coast before dawn, from the International Space Station on 6 August 2014 (Expedition 40; NASA photo ISS040-E-089021, Reid Wiseman). clouds.jpg: clouds swirling past Guadalupe Island in the Pacific, a vortex street, from the International Space Station on 24 August 2013 (Expedition 36; NASA photo ISS036-E-035663). earthrise.jpg: the Earth over the Moon's horizon, from Apollo 8 on 24 December 1968 (NASA photo AS08-14-2383, Bill Anders; NASA Johnson's high-resolution scan, its film colour taken out). earthset.jpg: the Earth setting behind the Moon, from Orion on 6 April 2026 (Artemis II; NASA photo art002e009288). endeavour.jpg: Space Shuttle Endeavour against the Earth's edge at sunset, from the International Space Station on 9 February 2010 (STS-130; NASA photo ISS022-E-062672). Mirrored, as The Economist ran it. greenland.jpg: meltwater lakes on the Greenland ice sheet, from the Earth Observing-1 satellite on 15 June 2016 (NASA Earth Observatory image by Jesse Allen). saturn.jpg: Saturn and its rings lit from behind, the Earth a dot below them, from Cassini in Saturn's shadow on 19 July 2013 ("The Day the Earth Smiled"; NASA/JPL-Caltech/SSI, PIA17172). sea-ice.jpg: ice floes along Kamchatka's coast, from the International Space Station on 15 March 2012 (Expedition 30; NASA photo ISS030-E-162344). sunrise.jpg: the first light of an orbital sunrise along the Earth's edge, from the International Space Station on 12 January 2020 (Expedition 61; NASA photo ISS061-E-123823).

package.nami
# More wallpapers to choose in Settings → Appearance (each picture in /etc/backgrounds is one).
# NASA's photos, all public domain, each cut to the screen's shape:
# blue-marble.jpg: the whole Earth, from Apollo 17 on its way to the Moon on 7 December
# 1972 (NASA photo AS17-148-22727, "The Blue Marble").
# city-lights.jpg: the United States' east coast before dawn, from the International
# Space Station on 6 August 2014 (Expedition 40; NASA photo ISS040-E-089021,
# Reid Wiseman).
# clouds.jpg: clouds swirling past Guadalupe Island in the Pacific, a vortex street,
# from the International Space Station on 24 August 2013 (Expedition 36; NASA photo
# ISS036-E-035663).
# earthrise.jpg: the Earth over the Moon's horizon, from Apollo 8 on 24 December 1968
# (NASA photo AS08-14-2383, Bill Anders; NASA Johnson's high-resolution scan, its film
# colour taken out).
# earthset.jpg: the Earth setting behind the Moon, from Orion on 6 April 2026
# (Artemis II; NASA photo art002e009288).
# endeavour.jpg: Space Shuttle Endeavour against the Earth's edge at sunset, from the
# International Space Station on 9 February 2010 (STS-130; NASA photo ISS022-E-062672).
# Mirrored, as The Economist ran it.
# greenland.jpg: meltwater lakes on the Greenland ice sheet, from the Earth Observing-1
# satellite on 15 June 2016 (NASA Earth Observatory image by Jesse Allen).
# saturn.jpg: Saturn and its rings lit from behind, the Earth a dot below them, from
# Cassini in Saturn's shadow on 19 July 2013 ("The Day the Earth Smiled";
# NASA/JPL-Caltech/SSI, PIA17172).
# sea-ice.jpg: ice floes along Kamchatka's coast, from the International Space Station
# on 15 March 2012 (Expedition 30; NASA photo ISS030-E-162344).
# sunrise.jpg: the first light of an orbital sunrise along the Earth's edge, from the
# International Space Station on 12 January 2020 (Expedition 61; NASA photo
# ISS061-E-123823).
name: namios-wallpapers
version: "2"
source:
  path: ./src
install: |
  install -Dm644 blue-marble.jpg $out/etc/backgrounds/blue-marble.jpg
  install -Dm644 city-lights.jpg $out/etc/backgrounds/city-lights.jpg
  install -Dm644 clouds.jpg $out/etc/backgrounds/clouds.jpg
  install -Dm644 earthrise.jpg $out/etc/backgrounds/earthrise.jpg
  install -Dm644 earthset.jpg $out/etc/backgrounds/earthset.jpg
  install -Dm644 endeavour.jpg $out/etc/backgrounds/endeavour.jpg
  install -Dm644 greenland.jpg $out/etc/backgrounds/greenland.jpg
  install -Dm644 saturn.jpg $out/etc/backgrounds/saturn.jpg
  install -Dm644 sea-ice.jpg $out/etc/backgrounds/sea-ice.jpg
  install -Dm644 sunrise.jpg $out/etc/backgrounds/sunrise.jpg

How windows go, in namiOS's look: each person's own switch, in Settings in nami's window or Super+Shift+T (Super+Alt+W with the keys as on a Mac, namios-look's). Three ways: Scrolling: side by side in a row that scrolls, niri's own. The start. Tiling: they share the screen, as Hyprland's tiling does: each new one splits the focused one's place in two, along its longer side, and a closed one's place goes back to its neighbour (nami's niri: desktop/niri/05-tiling.patch); one that asks to open maximized (Firefox does) tiles too, as dialogs and fixed-size windows float. Super+arrows go to the one there, Super+Shift+arrows swap with it, Super+Ctrl+arrows (or dragging the line between two, or Super+right-drag) resize, Super+G floats one or tiles it again, Super+F fills the screen. A window dragged onto another changes places with it. Floating, as below. Floating is as a Mac is, with Super as Command: new ones open floating, an app's next one down and to the right of its last, with the title bars apps draw themselves and its three buttons on their left, in namiOS's look; niri draws the same bar on those that draw none (desktop/niri/06-title-bars.patch), dark on Ghostty as Ghostty is. A click focuses and raises that window, not the pointer passing by; going to an app (Super+Tab, the dock) brings up its windows, and only those. Zoom (the third button, Super+F, a double click on the bar) fills the room between the bar and the dock, and the window stays one among the others (desktop/niri/08-windows-as-on-a-mac.patch). Super+O shows them all, as Mission Control does: spread out, each whole and none over another, and a click picks one (desktop/niri/09-mission-control.patch). Every app's buttons are on the left, whichever way windows go: close alone in Scrolling (its windows don't minimize), all three in Tiling and Floating. The buttons' look is there for GTK's apps and Firefox from when they start, so the apps already running when it changes have it too. The middle button or Super+M tucks a window away (nami's niri: desktop/niri) and the dock, which comes on with it, or Super+Tab brings it back. Super+W closes a window, Super+Q all of an app's, Super+H hides the app (as a Mac's Hide: its windows go, and come back as it's gone to again; nami's niri: desktop/niri/11), Super+` goes through an app's windows. Dragged to a screen's edge, a window takes half of it, a quarter at a corner, all of it from the top, and its size again when it's dragged away; Super+Alt+Left and Right do halves from the keys, Super+Alt+Up all of it, and Super+Alt+Down puts it back (namios-look's keys). niri reads ~/.local/state/nami/windows.kdl (namios-look's config includes it, if it's there), which this writes or removes. namios-look lists it, and binds the key. The round buttons are in every app, each as it draws its buttons, and in one installed tomorrow too (each is found by what it is, wherever it came from: nami, Flathub, a .deb, an AppImage): GTK 3 and 4 (libadwaita too), Xwayland's GTK apps: each person's GTK styles (~/.config/gtk-3.0 and gtk-4.0/gtk.css import windows-buttons.css). Flatpak's GTK apps: the same, in each app's own (~/.var/app/<id>/config/gtk-*/: the sandbox has no /etc/namios, so a copy beside it), for each app installed, before it first opens. Firefox, Thunderbird, LibreWolf, Zen (and their Flatpaks'): each profile's userChrome.css. Chrome, Chromium, Brave, Edge, and their web apps: Chrome's GTK theme, whose buttons are GTK's (windows-apps: each profile's Preferences, while it isn't open). VS Code, VSCodium, Cursor: the system's title bar, niri's (windows-apps). Qt's and KDE's, Java's, X11's (Xwayland), Electron's with a frame, foot: they ask for the system's title bar (Qt does whenever niri offers one, as it does here; X11's through xwayland-satellite), and niri draws it with the same buttons (desktop/niri/06). Not: what draws its own in its page, as a web page would (Steam, Slack, Discord, GitHub Desktop, balenaEtcher, Spotify, Electron apps without a frame): theirs to change. It's put in place as each person's session starts (nami-namios-windows.service), as windows go Floating or Tiling (and back in Scrolling: only what this changed), and as an app is installed from Flathub or a Firefox profile is made (nami-namios-windows-apps.path).

package.nami
# How windows go, in namiOS's look: each person's own switch, in Settings in nami's window or
# Super+Shift+T (Super+Alt+W with the keys as on a Mac, namios-look's). Three ways:
#   Scrolling: side by side in a row that scrolls, niri's own. The start.
#   Tiling: they share the screen, as Hyprland's tiling does: each new one splits the focused
#   one's place in two, along its longer side, and a closed one's place goes back to its
#   neighbour (nami's niri: desktop/niri/05-tiling.patch); one that asks to open maximized
#   (Firefox does) tiles too, as dialogs and fixed-size windows float. Super+arrows go to the one there,
#   Super+Shift+arrows swap with it, Super+Ctrl+arrows (or dragging the line between two, or
#   Super+right-drag) resize, Super+G floats one or tiles it again, Super+F fills the screen.
#   A window dragged onto another changes places with it.
#   Floating, as below.
# Floating is as a Mac is, with Super as Command: new ones open floating, an
# app's next one down and to the right of its last, with the title bars apps draw
# themselves and its three buttons on their left, in namiOS's look; niri draws the
# same bar on those that draw none (desktop/niri/06-title-bars.patch), dark on
# Ghostty as Ghostty is. A click focuses and raises that window, not the pointer
# passing by; going to an app (Super+Tab, the dock) brings up its windows, and only
# those. Zoom (the third button, Super+F, a double click on the bar) fills the room
# between the bar and the dock, and the window stays one among the others
# (desktop/niri/08-windows-as-on-a-mac.patch). Super+O shows them all, as Mission
# Control does: spread out, each whole and none over another, and a click picks one
# (desktop/niri/09-mission-control.patch). Every app's buttons are on the left,
# whichever way windows go: close alone in Scrolling (its windows don't minimize),
# all three in Tiling and Floating. The buttons' look is there for GTK's apps and
# Firefox from when they start, so the apps already running when it changes have it too. The middle button or Super+M tucks a window away (nami's niri: desktop/niri)
# and the dock, which comes on with it, or Super+Tab brings it back. Super+W closes
# a window, Super+Q all of an app's, Super+H hides the app (as a Mac's Hide: its windows go, and
# come back as it's gone to again; nami's niri: desktop/niri/11), Super+` goes through an
# app's windows. Dragged to a screen's edge, a window takes half of it, a quarter at
# a corner, all of it from the top, and its size again when it's dragged away;
# Super+Alt+Left and Right do halves from the keys, Super+Alt+Up all of it, and Super+Alt+Down
# puts it back (namios-look's keys). niri reads ~/.local/state/nami/windows.kdl (namios-look's config
# includes it, if it's there), which this writes or removes.
# namios-look lists it, and binds the key.
#
# The round buttons are in every app, each as it draws its buttons, and in one installed
# tomorrow too (each is found by what it is, wherever it came from: nami, Flathub, a .deb, an
# AppImage):
#   GTK 3 and 4 (libadwaita too), Xwayland's GTK apps: each person's GTK styles
#     (~/.config/gtk-3.0 and gtk-4.0/gtk.css import windows-buttons.css).
#   Flatpak's GTK apps: the same, in each app's own (~/.var/app/<id>/config/gtk-*/: the
#     sandbox has no /etc/namios, so a copy beside it), for each app installed, before it first opens.
#   Firefox, Thunderbird, LibreWolf, Zen (and their Flatpaks'): each profile's userChrome.css.
#   Chrome, Chromium, Brave, Edge, and their web apps: Chrome's GTK theme, whose buttons are GTK's
#     (windows-apps: each profile's Preferences, while it isn't open).
#   VS Code, VSCodium, Cursor: the system's title bar, niri's (windows-apps).
#   Qt's and KDE's, Java's, X11's (Xwayland), Electron's with a frame, foot: they ask for the
#     system's title bar (Qt does whenever niri offers one, as it does here; X11's through
#     xwayland-satellite), and niri draws it with the same buttons (desktop/niri/06).
#   Not: what draws its own in its page, as a web page would (Steam, Slack, Discord, GitHub
#     Desktop, balenaEtcher, Spotify, Electron apps without a frame): theirs to change.
# It's put in place as each person's session starts (nami-namios-windows.service), as windows go
# Floating or Tiling (and back in Scrolling: only what this changed), and as an app is installed
# from Flathub or a Firefox profile is made (nami-namios-windows-apps.path).
packages:
  - jq
  - libnotify
  # (dconf itself: what apps read through the portal; gsettings here may
  # write a file of its own.)
  - dconf
  - namios-dock
  # Chrome's Preferences, as JSON (windows-apps).
  - python3
services:
  - nami-namios-windows.service: { per-person: true }
  - nami-namios-windows-apps.path: { per-person: true }
files:
  /etc/namios/windows-floating.kdl: |
    // namiOS's floating windows (/etc/namios/windows): what changes from tiled.
    // Apps draw their own title bars (GTK's, with namiOS's buttons); those that ask niri to
    // (Qt's, Electron's with a frame, X11's, foot) get niri's, with the same three buttons
    // (desktop/niri/06). Electron's with a title area of their own draw their buttons there
    // themselves, on the side GTK's layout says (some always on the right: Claude Desktop's and
    // VS Code's recipes give theirs a frame, so niri's bar instead).
    prefer-no-csd false
    layout {
        title-bars
    }
    // Ghostty draws no title bar of its own (gtk-titlebar = false): niri gives it one, dark
    // as Ghostty is (namiOS's Ghostty is dark, whichever theme).
    window-rule {
        match app-id="^com\\.mitchellh\\.ghostty$"
        title-bar true
        title-bar-dark true
    }
    // namiOS's own apps draw theirs, with the same buttons.
    window-rule {
        match app-id="^nami(os)?-"
        title-bar false
    }
    animations {
        minimize-effect "genie"
    }
    input {
        focus-follows-mouse off=true
    }
    window-rule {
        open-floating true
    }
    binds {
        Mod+F hotkey-overlay-title="Maximize" { maximize-window-to-edges; }
        Mod+Ctrl+F hotkey-overlay-title="Full screen" { fullscreen-window; }
        Mod+M hotkey-overlay-title="Minimize" { minimize-window; }
        Mod+W hotkey-overlay-title="Close the window" { close-window; }
        Mod+H hotkey-overlay-title="Hide this app" { hide-app; }
        Mod+Q hotkey-overlay-title="Quit this app" { spawn "/etc/namios/windows" "quit"; }
    }
  /etc/namios/windows-tiling.kdl: |
    // namiOS's Tiling (/etc/namios/windows): what changes from Scrolling. The windows share the
    // screen as Hyprland's dwindle does, with the same gaps and corners as ever.
    layout {
        dwindle
        // A window floated (Super+G) gets a title bar, as in Floating, if it draws none itself.
        title-bars
    }
    // Ghostty draws no title bar of its own (gtk-titlebar = false): niri gives it one.
    window-rule {
        match app-id="^com\\.mitchellh\\.ghostty$"
        title-bar true
        title-bar-dark true
    }
    // namiOS's own apps draw theirs, with the same buttons.
    window-rule {
        match app-id="^nami(os)?-"
        title-bar false
    }
    animations {
        minimize-effect "genie"
    }
    binds {
        // Super+arrows (and H J K L) go to the window there, as they do in a row.
        Mod+Shift+Left  hotkey-overlay-title="Swap with the window on the left" { move-column-left; }
        Mod+Shift+Right hotkey-overlay-title="Swap with the window on the right" { move-column-right; }
        Mod+Shift+Up    hotkey-overlay-title="Swap with the window above" { move-window-up; }
        Mod+Shift+Down  hotkey-overlay-title="Swap with the window below" { move-window-down; }
        Mod+Shift+H     { move-column-left; }
        Mod+Shift+L     { move-column-right; }
        Mod+Shift+K     { move-window-up; }
        Mod+Shift+J     { move-window-down; }
        Mod+Ctrl+Left   hotkey-overlay-title="Narrower" { set-window-width "-5%"; }
        Mod+Ctrl+Right  hotkey-overlay-title="Wider" { set-window-width "+5%"; }
        Mod+Ctrl+Up     hotkey-overlay-title="Shorter" { set-window-height "-5%"; }
        Mod+Ctrl+Down   hotkey-overlay-title="Taller" { set-window-height "+5%"; }
        Mod+Ctrl+H      { set-window-width "-5%"; }
        Mod+Ctrl+L      { set-window-width "+5%"; }
        Mod+Ctrl+K      { set-window-height "-5%"; }
        Mod+Ctrl+J      { set-window-height "+5%"; }
        Mod+F hotkey-overlay-title="Fill the screen (and back)" { maximize-window-to-edges; }
        Mod+G hotkey-overlay-title="This window: floating or tiling" { toggle-window-floating; }
        Mod+M hotkey-overlay-title="Minimize" { minimize-window; }
    }
  # The buttons in namiOS's look, on GTK's title bars: three small circles in
  # nami's slate, 14px across and 6 apart, as niri's bars and namiOS's own apps
  # have them; what each does on hover, each turning a darker slate. Only those on the left (GTK 4's windowcontrols.start, GTK 3's .left),
  # where they always are in namiOS (someone's own layout with them on the right keeps
  # GTK's look): each GTK app reads this as it starts. (GTK reads its stylesheets
  # once, as an app starts.)
  /etc/namios/windows-buttons.css: |
    /* The button itself plain in every state, hovered and pressed too (libadwaita's own round
       or square backgrounds gone): the circle is all there is. 6 apart: GTK 4's box puts 3 more
       between them, GTK 3's 6 (its header bar's spacing). */
    windowcontrols.start > button, headerbar .left button.titlebutton, .titlebar .left button.titlebutton {
      min-width: 14px; min-height: 14px; padding: 0; margin: 0;
      border: none; border-radius: 50%; box-shadow: none; background: none; color: transparent;
    }
    windowcontrols.start > button:hover, windowcontrols.start > button:active, windowcontrols.start > button:backdrop { background: none; box-shadow: none; }
    windowcontrols.start { border-spacing: 0; }
    windowcontrols.start > button { margin: 0 3px; }
    windowcontrols.start > button > image {
      min-width: 14px; min-height: 14px; padding: 0;
      border-radius: 50%; box-shadow: none; color: transparent;
      background-color: rgba(100, 112, 138, 0.55);
    }
    headerbar .left button.titlebutton, .titlebar .left button.titlebutton { background-color: rgba(100, 112, 138, 0.55); }
    windowcontrols.start > button:backdrop > image, headerbar .left button.titlebutton:backdrop, .titlebar .left button.titlebutton:backdrop { background-color: rgba(100, 112, 138, 0.25); }
    windowcontrols.start > button:hover > image, headerbar .left button.titlebutton:hover, .titlebar .left button.titlebutton:hover { color: #f4f5f8; background-color: #45577a; }
    /* Marks (namios-icons': ×, − and +), small. With the pointer over any of GTK 4's three, as on
       a Mac, each shows its mark, and they're all solid: the one under it in its hover colour,
       the others a light slate; dark slate marks on the light slate, light ones on the darker
       slate. (GTK 3 has no hover for the box they're in: only the one under the pointer
       shows its mark there.) */
    /* The marks are 14px, as the circles are, and drawn at that size, so they're crisp and in the
       middle (namios-icons has them so). GTK 4's in the circle; GTK 3's icon is always 16, so the
       button draws the mark itself instead, and its own icon is there unseen (a pixel less on
       each side, so the button is 14 too). */
    windowcontrols.start > button > image { -gtk-icon-size: 14px; }
    headerbar .left button.titlebutton image, .titlebar .left button.titlebutton image { opacity: 0; margin: -1px; }
    headerbar .left button.titlebutton, .titlebar .left button.titlebutton { background-size: 14px 14px; background-position: center; background-repeat: no-repeat; }
    headerbar .left button.titlebutton.close, .titlebar .left button.titlebutton.close { background-image: -gtk-icontheme("window-close-symbolic"); }
    headerbar .left button.titlebutton.minimize, .titlebar .left button.titlebutton.minimize { background-image: -gtk-icontheme("window-minimize-symbolic"); }
    headerbar .left button.titlebutton.maximize, .titlebar .left button.titlebutton.maximize { background-image: -gtk-icontheme("window-maximize-symbolic"); }
    windowcontrols.start:hover > button > image { color: #1d2330; background-color: #9aa3b5; }
    windowcontrols.start:hover > button:hover > image { color: #f4f5f8; background-color: #45577a; }
    /* Chrome's (and Chromium's, and its web apps') own: it draws GTK 4's buttons itself, beside its
       tabs or its web app's title, from a windowcontrols of neither side with each button alone in
       it (GTK's own always have a side). The same circles, 6 apart (Chrome's own room between
       them); the mark of the one under the pointer. The room before them, 10 as on niri's bars:
       windows-buttons-gtk4.css. */
    windowcontrols:not(.start):not(.end) > button {
      min-width: 14px; min-height: 14px; padding: 0; margin: 0;
      border: none; border-radius: 50%; box-shadow: none; background: none; color: transparent;
    }
    windowcontrols:not(.start):not(.end) > button > image {
      min-width: 12px; min-height: 12px; padding: 0; -gtk-icon-size: 14px;
      border-radius: 50%; box-shadow: none; color: transparent;
      background-color: rgba(100, 112, 138, 0.55);
    }
    windowcontrols:not(.start):not(.end) > button:backdrop > image { background-color: rgba(100, 112, 138, 0.25); }
    windowcontrols:not(.start):not(.end) > button:hover > image { color: #f4f5f8; background-color: #45577a; }
  # GTK 4's alone (each person's gtk-4.0/gtk.css imports it): Chrome's header bar, the room before
  # its buttons. (Its own header bar has GTK 3's class, which no GTK 4 app's has.)
  /etc/namios/windows-buttons-gtk4.css: |
    headerbar.header-bar { padding-left: 10px; }
  # The same for Firefox, which draws its own (each profile's chrome/userChrome.css
  # imports it, `windows setup` puts it there): when its buttons are on the left.
  /etc/namios/firefox-buttons.css: |
    /* namiOS's window buttons (namios-windows), when windows float: their buttons are on the left then. */
    @media (-moz-gtk-csd-reversed-placement) {
      .titlebar-buttonbox {
        --titlebar-button-size: 14px !important;
        --titlebar-button-spacing: 3px !important;
        --titlebar-button-end-spacing: 3px !important;
      }
      .titlebar-buttonbox-container { padding-inline: 7px !important; }
      .titlebar-button > .toolbarbutton-icon {
        border-radius: 50% !important;
        background-color: rgba(100, 112, 138, 0.55) !important;
        background-image: none !important;
        background-size: 14px !important;
        background-position: center !important;
        transition: none !important;
      }
      .titlebar-button:-moz-window-inactive > .toolbarbutton-icon { background-color: rgba(100, 112, 138, 0.25) !important; }
      .titlebar-buttonbox:hover .titlebar-button > .toolbarbutton-icon { background-color: #9aa3b5 !important; }
      .titlebar-buttonbox:hover .titlebar-button:hover > .toolbarbutton-icon { background-color: #45577a !important; }
      /* The marks: namios-icons' (GTK's), drawn by Firefox itself at 14px, as the circle is, so
         they're crisp (its own way with GTK's icons draws them a little soft). Dark slate, and
         light on each one's own hover. */
      .titlebar-buttonbox:hover .titlebar-close > .toolbarbutton-icon { background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14' fill='%231d2330'><rect x='2.757' y='6' width='8.485' height='2' transform='rotate(45 7 7)'/><rect x='2.757' y='6' width='8.485' height='2' transform='rotate(-45 7 7)'/></svg>") !important; }
      .titlebar-buttonbox:hover .titlebar-min > .toolbarbutton-icon { background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14' fill='%231d2330'><rect x='3' y='6' width='8' height='2'/></svg>") !important; }
      .titlebar-buttonbox:hover :is(.titlebar-max, .titlebar-restore) > .toolbarbutton-icon { background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14' fill='%231d2330'><path d='M3 6h3V3h2v3h3v2H8v3H6V8H3z'/></svg>") !important; }
      .titlebar-buttonbox:hover .titlebar-close:hover > .toolbarbutton-icon { background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14' fill='%23f4f5f8'><rect x='2.757' y='6' width='8.485' height='2' transform='rotate(45 7 7)'/><rect x='2.757' y='6' width='8.485' height='2' transform='rotate(-45 7 7)'/></svg>") !important; }
      .titlebar-buttonbox:hover .titlebar-min:hover > .toolbarbutton-icon { background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14' fill='%23f4f5f8'><rect x='3' y='6' width='8' height='2'/></svg>") !important; }
      .titlebar-buttonbox:hover :is(.titlebar-max, .titlebar-restore):hover > .toolbarbutton-icon { background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14' fill='%23f4f5f8'><path d='M3 6h3V3h2v3h3v2H8v3H6V8H3z'/></svg>") !important; }
    }
  # Each person's own: GTK's apps and Firefox have the buttons' look from the start of
  # the session (before anything opens), whichever way windows go; Chrome and VS Code as
  # windows go (nothing's open yet, so what was open as they last changed has it now).
  /etc/systemd/user/nami-namios-windows.service: |
    [Unit]
    Description=namiOS's window buttons for GTK's apps, Firefox, Chrome and VS Code
    Before=graphical-session-pre.target
    ConditionUser=!@system
    [Service]
    Type=oneshot
    ExecStart=/etc/namios/windows setup
    [Install]
    WantedBy=graphical-session-pre.target
  # And again as an app comes from Flathub (each app's own GTK styles, before it first opens),
  # or Firefox makes a profile (its userChrome.css, for the next time it opens).
  /etc/systemd/user/nami-namios-windows-apps.path: |
    [Unit]
    Description=Watches for new apps, for namiOS's window buttons
    PartOf=graphical-session.target
    ConditionUser=!@system
    [Path]
    PathChanged=%h/.local/share/flatpak/app
    PathChanged=/var/lib/flatpak/app
    PathChanged=%h/.var/app
    PathChanged=%h/.mozilla/firefox
    PathChanged=%h/.config/mozilla/firefox
    PathChanged=%h/.thunderbird
    Unit=nami-namios-windows.service
    [Install]
    WantedBy=graphical-session.target
  /etc/namios/windows-apps:
    mode: "0755"
    content: |
      #!/run/current-system/sw/bin/python3 -I
      # namiOS's round window buttons in the apps that draw their own some other way (namios-windows):
      #
      #   windows-apps on    as windows float or tile (all three buttons)
      #   windows-apps off   back as they were, in Scrolling: only what this changed, and only if
      #                      it's still as this left it
      #   windows-apps wait  (by itself, after on or off with one of them open) until each is closed,
      #                      then as windows go by then
      #
      # Chrome, Chromium, Brave, Edge and their web apps draw their own square buttons on Chrome's
      # Classic theme, and GTK's (round, in namiOS's look: windows-buttons.css) on its GTK theme: each
      # profile is put on GTK (Settings, Appearance, Theme), as its Preferences say it
      # (extensions.theme.system_theme: 0 Classic, 1 GTK, 2 Qt). VS Code and its kin (VSCodium,
      # Cursor, ...) draw theirs on the right, over the page: theirs is the system's title bar
      # ("window.titleBarStyle": "native"), niri's with the same three buttons.
      #
      # Found wherever they are, so one installed tomorrow is too, the next time this
…
checks.nami
# How to tell namios-windows works, on a computer nami made (tests/vm-quick.sh
# tests/namios runs these, with NAMI_USB_GPU=1 for niri). Tiling's: each window inside the
# screen, none overlapping, and each edge at the screen's gap or 12 from a neighbour's (fit=n).
"niri's config is valid with floating windows":
  run: niri validate -c /etc/namios/windows-floating.kdl 2>&1
  expect: "valid"
"in the desktop: windows tile, float at the switch, new ones too, and back":
  run: export NIRI_SOCKET=$(ls /run/user/$(id -u)/niri.*.sock | head -1); ghosts() { niri msg -j windows | jq -c '[.[] | select(.app_id == "com.mitchellh.ghostty") | .is_floating]'; }; wait_for() { for i in $(seq 30); do [ "$(ghosts | jq length)" = "$1" ] && return; sleep 1; done; }; /etc/namios/windows tiled; niri msg action spawn -- ghostty; wait_for 1; printf "start %s %s " "$(/etc/namios/windows status)" "$(ghosts)"; /etc/namios/windows floating; sleep 2; printf "switched %s %s " "$(/etc/namios/windows status)" "$(ghosts)"; niri msg action spawn -- ghostty; wait_for 2; printf "new %s " "$(ghosts)"; /etc/namios/windows tiled; sleep 2; printf "back %s %s\n" "$(/etc/namios/windows status)" "$(ghosts)"; for id in $(niri msg -j windows | jq -r '.[] | select(.app_id == "com.mitchellh.ghostty") | .id'); do niri msg action close-window --id "$id"; done
  expect: "start scrolling \\[false\\] switched floating \\[true\\] new \\[true,true\\] back scrolling \\[false,false\\]"
"in the desktop: the buttons on the left whichever way windows go (all three where they minimize, close alone in Scrolling), in namiOS's look (kept for GTK's apps from their start)":
  run: export NIRI_SOCKET=$(ls /run/user/$(id -u)/niri.*.sock | head -1); was=$(/etc/namios/windows status); l() { dconf read /org/gnome/desktop/wm/preferences/button-layout; }; /etc/namios/windows floating; a=$(l); b=$(grep -c 'windows-buttons.css.*windows-buttons-gtk4.css' ~/.config/gtk-4.0/gtk.css); /etc/namios/windows tiling; t=$(l); /etc/namios/windows scrolling; r=$(l); c=$(grep -c windows-buttons.css ~/.config/gtk-4.0/gtk.css 2>/dev/null); /etc/namios/windows "$was"; echo "floating=$a tiling=$t scrolling=$r on=$b off=${c:-0}"
  expect: "^floating='close,minimize,maximize:' tiling='close,minimize,maximize:' scrolling='close:' on=1 off=1$"
"the buttons' look is only for buttons on the left (where they always are) and Chrome's own":
  run: echo "all=$(grep -c 'windowcontrols > button\|headerbar button.titlebutton' /etc/namios/windows-buttons.css) left=$(grep -c 'windowcontrols.start > button' /etc/namios/windows-buttons.css) chrome=$(grep -c 'windowcontrols:not(.start):not(.end) > button' /etc/namios/windows-buttons.css) firefox=$(grep -c 'moz-gtk-csd-reversed-placement' /etc/namios/firefox-buttons.css)"
  expect: "^all=0 left=[1-9][0-9]* chrome=[1-9][0-9]* firefox=1$"
"Chrome's profiles go on GTK's theme (its buttons GTK's) and back as they were, VS Code's to the system's title bar and back; not a theme of someone's own, nor a Chrome that's open":
  run: t=$(mktemp -d); c=$t/.config/google-chrome; mkdir -p "$c/Default" "$c/Profile 1" "$t/.config/Code/User"; echo '{}' > "$c/Local State"; echo '{}' > "$t/.config/Code/Local State"; echo '{"browser":{"theme":{"saved_local_theme":"CAAQAEgB"}},"extensions":{"theme":{"id":"","system_theme":0}}}' > "$c/Default/Preferences"; echo '{"extensions":{"theme":{"id":"abcdefgh","system_theme":0}}}' > "$c/Profile 1/Preferences"; was=$(cat "$c/Default/Preferences"); a() { HOME=$t XDG_CONFIG_HOME= /etc/namios/windows-apps "$1" >/dev/null; }; a on; a on; g=$(jq .extensions.theme.system_theme "$c/Default/Preferences"); o=$(jq .extensions.theme.system_theme "$c/Profile 1/Preferences"); v=$(grep -c 'titleBarStyle.*native' "$t/.config/Code/User/settings.json"); a off; [ "$(cat "$c/Default/Preferences")" = "$was" ] && b=same || b=changed; [ -e "$t/.config/Code/User/settings.json" ] && s=kept || s=gone; ln -s "$(cat /proc/sys/kernel/hostname)-$$" "$c/SingletonLock"; a on; l=$(jq .extensions.theme.system_theme "$c/Default/Preferences"); rm -rf "$t"; echo "gtk=$g own=$o code=$v back=$b settings=$s open=$l"
  expect: "^gtk=1 own=0 code=1 back=same settings=gone open=0$"
"once someone puts Chrome back on Classic themselves, it stays theirs":
  run: t=$(mktemp -d); c=$t/.config/google-chrome; mkdir -p "$c/Default"; echo '{}' > "$c/Local State"; echo '{}' > "$c/Default/Preferences"; a() { HOME=$t XDG_CONFIG_HOME= /etc/namios/windows-apps "$1" >/dev/null; }; a on; jq -c '.extensions.theme.system_theme = 0' "$c/Default/Preferences" > "$t/p" && mv "$t/p" "$c/Default/Preferences"; a on; a off; a on; l=$(jq .extensions.theme.system_theme "$c/Default/Preferences"); rm -rf "$t"; echo "classic=$l"
  expect: "^classic=0$"
"Flatpak's apps have the buttons' look in their own GTK styles (theirs kept), one installed and not yet opened too, and Firefox in a Flatpak":
  run: t=$(mktemp -d); mkdir -p "$t/.local/share/flatpak/app/org.example.New" "$t/.var/app/org.example.Old/config/gtk-4.0" "$t/.var/app/org.mozilla.firefox/.mozilla/firefox/p.default" "$t/.local/state/nami"; cp ~/.local/state/nami/windows.kdl "$t/.local/state/nami/" 2>/dev/null; echo 'headerbar{color:red}' > "$t/.var/app/org.example.Old/config/gtk-4.0/gtk.css"; touch "$t/.var/app/org.mozilla.firefox/.mozilla/firefox/p.default/prefs.js"; for i in 1 2; do HOME=$t XDG_CONFIG_HOME= /etc/namios/windows setup; done; n=$t/.var/app/org.example.New/config; o=$t/.var/app/org.example.Old/config/gtk-4.0; new=$(grep -c '^@import url("namios-windows-buttons.css");' "$n/gtk-3.0/gtk.css")/$(grep -c 'namios-windows-buttons-gtk4.css' "$n/gtk-4.0/gtk.css"); own=$(grep -c 'color:red' "$o/gtk.css")/$(wc -l < "$o/gtk.css"); cmp -s /etc/namios/windows-buttons.css "$o/namios-windows-buttons.css" && k=copy || k=missing; ff=$(grep -c namios-buttons.css "$t/.var/app/org.mozilla.firefox/.mozilla/firefox/p.default/chrome/userChrome.css"); rm -rf "$t"; echo "new=$new own=$own $k firefox=$ff"
  expect: "^new=1/1 own=1/2 copy firefox=1$"
"in the desktop: each person's session starts with the buttons' look in place, and it's put in place again as an app is installed":
  run: echo "setup=$(systemctl --user is-enabled nami-namios-windows.service) result=$(systemctl --user show -p Result --value nami-namios-windows.service) apps=$(systemctl --user is-active nami-namios-windows-apps.path)"
  expect: "^setup=enabled result=success apps=active$"
"the buttons are circles, 14px across, in GTK's apps, Chrome and Firefox alike":
  run: echo "gtk=$(grep -c 'border-radius:.50%' /etc/namios/windows-buttons.css) firefox=$(grep -c 'border-radius:.50%' /etc/namios/firefox-buttons.css) other=$(grep -h 'border-radius' /etc/namios/windows-buttons.css /etc/namios/firefox-buttons.css | grep -vc '50%') size=$(grep -c 'min-width:.14px;.min-height:.14px' /etc/namios/windows-buttons.css)/$(grep -c 'titlebar-button-size:.14px' /etc/namios/firefox-buttons.css)"
  expect: "^gtk=4 firefox=1 other=0 size=3/1$"
"in the desktop: floating: minimize hides a window, it can't be focused, and focusing it brings it back where it was":
  run: ( export NIRI_SOCKET=$(ls /run/user/$(id -u)/niri.*.sock | head -1); was=$(/etc/namios/windows status); /etc/namios/windows floating; niri msg action spawn -- ghostty --title=minimize-check; w() { niri msg -j windows | jq -c '.[] | select(.title == "minimize-check")'; }; for i in $(seq 30); do [ -n "$(w)" ] && break; sleep 1; done; sleep 1; id=$(w | jq -r .id); a=$(w | jq -c .layout.tile_pos_in_workspace_view); niri msg action minimize-window --id "$id"; sleep 1; h=$(w | jq -r .is_minimized); f=$(niri msg -j focused-window | jq -r '.id // "none"'); [ "$f" = "$id" ] && f=still || f=gone; niri msg action focus-window --id "$id"; sleep 1; b=$(w | jq -c .layout.tile_pos_in_workspace_view); r=$(w | jq -r .is_minimized); [ "$a" = "$b" ] && p=same || p=moved; niri msg action close-window --id "$id"; sleep 1; /etc/namios/windows "$was"; echo "hidden=$h focus=$f back=$r $p" )
  expect: "^hidden=true focus=gone back=false same$"
"niri's config is valid with tiling windows":
  run: niri validate -c /etc/namios/windows-tiling.kdl 2>&1
  expect: "valid"
"in the desktop: Tiling: one to four windows share the screen, with gaps; one closed gives its place back; Super+Shift+Right swaps":
  run: export NIRI_SOCKET=$(ls /run/user/$(id -u)/niri.*.sock | head -1); was=$(/etc/namios/windows status); niri msg action focus-workspace 99; ws=$(niri msg -j workspaces | jq '.[]|select(.is_focused).id'); W=$(niri msg -j outputs | jq '[.[]][0].logical.width'); H=$(niri msg -j outputs | jq '[.[]][0].logical.height'); fit() { niri msg -j windows | jq -r --argjson ws "$ws" --argjson g 12 --argjson W "$W" --argjson H "$H" 'def near(a;b):((a-b)|fabs)<=2; def ov(a0;a1;b0;b1):(a0<b1-1) and (b0<a1-1); [.[]|select(.is_floating==false and .is_minimized==false and .workspace_id==$ws)|.layout|{x:.tile_pos_in_workspace_view[0],y:.tile_pos_in_workspace_view[1],w:.tile_size[0],h:.tile_size[1]}] as $r|($r|map(.y)|min) as $t|($r|map(.y+.h)|max) as $b|[$r[] as $p|$r[] as $q|select($p!=$q and ov($p.x;$p.x+$p.w;$q.x;$q.x+$q.w) and ov($p.y;$p.y+$p.h;$q.y;$q.y+$q.h))]|length as $o|[$r[] as $p|select((near($p.x;$g) or any($r[];near(.x+.w+$g;$p.x) and ov(.y;.y+.h;$p.y;$p.y+$p.h))) and (near($p.x+$p.w;$W-$g) or any($r[];near($p.x+$p.w+$g;.x) and ov(.y;.y+.h;$p.y;$p.y+$p.h))) and (near($p.y;$t) or any($r[];near(.y+.h+$g;$p.y) and ov(.x;.x+.w;$p.x;$p.x+$p.w))) and (near($p.y+$p.h;$b) or any($r[];near($p.y+$p.h+$g;.y) and ov(.x;.x+.w;$p.x;$p.x+$p.w))))]|length as $f|"n=\($r|length) overlaps=\($o) fit=\($f) tall=\(($b-$t)>$H*0.6)"'; }; wid() { niri msg -j windows | jq -r --arg t "$1" '.[]|select(.title==$t).id'; }; win() { niri msg -j windows | jq -r --arg t "$1" ".[]|select(.title==\$t)|$2"; }; settle() { _s0=; for _i in $(seq 20); do sleep 0.25; _s1=$(niri msg -j windows | jq -c '[.[]|[.id,.is_floating,.is_minimized,.layout]]'); [ "$_s1" = "$_s0" ] && return; _s0=$_s1; done; }; spawn1() { niri msg action spawn -- ghostty --title="$1"; for i in $(seq 150); do [ -n "$(wid "$1")" ] && break; sleep 0.2; done; settle; }; shut() { for t in "$@"; do niri msg action close-window --id "$(wid "$t")"; done; for t in "$@"; do for i in $(seq 50); do [ -z "$(wid "$t")" ] && break; sleep 0.2; done; done; settle; }; /etc/namios/windows tiling; for i in 1 2 3 4; do spawn1 tile-$i; printf "%s; " "$(fit)"; done; shut tile-2; printf "closed %s; " "$(fit)"; niri msg action focus-window --id "$(wid tile-1)"; sleep 1; a=$(win tile-1 .layout.tile_pos_in_workspace_view[0]); niri msg action move-column-right; settle; b=$(win tile-1 .layout.tile_pos_in_workspace_view[0]); if [ "${b%.*}" -gt "${a%.*}" ]; then s=swapped; else s="not swapped $a $b"; fi; printf "%s %s\n" "$s" "$(fit)"; shut tile-1 tile-3 tile-4; /etc/namios/windows "$was"
  expect: "^n=1 overlaps=0 fit=1 tall=true; n=2 overlaps=0 fit=2 tall=true; n=3 overlaps=0 fit=3 tall=true; n=4 overlaps=0 fit=4 tall=true; closed n=3 overlaps=0 fit=3 tall=true; swapped n=3 overlaps=0 fit=3 tall=true$"
"in the desktop: Tiling: a window floats and tiles again, fills the screen and comes back, minimizes and comes back":
  run: export NIRI_SOCKET=$(ls /run/user/$(id -u)/niri.*.sock | head -1); was=$(/etc/namios/windows status); niri msg action focus-workspace 99; ws=$(niri msg -j workspaces | jq '.[]|select(.is_focused).id'); W=$(niri msg -j outputs | jq '[.[]][0].logical.width'); H=$(niri msg -j outputs | jq '[.[]][0].logical.height'); fit() { niri msg -j windows | jq -r --argjson ws "$ws" --argjson g 12 --argjson W "$W" --argjson H "$H" 'def near(a;b):((a-b)|fabs)<=2; def ov(a0;a1;b0;b1):(a0<b1-1) and (b0<a1-1); [.[]|select(.is_floating==false and .is_minimized==false and .workspace_id==$ws)|.layout|{x:.tile_pos_in_workspace_view[0],y:.tile_pos_in_workspace_view[1],w:.tile_size[0],h:.tile_size[1]}] as $r|($r|map(.y)|min) as $t|($r|map(.y+.h)|max) as $b|[$r[] as $p|$r[] as $q|select($p!=$q and ov($p.x;$p.x+$p.w;$q.x;$q.x+$q.w) and ov($p.y;$p.y+$p.h;$q.y;$q.y+$q.h))]|length as $o|[$r[] as $p|select((near($p.x;$g) or any($r[];near(.x+.w+$g;$p.x) and ov(.y;.y+.h;$p.y;$p.y+$p.h))) and (near($p.x+$p.w;$W-$g) or any($r[];near($p.x+$p.w+$g;.x) and ov(.y;.y+.h;$p.y;$p.y+$p.h))) and (near($p.y;$t) or any($r[];near(.y+.h+$g;$p.y) and ov(.x;.x+.w;$p.x;$p.x+$p.w))) and (near($p.y+$p.h;$b) or any($r[];near($p.y+$p.h+$g;.y) and ov(.x;.x+.w;$p.x;$p.x+$p.w))))]|length as $f|"n=\($r|length) overlaps=\($o) fit=\($f) tall=\(($b-$t)>$H*0.6)"'; }; wid() { niri msg -j windows | jq -r --arg t "$1" '.[]|select(.title==$t).id'; }; win() { niri msg -j windows | jq -r --arg t "$1" ".[]|select(.title==\$t)|$2"; }; settle() { _s0=; for _i in $(seq 20); do sleep 0.25; _s1=$(niri msg -j windows | jq -c '[.[]|[.id,.is_floating,.is_minimized,.layout]]'); [ "$_s1" = "$_s0" ] && return; _s0=$_s1; done; }; spawn1() { niri msg action spawn -- ghostty --title="$1"; for i in $(seq 150); do [ -n "$(wid "$1")" ] && break; sleep 0.2; done; settle; }; shut() { for t in "$@"; do niri msg action close-window --id "$(wid "$t")"; done; for t in "$@"; do for i in $(seq 50); do [ -z "$(wid "$t")" ] && break; sleep 0.2; done; done; settle; }; /etc/namios/windows tiling; spawn1 one-1; spawn1 one-2; niri msg action toggle-window-floating --id "$(wid one-2)"; settle; printf "floats=%s %s; " "$(win one-2 .is_floating)" "$(fit)"; niri msg action toggle-window-floating --id "$(wid one-2)"; settle; printf "tiles=%s %s; " "$(win one-2 .is_floating)" "$(fit)"; niri msg action focus-window --id "$(wid one-1)"; niri msg action maximize-window-to-edges; settle; w=$(win one-1 .layout.tile_size[0]); if [ "${w%.*}" -ge $((W - 2)) ]; then m=fills; else m="not filling $w"; fi; niri msg action maximize-window-to-edges; settle; printf "%s, back %s; " "$m" "$(fit)"; niri msg action minimize-window --id "$(wid one-2)"; settle; printf "minimized %s; " "$(fit)"; niri msg action focus-window --id "$(wid one-2)"; settle; printf "back %s\n" "$(fit)"; shut one-1 one-2; /etc/namios/windows "$was"
  expect: "^floats=true n=1 overlaps=0 fit=1 tall=true; tiles=false n=2 overlaps=0 fit=2 tall=true; fills, back n=2 overlaps=0 fit=2 tall=true; minimized n=1 overlaps=0 fit=1 tall=true; back n=2 overlaps=0 fit=2 tall=true$"
"in the desktop: Scrolling, Tiling (Super+Shift+T), Floating, Tiling and back to Scrolling, with the windows that are open":
  run: export NIRI_SOCKET=$(ls /run/user/$(id -u)/niri.*.sock | head -1); was=$(/etc/namios/windows status); niri msg action focus-workspace 99; ws=$(niri msg -j workspaces | jq '.[]|select(.is_focused).id'); W=$(niri msg -j outputs | jq '[.[]][0].logical.width'); H=$(niri msg -j outputs | jq '[.[]][0].logical.height'); fit() { niri msg -j windows | jq -r --argjson ws "$ws" --argjson g 12 --argjson W "$W" --argjson H "$H" 'def near(a;b):((a-b)|fabs)<=2; def ov(a0;a1;b0;b1):(a0<b1-1) and (b0<a1-1); [.[]|select(.is_floating==false and .is_minimized==false and .workspace_id==$ws)|.layout|{x:.tile_pos_in_workspace_view[0],y:.tile_pos_in_workspace_view[1],w:.tile_size[0],h:.tile_size[1]}] as $r|($r|map(.y)|min) as $t|($r|map(.y+.h)|max) as $b|[$r[] as $p|$r[] as $q|select($p!=$q and ov($p.x;$p.x+$p.w;$q.x;$q.x+$q.w) and ov($p.y;$p.y+$p.h;$q.y;$q.y+$q.h))]|length as $o|[$r[] as $p|select((near($p.x;$g) or any($r[];near(.x+.w+$g;$p.x) and ov(.y;.y+.h;$p.y;$p.y+$p.h))) and (near($p.x+$p.w;$W-$g) or any($r[];near($p.x+$p.w+$g;.x) and ov(.y;.y+.h;$p.y;$p.y+$p.h))) and (near($p.y;$t) or any($r[];near(.y+.h+$g;$p.y) and ov(.x;.x+.w;$p.x;$p.x+$p.w))) and (near($p.y+$p.h;$b) or any($r[];near($p.y+$p.h+$g;.y) and ov(.x;.x+.w;$p.x;$p.x+$p.w))))]|length as $f|"n=\($r|length) overlaps=\($o) fit=\($f) tall=\(($b-$t)>$H*0.6)"'; }; wid() { niri msg -j windows | jq -r --arg t "$1" '.[]|select(.title==$t).id'; }; win() { niri msg -j windows | jq -r --arg t "$1" ".[]|select(.title==\$t)|$2"; }; settle() { _s0=; for _i in $(seq 20); do sleep 0.25; _s1=$(niri msg -j windows | jq -c '[.[]|[.id,.is_floating,.is_minimized,.layout]]'); [ "$_s1" = "$_s0" ] && return; _s0=$_s1; done; }; spawn1() { niri msg action spawn -- ghostty --title="$1"; for i in $(seq 150); do [ -n "$(wid "$1")" ] && break; sleep 0.2; done; settle; }; shut() { for t in "$@"; do niri msg action close-window --id "$(wid "$t")"; done; for t in "$@"; do for i in $(seq 50); do [ -z "$(wid "$t")" ] && break; sleep 0.2; done; done; settle; }; /etc/namios/windows scrolling; spawn1 mode-1; spawn1 mode-2; s() { printf "%s %s " "$(/etc/namios/windows status)" "$(niri msg -j windows | jq -c '[.[]|select(.title|test("^mode-"))|.is_floating]')"; }; s; /etc/namios/windows toggle; sleep 2; s; printf "%s; " "$(fit)"; /etc/namios/windows floating; sleep 2; s; /etc/namios/windows tiling; sleep 2; s; printf "%s; " "$(fit)"; /etc/namios/windows scrolling; sleep 2; s; echo; shut mode-1 mode-2; /etc/namios/windows "$was"
  expect: "^scrolling \\[false,false\\] tiling \\[false,false\\] n=2 overlaps=0 fit=2 tall=true; floating \\[true,true\\] tiling \\[false,false\\] n=2 overlaps=0 fit=2 tall=true; scrolling \\[false,false\\] $"
"in the desktop: Tiling: Firefox tiles too (it asks to open maximized), in front":
  run: export NIRI_SOCKET=$(ls /run/user/$(id -u)/niri.*.sock | head -1); was=$(/etc/namios/windows status); niri msg action focus-workspace 99; ws=$(niri msg -j workspaces | jq '.[]|select(.is_focused).id'); W=$(niri msg -j outputs | jq '[.[]][0].logical.width'); H=$(niri msg -j outputs | jq '[.[]][0].logical.height'); fit() { niri msg -j windows | jq -r --argjson ws "$ws" --argjson g 12 --argjson W "$W" --argjson H "$H" 'def near(a;b):((a-b)|fabs)<=2; def ov(a0;a1;b0;b1):(a0<b1-1) and (b0<a1-1); [.[]|select(.is_floating==false and .is_minimized==false and .workspace_id==$ws)|.layout|{x:.tile_pos_in_workspace_view[0],y:.tile_pos_in_workspace_view[1],w:.tile_size[0],h:.tile_size[1]}] as $r|($r|map(.y)|min) as $t|($r|map(.y+.h)|max) as $b|[$r[] as $p|$r[] as $q|select($p!=$q and ov($p.x;$p.x+$p.w;$q.x;$q.x+$q.w) and ov($p.y;$p.y+$p.h;$q.y;$q.y+$q.h))]|length as $o|[$r[] as $p|select((near($p.x;$g) or any($r[];near(.x+.w+$g;$p.x) and ov(.y;.y+.h;$p.y;$p.y+$p.h))) and (near($p.x+$p.w;$W-$g) or any($r[];near($p.x+$p.w+$g;.x) and ov(.y;.y+.h;$p.y;$p.y+$p.h))) and (near($p.y;$t) or any($r[];near(.y+.h+$g;$p.y) and ov(.x;.x+.w;$p.x;$p.x+$p.w))) and (near($p.y+$p.h;$b) or any($r[];near($p.y+$p.h+$g;.y) and ov(.x;.x+.w;$p.x;$p.x+$p.w))))]|length as $f|"n=\($r|length) overlaps=\($o) fit=\($f) tall=\(($b-$t)>$H*0.6)"'; }; wid() { niri msg -j windows | jq -r --arg t "$1" '.[]|select(.title==$t).id'; }; win() { niri msg -j windows | jq -r --arg t "$1" ".[]|select(.title==\$t)|$2"; }; settle() { _s0=; for _i in $(seq 20); do sleep 0.25; _s1=$(niri msg -j windows | jq -c '[.[]|[.id,.is_floating,.is_minimized,.layout]]'); [ "$_s1" = "$_s0" ] && return; _s0=$_s1; done; }; spawn1() { niri msg action spawn -- ghostty --title="$1"; for i in $(seq 150); do [ -n "$(wid "$1")" ] && break; sleep 0.2; done; settle; }; shut() { for t in "$@"; do niri msg action close-window --id "$(wid "$t")"; done; for t in "$@"; do for i in $(seq 50); do [ -z "$(wid "$t")" ] && break; sleep 0.2; done; done; settle; }; /etc/namios/windows tiling; spawn1 ff-1; for id in $(niri msg -j windows | jq -r '.[]|select(.app_id=="firefox")|.id'); do niri msg action close-window --id "$id"; done; p=$(mktemp -d); niri msg action spawn -- firefox --no-remote --profile "$p" about:blank; for i in $(seq 150); do [ -n "$(niri msg -j windows | jq -r '.[]|select(.app_id=="firefox")|.id')" ] && break; sleep 0.2; done; sleep 3; settle; f=$(niri msg -j windows | jq -c '[.[]|select(.app_id=="firefox")][0]'); printf "firefox floating=%s row=%s focused=%s %s\n" "$(echo "$f" | jq -r .is_floating)" "$(echo "$f" | jq -c .layout.pos_in_scrolling_layout)" "$(niri msg -j focused-window | jq -r .app_id)" "$(fit)"; niri msg action close-window --id "$(echo "$f" | jq -r .id)"; for i in $(seq 50); do [ -z "$(niri msg -j windows | jq -r '.[]|select(.app_id=="firefox")|.id')" ] && break; sleep 0.2; do
…

NetworkManager runs the network (Wi-Fi, cable, VPN), as on Ubuntu; systemd's own network manager would fight it, so it's kept off.

package.nami
# NetworkManager runs the network (Wi-Fi, cable, VPN), as on Ubuntu;
# systemd's own network manager would fight it, so it's kept off.
services:
  - NetworkManager.service
# Everyone may change the network.
groups:
  networkmanager: everyone
without:
  - systemd-networkd.service
  - systemd-networkd.socket
  - systemd-networkd-wait-online.service
  - systemd-networkd-varlink.socket
  - systemd-networkd-varlink-metrics.socket
  - systemd-networkd-persistent-storage.service
  - systemd-network-generator.service
files:
  /etc/NetworkManager/NetworkManager.conf: |
    [main]
    plugins=keyfile
    dns=systemd-resolved
  /etc/tmpfiles.d/networkmanager.conf: |
    d /var/lib/NetworkManager 0700 root root -
    d /etc/NetworkManager/system-connections 0700 root root -
  # VPN plugins (openvpn's, in gnome): NetworkManager finds them in
  # /etc/NetworkManager/VPN, where they're listed as the system is put
  # together.
  /etc/NetworkManager/VPN:
    script: |
      shopt -s nullglob
      mkdir -p "$out"
      for p in $packages; do
        for f in "$p"/lib/NetworkManager/VPN/*.name; do
          [ -e "$out/${f##*/}" ] || cp "$f" "$out/"
        done
      done
checks.nami
# How to tell networkmanager works, on a computer nami made (tests/usb.sh runs these).
"the network (NetworkManager)":
  run: nmcli -t -f STATE general; systemctl is-active systemd-networkd
  expect: "^connected"
"one network manager (not systemd-networkd too)":
  run: systemctl is-active systemd-networkd || true
  expect: "^inactive"
"VPN: NetworkManager's list of plugins, each with its program":
  run: for f in /etc/NetworkManager/VPN/*.name; do p=$(sed -n 's/^program=//p' "$f"); [ -x "$p" ] && echo "PLUGIN ${f##*/}"; done
  expect: "PLUGIN nm-"

niri

1 file

Windows side by side in a row that scrolls, by keyboard: niri itself, with what it needs around it: the login screen, files, the keyring, X11 apps and the portal. Its bar, launcher and the rest are a look: namios-look (nami's own desktop). It's niri with namiOS's changes (desktop/niri), so floating windows behave as a Mac's. Compiled once per change of the patches (packaging/desktop-release.sh writes the version and checksum here), so no computer compiles it.

package.nami
# Windows side by side in a row that scrolls, by keyboard: niri itself,
# with what it needs around it: the login screen, files, the keyring,
# X11 apps and the portal. Its bar, launcher and the rest are a look:
# namios-look (nami's own desktop).
#
# It's niri with namiOS's changes (desktop/niri), so floating windows behave as
# a Mac's. Compiled once per change of the patches
# (packaging/desktop-release.sh writes the version and checksum here), so no
# computer compiles it.
name: niri
version: 26.04-nami.1
source:
  url: https://namios.dev/releases/0.18.9/niri-26.04-nami.1-x86_64-linux.tar.gz
  sha256: 483b4683f322d1882ed7b010b6a837a9aa8c8add5170f0f7dddfa79268fa8b4c
build-deps: [autoPatchelfHook]
deps: [libgcc.lib, cairo, pango, glib, libinput, libxkbcommon, wayland, seatd, systemd, libgbm, libdisplay-info_0_3, pipewire, libglvnd]
# It opens these as it starts (not named in the program, so they'd be dropped).
runtime-deps: [wayland, libxkbcommon, libglvnd, libgbm]
install: |
  mkdir -p $out
  cp -r bin share $out/
  sed -i "s|^ExecStart=niri |ExecStart=$out/bin/niri |" $out/share/systemd/user/niri.service
packages:
  - desktop
  - gdm
  # Files, and the keyring (GNOME's).
  - nautilus
  - gnome-keyring
  - gcr_4
  - xwayland-satellite
  - xdg-desktop-portal-gnome
  # VPN connections (OpenVPN's, in Settings' VPN).
  - networkmanager-openvpn
  - brightnessctl

nssmdns

2 files

.local names (computer.local) for every program, through avahi.

package.nami
# .local names (computer.local) for every program, through avahi.
name-lookup: ["mdns_minimal [NOTFOUND=return]"]
checks.nami
# How to tell nssmdns works, on a computer nami made (tests/usb.sh runs these).
"this computer's .local name":
  run: getent hosts "$(uname -n).local"
  expect: "local"

nvidia

2 files

NVIDIA's own driver, as Ubuntu's "Additional Drivers" puts it on: the desktop (niri, on Wayland) draws with the card, and CUDA and nvidia-smi work. - nvidia (next to namios) in computer.nami. A computer without an NVIDIA card starts as before: nothing here loads without one. The driver is NVIDIA's 595, for cards from Turing on (GTX 16xx, RTX 20xx and newer, Quadro T and RTX A), with NVIDIA's open kernel modules, which NVIDIA and Ubuntu use for those cards. Older ones (Maxwell, Pascal and Volta: GTX 750 to GTX 1080 Ti) take nvidia-legacy instead; nami doctor says which of the two a computer's card is for. Its libraries aren't free software, so the binary cache doesn't have them: nami builds them once from NVIDIA's download (a few minutes). Secure Boot stays on: the kernel (nixpkgs') doesn't check modules' signatures (MODULE_SIG off) and has no lockdown (SECURITY_LOCKDOWN_LSM off), so NVIDIA's modules load unsigned; shim and systemd-boot check only the kernel, which is signed with the computer's key. The kernel modules (nvidia, nvidia_modeset, nvidia_drm, nvidia_uvm), built for the system's kernel, linuxPackages: the version of each must match. They join the kernel's own in /lib/modules.

package.nami
# NVIDIA's own driver, as Ubuntu's "Additional Drivers" puts it on: the
# desktop (niri, on Wayland) draws with the card, and CUDA and nvidia-smi
# work. `- nvidia` (next to namios) in computer.nami. A computer without
# an NVIDIA card starts as before: nothing here loads without one.
#
# The driver is NVIDIA's 595, for cards from Turing on (GTX 16xx, RTX 20xx
# and newer, Quadro T and RTX A), with NVIDIA's open kernel modules,
# which NVIDIA and Ubuntu use for those cards. Older ones (Maxwell, Pascal
# and Volta: GTX 750 to GTX 1080 Ti) take nvidia-legacy instead; `nami
# doctor` says which of the two a computer's card is for.
#
# Its libraries aren't free software, so the binary cache doesn't have
# them: nami builds them once from NVIDIA's download (a few minutes).
#
# Secure Boot stays on: the kernel (nixpkgs') doesn't check modules'
# signatures (MODULE_SIG off) and has no lockdown (SECURITY_LOCKDOWN_LSM
# off), so NVIDIA's modules load unsigned; shim and systemd-boot check
# only the kernel, which is signed with the computer's key.
# The kernel modules (nvidia, nvidia_modeset, nvidia_drm, nvidia_uvm),
# built for the system's kernel, linuxPackages: the version of each
# must match. They join the kernel's own in /lib/modules.
drivers:
  # The card's own processor runs this (GSP), which the open modules need.
  firmware: [linuxPackages.nvidia_x11.firmware]
  # OpenGL, EGL, Vulkan, GBM and VDPAU, next to mesa's in
  # /run/opengl-driver; and EGL's ways onto Wayland, GBM and X11 (NVIDIA's
  # EGL finds them in /etc/egl).
  graphics: [linuxPackages.nvidia_x11.out, egl-wayland, egl-wayland2, egl-gbm, egl-x11]
  # Their 32-bit builds, for 32-bit programs (most of Steam's games):
  # part of the same driver, so nothing more is built.
  graphics-32bit: [linuxPackages.nvidia_x11.lib32]
  kernel-modules: [linuxPackages.nvidia_x11_stable_open]
packages:
  # nvidia-smi, nvidia-bug-report.sh, and CUDA's MPS.
  - linuxPackages.nvidia_x11.bin
files:
  /etc/modprobe.d/nvidia.conf: |
    # nouveau (and nova, after it) would take the card first.
    blacklist nouveau
    blacklist nova_core
    blacklist nvidiafb
    # The desktop draws through the kernel (KMS), as Wayland needs; the
    # text console too (fbdev).
    options nvidia_drm modeset=1 fbdev=1
    # What's on the screen survives suspend: the kernel tells the
    # driver (595 and the open modules do it without systemd services),
    # and the card's memory is saved on the disk, not in RAM.
    options nvidia NVreg_PreserveVideoMemoryAllocations=1 NVreg_UseKernelSuspendNotifiers=1 NVreg_TemporaryFilePath=/var/tmp
  /etc/udev/rules.d/60-nvidia.rules: |
    # udev loads nvidia for an NVIDIA card (by its PCI id); once it's
    # in, the rest: the display (nvidia_drm, with nvidia_modeset) and
    # CUDA's memory (nvidia_uvm). Without a card, nvidia doesn't load,
    # and neither do these.
    ACTION=="add", SUBSYSTEM=="module", KERNEL=="nvidia", RUN{builtin}+="kmod load nvidia_modeset nvidia_drm nvidia_uvm"
    # The device files the driver's libraries open (on Ubuntu,
    # nvidia-modprobe makes them).
    ACTION=="add", SUBSYSTEM=="module", KERNEL=="nvidia", RUN+="/run/current-system/sw/bin/sh -c 'PATH=/run/current-system/sw/bin; mknod -m 666 /dev/nvidiactl c 195 255; for i in $$(cat /proc/driver/nvidia/gpus/*/information | grep Minor | cut -d \  -f 4); do mknod -m 666 /dev/nvidia$${i} c 195 $${i}; done'"
    ACTION=="add", SUBSYSTEM=="module", KERNEL=="nvidia_modeset", RUN+="/run/current-system/sw/bin/sh -c 'PATH=/run/current-system/sw/bin; mknod -m 666 /dev/nvidia-modeset c 195 254'"
    ACTION=="add", SUBSYSTEM=="module", KERNEL=="nvidia_uvm", RUN+="/run/current-system/sw/bin/sh -c 'PATH=/run/current-system/sw/bin; d=$$(grep nvidia-uvm /proc/devices | cut -d \  -f 1); mknod -m 666 /dev/nvidia-uvm c $$d 0; mknod -m 666 /dev/nvidia-uvm-tools c $$d 1'"
  # With an NVIDIA card, the login screen waits for udev to have loaded
  # its driver (a few seconds), so it starts on the card and not on the
  # firmware's screen, which nvidia_drm then takes away.
  /etc/systemd/system/gdm.service.d/nvidia.conf: |
    [Service]
    ExecStartPre=-/run/current-system/sw/bin/sh -c 'PATH=/run/current-system/sw/bin; if grep -qsx 0x10de /sys/bus/pci/devices/*/vendor; then udevadm settle -t 15; fi'
hardware:
  # Made by packaging/nvidia-ids.py from NVIDIA's own list of cards.
  pci: [
    "10de:1e02", "10de:1e04", "10de:1e07", "10de:1e09", "10de:1e30",
    "10de:1e36", "10de:1e78", "10de:1e81", "10de:1e82", "10de:1e84",
    "10de:1e87", "10de:1e89", "10de:1e90", "10de:1e91", "10de:1e93",
    "10de:1eb0", "10de:1eb1", "10de:1eb5", "10de:1eb6", "10de:1eb8",
    "10de:1ec2", "10de:1ec7", "10de:1ed0", "10de:1ed1", "10de:1ed3",
    "10de:1ef5", "10de:1f02", "10de:1f03", "10de:1f06", "10de:1f07",
    "10de:1f08", "10de:1f0a", "10de:1f0b", "10de:1f10", "10de:1f11",
    "10de:1f12", "10de:1f14", "10de:1f15", "10de:1f36", "10de:1f42",
    "10de:1f47", "10de:1f50", "10de:1f51", "10de:1f54", "10de:1f55",
    "10de:1f76", "10de:1f82", "10de:1f83", "10de:1f91", "10de:1f95",
    "10de:1f96", "10de:1f97", "10de:1f98", "10de:1f99", "10de:1f9c",
    "10de:1f9d", "10de:1f9f", "10de:1fa0", "10de:1fb0", "10de:1fb1",
    "10de:1fb2", "10de:1fb6", "10de:1fb7", "10de:1fb8", "10de:1fb9",
    "10de:1fba", "10de:1fbb", "10de:1fbc", "10de:1fdd", "10de:1ff0",
    "10de:1ff2", "10de:1ff9", "10de:20b0", "10de:20b2", "10de:20b3",
    "10de:20b5", "10de:20b6", "10de:20b7", "10de:20bd", "10de:20f1",
    "10de:20f3", "10de:20f5", "10de:20f6", "10de:20fd", "10de:2182",
    "10de:2184", "10de:2187", "10de:2188", "10de:2189", "10de:2191",
    "10de:2192", "10de:21c4", "10de:21d1", "10de:2203", "10de:2204",
    "10de:2206", "10de:2207", "10de:2208", "10de:220a", "10de:220d",
    "10de:2216", "10de:2230", "10de:2231", "10de:2232", "10de:2233",
    "10de:2235", "10de:2236", "10de:2237", "10de:2238", "10de:230e",
    "10de:2321", "10de:2322", "10de:2324", "10de:2329", "10de:232c",
    "10de:2330", "10de:2331", "10de:2335", "10de:2339", "10de:233a",
    "10de:233b", "10de:2342", "10de:2348", "10de:2414", "10de:2420",
    "10de:2438", "10de:2460", "10de:2482", "10de:2484", "10de:2486",
    "10de:2487", "10de:2488", "10de:2489", "10de:248a", "10de:249c",
    "10de:249d", "10de:24a0", "10de:24b0", "10de:24b1", "10de:24b6",
    "10de:24b7", "10de:24b8", "10de:24b9", "10de:24ba", "10de:24bb",
    "10de:24c7", "10de:24c9", "10de:24dc", "10de:24dd", "10de:24e0",
    "10de:24fa", "10de:2503", "10de:2504", "10de:2507", "10de:2508",
    "10de:2520", "10de:2521", "10de:2523", "10de:2531", "10de:2544",
    "10de:2560", "10de:2563", "10de:2571", "10de:2582", "10de:2584",
    "10de:25a0", "10de:25a2", "10de:25a5", "10de:25a6", "10de:25a7",
    "10de:25a9", "10de:25aa", "10de:25ab", "10de:25ac", "10de:25ad",
    "10de:25b0", "10de:25b2", "10de:25b6", "10de:25b8", "10de:25b9",
    "10de:25ba", "10de:25bb", "10de:25bc", "10de:25bd", "10de:25e0",
    "10de:25e2", "10de:25e5", "10de:25ec", "10de:25ed", "10de:25f9",
    "10de:25fa", "10de:25fb", "10de:2684", "10de:2685", "10de:2689",
    "10de:26b1", "10de:26b2", "10de:26b3", "10de:26b5", "10de:26b9",
    "10de:26ba", "10de:2702", "10de:2704", "10de:2705", "10de:2709",
    "10de:2717", "10de:2730", "10de:2757", "10de:2770", "10de:2782",
    "10de:2783", "10de:2786", "10de:2788", "10de:27a0", "10de:27b0",
    "10de:27b1", "10de:27b2", "10de:27b6", "10de:27b8", "10de:27ba",
    "10de:27bb", "10de:27e0", "10de:27fb", "10de:2803", "10de:2805",
    "10de:2808", "10de:2820", "10de:2822", "10de:2838", "10de:2860",
    "10de:2882", "10de:28a0", "10de:28a1", "10de:28a3", "10de:28b0",
    "10de:28b8", "10de:28b9", "10de:28ba", "10de:28bb", "10de:28e0",
    "10de:28e1", "10de:28e3", "10de:28f8", "10de:2901", "10de:2909",
    "10de:2941", "10de:29bb", "10de:2b85", "10de:2b87", "10de:2b8c",
    "10de:2bb1", "10de:2bb3", "10de:2bb4", "10de:2bb5", "10de:2bb9",
    "10de:2c02", "10de:2c05", "10de:2c18", "10de:2c19", "10de:2c31",
    "10de:2c33", "10de:2c34", "10de:2c38", "10de:2c39", "10de:2c3a",
    "10de:2c58", "10de:2c59", "10de:2c77", "10de:2c79", "10de:2d04",
    "10de:2d05", "10de:2d18", "10de:2d19", "10de:2d30", "10de:2d39",
    "10de:2d58", "10de:2d59", "10de:2d79", "10de:2d83", "10de:2d98",
    "10de:2db8", "10de:2db9", "10de:2dd8", "10de:2df9", "10de:2e12",
    "10de:2f04", "10de:2f06", "10de:2f18", "10de:2f38", "10de:2f58",
    "10de:3182", "10de:31c2", "10de:31c3"
  ]
checks.nami
# How to tell nvidia works, on a computer nami made (tests/usb.sh runs these).
"NVIDIA: the modules are built for the kernel that runs":
  run: '[ "$(modinfo -F vermagic nvidia | cut -d" " -f1)" = "$(uname -r)" ] && modinfo -F vermagic nvidia_drm && echo SAME'
  expect: "SAME"
"NVIDIA: modprobe knows what needs what (depmod)":
  run: modprobe -D nvidia_drm 2>&1 | tr '\n' ' '
  expect: "nvidia\\.ko.*nvidia-modeset\\.ko.*nvidia-drm\\.ko"
"NVIDIA: nouveau is kept away, and the display gets KMS":
  run: modprobe -c | grep -E '^(blacklist nouveau|options nvidia_drm)' | tr '\n' ' '
  expect: "blacklist nouveau options nvidia_drm modeset=1 fbdev=1"
"NVIDIA: the card's firmware (GSP)":
  run: ls /run/current-system/firmware/lib/firmware/nvidia/[0-9]*/
  expect: "gsp_ga10x\\.bin\\.zst"
"NVIDIA: the libraries, next to mesa's":
  run: ls /run/opengl-driver/share/glvnd/egl_vendor.d /run/opengl-driver/lib/gbm /run/opengl-driver/share/vulkan/icd.d /etc/egl/egl_external_platform.d | grep -cxE '10_nvidia.json|50_mesa.json|nvidia-drm_gbm.so|nvidia_icd.json|10_nvidia_wayland.json|15_nvidia_gbm.json' | sed 's/^/N=/'
  expect: "N=6"
"NVIDIA: nvidia-smi runs":
  run: nvidia-smi 2>&1 | head -3
  expect: "NVIDIA-SMI|Driver Version|NVIDIA driver"

NVIDIA's driver for older cards: Maxwell, Pascal and Volta (GTX 750 to GTX 1080 Ti, Quadro M and P, Titan V), which the nvidia example's driver no longer has. - nvidia-legacy in computer.nami, in place of nvidia; nami doctor says which of the two a computer's card is for. Cards from Turing on (GTX 16xx, RTX 20xx and newer) take nvidia. The driver is NVIDIA's 535, the long-lived branch, with NVIDIA's own (closed) kernel modules: the open ones are for Turing on only. Its libraries and modules aren't free software, so the binary cache doesn't have them: nami builds them once from NVIDIA's download (a few minutes). Its modules are built for nixpkgs' default kernel (linuxPackages), so this goes without a kernel-* add-on. Secure Boot stays on: the kernel (nixpkgs') doesn't check modules' signatures, so NVIDIA's modules load unsigned.

package.nami
# NVIDIA's driver for older cards: Maxwell, Pascal and Volta (GTX 750 to
# GTX 1080 Ti, Quadro M and P, Titan V), which the nvidia example's driver
# no longer has. `- nvidia-legacy` in computer.nami, in place of nvidia;
# `nami doctor` says which of the two a computer's card is for. Cards from
# Turing on (GTX 16xx, RTX 20xx and newer) take nvidia.
#
# The driver is NVIDIA's 535, the long-lived branch, with NVIDIA's own
# (closed) kernel modules: the open ones are for Turing on only. Its
# libraries and modules aren't free software, so the binary cache doesn't
# have them: nami builds them once from NVIDIA's download (a few minutes).
# Its modules are built for nixpkgs' default kernel (linuxPackages), so
# this goes without a kernel-* add-on.
#
# Secure Boot stays on: the kernel (nixpkgs') doesn't check modules'
# signatures, so NVIDIA's modules load unsigned.
drivers:
  # OpenGL, EGL, Vulkan, GBM and VDPAU, next to mesa's in
  # /run/opengl-driver, and EGL's ways onto Wayland and GBM.
  graphics: [linuxPackages.nvidia_x11_legacy535.out, egl-wayland, egl-gbm]
  # The 32-bit ones, for 32-bit programs (most of Steam's games).
  graphics-32bit: [linuxPackages.nvidia_x11_legacy535.lib32]
  # The kernel modules (nvidia, nvidia_modeset, nvidia_drm, nvidia_uvm),
  # built for the system's kernel.
  kernel-modules: [linuxPackages.nvidia_x11_legacy535_modules]
packages:
  # nvidia-smi, nvidia-bug-report.sh, and CUDA's MPS.
  - linuxPackages.nvidia_x11_legacy535.bin
  # fgconsole and chvt, which suspending with the card uses.
  - kbd
services:
  - nvidia-suspend.service
  - nvidia-hibernate.service
  - nvidia-resume.service
files:
  /etc/modprobe.d/nvidia.conf: |
    # nouveau (and nova, after it) would take the card first.
    blacklist nouveau
    blacklist nova_core
    blacklist nvidiafb
    # The desktop draws through the kernel (KMS), as Wayland needs.
    options nvidia_drm modeset=1
    # What's on the screen survives suspend: the card's memory is saved on
    # the disk, not in RAM (the services below tell the driver when).
    options nvidia NVreg_PreserveVideoMemoryAllocations=1 NVreg_TemporaryFilePath=/var/tmp
  /etc/udev/rules.d/60-nvidia.rules: |
    # udev loads nvidia for an NVIDIA card (by its PCI id); once it's
    # in, the rest: the display (nvidia_drm, with nvidia_modeset) and
    # CUDA's memory (nvidia_uvm). Without a card, nvidia doesn't load,
    # and neither do these.
    ACTION=="add", SUBSYSTEM=="module", KERNEL=="nvidia", RUN{builtin}+="kmod load nvidia_modeset nvidia_drm nvidia_uvm"
    # The device files the driver's libraries open.
    ACTION=="add", SUBSYSTEM=="module", KERNEL=="nvidia", RUN+="/run/current-system/sw/bin/sh -c 'PATH=/run/current-system/sw/bin; mknod -m 666 /dev/nvidiactl c 195 255; for i in $$(cat /proc/driver/nvidia/gpus/*/information | grep Minor | cut -d \  -f 4); do mknod -m 666 /dev/nvidia$${i} c 195 $${i}; done'"
    ACTION=="add", SUBSYSTEM=="module", KERNEL=="nvidia_modeset", RUN+="/run/current-system/sw/bin/sh -c 'PATH=/run/current-system/sw/bin; mknod -m 666 /dev/nvidia-modeset c 195 254'"
    ACTION=="add", SUBSYSTEM=="module", KERNEL=="nvidia_uvm", RUN+="/run/current-system/sw/bin/sh -c 'PATH=/run/current-system/sw/bin; d=$$(grep nvidia-uvm /proc/devices | cut -d \  -f 1); mknod -m 666 /dev/nvidia-uvm c $$d 0; mknod -m 666 /dev/nvidia-uvm-tools c $$d 1'"
  # Suspend and hibernate: the 535 driver is told by these (newer ones by
  # the kernel itself), as NVIDIA's own nvidia-*.service files do.
  /etc/systemd/system/nvidia-suspend.service: |
    [Unit]
    Description=NVIDIA system suspend actions
    Before=systemd-suspend.service
    [Service]
    Type=oneshot
    Environment=PATH=/run/current-system/sw/bin
    ExecStart=/run/opengl-driver/bin/nvidia-sleep.sh suspend
    [Install]
    RequiredBy=systemd-suspend.service
  /etc/systemd/system/nvidia-hibernate.service: |
    [Unit]
    Description=NVIDIA system hibernate actions
    Before=systemd-hibernate.service
    [Service]
    Type=oneshot
    Environment=PATH=/run/current-system/sw/bin
    ExecStart=/run/opengl-driver/bin/nvidia-sleep.sh hibernate
    [Install]
    RequiredBy=systemd-hibernate.service
  /etc/systemd/system/nvidia-resume.service: |
    [Unit]
    Description=NVIDIA system resume actions
    After=systemd-suspend.service systemd-hibernate.service
    [Service]
    Type=oneshot
    Environment=PATH=/run/current-system/sw/bin
    ExecStart=/run/opengl-driver/bin/nvidia-sleep.sh resume
    [Install]
    RequiredBy=systemd-suspend.service systemd-hibernate.service
  # With an NVIDIA card, the login screen waits for udev to have loaded
  # its driver (a few seconds), so it starts on the card and not on the
  # firmware's screen, which nvidia_drm then takes away.
  /etc/systemd/system/gdm.service.d/nvidia.conf: |
    [Service]
    ExecStartPre=-/run/current-system/sw/bin/sh -c 'PATH=/run/current-system/sw/bin; if grep -qsx 0x10de /sys/bus/pci/devices/*/vendor; then udevadm settle -t 15; fi'
hardware:
  # Made by packaging/nvidia-ids.py from NVIDIA's own list of cards.
  pci: [
    "10de:1340", "10de:1341", "10de:1344", "10de:1346", "10de:1347",
    "10de:1348", "10de:1349", "10de:134b", "10de:134d", "10de:134e",
    "10de:134f", "10de:137a", "10de:137b", "10de:137d", "10de:1380",
    "10de:1381", "10de:1382", "10de:1390", "10de:1391", "10de:1392",
    "10de:1393", "10de:1398", "10de:1399", "10de:139a", "10de:139b",
    "10de:139c", "10de:139d", "10de:13b0", "10de:13b1", "10de:13b2",
    "10de:13b3", "10de:13b4", "10de:13b6", "10de:13b9", "10de:13ba",
    "10de:13bb", "10de:13bc", "10de:13c0", "10de:13c2", "10de:13d7",
    "10de:13d8", "10de:13d9", "10de:13da", "10de:13f0", "10de:13f1",
    "10de:13f2", "10de:13f3", "10de:13f8", "10de:13f9", "10de:13fa",
    "10de:13fb", "10de:1401", "10de:1402", "10de:1406", "10de:1407",
    "10de:1427", "10de:1430", "10de:1431", "10de:1436", "10de:15f0",
    "10de:15f7", "10de:15f8", "10de:15f9", "10de:1617", "10de:1618",
    "10de:1619", "10de:161a", "10de:1667", "10de:174d", "10de:174e",
    "10de:179c", "10de:17c2", "10de:17c8", "10de:17f0", "10de:17f1",
    "10de:17fd", "10de:1b00", "10de:1b02", "10de:1b06", "10de:1b30",
    "10de:1b38", "10de:1b80", "10de:1b81", "10de:1b82", "10de:1b83",
    "10de:1b84", "10de:1b87", "10de:1ba0", "10de:1ba1", "10de:1ba2",
    "10de:1bb0", "10de:1bb1", "10de:1bb3", "10de:1bb4", "10de:1bb5",
    "10de:1bb6", "10de:1bb7", "10de:1bb8", "10de:1bb9", "10de:1bbb",
    "10de:1bc7", "10de:1be0", "10de:1be1", "10de:1c02", "10de:1c03",
    "10de:1c04", "10de:1c06", "10de:1c07", "10de:1c09", "10de:1c20",
    "10de:1c21", "10de:1c22", "10de:1c23", "10de:1c30", "10de:1c31",
    "10de:1c60", "10de:1c61", "10de:1c62", "10de:1c81", "10de:1c82",
    "10de:1c83", "10de:1c8c", "10de:1c8d", "10de:1c8f", "10de:1c90",
    "10de:1c91", "10de:1c92", "10de:1c94", "10de:1c96", "10de:1cb1",
    "10de:1cb2", "10de:1cb3", "10de:1cb6", "10de:1cba", "10de:1cbb",
    "10de:1cbc", "10de:1cbd", "10de:1cfa", "10de:1cfb", "10de:1d01",
    "10de:1d02", "10de:1d10", "10de:1d11", "10de:1d12", "10de:1d13",
    "10de:1d16", "10de:1d33", "10de:1d34", "10de:1d52", "10de:1d81",
    "10de:1db1", "10de:1db3", "10de:1db4", "10de:1db5", "10de:1db6",
    "10de:1db7", "10de:1db8", "10de:1dba", "10de:1df0", "10de:1df2",
    "10de:1df5", "10de:1df6"
  ]
checks.nami
# How to tell nvidia-legacy works, on a computer nami made (tests/usb.sh runs these).
"NVIDIA (older cards): the 535 modules, built for the kernel that runs":
  run: '[ "$(modinfo -F vermagic nvidia | cut -d" " -f1)" = "$(uname -r)" ] && modinfo -F version nvidia'
  expect: "^535\\."
"NVIDIA (older cards): modprobe knows what needs what (depmod)":
  run: modprobe -D nvidia_drm 2>&1 | tr '\n' ' '
  expect: "nvidia\\.ko.*nvidia-modeset\\.ko.*nvidia-drm\\.ko"
"NVIDIA (older cards): nouveau is kept away, and the display gets KMS":
  run: modprobe -c | grep -E '^(blacklist nouveau|options nvidia_drm)' | tr '\n' ' '
  expect: "blacklist nouveau options nvidia_drm modeset=1"
"NVIDIA (older cards): the libraries, next to mesa's, 32-bit too":
  run: ls /run/opengl-driver/share/glvnd/egl_vendor.d /run/opengl-driver/share/vulkan/icd.d /run/opengl-driver-32/lib | grep -cxE '10_nvidia.json|50_mesa.json|nvidia_icd.json|libEGL_nvidia.so.0' | sed 's/^/N=/'
  expect: "N=4"
"NVIDIA (older cards): suspend tells the driver":
  run: systemctl is-enabled nvidia-suspend.service nvidia-resume.service | tr '\n' ' '
  expect: "^enabled enabled"
"NVIDIA (older cards): nvidia-smi runs":
  run: nvidia-smi 2>&1 | head -3
  expect: "NVIDIA-SMI|Driver Version|NVIDIA driver"

office

1 file

Office and email: documents, spreadsheets, slides, PDFs and mail. Others: onlyoffice-desktopeditors, obsidian, joplin-desktop, xournalpp.

package.nami
# Office and email: documents, spreadsheets, slides, PDFs and mail.
# Others: onlyoffice-desktopeditors, obsidian, joplin-desktop, xournalpp.
packages:
  - libreoffice
  - thunderbird
  - papers           # PDFs

oomd

2 files

Running out of memory, as Ubuntu handles it (systemd-oomd): when a person's apps make the computer crawl for want of memory, the worst of them is stopped, before everything freezes. desktop lists this.

package.nami
# Running out of memory, as Ubuntu handles it (systemd-oomd): when a
# person's apps make the computer crawl for want of memory, the worst of
# them is stopped, before everything freezes. desktop lists this.
services:
  - systemd-oomd.service
files:
  # It starts once the memory controller is there (its condition, checked
  # at the socket too early in the start, would keep it off).
  /etc/systemd/system/systemd-oomd.service.d/nami.conf: |
    [Unit]
    ConditionControlGroupController=
  /etc/systemd/system/systemd-oomd.socket.d/nami.conf: |
    [Unit]
    ConditionControlGroupController=
  # Each person's apps: stopped when they wait for memory half the time.
  /etc/systemd/system/user@.service.d/oomd.conf: |
    [Service]
    ManagedOOMMemoryPressure=kill
    ManagedOOMMemoryPressureLimit=50%
checks.nami
# How to tell oomd works, on a computer nami made (tests/usb.sh runs these).
"running out of memory: systemd-oomd watches each person's apps":
  run: echo $(systemctl is-active systemd-oomd) $(systemctl show "user@$(id -u).service" -p ManagedOOMMemoryPressure)
  expect: "^active ManagedOOMMemoryPressure=kill"

openssh

1 file

OpenSSH: logging in from another computer (sshd), with the password (a finger can't be from afar).

package.nami
# OpenSSH: logging in from another computer (sshd), with the password
# (a finger can't be from afar).
login:
  sshd: password

Programs built for other distributions: a prebuilt program from GitHub's releases, npm's and pip's prebuilt ones, rustup's tools, a game's. They ask for their loader at /lib64/ld-linux-x86-64.so.2 and their libraries at /usr/lib, which namiOS doesn't have. nix-ld is that loader here: it starts them with the system's glibc and finds their libraries in the set below (and other-linuxes-desktop's), joined in /run/current-system/sw/share/nix-ld/lib. Only those programs look there: the system's own have their libraries already, and don't see these. A library missing from the set is said by name, with the package that has it (nami libraries <program>, and after one fails in a terminal); nami libraries --add <program> adds it to that person's own set. base lists it; leave it out with without: [other-linuxes].

package.nami
# Programs built for other distributions: a prebuilt program from GitHub's
# releases, npm's and pip's prebuilt ones, rustup's tools, a game's. They
# ask for their loader at /lib64/ld-linux-x86-64.so.2 and their libraries at
# /usr/lib, which namiOS doesn't have. nix-ld is that loader here: it starts
# them with the system's glibc and finds their libraries in the set below
# (and other-linuxes-desktop's), joined in
# /run/current-system/sw/share/nix-ld/lib. Only those programs look there:
# the system's own have their libraries already, and don't see these.
# A library missing from the set is said by name, with the package that
# has it (`nami libraries <program>`, and after one fails in a terminal);
# `nami libraries --add <program>` adds it to that person's own set.
# base lists it; leave it out with `without: [other-linuxes]`.
packages:
  - nix-ld
# What they link to most, on a computer without a desktop too: C++'s and
# GCC's runtime, compression, TLS and the network, text and data formats,
# the system's own (systemd's, D-Bus', PAM's), and FUSE.
libraries:
  - libgcc
  - zlib
  - zstd
  - bzip2
  - xz
  - lz4
  - brotli
  - libarchive
  - openssl
  - curl
  - nghttp2
  - libidn2
  - libpsl
  - libssh
  - libssh2
  - krb5
  - keyutils
  - e2fsprogs
  - openldap
  - cyrus_sasl
  - gnutls
  - nettle
  - p11-kit
  - libtasn1
  - libgcrypt
  - libgpg-error
  - icu
  - libxml2
  - libxslt
  - expat
  - pcre2
  - glib
  - sqlite
  - libffi
  - gmp
  - readline
  - ncurses
  # libtinfo.so.5 and libncurses.so.5, which older programs want.
  - ncurses5
  # libcrypt.so.1, which glibc had.
  - libxcrypt-legacy
  - libxcrypt
  - util-linux
  - attr
  - acl
  - libcap
  - libsodium
  - systemdLibs
  - dbus
  - libuv
  - libunwind
  - elfutils
  - libbsd
  - libmd
  - libusb1
  - libnsl
  - libtirpc
  - numactl
  - linux-pam
  - libevent
  - fuse3
# Where they look, in order: the set, the graphics driver's own libraries
# (CUDA's libcuda, for pip's PyTorch), and the person's own set.
env:
  NIX_LD_LIBRARY_PATH: /run/current-system/sw/share/nix-ld/lib:/run/opengl-driver/lib:$HOME/.local/state/nami/libraries
files:
  # Commands of apps installed from downloads (`nami install ./foo.deb`) go in
  # ~/.local/bin, as on other distributions: on PATH, after the system's own.
  /etc/profile.d/local-bin.sh: |
    case ":$PATH:" in *":$HOME/.local/bin:"*) ;; *) PATH="$PATH:$HOME/.local/bin" ;; esac
  # A program for another distribution that just failed to start in a terminal
  # (127, the loader's "error while loading shared libraries"): which
  # library it lacks, in words, and the package with it.
  /etc/bashrc.d/other-linuxes.sh: |
    _nami_lacks() {
      local s=$? w f
      if [ "$s" = 127 ]; then
        w=$(HISTTIMEFORMAT= history 1 | sed 's/^ *[0-9]* *//')
        w=${w%% *}; w=${w/#\~/$HOME}
        case $w in */*) f=$w ;; *) f=$(type -P -- "$w" 2>/dev/null) ;; esac
        [ -n "$f" ] && [ -f "$f" ] && /nix/var/nami/bin/nami libraries --after-failure -- "$f"
      fi
      return $s
    }
    PROMPT_COMMAND="_nami_lacks${PROMPT_COMMAND:+; $PROMPT_COMMAND}"
  /etc/zshrc.d/other-linuxes.zsh: |
    _nami_lacks_cmd=
    _nami_lacks_preexec() { _nami_lacks_cmd=$1 }
    _nami_lacks_precmd() {
      local s=$? w f
      local -a words
      if [[ $s == 127 && -n $_nami_lacks_cmd ]]; then
        words=(${(z)_nami_lacks_cmd}); w=${(Q)words[1]}; w=${w/#\~/$HOME}
        if [[ $w == */* ]]; then f=$w; else f=$(whence -p -- $w 2>/dev/null); fi
        [[ -n $f && -f $f ]] && /nix/var/nami/bin/nami libraries --after-failure -- $f
      fi
      _nami_lacks_cmd=
      return $s
    }
    preexec_functions+=(_nami_lacks_preexec)
    precmd_functions=(_nami_lacks_precmd $precmd_functions)
checks.nami
# How to tell other-linuxes works, on a computer nami made (tests/usb.sh runs these).
"programs built for other distributions start with nix-ld, which has the system's glibc":
  run: echo "$(readlink /lib64/ld-linux-x86-64.so.2) $(readlink -f /run/current-system/sw/share/nix-ld/lib/ld.so)"
  expect: "nix-ld-[0-9.]+/libexec/nix-ld /nix/store/[a-z0-9]{32}-glibc-[0-9.-]+/lib/ld-linux-x86-64\\.so\\.2$"
"and find their libraries: C++'s, zlib, OpenSSL, curl, glibc's old libcrypt and ncurses'":
  run: (cd /run/current-system/sw/share/nix-ld/lib && ls libstdc++.so.6 libgcc_s.so.1 libz.so.1 libssl.so.3 libcurl.so.4 libcrypt.so.1 libtinfo.so.5 libuuid.so.1 libudev.so.1 >/dev/null && echo "SET-OK $(ls | wc -l)")
  expect: "^SET-OK [0-9]{3,}$"
"where they look: the set, the graphics driver's, the person's own (not on everyone's LD_LIBRARY_PATH)":
  run: env -i HOME=/tmp /run/current-system/sw/bin/bash -lc 'case "$LD_LIBRARY_PATH" in *nix-ld*) echo LEAKS;; *) echo OWN;; esac; echo "NIX_LD=$NIX_LD_LIBRARY_PATH"' 2>/dev/null | tr '\n' ' '
  expect: "^OWN NIX_LD=/run/current-system/sw/share/nix-ld/lib:/run/opengl-driver/lib:/tmp/.local/state/nami/libraries $"

Apps built for other distributions, on a desktop: a downloaded app's tarball (VS Code's, Discord's, Zed's, JetBrains'), an AppImage, a game. Next to other-linuxes' set (base has it), the libraries desktop apps and games link to: X11's and Wayland's, OpenGL's and Vulkan's, sound's, GTK's, Chromium's and Electron's (NSS, CUPS, the keyring), SDL's and pictures'. And opening one in Files starts it (nami start: it's made a program first, asked, as downloads aren't; an AppImage is unpacked if FUSE can't mount it), with what it lacks said as a notification, with Add; after its first start, it's offered for the launcher (nami add-to-launcher, with its own name and picture). A downloaded package opened in Files (or from the browser's downloads) — a .deb, an .rpm, an AppImage, a tarball with a program in it — shows in Settings to install, just for that person, no admin password (nami open-package, then nami install <file>; src/foreign.rs). A tarball that's only files is unpacked beside it, as Files does. So does a nami bundle, an app in one file (application/x-tray-bundle, namios-files'; src/bundle_app.rs). desktop lists it; leave it out with without: [other-linuxes-desktop].

package.nami
# Apps built for other distributions, on a desktop: a downloaded app's tarball
# (VS Code's, Discord's, Zed's, JetBrains'), an AppImage, a game. Next to
# other-linuxes' set (base has it), the libraries desktop apps and games
# link to: X11's and Wayland's, OpenGL's and Vulkan's, sound's, GTK's,
# Chromium's and Electron's (NSS, CUPS, the keyring), SDL's and pictures'.
# And opening one in Files starts it (`nami start`: it's made a program
# first, asked, as downloads aren't; an AppImage is unpacked if FUSE can't
# mount it), with what it lacks said as a notification, with Add; after
# its first start, it's offered for the launcher (`nami add-to-launcher`,
# with its own name and picture).
# A downloaded package opened in Files (or from the browser's downloads) —
# a .deb, an .rpm, an AppImage, a tarball with a program in it — shows in
# Settings to install, just for that person, no admin password (`nami
# open-package`, then `nami install <file>`; src/foreign.rs). A tarball
# that's only files is unpacked beside it, as Files does. So does a nami
# bundle, an app in one file (application/x-tray-bundle, namios-files';
# src/bundle_app.rs).
# desktop lists it; leave it out with `without: [other-linuxes-desktop]`.
packages:
  - other-linuxes
  # AppImages of the older kind mount themselves with FUSE 2 (libfuse.so.2,
  # fusermount); fuse3's fusermount3 is base's. nixpkgs dropped FUSE 2 in
  # 26.11 (its `fuse` is FUSE 3 now): its last build, from the catalog's
  # history, ready-built.
  - fuse: 2
  # unsquashfs: what's in an AppImage (its name, icon), read without starting it.
  - squashfs-tools
setuid: [bin/fusermount]
libraries:
  # X11 and Wayland.
  - libx11
  - libxext
  - libxrender
  - libxrandr
  - libxi
  - libxcursor
  - libxfixes
  - libxcomposite
  - libxdamage
  - libxtst
  - libxscrnsaver
  - libxinerama
  - libxxf86vm
  - libsm
  - libice
  - libxau
  - libxdmcp
  - libxcb
  - libxcb-util
  - libxcb-image
  - libxcb-keysyms
  - libxcb-render-util
  - libxcb-wm
  - libxcb-cursor
  - libxmu
  - libxt
  - libxpm
  - libxv
  - libxft
  - libxshmfence
  - libxkbfile
  - libxkbcommon
  - wayland
  - libdecor
  # Graphics: OpenGL, EGL and Vulkan's loaders (the drivers are in
  # /run/opengl-driver), GBM, video decoding.
  - libglvnd
  - libGLU
  - freeglut
  - glew
  - libgbm
  - libdrm
  - libepoxy
  - vulkan-loader
  - libva
  - libvdpau
  # Sound.
  - alsa-lib
  - libpulseaudio
  - pipewire
  - libjack2
  - openal
  - portaudio
  - libsndfile
  - libvorbis
  - libogg
  - flac
  - libopus
  - libmpg123
  - speex
  - libsamplerate
  - libtheora
  - gst_all_1.gstreamer
  - gst_all_1.gst-plugins-base
  # GTK and what draws text and pictures.
  - gtk3
  # (nixpkgs 26.11 dropped GTK 2 and libpng 1.2: their last builds, from the
  # catalog's history, as with FUSE 2.)
  - gtk2@2
  - gtk4
  - pango
  - cairo
  - gdk-pixbuf
  - at-spi2-core
  - fontconfig
  - freetype
  - harfbuzz
  - fribidi
  - graphite2
  - libthai
  - pixman
  - json-glib
  - libsoup_3
  - libportal
  # Chromium's and Electron's: NSS, printing, the keyring, notifications,
  # the panel's icons.
  - nss
  - nspr
  - cups
  - libsecret
  - libnotify
  - libappindicator
  - libayatana-appindicator
  - libdbusmenu
  - libdbusmenu-gtk3
  - libcanberra
  # Pictures.
  - libpng
  - libpng12@1.2
  - libjpeg
  - libjpeg8
  - libtiff
  - libwebp
  - lcms2
  # Games: SDL, controllers, input.
  - SDL2
  - sdl3
  - SDL2_image
  - SDL2_mixer
  - SDL2_ttf
  - hidapi
  - libgudev
  - libevdev
  - libpciaccess
  # AppImages' FUSE 2 (above).
  - fuse@2
files:
  # Opening a program in Files (an AppImage, a downloaded app's program):
  # `nami start`. And "Add to Launcher", in Files' Open With.
  /etc/nami-os/share/applications/nami-start.desktop: |
    [Desktop Entry]
    Type=Application
    Name=Run Program
    Comment=Start a program built for another distribution
    Icon=application-x-executable
    Exec=/nix/var/nami/bin/nami start %f
    MimeType=application/vnd.appimage;application/x-iso9660-appimage;application/x-executable;application/x-pie-executable;application/x-sharedlib;application/x-tray-bundle;
    NoDisplay=true
    Terminal=false
  /etc/nami-os/share/applications/nami-add-to-launcher.desktop: |
    [Desktop Entry]
    Type=Application
    Name=Add to Launcher
    Comment=Put a program built for another distribution in the launcher
    Icon=list-add
    Exec=/nix/var/nami/bin/nami add-to-launcher %f
    MimeType=application/vnd.appimage;application/x-iso9660-appimage;application/x-executable;application/x-pie-executable;
    NoDisplay=true
    Terminal=false
  # A downloaded package to install: Settings shows it, with Install.
  /etc/nami-os/share/applications/nami-install-app.desktop: |
    [Desktop Entry]
    Type=Application
    Name=Install App
    Comment=Install an app built for another distribution, just for you
    Icon=system-software-install
    Exec=/nix/var/nami/bin/nami open-package %f
    MimeType=application/vnd.debian.binary-package;application/x-deb;application/x-rpm;application/x-redhat-package-manager;application/vnd.appimage;application/x-iso9660-appimage;application/x-compressed-tar;application/x-xz-compressed-tar;application/x-zstd-compressed-tar;application/x-tray-bundle;
    NoDisplay=true
    Terminal=false
  # Opening a package shows it to install; an AppImage too (Run Program is in Open
  # With, to start it without installing it); a program, Run Program.
  /etc/nami-os/share/applications/mimeapps.list: |
    [Default Applications]
    application/vnd.debian.binary-package=nami-install-app.desktop
    application/x-deb=nami-install-app.desktop
    application/x-rpm=nami-install-app.desktop
    application/x-redhat-package-manager=nami-install-app.desktop
    application/vnd.appimage=nami-install-app.desktop
    application/x-iso9660-appimage=nami-install-app.desktop
    application/x-tray-bundle=nami-install-app.desktop
    application/x-executable=nami-start.desktop
    application/x-pie-executable=nami-start.desktop
    application/x-sharedlib=nami-start.desktop
checks.nami
# How to tell other-linuxes-desktop works, on a computer nami made (tests/usb.sh runs these).
"downloaded apps find their libraries: GTK, X11, Wayland, OpenGL, Vulkan, sound, NSS, SDL, FUSE 2":
  run: (cd /run/current-system/sw/share/nix-ld/lib && ls libgtk-3.so.0 libX11.so.6 libxcb.so.1 libwayland-client.so.0 libGL.so.1 libEGL.so.1 libvulkan.so.1 libgbm.so.1 libasound.so.2 libpulse.so.0 libnss3.so libsecret-1.so.0 libSDL2-2.0.so.0 libfuse.so.2 >/dev/null && echo SET-OK)
  expect: "^SET-OK$"
"AppImages of the older kind mount themselves (fusermount, setuid)":
  run: stat -c %a /run/wrappers/bin/fusermount /run/wrappers/bin/fusermount3 | tr '\n' ' '
  expect: "^4755 4755 $"
"opening a downloaded program in Files starts it (nami start)":
  run: XDG_DATA_DIRS=/etc/nami-os/share:/run/current-system/sw/share gio mime application/x-pie-executable | head -1 | grep -c "nami-start.desktop" | sed "s/^/N=/"
  expect: "^N=1$"
"opening a .deb, an .rpm or an AppImage in Files shows it in Settings, to install (nami open-package)":
  run: for t in application/vnd.debian.binary-package application/x-rpm application/vnd.appimage; do XDG_DATA_DIRS=/etc/nami-os/share:/run/current-system/sw/share gio mime $t | head -1; done | grep -c "nami-install-app.desktop" | sed "s/^/N=/"
  expect: "^N=3$"
"what's in an AppImage is read without starting it (unsquashfs)":
  run: command -v unsquashfs >/dev/null && echo HAVE
  expect: "^HAVE$"
"opening a nami bundle in Files shows it in Settings, to install (nami open-package)":
  run: XDG_DATA_DIRS=/etc/nami-os/share:/run/current-system/sw/share gio mime application/x-tray-bundle | head -1 | grep -c "nami-install-app.desktop" | sed "s/^/N=/"
  expect: "^N=1$"

Parental controls, as Ubuntu has them (malcontent): a child on the computer (users: <them>: { child: true } in computer.nami) logs in only in their hours, and their session ends when the hours do; the apps in their without: are off their menu and their desktop won't start them (GNOME's; other desktops keep the hours only). nami gives each person's limits to AccountsService at every start. desktop lists this.

package.nami
# Parental controls, as Ubuntu has them (malcontent): a child on the
# computer (users: <them>: { child: true } in computer.nami) logs in only
# in their hours, and their session ends when the hours do; the apps in
# their without: are off their menu and their desktop won't start them
# (GNOME's; other desktops keep the hours only). nami gives each person's
# limits to AccountsService at every start. desktop lists this.
packages:
  - malcontent
  # Its library (GNOME Shell reads the limits with it) and its login rule.
  - malcontent.lib
  - malcontent.pam
# GNOME Shell finds the library where it looks for libraries it calls.
env:
  GI_TYPELIB_PATH: /run/current-system/sw/lib/girepository-1.0
# The hours, checked for children alone (everyone else steps past it).
login:
  all:
    - account [success=1 default=ignore] /run/current-system/sw/lib/security/pam_succeed_if.so quiet user notingroup children
    - account required /run/current-system/sw/lib/security/pam_malcontent.so
files:
  # AccountsService keeps the limits: it finds malcontent's part of them here.
  /etc/systemd/system/accounts-daemon.service.d/parental-controls.conf: |
    [Service]
    Environment=XDG_DATA_DIRS=/run/current-system/sw/share
checks.nami
# How to tell parental controls work, on a computer nami made (tests/usb.sh runs these).
"parental controls: everyone's given to AccountsService at the start":
  run: systemctl is-active nami-parental-controls
  expect: "^active"
"parental controls: AccountsService keeps malcontent's part":
  run: u=$(busctl --system call org.freedesktop.Accounts /org/freedesktop/Accounts org.freedesktop.Accounts FindUserByName s "$(id -un)" | cut -d'"' -f2); busctl --system introspect org.freedesktop.Accounts "$u" com.endlessm.ParentalControls.SessionLimits | grep -c DailySchedule
  expect: "^1"
"parental controls: no limits for someone who isn't a child":
  run: u=$(busctl --system call org.freedesktop.Accounts /org/freedesktop/Accounts org.freedesktop.Accounts FindUserByName s "$(id -un)" | cut -d'"' -f2); busctl --system get-property org.freedesktop.Accounts "$u" com.endlessm.ParentalControls.SessionLimits LimitType
  expect: "^u 0"
"in the desktop: parental controls: GNOME Shell reads the limits (malcontent's library is loaded in it)":
  run: p=$(pgrep -u "$(id -un)" -f '/bin/[g]nome-shell( |$)' | head -1); if [ -z "$p" ]; then echo "NOT GNOME"; elif grep -q libmalcontent /proc/$p/maps; then echo FOUND; fi
  expect: "^(FOUND|NOT GNOME)"

photos

1 file

Photos and drawing: edit photos, paint, and draw shapes and logos. Others: digikam, rawtherapee, scribus, pinta.

package.nami
# Photos and drawing: edit photos, paint, and draw shapes and logos.
# Others: digikam, rawtherapee, scribus, pinta.
packages:
  - gimp
  - krita
  - inkscape
  - darktable        # raw photos

pipewire

2 files

Sound and screen sharing: each person's own PipeWire, started when an app wants it.

package.nami
# Sound and screen sharing: each person's own PipeWire, started when an
# app wants it.
services:
  - pipewire.socket: { per-person: true }
  - pipewire-pulse.socket: { per-person: true }
files:
  # Programs that play through ALSA (games, Wine, older programs) play
  # through PipeWire too, so they mix with the rest: the default ALSA
  # device is PipeWire's. alsa-lib finds PipeWire's plugin by these paths,
  # its 64-bit build and the 32-bit one for 32-bit programs (steam lists
  # it; without it they find no plugin).
  /etc/alsa/conf.d/50-pipewire.conf: |
    pcm_type.pipewire {
      libs.native = /run/current-system/sw/lib/alsa-lib/libasound_module_pcm_pipewire.so ;
      libs.32Bit = /run/opengl-driver-32/lib/alsa-lib/libasound_module_pcm_pipewire.so ;
    }
    ctl_type.pipewire {
      libs.native = /run/current-system/sw/lib/alsa-lib/libasound_module_ctl_pipewire.so ;
      libs.32Bit = /run/opengl-driver-32/lib/alsa-lib/libasound_module_ctl_pipewire.so ;
    }
    </run/current-system/sw/share/alsa/alsa.conf.d/50-pipewire.conf>
    </run/current-system/sw/share/alsa/alsa.conf.d/99-pipewire-default.conf>
checks.nami
# How to tell pipewire works, on a computer nami made (tests/usb.sh runs these).
"pipewire: ALSA's default is PipeWire":
  run: aplay -L | grep -A1 -x default | tail -1
  expect: "PipeWire"
"in the desktop: pipewire: ALSA programs play through it":
  run: timeout 10 aplay -q -D pipewire -f cd -d 1 /dev/zero; echo played=$?
  expect: "^played=0$"

plymouth

2 files

The boot splash, as Ubuntu's: plymouth with the firmware's logo and a spinner below it (the bgrt theme; a plain spinner where the firmware has no logo), from early in the start until the login screen takes over (GDM quits it without a flicker). The serial console stays text. The kernel's options have quiet splash, as Ubuntu's; plymouth.enable=0 turns it off, and Esc shows the messages behind it. (It starts once the system does, after the boot archive: an encrypted disk's password is still asked in text, before it.) desktop lists this.

package.nami
# The boot splash, as Ubuntu's: plymouth with the firmware's logo and a
# spinner below it (the bgrt theme; a plain spinner where the firmware has
# no logo), from early in the start until the login screen takes over
# (GDM quits it without a flicker). The serial console stays text. The
# kernel's options have `quiet splash`, as Ubuntu's; `plymouth.enable=0`
# turns it off, and Esc shows the messages behind it. (It starts once the
# system does, after the boot archive: an encrypted disk's password is
# still asked in text, before it.) desktop lists this.
packages:
  - plymouth
files:
  /etc/plymouth/plymouthd.conf: |
    [Daemon]
    Theme=bgrt
    ShowDelay=0
    DeviceTimeout=8
  # Where plymouth looks for its plugins and themes; on the screen only
  # (on a serial line too it would show its text there instead).
  /etc/systemd/system/plymouth-start.service.d/nami.conf: |
    [Service]
    ExecStartPre=/run/current-system/sw/bin/mkdir -p /run/plymouth /var/lib/plymouth
    ExecStartPre=/run/current-system/sw/bin/ln -sfn /run/current-system/sw/lib/plymouth /run/plymouth/plugins
    ExecStartPre=/run/current-system/sw/bin/ln -sfn /run/current-system/sw/share/plymouth/themes /run/plymouth/themes
    ExecStart=
    ExecStart=/run/current-system/sw/bin/plymouthd --mode=boot --pid-file=/run/plymouth/pid --attach-to-session --ignore-serial-consoles
  # Told the disk can be written once it's running, not before (the root
  # is writable from the start here, so that comes early): else it never
  # writes its timings.
  /etc/systemd/system/plymouth-read-write.service.d/nami.conf: |
    [Unit]
    After=plymouth-start.service
  # Started early; its log and timings written once the disk can be;
  # quit by GDM (or by these, without a login screen).
  /etc/systemd/system/sysinit.target.d/plymouth.conf: |
    [Unit]
    Wants=plymouth-start.service plymouth-read-write.service systemd-ask-password-plymouth.path
  /etc/systemd/system/multi-user.target.d/plymouth.conf: |
    [Unit]
    Wants=plymouth-quit.service plymouth-quit-wait.service
checks.nami
# How to tell plymouth works, on a computer nami made (tests/usb.sh runs these).
# (It writes how long the start took when it's quit.)
"the boot splash: shown as the computer starts, quit by the login screen":
  run: for i in $(seq 60); do [ -s /var/lib/plymouth/boot-duration ] && break; sleep 5; done; plymouth --ping && echo STILL-ON || echo DURATION=$(cat /var/lib/plymouth/boot-duration)
  expect: "^DURATION=[0-9]"

podman

1 file

Podman on a computer nami made, whenever the podman package is on it: the settings every container tool reads, as Ubuntu's containers-common has them (any image may be run; a short name like alpine is Docker Hub's). sudo podman works, its images in /var/lib/containers; and podman as you (rootless), its images in ~/.local/share/containers, with the user IDs everyone has for containers (/etc/subuid) and shadow's setuid newuidmap.

package.nami
# Podman on a computer nami made, whenever the podman package is on it:
# the settings every container tool reads, as Ubuntu's containers-common
# has them (any image may be run; a short name like `alpine` is Docker
# Hub's). `sudo podman` works, its images in /var/lib/containers; and
# podman as you (rootless), its images in ~/.local/share/containers, with
# the user IDs everyone has for containers (/etc/subuid) and shadow's
# setuid newuidmap.
files:
  /etc/containers/policy.json:
    default: [{ type: insecureAcceptAnything }]
    transports: { docker-daemon: { "": [{ type: insecureAcceptAnything }] } }
  /etc/containers/registries.conf: |
    unqualified-search-registries = ["docker.io"]

polkit

1 file

polkit: who may do what (Settings asks for an admin's password through it).

package.nami
# polkit: who may do what (Settings asks for an admin's password through it).
setuid: [bin/pkexec, lib/polkit-1/polkit-agent-helper-1]
login:
  polkit-1: login
files:
  # Admins are who it asks for.
  /etc/polkit-1/rules.d/10-nami.rules: |
    polkit.addAdminRule(function(action, subject) { return ["unix-group:wheel"]; });

power

1 file

Power, as Ubuntu has it: the battery (upower), power modes (balanced, saver, performance: power-profiles-daemon), and laptops with two GPUs (switcheroo-control). Suspend is systemd's, and the brightness keys the desktop's. desktop lists this.

package.nami
# Power, as Ubuntu has it: the battery (upower), power modes (balanced,
# saver, performance: power-profiles-daemon), and laptops with two GPUs
# (switcheroo-control). Suspend is systemd's, and the brightness keys
# the desktop's. desktop lists this.
packages:
  - upower
  - power-profiles-daemon
  - switcheroo-control

power-profiles-daemon: power modes (balanced, saver, performance).

package.nami
# power-profiles-daemon: power modes (balanced, saver, performance).
services:
  - power-profiles-daemon.service
checks.nami
# How to tell power-profiles-daemon works, on a computer nami made (tests/usb.sh runs these).
"power modes (balanced, saver)":
  run: powerprofilesctl get
  expect: "balanced|power-saver|performance"

printing

2 files

Printing, as Ubuntu has it: CUPS with the common drivers (Gutenprint, HP's), printers on the network found by themselves (avahi, in base), and Settings' Printers panel. desktop lists this. How CUPS runs is in packages/cups/package.nami.

package.nami
# Printing, as Ubuntu has it: CUPS with the common drivers (Gutenprint,
# HP's), printers on the network found by themselves (avahi, in base),
# and Settings' Printers panel. desktop lists this. How CUPS runs
# is in packages/cups/package.nami.
packages:
  - cups
  - cups-filters
  - cups-pk-helper
  - gutenprint
  - hplip
  # Brother's and Samsung's lasers (printer-driver-brlaser and -splix).
  - brlaser
  - splix
  - ghostscript
  - ipp-usb
checks.nami
# How to tell printing works, on a computer nami made (tests/usb.sh runs these).
"printing: printer drivers (Gutenprint)":
  run: lpinfo -m 2>/dev/null | grep -ci gutenprint | sed 's/^/N=/'
  expect: "N=[1-9]"
"printing: Brother's and Samsung's laser drivers":
  run: lpinfo -m 2>/dev/null | grep -ciE 'brlaser|splix|samsung' | sed 's/^/N=/'
  expect: "N=[1-9]"
"printing: printers on the network need no driver (IPP Everywhere)":
  run: lpinfo -m 2>/dev/null | grep -c everywhere | sed 's/^/N=/'
  expect: "N=[1-9]"
"printing: Settings' Printers panel can add printers (cups-pk-helper)":
  run: timeout 30 busctl --system introspect org.opensuse.CupsPkHelper.Mechanism / | grep -c PrinterAdd | sed 's/^/N=/'
  expect: "N=[1-9]"

More printer drivers, for older printers that don't print by themselves over the network (most since 2015 do, with no driver: printing): OpenPrinting's collection of PPDs (foomatic, Ubuntu's openprinting-ppds), foo2zjs's (HP LaserJet 1000s, Minolta, Samsung's host-based lasers) and Brother's label printers. About 0.1 GB; - printing-extra (next to namios) in computer.nami adds them.

package.nami
# More printer drivers, for older printers that don't print by themselves
# over the network (most since 2015 do, with no driver: printing):
# OpenPrinting's collection of PPDs (foomatic, Ubuntu's openprinting-ppds),
# foo2zjs's (HP LaserJet 1000s, Minolta, Samsung's host-based lasers) and
# Brother's label printers. About 0.1 GB; `- printing-extra` (next to namios)
# in computer.nami adds them.
packages:
  - printing
  - foomatic-db-ppds
  - foo2zjs
  - ptouch-driver
checks.nami
# How to tell printing-extra works, on a computer nami made (tests/usb.sh runs these).
"printing: OpenPrinting's and foo2zjs's drivers":
  run: lpinfo -m 2>/dev/null | grep -ciE 'foomatic|foo2zjs' | sed 's/^/N=/'
  expect: "N=[0-9]{3,}"

Driverless network scanners (eSCL, WSD).

package.nami
# Driverless network scanners (eSCL, WSD).
checks.nami
# How to tell sane-airscan works, on a computer nami made (tests/usb.sh runs these).
"network scanners' driver":
  run: SANE_DEBUG_DLL=4 timeout 60 scanimage -L 2>&1 | grep -c 'libsane-airscan' | sed 's/^/N=/'
  expect: "N=[1-9]"

Scanning: SANE reads only its own settings and drivers unless told otherwise, so its list is every package's drivers (HP's, driverless network scanners'), worked out when the system is put together. Everyone may use the scanners.

package.nami
# Scanning: SANE reads only its own settings and drivers unless told
# otherwise, so its list is every package's drivers (HP's, driverless
# network scanners'), worked out when the system is put together.
# Everyone may use the scanners.
groups:
  scanner: everyone
env:
  SANE_CONFIG_DIR: /etc/sane.d
  LD_LIBRARY_PATH: /run/current-system/sw/lib/sane
files:
  /etc/sane.d/dll.conf:
    script: |
      for p in $packages; do
        cat "$p"/etc/sane.d/dll.conf "$p"/etc/sane.d/dll.d/* 2>/dev/null || true
      done > "$out"
checks.nami
# How to tell sane-backends works, on a computer nami made (tests/usb.sh runs these).
"scanning: SANE":
  run: timeout 60 scanimage -L 2>&1 | head -3
  expect: "scanners were identified|device"

scanning

1 file

Scanning, as Ubuntu has it: SANE with HP's drivers (hplip, in printing) and driverless network and USB scanners (eSCL and WSD: sane-airscan; ipp-usb, in printing). How SANE finds its drivers is in packages/sane-backends/package.nami. desktop lists this.

package.nami
# Scanning, as Ubuntu has it: SANE with HP's drivers (hplip, in
# printing) and driverless network and USB scanners (eSCL and WSD:
# sane-airscan; ipp-usb, in printing). How SANE finds its drivers is
# in packages/sane-backends/package.nami. desktop lists this.
packages:
  - sane-backends
  - sane-airscan

Secure Boot, which most PCs come with on, as Ubuntu does it: the firmware starts shim (signed by Microsoft; Debian's), shim starts systemd-boot signed with the computer's own key, and systemd-boot starts kernels signed with it too. On the first start with Secure Boot on, the firmware doesn't know the key yet: shim's MokManager comes up, and "Enroll key from disk" takes nami-key.cer off the USB drive (see the README). The key stays on the computer, root's only, to sign the kernels updates bring; nami install-to takes it along. base lists it.

package.nami
# Secure Boot, which most PCs come with on, as Ubuntu does it: the
# firmware starts shim (signed by Microsoft; Debian's), shim starts
# systemd-boot signed with the computer's own key, and systemd-boot starts
# kernels signed with it too. On the first start with Secure Boot on, the
# firmware doesn't know the key yet: shim's MokManager comes up, and
# "Enroll key from disk" takes nami-key.cer off the USB drive (see the README).
# The key stays on the computer, root's only, to sign the kernels updates
# bring; `nami install-to` takes it along. base lists it.
packages:
  # Signs the kernels updates bring.
  - sbsigntool
  # Secure Boot's state, and its keys: mokutil --sb-state.
  - mokutil
# shim and MokManager, from Debian 13's packages (by Microsoft's and
# Debian's keys). The first address that answers; snapshot.debian.org
# keeps every version for good.
secure-boot:
  shim:
    from:
      - https://deb.debian.org/debian/pool/main/s/shim-signed/shim-signed_1.51~1+deb13u1+16.1-2~deb13u1_amd64.deb
      - https://snapshot.debian.org/archive/debian/20260627T023159Z/pool/main/s/shim-signed/shim-signed_1.51~1+deb13u1+16.1-2~deb13u1_amd64.deb
    sha256: 3c802fa303c0e6bf126adee74028d1042e3120360d159c2c05181dc9b2f61005
    file: usr/lib/shim/shimx64.efi.signed
  mokmanager:
    from:
      - https://deb.debian.org/debian/pool/main/s/shim-helpers-amd64-signed/shim-helpers-amd64-signed_1+16.1+2~deb13u1_amd64.deb
      - https://snapshot.debian.org/archive/debian/20260627T023159Z/pool/main/s/shim-helpers-amd64-signed/shim-helpers-amd64-signed_1+16.1+2~deb13u1_amd64.deb
    sha256: 7e950d75d5a40ecc0a99f727452ce35780b47a04d9a2cc3b1ff7c2bb316c033e
    file: usr/lib/shim/mmx64.efi.signed
checks.nami
# How to tell secure-boot works, on a computer nami made (tests/usb.sh runs these).
"Secure Boot: the computer's own key, root's only":
  run: stat -c '%n %a' /nix/var/nami/secure-boot/key.pem
  expect: "key.pem 600"
"Secure Boot: mokutil says what it is":
  run: mokutil --sb-state 2>&1
  expect: "Secure ?Boot"

shadow

1 file

shadow: changing your password, and the user namespaces of containers.

package.nami
# shadow: changing your password, and the user namespaces of containers.
setuid: [bin/passwd, bin/newuidmap, bin/newgidmap]
files:
  # Its settings for adding people, with one more: a new person's home is
  # theirs alone (0700), as nami makes one, also when it's added another
  # way (Settings' accounts, AccountsService, useradd), not readable by
  # everyone else on the computer.
  /etc/login.defs:
    script: |
      for p in $packages; do
        if [ -f "$p/etc/login.defs" ]; then
          grep -v '^HOME_MODE' "$p/etc/login.defs" > "$out"
          break
        fi
      done
      printf '\n# A new home is its person'"'"'s alone.\nHOME_MODE\t0700\n' >> "$out"

shadow.su

1 file

su: becoming another user.

package.nami
# su: becoming another user.
setuid: [bin/su]
login:
  su: su

speech

2 files

The screen reader's voice: Speech Dispatcher with eSpeak NG's voices, as Ubuntu has them (speech-dispatcher), so Orca (gnome) speaks. It isn't in by default: eSpeak NG brings MBROLA's voices, about 0.7 GB on the USB drive. - speech (next to namios) in computer.nami adds it.

package.nami
# The screen reader's voice: Speech Dispatcher with eSpeak NG's voices, as
# Ubuntu has them (speech-dispatcher), so Orca (gnome) speaks. It
# isn't in by default: eSpeak NG brings MBROLA's voices, about 0.7 GB on
# the USB drive. `- speech` (next to namios) in computer.nami adds it.
packages:
  - speechd
# Each person's own, started when Orca (or anything else) first speaks.
services:
  - speech-dispatcher.socket: { per-person: true }
checks.nami
# How to tell speech works, on a computer nami made (tests/usb.sh runs these).
"the screen reader's voice: Speech Dispatcher, started when asked":
  run: systemctl --user is-enabled speech-dispatcher.socket; timeout 60 spd-say -w -o espeak-ng "hello" && echo SPOKE
  expect: "SPOKE"

steam

2 files

Steam, with what its games need from the computer: - steam in computer.nami. Steam runs its games in a container of its own (Steam Runtime), with Proton for Windows games. - Most games are 32-bit, or start through 32-bit parts: they draw with the 32-bit graphics drivers in /run/opengl-driver-32 (mesa's here, NVIDIA's from nvidia), and play sound through PipeWire's 32-bit ALSA plugin, next to them (the pipewire package points ALSA there). - Controllers (Steam's own, PlayStation's, Xbox's, the Steam Deck's) and VR headsets: their udev rules let Steam open them, and uinput lets Steam Input be a controller games understand.

package.nami
# Steam, with what its games need from the computer: `- steam` in
# computer.nami. Steam runs its games in a container of its own (Steam
# Runtime), with Proton for Windows games.
#
# - Most games are 32-bit, or start through 32-bit parts: they draw with
#   the 32-bit graphics drivers in /run/opengl-driver-32 (mesa's here,
#   NVIDIA's from nvidia), and play sound through PipeWire's 32-bit ALSA
#   plugin, next to them (the pipewire package points ALSA there).
# - Controllers (Steam's own, PlayStation's, Xbox's, the Steam Deck's) and
#   VR headsets: their udev rules let Steam open them, and uinput lets
#   Steam Input be a controller games understand.
packages:
  # Steam's runtime for programs outside Steam (steam-run ./game).
  - steam-run
  - steam-devices-udev-rules
drivers:
  graphics-32bit: [pkgsi686Linux.mesa, pkgsi686Linux.pipewire]
files:
  /etc/modules-load.d/steam.conf: |
    uinput
  # Through the firewall: Remote Play, and games copied from another
  # computer on the network (Valve's ports).
  /etc/firewall/allow.d/steam.conf:
    content: |
      [allow]
      Steam Remote Play = udp 27031-27036
      Steam Remote Play = tcp 27036-27037
      Steam: games from another computer = tcp 27040
    # (Let in from now on, not from the next start.)
    restarts: firewall.service
checks.nami
# How to tell steam works, on a computer nami made (tests/usb.sh runs these).
"Steam: in the app list":
  run: echo $(ls /run/current-system/sw/share/applications/steam.desktop) $(readlink -f $(command -v steam))
  expect: "^/run/current-system/sw/share/applications/steam.desktop /nix/store/.*steam"
"Steam: 32-bit graphics drivers, for its games":
  run: echo $(file -L -b /run/opengl-driver-32/lib/libEGL_mesa.so.0 /run/opengl-driver-32/lib/libvulkan_radeon.so | cut -c1-10)
  expect: "^ELF 32-bit ELF 32-bit$"
"Steam: controllers (uinput, and their udev rules)":
  run: echo $(ls /dev/uinput) $(ls /etc/udev/rules.d/ | grep -c steam)
  expect: "^/dev/uinput [1-9]"
"Steam: 32-bit sound, through PipeWire":
  run: echo $(file -L -b /run/opengl-driver-32/lib/alsa-lib/libasound_module_pcm_pipewire.so | cut -c1-10)
  expect: "^ELF 32-bit$"

sudo

2 files

sudo: acts as root for whoever runs it (admins, per /etc/sudoers).

package.nami
# sudo: acts as root for whoever runs it (admins, per /etc/sudoers).
setuid: [bin/sudo]
login:
  sudo: su
checks.nami
# How to tell sudo works, on a computer nami made (tests/usb.sh runs these).
"admins may use sudo (the wheel group)":
  run: getent group wheel
  expect: "^wheel:x:[0-9]+:[a-z_]"

switcheroo-control: laptops with two GPUs: which runs an app.

package.nami
# switcheroo-control: laptops with two GPUs: which runs an app.
services:
  - switcheroo-control.service

sync

2 files

Your folders, the same on each of your computers: Syncthing, straight between them (on your network, or across the internet, encrypted), no cloud and no account. In your user.nami (each computer's own): packages: - ../../shared/packages/sync files: ~/.config/nami-sync.conf: folders: Sync: ~/Sync # the same name on each computer is the same folder Photos: ~/Pictures computers: # the others: their Syncthing ID (nami-sync id there) desktop: MFZWI3D-BONSGYC-YLTMRWG-C43ENR5-QXGZDMM-FZWI3DP-BONSGYY-LTMRWAD Each computer lists the others once, as Syncthing pairs them; an Android phone with Syncthing-Fork is one more ID. Every folder is shared with every computer listed. Taken out of the file, a computer is let go and a folder isn't synced any more (its files stay). How it runs: Syncthing starts when you log in (its own unit, yours), and nami-sync makes it match the file then and whenever the file changes. Syncthing's own page, for the rest: http://127.0.0.1:8384.

package.nami
# Your folders, the same on each of your computers: Syncthing, straight
# between them (on your network, or across the internet, encrypted), no
# cloud and no account. In your user.nami (each computer's own):
#
#   packages:
#     - ../../shared/packages/sync
#   files:
#     ~/.config/nami-sync.conf:
#       folders:
#         Sync: ~/Sync            # the same name on each computer is the same folder
#         Photos: ~/Pictures
#       computers:                # the others: their Syncthing ID (`nami-sync id` there)
#         desktop: MFZWI3D-BONSGYC-YLTMRWG-C43ENR5-QXGZDMM-FZWI3DP-BONSGYY-LTMRWAD
#
# Each computer lists the others once, as Syncthing pairs them; an Android
# phone with Syncthing-Fork is one more ID. Every folder is shared with
# every computer listed. Taken out of the file, a computer is let go and a
# folder isn't synced any more (its files stay).
#
# How it runs: Syncthing starts when you log in (its own unit, yours), and
# nami-sync makes it match the file then and whenever the file changes.
# Syncthing's own page, for the rest: http://127.0.0.1:8384.
name: sync
version: "1"
source:
  path: ./src
deps: [syncthing, jq, curl]
install: |
  mkdir -p $out/bin $out/share/systemd/user
  sed -e "s|@syncthing@|$(command -v syncthing)|" -e "s|@jq@|$(command -v jq)|" -e "s|@curl@|$(command -v curl)|" nami-sync > $out/bin/nami-sync
  chmod +x $out/bin/nami-sync
  cat > $out/share/systemd/user/nami-sync.service <<UNIT
  [Unit]
  Description=Your synced folders and computers, as ~/.config/nami-sync.conf says
  Wants=syncthing.service
  After=syncthing.service
  [Service]
  Type=oneshot
  ExecStart=$out/bin/nami-sync apply
  [Install]
  WantedBy=default.target
  UNIT
  cat > $out/share/systemd/user/nami-sync.path <<UNIT
  [Unit]
  Description=Watches ~/.config/nami-sync.conf
  [Path]
  PathChanged=%h/.config/nami-sync.conf
  Unit=nami-sync.service
  [Install]
  WantedBy=default.target
  UNIT
# Syncthing itself (its unit comes with it).
packages:
  - syncthing
# Syncthing (yours, from its package) and the step that sets it up: each
# person's own. Listed in computer.nami instead, everyone with a
# ~/.config/nami-sync.conf gets them.
services:
  - syncthing.service: { per-person: true }
  - nami-sync.service: { per-person: true }
  - nami-sync.path: { per-person: true }
files:
  /etc/systemd/user/syncthing.service.d/nami.conf: |
    [Unit]
    ConditionPathExists=%h/.config/nami-sync.conf
src/nami-sync
#!/bin/sh
# nami-sync: your folders kept the same on your computers (Syncthing), as
# ~/.config/nami-sync.conf says:
#
#   [folders]                 name = path: the same name on each computer is the same folder
#   Sync = ~/Sync
#   [computers]               the others to sync with: name = their Syncthing ID
#   desktop = MFZWI3D-...
#
#   nami-sync apply     make Syncthing match it (after each change to it)
#   nami-sync id        this computer's Syncthing ID, to give the others
#   nami-sync status    the folders (how much is left) and the computers (online), as JSON
set -eu
st=@syncthing@
jq=@jq@
curl=@curl@
conf=${NAMI_SYNC_CONF:-${XDG_CONFIG_HOME:-$HOME/.config}/nami-sync.conf}
# (tray-sync.conf: where tray had it, until it's written again.)
[ -e "$conf" ] || [ ! -e "${conf%/*}/tray-sync.conf" ] || conf=${conf%/*}/tray-sync.conf
c() { $st cli "$@"; }

# name = value lines of a [section].
section() { awk -v s="[$1]" '/^\[/ { on = ($0 == s); next } on { i = index($0, " = "); if (i) print substr($0, 1, i - 1) "\t" substr($0, i + 3) }' "$conf" 2>/dev/null || true; }

# Syncthing answers once it's up (it starts with you).
up() {
  i=0
  until c show system >/dev/null 2>&1; do
    i=$((i + 1)); [ $i -lt 60 ] || { echo "Syncthing isn't running (systemctl --user status syncthing)" >&2; exit 1; }
    sleep 1
  done
}

rest() {
  key=$(c config gui apikey get) addr=$(c config gui raw-address get)
  $curl -fsS -H "X-API-Key: $key" "http://$addr/rest/$1"
}

case ${1:-} in
apply)
  up
  me=$(c show system | $jq -r .myID)
  tab=$(printf '\t')
  # The computers: added (named), and the ones taken out of the file let go.
  want=$(section computers | cut -f2 | tr 'a-z' 'A-Z')
  section computers | while IFS="$tab" read -r name id; do
    id=$(echo "$id" | tr 'a-z' 'A-Z')
    [ "$id" = "$me" ] && continue
    if c config devices list | grep -qx "$id"; then
      c config devices "$id" name set "$name"
    else
      echo "computer $name: added"
      c config devices add --device-id "$id" --name "$name"
    fi
  done
  for id in $(c config devices list); do
    [ "$id" = "$me" ] || echo "$want" | grep -qx "$id" || { echo "computer $id: let go"; c config devices "$id" delete; }
  done
  # The folders: each shared with every computer listed; taken out of the
  # file, Syncthing stops syncing it (its files stay).
  names=$(section folders | cut -f1)
  section folders | while IFS="$tab" read -r name path; do
    case $path in "~/"*) path=$HOME/${path#"~/"} ;; "~") path=$HOME ;; esac
    mkdir -p "$path"
    if c config folders list | grep -qx "$name"; then
      c config folders "$name" path set "$path"
    else
      echo "folder $name ($path): syncing"
      c config folders add --id "$name" --label "$name" --path "$path"
    fi
    have=$(c config folders "$name" devices list)
    for id in $want; do
      [ "$id" = "$me" ] || echo "$have" | grep -qx "$id" || c config folders "$name" devices add --device-id "$id"
    done
    for id in $have; do
      [ "$id" = "$me" ] || echo "$want" | grep -qx "$id" || c config folders "$name" devices "$id" delete
    done
  done
  for f in $(c config folders list); do
    echo "$names" | grep -qx "$f" || { echo "folder $f: not synced any more (its files stay)"; c config folders "$f" delete; }
  done
  ;;
id)
  up
  c show system | $jq -r .myID
  ;;
status)
  up
  me=$(c show system | $jq -r .myID)
  conns=$(rest system/connections)
  {
    section folders | while IFS="$(printf '\t')" read -r name path; do
      s=$(rest "db/status?folder=$name" 2>/dev/null || echo '{}')
      printf '%s\n' "$s" | $jq -c --arg n "$name" --arg p "$path" '{name: $n, path: $p, state: (.state // "unknown"), need: (.needBytes // 0), bytes: (.globalBytes // 0), files: (.globalFiles // 0)}'
    done
  } | $jq -s --arg me "$me" --argjson conns "$conns" --arg comps "$(section computers)" '{
      id: $me,
      folders: .,
      computers: ($comps | split("\n") | map(select(length > 0) | split("\t") | {name: .[0], id: (.[1] | ascii_upcase)})
        | map(. + {online: ($conns.connections[.id].connected // false)}))
    }'
  ;;
*)
  sed -n '2,13s/^# \{0,1\}//p' "$0"
  exit 2
  ;;
esac

tailscale

2 files

Tailscale, as on Ubuntu: - tailscale in computer.nami, then sudo tailscale up logs in (in the browser). Or it logs in by itself, with an auth key, and takes its settings from computer.nami, which writes them into /etc/tailscale/up.conf: packages: - tailscale files: /etc/tailscale/up.conf: set: # tailscale set (and up) flags hostname: laptop # its name in the tailnet operator: ada # who may run tailscale without sudo ssh: true # Tailscale SSH accept-routes: true # other computers' subnets exit-node: 100.101.102.103 # send the internet through that one up: # flags only tailscale up takes login-server: https://headscale.example.org # From the admin console's Keys page (root's alone, 0400). /run/nami/secrets/tailscale-auth-key: !secret "YWdl..." Any tailscale set flag goes under set: (advertise-exit-node: true, advertise-routes: [192.168.1.0/24], shields-up, accept-dns: false, ...); under up:, login-server and advertise-tags. An exit node or a subnet router forwards others' packets: - tailscale-router. The first start, not logged in yet, tailscale up --auth-key logs in (tailscale-up.service, once tailscaled runs); a bad key fails it, once, and systemctl status tailscale-up says why. From then on, each start and each nami apply that changes up.conf, tailscale set applies the settings, and the login stays as it is. Settings not given here are yours to change with tailscale set. MagicDNS names (laptop, laptop.tailnet.ts.net) resolve as on Ubuntu: tailscaled tells systemd-resolved, which every nami computer has, about them over D-Bus; other names resolve as before. Tailscale's own rules (netfilter) are tailscaled's; namiOS's firewall lets the tailnet in (tailscale0), and Tailscale's port, for direct connections. How tailscaled runs: started with the computer, its state (the login) in /var/lib/tailscale, kept through updates. nixpkgs' package brings the unit (Debian's, as Ubuntu runs it) without the file it reads its port from: that's here.

package.nami
# Tailscale, as on Ubuntu: `- tailscale` in computer.nami, then
# `sudo tailscale up` logs in (in the browser). Or it logs in by itself,
# with an auth key, and takes its settings from computer.nami, which
# writes them into /etc/tailscale/up.conf:
#
#   packages:
#     - tailscale
#   files:
#     /etc/tailscale/up.conf:
#       set:                             # `tailscale set` (and up) flags
#         hostname: laptop               # its name in the tailnet
#         operator: ada                 # who may run `tailscale` without sudo
#         ssh: true                      # Tailscale SSH
#         accept-routes: true            # other computers' subnets
#         exit-node: 100.101.102.103     # send the internet through that one
#       up:                              # flags only `tailscale up` takes
#         login-server: https://headscale.example.org
#     # From the admin console's Keys page (root's alone, 0400).
#     /run/nami/secrets/tailscale-auth-key: !secret "YWdl..."
#
# Any `tailscale set` flag goes under set: (`advertise-exit-node: true`,
# `advertise-routes: [192.168.1.0/24]`, `shields-up`, `accept-dns: false`,
# ...); under up:, `login-server` and `advertise-tags`. An exit node or a
# subnet router forwards others' packets: `- tailscale-router`.
#
# The first start, not logged in yet, `tailscale up --auth-key` logs in
# (tailscale-up.service, once tailscaled runs); a bad key fails it, once,
# and `systemctl status tailscale-up` says why. From then on, each start
# and each `nami apply` that changes up.conf, `tailscale set` applies the
# settings, and the login stays as it is. Settings not given here are
# yours to change with `tailscale set`.
#
# MagicDNS names (laptop, laptop.tailnet.ts.net) resolve as on Ubuntu:
# tailscaled tells systemd-resolved, which every nami computer has, about
# them over D-Bus; other names resolve as before. Tailscale's own rules
# (netfilter) are tailscaled's; namiOS's firewall lets the tailnet in
# (tailscale0), and Tailscale's port, for direct connections.
#
# How tailscaled runs: started with the computer, its state (the login) in
# /var/lib/tailscale, kept through updates. nixpkgs' package brings the
# unit (Debian's, as Ubuntu runs it) without the file it reads its port
# from: that's here.
services:
  - tailscaled.service
  - tailscale-up.service
files:
  /etc/firewall/allow.d/tailscale.conf:
    content: |
      [allow]
      Tailscale = udp 41641
    # (Let in from now on, not from the next start.)
    restarts: firewall.service
  # The tunnel device (tailscale0) needs tun.
  /etc/modules-load.d/tailscale.conf: |
    tun
  # NetworkManager leaves tailscale0 to tailscaled: it would take the
  # DNS settings tailscaled gives systemd-resolved for it.
  /etc/NetworkManager/conf.d/tailscale.conf: |
    [keyfile]
    unmanaged-devices=interface-name:tailscale0
  # The settings: none here. computer.nami's up.conf is its content,
  # and tailscale-up runs again when `nami apply` changes it.
  /etc/tailscale/up.conf:
    content: {}
    restarts: tailscale-up.service
  /etc/tailscale/up.sh: |
    # tailscale-up.service: the settings in /etc/tailscale/up.conf.
    # Not logged in yet, with an auth key: `tailscale up` logs in with
    # it. Logged in: `tailscale set` applies them, and the login stays
    # as it is.
    set -f
    conf=${1:-/etc/tailscale/up.conf}
    key=${2:-/run/nami/secrets/tailscale-auth-key}
    # The flags in section [$1] of the settings: `name = value` is
    # --name=value (a name given more than once: its values, joined by commas).
    flags() {
      awk -v want="[$1]" '
        /^\[/ { on = ($0 == want); next }
        on && / = / {
          i = index($0, " = "); k = substr($0, 1, i - 1); v = substr($0, i + 3)
          if (k in f) f[k] = f[k] "," v; else { f[k] = v; order[++n] = k }
        }
        END { for (i = 1; i <= n; i++) print "--" order[i] "=" f[order[i]] }' "$conf"
    }
    # Logged in or not (tailscaled can take a moment to know).
    for _ in $(seq 30); do
      state=$(tailscale status --json --peers=false 2>/dev/null | sed -n 's/^ *"BackendState": "\(.*\)",$/\1/p')
      [ -n "$state" ] && [ "$state" != NoState ] && break
      sleep 1
    done
    if [ "$state" = NeedsLogin ] && [ -e "$key" ]; then
      echo "logging in with the auth key"
      exec tailscale up --reset --auth-key="file:$key" --timeout=2m $(flags up) $(flags set)
    fi
    [ "$state" = NeedsLogin ] && echo "not logged in yet: \`sudo tailscale up\` logs in (in the browser)"
    echo "applying the settings (logged in: $state)"
    set -- $(flags set)
    [ $# -gt 0 ] || { echo "(there are none)"; exit 0; }
    exec tailscale set "$@"
  /etc/systemd/system/tailscale-up.service: |
    [Unit]
    Description=Tailscale: logging in with the auth key, and its settings
    Requires=tailscaled.service
    After=tailscaled.service network-online.target
    Wants=network-online.target
    [Service]
    Type=oneshot
    RemainAfterExit=yes
    ExecStart=/run/current-system/sw/bin/sh /etc/tailscale/up.sh
    [Install]
    WantedBy=multi-user.target
  /etc/systemd/system/tailscaled.service.d/nami.conf: |
    [Service]
    # Its port for WireGuard (41641, as on Ubuntu), and no more flags.
    Environment=PORT=41641 FLAGS=
checks.nami
# How to tell tailscale works, on a computer nami made (tests/usb.sh runs these).
"Tailscale: tailscaled runs":
  run: systemctl is-active tailscaled
  expect: "^active"
"Tailscale: logged in, or waiting for a login":
  run: tailscale status --json --peers=false | grep BackendState
  expect: '"(NeedsLogin|Running)"'
"Tailscale: its tunnel device":
  run: echo $(ip -o link show tailscale0 | cut -d' ' -f2) $(test -c /dev/net/tun && echo /dev/net/tun)
  expect: "^tailscale0: /dev/net/tun$"
"Tailscale: its login is kept in /var/lib/tailscale":
  run: stat -c '%a %U %n' /var/lib/tailscale
  expect: "^700 root /var/lib/tailscale"
"Tailscale: DNS through systemd-resolved, as on Ubuntu (MagicDNS)":
  run: 'systemctl is-active systemd-resolved; journalctl -b -u tailscaled --no-pager | grep -o ''dns: using "[a-z-]*" mode'' | tail -1'
  expect: 'dns: using "systemd-resolved" mode'
"Tailscale: other names still resolve":
  run: resolvectl query cache.nixos.org
  expect: "cache.nixos.org: [0-9a-f]"

A Tailscale exit node or subnet router forwards others' packets: IP forwarding on. List it in packages:, and say what it advertises in the settings: packages: - tailscale-router files: /etc/tailscale/up.conf: set: { advertise-exit-node: true } # or advertise-routes: [192.168.1.0/24]

package.nami
# A Tailscale exit node or subnet router forwards others' packets: IP
# forwarding on. List it in packages:, and say what it advertises in
# the settings:
#
#   packages:
#     - tailscale-router
#   files:
#     /etc/tailscale/up.conf:
#       set: { advertise-exit-node: true }      # or advertise-routes: [192.168.1.0/24]
packages:
  - tailscale
files:
  /etc/sysctl.d/60-tailscale.conf:
    content: |
      net.ipv4.ip_forward = 1
      net.ipv6.conf.all.forwarding = 1
    restarts: systemd-sysctl.service

talking

1 file

Talking to people: messages and calls. Others: discord, slack, zoom-us, teams-for-linux.

package.nami
# Talking to people: messages and calls. Others: discord, slack,
# zoom-us, teams-for-linux.
packages:
  - signal-desktop
  - element-desktop
  - telegram-desktop

thermald

1 file

thermald: keeping cool (Intel laptops).

package.nami
# thermald: keeping cool (Intel laptops).
services:
  - thermald.service

Updates you can see, as a Mac shows them: when the daily update (nami-update.timer, base) has put a new version of the computer together for its next start, everyone at a desktop is told ("Restart to Finish Updating", with Restart and Later; a click opens Updates), and again at each login until the computer has restarted into it. Nothing is said when nothing changed. "Software Updates" in the app list is nami-gui's Updates page: what's new, Update Now, Restart Now, and whether updates install automatically. desktop lists this. How it knows: a version is waiting when the newest in /nix/var/nami/os is newer than the one running and hasn't run out of tries to start (its boot entry, nami-N+0-3.conf, then). Root works that out (state) as the computer starts and after each update, into /run/nami-update/pending, with the nami that made it in /run/nami-update/version (and the one the computer started with in /run/nami-update/started, for What's New); each person's desktop watches that file.

package.nami
# Updates you can see, as a Mac shows them: when the daily update
# (nami-update.timer, base) has put a new version of the computer together
# for its next start, everyone at a desktop is told ("Restart to Finish
# Updating", with Restart and Later; a click opens Updates), and again at
# each login until the computer has restarted into it. Nothing is said when
# nothing changed. "Software Updates" in the app list is nami-gui's Updates
# page: what's new, Update Now, Restart Now, and whether updates install
# automatically. desktop lists this.
#
# How it knows: a version is waiting when the newest in /nix/var/nami/os
# is newer than the one running and hasn't run out of tries to start (its
# boot entry, nami-N+0-3.conf, then). Root works that out (`state`) as the
# computer starts and after each update, into /run/nami-update/pending,
# with the nami that made it in /run/nami-update/version (and the one the
# computer started with in /run/nami-update/started, for What's New); each
# person's desktop watches that file.
services:
  - nami-update-state.service
  # Each person's, in their desktop session (graphical-session.target).
  - nami-update-notify.service: { per-person: true }
  - nami-update-notify.path: { per-person: true }
  # Apps each person installed from downloads (a .deb, .rpm, AppImage)
  # update with it: once a day, on the same switch (nami-update.timer),
  # each checked against its maker's signature (src/foreign_update.rs).
  - nami-app-updates.timer: { per-person: true }
files:
  /etc/nami-os/update/state:
    mode: "0755"
    content: |
      #!/bin/sh
      # Is a new version of this computer waiting for its next start? As
      # root: its number into /run/nami-update/pending (written only when
      # it changes, so nobody is told twice), or no file. --check: only say.
      PATH=/run/current-system/sw/bin
      cur=$(readlink /run/current-system); cur=${cur##*system-}
      case $cur in ''|*[!0-9]*) cur=0 ;; esac
      new=0
      for d in /nix/var/nami/os/system-*; do
        n=${d##*system-}
        case $n in ''|*[!0-9]*) continue ;; esac
        [ "$n" -gt "$new" ] && new=$n
      done
      f=/run/nami-update/pending
      [ "${1:-}" = --check ] || mkdir -p /run/nami-update
      # nami's version (`nami 0.18.6`): as the computer started, and as it is now.
      v=$(/nix/var/nami/bin/nami --version 2>/dev/null); v=${v##* }
      [ -e /run/nami-update/started ] || [ "${1:-}" = --check ] || echo "$v" > /run/nami-update/started
      # (Out of tries: it couldn't start, and the one before started instead.)
      if [ "$new" -gt "$cur" ] && ! ls /boot/loader/entries/nami-"$new"+0-*.conf >/dev/null 2>&1; then
        echo "version $new is waiting for the next start (running version $cur)"
        [ "${1:-}" = --check ] && exit 0
        echo "$v" > /run/nami-update/version
        [ "$(cat "$f" 2>/dev/null)" = "$new" ] || { echo "$new" > "$f.new" && mv "$f.new" "$f"; }
      else
        echo "nothing waiting (running version $cur)"
        [ "${1:-}" = --check ] && exit 0
        rm -f "$f"
      fi
      exit 0
  /etc/nami-os/update/notify:
    mode: "0755"
    content: |
      #!/bin/sh
      # In each person's desktop session: at login, and when an update
      # makes a new version, a notification if one is waiting, with
      # Restart and Later; a click on it opens Updates.
      new=$(cat /run/nami-update/pending 2>/dev/null)
      cur=$(readlink /run/current-system); cur=${cur##*system-}
      case $new in ''|*[!0-9]*) exit 0 ;; esac
      case $cur in ''|*[!0-9]*) cur=0 ;; esac
      # (Running it already: `nami apply` switched to it.)
      [ "$new" -gt "$cur" ] || exit 0
      # The desktop shows notifications once it's up (at login, next to this).
      i=0
      until busctl --user status org.freedesktop.Notifications >/dev/null 2>&1; do
        i=$((i + 1))
        [ $i -lt 120 ] || { echo "no notifications on this desktop"; exit 0; }
        sleep 1
      done
      v=$(cat /run/nami-update/version 2>/dev/null)
      if [ -n "$v" ]; then said="namiOS $v is ready."; else said="An update for namiOS is ready."; fi
      echo "version $new is ready: telling $(id -un)"
      a=$(notify-send --app-name="Software Updates" --icon=system-software-update --hint=string:desktop-entry:nami-software-updates \
        --action=default=Open --action=restart=Restart --action=later=Later --wait \
        "Restart to Finish Updating" "$said Your work stays as it is until you restart.")
      case $a in
        restart)
          echo "restarting, as $(id -un) asked"
          exec /etc/nami-os/update/restart ;;
        default) exec /etc/nami-os/update/now ;;
      esac
  /etc/nami-os/update/restart:
    mode: "0755"
    content: |
      #!/bin/sh
      # Restart into the version waiting: namiOS's desktop asks first;
      # elsewhere, at once.
      /run/current-system/sw/bin/nami-desktop power restart 2>/dev/null && exit 0
      exec systemctl reboot
  /etc/nami-os/update/now:
    mode: "0755"
    content: |
      #!/bin/sh
      # Software Updates: nami-gui's Updates page, which looks for updates
      # as it opens, installs them with Update Now (an admin's password
      # for someone who isn't one), and restarts with Restart Now.
      exec nami-gui --page updates
  /etc/nami-os/share/applications/nami-software-updates.desktop: |
    [Desktop Entry]
    Type=Application
    Name=Software Updates
    Comment=Install updates for namiOS, nami and your apps
    Icon=system-software-update
    Exec=nami-gui --page updates
    Terminal=false
    Categories=GTK;System;Settings;PackageManager;
    Keywords=update;upgrade;restart;software;
  # Its icon, for themes without one (Yaru has its own).
  /etc/nami-os/share/icons/hicolor/scalable/apps/system-software-update.svg: |
    <svg xmlns="http://www.w3.org/2000/svg" width="128" height="128" viewBox="0 0 128 128">
      <defs><linearGradient id="g" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#62a0ea"/><stop offset="1" stop-color="#1c71d8"/></linearGradient></defs>
      <rect x="8" y="8" width="112" height="112" rx="24" fill="url(#g)"/>
      <path d="M64 30a34 34 0 1 0 31 20" fill="none" stroke="#fff" stroke-width="10" stroke-linecap="round"/>
      <path d="M84 28l16 18-23 6z" fill="#fff"/>
      <path d="M64 44v32m-13-13l13 13 13-13" fill="none" stroke="#fff" stroke-width="9" stroke-linecap="round" stroke-linejoin="round"/>
    </svg>
  /etc/systemd/system/nami-update-state.service: |
    [Unit]
    Description=Is an update waiting for the next start? (for the desktop's notice)
    # (The boot partition says whether a version ran out of tries; it
    # may be mounted a moment later, or not be there at all.)
    WantsMountsFor=/boot
    [Service]
    Type=oneshot
    RemainAfterExit=yes
    ExecStart=/etc/nami-os/update/state
    [Install]
    WantedBy=multi-user.target
  # After each update: what's waiting now.
  /etc/systemd/system/nami-update.service.d/notify.conf: |
    [Service]
    ExecStartPost=/etc/nami-os/update/state
  /etc/systemd/user/nami-update-notify.service: |
    [Unit]
    Description=Tells you when an update is ready (restart to use it)
    PartOf=graphical-session.target
    After=graphical-session.target
    ConditionUser=!@system
    [Service]
    ExecStart=/etc/nami-os/update/notify
    [Install]
    WantedBy=graphical-session.target
  /etc/systemd/user/nami-update-notify.path: |
    [Unit]
    Description=Watches for an update ready for the next start
    PartOf=graphical-session.target
    ConditionUser=!@system
    [Path]
    PathModified=/run/nami-update/pending
    Unit=nami-update-notify.service
    [Install]
    WantedBy=graphical-session.target
  # The person's apps from downloads, kept up to date: looked at once a day
  # (at most: a run within the day only puts in place an update that was
  # waiting for its app to be closed), quietly, as the computer's own
  # update is, and only while it updates itself (`nami file-apps --update
  # --background` asks nami-update.timer). "X was updated" says so after.
  /etc/systemd/user/nami-app-updates.service: |
    [Unit]
    Description=Updates your apps from downloads (checked against their makers' signatures)
    Wants=network-online.target
    After=network-online.target
    ConditionUser=!@system
    [Service]
    Type=oneshot
    Environment=PATH=%h/.local/state/nami/profile/bin:/nix/var/nami/bin:/run/wrappers/bin:/run/current-system/sw/bin
    ExecStart=/nix/var/nami/bin/nami file-apps --update --background
    Nice=19
    IOSchedulingClass=idle
    TimeoutStartSec=2h
  /etc/systemd/user/nami-app-updates.timer: |
    [Unit]
    Description=Updates your apps from downloads, daily
    ConditionUser=!@system
    [Timer]
    OnStartupSec=5min
    OnUnitActiveSec=1h
    RandomizedDelaySec=5min
    [Install]
    WantedBy=timers.target
checks.nami
# How to tell update-notify works, on a computer nami made (tests/usb.sh runs these).
"updates: the computer knows whether one is waiting for the next start":
  run: echo $(systemctl is-active nami-update-state.service) $(/etc/nami-os/update/state --check)
  expect: "^active (nothing waiting|version [0-9]+ is waiting)"
"updates: each person's desktop is told (at login, and when one is ready)":
  run: systemctl --user is-enabled nami-update-notify.service nami-update-notify.path | tr '\n' ' '
  expect: "^enabled enabled"
"updates: Software Updates, in the app list":
  run: n=0; for d in $(echo "$XDG_DATA_DIRS" | tr ':' ' '); do grep -qx 'Exec=nami-gui --page updates' "$d/applications/nami-software-updates.desktop" 2>/dev/null && n=$((n + 1)); done; echo FOUND=$n $(test -x /etc/nami-os/update/now && echo RUNS)
  expect: "^FOUND=1 RUNS"
"updates: each person's apps from downloads update daily too (on the same switch)":
  run: echo $(systemctl --user is-enabled nami-app-updates.timer) $(systemctl --user cat nami-app-updates.service 2>/dev/null | grep -c 'file-apps --update --background')
  expect: "^enabled 1"

upower

2 files

upower: the battery, for the top bar and Settings.

package.nami
# upower: the battery, for the top bar and Settings.
services:
  - upower.service
checks.nami
# How to tell upower works, on a computer nami made (tests/usb.sh runs these).
"the battery, for the top bar (upower)":
  run: upower -e
  expect: "DisplayDevice"

mount and umount, for the drives fstab lets everyone mount.

package.nami
# mount and umount, for the drives fstab lets everyone mount.
setuid: [bin/mount, bin/umount]

video

1 file

Video and sound: edit videos, record and stream, make music. Others: shotcut, ardour, lmms, musescore, davinci-resolve.

package.nami
# Video and sound: edit videos, record and stream, make music.
# Others: shotcut, ardour, lmms, musescore, davinci-resolve.
packages:
  - kdePackages.kdenlive
  - obs-studio
  - audacity
  - handbrake        # converting videos

vm-guest

2 files

In a virtual machine, as Ubuntu installs it: SPICE's agent (copy and paste between the VM and the computer it runs on, the screen's size following the window, in virt-manager, GNOME Boxes, Proxmox...) and QEMU's guest agent (the host can shut it down cleanly, freeze its disks for a snapshot). Each starts only in a VM whose host gives it the channel for it (udev starts it then); elsewhere nothing runs. desktop lists this.

package.nami
# In a virtual machine, as Ubuntu installs it: SPICE's agent (copy and
# paste between the VM and the computer it runs on, the screen's size
# following the window, in virt-manager, GNOME Boxes, Proxmox...) and
# QEMU's guest agent (the host can shut it down cleanly, freeze its disks
# for a snapshot). Each starts only in a VM whose host gives it the
# channel for it (udev starts it then); elsewhere nothing runs.
# desktop lists this.
packages:
  - spice-vdagent
  - qemu.ga
files:
  /etc/udev/rules.d/70-nami-vm-guest.rules: |
    SUBSYSTEM=="virtio-ports", ATTR{name}=="com.redhat.spice.0", TAG+="systemd", ENV{SYSTEMD_WANTS}+="spice-vdagentd.service"
    SUBSYSTEM=="virtio-ports", ATTR{name}=="org.qemu.guest_agent.0", TAG+="systemd", ENV{SYSTEMD_WANTS}+="qemu-guest-agent.service"
  /etc/systemd/system/spice-vdagentd.service: |
    [Unit]
    Description=SPICE guest agent (copy and paste, screen size)
    ConditionVirtualization=vm
    ConditionPathExists=/dev/virtio-ports/com.redhat.spice.0
    BindsTo=dev-virtio\x2dports-com.redhat.spice.0.device
    After=dev-virtio\x2dports-com.redhat.spice.0.device
    [Service]
    RuntimeDirectory=spice-vdagentd
    # (The mouse, as the host's window moves it.)
    ExecStartPre=-/run/current-system/sw/bin/modprobe uinput
    ExecStart=/run/current-system/sw/bin/spice-vdagentd -x
    Restart=on-failure
  /etc/systemd/system/qemu-guest-agent.service: |
    [Unit]
    Description=QEMU guest agent
    ConditionVirtualization=vm
    ConditionPathExists=/dev/virtio-ports/org.qemu.guest_agent.0
    BindsTo=dev-virtio\x2dports-org.qemu.guest_agent.0.device
    After=dev-virtio\x2dports-org.qemu.guest_agent.0.device
    [Service]
    ExecStart=/run/current-system/sw/bin/qemu-ga
    Restart=always
    RestartSec=0
  # Each person's half, in their desktop session, talking to the above.
  /etc/systemd/user/spice-vdagent.service: |
    [Unit]
    Description=SPICE guest agent, for this desktop
    PartOf=graphical-session.target
    After=graphical-session.target
    ConditionVirtualization=vm
    ConditionPathExists=/dev/virtio-ports/com.redhat.spice.0
    ConditionUser=!@system
    StartLimitIntervalSec=120
    StartLimitBurst=3
    [Service]
    ExecStart=/run/current-system/sw/bin/spice-vdagent -x
    Restart=on-failure
    RestartSec=10
    [Install]
    WantedBy=graphical-session.target
services:
  - spice-vdagent.service: { per-person: true }
checks.nami
# How to tell vm-guest works, on a computer nami made (tests/usb.sh runs these).
# (The quick VM test gives the VM both channels, as virt-manager does.)
"in a VM: SPICE's and QEMU's guest agents, started when the host has them":
  run: for c in com.redhat.spice.0:spice-vdagentd org.qemu.guest_agent.0:qemu-guest-agent; do if [ -e /dev/virtio-ports/${c%%:*} ]; then printf "%s " "${c#*:}=$(systemctl is-active ${c#*:})"; else printf "%s " "${c#*:}=no-channel-$(systemctl show -p LoadState --value ${c#*:})"; fi; done
  expect: "^spice-vdagentd=(active|no-channel-loaded) qemu-guest-agent=(active|no-channel-loaded) "

vscode

1 file

Visual Studio Code. Unfree, so cache.nixos.org doesn't have it: this takes Microsoft's prebuilt tarball and lets nixpkgs' autoPatchelfHook point every binary at nixpkgs libraries instead of /usr/lib, so it runs on any distro.

package.nami
# Visual Studio Code. Unfree, so cache.nixos.org doesn't have it: this takes
# Microsoft's prebuilt tarball and lets nixpkgs' autoPatchelfHook point every
# binary at nixpkgs libraries instead of /usr/lib, so it runs on any distro.
name: vscode
version: 1.141.0
source:
  url: https://update.code.visualstudio.com/1.141.0/linux-x64/stable
  name: vscode-1.141.0.tar.gz
  sha256: d77d588f0454cbaaa71e723497de4160d15b95fba4988abe177b1432e6bd570a
build-deps: [autoPatchelfHook]
deps:
  - alsa-lib
  - at-spi2-atk
  - at-spi2-core
  - cairo
  - cups
  - curl
  - dbus
  - expat
  - glib
  - gtk3
  - libdrm
  - libgbm
  - libkrb5
  - libnotify
  - libsecret
  - libuuid
  - libx11
  - libxcb
  - libxcomposite
  - libxdamage
  - libxext
  - libxfixes
  - libxkbcommon
  - libxkbfile
  - libxrandr
  - libxscrnsaver
  - libxshmfence
  - libxtst
  - nspr
  - nss
  - openssl
  - pango
  - wayland
  - libgcc.lib
runtime-deps: [udev, libGL, libsecret, libnotify]
install: |
  mkdir -p $out/lib/vscode $out/bin $out/share/applications $out/share/pixmaps
  cp -r . $out/lib/vscode
  # A setuid helper; the store can't hold setuid files. Electron falls back
  # to user namespaces for its sandbox.
  rm $out/lib/vscode/chrome-sandbox
  # Its window buttons on the left, as every window's: on namiOS, VS Code's title bar is the
  # system's (window.titleBarStyle "native"), niri's with namiOS's three buttons, and VS Code's
  # menus below it. Its own title bar puts minimize, maximize and close on the right whatever the
  # desktop says (Electron draws them there, over the page). Said in the person's own settings
  # the first time, so it's theirs: a titleBarStyle there already ("custom" to have VS Code's own
  # back) is kept.
  cat > $out/bin/code <<EOF
  #!$SHELL
  s=\${XDG_CONFIG_HOME:-\$HOME/.config}/Code/User/settings.json
  if [ -n "\${HOME:-}" ] && ! grep -qs '"window.titleBarStyle"' "\$s"; then
    mkdir -p "\${s%/*}"
    if [ -n "\$(tr -d ' \t\n{}' 2>/dev/null < "\$s")" ]; then
      # (Its first line that starts the settings; JSON with comments, so no jq.)
      sed -i '0,/^[[:space:]]*{/s//{\n  "window.titleBarStyle": "native",/' "\$s"
    else
      printf '{\n  "window.titleBarStyle": "native"\n}\n' > "\$s"
    fi
  fi
  exec $out/lib/vscode/bin/code "\$@"
  EOF
  chmod +x $out/bin/code
  cp resources/app/resources/linux/code.png $out/share/pixmaps/vscode.png
  cat > $out/share/applications/code.desktop <<DESKTOP
  [Desktop Entry]
  Name=Visual Studio Code
  Comment=Code Editing. Redefined.
  Exec=$out/bin/code %F
  Icon=vscode
  Type=Application
  Categories=Utility;TextEditor;Development;IDE;
  MimeType=text/plain;inode/directory;
  DESKTOP
build-env:
  # Only the optional Microsoft-account login broker wants these (WebKitGTK);
  # pulling in a whole browser engine for it isn't worth it.
  autoPatchelfIgnoreMissingDeps: libwebkit2gtk-4.1.so.0 libsoup-3.0.so.0

PipeWire's session manager (which device plays what), next to PipeWire.

package.nami
# PipeWire's session manager (which device plays what), next to PipeWire.
services:
  - wireplumber.service: { per-person: true }

zcat-lite

3 files

Local source, CMake, and a library from nixpkgs (zlib).

package.nami
# Local source, CMake, and a library from nixpkgs (zlib).
name: zcat-lite
version: 0.1.0
source:
  path: ./src
build-deps: [cmake]
deps: [zlib]
cmake-flags: [-DGREETING=nami]
src/CMakeLists.txt
cmake_minimum_required(VERSION 3.20)
project(zcat-lite C)
find_package(ZLIB REQUIRED)
set(GREETING "world" CACHE STRING "who to greet")
add_executable(zcat-lite main.c)
target_compile_definitions(zcat-lite PRIVATE GREETING="${GREETING}")
target_link_libraries(zcat-lite ZLIB::ZLIB)
install(TARGETS zcat-lite)
src/main.c
#include <stdio.h>
#include <zlib.h>

/* Decompress gzip from stdin to stdout. */
int main(int argc, char **argv) {
    if (argc > 1) { printf("zcat-lite for %s, zlib %s\n", GREETING, zlibVersion()); return 0; }
    gzFile in = gzdopen(0, "rb");
    char buf[65536];
    int n;
    while ((n = gzread(in, buf, sizeof buf)) > 0) fwrite(buf, 1, n, stdout);
    return gzclose(in) == Z_OK ? 0 : 1;
}

zram-swap

2 files

Swap, as every Ubuntu has (Ubuntu's is a file on the disk): here it's compressed memory (zram), as Fedora's and ChromeOS's, which suits a USB drive best (nothing written to it) and is quicker than a disk. Half the memory, at most 4 GB (zram-generator's default); what's swapped takes about a third of that once compressed. base lists it.

package.nami
# Swap, as every Ubuntu has (Ubuntu's is a file on the disk): here it's
# compressed memory (zram), as Fedora's and ChromeOS's, which suits a USB drive
# best (nothing written to it) and is quicker than a disk. Half the memory,
# at most 4 GB (zram-generator's default); what's swapped takes about a
# third of that once compressed. base lists it.
services:
  - nami-zram.service
files:
  /etc/nami-os/zram:
    mode: "0755"
    content: |
      #!/bin/sh
      PATH=/run/current-system/sw/bin
      if [ "$1" = stop ]; then
        swapoff /dev/zram0
        zramctl --reset /dev/zram0
        exit 0
      fi
      modprobe zram || exit 1
      kb=$(awk '/^MemTotal:/ { m = int($2 / 2); print (m > 4194304 ? 4194304 : m) }' /proc/meminfo)
      # (As the computer starts, udev may still have it open for a moment: "busy".)
      for _ in 1 2 3 4 5; do
        zramctl /dev/zram0 --algorithm zstd --size "${kb}K" && break
        sleep 1
      done
      mkswap -q /dev/zram0 && swapon -p 100 /dev/zram0
  /etc/systemd/system/nami-zram.service: |
    [Unit]
    Description=Swap in compressed memory (zram)
    DefaultDependencies=no
    Before=swap.target shutdown.target
    Conflicts=shutdown.target
    ConditionVirtualization=!container
    [Service]
    Type=oneshot
    RemainAfterExit=yes
    ExecStart=/etc/nami-os/zram start
    ExecStop=/etc/nami-os/zram stop
    [Install]
    WantedBy=swap.target
checks.nami
# How to tell zram-swap works, on a computer nami made (tests/usb.sh runs these).
"swap: compressed memory (zram)":
  run: swapon --show=NAME,TYPE --noheadings
  expect: "/dev/zram0 +partition"

zsh

2 files

zsh, the shell (macOS's), set up as a good one: a long shared history, completion with a menu (any case), cd by folder name, Emacs keys, the completions packages bring. And /etc/zshrc.d: what packages add for it (files: /etc/zshrc.d/<name>.zsh). No first-run questions. A command that isn't here says which package has it, and runs it once if you like (, cowsay hi).

package.nami
# zsh, the shell (macOS's), set up as a good one: a long shared history,
# completion with a menu (any case), cd by folder name, Emacs keys, the
# completions packages bring. And /etc/zshrc.d: what packages add for it
# (files: /etc/zshrc.d/<name>.zsh). No first-run questions. A command
# that isn't here says which package has it, and runs it once if you like
# (`, cowsay hi`).
files:
  # (zsh asks a new person how to set it up when they have no ~/.zshrc:
  # not here, this is set up)
  /etc/zshenv: |
    zsh-newuser-install() { :; }
  /etc/zshrc: |
    [[ -o interactive ]] || return
    HISTFILE=~/.zsh_history HISTSIZE=50000 SAVEHIST=50000
    setopt share_history hist_ignore_all_dups hist_reduce_blanks autocd interactive_comments no_beep
    bindkey -e
    fpath+=(~/.local/state/nami/profile/share/zsh/site-functions /nix/var/nami/profiles/default/share/zsh/site-functions /run/current-system/sw/share/zsh/site-functions)
    autoload -Uz compinit && compinit -d ~/.cache/zcompdump
    zstyle ':completion:*' menu select
    zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}'
    # A command that isn't here: which package has it, and run it once (`, cowsay hi`: nami run-once).
    command_not_found_handler() {
      [[ -x /nix/var/nami/bin/nami ]] && { /nix/var/nami/bin/nami run-once --not-found -- "$@"; return; }
      print -u2 "zsh: command not found: $1"; return 127
    }
    ,() { /nix/var/nami/bin/nami run-once "$@"; }
    for f in /etc/zshrc.d/*.zsh(N); do source $f; done; unset f
checks.nami
# How to tell zsh works, on a computer nami made (tests/vm-quick.sh tests/namios runs these).
"a command that isn't here says which package has it, and `,` runs it once":
  run: "zsh -ic 'figlet hi </dev/null; , figlet -v; command -v figlet || echo still-not-installed' 2>&1 | grep -cE 'Keep it: +nami install figlet|FIGlet Copyright|^still-not-installed$' | sed 's/^/N=/'"
  expect: "N=3"

Project starters

nami new <folder> --from <starter> starts a project from one of these.

c

1 file

C and C++, with a compiler, make, CMake and pkg-config. The tools this project needs; nami shell to use them.

project.nami
# C and C++, with a compiler, make, CMake and pkg-config. The tools this project needs; `nami shell` to use them.
packages:
  - gcc
  - gnumake
  - cmake
  - pkg-config
tasks:
  build: cmake -B build && cmake --build build

empty

1 file

Nothing yet, for the tools you add. The tools this project needs; nami shell to use them.

project.nami
# Nothing yet, for the tools you add. The tools this project needs; `nami shell` to use them.
packages: []

go

1 file

Go with its language server. The tools this project needs; nami shell to use them.

project.nami
# Go with its language server. The tools this project needs; `nami shell` to use them.
packages:
  - go
  - gopls
tasks:
  build: go build ./...
  test: go test ./...

node

1 file

JavaScript and TypeScript with Node.js. The tools this project needs; nami shell to use them.

project.nami
# JavaScript and TypeScript with Node.js. The tools this project needs; `nami shell` to use them.
packages:
  - nodejs
tasks:
  dev: npm run dev
  test: npm test

python

1 file

Python, with uv for dependencies. The tools this project needs; nami shell to use them.

project.nami
# Python, with uv for dependencies. The tools this project needs; `nami shell` to use them.
packages:
  - python3
  - uv
tasks:
  test: uv run pytest

rust

1 file

Rust, with cargo, its formatter and linter, and editor support. The tools this project needs; nami shell to use them.

project.nami
# Rust, with cargo, its formatter and linter, and editor support. The tools this project needs; `nami shell` to use them.
packages:
  - rustc
  - cargo
  - rustfmt
  - clippy
  - rust-analyzer
tasks:
  build: cargo build --release
  test: cargo test

Project services

Databases and such for nami up: copy one to a project's services/ folder and list it under services:.

mailpit

1 file

Mailpit for a project: copy this file to its services/ folder and list it, - ./services/mailpit.nami, under services: in its project.nami. Mail the project sends it over SMTP stays here, to read in your browser (MAILPIT_URL). It's ready when its ports answer.

mailpit.nami
# Mailpit for a project: copy this file to its services/ folder and list it,
# `- ./services/mailpit.nami`, under services: in its project.nami.
# Mail the project sends it over SMTP stays here, to read in your browser
# (MAILPIT_URL). It's ready when its ports answer.
about: Mailpit, catches the mail the project sends (read it in your browser)
packages: [mailpit]
port: 1025
ports: { web: 8025 }
run: mailpit --smtp 127.0.0.1:{port} --listen 127.0.0.1:{port.web} --database {state}/mailpit.db
exports:
  SMTP_HOST: localhost
  SMTP_PORT: "{port}"
  MAILPIT_URL: http://localhost:{port.web}

mysql

1 file

MySQL for a project (MariaDB, which speaks MySQL): copy this file to its services/ folder and list it, - ./services/mysql.nami, under services: in its project.nami. Its data and socket are in the project's .nami/mysql ({sockets}: a short folder elsewhere when that path is too long for a socket). The database is named after the project's folder; root has no password (it only listens on this computer).

mysql.nami
# MySQL for a project (MariaDB, which speaks MySQL): copy this file to its
# services/ folder and list it, `- ./services/mysql.nami`, under services:
# in its project.nami. Its data and socket are in the project's .nami/mysql
# ({sockets}: a short folder elsewhere when that path is too long for a socket).
# The database is named after the project's folder; root has no password
# (it only listens on this computer).
about: MySQL (MariaDB), the database
packages: [mariadb]
port: 3306
init: |
  mariadb-install-db --no-defaults --datadir={state}/data --auth-root-authentication-method=normal --skip-test-db >/dev/null
  echo 'CREATE DATABASE IF NOT EXISTS `{project}`;' > {state}/init.sql
run: mariadbd --no-defaults --datadir={state}/data --socket={sockets}/mysql.sock --port={port} --bind-address=127.0.0.1 --pid-file={state}/mysqld.pid --init-file={state}/init.sql
ready: mariadb-admin --no-defaults --socket={sockets}/mysql.sock -u root ping
as-root: false              # it won't, by default: as root, nami runs it as nobody
exports:
  MYSQL_UNIX_PORT: "{sockets}/mysql.sock"   # the mysql client uses the socket
  MYSQL_TCP_PORT: "{port}"
  MYSQL_DATABASE: "{project}"
  DATABASE_URL: mysql://root@localhost:{port}/{project}

postgres

1 file

PostgreSQL for a project: copy this file to its services/ folder and list it under services: in its project.nami, - ./services/postgres.nami (- ./services/postgres.nami: { version: 16 } for a version). Its data and socket are in the project's .nami/postgres ({sockets}: a short folder elsewhere when that path is too long for a socket). The database is named after the project's folder; anyone on this computer may log in as postgres, without a password (it only listens on this computer).

postgres.nami
# PostgreSQL for a project: copy this file to its services/ folder and list
# it under services: in its project.nami, `- ./services/postgres.nami`
# (`- ./services/postgres.nami: { version: 16 }` for a version). Its data and
# socket are in the project's .nami/postgres ({sockets}: a short folder elsewhere
# when that path is too long for a socket). The database is named after
# the project's folder; anyone on this computer may log in as postgres,
# without a password (it only listens on this computer).
about: PostgreSQL, the database
packages: [postgresql]
port: 5432
init: |
  initdb -D {state}/data -U postgres --auth=trust --encoding=UTF8 --no-locale >/dev/null
  echo 'CREATE DATABASE "{project}"' | postgres --single -D {state}/data postgres >/dev/null
run: postgres -D {state}/data -k {sockets} -p {port} -c listen_addresses=localhost
ready: pg_isready -q -h {sockets} -p {port}
stop-signal: INT          # a fast shutdown, even with clients connected
as-root: false              # it refuses to: as root, nami runs it as nobody
exports:
  PGHOST: "{sockets}"       # psql and libpq use the socket
  PGPORT: "{port}"
  PGUSER: postgres
  PGDATABASE: "{project}"
  DATABASE_URL: postgresql://postgres@localhost:{port}/{project}

redis

1 file

Redis for a project: copy this file to its services/ folder and list it, - ./services/redis.nami, under services: in its project.nami. Its socket and saved data are in the project's .nami/redis ({sockets}: a short folder elsewhere when that path is too long for a socket).

redis.nami
# Redis for a project: copy this file to its services/ folder and list it,
# `- ./services/redis.nami`, under services: in its project.nami.
# Its socket and saved data are in the project's .nami/redis ({sockets}: a
# short folder elsewhere when that path is too long for a socket).
about: Redis, the in-memory store
packages: [redis]
port: 6379
run: redis-server --port {port} --bind 127.0.0.1 --unixsocket {sockets}/redis.sock --unixsocketperm 700 --dir {state} --daemonize no
ready: redis-cli -s {sockets}/redis.sock ping
exports:
  REDIS_URL: redis://localhost:{port}
  REDIS_SOCKET: "{sockets}/redis.sock"

Something wrong or missing here? nami report tells us, or Report a problem in the nami window.