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