aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorgramanas <anastasis.gramm2@gmail.com>2024-10-07 11:47:06 +0300
committergramanas <anastasis.gramm2@gmail.com>2024-10-07 11:47:06 +0300
commit4547e75868cba2a265b78661ddc386b5e81c1bb0 (patch)
tree71924feb573c8af5030080fc007eee7bfbaabb20 /scripts
downloadnix-master.tar.gz
nix-master.tar.bz2
nix-master.zip
Diffstat (limited to 'scripts')
-rw-r--r--scripts/disko.nix74
-rwxr-xr-xscripts/install.sh14
2 files changed, 88 insertions, 0 deletions
diff --git a/scripts/disko.nix b/scripts/disko.nix
new file mode 100644
index 0000000..6f2cc6f
--- /dev/null
+++ b/scripts/disko.nix
@@ -0,0 +1,74 @@
+{
+ disko.devices = {
+ nodev."/" = {
+ fsType = "tmpfs";
+ mountOptions = [
+ "defaults"
+ "size=16G"
+ "mode=755"
+ ];
+ };
+
+ disk.main = {
+ type = "disk";
+ device = "/dev/vda";
+
+ content = {
+ type = "gpt";
+ partitions = {
+ ESP = {
+ priority = 1;
+ size = "512M";
+ type = "EF00";
+ content = {
+ type = "filesystem";
+ format = "vfat";
+ mountpoint = "/boot";
+ mountOptions = [
+ "defaults"
+ ];
+ };
+ };
+
+ luks = {
+ size = "100%";
+ content = {
+ type = "luks";
+ name = "crypted";
+ settings = {
+ allowDiscards = true;
+ };
+ content = {
+ type = "btrfs";
+ extraArgs = ["-f"];
+ subvolumes = {
+ nix = {
+ mountpoint = "/nix";
+ mountOptions = ["compress=zstd" "noatime"];
+ };
+ persist = {
+ mountpoint = "/persist";
+ mountOptions = ["compress=zstd" "noatime"];
+ };
+ log = {
+ mountpoint = "/var/log";
+ mountOptions = ["compress=zstd" "noatime"];
+ };
+ tmp = {
+ mountpoint = "/tmp";
+ mountOptions = ["noatime"];
+ };
+ swap = {
+ mountpoint = "/swap";
+ mountOptions = ["noatime"];
+ swap.swapfile.size = "32G";
+ };
+ };
+ };
+ };
+ };
+ };
+ };
+ };
+ };
+}
diff --git a/scripts/install.sh b/scripts/install.sh
new file mode 100755
index 0000000..c809cc9
--- /dev/null
+++ b/scripts/install.sh
@@ -0,0 +1,14 @@
+#!/usr/bin/env bash
+
+sudo -i
+
+# Partitioning, formatting and mounting
+sudo nix --experimental-features "nix-command flakes" run github:nix-community/disko -- --mode zap_create_mount ./disko.nix
+
+# Installing
+nixos-install --flake https://github.com/cu1ch3n/nixbook#nixbook --no-root-passwd
+
+# Setting up password files
+mkdir -p /mnt/persist/passwordFiles
+mkpasswd -m SHA-512 -s > /mnt/persist/passwordFiles/root
+mkpasswd -m SHA-512 -s > /mnt/persist/passwordFiles/chen