Skip to content

Instantly share code, notes, and snippets.

@SamuelDavis
Last active March 20, 2024 01:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SamuelDavis/4d85e7f6300937ef6b22243026dae361 to your computer and use it in GitHub Desktop.
Save SamuelDavis/4d85e7f6300937ef6b22243026dae361 to your computer and use it in GitHub Desktop.
NixOS Global Config
# 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 = {
package = pkgs.nix;
settings.experimental-features = [ "nix-command" "flakes" ];
};
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
];
# Bootloader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
networking.hostName = "nixos"; # Define your hostname.
networking.extraHosts =
''
127.0.0.1 localhost.localhost
127.0.0.1 localhost.test
'';
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# 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.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";
};
# Define a user account. Don't forget to set a password with ‘passwd’.
users.users.sdavis = {
isNormalUser = true;
description = "Samuel Davis";
extraGroups = [ "networkmanager" "wheel" "audio" "docker" ];
packages = with pkgs; [
# Window Manager
hyprpaper
waybar
wofi
kitty
# Browsers
brave
# System Tooling
brightnessctl
playerctl
wl-clipboard
wlr-randr
# Programming
git
jetbrains.phpstorm
docker-compose
mkcert
];
};
virtualisation.docker.enable = true;
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
neovim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
# wget
];
# Configure Environment Variables
environment.sessionVariables = rec {
EDITOR = "nvim";
TERM = "kitty";
# Wayland + Nvidia fixes;
# WLR_RENDERER = "vulkan"; # prevent general flickering
WLR_NO_HARDWARE_CURSORS = "1"; # make sure cursor is visible
# XWAYLAND_NO_GLAMOR = "1"; # prevent XWayland flicker
NIXOS_OZONE_WL = "1"; # hint to Electron apps to use Wayland
};
environment.loginShellInit = ''
[[ "$(tty)" == /dev/tty1 ]] && Hyprland
'';
# 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;
# };
# List services that you want to enable:
# 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. 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.11"; # Did you read the comment?
# Graphics
hardware.opengl = {
enable = true;
driSupport = true;
driSupport32Bit = true;
};
services.xserver.videoDrivers = [ "nvidia" ];
hardware.nvidia = {
modesetting.enable = true;
powerManagement.enable = false;
powerManagement.finegrained = false;
open = false;
nvidiaSettings = true;
package = config.boot.kernelPackages.nvidiaPackages.stable;
prime = {
offload = {
enable = true;
enableOffloadCmd = true;
};
nvidiaBusId = "PCI:1:0:0";
intelBusId = "PCI:0:2:0";
};
};
# Enable Window Manager
programs.hyprland = {
enable = true;
enableNvidiaPatches = true;
xwayland.enable = true;
};
# Sound
sound.enable = true;
hardware.pulseaudio.enable = true;
# Password Manager
programs._1password.enable = true;
programs._1password-gui = {
enable = true;
polkitPolicyOwners = [ "sdavis" ];
};
# mkcert Local Certificates
security.pki = {
certificateFiles = [
./rootCA.pem
];
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment