arnaucube
arnaucube/configsPublic Self-hosted repository
configs/nixos/common-configuration.nix
nixos/common-configuration.nixRaw
  1# This file contains the config shared across different devices.
  2
  3{ pkgs, ... }:
  4
  5{
  6  # Set your time zone.
  7  time.timeZone = "Europe/Madrid";
  8
  9  # Select internationalisation properties.
 10  i18n.defaultLocale = "en_US.UTF-8";
 11
 12  i18n.extraLocaleSettings = {
 13    LC_ADDRESS = "es_ES.UTF-8";
 14    LC_IDENTIFICATION = "es_ES.UTF-8";
 15    LC_MEASUREMENT = "es_ES.UTF-8";
 16    LC_MONETARY = "es_ES.UTF-8";
 17    LC_NAME = "es_ES.UTF-8";
 18    LC_NUMERIC = "es_ES.UTF-8";
 19    LC_PAPER = "es_ES.UTF-8";
 20    LC_TELEPHONE = "es_ES.UTF-8";
 21    LC_TIME = "en_US.UTF-8";
 22  };
 23
 24  # Sway session managed by greetd.
 25  services.greetd = {
 26    enable = true;
 27    settings.default_session = {
 28      command = "${pkgs.tuigreet}/bin/tuigreet --time --remember --cmd sway";
 29      user = "greeter";
 30    };
 31  };
 32
 33  # Enable and unlock the GNOME Keyring through greetd's PAM session.
 34  services.gnome.gnome-keyring.enable = true;
 35  security.pam.services.greetd.enableGnomeKeyring = true;
 36
 37  programs.sway = {
 38    enable = true;
 39    wrapperFeatures.gtk = true;
 40  };
 41  security.polkit.enable = true;
 42
 43  # Minimal Sway sessions do not process XDG autostart entries, so start the
 44  # authentication agent explicitly with the graphical user session.
 45  systemd.user.services.polkit-gnome-authentication-agent = {
 46    description = "Polkit GNOME authentication agent";
 47    wantedBy = [ "graphical-session.target" ];
 48    partOf = [ "graphical-session.target"];
 49    after = [ "graphical-session.target" ];
 50    serviceConfig = {
 51      Type = "simple";
 52      ExecStart = "${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1";
 53      Restart = "on-failure";
 54    };
 55  };
 56
 57  # Automatically mount removable media while the graphical session is active.
 58  systemd.user.services.udiskie = {
 59    description = "Udiskie removable media automounter";
 60    wantedBy = [ "graphical-session.target" ];
 61    partOf = [ "graphical-session.target" ];
 62    after = [ "graphical-session.target" ];
 63    serviceConfig = {
 64      Type = "simple";
 65      ExecStart = "${pkgs.udiskie}/bin/udiskie --no-tray";
 66      Restart = "on-failure";
 67    };
 68  };
 69  environment.systemPackages = with pkgs; [
 70    # Sway utilities
 71    grim
 72    slurp
 73    wl-clipboard
 74    mako
 75
 76    # Utilities
 77    wget
 78    tmux
 79    git
 80    delta
 81    tig
 82    mosh
 83    bat
 84    ripgrep
 85    fzf
 86    htop
 87    jq
 88    unzip
 89    gnutar
 90    flameshot
 91    pulseaudio
 92    usbutils
 93    time
 94    fastfetch
 95    rpm
 96    pdfgrep
 97    keynav
 98    screenfetch
 99    libnotify
100    tree
101
102    # Editors and terminals
103    neovim
104    vim-full
105    alacritty
106    kitty
107
108    # Documents and file management
109    zathura
110    atril
111    lf
112    yazi
113    thunar
114    xfconf
115    ristretto
116    tumbler
117    thunar-volman
118    udiskie # auto-mount usb (needed for sway)
119    polkit_gnome # let unprivileged users mount filesystems
120
121    # Media
122    pavucontrol
123    mpv
124    vlc
125    feh
126    gimp
127    calibre
128    tauon
129    jellyfin-tui
130    kdePackages.kdenlive
131    libreoffice-qt6
132    ffmpeg
133    libavif # for converting avif imgs (for link2epub)
134
135    # Browsers
136    firefox
137    qutebrowser
138    chromium
139
140    # Development
141    texlive.combined.scheme-full
142    gnumake
143    gcc
144    clang
145    clang-tools
146    openssl
147    openssl.dev
148    glib
149    gdk-pixbuf
150    gtk3
151    atk
152    cairo
153    pango
154    pkg-config
155    cmake
156    rustup
157    wabt
158    wasmedge
159    sage
160    coq
161    coqPackages.mathcomp
162    opam
163    go
164    gopls
165    (python3.withPackages (ps: with ps; [
166      pynvim
167      matplotlib
168      numpy
169      meshtastic
170      esptool
171      unicodeit
172      setuptools
173      jupyterlab
174    ]))
175    nodejs
176    pnpm
177    elan
178
179    # Keyboard firmware
180    qmk
181    vial
182    via
183  ];
184  fonts.packages = with pkgs; [
185    dina-font
186    proggyfonts
187    terminus_font
188    fira-code
189    liberation_ttf
190    noto-fonts
191    tamsyn
192    termsyn
193    gohufont
194  ];
195
196  programs.zsh.enable = true;
197  users.defaultUserShell = pkgs.zsh;
198  environment.shells = [ pkgs.zsh ];
199
200  # Set the web browser and default PDF reader.
201  xdg.mime.enable = true;
202  environment.sessionVariables = {
203    BROWSER = "firefox";
204  };
205  xdg.mime.defaultApplications = {
206    "application/pdf" = "org.pwmt.zathura.desktop";
207    "text/html" = "firefox.desktop";
208    "x-scheme-handler/http" = "firefox.desktop";
209    "x-scheme-handler/https" = "firefox.desktop";
210  };
211
212  xdg.portal = {
213    enable = true;
214    xdgOpenUsePortal = true;
215    extraPortals = [ pkgs.xdg-desktop-portal-gtk ];
216
217    config.sway = {
218      default = "gtk";
219      "org.freedesktop.impl.portal.ScreenCast" = "wlr";
220      "org.freedesktop.impl.portal.Screenshot" = "wlr";
221    };
222  };
223
224  # gvfs needed for Thunar to detect external disks
225  services.gvfs.enable = true;
226
227  hardware.graphics.enable = true;
228
229  # bluetooth related
230  hardware.bluetooth.enable = true;
231  services.blueman.enable = true;
232
233  services.pipewire = {
234    enable = true;
235    alsa.enable = true;
236    alsa.support32Bit = true;
237    pulse.enable = true;
238    wireplumber.enable = true;
239    jack.enable = true;
240  };
241
242  # udev rules (for Vial)
243  services.udev.extraRules = ''
244    KERNEL=="hidraw*", SUBSYSTEM=="hidraw", ATTRS{idVendor}=="4653", ATTRS{idProduct}=="0001", MODE="0660", GROUP="users", TAG+="uaccess"
245  '';
246  services.udev.packages = [ pkgs.qmk-udev-rules ];
247
248  nix.settings.extra-experimental-features = [ "nix-command" "flakes" ];
249}