shell: add flk up command

Automatically generate a configuration for your current system using
nixos-generate-config, placed in the `up` directory. A file is added in
hosts/up-$(hostname).nix importing said configuration.
This commit is contained in:
Timothy DeHerrera 2021-01-11 13:15:55 -07:00
parent d0fe508da2
commit e33f53ff2e
No known key found for this signature in database
GPG Key ID: 8985725DB5B0C122
2 changed files with 11 additions and 7 deletions

View File

@ -104,12 +104,9 @@ for ease of use. Once inside:
# This will setup nix-command and pull in the needed tools # This will setup nix-command and pull in the needed tools
nix-shell # or `direnv allow` if you prefer nix-shell # or `direnv allow` if you prefer
# quick way to setup your fileSystems (assuming they are partioned): # use nixos-generate-config to generate a basic config for your system
sudo mount /dev/<install-drive> /mnt # edit hosts/up-$(hostname).nix to modify.
nixos-generate-config --root /mnt --show-hardware-config > hosts/yourConfig.nix flk up
# Edit your config to add a bootloader
$EDITOR hosts/yourConfig.nix
# The following should work fine for EFI systems. # The following should work fine for EFI systems.
# boot.loader.systemd-boot.enable = true; # boot.loader.systemd-boot.enable = true;

View File

@ -17,7 +17,14 @@ let
flk = pkgs.writeShellScriptBin "flk" '' flk = pkgs.writeShellScriptBin "flk" ''
if [[ -z "$1" ]]; then if [[ -z "$1" ]]; then
echo "Usage: $(basename "$0") [ iso | install {host} | {host} [switch|boot|test] ]" echo "Usage: $(basename "$0") [ iso | up | install {host} | {host} [switch|boot|test] ]"
elif [[ "$1" == "up" ]]; then
mkdir -p up
nixos-generate-config --dir up
echo \
"{
imports = [ ../up/configuration.nix ];
}" > hosts/up-$(hostname).nix
elif [[ "$1" == "iso" ]]; then elif [[ "$1" == "iso" ]]; then
nix build ${configs}.niximg.${build}.isoImage nix build ${configs}.niximg.${build}.isoImage
elif [[ "$1" == "install" ]]; then elif [[ "$1" == "install" ]]; then