1
0
Fork 0

Try fixing nixPath

This commit is contained in:
Malte Brandy 2020-12-07 04:12:07 +01:00
parent 09fc18233b
commit a5c4288b00
2 changed files with 11 additions and 5 deletions

View file

@ -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

View file

@ -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 = ["<nixpkgs/nixos>", "-A", "system"]