diff --git a/overlays/testing.nix b/overlays/testing.nix index 7fe8f0ef..e70c5287 100644 --- a/overlays/testing.nix +++ b/overlays/testing.nix @@ -9,7 +9,9 @@ let haskellBody = name: commandline: '' main = do (configDir:hostname:args) <- getArgs - paths <- myNixPath $ toText configDir + (decodeUtf8 -> homeManagerChannel) <- nix_instantiate "--eval" "-E" ([i|(import ./channels.nix).#{hostname}.home-manager-channel)|] :: String) |> captureTrim + (decodeUtf8 -> nixpkgsChannel) <- nix_instantiate "--eval" "-E" ([i|(import ./channels.nix).#{hostname}.nixpkgs-channel)|] :: String) |> captureTrim + paths <- aNixPath homeManagerChannel nixpkgsChannel (toText configDir) logFile <- mktemp |> captureTrim let command = (${commandline}) &!> StdOut &> Append logFile failHandler = do diff --git a/overlays/writeHaskellScript.nix b/overlays/writeHaskellScript.nix index e75d1d9d..75444569 100644 --- a/overlays/writeHaskellScript.nix +++ b/overlays/writeHaskellScript.nix @@ -50,14 +50,18 @@ self: super: { escaped <- nix_instantiate ["--eval" :: String, "-E", [i|toString #{expression}|]] |> captureTrim pure . Text.dropAround ('"' ==) . decodeUtf8 . trim $ escaped - myNixPath :: Text -> IO [String] - myNixPath path = concat <$> mapM getNivAssign [("home-manager", "${self.home-manager-channel}"), - ("nixpkgs", "${self.nixpkgs-channel}"), - ("nixos-unstable", "nixos-unstable")] + aNixPath :: Text -> Text -> Text -> IO [String] + aNixPath homeManagerChannel nixpkgsChannel path = concat <$> mapM getNivAssign + [("home-manager", homeManagerChannel), + ("nixpkgs", nixpkgsChannel), + ("nixos-unstable", "nixos-unstable")] where tag name str = ["-I", [i|#{name :: Text}=#{str :: Text}|]] :: [String] getNivAssign (name, repo) = tag name <$> getNivPath path repo + myNixPath :: Text -> IO [String] + myNixPath = aNixPath "${self.home-manager-channel}" "${self.nixpkgs-channel}" + buildSystemParams :: [String] buildSystemParams = ["", "-A", "system"]