refactor basic tools a bit
This commit is contained in:
parent
f3ef2e058c
commit
fc21e3a1b2
4 changed files with 85 additions and 49 deletions
36
modules/basic-tools/nix.nix
Normal file
36
modules/basic-tools/nix.nix
Normal file
|
@ -0,0 +1,36 @@
|
|||
{ lib, pkgs, inputs, ... }: {
|
||||
|
||||
nix = {
|
||||
extraOptions = ''
|
||||
experimental-features = nix-command flakes
|
||||
'';
|
||||
};
|
||||
|
||||
# override default nix shell nixpkgs# behaviour to use current flake lock
|
||||
nix.registry =
|
||||
let flakes = lib.filterAttrs (_name: value: value ? outputs) inputs.self.inputs;
|
||||
in builtins.mapAttrs (_name: v: { flake = v; }) flakes;
|
||||
|
||||
nix.nixPath = lib.mapAttrsToList (name: value: "${name}=${value.outPath}") inputs.self.inputs;
|
||||
|
||||
environment.shellAliases = {
|
||||
nix-build="${pkgs.nix-output-monitor}/bin/nom-build";
|
||||
nix-shell="${pkgs.nix-output-monitor}/bin/nom-shell";
|
||||
};
|
||||
|
||||
programs.zsh.interactiveShellInit = ''
|
||||
# hacky wrapper for nix, so we can use nom automagically
|
||||
export _nom_cmd=${pkgs.nix-output-monitor}/bin/nom
|
||||
function nix {
|
||||
case $1 in
|
||||
build|shell|develop)
|
||||
echo \[SUBSTITUTION\] ''$_nom_cmd ''${@:1} 1>&2
|
||||
''$_nom_cmd ''${@:1}
|
||||
;;
|
||||
*)
|
||||
${pkgs.nix}/bin/nix $@
|
||||
esac
|
||||
}
|
||||
compdef nix=_nix
|
||||
'';
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue