From b8d1df88732a80691483c62fabb0a56a4105b073 Mon Sep 17 00:00:00 2001 From: Paul Hartman Date: Thu, 10 Oct 2024 04:09:33 -0500 Subject: [PATCH] First Commit --- README.md | 0 hosts/nas/configuration.nix | 210 +++++++++++++++++++++++++++ hosts/nas/hardware-configuration.nix | 33 +++++ 3 files changed, 243 insertions(+) create mode 100644 README.md create mode 100644 hosts/nas/configuration.nix create mode 100644 hosts/nas/hardware-configuration.nix diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/hosts/nas/configuration.nix b/hosts/nas/configuration.nix new file mode 100644 index 0000000..cfe8087 --- /dev/null +++ b/hosts/nas/configuration.nix @@ -0,0 +1,210 @@ +# 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 = { + # settings.auto-optimize-store = true; + 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"; + }; + }; + }; + + # Configure network proxy if necessary + # networking.proxy.default = "http://user:password@proxy:port/"; + # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; + + # 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; [ + # vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default. + # wget + micro + docker-compose + htop + intel-gpu-tools + 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; + programs.gnupg.agent = { + enable = true; + enableSSHSupport = true; + }; + programs.git = { + enable = true; +# userName = "Paul Hartman"; +# userEmail = "paul.hartman@astaluk.com"; + }; + # 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; + + # 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. It‘s 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? + +} diff --git a/hosts/nas/hardware-configuration.nix b/hosts/nas/hardware-configuration.nix new file mode 100644 index 0000000..8b5d922 --- /dev/null +++ b/hosts/nas/hardware-configuration.nix @@ -0,0 +1,33 @@ +# 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 = [ "ata_piix" "uhci_hcd" "ahci" "sd_mod" "sr_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/e797be10-81a9-49ca-b314-88043dc5c518"; + fsType = "ext4"; + }; + + swapDevices = + [ { device = "/dev/disk/by-uuid/3b8e47af-b64e-4c39-9d80-6a3d396400bd"; } + ]; + + # 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..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.ens18.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; +}