I feel a little stupid now, instead of overriding the actual coreutils package, I could just make make build my own, and adding it in environment.systemPackages
did the trick.
this would cause everything to be rebuild:
nixpkgs = {
# You can add overlays here
overlays = [
(final: prev: {
coreutils = prev.coreutils.overrideAttrs (oldAttrs: rec {
postInstall = ''
mv $out/bin/rm $out/bin/rm.bak
ln -s ${pkgs.unstable.rmtrash}/bin/rmtrash $out/bin/rm
'';
});
})
];
};
so instead, this worked:
nixpkgs = {
# You can add overlays here
overlays = [
(final: prev: {
myCoreutils = prev.coreutils.overrideAttrs (oldAttrs: rec {
postInstall = ''
mv $out/bin/rm $out/bin/rm.bak
ln -s ${pkgs.unstable.rmtrash}/bin/rmtrash $out/bin/rm
'';
});
})
];
};
environment.systemPackages = with pkgs; [
myCoreutils
];
But this is better, to just copy the output of coreutils and not need to rebuild it:
nixpkgs = {
# You can add overlays here
overlays = [
(final: prev: {
myCoreutils = pkgs.symlinkJoin {
name = "coreutils-wrapped";
paths = [ pkgs.coreutils ];
nativeBuildInputs = [ ];
postBuild = ''
rm $out/bin/rm
ln -s ${pkgs.rmtrash}/bin/rmtrash $out/bin/rm
'';
};
})
];
};
environment.systemPackages = with pkgs; [
myCoreutils
];