Skip to content

Commit

Permalink
Merge pull request #33 from birros/feat/migrate-to-nix
Browse files Browse the repository at this point in the history
feat: migrate to Nix Flake build system
  • Loading branch information
birros authored Dec 12, 2024
2 parents ad03c27 + 863a542 commit 2719972
Show file tree
Hide file tree
Showing 153 changed files with 3,190 additions and 2,658 deletions.
105 changes: 34 additions & 71 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,39 @@ on: [push, pull_request]
jobs:
ci:
name: ci
runs-on: macos-13
# https://github.com/actions/runner-images/blob/main/images/macos/macos-15-Readme.md
runs-on: macos-15
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install requirements
run: brew install go meson ninja nasm
- uses: DeterminateSystems/nix-installer-action@v14
with:
extra-conf: |
sandbox = true
sandbox-fallback = false
- name: Nix version
run: nix --version

- name: Show Nix config
run: nix config show

- name: Xcode version
run: /Applications/Xcode_16.1.0.app/Contents/Developer/usr/bin/xcodebuild -version

# See ${workspace}/nix/overlays/xcode.md
- name: Set up Xcode in Nix store
run: |
XCODE_APP=$(realpath /Applications/Xcode_16.1.0.app)
NIX_STORE_PATH="/nix/store/v92p4w6nxhyhq6lv0maq5cbb59mbxw5b-Xcode.app"
HASH="sha256:d63c91255c8e98603b7f1470067c5225ab673850eed35449f5a0105c936e581c"
sudo cp -a $XCODE_APP $NIX_STORE_PATH
sudo sqlite3 /nix/var/nix/db/db.sqlite "INSERT INTO ValidPaths (path,hash,registrationTime) VALUES ('$NIX_STORE_PATH','$HASH',$(date +%s))"
- name: Print tool versions
run: make tool-versions
- uses: DeterminateSystems/magic-nix-cache-action@v8

