1
0
Fork 0
NixOS/hosts/nas/configuration.nix

207 lines
5 KiB
Nix
Raw Normal View History

2024-10-10 04:09:33 -05:00
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help).
{ config, pkgs, ... }:
{
nix = {
nixPath = [
"nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixos"
"nixos-config=/home/paul/.nixos/hosts/nas/configuration.nix"
"/nix/var/nix/profiles/per-user/root/channels"
];
};
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
];
# Bootloader.
boot.loader.grub.enable = true;
boot.loader.grub.device = "/dev/sda";
boot.loader.grub.useOSProber = true;
# Disks
fileSystems = {
"/mnt/sdb" = {
device = "/dev/disk/by-uuid/ff5645a7-e9f4-4f89-9eaa-75bb7c4a769d";
fsType = "btrfs";
options = ["defaults"];
};
"/mnt/sdc" ={
device = "/dev/disk/by-uuid/5359ba4d-2737-4081-843c-fcedc2b465ad";
fsType = "btrfs";
options = [ "defaults" ];
};
};
# Networking options, Tailscale is located in Services section
networking = {
hostName = "nas"; # Define your hostname.
firewall.enable = false;
dhcpcd.enable = true;
interfaces = {
ens18.ipv4.addresses = [{
address = "192.168.1.101";
prefixLength = 20;
}];
};
defaultGateway = {
address = "192.168.1.254";
interface = "ens18";
};
nameservers = [ "100.91.252.17" "100.96.32.13"];
};
virtualisation = {
docker = {
enable = true;
autoPrune = {
enable = true;
dates = "weekly";
};
};
};
nix = {
settings = {
experimental-features = [ "nix-command" "flakes" ];
warn-dirty = false;
};
};
services.samba-wsdd.enable = true; # make shares visible for windows 10 clients
services.samba = {
enable = true;
securityType = "user";
extraConfig = ''
workgroup = WORKGROUP
server string = testnix
netbios name = testnix
security = user
guest ok = yes
guest account = nobody
map to guest = bad user
load printers = no
'';
shares = {
movies = {
path = "/mnt/sdb";
browseable = "yes";
"read only" = "no";
"guest ok" = "yes";
"create mask" = "0644";
"directory mask" = "0755";
"force user" = "paul";
"force group" = "users";
};
tv-shows = {
path = "/mnt/sdc";
browseable = "yes";
"read only" = "no";
"guest ok" = "yes";
"create mask" = "0644";
"directory mask" = "0755";
"force user" = "paul";
"force group" = "users";
};
};
};
# Enable networking
networking.networkmanager.enable = true;
# Set your time zone.
time.timeZone = "America/Chicago";
# Select internationalisation properties.
i18n.defaultLocale = "en_US.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "en_US.UTF-8";
LC_IDENTIFICATION = "en_US.UTF-8";
LC_MEASUREMENT = "en_US.UTF-8";
LC_MONETARY = "en_US.UTF-8";
LC_NAME = "en_US.UTF-8";
LC_NUMERIC = "en_US.UTF-8";
LC_PAPER = "en_US.UTF-8";
LC_TELEPHONE = "en_US.UTF-8";
LC_TIME = "en_US.UTF-8";
};
# Configure keymap in X11
services.xserver = {
xkb.layout = "us";
xkb.variant = "";
};
# Define a user account. Don't forget to set a password with passwd.
users.users.paul = {
isNormalUser = true;
description = "Paul";
extraGroups = [ "networkmanager" "wheel" ];
packages = with pkgs; [];
};
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
micro
2024-10-10 04:09:33 -05:00
docker-compose
htop
iotop
lm_sensors
ncdu
nmap
tailscale
tdns-cli
tmux
tree
wget
];
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
programs = {
mtr.enable = true;
gnupg.agent = {
enable = true;
enableSSHSupport = true;
};
git.enable = true;
2024-10-10 04:09:33 -05:00
};
2024-10-10 04:09:33 -05:00
# List services that you want to enable:
services = {
openssh.enable = true;
qemuGuest.enable = true;
tailscale.enable = true;
};
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
2024-10-13 01:13:25 -05:00
# Enable Automatic Upgrades
system.autoUpgrade.enable = true;
nix.gc.automatic = true;
nix.gc.dates = "weekly"; # Run garbage collection weekly to free up disk space
2024-10-10 04:09:33 -05:00
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. Its perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "23.05"; # Did you read the comment?
}