Hello all,
Let’s say I want to create a very simple derivation, which has, as a dependency, a program that I’m using home-manager to configure:
let
pkgs = import <nixpkgs> {};
wrapper = { stdenv, writeShellScriptBin, bash, kakoune }:
writeShellScriptBin "wrapkak"
''
#! ${bash}/bin/bash
echo "stay calm this is a wrapper"
exec ${kakoune}/bin/kak $@
'';
in
with pkgs; callPackage wrapper {}
In this case, the home-manager-configured program is kakoune
. Unfortunately, when I build this thing, I discover that it’s using (quite understandably, since I’ve not told it not to) kakoune straight from nixpkgs, rather than from home-manager:
$ cat ~/.nix-profile/bin/wrapkak
#!/nix/store/wadmyilr414n7bimxysbny876i2vlm5r-bash-5.1-p8/bin/bash
#! /nix/store/wadmyilr414n7bimxysbny876i2vlm5r-bash-5.1-p8/bin/bash
echo "stay calm this is a wrapper"
exec /nix/store/5w0bb165sxp0k7ddbalh4ibz0xpirp3s-kakoune-2021.10.28/bin/kak $@
versus the home-manager-generated one:
$ ls -l $(which kak)
lrwxrwxrwx 1 root root 69 Jan 1 1970 /home/chris/.nix-profile/bin/kak -> /nix/store/s0crf1jwrv4ll5l78kxscq3lg7kyz38w-home-manager-path/bin/kak
I presume I need to make my derivation into an overlay and import it into home.nix
somehow, but I’m not quite clear how. There is eg this Example how to use newer version of a package configured by home-manager · Issue #1107 · nix-community/home-manager · GitHub, but it’s describing how to use an overlay to change inputs into home-manager, not how to apply an overlay to home-manager’s outputs.
Any help gratefully received.