From b09dac1b6abac8b4951f57ebea81223689582963 Mon Sep 17 00:00:00 2001 From: foglar Date: Wed, 1 Jan 2025 21:26:43 +0100 Subject: [PATCH] test --- flake.nix | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/flake.nix b/flake.nix index fb36432..90e8f5f 100644 --- a/flake.nix +++ b/flake.nix @@ -176,8 +176,33 @@ name = "install"; runtimeInputs = with pkgs; [git busybox gum]; text = '' - chmod +x ${./install.sh} - ${./install.sh} "$@" + #!/bin/sh + + echo "Running script" + + if [ $# -gt 0 ]; then + SCRIPT_DIR=$1 + else + SCRIPT_DIR=~/.dotfiles + fi + + nix-shell -p git --command "git clone https://git.foglar.tech/foglar/dotfiles.git $SCRIPT_DIR" + sudo nixos-generate-config --show-hardware-config >$SCRIPT_DIR/kogami/hardware-configuration.nix + sudo nixos-generate-config --show-hardware-config >$SCRIPT_DIR/ginoza/hardware-configuration.nix + + sed -i "0,/shinya/s//$(whoami)/" $SCRIPT_DIR/flake.nix + + if [ -z $EDITOR ]; then + EDITOR=nano + fi + $EDITOR $SCRIPT_DIR/flake.nix + + profile=$(gum choose kogami ginoza) + sudo nixos-rebuild build --flake $SCRIPT_DIR#"${profile}" --update + + gum confirm "Do you want to switch to the new configuration?" && sudo nixos-rebuild switch --flake $SCRIPT_DIR#"${profile}" + gum confirm "Do you want to reboot now?" && systemctl reboot || echo "Please reboot later, to switch to the new configuration" + ''; }; });