haskell.nix/hix/default.nix
Hamish Mackenzie d5d304d5b5
Flakify all inputs (#1180)
* Include dependencies of haskell.nix that were tracked in `nix/sources.json`
  as flake inputs (`flake.lock` replaces `nix/sources.json`).
* Use `flake-compat` to continue to provide a compatible interface for non
  flake projects.

Co-authored-by: Alexander Bantyev <balsoft@balsoft.ru>
Co-authored-by: Shea Levy <shea@shealevy.com>
2021-08-06 15:54:39 +12:00

44 lines
1.2 KiB
Nix

{ pkgs }:
let
args = '' --arg userDefaults "$HOME/.config/hix/hix.conf" --arg src ./.'';
# Use HIX_ROOT to override the version of hix used when developing new hix features.
# See docs/dev/hix.md for details.
hixProject = "\${HIX_ROOT:-${./..}}/hix/project.nix";
in pkgs.symlinkJoin {
name = "hix";
paths = [
(pkgs.writeScriptBin "hix-shell" ''
nix-shell ${hixProject} ${args} -A shell "$@"
'')
(pkgs.writeScriptBin "hix-build" ''
nix-build ${hixProject} ${args} "$@"
'')
(pkgs.writeScriptBin "hix-instantiate" ''
nix-instantiate ${hixProject} ${args} "$@"
'')
(pkgs.writeScriptBin "hix-env" ''
nix-env -f ${hixProject} ${args} "$@"
'')
(pkgs.writeScriptBin "hix" ''
cmd=$1
shift
case $cmd in
update)
nix-env -iA hix -f https://github.com/input-output-hk/haskell.nix/tarball/master
;;
build|dump-path|eval|log|path-info|run|search|show-derivation|sign-paths|verify|why-depends)
nix $cmd -f ${hixProject} ${args} "$@"
;;
repl)
nix $cmd ${hixProject} ${args} "$@"
;;
*)
nix $cmd "$@"
;;
esac
'')
];
} // {
project = import ./project.nix;
}