configuration.nix
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| configuration.nix [2026/06/01 22:37] – Tweak whitespace sam | configuration.nix [2026/06/29 14:27] (current) – tweaks sam | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== My Nix Configuration ====== | ====== My Nix Configuration ====== | ||
| + | |||
| + | In order to edit the configuration without root permissions, | ||
| + | < | ||
| + | mkdir ~/etc | ||
| + | sudo mv /etc/nixos/ ~/etc/ | ||
| + | sudo chown -R $(id -un):users ~/ | ||
| + | sudo ln -s ~/ | ||
| + | </ | ||
| + | |||
| + | ===== The Configuration ===== | ||
| < | < | ||
| Line 6: | Line 16: | ||
| # and in the NixOS manual (accessible by running ‘nixos-help’). | # and in the NixOS manual (accessible by running ‘nixos-help’). | ||
| - | { config, pkgs, ... }: | + | { config, pkgs, lib, ... }: |
| let | let | ||
| home-manager = builtins.fetchTarball https:// | home-manager = builtins.fetchTarball https:// | ||
| + | |||
| + | # Given a list of attribute sets, union them into a single attribute | ||
| + | # set, preferring keys earlier in the list. | ||
| + | unionsAttrs = lib.foldAttrs lib.const {}; | ||
| in | in | ||
| { | { | ||
| Line 31: | Line 45: | ||
| # Enable networking | # Enable networking | ||
| networking.networkmanager.enable = true; | networking.networkmanager.enable = true; | ||
| + | |||
| + | # Enable bluetooth | ||
| + | hardware.bluetooth = { | ||
| + | enable = true; | ||
| + | powerOnBoot = false; | ||
| + | }; | ||
| # Set your time zone. | # Set your time zone. | ||
| Line 49: | Line 69: | ||
| LC_TIME = " | LC_TIME = " | ||
| }; | }; | ||
| + | |||
| + | # Add swap | ||
| + | swapDevices = [{ | ||
| + | device = "/ | ||
| + | size = 16*1024; # 16 GiB | ||
| + | }]; | ||
| # Define a user account. Don't forget to set a password with ‘passwd’. | # Define a user account. Don't forget to set a password with ‘passwd’. | ||
| Line 65: | Line 91: | ||
| security.pam.services = { | security.pam.services = { | ||
| greetd.enableGnomeKeyring = true; | greetd.enableGnomeKeyring = true; | ||
| + | # Necessary for swaylock to work correctly. | ||
| + | swaylock = {}; | ||
| }; | }; | ||
| Line 76: | Line 104: | ||
| }; | }; | ||
| }; | }; | ||
| + | }; | ||
| + | |||
| + | services.logind.settings.Login = { | ||
| + | # don’t shutdown when power button is short-pressed. We want sway | ||
| + | # to handle that key instead. | ||
| + | HandlePowerKey = " | ||
| + | }; | ||
| + | |||
| + | # CPU frequency scaling. This is meant to extend battery life. | ||
| + | services.auto-cpufreq = { | ||
| + | enable = true; | ||
| + | settings = { | ||
| + | battery = { | ||
| + | governor = " | ||
| + | turbo = " | ||
| + | }; | ||
| + | charger = { | ||
| + | governor = " | ||
| + | turbo = " | ||
| + | }; | ||
| + | }; | ||
| + | }; | ||
| + | # Tries to keep the CPU at a reasonable temperature by throttling | ||
| + | # when necessary. | ||
| + | services.thermald.enable = true; | ||
| + | |||
| + | # A service which automatically mounts external storage devices. | ||
| + | services.udisks2.enable = true; | ||
| + | |||
| + | ## Printing ########## | ||
| + | |||
| + | # NOTE: see http:// | ||
| + | services.printing.enable = true; | ||
| + | |||
| + | # The below is for automatic discovery of network printers using | ||
| + | # the IPP Everywhere protocol. | ||
| + | services.avahi = { | ||
| + | enable = true; | ||
| + | nssmdns4 = true; | ||
| + | openFirewall = true; | ||
| }; | }; | ||
| # Fonts | # Fonts | ||
| fonts.packages = with pkgs; [ | fonts.packages = with pkgs; [ | ||
| - | | + | |
| ]; | ]; | ||
| Line 89: | Line 157: | ||
| # Permits adjustment of audio volume via pactl | # Permits adjustment of audio volume via pactl | ||
| pactl = " | pactl = " | ||
| + | # Permits locking the screen | ||
| + | swaylock = " | ||
| in { | in { | ||
| home.packages = with pkgs; [ | home.packages = with pkgs; [ | ||
| - | kdePackages.falkon | ||
| - | |||
| # For keeping track of passwords: | # For keeping track of passwords: | ||
| pass | pass | ||
| Line 106: | Line 174: | ||
| # we will start this program as a systemd service. | # we will start this program as a systemd service. | ||
| davmail | davmail | ||
| + | |||
| + | # dokoff (locally defined) | ||
| + | (callPackage / | ||
| + | |||
| + | # For taking screenshots | ||
| + | grim | ||
| ]; | ]; | ||
| programs.bash = { | programs.bash = { | ||
| enable = true; | enable = true; | ||
| + | enableCompletion = true; | ||
| bashrcExtra = "eval \" | bashrcExtra = "eval \" | ||
| }; | }; | ||
| Line 125: | Line 200: | ||
| user.name = "Sam Cohen"; | user.name = "Sam Cohen"; | ||
| user.email = " | user.email = " | ||
| + | rebase.autoSquash = true; | ||
| }; | }; | ||
| }; | }; | ||
| Line 136: | Line 212: | ||
| enable = true; | enable = true; | ||
| pinentry.package = pkgs.pinentry-qt; | pinentry.package = pkgs.pinentry-qt; | ||
| + | defaultCacheTtl = 1800; # Only ask for a password half an hour after inactivity | ||
| }; | }; | ||
| Line 143: | Line 220: | ||
| enable = true; | enable = true; | ||
| themeFile = " | themeFile = " | ||
| - | font.name = "AurulentSansM Nerd Font"; | + | font.name = "Hack"; |
| font.size = 10; | font.size = 10; | ||
| + | # Make the text render a lot thicker, more similar to emacs | ||
| + | # text rendering: | ||
| + | extraConfig = " | ||
| + | }; | ||
| + | |||
| + | programs.rofi = { | ||
| + | enable = true; | ||
| + | modes = [ " | ||
| + | theme = " | ||
| + | }; | ||
| + | |||
| + | # Client for udisks2 | ||
| + | services.udiskie = { | ||
| + | enable = true; | ||
| }; | }; | ||
| Line 155: | Line 246: | ||
| # it later. | # it later. | ||
| MU4E = " | MU4E = " | ||
| + | EDITOR = " | ||
| }; | }; | ||
| Line 168: | Line 260: | ||
| ]; | ]; | ||
| modifier = " | modifier = " | ||
| - | keybindings = { | + | keybindings = let |
| - | | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | |
| - | " | + | # to the workspace, and one which moves the current |
| - | " | + | # container to the workspace: |
| - | " | + | bindings = lib.listToAttrs |
| - | " | + | (lib.concatMap (n: |
| + | let | ||
| + | ns = toString n; | ||
| + | in [ | ||
| + | { " | ||
| + | { " | ||
| + | ]) workspaces); | ||
| + | in | ||
| + | | ||
| + | bindings | ||
| + | { | ||
| + | | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | | ||
| - | # Brightness Controls | + | " |
| - | "XF86MonBrightnessDown" = "exec ${brightnessctl} s 10%-"; | + | "${modifier}+q" = "kill"; |
| - | "XF86MonBrightnessUp" = "exec ${brightnessctl} s +10%"; | + | "${modifier}+a" = "focus parent"; |
| + | "${modifier}+f" = "fullscreen toggle"; | ||
| + | "${modifier}+space" = " | ||
| + | " | ||
| - | | + | # Brightness Controls |
| - | " | + | " |
| - | " | + | " |
| - | " | + | |
| + | | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | |||
| + | # Launching | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | |||
| + | # Locking | ||
| + | " | ||
| + | } | ||
| + | ]; | ||
| - | # Launching | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | }; | ||
| input = { | input = { | ||
| " | " | ||
| Line 258: | Line 353: | ||
| ]; | ]; | ||
| events = { | events = { | ||
| - | " | + | |
| + | | ||
| + | " | ||
| }; | }; | ||
| + | }; | ||
| + | |||
| + | # Locks the screen when power button is pressed. | ||
| + | programs.swaylock = { | ||
| + | enable = true; | ||
| + | }; | ||
| + | |||
| + | # Displays notifications when called upon. | ||
| + | services.mako = { | ||
| + | enable = true; | ||
| + | settings = { | ||
| + | default-timeout = 5000; # 5 seconds. | ||
| + | }; | ||
| + | }; | ||
| + | |||
| + | programs.firefox = { | ||
| + | enable = true; | ||
| }; | }; | ||
| Line 287: | Line 401: | ||
| # $ nix search wget | # $ nix search wget | ||
| environment.systemPackages = with pkgs; [ | environment.systemPackages = with pkgs; [ | ||
| - | | + | |
| - | ]; | + | wl-clipboard |
| + | | ||
| + | | ||
| + | darktable | ||
| + | gphoto2 | ||
| - | | + | ## In Service of Emacs ########## |
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | + | # document viewer. | |
| - | | + | |
| - | # services.openssh.enable = true; | + | |
| - | + | | |
| - | | + | ]; |
| - | # networking.firewall.allowedTCPPorts = [ ... ]; | + | |
| - | | + | |
| - | # Or disable the firewall altogether. | + | |
| - | # networking.firewall.enable = false; | + | |
| # This value determines the NixOS release from which the default | # This value determines the NixOS release from which the default | ||
configuration.nix.1780353450.txt.gz · Last modified: by sam