- name: Determine version
id: version
Expand All @@ -34,80 +55,22 @@ jobs:
echo ${VERSION}
- name: Build
# macOS runners have unknown resource limits (timeout or number of open
# files…) that prevent the execution of a single Makefile rule that
# manages all builds. So the time per rule must be limited.
run: |
VERSION=${{ steps.version.outputs.version }}
make build/output/libmpv-libs_${VERSION}_ios-arm64-audio-default.tar.gz
make build/output/libmpv-libs_${VERSION}_ios-arm64-audio-full.tar.gz
make build/output/libmpv-libs_${VERSION}_ios-arm64-audio-encodersgpl.tar.gz
make build/output/libmpv-libs_${VERSION}_ios-arm64-video-default.tar.gz
make build/output/libmpv-libs_${VERSION}_ios-arm64-video-full.tar.gz
make build/output/libmpv-libs_${VERSION}_ios-arm64-video-encodersgpl.tar.gz
make build/output/libmpv-libs_${VERSION}_iossimulator-amd64-audio-default.tar.gz
make build/output/libmpv-libs_${VERSION}_iossimulator-amd64-audio-full.tar.gz
make build/output/libmpv-libs_${VERSION}_iossimulator-amd64-audio-encodersgpl.tar.gz
make build/output/libmpv-libs_${VERSION}_iossimulator-amd64-video-default.tar.gz
make build/output/libmpv-libs_${VERSION}_iossimulator-amd64-video-full.tar.gz
make build/output/libmpv-libs_${VERSION}_iossimulator-amd64-video-encodersgpl.tar.gz
make build/output/libmpv-libs_${VERSION}_iossimulator-arm64-audio-default.tar.gz
make build/output/libmpv-libs_${VERSION}_iossimulator-arm64-audio-full.tar.gz
make build/output/libmpv-libs_${VERSION}_iossimulator-arm64-audio-encodersgpl.tar.gz
make build/output/libmpv-libs_${VERSION}_iossimulator-arm64-video-default.tar.gz
make build/output/libmpv-libs_${VERSION}_iossimulator-arm64-video-full.tar.gz
make build/output/libmpv-libs_${VERSION}_iossimulator-arm64-video-encodersgpl.tar.gz
make build/output/libmpv-libs_${VERSION}_iossimulator-universal-audio-default.tar.gz
make build/output/libmpv-libs_${VERSION}_iossimulator-universal-audio-full.tar.gz
make build/output/libmpv-libs_${VERSION}_iossimulator-universal-audio-encodersgpl.tar.gz
make build/output/libmpv-libs_${VERSION}_iossimulator-universal-video-default.tar.gz
make build/output/libmpv-libs_${VERSION}_iossimulator-universal-video-full.tar.gz
make build/output/libmpv-libs_${VERSION}_iossimulator-universal-video-encodersgpl.tar.gz
make build/output/libmpv-libs_${VERSION}_macos-amd64-audio-default.tar.gz
make build/output/libmpv-libs_${VERSION}_macos-amd64-audio-full.tar.gz
make build/output/libmpv-libs_${VERSION}_macos-amd64-audio-encodersgpl.tar.gz
make build/output/libmpv-libs_${VERSION}_macos-amd64-video-default.tar.gz
make build/output/libmpv-libs_${VERSION}_macos-amd64-video-full.tar.gz
make build/output/libmpv-libs_${VERSION}_macos-amd64-video-encodersgpl.tar.gz
make build/output/libmpv-libs_${VERSION}_macos-arm64-audio-default.tar.gz
make build/output/libmpv-libs_${VERSION}_macos-arm64-audio-full.tar.gz
make build/output/libmpv-libs_${VERSION}_macos-arm64-audio-encodersgpl.tar.gz
make build/output/libmpv-libs_${VERSION}_macos-arm64-video-default.tar.gz
make build/output/libmpv-libs_${VERSION}_macos-arm64-video-full.tar.gz
make build/output/libmpv-libs_${VERSION}_macos-arm64-video-encodersgpl.tar.gz
make build/output/libmpv-libs_${VERSION}_macos-universal-audio-default.tar.gz
make build/output/libmpv-libs_${VERSION}_macos-universal-audio-full.tar.gz
make build/output/libmpv-libs_${VERSION}_macos-universal-audio-encodersgpl.tar.gz
make build/output/libmpv-libs_${VERSION}_macos-universal-video-default.tar.gz
make build/output/libmpv-libs_${VERSION}_macos-universal-video-full.tar.gz
make build/output/libmpv-libs_${VERSION}_macos-universal-video-encodersgpl.tar.gz
make build/output/libmpv-xcframeworks_${VERSION}_ios-universal-audio-default.tar.gz
make build/output/libmpv-xcframeworks_${VERSION}_ios-universal-audio-full.tar.gz
make build/output/libmpv-xcframeworks_${VERSION}_ios-universal-audio-encodersgpl.tar.gz
make build/output/libmpv-xcframeworks_${VERSION}_ios-universal-video-default.tar.gz
make build/output/libmpv-xcframeworks_${VERSION}_ios-universal-video-full.tar.gz
make build/output/libmpv-xcframeworks_${VERSION}_ios-universal-video-encodersgpl.tar.gz
make build/output/libmpv-xcframeworks_${VERSION}_macos-universal-audio-default.tar.gz
make build/output/libmpv-xcframeworks_${VERSION}_macos-universal-audio-full.tar.gz
make build/output/libmpv-xcframeworks_${VERSION}_macos-universal-audio-encodersgpl.tar.gz
make build/output/libmpv-xcframeworks_${VERSION}_macos-universal-video-default.tar.gz
make build/output/libmpv-xcframeworks_${VERSION}_macos-universal-video-full.tar.gz
make build/output/libmpv-xcframeworks_${VERSION}_macos-universal-video-encodersgpl.tar.gz
make build/output/debug.zip
echo \"$VERSION\" > nix/utils/default/version.nix
nix build -v
- name: Upload artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
if-no-files-found: error
path: |
build/output/debug.zip
build/output/*.tar.gz
result/*.tar.gz
- name: Release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
fail_on_unmatched_files: true
files: |
build/output/debug.zip
build/output/*.tar.gz
result/*.tar.gz
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
build
result
10 changes: 0 additions & 10 deletions .tool-versions

This file was deleted.

3 changes: 2 additions & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"recommendations": [
"redhat.vscode-yaml",
"bierner.markdown-mermaid",
"foxundermoon.shell-format"
"foxundermoon.shell-format",
"jnoortheen.nix-ide"
]
}
13 changes: 13 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,18 @@
"editor.formatOnSave": true,
"[yaml]": {
"editor.defaultFormatter": "redhat.vscode-yaml"
},
"nix.serverPath": "nixd",
"nix.enableLanguageServer": true,
"nix.formatterPath": "nixfmt",
"nix.serverSettings": {
"nixd": {
"nixpkgs": {
"expr": "import <nixpkgs> { }",
},
"formatting": {
"command": [ "nixfmt" ],
},
}
}
}
Loading

0 comments on commit 2719972

Please sign in to comment.