From 69898664d42f74c305eb81bb10f1171cdef7c5da Mon Sep 17 00:00:00 2001 From: Lillian-Violet Date: Tue, 27 Feb 2024 15:42:27 +0100 Subject: [PATCH] Add new script for install (untested) --- pkgs/default.nix | 1 + pkgs/install-nix/default.nix | 31 +++++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 pkgs/install-nix/default.nix diff --git a/pkgs/default.nix b/pkgs/default.nix index 7569bfa..fce0284 100644 --- a/pkgs/default.nix +++ b/pkgs/default.nix @@ -5,4 +5,5 @@ pkgs: { dvt = pkgs.callPackage ./dvt {}; servo = pkgs.callPackage ./servo {}; rebuild = pkgs.callPackage ./rebuild {}; + install-nix = pkgs.callPackage ./install-nix {}; } diff --git a/pkgs/install-nix/default.nix b/pkgs/install-nix/default.nix new file mode 100644 index 0000000..d921918 --- /dev/null +++ b/pkgs/install-nix/default.nix @@ -0,0 +1,31 @@ +{ + lib, + stdenv, + writeShellApplication, +}: +writeShellApplication +{ + name = "install-nix"; + + runtimeInputs = []; + + text = '' + # An install script for NixOS installation to /tmp + set -e + hostname=$1 + if [[ "$1" == "" ]]; then + echo "No hostname given, please specify a hostname" + exit 2 + fi + pushd /tmp + git clone https://git.lillianviolet.dev/Lillian-Violet/NixOS-Config.git ./install + pushd ./install + echo "NixOS Installing..." + sudo nixos-install --flake .#$1 + popd + echo "Cleaning up repository in tmp..." + rm -rf ./install + popd + notify-send -e "NixOS Install Succeeded!" --icon=software-update-available + ''; +}