diff --git a/README.md b/README.md index 1e133190..1bb51cd7 100644 --- a/README.md +++ b/README.md @@ -93,7 +93,7 @@ this flake to the inputs and define your hosts and users in the `flake.nix`: inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-22.05"; - nixcfg.url = "github:christianharke/nixcfg"; + nixcfg.url = "github:rake5k/nixcfg"; }; outputs = { nixpkgs, nixcfg, ... } @ inputs: @@ -134,7 +134,7 @@ sudo su # become root mkdir -p ~/.config/nix echo "experimental-features = nix-command flakes" > ~/.config/nix/nix.conf -nix run github:christianharke/nixcfg#nixos-install -- +nix run github:rake5k/nixcfg#nixos-install -- github:rake5k/nixcfg-home ``` Where: @@ -155,7 +155,7 @@ After rebooting proceed with the [next section](#nixos-config-setup). #### NixOS config setup ```bash -$ sudo nix run github:christianharke/nixcfg#setup +$ sudo nix run github:rake5k/nixcfg#setup ``` ### Non-NixOS @@ -174,7 +174,7 @@ sh <(curl -L https://nixos.org/nix/install) --no-channel-add --no-modify-profile ```bash # Set up this Nix configuration -nix run github:christianharke/nixcfg#setup +nix run github:rake5k/nixcfg#setup # set login shell chsh -s /bin/zsh @@ -234,10 +234,10 @@ $ # On non-NixOS $ hm-switch ``` -[ci]: https://github.com/christianharke/nixcfg/actions/workflows/ci.yml -[ci-badge]: https://github.com/christianharke/nixcfg/actions/workflows/ci.yml/badge.svg -[update]: https://github.com/christianharke/nixcfg/actions/workflows/update.yml -[update-badge]: https://github.com/christianharke/nixcfg/actions/workflows/update.yml/badge.svg +[ci]: https://github.com/rake5k/nixcfg/actions/workflows/ci.yml +[ci-badge]: https://github.com/rake5k/nixcfg/actions/workflows/ci.yml/badge.svg +[update]: https://github.com/rake5k/nixcfg/actions/workflows/update.yml +[update-badge]: https://github.com/rake5k/nixcfg/actions/workflows/update.yml/badge.svg [age]: https://age-encryption.org/ [agenix]: https://github.com/ryantm/agenix diff --git a/flake/apps/nixos-install.sh b/flake/apps/nixos-install.sh index 5cc0c2e4..6fe0982c 100644 --- a/flake/apps/nixos-install.sh +++ b/flake/apps/nixos-install.sh @@ -7,6 +7,7 @@ source @bashLib@ readonly HOSTNAME="${1}" readonly DISK="${2}" +readonly FLAKE="${3}" # Validate arguments @@ -49,7 +50,7 @@ readonly ROOT_PARTITION ### Declare functions readonly ROOT_CRYPT="root-crypt" -readonly BOOT_FS="boot" +readonly BOOT_FS="BOOT" readonly ROOT_FS="root" readonly MOUNT_ROOT="/mnt" @@ -118,20 +119,19 @@ enable_swap() { local swap_dir="${MOUNT_ROOT}/swap" local swap_file="${swap_dir}/swapfile" - _log "[create_filesystems] Creating swap file..." - touch "${swap_file}" - chattr +C "${swap_file}" - dd if=/dev/zero of="${swap_file}" bs=1M count=4096 - chmod 0600 "${swap_file}" - mkswap "${swap_file}" + _log "[enable_swap] Creating swap file..." + btrfs filesystem mkswapfile --size 4G "${swap_file}" _log "[enable_swap] Enabling swap..." - swapon -v "${swap_file}" + swapon "${swap_file}" + + _log "[enable_swap] Enabled swaps:" + cat /proc/swaps } install() { _log "[install] Installing NixOS..." - nixos-install --root "${MOUNT_ROOT}" --flake "github:christianharke/nixcfg#${HOSTNAME}" --impure + nixos-install --root "${MOUNT_ROOT}" --flake "${FLAKE}#${HOSTNAME}" --impure _log "[install] Installing NixOS... finished!" _log "[install] Installation finished, please reboot and remove installation media..." @@ -148,7 +148,7 @@ fi CRYPT_VOL_STATUS="$(cryptsetup -q status "${ROOT_CRYPT}")" readonly CRYPT_VOL_STATUS -CRYPT_VOL_NUM_ACTIVE=$(echo "${CRYPT_VOL_STATUS}" | grep "^/dev/mapper/${ROOT_CRYPT} is active and is in use.$" -c) +CRYPT_VOL_NUM_ACTIVE=$(echo "${CRYPT_VOL_STATUS}" | grep "^/dev/mapper/${ROOT_CRYPT} is active.$" -c) readonly CRYPT_VOL_NUM_ACTIVE if [[ ${CRYPT_VOL_NUM_ACTIVE} -lt 1 ]]; then decrypt_volumes