add install script

This commit is contained in:
Dmitriy 2019-09-13 02:35:38 +04:00
parent 9cd36ccfd6
commit 75ec69587a
2 changed files with 75 additions and 0 deletions

28
install/install.sh Normal file
View File

@ -0,0 +1,28 @@
#!/usr/bin/env bash
BOOT_PARTITION=/dev/sda1
SWAP_PARTITION=/dev/sda2
ROOT_PARTITION=$ROOT_PARTITION
gdisk /dev/sda
mkfs.vfat -n BOOT $BOOT_PARTITION
mkfs.btrfs -L root $ROOT_PARTITION
mkswap -L swap $SWAP_PARTITION
mount -t btrfs $ROOT_PARTITION /mnt/
btrfs subvolume create /mnt/nixos
umount /mnt/
mount -t btrfs -o subvol=nixos,compress=zstd,noatime,discard,ssd $ROOT_PARTITION /mnt/
btrfs subvolume create /mnt/var
btrfs subvolume create /mnt/home
btrfs subvolume create /mnt/tmp
mkdir /mnt/boot
mount $BOOT_PARTITION /mnt/boot/
nixos-generate-config --root /mnt/
cp ./min-config.nix /mnt/etc/nixos/configuration.nix
nano /mnt/etc/nixos/configuration.nix
nixos-install -I nixpkgs=https://github.com/NixOS/nixpkgs-channels/archive/nixos-unstable.tar.gz

47
install/min-config.nix Normal file
View File

@ -0,0 +1,47 @@
{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
];
# Use the systemd-boot EFI boot loader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
fileSystems = {
"/" = {
options = [ "noatime" "ssd" "discard" "compress=zstd" ];
};
};
swapDevices = [
{ label = "swap"; }
];
networking = {
hostName = "nixos";
firewall.enable = false;
};
i18n = {
consoleFont = "Lat2-Terminus16";
consoleKeyMap = "us";
defaultLocale = "en_US.UTF-8";
};
time.timeZone = "Europe/Volgograd";
environment.systemPackages = with pkgs; [
wget vim git
];
users.users.alukard = {
isNormalUser = true;
extraGroups = [ "wheel" ];
};
system.stateVersion = "19.03";
}