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 = [ ]; boot.extraModulePackages = [ ];
fileSystems."/" = fileSystems."/" =
{ device = "/dev/disk/by-uuid/8b1fe87c-42d3-40b1-bceb-fc9e2dc83fb6"; { device = "/dev/disk/by-uuid/68bcbb81-34dd-4661-82ba-1ff2ef048e2d";
fsType = "btrfs"; fsType = "f2fs";
options = [ "subvol=@nixos" ];
}; };
boot.initrd.luks.devices."cryptnixos".device = "/dev/disk/by-uuid/51c780b4-cbdd-4ccb-9cc9-a8b2f17e9e64"; boot.initrd.luks.devices."cryptnixos".device = "/dev/disk/by-uuid/d287bbf7-ba7e-4316-8c68-072bb21dc8b1";
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" ];
};
fileSystems."/boot" = fileSystems."/boot" =
{ device = "/dev/disk/by-uuid/7294-A273"; { 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 #!/usr/bin/env bash
cd .. cd ..
CONFIG_FOLDER=$(pwd) CONFIG_FOLDER=$(pwd)
niv update nixpkgs
cd install cd install
ENCRYPT_ROOT=true 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 --type luks2 --cipher aes-xts-plain64 --key-size 256 --hash sha512 luksFormat $ROOT_PARTITION
cryptsetup luksOpen --type luks2 $ROOT_PARTITION $ROOT_NAME cryptsetup luksOpen --type luks2 $ROOT_PARTITION $ROOT_NAME
ROOT_NAME=/dev/mapper/$ROOT_NAME ROOT_NAME=/dev/mapper/$ROOT_NAME
mkfs.btrfs -f -L root $ROOT_NAME mkfs.f2fs -f -l root $ROOT_NAME
mount -t btrfs -o compress=zstd,noatime,ssd $ROOT_NAME /mnt mount $ROOT_NAME /mnt
else else
ROOT_NAME=$ROOT_PARTITION ROOT_NAME=$ROOT_PARTITION
mkfs.btrfs -f -L root $ROOT_PARTITION mkfs.f2fs -f -l root $ROOT_PARTITION
mount -t btrfs -o compress=zstd,noatime,ssd $ROOT_PARTITION /mnt mount $ROOT_PARTITION /mnt
fi 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 # Mount boot
mkdir /mnt/boot mkdir /mnt/boot
mount $BOOT_PARTITION /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 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 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" 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" read -p "Press enter to continue"
sed -i 's#nixos-config=/mnt/etc/nixos/#nixos-config=/etc/nixos/#' $CONFIG_FOLDER/modules/packages.nix sed -i 's#nixos-config=/mnt/etc/nixos/#nixos-config=/etc/nixos/#' $CONFIG_FOLDER/modules/packages.nix
mkdir -p /mnt/home/alukard/nixos-config 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
steam-run steam-run
protontricks protontricks
lutris
# retroarch # retroarch
] ++ lib.optionals (enableDocker) [ ] ++ lib.optionals (enableVirtualisation) [
docker-compose docker-compose
]; ];

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

@ -19,7 +19,7 @@ with types; {
cpu = devInfo.cpu.vendor; cpu = devInfo.cpu.vendor;
video = devInfo.video; video = devInfo.video;
isSSD = devInfo.drive.type == "ssd"; isSSD = devInfo.drive.type == "ssd";
enableDocker = devInfo.enableDocker; enableVirtualisation = devInfo.enableVirtualisation;
hostName = if !isNull devInfo.hostName then hostName = if !isNull devInfo.hostName then
devInfo.hostName devInfo.hostName
else else
@ -40,25 +40,9 @@ with types; {
video = "amd"; video = "amd";
ram = 16; ram = 16;
isShared = false; isShared = false;
enableDocker = true; enableVirtualisation = true;
hostName = "ataraxia-pc"; 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 = { Dell-Laptop = {
cpu = { cpu = {
vendor = "intel"; vendor = "intel";
@ -72,7 +56,7 @@ with types; {
video = "intel"; video = "intel";
ram = 8; ram = 8;
isShared = false; isShared = false;
enableDocker = true; enableVirtualisation = true;
hostName = "dell-ataraxia"; hostName = "dell-ataraxia";
}; };
NixOS-VM = { NixOS-VM = {
@ -88,7 +72,7 @@ with types; {
video = "virtualbox"; video = "virtualbox";
ram = 4; ram = 4;
isShared = false; isShared = false;
enableDocker = false; enableVirtualisation = false;
hostName = null; hostName = null;
}; };
}; };

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

@ -4,31 +4,6 @@ with rec {
}; };
with deviceSpecific; { with deviceSpecific; {
fileSystems = { 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 { "/shared/nixos" = lib.mkIf isVM {
fsType = "vboxsf"; fsType = "vboxsf";
device = "shared"; device = "shared";

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

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