Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion hix/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,16 @@ let
flake|build|develop|run|profile)
# Put the flake files for remote URLs in $HOME/.hix by default
HIX_DIR="''${HIX_DIR:-$HOME/.hix}"
HIX_TMPDIR="$(mktemp -d)"
projectArgs=""
while(($#)); do
arg=$1
case $arg in
--projectArgs)
projectArgs="$2"
args+=(--override-input projectArgs "$HIX_TMPDIR")
shift
;;
--out-link|-o|--eval-store|--include|-I|--inputs-from|--expr|--file|-f|--keep|-k|--phase|--profile|--unset|-u)
args+=("$arg" "$2")
shift
Expand Down Expand Up @@ -83,7 +90,7 @@ let
fi
# Make a temporary flake if we have not already
mkdir -p $FLAKE
HIX_FLAKE="$(mktemp -d)/flake.nix"
HIX_FLAKE="$HIX_TMPDIR/flake.nix"
sed 's|EVAL_SYSTEM|${pkgs.stdenv.hostPlatform.system}|' < ${hixProject}/flake.nix > $HIX_FLAKE
if ! cmp $HIX_FLAKE $FLAKE/flake.nix &>/dev/null; then
if [ -e $FLAKE/flake.lock ]; then
Expand All @@ -95,6 +102,9 @@ let
cp $HIX_FLAKE $FLAKE/flake.nix
chmod +w $FLAKE/flake.nix
fi
if [ "$projectArgs" != "" ]; then
printf %s "$projectArgs" > "$HIX_TMPDIR/projectArgs.nix"
fi
nix $cmd "''${args[@]}"
;;
init|init-hix)
Expand Down
1 change: 0 additions & 1 deletion hix/empty-set/default.nix

This file was deleted.

11 changes: 8 additions & 3 deletions hix/project/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,21 @@
inputs.haskellNix.url = "github:input-output-hk/haskell.nix";
inputs.nixpkgs.follows = "haskellNix/nixpkgs-unstable";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.projectArgs.url = "github:input-output-hk/empty-flake";
inputs.projectArgs.flake = false;
inputs.src.flake = false;
outputs = { self, src, nixpkgs, flake-utils, haskellNix }:
outputs = { self, src, nixpkgs, flake-utils, haskellNix, projectArgs }:
flake-utils.lib.eachSystem [ "EVAL_SYSTEM" ] (system:
let
overlays = [ haskellNix.overlay
(final: _prev: {
hixProject =
final.haskell-nix.hix.project {
final.haskell-nix.hix.project ({
inherit src;
};
} // (
if builtins.pathExists (projectArgs + "/projectArgs.nix")
then import (projectArgs + "/projectArgs.nix")
else {}));
})
];
pkgs = import nixpkgs { inherit system overlays; inherit (haskellNix) config; };
Expand Down
Loading