diff options
Diffstat (limited to 'nixos/configuration.nix')
-rw-r--r-- | nixos/configuration.nix | 310 |
1 files changed, 310 insertions, 0 deletions
diff --git a/nixos/configuration.nix b/nixos/configuration.nix new file mode 100644 index 0000000..3d1dfb6 --- /dev/null +++ b/nixos/configuration.nix @@ -0,0 +1,310 @@ +# 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`). + +{ hostname, username, config, pkgs, ... }: + +let + dmenu-src = builtins.fetchTarball "https://git.jptrzy.xyz/dmenu/snapshot/master.tar.gz"; + #dwm-src = builtins.fetchTarball "https://git.jptrzy.xyz/dwm/snapshot/master.tar.gz"; + dwmblocks-src = builtins.fetchTarball "https://git.jptrzy.xyz/dwmblocks/snapshot/master.tar.gz"; + neo-comic-mono-font = builtins.fetchTarball "https://git.jptrzy.xyz/neo-comic-mono-font/snapshot/master.tar.gz"; + sent-src = builtins.fetchTarball "https://git.jptrzy.xyz/sent/snapshot/master.tar.gz"; + slock-src = builtins.fetchTarball "https://git.jptrzy.xyz/slock/snapshot/master.tar.gz"; + + dwm-src = /home/${username}/.local/src/dwm; +in { + system.stateVersion = "23.05"; # Did you read the comment? + + nixpkgs.config.allowUnfree = true; + + nix.extraOptions = '' + experimental-features = nix-command flakes + ''; + nix.gc.automatic = true; + + imports = [ + # Include the results of the hardware scan. + ./hardware-configuration.nix + + # Autologin on tty1 + ./autologin.nix + ]; + + nixpkgs.config.packageOverrides = pkgs: { + nur = import (builtins.fetchTarball "https://github.com/nix-community/NUR/archive/master.tar.gz") { + inherit pkgs; + }; + + vaapiIntel = pkgs.vaapiIntel.override { enableHybridCodec = true; }; + angband = pkgs.angband.override { + enableSdl2 = true; + }; + }; + + security.pam.services."${username}".enableGnomeKeyring = true; + security.wrappers = { + slock = { + owner = "root"; group = "root"; + setuid = true; + source = "${pkgs.slock}/bin/slock"; + }; + }; + +# BootLoader + + boot = { + # Decrypt LUKS Partition before accessing LVM(s) partitions + initrd.luks.devices = { + root = { + device = "/dev/sda2"; + preLVM = true; + }; + }; + + # Use the systemd-boot EFI boot loader. + loader = { + systemd-boot = { + enable = true; + configurationLimit = 3; + }; + + efi.canTouchEfiVariables = true; + }; + }; + +# System + + # Set your time zone. + time.timeZone = "Europe/Warsaw"; + + users.groups."${username}" = {}; + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.users."${username}" = { + createHome = true; + isNormalUser = true; + extraGroups = [ "${username}" "wheel" "video" "audio" "disk" "networkmanager" ]; # Enable ‘sudo’ for the user. + group = "users"; + home = "/home/${username}"; + uid = 1000; + }; + + # Network + networking = { + hostName = "${hostname}"; # Define your hostname. + networkmanager.enable = true; # Easiest to use and most distros use this by default. + }; + + # Enable sound. + sound.enable = true; + + hardware = { + bluetooth = { + enable = true; + settings = { + General = { + Enable = "Source,Sink,Media,Socket"; + }; + }; + }; + + pulseaudio = { + enable = true; + package = pkgs.pulseaudioFull; + extraConfig = " + load-module module-switch-on-connect + "; + }; + + opengl = { + enable = true; + extraPackages = with pkgs; [ + intel-media-driver # LIBVA_DRIVER_NAME=iHD + vaapiIntel # LIBVA_DRIVER_NAME=i965 (older but works better for Firefox/Chromium) + vaapiVdpau + libvdpau-va-gl + libGL + ]; + setLdLibraryPath = true; + }; + }; + + services = { + logind.extraConfig = '' + HandleLidSwitch=suspend + ''; + + xserver = { # Enable the X11 windowing system. + enable = true; + + layout = "pl"; + xkbOptions = "caps:escape"; + + displayManager.sx.enable = true; + windowManager.dwm.enable = true; + + libinput = { + enable = true; + touchpad = { + naturalScrolling = true; + clickMethod = "none"; + tapping = false; + }; + }; + }; + + #printing = { + # enable = true; + # drivers = [ + # pkgs.hplip + # pkgs.hplipWithPlugin + # ]; + #}; + + avahi = { + enable = true; + nssmdns = true; + openFirewall = true; + }; + + auto-cpufreq.enable = true; # Helps battery life + + flatpak.enable = true; + + gvfs.enable = true; # Gvfs - Trash and MTP (Smartphones) + + dbus.enable = true; + }; + +# Services + + # PinEntry for GnuPG + programs.gnupg.agent = { + enable = true; + pinentryFlavor = "gnome3"; + enableSSHSupport = true; + }; + + # Portals + xdg.portal.enable = true; + xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-gtk ]; + +# Programs + # Enable Sceen Brightness + programs.light.enable = true; + + programs.system-config-printer.enable = true; + + # Fonts + fonts.fonts = with pkgs; [ + noto-fonts + noto-fonts-cjk + noto-fonts-emoji + + font-awesome + + # Custom + (import "${neo-comic-mono-font}") + ]; + + # Gaming + programs.steam = { + enable = true; + remotePlay.openFirewall = true; # Open ports in the firewall for Steam Remote Play + dedicatedServer.openFirewall = true; # Open ports in the firewall for Source Dedicated Server + }; + + # Suckless Overlays + nixpkgs.overlays = [ + (final: prev: { + dmenu = prev.dmenu.overrideAttrs (old: { src = dmenu-src; }); + dwm = prev.dwm.overrideAttrs (old: { src = dwm-src; }); + dwmblocks = prev.dwmblocks.overrideAttrs (old: { src = dwmblocks-src; }); + sent = prev.dwm.overrideAttrs (old: { src = sent-src; }); + slock = prev.slock.overrideAttrs (old: { + src = slock-src; + buildInputs = with pkgs; [ + xorg.libXinerama + xorg.libXft + imlib2 + ] ++ old.buildInputs; + }); + }) + ]; + +# List packages installed in system profile. To search, run: + environment.binsh = "${pkgs.dash}/bin/dash"; + + # $ nix search wget + environment.systemPackages = with pkgs; [ + #(import /home/.../.local/src/slock/default.nix { + # inherit fetchurl lib stdenv writeText; + # inherit libxcrypt; + # inherit (xorg) xorgproto libX11 libXext libXrandr; + #}) + neovim + git + wget + htop + gnumake + gcc + gnupg + pass + killall + shellcheck + + # Window Manager + cmus + dconf + dmenu dwm dwmblocks slock + xclip + nsxiv + zathura + + pinentry-gnome gcr pinentry-gtk2 + + # Heavy + lazygit + alacritty + firefox + gnome.nautilus + pika-backup + pavucontrol + logseq + heroic + lxappearance + fontpreview + ffmpeg + mpv + thunderbird + signal-desktop + w3m + texlive.combined.scheme-full + yt-dlp + curl + ueberzug + libnotify + abaddon # Discord + inkscape gimp krita + cups + arandr + monero-gui + sent + xautolock + fragments # Torrent client + + # Gnome Apps without Gnome + gnome.adwaita-icon-theme libsecret gnome.seahorse + + # Lanuguages + nil nix-index + + # Games + #angband + #nethack + #openttd + dolphin-emu + ]; +} + |