Skip to content

Instantly share code, notes, and snippets.

@SamuelDavis
Last active September 16, 2024 11:35
Show Gist options
  • 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, lib, ... }:
let
myLocale = "en_US.UTF-8";
in
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
./thinkpad-x1-extreme-gen4-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 = myLocale;
i18n.extraLocaleSettings = {
LC_ADDRESS = myLocale;
LC_IDENTIFICATION = myLocale;
LC_MEASUREMENT = myLocale;
LC_MONETARY = myLocale;
LC_NAME = myLocale;
LC_NUMERIC = myLocale;
LC_PAPER = myLocale;
LC_TELEPHONE = myLocale;
LC_TIME = myLocale;
};
# 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" "input" ];
packages = with pkgs; [
# browsers
brave
# neovim
ripgrep
# programming
nodejs
php
php81Packages.composer
git
jetbrains.phpstorm
mkcert
];
};
nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
"1password"
"1password-cli"
"phpstorm"
];
# Password Manager
programs._1password.enable = true;
programs._1password-gui = {
enable = true;
polkitPolicyOwners = [ "sdavis" ];
};
# Window Manager
programs.sway = {
enable = true;
wrapperFeatures.gtk = true;
extraPackages = with pkgs; [
# window manager
foot # terminal
wmenu # app launcher
waybar
swaylock
swayidle
wl-clipboard
wlr-randr
# notifications
mako
# aud/vis controls
brightnessctl
playerctl
# screenshots
grim
slurp
];
};
# Function Keys
programs.light.enable = true;
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [ neovim ];
# Configure Environment Variables
environment.sessionVariables = rec {
EDITOR = "nvim";
};
environment.loginShellInit = ''
[[ "$(tty)" == /dev/tty1 ]] && sway --unsupported-gpu
'';
# 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?
# Sound
sound.enable = true;
hardware.pulseaudio.enable = true;
# mkcert Local Certificates
security.pki = {
certificateFiles = [
./rootCA.pem
];
};
# Display Drivers
hardware.opengl = {
enable = true;
driSupport = true;
driSupport32Bit = true;
};
services.xserver.videoDrivers = [ "nvidia-open" ];
hardware.nvidia = {
modesetting.enable = true;
powerManagement.enable = false;
powerManagement.finegrained = false;
open = false;
nvidiaSettings = true;
package = config.boot.kernelPackages.nvidiaPackages.stable;
prime = {
intelBusId = "PCI:0:2:0";
nvidiaBusId = "PCI:1:0:0";
};
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment