1
0
Fork 0
nixos-config/overlays/testing.nix

35 lines
1.8 KiB
Nix
Raw Normal View History

2020-05-27 13:20:08 +00:00
self: super:
2019-07-25 21:35:59 +00:00
let
2020-05-27 13:20:08 +00:00
bins = [ self.nix ];
repoSrc = "git@hera.m-0.eu:nixos-config";
configPath = "/etc/nixos";
systems = [ "apollo" "hera" ];
2020-06-27 19:54:32 +00:00
homes = self.lib.attrNames (import ../home-manager/machines.nix);
2020-06-26 17:19:42 +00:00
imports = [ "Control.Exception (onException)" ];
2021-01-09 02:31:25 +00:00
haskellBody = name: drv: target: ''
2019-07-25 21:35:59 +00:00
main = do
2021-01-09 02:31:25 +00:00
(configDir:hostname:_) <- getArgs
2020-12-07 03:24:18 +00:00
(Text.dropAround ('"' ==) . decodeUtf8 . trim -> homeManagerChannel) <- nix_instantiate "--eval" "-E" ([i|(import #{configDir}/channels.nix).#{hostname}.home-manager-channel|] :: String) |> captureTrim
(Text.dropAround ('"' ==) . decodeUtf8 . trim -> nixpkgsChannel) <- nix_instantiate "--eval" "-E" ([i|(import #{configDir}/channels.nix).#{hostname}.nixpkgs-channel|] :: String) |> captureTrim
2020-12-07 03:12:07 +00:00
paths <- aNixPath homeManagerChannel nixpkgsChannel (toText configDir)
2021-01-07 03:45:37 +00:00
say [i|Trying to build ${name} config for #{hostname}.|]
2021-01-09 02:31:25 +00:00
(Text.dropAround ('"' ==) . decodeUtf8 . trim -> derivationName) <- (nix_instantiate $ ${drv}) |> captureTrim
exe "nix-jobs" ["realise", toString derivationName]
nix_store ["-r", toString derivationName, "--indirect", "--add-root", ${target}]
2020-05-17 20:23:27 +00:00
say [i|Build of ${name} config for #{hostname} was successful.|]
2019-07-31 21:56:52 +00:00
'';
2020-05-27 13:20:08 +00:00
in {
2019-07-25 21:35:59 +00:00
2020-05-27 13:20:08 +00:00
test-system-config = self.writeHaskellScript {
2019-07-25 21:35:59 +00:00
name = "test-system-config";
2019-07-28 22:51:10 +00:00
inherit bins;
2020-06-26 17:19:42 +00:00
inherit imports;
2021-01-09 02:31:25 +00:00
} (haskellBody "system" ''buildSystemParams ++ paths ++ ["-I", [i|nixos-config=#{configDir}/nixos/machines/#{hostname}/configuration.nix|]]'' "[i|result-system-#{hostname}|]");
2019-07-25 21:35:59 +00:00
2020-05-27 13:20:08 +00:00
test-home-config = self.writeHaskellScript {
2019-07-26 13:54:30 +00:00
name = "test-home-config";
2019-07-28 22:51:10 +00:00
inherit bins;
2020-06-26 17:19:42 +00:00
inherit imports;
2021-01-09 02:31:25 +00:00
} (haskellBody "home" ''paths ++ [[i|#{configDir}/home-manager/target.nix|], "-A", hostname]'' "[i|result-home-manager-#{hostname}|]");
2019-08-02 03:17:00 +00:00
}