From e0a5ab4dbd15aad917809b8273adfb38cc435b7e Mon Sep 17 00:00:00 2001 From: akash-akya Date: Sat, 20 Jul 2024 12:47:56 +0530 Subject: [PATCH] Switch to nix based CI --- .github/workflows/ci.yaml | 15 +++++++-------- flake.lock | 27 +++++++++++++++++++++++++++ flake.nix | 24 ++++++++++++++++++++++++ mix.exs | 2 +- 4 files changed, 59 insertions(+), 9 deletions(-) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index aff7895..32570b9 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -118,14 +118,12 @@ jobs: macos-precompiled: runs-on: macos-11 steps: - - uses: actions/checkout@v3 - - name: Install erlang and elixir - run: | - brew install erlang elixir - mix local.hex --force - mix local.rebar --force - - run: mix deps.get - - run: mix test --trace + - uses: actions/checkout@v4 + - uses: DeterminateSystems/nix-installer-action@main + - uses: DeterminateSystems/magic-nix-cache-action@main + - uses: DeterminateSystems/flake-checker-action@main + - run: nix develop --command mix deps.get + - run: nix develop --command mix test --trace lint: runs-on: ubuntu-22.04 @@ -160,6 +158,7 @@ jobs: # mix dialyzer --plt - run: mix deps.get + - run: mix clean && mix deep_clean - run: mix compile --force --warnings-as-errors - run: mix deps.unlock --check-unused - run: mix format --check-formatted diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..0360468 --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1718835956, + "narHash": "sha256-wM9v2yIxClRYsGHut5vHICZTK7xdrUGfrLkXvSuv6s4=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "dd457de7e08c6d06789b1f5b88fc9327f4d96309", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-24.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..fc0f7d1 --- /dev/null +++ b/flake.nix @@ -0,0 +1,24 @@ +{ + description = "Elixir Development Environment"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05"; + }; + + outputs = { self, nixpkgs, ... }: + let + supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]; + forAllSystems = f: nixpkgs.lib.genAttrs supportedSystems (system: f { + pkgs = import nixpkgs { inherit system; }; + }); + in + { + devShells = forAllSystems ({ pkgs }: { + default = pkgs.mkShell { + packages = with pkgs; [ + elixir + ]; + }; + }); + }; +} diff --git a/mix.exs b/mix.exs index bdb2ebf..375f8b7 100644 --- a/mix.exs +++ b/mix.exs @@ -136,7 +136,7 @@ defmodule Vix.MixProject do end defp maybe_kino do - if Version.compare(System.version(), "1.13.0") in [:gt, :eq] do + if Version.compare(System.version(), "1.14.0") in [:gt, :eq] do [{:kino, "~> 0.7", optional: true}] else []