Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 23 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,32 @@ jobs:
name: 'Generate matrix from cabal'
outputs:
test-matrix: ${{ steps.set-test-matrix.outputs.matrix }}
release-matrix: ${{ steps.set-release-matrix.outputs.matrix }}
release-matrix: ${{ steps.extend-release-matrix.outputs.matrix }}
runs-on: ubuntu-latest
steps:
- name: Extract the tested GHC versions (tests)
id: set-test-matrix
uses: kleidukos/get-tested@v0.1.9.1
uses: kleidukos/get-tested@v0.1.10.0
with:
cabal-file: ghcup-gtk.cabal
ubuntu-version: '26.04'
version: 0.1.9.1
ubuntu-version: '24.04,26.04'
version: 0.1.10.0

- name: Extract the tested GHC versions (packages)
id: set-release-matrix
uses: kleidukos/get-tested@v0.1.9.1
uses: kleidukos/get-tested@v0.1.10.0
with:
cabal-file: ghcup-gtk.cabal
ubuntu-version: '26.04'
ubuntu-version: '24.04,26.04'
macos-version: 'latest'
version: 0.1.9.1
version: 0.1.10.0

- name: Add the aarch64 Ubuntu runners to the release matrix
id: extend-release-matrix
env:
MATRIX: ${{ steps.set-release-matrix.outputs.matrix }}
run: |
echo "matrix=$(jq -c '.include += [.include[] | select(.os | startswith("ubuntu-")) | .os += "-arm"]' <<< "$MATRIX")" >> "$GITHUB_OUTPUT"

tests:
name: ${{ matrix.ghc }} on ${{ matrix.os }}
Expand Down Expand Up @@ -142,22 +149,23 @@ jobs:
uses: actions/cache@v6
with:
path: ${{ steps.setup-haskell.outputs.cabal-store }}
key: release-${{ runner.os }}-ghc-${{ matrix.ghc }}-${{ hashFiles('**/plan.json') }}
restore-keys: release-${{ runner.os }}-ghc-${{ matrix.ghc }}-
key: release-${{ matrix.os }}-ghc-${{ matrix.ghc }}-${{ hashFiles('**/plan.json') }}
restore-keys: release-${{ matrix.os }}-ghc-${{ matrix.ghc }}-

- name: Cache flatpak runtimes
if: runner.os == 'Linux'
if: startsWith(matrix.os, 'ubuntu-26.04')
uses: actions/cache@v6
with:
path: ~/.local/share/flatpak
key: flatpak-runtimes-${{ hashFiles('flatpak/org.haskell.GhcupGtk.yml') }}
key: flatpak-runtimes-${{ runner.arch }}-${{ hashFiles('packaging/flatpak/org.haskell.GhcupGtk.yml') }}

- name: Build packages
run: |
FORMATS=()
if [[ "$RUNNER_OS" == "Linux" ]]; then
FORMATS=(deb rpm pacman flatpak)
fi
case "${{ matrix.os }}" in
ubuntu-26.04*) FORMATS=(deb rpm pacman flatpak tarball) ;;
ubuntu-24.04*) FORMATS=(deb) ;;
esac
if [[ "$GITHUB_REF" == refs/tags/v* ]]; then
./scripts/package.sh -v "${GITHUB_REF_NAME#v}" ${FORMATS[@]+"${FORMATS[@]}"}
else
Expand All @@ -166,7 +174,7 @@ jobs:

