Skip to content
This repository has been archived by the owner on Oct 27, 2022. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'origin/develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
László Vaskó committed Nov 22, 2019
2 parents c564b24 + 10655c5 commit ed6b14f
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 9 deletions.
9 changes: 7 additions & 2 deletions default.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{ # Package set to build the Emacs environment from
emacsPackages
# Emacs package to use during build
, emacs ? emacsPackages.emacs
# You may override to use your version of `straight`
, straight ? null
# Your `init.el` file to use for discovering and installing packages
Expand All @@ -8,10 +10,13 @@
, emacsArgs ? []
# Additional files you wish to load prior to executing package discovery
# Good place to place to call `advice-add` from
, emacsLoadFiles ? [] }:
, emacsLoadFiles ? []
# Abort processing if a package not found in `emacsPackages`
# Setting it to false will result in just skipping an unavailable package
, abortOnNotFound ? false }:

let
libstraight = epkgs.callPackage ./libstraight.nix { inherit epkgs; };
libstraight = epkgs.callPackage ./libstraight.nix { inherit abortOnNotFound epkgs emacs; };
epkgs =
if straight == null then
emacsPackages.overrideScope' (self: super:
Expand Down
14 changes: 8 additions & 6 deletions libstraight.nix
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
{ lib, stdenv, epkgs, writeScript }:
{ abortOnNotFound ? true,
lib, stdenv, epkgs, emacs, writeScript }:

let
inherit (builtins) filter trace;
inherit (lib) concatMapStringsSep escapeShellArgs importJSON flatten unique optionalString;
inherit (lib) concatMapStringsSep escapeShellArgs importJSON flatten unique optionalString warn;

expandDependencies = packages:
let
Expand All @@ -23,7 +24,7 @@ let
else
ln -snf $psrc $REPO/${pkg.ename}
fi
${optionalString (pkg.src.meta ? homepage) ''
${optionalString ((pkg.src ? meta) && (pkg.src.meta ? homepage)) ''
if [[ ! -d $REPO/${baseNameOf pkg.src.meta.homepage} ]]; then
ln -snf $psrc $REPO/${baseNameOf pkg.src.meta.homepage}
fi
Expand All @@ -39,11 +40,12 @@ let
list = importJSON json;
in map (x:
if epkgs ? "${x}" then epkgs.${x}
else (trace "XXX no attribute found for use-package ${x}") null) list;
else if abortOnNotFound then abort "Package not available: ${x}"
else (warn "Package not available: ${x}") null) list;

packagesJSON = { emacsInitFile, emacsLoadFiles, emacsArgs }: stdenv.mkDerivation {
name = "emacs-straight-packages.json";
buildInputs = [ epkgs.emacs ];
buildInputs = [ emacs ];
buildPhase = ":";
installPhase = ''
runHook preInstall
Expand All @@ -61,7 +63,7 @@ let
emacsEnv = { emacsInitFile, emacsLoadFiles, emacsArgs }: { packages, straightDir }: stdenv.mkDerivation {
name = "straight-emacs-env";
buildPhase = ":";
buildInputs = [ epkgs.emacs ];
buildInputs = [ emacs ];
installPhase = ''
runHook preInstall
Expand Down
6 changes: 5 additions & 1 deletion setup.el
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,15 @@
(let ((pkg (if (listp recipe)
(car recipe)
recipe)))
(message "straight-use-package %s %s; pkg=%s" recipe r pkg)
(message "straight-use-package %s %s" recipe r)
(add-to-list 'nix-straight--packages pkg))))
(advice-add 'straight-recipes-retrieve
:override (lambda (pkg)
(list)))
(advice-add 'straight-use-recipes
:override (lambda (&rest r)
(message "straight-use-recipes %s" r)
))

(load init-file nil nil t)
(princ (if (null nix-straight--packages)
Expand Down

0 comments on commit ed6b14f

Please sign in to comment.