fileserver
This commit is contained in:
parent
82916ad718
commit
fd398a7226
94
fileserver/configuration.nix
Normal file
94
fileserver/configuration.nix
Normal file
|
@ -0,0 +1,94 @@
|
||||||
|
# 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
|
||||||
|
./transmission.nix
|
||||||
|
];
|
||||||
|
|
||||||
|
# Kernel
|
||||||
|
boot.kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages;
|
||||||
|
# Use the Grub boot loader.
|
||||||
|
boot.loader.grub = {
|
||||||
|
enable = true;
|
||||||
|
zfsSupport = true;
|
||||||
|
efiSupport = true;
|
||||||
|
efiInstallAsRemovable = true;
|
||||||
|
mirroredBoots = [
|
||||||
|
{ devices = [ "nodev" ]; path = "/boot"; }
|
||||||
|
];
|
||||||
|
};
|
||||||
|
boot.supportedFilesystems = [ "zfs" ];
|
||||||
|
boot.loader.grub.memtest86.enable = true;
|
||||||
|
zramSwap = {
|
||||||
|
enable = true;
|
||||||
|
algorithm = "zstd";
|
||||||
|
};
|
||||||
|
|
||||||
|
# ZFS
|
||||||
|
services.zfs.autoScrub.enable = true;
|
||||||
|
services.zfs.trim.enable = true;
|
||||||
|
|
||||||
|
# Firmware
|
||||||
|
services.fwupd.enable = true;
|
||||||
|
hardware.firmware = with pkgs; [ firmwareLinuxNonfree ];
|
||||||
|
hardware.enableAllFirmware = true;
|
||||||
|
hardware.enableRedistributableFirmware = true;
|
||||||
|
|
||||||
|
# enable unfree
|
||||||
|
nixpkgs.config.allowUnfree = true;
|
||||||
|
|
||||||
|
# Network
|
||||||
|
networking.hostName = "files";
|
||||||
|
services.tailscale.enable = true;
|
||||||
|
networking.networkmanager.enable = true;
|
||||||
|
networking.hostId = "8425e349";
|
||||||
|
|
||||||
|
# TimeZone
|
||||||
|
time.timeZone = "Europe/Oslo";
|
||||||
|
|
||||||
|
# Select internationalisation properties.
|
||||||
|
i18n.defaultLocale = "en_US.UTF-8";
|
||||||
|
console = {
|
||||||
|
font = "Lat2-Terminus16";
|
||||||
|
keyMap = "no";
|
||||||
|
};
|
||||||
|
|
||||||
|
users.users.geir= {
|
||||||
|
isNormalUser = true;
|
||||||
|
extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user.
|
||||||
|
packages = with pkgs; [
|
||||||
|
tree fastfetch kitty
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
# List packages installed in system profile. To search, run:
|
||||||
|
# $ nix search wget
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
emacs zfs
|
||||||
|
wget curl git
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
# Enable services
|
||||||
|
services.openssh.enable = true;
|
||||||
|
services.nfs.server.enable = true;
|
||||||
|
services.nfs.server.exports = ''
|
||||||
|
/mnt/storage 10.0.0.0/24(rw,fsid=0,no_subtree_check) 100.64.0.0/10(rw,fsid=0,no_subtree_check)
|
||||||
|
'';
|
||||||
|
|
||||||
|
# Open ports in the firewall.
|
||||||
|
# networking.firewall.allowedTCPPorts = [ 2049 ];
|
||||||
|
# networking.firewall.allowedUDPPorts = [ ... ];
|
||||||
|
# Or disable the firewall altogether.
|
||||||
|
networking.firewall.enable = false;
|
||||||
|
|
||||||
|
system.stateVersion = "23.11";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
93
fileserver/configuration.nix~
Normal file
93
fileserver/configuration.nix~
Normal file
|
@ -0,0 +1,93 @@
|
||||||
|
# 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
|
||||||
|
];
|
||||||
|
|
||||||
|
# Kernel
|
||||||
|
boot.kernelPackages = config.boot.zfs.package.latestCompatibleLinuxPackages;
|
||||||
|
# Use the Grub boot loader.
|
||||||
|
boot.loader.grub = {
|
||||||
|
enable = true;
|
||||||
|
zfsSupport = true;
|
||||||
|
efiSupport = true;
|
||||||
|
efiInstallAsRemovable = true;
|
||||||
|
mirroredBoots = [
|
||||||
|
{ devices = [ "nodev" ]; path = "/boot"; }
|
||||||
|
];
|
||||||
|
};
|
||||||
|
boot.supportedFilesystems = [ "zfs" ];
|
||||||
|
boot.loader.grub.memtest86.enable = true;
|
||||||
|
zramSwap = {
|
||||||
|
enable = true;
|
||||||
|
algorithm = "zstd";
|
||||||
|
};
|
||||||
|
|
||||||
|
# ZFS
|
||||||
|
services.zfs.autoScrub.enable = true;
|
||||||
|
services.zfs.trim.enable = true;
|
||||||
|
|
||||||
|
# Firmware
|
||||||
|
services.fwupd.enable = true;
|
||||||
|
hardware.firmware = with pkgs; [ firmwareLinuxNonfree ];
|
||||||
|
hardware.enableAllFirmware = true;
|
||||||
|
hardware.enableRedistributableFirmware = true;
|
||||||
|
|
||||||
|
# enable unfree
|
||||||
|
nixpkgs.config.allowUnfree = true;
|
||||||
|
|
||||||
|
# Network
|
||||||
|
networking.hostName = "files";
|
||||||
|
services.tailscale.enable = true;
|
||||||
|
networking.networkmanager.enable = true;
|
||||||
|
networking.hostId = "8425e349";
|
||||||
|
|
||||||
|
# TimeZone
|
||||||
|
time.timeZone = "Europe/Oslo";
|
||||||
|
|
||||||
|
# Select internationalisation properties.
|
||||||
|
i18n.defaultLocale = "en_US.UTF-8";
|
||||||
|
console = {
|
||||||
|
font = "Lat2-Terminus16";
|
||||||
|
keyMap = "no";
|
||||||
|
};
|
||||||
|
|
||||||
|
users.users.geir= {
|
||||||
|
isNormalUser = true;
|
||||||
|
extraGroups = [ "wheel" ]; # Enable ‘sudo’ for the user.
|
||||||
|
packages = with pkgs; [
|
||||||
|
tree fastfetch kitty
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
# List packages installed in system profile. To search, run:
|
||||||
|
# $ nix search wget
|
||||||
|
environment.systemPackages = with pkgs; [
|
||||||
|
emacs zfs
|
||||||
|
wget curl git
|
||||||
|
];
|
||||||
|
|
||||||
|
|
||||||
|
# Enable services
|
||||||
|
services.openssh.enable = true;
|
||||||
|
services.nfs.server.enable = true;
|
||||||
|
services.nfs.server.exports = ''
|
||||||
|
/mnt/storage 10.0.0.0/24(rw,fsid=0,no_subtree_check) 100.64.0.0/10(rw,fsid=0,no_subtree_check)
|
||||||
|
'';
|
||||||
|
|
||||||
|
# Open ports in the firewall.
|
||||||
|
# networking.firewall.allowedTCPPorts = [ 2049 ];
|
||||||
|
# networking.firewall.allowedUDPPorts = [ ... ];
|
||||||
|
# Or disable the firewall altogether.
|
||||||
|
networking.firewall.enable = false;
|
||||||
|
|
||||||
|
system.stateVersion = "23.11";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
43
fileserver/hardware-configuration.nix
Normal file
43
fileserver/hardware-configuration.nix
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
# 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 + "/installer/scan/not-detected.nix")
|
||||||
|
];
|
||||||
|
|
||||||
|
boot.initrd.availableKernelModules = [ "xhci_pci" "ehci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ];
|
||||||
|
boot.initrd.kernelModules = [ ];
|
||||||
|
boot.kernelModules = [ "kvm-intel" ];
|
||||||
|
boot.extraModulePackages = [ ];
|
||||||
|
|
||||||
|
fileSystems."/" =
|
||||||
|
{ device = "/dev/disk/by-uuid/e7fc0e32-b9e5-4080-859e-fe9dea60823d";
|
||||||
|
fsType = "ext4";
|
||||||
|
};
|
||||||
|
|
||||||
|
fileSystems."/boot" =
|
||||||
|
{ device = "/dev/disk/by-uuid/2C7A-9F08";
|
||||||
|
fsType = "vfat";
|
||||||
|
options = [ "fmask=0022" "dmask=0022" ];
|
||||||
|
};
|
||||||
|
|
||||||
|
fileSystems."/mnt/storage" =
|
||||||
|
{ device = "storage/media";
|
||||||
|
fsType = "zfs";
|
||||||
|
};
|
||||||
|
|
||||||
|
swapDevices = [ ];
|
||||||
|
|
||||||
|
# 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.enp3s0.useDHCP = lib.mkDefault true;
|
||||||
|
|
||||||
|
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||||
|
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
|
||||||
|
}
|
7
fileserver/transmission.nix
Normal file
7
fileserver/transmission.nix
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
{ config, pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
services.transmission = {
|
||||||
|
enable = true;
|
||||||
|
};
|
||||||
|
}
|
0
fileserver/transmission.nix~
Normal file
0
fileserver/transmission.nix~
Normal file
Loading…
Reference in a new issue