From f36e35d8080cd5b065b57f65a5d7ef9cd85e8322 Mon Sep 17 00:00:00 2001 From: Akira Komamura Date: Wed, 31 May 2023 22:14:02 +0900 Subject: [PATCH 1/4] Improve the test to actually load the packages --- tests/default.nix | 38 +++++++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 11 deletions(-) diff --git a/tests/default.nix b/tests/default.nix index dc6f942..4673360 100644 --- a/tests/default.nix +++ b/tests/default.nix @@ -1,12 +1,28 @@ -{ emacsAttr -}: -let - pkgs = import (import ../nix/sources.nix).nixpkgs { overlays = [ (import ../overlay.nix) ]; }; - emacs = (import ../default.nix).${emacsAttr}; +{emacsAttr ? null}: let + pkgs = import (import ../nix/sources.nix).nixpkgs { + overlays = [(import ../overlay.nix)]; + }; + emacs = + if emacsAttr == null + then pkgs.emacs + else (import ../default.nix).${emacsAttr}; in -(pkgs.emacsPackagesFor emacs).emacsWithPackages ( - epkgs: [ - epkgs.seq - epkgs.dash - ] -) + pkgs.writeShellApplication { + name = "test"; + runtimeInputs = [ + ((pkgs.emacs.pkgs.overrideScope' (_: _: { + inherit emacs; + })) + .withPackages ( + epkgs: [ + epkgs.seq + epkgs.dash + ] + )) + ]; + text = '' + emacs --version + emacs -batch -q -l seq -l dash + echo "Successfully loaded." + ''; + } From 4b7449f72dc7488e4b5dc706471ef4fa48bb668f Mon Sep 17 00:00:00 2001 From: Akira Komamura Date: Wed, 31 May 2023 22:58:19 +0900 Subject: [PATCH 2/4] Update the CI to run the test --- .github/workflows/test.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6193b65..c2603c2 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -37,6 +37,8 @@ jobs: cd tests && HOME=$(mktemp -d) ../result/bin/emacs -Q --batch \ --eval "(setq debug-on-error t)" --load init.el name: Test if package.el works inside Emacs - - run: nix-build --argstr emacsAttr emacs-${{ matrix.attr }} tests + - run: | + nix-build --argstr emacsAttr emacs-${{ matrix.attr }} tests \ + && result/bin/test if: ${{ ! contains( fromJson('[ "23-4", "24-1", "24-2", "24-3", "24-4", "24-5" ]'), matrix.attr ) }} name: Test low-level Nix usage From 8ee722d71b9eb591d22dd1d1f83feb45233e6b3e Mon Sep 17 00:00:00 2001 From: Akira Komamura Date: Wed, 31 May 2023 23:01:05 +0900 Subject: [PATCH 3/4] Create an empty site-start.el to make the wrapper work --- emacs.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/emacs.nix b/emacs.nix index dd8bcba..771726e 100644 --- a/emacs.nix +++ b/emacs.nix @@ -91,6 +91,12 @@ stdenv.mkDerivation rec { installTargets = "tags install"; + # Create site-start.el which is needed by the wrapper + postInstall = '' + mkdir -p $out/share/emacs/site-lisp + touch $out/share/emacs/site-lisp/site-start.el + ''; + meta = with lib; { description = "The extensible, customizable GNU text editor"; homepage = https://www.gnu.org/software/emacs/; From a46c3b52913f37e9b864655f3ea8bc88abddf6b6 Mon Sep 17 00:00:00 2001 From: Akira Komamura Date: Fri, 2 Jun 2023 07:59:11 +0900 Subject: [PATCH 4/4] Improve the step name --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c2603c2..d7df2a1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -41,4 +41,4 @@ jobs: nix-build --argstr emacsAttr emacs-${{ matrix.attr }} tests \ && result/bin/test if: ${{ ! contains( fromJson('[ "23-4", "24-1", "24-2", "24-3", "24-4", "24-5" ]'), matrix.attr ) }} - name: Test low-level Nix usage + name: Test if the wrapper builds a configuration