move storage to nixos 🎉
This commit is contained in:
parent
42d258e73b
commit
75af9679d2
11 changed files with 323 additions and 74 deletions
47
nixos/hosts/hades/storage/configuration.nix
Normal file
47
nixos/hosts/hades/storage/configuration.nix
Normal file
|
@ -0,0 +1,47 @@
|
|||
# Edit this configuration file to define what should be installed on
|
||||
# your system. Help is available in the configuration.nix(5) man page, on
|
||||
# https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
|
||||
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
imports =
|
||||
[ # Include the results of the hardware scan.
|
||||
./hardware-configuration.nix
|
||||
./fs.nix
|
||||
];
|
||||
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
|
||||
networking.hostName = "storage"; # Define your hostname.
|
||||
# Pick only one of the below networking options.
|
||||
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
|
||||
# networking.networkmanager.enable = true; # Easiest to use and most distros use this by default.
|
||||
|
||||
# Set your time zone.
|
||||
time.timeZone = "Europe/Amsterdam";
|
||||
|
||||
# Define a user account. Don't forget to set a password with ‘passwd’.
|
||||
users.users.vivian = {
|
||||
isNormalUser = true;
|
||||
extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user.
|
||||
};
|
||||
|
||||
# Enable the OpenSSH daemon.
|
||||
services.openssh.enable = true;
|
||||
|
||||
# Disable firewall, as NFS makes it annoying
|
||||
networking.firewall.enable = false;
|
||||
|
||||
# For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion .
|
||||
system.stateVersion = "23.11"; # Did you read the comment?
|
||||
|
||||
|
||||
services.nfs.server = {
|
||||
enable = true;
|
||||
exports = ''
|
||||
/mnt/storage *(rw,async,no_subtree_check,fsid=0,all_squash,anonuid=0,anongid=0)
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
67
nixos/hosts/hades/storage/fs.nix
Normal file
67
nixos/hosts/hades/storage/fs.nix
Normal file
|
@ -0,0 +1,67 @@
|
|||
{ pkgs, ... }: {
|
||||
|
||||
environment.systemPackages = with pkgs; [ mergerfs ];
|
||||
|
||||
fileSystems."/mnt/disk1" = {
|
||||
fsType = "ext4";
|
||||
device = "/dev/disk/by-partuuid/abbfc440-fb3d-4b33-92cb-948b2deeac53";
|
||||
};
|
||||
|
||||
fileSystems."/mnt/disk2" = {
|
||||
fsType = "ext4";
|
||||
device = "/dev/disk/by-partuuid/3a57ffa8-8a0f-4839-81df-7f34d99e9dbc";
|
||||
};
|
||||
|
||||
fileSystems."/mnt/disk3" = {
|
||||
fsType = "ext4";
|
||||
device = "/dev/disk/by-partuuid/0f72c5f8-b7db-4151-83f0-47e5f703aeb1";
|
||||
};
|
||||
|
||||
fileSystems."/mnt/disk4" = {
|
||||
fsType = "ext4";
|
||||
device = "/dev/disk/by-partuuid/b9c72b41-1538-436e-a595-49d1faa5ed01";
|
||||
};
|
||||
|
||||
fileSystems."/mnt/disk5" = {
|
||||
fsType = "ext4";
|
||||
device = "/dev/disk/by-partuuid/928d0200-eca1-4a69-b2d6-fbd23a5ee8cd";
|
||||
};
|
||||
|
||||
fileSystems."/mnt/disk6" = {
|
||||
fsType = "ext4";
|
||||
device = "/dev/disk/by-uuid/63381321-fe00-4838-8668-4d1decc94296";
|
||||
};
|
||||
|
||||
fileSystems."/mnt/parity1" = {
|
||||
fsType = "ext4";
|
||||
device = "/dev/disk/by-partuuid/7c9b88ed-b8f8-40c9-bbc3-b75d30e04e01";
|
||||
};
|
||||
|
||||
fileSystems."/mnt/parity2" = {
|
||||
fsType = "ext4";
|
||||
device = "/dev/disk/by-uuid/6c568887-9d2e-45ce-ab85-4c48cca2226a";
|
||||
};
|
||||
|
||||
fileSystems."/mnt/storage" = {
|
||||
fsType = "fuse.mergerfs";
|
||||
device = "/mnt/disk*";
|
||||
options = [
|
||||
"direct_io"
|
||||
"defaults"
|
||||
"allow_other"
|
||||
"minfreespace=20G"
|
||||
"fsname=mergerfs"
|
||||
"use_ino"
|
||||
"noforget"
|
||||
"moveonenospc=true"
|
||||
"category.create=mfs"
|
||||
];
|
||||
};
|
||||
|
||||
services.nfs.server = {
|
||||
enable = true;
|
||||
exports = ''
|
||||
/mnt/storage *(rw,async,no_subtree_check,fsid=0,all_squash,anonuid=0,anongid=0)
|
||||
'';
|
||||
};
|
||||
}
|
38
nixos/hosts/hades/storage/hardware-configuration.nix
Normal file
38
nixos/hosts/hades/storage/hardware-configuration.nix
Normal file
|
@ -0,0 +1,38 @@
|
|||
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
||||
# and may be overwritten by future invocations. Please make changes
|
||||
# to /etc/nixos/configuration.nix instead.
|
||||
{ config, lib, pkgs, modulesPath, ... }:
|
||||
|
||||
{
|
||||
imports =
|
||||
[ (modulesPath + "/profiles/qemu-guest.nix")
|
||||
];
|
||||
|
||||
boot.initrd.availableKernelModules = [ "uhci_hcd" "ehci_pci" "ahci" "mpt3sas" "virtio_pci" "sd_mod" "sr_mod" "virtio_blk" ];
|
||||
boot.initrd.kernelModules = [ ];
|
||||
boot.kernelModules = [ "kvm-intel" ];
|
||||
boot.extraModulePackages = [ ];
|
||||
|
||||
fileSystems."/" =
|
||||
{ device = "/dev/disk/by-uuid/cdbb197e-c1a8-4780-acd8-57d23bfb4050";
|
||||
fsType = "ext4";
|
||||
};
|
||||
|
||||
fileSystems."/boot" =
|
||||
{ device = "/dev/disk/by-uuid/7613-E759";
|
||||
fsType = "vfat";
|
||||
};
|
||||
|
||||
swapDevices =
|
||||
[ { device = "/dev/disk/by-uuid/a3e08ffb-2237-463e-b9bf-8a42c0dbbf22"; }
|
||||
];
|
||||
|
||||
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
||||
# (the default) this is the recommended approach. When using systemd-networkd it's
|
||||
# still possible to use this option, but it's recommended to use it in conjunction
|
||||
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
|
||||
networking.useDHCP = lib.mkDefault true;
|
||||
# networking.interfaces.enp6s18.useDHCP = lib.mkDefault true;
|
||||
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue