1
0
Fork 0

Introduce quickbuild

This commit is contained in:
Malte Brandy 2020-10-11 15:03:01 +02:00
parent 29a3d5ada9
commit 93f0bdc025
No known key found for this signature in database
GPG key ID: 226A2D41EF5378C9
2 changed files with 18 additions and 4 deletions

View file

@ -36,7 +36,7 @@ in {
'';
updateModes = pkgs.writeHaskellScript {
name = "update-modes";
bins = [ activateMode pkgs.git ];
bins = [ activateMode pkgs.git pkgs.nix-output-monitor ];
} ''
params = ["${configPath}/home-manager/target.nix", "-A", "apollo", "-o", "/home/maralorn/.modes"]
privatePath = "${configPath}/private"
@ -46,10 +46,24 @@ in {
say "Building ~/.modes for apollo"
nixPath <- myNixPath "${configPath}"
bracket (rm canaryPath) (\() -> git "-C" privatePath "restore" canaryPath) $ \() ->
nix_build nixPath (params ++ remoteBuildParams)
nix_build nixPath (params ++ remoteBuildParams) &!> StdOut |> nom
nix_build nixPath params
activate_mode
'';
quickUpdateMode = pkgs.writeHaskellScript {
name = "quick-update-mode";
bins = [ updateModes pkgs.git pkgs.home-manager pkgs.nix-output-monitor];
} ''
getMode :: IO Text
getMode = decodeUtf8 <$> (cat "/home/maralorn/volatile/mode" |> captureTrim)
main = do
nixPath <- myNixPath "${configPath}"
mode <- getMode
say [i|Quick switching to mode #{mode} ...|]
home_manager (nixPath <> ["switch", "-A", [i|apollo-#{mode}|]]) &!> StdOut |> nom
update_modes
'';
selectMode = pkgs.writeHaskellScript {
name = "select-mode";
bins = [ pkgs.dialog activateMode pkgs.ncurses ];

View file

@ -9,9 +9,9 @@ let
confAttr = attr;
}).activationPackage;
in lib.mapAttrs (host: configs:
pkgs.runCommand "${host}-modes" { } ''
(pkgs.runCommand "${host}-modes" { } ''
mkdir $out
${lib.concatStringsSep "\n" (lib.mapAttrsToList
(mode: config: "ln -s ${buildHomeManager "${host}-${mode}"} $out/${mode}")
configs)}
'') modes
'').overrideAttrs (_: { preferLocalBuild = true; })) modes