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
100    # Editors and terminals
101    neovim
102    vim-full
103    alacritty
104    kitty
105
106    # Documents and file management
107    zathura
108    atril
109    lf
110    yazi
111    thunar
112    xfconf
113    ristretto
114    tumbler
115    thunar-volman
116    udiskie # auto-mount usb (needed for sway)
117    polkit_gnome # let unprivileged users mount filesystems
118
119    # Media
120    pavucontrol
121    mpv
122    vlc
123    feh
124    gimp
125    calibre
126    tauon
127    kdePackages.kdenlive
128    libreoffice-qt6
129    ffmpeg
130
131    # Browsers
132    firefox
133    qutebrowser
134    chromium
135
136    # Development
137    texlive.combined.scheme-full
138    gnumake
139    gcc
140    clang
141    clang-tools
142    openssl
143    openssl.dev
144    glib
145    gdk-pixbuf
146    gtk3
147    atk
148    cairo
149    pango
150    pkg-config
151    cmake
152    rustup
153    wabt
154    wasmedge
155    sage
156    coq
157    coqPackages.mathcomp
158    opam
159    go
160    (python3.withPackages (ps: with ps; [
161      matplotlib
162      numpy
163      meshtastic
164      esptool
165      unicodeit
166      setuptools
167      jupyterlab
168    ]))
169    nodejs
170    pnpm
171    elan
172
173    # Keyboard firmware
174    qmk
175    vial
176    via
177  ];
178  fonts.packages = with pkgs; [
179    dina-font
180    proggyfonts
181    terminus_font
182    fira-code
183    liberation_ttf
184    noto-fonts
185    tamsyn
186    termsyn
187    gohufont
188  ];
189
190  programs.zsh.enable = true;
191  users.defaultUserShell = pkgs.zsh;
192  environment.shells = [ pkgs.zsh ];
193
194  # Set the web browser and default PDF reader.
195  xdg.mime.enable = true;
196  environment.sessionVariables = {
197    BROWSER = "firefox";
198  };
199  xdg.mime.defaultApplications = {
200    "application/pdf" = "org.pwmt.zathura.desktop";
201    "text/html" = "firefox.desktop";
202    "x-scheme-handler/http" = "firefox.desktop";
203    "x-scheme-handler/https" = "firefox.desktop";
204  };
205
206  xdg.portal = {
207    enable = true;
208    xdgOpenUsePortal = true;
209    extraPortals = [ pkgs.xdg-desktop-portal-gtk ];
210
211    config.sway = {
212      default = "gtk";
213      "org.freedesktop.impl.portal.ScreenCast" = "wlr";
214      "org.freedesktop.impl.portal.Screenshot" = "wlr";
215    };
216  };
217
218  # gvfs needed for Thunar to detect external disks
219  services.gvfs.enable = true;
220
221  hardware.graphics.enable = true;
222
223  # bluetooth related
224  hardware.bluetooth.enable = true;
225  services.blueman.enable = true;
226
227  services.pipewire = {
228    enable = true;
229    alsa.enable = true;
230    alsa.support32Bit = true;
231    pulse.enable = true;
232    wireplumber.enable = true;
233    jack.enable = true;
234  };
235
236  # udev rules (for Vial)
237  services.udev.extraRules = ''
238    KERNEL=="hidraw*", SUBSYSTEM=="hidraw", ATTRS{idVendor}=="4653", ATTRS{idProduct}=="0001", MODE="0660", GROUP="users", TAG+="uaccess"
239  '';
240  services.udev.packages = [ pkgs.qmk-udev-rules ];
241
242  nix.settings.extra-experimental-features = [ "nix-command" "flakes" ];
243}