This commit is contained in:
Dmitriy Holkin 2020-03-22 01:07:54 +04:00
parent 96dd281875
commit 843d541ab5
6 changed files with 23 additions and 97 deletions

25
hardware-configuration/Dell-Laptop.nix Normal file → Executable file
View File

@ -14,30 +14,11 @@
boot.extraModulePackages = [ ];
fileSystems."/" =
{ device = "/dev/disk/by-uuid/8b1fe87c-42d3-40b1-bceb-fc9e2dc83fb6";
fsType = "btrfs";
options = [ "subvol=@nixos" ];
{ device = "/dev/disk/by-uuid/68bcbb81-34dd-4661-82ba-1ff2ef048e2d";
fsType = "f2fs";
};
boot.initrd.luks.devices."cryptnixos".device = "/dev/disk/by-uuid/51c780b4-cbdd-4ccb-9cc9-a8b2f17e9e64";
fileSystems."/.snapshots" =
{ device = "/dev/disk/by-uuid/8b1fe87c-42d3-40b1-bceb-fc9e2dc83fb6";
fsType = "btrfs";
options = [ "subvol=@snapshots" ];
};
fileSystems."/home" =
{ device = "/dev/disk/by-uuid/8b1fe87c-42d3-40b1-bceb-fc9e2dc83fb6";
fsType = "btrfs";
options = [ "subvol=@home" ];
};
fileSystems."/nix/store" =
{ device = "/dev/disk/by-uuid/8b1fe87c-42d3-40b1-bceb-fc9e2dc83fb6";
fsType = "btrfs";
options = [ "subvol=@nix-store" ];
};
boot.initrd.luks.devices."cryptnixos".device = "/dev/disk/by-uuid/d287bbf7-ba7e-4316-8c68-072bb21dc8b1";
fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/7294-A273";

25
install/install.sh Normal file → Executable file
View File

@ -1,7 +1,6 @@
#!/usr/bin/env bash
cd ..
CONFIG_FOLDER=$(pwd)
niv update nixpkgs
cd install
ENCRYPT_ROOT=true
@ -26,27 +25,13 @@ if [[ "$ENCRYPT_ROOT" == true ]]; then
cryptsetup --type luks2 --cipher aes-xts-plain64 --key-size 256 --hash sha512 luksFormat $ROOT_PARTITION
cryptsetup luksOpen --type luks2 $ROOT_PARTITION $ROOT_NAME
ROOT_NAME=/dev/mapper/$ROOT_NAME
mkfs.btrfs -f -L root $ROOT_NAME
mount -t btrfs -o compress=zstd,noatime,ssd $ROOT_NAME /mnt
mkfs.f2fs -f -l root $ROOT_NAME
mount $ROOT_NAME /mnt
else
ROOT_NAME=$ROOT_PARTITION
mkfs.btrfs -f -L root $ROOT_PARTITION
mount -t btrfs -o compress=zstd,noatime,ssd $ROOT_PARTITION /mnt
mkfs.f2fs -f -l root $ROOT_PARTITION
mount $ROOT_PARTITION /mnt
fi
btrfs subvolume create /mnt/@nixos
btrfs subvolume create /mnt/@nix-store
btrfs subvolume create /mnt/@home
btrfs subvolume create /mnt/@snapshots
umount /mnt
mount -t btrfs -o subvol=@nixos,compress=zstd,noatime,ssd $ROOT_NAME /mnt/
mkdir -p /mnt/.snapshots
mkdir -p /mnt/home
mkdir -p /mnt/nix/store
mount -t btrfs -o subvol=@snapshots,compress=zstd,noatime,ssd $ROOT_NAME /mnt/.snapshots
mount -t btrfs -o subvol=@home,compress=zstd,noatime,ssd $ROOT_NAME /mnt/home
mount -t btrfs -o subvol=@nix-store,compress=zstd,noatime,ssd $ROOT_NAME /mnt/nix/store
btrfs subvolume create /mnt/tmp
btrfs subvolume create /mnt/var
# Mount boot
mkdir /mnt/boot
mount $BOOT_PARTITION /mnt/boot
@ -58,7 +43,7 @@ cp /mnt/etc/nixos/hardware-configuration.nix $CONFIG_FOLDER/hardware-configurati
echo "import $CONFIG_FOLDER \"$DEVICE_NAME\"" > /mnt/etc/nixos/configuration.nix
sed -i 's#nixos-config=/etc/nixos/#nixos-config=/mnt/etc/nixos/#' $CONFIG_FOLDER/modules/packages.nix
read -p "Please, add swap device into nixos-config/modules/filesystems.nix before continue"
nixos-install -I nixpkgs=https://github.com/NixOS/nixpkgs-channels/archive/nixos-unstable.tar.gz --max-jobs $MAX_JOBS --no-root-passwd
nixos-install -I nixpkgs=https://github.com/NixOS/nixpkgs-channels/archive/d96bd3394b734487d1c3bfbac0e8f17465e03afe.tar.gz --max-jobs $MAX_JOBS --no-root-passwd
read -p "Press enter to continue"
sed -i 's#nixos-config=/mnt/etc/nixos/#nixos-config=/etc/nixos/#' $CONFIG_FOLDER/modules/packages.nix
mkdir -p /mnt/home/alukard/nixos-config

3
modules/applications/packages.nix Normal file → Executable file
View File

@ -101,8 +101,9 @@ in {
steam
steam-run
protontricks
lutris
# retroarch
] ++ lib.optionals (enableDocker) [
] ++ lib.optionals (enableVirtualisation) [
docker-compose
];

24
modules/devices.nix Normal file → Executable file
View File

@ -19,7 +19,7 @@ with types; {
cpu = devInfo.cpu.vendor;
video = devInfo.video;
isSSD = devInfo.drive.type == "ssd";
enableDocker = devInfo.enableDocker;
enableVirtualisation = devInfo.enableVirtualisation;
hostName = if !isNull devInfo.hostName then
devInfo.hostName
else
@ -40,25 +40,9 @@ with types; {
video = "amd";
ram = 16;
isShared = false;
enableDocker = true;
enableVirtualisation = true;
hostName = "ataraxia-pc";
};
PackardBell-Laptop = {
cpu = {
vendor = "intel";
clock = 2500;
cores = 2;
};
drive = {
type = "hdd";
size = 500;
};
video = "nvidia";
ram = 6;
isShared = true;
enableDocker = false;
hostName = null;
};
Dell-Laptop = {
cpu = {
vendor = "intel";
@ -72,7 +56,7 @@ with types; {
video = "intel";
ram = 8;
isShared = false;
enableDocker = true;
enableVirtualisation = true;
hostName = "dell-ataraxia";
};
NixOS-VM = {
@ -88,7 +72,7 @@ with types; {
video = "virtualbox";
ram = 4;
isShared = false;
enableDocker = false;
enableVirtualisation = false;
hostName = null;
};
};

27
modules/filesystems.nix Normal file → Executable file
View File

@ -4,31 +4,6 @@ with rec {
};
with deviceSpecific; {
fileSystems = {
"/" = {
options = if isSSD then
[ "ssd" "noatime" "compress=zstd" ]
else
[ "noatime" "compress=zstd" ];
};
"/.snapshots" = {
options = if isSSD then
[ "ssd" "noatime" "compress=zstd" ]
else
[ "noatime" "compress=zstd" ];
};
"/home" = {
options = if isSSD then
[ "ssd" "noatime" "compress=zstd" ]
else
[ "noatime" "compress=zstd" ];
};
"/nix/store" = {
options = if isSSD then
[ "ssd" "noatime" "compress=zstd" ]
else
[ "noatime" "compress=zstd" ];
};
"/shared/nixos" = lib.mkIf isVM {
fsType = "vboxsf";
device = "shared";
@ -128,4 +103,4 @@ with deviceSpecific; {
randomEncryption.enable = true;
}
];
}
}

16
modules/services.nix Normal file → Executable file
View File

@ -5,10 +5,10 @@ in {
services.acpid.enable = true;
services.btrfs.autoScrub = {
enable = true;
interval = "weekly";
};
# services.btrfs.autoScrub = {
# enable = true;
# interval = "weekly";
# };
services.redshift = {
enable = true;
@ -48,12 +48,12 @@ in {
services.gnome3.gnome-keyring.enable = true;
virtualisation.docker.enable = device.enableDocker;
virtualisation.docker.enable = device.enableVirtualisation;
# virtualisation.virtualbox.host = lib.mkIf config.deviceSpecific.isHost {
# enable = true;
# virtualisation.virtualbox.host = {
# enable = device.enableVirtualisation;
# # enableHardening = false;
# enableExtensionPack = true;
# enableExtensionPack = false;
# };
# Install cdemu for some gaming purposes