nix_config/machines/buck/configuration.nix
2024-02-11 07:02:40 -05:00

273 lines
7.6 KiB
Nix
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 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,
inputs,
sops,
...
}: {
imports = [
# Include the results of the hardware scan.
./hardware-configuration.nix
];
nixpkgs.config.permittedInsecurePackages = [
"electron-25.9.0"
];
# This lets us pin the nixpkgs registry by default to the nixpkgs used to build this system.
# Doing this means we are less likely to require the 30+MB download when
# running commands like nix search or nix run
# See: https://dataswamp.org/~solene/2022-07-20-nixos-flakes-command-sync-with-system.html
nix.registry.nixpkgs.flake = inputs.nixpkgs;
sops = {
# This will add secrets.yml to the nix store
# You can avoid this by adding a string to the full path instead, i.e.
# sops.defaultSopsFile = "/root/.sops/secrets/example.yaml";
defaultSopsFile = ../../secrets.yaml;
# This will automatically import SSH keys as age keys
age.sshKeyPaths = ["/etc/ssh/ssh_host_ed25519_key"];
# This is using an age key that is expected to already be in the filesystem
#age.keyFile = "/var/lib/sops-nix/key.txt";
# This will generate a new key if the key specified above does not exist
#age.generateKey = true;
# This is the actual specification of the secrets.
secrets."pihole/webpassword" = {};
secrets."spotify/username".owner = "jacob";
secrets."spotify/password".owner = "jacob";
secrets."email/gmail/password".owner = "jacob";
secrets."email/jhink/password".owner = "jacob";
secrets."wifi/env" = {};
};
# Bootloader.
boot.loader = {
systemd-boot = {
enable = true;
# limit number of configurations to save in the boot menu
configurationLimit = 10;
};
efi = {
canTouchEfiVariables = true;
efiSysMountPoint = "/boot/efi";
};
};
networking = {
hostName = "buck"; # Define your hostname.
enableIPv6 = true;
networkmanager.enable = true;
wireless = { # wpa_supplicant
enable = false;
userControlled.enable = true;
environmentFile = "/run/secrets/wifi/env";
networks = {
"@SSID_HOME@" = {
pskRaw = "@PSKRAW_HOME@";
};
};
};
};
# 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/New_York";
# Select internationalisation properties.
i18n.defaultLocale = "en_US.utf8";
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
networkmanager
networkmanagerapplet
vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
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;
};
# This is needed in case users set zsh as their default shell
zsh.enable = true;
};
# List services that you want to enable:
# Enable sound.
sound.enable = true;
#hardware.raspberry-pi."4".fkms-3d.enable = true;
# Enable touchpad support (enabled default in most desktopManager). services.xserver.libinput.enable = true;
# Define a user account. Don't forget to set a password with passwd.
users = {
groups.plugdev = {};
users.jacob = {
isNormalUser = true;
extraGroups = [ "audio" "jackaudio" "plugdev" "video" "wheel" ]; # Enable sudo for the user.
shell = pkgs.zsh;
};
};
security.rtkit.enable = true; # recommended for pipewire
# List services that you want to enable:
services = {
# If you want to use JACK applications, uncomment this
jack = {
alsa.enable = false;
jackd.enable = true;
loopback.enable = true;
};
logind = {
extraConfig = ''
[Login]
KillUserProcesses=no
HandleLidSwitch=suspend
HandleLidSwitchDocked=ignore
HandleLidSwitchExternalPower=suspend
IdleAction=suspend
IdleActionSec=15min
'';
};
# Enable the OpenSSH daemon.
openssh.enable = true;
pipewire = {
enable = false;
alsa.enable = false;
alsa.support32Bit = true;
pulse.enable = true;
# use the example session manager (no others are packaged yet so this is enabled by default,
# no need to redefine it in your config for now)
#media-session.enable = true;
};
printing = {
enable = true;
};
rpcbind.enable = true; # for NFS
syncthing = import ./syncthing.nix;
udev.extraRules = ''
ACTION=="add", SUBSYSTEM=="backlight", KERNEL=="intel_backlight", MODE="0666", RUN+="${pkgs.coreutils}/bin/chmod a+w /sys/class/backlight/%k/brightness"
'';
tailscale.enable = true;
# Enable the X11 windowing system. services.xserver.enable = true;
xserver = {
enable = true;
dpi = 112; # t470 has a 14" 16:9 monitor at native res 1366x768
displayManager = {
defaultSession = "none+i3";
autoLogin = {
enable = true;
user = "jacob";
};
lightdm = {
enable = true;
greeter.enable = false;
};
};
libinput = {
enable = true;
touchpad = {
naturalScrolling = true;
disableWhileTyping = true;
};
};
windowManager.i3 = {
enable = true;
extraPackages = with pkgs; [
dmenu #application launcher most people use
i3status # gives you the default i3 status bar
i3lock #default i3 screen locker
i3blocks #if you are planning on using i3blocks over i3status
];
};
};
};
services.acpid.enable = true;
services.thermald.enable = true;
services.fwupd.enable = true;
systemd.mounts = let
nfsOpts = {
type = "nfs";
mountConfig = {
Options = "noatime";
};
};
nas = "100.64.0.5"; # synnas over tailscale
in [
(nfsOpts // {
what = "${nas}:/homes/jacob/Photos";
where = "/nas/photos";
})
];
systemd.automounts = let
autoMountOpts = {
wantedBy = [ "multi-user.target" ];
automountConfig = {
TimeoutIdleSec = "600";
};
};
in [
(autoMountOpts // { where = "/nas/photos"; })
];
# Enable the OpenSSH daemon.
# services.openssh.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. 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 = "22.05"; # Did you read the comment?
nix = {
gc = {
automatic = true;
};
settings = {
experimental-features = ["nix-command" "flakes"];
max-jobs = 4;
};
};
}