-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a non-overlay API for defining a config #183
Conversation
8f60d24
to
91b73c5
Compare
91b73c5
to
6cfc4a4
Compare
i've just moved to flake-parts, so i'm very interested in this :) how do you invisage overriding packages with this approach? (final. emacsTwist { }).overrideScope (
_: prev': {
elispPackages = prev'.elispPackages.overrideScope (
prev.callPackage ./package-overrides.nix { inherit (prev') emacs; }
);
}
); |
You can just call |
Oh... haha, okay, that makes sense - thank you! I tried taking this for a spin. I'm encountering a strange issue, though. Here are the relevant parts of my configuration. mkFlake call in flake.nixflake-parts.lib.mkFlake { inherit inputs; } {
imports = [ ez-configs.flakeModule ];
systems = nixpkgs.lib.systems.flakeExposed;
perSystem = { config, pkgs, system, emacs-env, ... }: {
_module.args.pkgs = import inputs.nixpkgs {
inherit system;
overlays = [
inputs.emacs-overlay.overlays.emacs
inputs.org-babel.overlays.default
];
config = { };
};
_module.args.emacs-env = import ./configurations/emacs {
inherit inputs pkgs;
};
packages = {
inherit emacs-env;
};
apps = emacs-env.makeApps {
lockDirName = "configurations/emacs/.lock";
};
};
ezConfigs = {
globalArgs = {
inherit inputs;
};
} // builtins.listToAttrs (map
(name: {
inherit name;
value = {
modulesDirectory = ./. + "/modules/${name}";
configurationsDirectory = ./. + "/configurations/${name}";
};
}) [ "home" "darwin" "nixos" ]);
} configurations/emacs/default.nixUsed in the above flake at `_module.args.emacs-env = import ./configurations/emacs ...`{ inputs, pkgs }:
let
inherit (pkgs) lib;
emacsPackage = pkgs.emacs-pgtk;
treeSitterLoadPath = lib.pipe pkgs.tree-sitter-grammars [
(lib.filterAttrs (name: _: name != "recurseForDerivations"))
builtins.attrValues
(map (drv: {
# Some grammars don't contain "tree-sitter-" as the prefix,
# so add it explicitly.
name = "libtree-sitter-${
lib.pipe (lib.getName drv) [
(lib.removeSuffix "-grammar")
(lib.removePrefix "tree-sitter-")
]
}${pkgs.stdenv.targetPlatform.extensions.sharedLibrary}";
path = "${drv}/parser";
}))
(pkgs.linkFarm "treesit-grammars")
];
in
(inputs.twist.lib.makeEnv {
inherit emacsPackage pkgs;
lockDir = ./.lock;
initFiles = [ (pkgs.tangleOrgBabelFile "init.el" ./README.org { }) ];
inputOverrides = import ./input-overrides.nix { inherit (pkgs) lib; };
extraSiteStartElisp = ''
(add-to-list 'treesit-extra-load-path "${treeSitterLoadPath}/")
'';
registries = import ./registries.nix {
inherit inputs;
emacsSrc = emacsPackage.src;
};
}).overrideScope (
_: prev': {
elispPackages = prev'.elispPackages.overrideScope (
pkgs.callPackage ./package-overrides.nix { inherit (prev') emacs; }
);
}
) When trying to build my system derivation, I get the following error:
Which looks to be this line from twist.nix's build-support package. It's curious how the preceeding line is I wonder if I'm passing Would appreciate any help on this 🙏 But completely understand you're probably very busy with other endeavours :) |
@cmacrae elisp-helpers was updated a few days ago. You have to update |
Thank you, that got it working! I'm now no longer using any overlay and have moved to the home-manager module. It took me quite a bit of hacking around, but I understand now how the package loading works, via I'd love to contribute some documentation, though I see that you have some docs in progress and were contemplating a dedicated site. If you're open to the contribution, where would you prefer I record my findings? I feel like I've gained some useful context that could help others enjoy all the fantastic work you've done on this project!
Absoltutely no need for apologies :) I'm very aware that running code from a PR branch is not a place for expectations of stability |
This PR adds
lib.makeEnv
function which is a replacement for theemacsTwist
function provided via the overlay. The overlay won't be removed immediately, but it is deprecated.The rationale for this non-overlay API is to avoid pollution of pkgs and cleaner integration with flake-parts. A recommended usage with flake-parts is as follows: