feat: add Nix flake and handle Nix-store installs in upgrade (#764)

* feat: add Nix flake and stop self-upgrade of Nix-store installs

Add flake.nix with packages, overlays.default, checks and a formatter,
building nix/package.nix with the unit tests in the Nix sandbox. The
version comes from the Release Please manifest, so releases need no Nix
edit. A Nix workflow runs `nix flake check` on non-docs changes.

`skillshare upgrade` now detects binaries under /nix/store/ and prints
`nix profile upgrade skillshare` instead of replacing a read-only store
path; update notices and doctor suggest the same command.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(upgrade): give Nix installs the right update path everywhere

The first flake commit sent every /nix/store binary to `nix profile
upgrade`, failed a plain `skillshare upgrade` with exit 1 even when the
CLI was current, and left the dashboard with a generic 500.

- Tell `nix profile` installs (the profile manifest lists the store path)
  from NixOS, Home Manager and overlay installs, which are told to update
  their configuration and rebuild. Detection lives in one helper shared by
  the update notice, doctor, upgrade and the dashboard.
- `upgrade` on Nix reports "already up to date" or prints the hint and
  exits 0; the built-in skill still updates.
- The dashboard runs the upgrade so the skill updates, then answers
  409 `upgrade.nix` with the command when a newer CLI waits on Nix. The
  UI shows localized text for it in all 11 locales.
- Installs skip the unit tests; the flake's checks enable them. postPatch
  lowers only the go directive's patch version and fails evaluation with
  a clear message when go.mod needs a newer Go minor. CI also builds the
  package on macOS.
- Docs, translations, the built-in skill reference and the release topic
  describe the new behaviour.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Charitarth Chugh
2026-11-04 15:53:57 +08:00
committed by GitHub
co-authored by Claude Opus 5.5
parent 83d4d0ac19
commit 64c8a3f34e
67 changed files with 864 additions and 59 deletions
+53
View File
@@ -0,0 +1,53 @@
name: Nix
# Keeps the flake building, including the Go unit tests in the Nix sandbox.
# A hash mismatch after a go.sum change means vendorHash in nix/package.nix
# needs the "got: sha256-..." value from the log.
on:
push:
branches: [main]
paths-ignore: &docs-paths
- "website/**"
- "video/**"
- "wiki/**"
- "proposals/**"
- "ai_docs/**"
- "**/*.md"
pull_request:
branches: [main]
paths-ignore: *docs-paths
workflow_dispatch:
concurrency:
group: ${{ github.event_name == 'pull_request' && format('nix-pr-{0}', github.event.pull_request.number) || format('nix-{0}', github.run_id) }}
cancel-in-progress: true
permissions:
contents: read
jobs:
check:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Nix
uses: cachix/install-nix-action@v31
- name: Flake check
run: nix flake check -L
# The unit tests do not run on macOS upstream either, so only build the
# package (with its version check) for aarch64-darwin.
build-darwin:
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Nix
uses: cachix/install-nix-action@v31
- name: Build
run: nix build -L .#skillshare