Skip to content

Commit

Permalink
feat(lib/funk): WIP: setup in one step
Browse files Browse the repository at this point in the history
sudo nix run github:panchoh/nixos#nixos
  • Loading branch information
panchoh committed Feb 16, 2024
1 parent 6f9c55a commit 0d85363
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions lib/apps-disko-and-funk.nix
Original file line number Diff line number Diff line change
@@ -1,11 +1,28 @@
inputs:
builtins.foldl' (
acc: box: let
inherit (box) system hostName;
# FIXME: tied to system
inherit (inputs.nixpkgs.legacyPackages.x86_64-linux) pkgs;
inherit (inputs.nixpkgs.lib) getExe;
inherit (box) system hostName diskDevice;
flake = inputs.self.outPath;

entry = {
type = "app";
# TODO: run not only disko, but all steps, including blkdiscard -f box.diskDevice, nixos-install --...
program = "${inputs.self.nixosConfigurations."${hostName}".config.system.build.diskoScript}";
program = builtins.toString (getExe (pkgs.writeShellApplication {
name = "setup";
meta.mainProgram = "setup";
runtimeInputs = [pkgs.util-linux];
# bashOptions = ["errexit" "nounset" "pipefail" "xtrace"];
text = ''
echo blkdiscard -f "${diskDevice}"
echo ${inputs.self.nixosConfigurations."${hostName}".config.system.build.diskoScript}
echo nixos-install --verbose --no-root-password --no-channel-copy --flake github:panchoh/nixos#nixos
echo nixos-install --verbose --no-root-password --no-channel-copy --flake ${../.}#nixos
echo nixos-install --verbose --no-root-password --no-channel-copy --flake ${flake}#nixos
echo reboot
'';
}));
};
in
acc // {${system} = (acc.${system} or {}) // {${hostName} = entry;};}
Expand Down

0 comments on commit 0d85363

Please sign in to comment.