Add devshell

This commit is contained in:
Greg Hellings
2023-06-28 23:10:07 -05:00
parent e3babb3ac8
commit 581d51382c
4 changed files with 18 additions and 0 deletions
+1
View File
@@ -73,6 +73,7 @@ in rec {
hms = prev.callPackage ./hms.nix {
pkgs = final.pkgs;
};
inject = prev.callPackage ./inject.nix { inherit (final) pkgs; };
setup-ssh = prev.callPackage ./setup-ssh.nix {
pkgs = final.pkgs;
};
+3
View File
@@ -0,0 +1,3 @@
{ pkgs, ... }:
pkgs.writeShellScriptBin "inject-nixos-config" (builtins.readFile ./inject.sh)
+24
View File
@@ -0,0 +1,24 @@
#!/usr/bin/env bash
hostname="${1}"
if [ -n "${hostname}"]; then
echo "You must provide a hostname";
exit 1;
fi
curl -L -o "${HOME}/nixos-config.tar.gz" https://github.com/greg-hellings/nixos-config/archive/refs/heads/main.tar.gz
tar xaf "${HOME}/nixos-config.tar.gz" -C "${HOME}"
sudo mv /etc/nixos /etc/nixos.bk
sudo mv "${HOME}/nixos-config-main/" /etc/nixos
mkdir -p "/etc/nixos/hosts/${hostname}"
# Prepares everything for the flake usage
cp /etc/nixos.bk/configuration.nix "/etc/nixos/hosts/${hostname}/default.nix"
cp /etc/nixos.bk/hardware-configuration.nix "/etc/nixos/hosts/${hostname}/hardware-configuration.nix"
# Prepares it for injecting the use case into the flake usage
cp /etc/nixos.bk/hardware-configuration.nix /etc/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"