# 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’).

{ pkgs, ... }:
{
  imports = [
    ./hardware-configuration-t470.nix
    ./common.nix

    ./sourcehut.nix
    ./snipeit.nix
    ./borgbackup.nix
  ];

  networking.hostName = "t470"; # Define your hostname.
  networking.extraHosts = ''
    127.0.0.1 sourcehut.nixos.local
    127.0.0.1 meta.sourcehut.nixos.local
    127.0.0.1 man.sourcehut.nixos.local
    127.0.0.1 git.sourcehut.nixos.local

    127.0.0.1 snipe-it.nixos.local

    127.0.0.1 inventree.nixos.local
  '';

  # automount smb music share
  fileSystems."/home/khais/Music" = {
    device = "//void/Music";
    fsType = "cifs";
    options = let 
      # prevent hanging when network is not reachable
      automount_opts = "x-systemd.automount,noauto,x-systemd.idle-timeout=60,x-systemd.device-timeout=5s,x-systemd.mount-timeout=5s";
    in [ "${automount_opts},credentials=/etc/nixos/secrets/music.smb" ];
  };

  fileSystems."/home/khais/Books" = {
    device = "//void/Books";
    fsType = "cifs";
    options = let 
      # prevent hanging when network is not reachable
      automount_opts = "x-systemd.automount,noauto,x-systemd.idle-timeout=60,x-systemd.device-timeout=5s,x-systemd.mount-timeout=5s";
    in [ "${automount_opts},credentials=/etc/nixos/secrets/books.smb" ];
  };

  # fingerprint sensor setup
  services.open-fprintd.enable = true;
  services.python-validity.enable = true;
}
