diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml new file mode 100644 index 0000000..0c7ef65 --- /dev/null +++ b/.github/workflows/check.yml @@ -0,0 +1,23 @@ +name: Check + +on: + workflow_dispatch: + pull_request: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + update: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: cachix/install-nix-action@v23 + with: + extra_nix_config: | + accept-flake-config = true + + - name: Smoke-test the library function + run: nix develop -c just check-function diff --git a/flake.nix b/flake.nix index e06b289..dc218f6 100644 --- a/flake.nix +++ b/flake.nix @@ -13,6 +13,7 @@ outputs = { systems, nixpkgs, + self, ... } @ inputs: let inherit (nixpkgs) lib; @@ -33,6 +34,18 @@ in { data = import ./generated; + lib.builtinLibrariesOfEmacsVersion = targetVersion: let + xs = + builtins.map ({libraries, ...}: libraries) + ( + builtins.filter ({version, ...}: version == targetVersion) + (builtins.attrValues self.data) + ); + in + if builtins.length xs > 0 + then builtins.head xs + else null; + devShells = eachSystem (pkgs: { default = pkgs.mkShell {buildInputs = [pkgs.just];}; }); diff --git a/justfile b/justfile index 0b9142e..fd7c066 100644 --- a/justfile +++ b/justfile @@ -4,3 +4,6 @@ update: mkdir -p generated rm -f generated/*.nix install -m 644 $(nix build . --print-out-paths)/*.nix generated/ + +check-function: + nix eval .\#lib.builtinLibrariesOfEmacsVersion --apply 'f: f "29.1"'