diff --git a/.github/workflows/build-artifacts.yml b/.github/workflows/build-artifacts.yml index a60d168..475fdca 100644 --- a/.github/workflows/build-artifacts.yml +++ b/.github/workflows/build-artifacts.yml @@ -11,29 +11,22 @@ on: jobs: Compile-All: - runs-on: macos-12 + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Cache Vagrant boxes - uses: actions/cache@v4.0.2 + - name: Install Nix + uses: cachix/install-nix-action@v26 with: - path: ~/.vagrant.d/boxes - key: $${{ runner.os }}-vagrant-${{ hashFiles('Vagrantfile') }} - restore-keys: | - ${{ runner.os }}-vagrant- + github_access_token: ${{ secrets.GITHUB_TOKEN }} + nix_path: nixpkgs=channel:nixos-unstable - - name: Show Vagrant version - run: vagrant --version - - - name: Run vagrant up & provision + - name: Compile TextMate Grammar run: | - vagrant plugin install vagrant-disksize - vagrant up --provision - env: - VER: 23.05 + chmod +x ./scripts/compile-grammar.sh + ./scripts/compile-grammar.sh - - name: Get Coverage Badge SVG + - name: Compile Coverage Badge SVG run: make -B $(pwd)/images/coverage-badge.svg - name: Import GPG key diff --git a/Vagrantfile b/Vagrantfile index 207c8c8..66a47b6 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -7,7 +7,7 @@ Vagrant.configure("2") do |config| config.vm.box = "nixbox/nixos" config.vm.box_version = ver.to_s - config.disksize.size = '8GB' + config.disksize.size = '10GB' config.vm.provider "virtualbox" do |vb| vb.gui = false @@ -17,12 +17,8 @@ Vagrant.configure("2") do |config| config.vm.synced_folder ".", "/vagrant" config.vm.provision "shell", privileged: false, inline: <<-'SHELL' - cd /vagrant/ - nix --version - df -h - echo "statix check && \ - nix flake check --impure && \ - cp \$(nix build --impure --no-link --print-out-paths)/parigp* ./syntaxes/" | \ - nix-shell --run bash + SCRIPTNAME=scripts/compile-grammar.sh + chmod +x /vagrant/$SCRIPTNAME + /vagrant/$SCRIPTNAME SHELL end diff --git a/flake.nix b/flake.nix index 9c5fcff..b47fce8 100644 --- a/flake.nix +++ b/flake.nix @@ -10,7 +10,7 @@ { packages.${current_system}.default = - with import nixpkgs { system = current_system; }; + with import ./nixpkgs.nix { system = current_system; }; let vscode_tmgrammar_test = buildNpmPackage rec { pname = "vscode-tmgrammar-test"; diff --git a/nixpkgs.nix b/nixpkgs.nix new file mode 100644 index 0000000..b0652ee --- /dev/null +++ b/nixpkgs.nix @@ -0,0 +1,7 @@ +let + lock = (builtins.fromJSON (builtins.readFile ./flake.lock)).nodes.nixpkgs.locked; +in +import (fetchTarball { + url = "https://github.com/nixos/nixpkgs/archive/${lock.rev}.tar.gz"; + sha256 = lock.narHash; +}) diff --git a/scripts/compile-grammar.sh b/scripts/compile-grammar.sh new file mode 100755 index 0000000..c0eb869 --- /dev/null +++ b/scripts/compile-grammar.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env nix-shell +#!nix-shell ../shell.nix -i bash +# compile-grammar.sh - Builds TextMate grammar with help of Nix. + +# shellcheck shell=sh +set -e + + +scriptPath="$(readlink -f $0)" +rootDir=$(dirname "${scriptPath%/*}") + +statix check +nix flake check --impure "$rootDir" + +cp $(nix build --impure \ + --no-link \ + --print-out-paths "$rootDir")/parigp* "$rootDir/syntaxes/" diff --git a/shell.nix b/shell.nix index 5dd0527..595e18d 100644 --- a/shell.nix +++ b/shell.nix @@ -1,4 +1,4 @@ -{ pkgs ? (import ) {} }: +{ pkgs ? (import ./nixpkgs.nix) {} }: pkgs.mkShell { NIX_CONFIG = "experimental-features = nix-command flakes"; nativeBuildInputs = with pkgs; [