- uses: actions/upload-artifact@v7
with:
name: packages-${{ runner.os }}
name: packages-${{ matrix.os }}-${{ runner.arch }}
path: dist-package/out/*
if-no-files-found: error

Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Revision history for ghcup-gtk

## 0.1.0.0 -- YYYY-mm-dd
## 0.1.0.0 -- 2026-08-31

* First version. Released on an unsuspecting world.
68 changes: 68 additions & 0 deletions assets/org.haskell.GhcupGtk.metainfo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop-application">
<id>org.haskell.GhcupGtk</id>
<metadata_license>CC0-1.0</metadata_license>
<project_license>GPL-3.0-only</project_license>
<name>Haskell Toolchain Manager</name>
<summary>Install GHC, Cabal, HLS and Stack</summary>
<description>
<p>
Haskell Toolchain Manager is a GTK4/libadwaita application for installing
and managing the Haskell toolchain. It downloads toolchains from the
official GHCup release channels.
</p>
<ul>
<li>Install, set and remove versions of the GHC compiler</li>
<li>Manage Cabal, Stack and the Haskell Language Server</li>
<li>Follow the regular, prerelease and nightly release channels</li>
<li>Configure metadata sources from the preferences dialog</li>
</ul>
</description>
<launchable type="desktop-id">org.haskell.GhcupGtk.desktop</launchable>
<developer id="in.glitchbra.hecate">
<name>Hécate Moonlight</name>
</developer>
<url type="homepage">https://github.com/Kleidukos/ghcup-gtk</url>
<url type="bugtracker">https://github.com/Kleidukos/ghcup-gtk/issues</url>
<url type="vcs-browser">https://github.com/Kleidukos/ghcup-gtk</url>
<url type="donation">https://ko-fi.com/hecatemoonlight</url>
<screenshots>
<screenshot type="default">
<image>https://raw.githubusercontent.com/Kleidukos/ghcup-gtk/v0.1.0.0/screenshots/list-view.png</image>
<caption>The main window, listing toolchain releases</caption>
</screenshot>
<screenshot>
<image>https://raw.githubusercontent.com/Kleidukos/ghcup-gtk/v0.1.0.0/screenshots/preferences.png</image>
<caption>The preferences dialog, with release channel settings</caption>
</screenshot>
</screenshots>
<releases>
<release version="0.1.0.0" date="2026-09-01">
<description>
<p>Initial release.</p>
</description>
</release>
</releases>
<content_rating type="oars-1.1"/>
<branding>
<color type="primary" scheme_preference="light">#cabcf0</color>
<color type="primary" scheme_preference="dark">#4a3d70</color>
</branding>
<keywords>
<keyword>ghc</keyword>
<keyword>cabal</keyword>
<keyword>stack</keyword>
<keyword>hls</keyword>
<keyword>haskell</keyword>
<keyword>ghcup</keyword>
<keyword>compiler</keyword>
<keyword>toolchain</keyword>
</keywords>
<recommends>
<control>keyboard</control>
<control>pointing</control>
</recommends>
<requires>
<display_length compare="ge">768</display_length>
</requires>
</component>
35 changes: 35 additions & 0 deletions packaging/flatpak/flathub/org.haskell.GhcupGtk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Manifest for Flathub submission
# After cutting a release, fill in the sha256 fields:
# sha256sum ghcup-gtk-<version>-linux-{x86_64,aarch64}.tar.gz
app-id: org.haskell.GhcupGtk
runtime: org.gnome.Platform
runtime-version: '49'
sdk: org.gnome.Sdk
command: ghcup-gtk
finish-args:
- --share=ipc
- --share=network
- --socket=wayland
- --socket=fallback-x11
- --device=dri
# Manage the user-local toolchain
- --filesystem=home
# Query the host's real $SHELL and $PATH via flatpak-spawn
- --talk-name=org.freedesktop.Flatpak
- --env=ghcup_gtk_datadir=/app/share/ghcup-gtk
modules:
- name: ghcup-gtk
buildsystem: simple
build-commands:
- cp -a ./. /app
sources:
- type: archive
only-arches: [x86_64]
strip-components: 0
url: https://github.com/Kleidukos/ghcup-gtk/releases/download/v0.1.0.0/ghcup-gtk-0.1.0.0-linux-x86_64.tar.gz
sha256: TODO_FILL_AFTER_RELEASE
- type: archive
only-arches: [aarch64]
strip-components: 0
url: https://github.com/Kleidukos/ghcup-gtk/releases/download/v0.1.0.0/ghcup-gtk-0.1.0.0-linux-aarch64.tar.gz
sha256: TODO_FILL_AFTER_RELEASE
3 changes: 2 additions & 1 deletion packaging/flatpak/org.haskell.GhcupGtk.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Manifest for Flatpak building
app-id: org.haskell.GhcupGtk
runtime: org.gnome.Platform
runtime-version: '49'
Expand All @@ -9,7 +10,7 @@ finish-args:
- --socket=wayland
- --socket=fallback-x11
- --device=dri
- --filesystem=host
- --filesystem=home
# Query the host's real $SHELL and $PATH via flatpak-spawn
- --talk-name=org.freedesktop.Flatpak
- --env=ghcup_gtk_datadir=/app/share/ghcup-gtk
Expand Down
18 changes: 13 additions & 5 deletions scripts/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -euo pipefail
# Usage: scripts/package.sh -v <version>|head [format...]
# -v: mandatory; version label used in the package file name; either
# a numeric version (e.g. 1.2.3) or the literal "head".
# formats: deb rpm pacman flatpak (Linux), osxpkg (macOS)
# formats: deb rpm pacman flatpak tarball (Linux), osxpkg (macOS)
# No format arguments: build every fpm format native to the host OS
# (flatpak is only built when requested explicitly, since it needs
# flatpak-builder and the GNOME runtime installed).
Expand All @@ -19,7 +19,7 @@ usage() {
echo "usage: scripts/package.sh -v <version>|head [format...]"
echo " -v mandatory; version label for the package file name:"
echo " a numeric version (e.g. 1.2.3) or \"head\""
echo " formats: deb rpm pacman flatpak (Linux), osxpkg (macOS)"
echo " formats: deb rpm pacman flatpak tarball (Linux), osxpkg (macOS)"
}

ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
Expand Down Expand Up @@ -71,7 +71,7 @@ fi

for fmt in "${FORMATS[@]}"; do
case "$OS,$fmt" in
Darwin,osxpkg | Linux,deb | Linux,rpm | Linux,pacman | Linux,flatpak) ;;
Darwin,osxpkg | Linux,deb | Linux,rpm | Linux,pacman | Linux,flatpak | Linux,tarball) ;;
*)
echo "error: cannot build '$fmt' on $OS" >&2
exit 1
Expand All @@ -95,10 +95,10 @@ fi
ARCH="$(uname -m)"

# Minimum supported OS per package format. Keep in sync with the
# runners in .github/workflows/release.yml.
# runners in .github/workflows/ci.yml.
min_os_for() {
case "$1" in
deb) echo ubuntu-26 ;;
deb) echo "ubuntu-$(. /etc/os-release && echo "${VERSION_ID%%.*}")" ;;
rpm) echo fedora-44 ;;
pacman) echo archlinux ;;
osxpkg) echo macos-15 ;;
Expand Down Expand Up @@ -190,6 +190,8 @@ else
"${STAGING}${PREFIX}/share/applications/org.haskell.GhcupGtk.desktop"
install_file 644 assets/org.haskell.GhcupGtk.svg \
"${STAGING}${PREFIX}/share/icons/hicolor/scalable/apps/org.haskell.GhcupGtk.svg"
install_file 644 assets/org.haskell.GhcupGtk.metainfo.xml \
"${STAGING}${PREFIX}/share/metainfo/org.haskell.GhcupGtk.metainfo.xml"
fi

FPM_COMMON=(
Expand Down Expand Up @@ -238,6 +240,12 @@ for fmt in "${FORMATS[@]}"; do
build_flatpak "ghcup-gtk-${VERSION_LABEL}-${ARCH}.flatpak"
continue
;;
tarball)
PKG_NAME="ghcup-gtk-${VERSION_LABEL}-linux-${ARCH}.tar.gz"
echo "==> tar ($PKG_NAME)"
tar -C "${STAGING}${PREFIX}" -czf "dist-package/out/${PKG_NAME}" .
continue
;;
osxpkg)
build_osxpkg "ghcup-gtk-${VERSION_LABEL}-$(min_os_for "$fmt")-${ARCH}.pkg"
continue
Expand Down
16 changes: 13 additions & 3 deletions src/gtk/UI/Dialog.hs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@ import GI.Gtk qualified as Gtk

import Presentation.Row (Confirmation (..))

class FileResult r where
toMaybeFile :: r -> Maybe Gio.File

instance FileResult Gio.File where
toMaybeFile = Just

instance FileResult (Maybe Gio.File) where
toMaybeFile = id

info :: Adw.ApplicationWindow -> Text -> Text -> IO ()
info window heading body = do
dialog <- Adw.alertDialogNew (Just heading) (Just body)
Expand Down Expand Up @@ -46,7 +55,8 @@ pickFolder window title onPicked = do
result <- try @GError (fileDialog.selectFolderFinish asyncResult)
case result of
Left _dismissed -> pure ()
Right file -> do
mpath <- file.getPath
forM_ mpath onPicked
Right picked ->
forM_ (toMaybeFile picked) $ \file -> do
mpath <- file.getPath
forM_ mpath onPicked
)
4 changes: 2 additions & 2 deletions src/gtk/UI/Shell.hs
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ build app config = do

breakpoint <-
Adw.breakpointNew =<< Adw.breakpointConditionParse "max-width: 560sp"
collapsed <- toGValue True
breakpoint.addSetter splitView "collapsed" (Just collapsed)
_ <- on breakpoint #apply $ set splitView [#collapsed := True]
_ <- on breakpoint #unapply $ set splitView [#collapsed := False]
window.addBreakpoint breakpoint

ToolPanes.onToolSelected panes $ \tool -> do
Expand Down
Loading