configuration.nix
This is an old revision of the document!
My Nix Configuration
# 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, ... }:
let
home-manager = builtins.fetchTarball https://github.com/nix-community/home-manager/archive/release-26.05.tar.gz;
in
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
(import "${home-manager}/nixos")
];
# Bootloader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
networking.hostName = "xps"; # Define your hostname.
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/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";
};
# Define a user account. Don't forget to set a password with ‘passwd’.
users.users."sam" = {
isNormalUser = true;
description = "Sam Cohen";
extraGroups = [ "networkmanager" "wheel" "video" ];
packages = with pkgs; [];
};
# Necessary for sway
security.polkit.enable = true;
# Keyring for wayland applications
services.gnome.gnome-keyring.enable = true;
security.pam.services = {
greetd.enableGnomeKeyring = true;
};
# Launches sway on login
services.greetd = {
enable = true;
settings = {
default_session = {
command = "${pkgs.tuigreet}/bin/tuigreet --time --cmd sway";
user = "greeter";
};
};
};
# Fonts
fonts.packages = with pkgs; [
nerd-fonts.aurulent-sans-mono
];
home-manager.users."sam" = { config, pkgs, lib, ... }:
let
# Permits adjustment of display brightness
brightnessctl = "${pkgs.brightnessctl}/bin/brightnessctl";
# Permits adjustment of audio volume via pactl
pactl = "${pkgs.pulseaudio}/bin/pactl";
in {
home.packages = with pkgs; [
kdePackages.falkon
# For keeping track of passwords:
pass
# For reading mail:
mu
# For syncing with mail servers:
isync
# For sending email:
msmtp
# For communicating with exchange servers. See below, usually
# we will start this program as a systemd service.
davmail
];
programs.bash = {
enable = true;
bashrcExtra = "eval \"$(direnv hook bash)\"";
};
programs.git = {
enable = true;
signing = {
key = "E2FE54A52DF79398";
format = "openpgp";
signByDefault = true;
};
settings = {
init.defaultBranch = "main";
user.useConfigOnly = true;
user.name = "Sam Cohen";
user.email = "sbcohen2000@gmail.com";
};
};
## GPG ##########
programs.gpg = {
enable = true;
};
services.gpg-agent = {
enable = true;
pinentry.package = pkgs.pinentry-qt;
};
## Sway/GUI ##########
programs.kitty = {
enable = true;
themeFile = "AtomOneLight";
font.name = "AurulentSansM Nerd Font";
font.size = 10;
};
services.emacs.enable = true;
programs.emacs = {
enable = true;
};
home.sessionVariables = {
# Put the location of mu4e on the path so that emacs can find
# it later.
MU4E = "${pkgs.mu.mu4e}";
};
wayland.windowManager.sway = {
enable = true;
wrapperFeatures.gtk = true; # Fixes common issues with gtk3 apps
checkConfig = true;
config = rec {
terminal = "kitty";
startup = [
# Launch emacs on start
{ command = "emacsclient -c"; }
];
modifier = "Mod4";
keybindings = {
# Navigation
"${modifier}+0" = "workspace number 10";
"${modifier}+1" = "workspace number 1";
"${modifier}+2" = "workspace number 2";
"${modifier}+3" = "workspace number 3";
"${modifier}+4" = "workspace number 4";
"${modifier}+5" = "workspace number 5";
"${modifier}+6" = "workspace number 6";
"${modifier}+7" = "workspace number 7";
"${modifier}+8" = "workspace number 8";
"${modifier}+9" = "workspace number 9";
"${modifier}+Shift+0" = "move container to workspace number 10";
"${modifier}+Shift+1" = "move container to workspace number 1";
"${modifier}+Shift+2" = "move container to workspace number 2";
"${modifier}+Shift+3" = "move container to workspace number 3";
"${modifier}+Shift+4" = "move container to workspace number 4";
"${modifier}+Shift+5" = "move container to workspace number 5";
"${modifier}+Shift+6" = "move container to workspace number 6";
"${modifier}+Shift+7" = "move container to workspace number 7";
"${modifier}+Shift+8" = "move container to workspace number 8";
"${modifier}+Shift+9" = "move container to workspace number 9";
"${modifier}+Left" = "focus left";
"${modifier}+Right" = "focus right";
"${modifier}+Up" = "focus up";
"${modifier}+Down" = "focus down";
"${modifier}+Shift+Left" = "move left";
"${modifier}+Shift+Right" = "move right";
"${modifier}+Shift+Up" = "move up";
"${modifier}+Shift+Down" = "move down";
"${modifier}+q" = "kill";
"${modifier}+a" = "focus parent";
"${modifier}+f" = "fullscreen toggle";
"${modifier}+space" = "layout toggle split";
"${modifier}+Shift+space" = "floating toggle";
# Brightness Controls
"XF86MonBrightnessDown" = "exec ${brightnessctl} s 10%-";
"XF86MonBrightnessUp" = "exec ${brightnessctl} s +10%";
# Volume Controls
"XF86AudioRaiseVolume" = "exec ${pactl} set-sink-volume @DEFAULT_SINK@ +5%";
"XF86AudioLowerVolume" = "exec ${pactl} set-sink-volume @DEFAULT_SINK@ -5%";
"XF86AudioMute" = "exec ${pactl} set-sink-mute @DEFAULT_SINK@ toggle";
# Launching
"${modifier}+Return" = "exec kitty";
"${modifier}+e" = "exec emacsclient -c";
"${modifier}+b" = "exec falkon";
};
input = {
"type:keyboard" = {
xkb_options = "ctrl:nocaps";
repeat_delay = "250";
repeat_rate = "30";
};
"type:touchpad" = {
tap = "enabled";
# Prevent an odd feature where after tapping you can drag
# the mouse to create a selection.
drag = "disabled";
drag_lock = "disabled";
# Change scroll direction.
natural_scroll = "enabled";
# Disable trackpad while typing.
dwt = "enabled";
};
};
};
};
# Turns off the display, then suspends the computer after a period
# of inactivity.
services.swayidle = {
enable = true;
timeouts = [
{
timeout = 1 * 60;
command = "${brightnessctl} -s s 5%"; # Set the brightness, saving the old value to a tmpfile.
resumeCommand = "${brightnessctl} -r"; # Restore the previous brightness.
}
{
timeout = 5 * 60;
command = "${pkgs.systemd}/bin/systemctl suspend";
}
];
events = {
"after-resume" = "${brightnessctl} -r"; # Restore the previous brightness.;
};
};
## Mail ##########
# We use a davmail server to proxy Exchange mail servers as
# local SMTP/IMAP servers.
systemd.user.services.davmail = {
Unit = {
Description = "Proxy Exchange servers through local SMTP/IMAP.";
};
Install = {
WantedBy = [ "default.target" ];
};
Service = {
ExecStart = "${pkgs.davmail}/bin/davmail ${config.home.homeDirectory}/.davmail.properties";
};
};
# Restart user services when we perform a configuration switch.
systemd.user.startServices = "sd-switch";
home.stateVersion = "26.05";
};
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
pkgs.direnv
];
# 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 = "26.05"; # Did you read the comment?
}
configuration.nix.1780353359.txt.gz · Last modified: by sam