about summary refs log tree commit diff
path: root/nix
diff options
context:
space:
mode:
authorNguyễn Gia Phong <mcsinyx@disroot.org>2021-11-07 13:47:02 +0700
committerNguyễn Gia Phong <mcsinyx@disroot.org>2021-11-07 20:17:10 +0700
commit557705fc88fc0405d8f79bb15cbf0679e168cf6c (patch)
tree69dcb97176f0e6d1b26554963239dca33a41f75b /nix
parentb078705298d983396fff6b673f3b7f93c5bac471 (diff)
downloaddotfiles-557705fc88fc0405d8f79bb15cbf0679e168cf6c.tar.gz
Migrate NixOS to tmpfs+btrfs
Diffstat (limited to 'nix')
-rw-r--r--nix/configuration.nix2
-rw-r--r--nix/devel.nix7
-rw-r--r--nix/games.nix2
-rw-r--r--nix/hardware-configuration.nix65
4 files changed, 53 insertions, 23 deletions
diff --git a/nix/configuration.nix b/nix/configuration.nix
index 37a0a83..bc0d12c 100644
--- a/nix/configuration.nix
+++ b/nix/configuration.nix
@@ -13,6 +13,7 @@
 
   boot = {
     binfmt.emulatedSystems = [ "aarch64-linux" ];
+    supportedFilesystems = [ "btrfs" ];
     loader = {
       efi.canTouchEfiVariables = true;
       grub = {
@@ -62,7 +63,6 @@
     extraGroups = [ "dialout" "networkmanager" "video" "wheel" ];
   };
 
-  nix.autoOptimiseStore = true;
   environment.systemPackages = with pkgs; [
     htop inotify-tools isync killall oathToolkit rsync stow tor unzip w3m wget
     mpv pavucontrol sent vimiv-qt yacreader youtube-dl
diff --git a/nix/devel.nix b/nix/devel.nix
index ebd4da7..11d0509 100644
--- a/nix/devel.nix
+++ b/nix/devel.nix
@@ -17,8 +17,11 @@
   services = {
     # openssh.enable = true;
     ipfs = {
-      enable = false;
-      dataDir = "/data/IPFS";
+      enable = true;
+      user = "sea";
+      dataDir = "/home/sea/.ipfs";
+      # autoMount = true;
+      localDiscovery = true;
     };
   };
 }
diff --git a/nix/games.nix b/nix/games.nix
index 8381cba..d441078 100644
--- a/nix/games.nix
+++ b/nix/games.nix
@@ -1,8 +1,6 @@
 { config, pkgs, ... }:
 
 {
-  nixpkgs.config.allowUnfree = true;
-
   environment.systemPackages = with pkgs; [
     _20kly hedgewars globulation2 scorched3d teeworlds # strategy
     astromenace chromium-bsu # scrolling
diff --git a/nix/hardware-configuration.nix b/nix/hardware-configuration.nix
index 4ed5ba4..63c0801 100644
--- a/nix/hardware-configuration.nix
+++ b/nix/hardware-configuration.nix
@@ -6,38 +6,67 @@
 {
   imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
 
-  boot.initrd.availableKernelModules = [
-    "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage" "sd_mod" "rtsx_pci_sdmmc"
-  ];
-  boot.initrd.kernelModules = [ ];
-  boot.kernelModules = [ "kvm-intel" ];
-  boot.extraModulePackages = [ ];
+  boot = {
+    initrd = {
+      availableKernelModules = [
+        "xhci_pci" "ahci" "nvme" "usbhid" "usb_storage"
+        "sd_mod" "rtsx_pci_sdmmc"
+      ];
+      kernelModules = [ ];
+    };
+    kernelModules = [ "kvm-intel" ];
+    extraModulePackages = [ ];
+  };
 
+  nix.readOnlyStore = false;
   fileSystems = {
     "/" = {
-      device = "/dev/disk/by-uuid/34058769-4280-4374-ad92-259554380a9e";
-      fsType = "ext4";
+      device = "none";
+      fsType = "tmpfs";
     };
 
     "/boot" = {
-      device = "/dev/disk/by-uuid/8EB8-6EDD";
+      device = "/dev/disk/by-uuid/B283-B76E";
       fsType = "vfat";
     };
 
+    "/nix" = {
+      device = "/dev/disk/by-uuid/c334d115-eda9-4470-8c28-b01c4628865b";
+      fsType = "btrfs";
+      options = [ "subvol=nix" "compress=zstd" "noatime" ];
+    };
+
+    "/etc" = {
+      device = "/dev/disk/by-uuid/c334d115-eda9-4470-8c28-b01c4628865b";
+      fsType = "btrfs";
+      options = [ "subvol=etc" "compress=zstd" "noatime" ];
+    };
+
+    "/root" = {
+      device = "/dev/disk/by-uuid/c334d115-eda9-4470-8c28-b01c4628865b";
+      fsType = "btrfs";
+      options = [ "subvol=root" "compress=zstd" "noatime" ];
+    };
+
     "/home" = {
-      device = "/dev/disk/by-uuid/69991f9d-8fec-4b32-8e3e-83d6a2c64257";
-      fsType = "ext4";
+      device = "/dev/disk/by-uuid/c334d115-eda9-4470-8c28-b01c4628865b";
+      fsType = "btrfs";
+      options = [ "subvol=home" "compress=zstd" ];
     };
 
-    # "/data" = {
-    #   device = "/dev/disk/by-uuid/02594f2b-d681-49fc-8f4a-0616d44c8987";
-    #   fsType = "ext4";
-    # };
+    "/var/log" = {
+      device = "/dev/disk/by-uuid/c334d115-eda9-4470-8c28-b01c4628865b";
+      fsType = "btrfs";
+      options = [ "subvol=log" "compress=zstd" ];
+      neededForBoot = true;
+    };
   };
 
-  # swapDevices = [
-  #   { device = "/dev/disk/by-uuid/6f45a147-3b44-4eb9-8ac3-2201e80cff5e"; }
-  # ];
+  services.fstrim.enable = true;
+
+  swapDevices = [
+    { device = "/dev/disk/by-uuid/d3a6d2bc-19dd-4260-a6d4-89c04264dbd8"; }
+  ];
 
   powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
 }