Move to git

This commit is contained in:
Greg Hellings
2023-06-28 23:53:07 -05:00
parent 9e5ad5ffc6
commit 8be2f7c698
+8 -4
View File
@@ -1,4 +1,8 @@
{ pkgs, ... }:
{
pkgs,
git,
...
}:
pkgs.writeShellScriptBin "inject-nixos-config" ''
hostname="''${1}"
@@ -7,10 +11,9 @@ if [ -n "''${hostname}"]; then
exit 1;
fi
${pkgs.curl}/bin/curl -L -o "''${HOME}/nixos-config.tar.gz" https://github.com/greg-hellings/nixos-config/archive/refs/heads/main.tar.gz
${pkgs.gnutar}/bin/tar xaf "''${HOME}/nixos-config.tar.gz" -C "''${HOME}"
mv /etc/nixos /etc/nixos.bk
mv "''${HOME}/nixos-config-main/" /etc/nixos
cd /etc
${git}/bin/git clone http://github.com/greg-hellings/nixos-config nixos
mkdir -p "/etc/nixos/hosts/''${hostname}"
# Prepares everything for the flake usage
@@ -19,6 +22,7 @@ cp /etc/nixos.bk/hardware-configuration.nix "/etc/nixos/hosts/''${hostname}/hard
# Prepares it for injecting the use case into the flake usage
cp /etc/nixos.bk/hardware-configuration.nix /etc/nixos
chown -R greg nixos
echo "Now you should be able to just run 'nixos-rebuild switch' to enable the flake functionality"
echo "After that and adding the entry to the flake, run 'nixos-rebuild boot --flake '.#''${hostname}' and reboot"