nixos-config/system/configuration.nix

263 lines
9 KiB
Nix
Raw Normal View History

2022-06-05 01:43:16 -03:00
# 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).
{ config, pkgs, ... }:
2022-06-12 23:47:05 -03:00
let
2022-07-21 00:32:09 -03:00
# bash script to let dbus know about important env variables and
2022-06-12 23:47:05 -03:00
# propogate them to relevent services run at the end of sway config
# see
# https://github.com/emersion/xdg-desktop-portal-wlr/wiki/"It-doesn't-work"-Troubleshooting-Checklist
2022-07-16 02:12:18 -03:00
# note: this is pretty much the same as /etc/sway/config.d/nixos.conf but also restarts
2022-06-12 23:47:05 -03:00
# some user services to make sure they have the correct environment variables
dbus-sway-environment = pkgs.writeTextFile {
name = "dbus-sway-environment";
destination = "/bin/dbus-sway-environment";
executable = true;
text = ''
2022-07-15 22:03:57 -03:00
dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=sway
systemctl --user stop pipewire pipewire-media-session xdg-desktop-portal xdg-desktop-portal-wlr
systemctl --user start pipewire pipewire-media-session xdg-desktop-portal xdg-desktop-portal-wlr
'';
2022-06-12 23:47:05 -03:00
};
# currently, there is some friction between sway and gtk:
# https://github.com/swaywm/sway/wiki/GTK-3-settings-on-Wayland
# the suggested way to set gtk settings is with gsettings
# for gsettings to work, we need to tell it where the schemas are
# using the XDG_DATA_DIR environment variable
# run at the end of sway config
configure-gtk = pkgs.writeTextFile {
2022-07-21 00:32:09 -03:00
name = "configure-gtk";
destination = "/bin/configure-gtk";
executable = true;
text = let
schema = pkgs.gsettings-desktop-schemas;
datadir = "${schema}/share/gsettings-schemas/${schema.name}";
in ''
export XDG_DATA_DIRS=${datadir}:$XDG_DATA_DIRS
gnome_schema=org.gnome.desktop.interface
2022-08-01 20:15:26 -03:00
# gsettings set $gnome_schema gtk-theme 'Dracula'
2022-07-21 00:32:09 -03:00
'';
2022-06-12 23:47:05 -03:00
};
2022-07-21 00:32:09 -03:00
in {
2022-06-05 01:43:16 -03:00
# Bootloader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
boot.loader.efi.efiSysMountPoint = "/boot/efi";
2022-08-06 18:32:34 -03:00
boot.kernel.sysctl = {
"vm.max_map_count" = 1048576; # Needed by DayZ
};
2022-08-20 15:22:48 -03:00
programs.adb.enable = true;
2022-08-30 22:01:06 -03:00
services.udev.packages = [ pkgs.android-udev-rules ];
2022-08-20 15:22:48 -03:00
2022-06-05 01:43:16 -03:00
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# Enable networking
networking.networkmanager.enable = true;
# Set your time zone.
time.timeZone = "America/Sao_Paulo";
# Select internationalisation properties.
i18n.defaultLocale = "pt_BR.utf8";
# Enable the X11 windowing system.
2022-07-16 02:12:18 -03:00
services.xserver.enable = false;
2022-06-05 01:43:16 -03:00
# Enable the GNOME Desktop Environment.
2022-06-12 23:47:05 -03:00
# services.xserver.displayManager.gdm.enable = true;
2022-06-13 09:45:20 -03:00
# services.xserver.desktopManager.gnome.enable = true;
2022-07-15 22:03:57 -03:00
# services.xserver.displayManager.autologin.user = "lelgenio";
2022-07-21 00:32:09 -03:00
services.greetd = let
2022-08-05 22:43:31 -03:00
greetd_main_script = pkgs.writeShellScriptBin "main" ''
${dbus-sway-environment}/bin/dbus-sway-environment
${configure-gtk}/bin/configure-gtk
export XDG_CURRENT_DESKTOP=sway GTK_THEME=Orchis-Red-Dark-Compact
${pkgs.greetd.gtkgreet}/bin/gtkgreet -l -c sway
swaymsg exit
'';
2022-07-16 14:24:09 -03:00
swayConfig = pkgs.writeText "greetd-sway-config" ''
# `-l` activates layer-shell mode. Notice that `swaymsg exit` will run after gtkgreet.
2022-08-05 22:43:31 -03:00
exec "${greetd_main_script}/bin/main"
2022-07-16 14:24:09 -03:00
bindsym Mod4+shift+e exec swaynag \
-t warning \
-m 'What do you want to do?' \
-b 'Poweroff' 'systemctl poweroff' \
-b 'Reboot' 'systemctl reboot'
input "*" {
repeat_delay 200
repeat_rate 30
xkb_layout us(colemak)
xkb_numlock enabled
xkb_options lv3:lsgt_switch,grp:shifts_toggle
}
'';
in {
enable = true;
settings = {
initial_session = {
command = "${pkgs.sway}/bin/sway";
user = "lelgenio";
};
default_session = {
command = "${pkgs.sway}/bin/sway --config ${swayConfig}";
};
};
};
2022-06-05 01:43:16 -03:00
# Configure keymap in X11
services.xserver = {
layout = "us";
xkbVariant = "colemak";
};
2022-07-15 22:03:57 -03:00
console.keyMap = "colemak";
2022-06-05 01:43:16 -03:00
# Enable CUPS to print documents.
2022-06-09 23:16:20 -03:00
# services.printing.enable = true;
2022-06-13 09:45:20 -03:00
services.dbus.enable = true;
xdg.portal = {
enable = true;
wlr.enable = true;
# gtk portal needed to make gtk apps happy
2022-07-31 18:09:47 -03:00
# extraPortals = [ pkgs.xdg-desktop-portal-gtk ];
# gtkUsePortal = false;
2022-06-13 09:45:20 -03:00
};
2022-06-09 23:16:20 -03:00
services.flatpak.enable = true;
2022-06-05 01:43:16 -03:00
virtualisation.docker.enable = true;
2022-08-07 15:12:25 -03:00
security.rtkit.enable = true;
2022-10-10 21:01:43 -03:00
services.sshd.enable = true;
2022-08-07 15:12:25 -03:00
## Enable sound with pipewire.
2022-06-05 01:43:16 -03:00
sound.enable = true;
2022-07-19 21:55:17 -03:00
# hardware.pulseaudio.enable = true;
2022-08-07 15:12:25 -03:00
services.pipewire = {
enable = true;
wireplumber.enable = true;
pulse.enable = true;
alsa.enable = true;
jack.enable = true;
};
2022-06-05 01:43:16 -03:00
# Enable touchpad support (enabled default in most desktopManager).
2022-06-09 23:16:20 -03:00
services.xserver.libinput.enable = true;
2022-06-05 01:43:16 -03:00
# Define a user account. Don't forget to set a password with passwd.
users.users.lelgenio = {
isNormalUser = true;
description = "Leonardo Eugênio";
2022-08-20 15:22:48 -03:00
extraGroups = [ "networkmanager" "wheel" "docker" "adbusers" ];
2022-06-05 01:43:16 -03:00
shell = pkgs.fish;
};
2022-07-16 14:24:09 -03:00
# services.getty.autologinUser = "lelgenio";
2022-06-05 01:43:16 -03:00
programs.fish.enable = true;
services.syncthing = {
enable = true;
user = "lelgenio";
dataDir = "/home/lelgenio/";
configDir = "/home/lelgenio/.config/syncthing";
};
2022-07-18 23:45:04 -03:00
# TODO: enable thunar plugins
# programs.thunar.enable = true;
# programs.thunar.plugins = with pkgs.xfce; [ thunar-archive-plugin thunar-volman ];
services.gvfs.enable = true; # Mount, trash, and other functionalities
services.tumbler.enable = true; # Thumbnail support for images
2022-06-05 01:43:16 -03:00
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
2022-07-21 00:32:09 -03:00
# vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
# wget
2022-06-05 01:43:16 -03:00
git
2022-07-16 02:12:18 -03:00
pinentry-curses
2022-06-05 01:43:16 -03:00
firefox
vscode
micro
fd
2022-08-30 22:19:40 -03:00
du-dust
2022-06-12 23:47:05 -03:00
kakoune
kak-lsp
2022-06-13 09:45:20 -03:00
pavucontrol
2022-06-13 10:34:47 -03:00
tdesktop
2022-06-12 23:47:05 -03:00
# recomended by nixwiki
alacritty # gpu accelerated terminal
sway
dbus-sway-environment
2022-08-01 20:15:26 -03:00
pkgs.xdg-desktop-portal
pkgs.xdg-desktop-portal-wlr
2022-06-12 23:47:05 -03:00
configure-gtk
wayland
glib # gsettings
2022-09-26 22:12:56 -03:00
usbutils
2022-08-01 20:15:26 -03:00
# dracula-theme # gtk theme
2022-07-21 00:32:09 -03:00
gnome3.adwaita-icon-theme # default gnome cursors
2022-06-12 23:47:05 -03:00
swaylock
swayidle
grim # screenshot functionality
slurp # screenshot functionality
wl-clipboard # wl-copy and wl-paste for copy/paste from stdin / stdout
bemenu # wayland clone of dmenu
mako # notification system developed by swaywm maintainer
2022-06-13 22:21:47 -03:00
(orchis-theme.override { tweaks = [ "compact" "solid" ]; })
2022-07-19 21:55:17 -03:00
pulseaudio
2022-08-01 23:00:36 -03:00
docker-compose
gnumake
mariadb
php74
2022-09-23 20:03:37 -03:00
nodePackages.intelephense
2022-10-04 11:56:29 -03:00
nodePackages.typescript-language-server
2022-08-03 11:56:30 -03:00
nodejs
nodePackages.yarn
nodePackages.less
nodePackages.less-plugin-clean-css
nodePackages.uglify-js
2022-08-08 19:38:58 -03:00
trunk
wasm-bindgen-cli
nodePackages.sass
2022-06-05 01:43:16 -03:00
];
2022-06-13 09:45:20 -03:00
# enable sway window manager
programs.sway = {
enable = true;
wrapperFeatures.gtk = true;
};
2022-07-21 01:04:22 -03:00
services.geoclue2.enable = true;
2022-07-21 00:29:12 -03:00
# programs.qt5ct.enable = true;
2022-07-20 00:14:01 -03:00
programs.steam.enable = true;
2022-06-05 01:43:16 -03:00
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
# programs.mtr.enable = true;
services.pcscd.enable = true;
programs.gnupg.agent = {
enable = true;
enableSSHSupport = true;
pinentryFlavor = "curses";
};
# List services that you want to enable:
# Enable the OpenSSH daemon.
# services.openssh.enable = true;
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
2022-06-09 23:16:20 -03:00
networking.firewall.enable = false;
2022-07-20 19:48:29 -03:00
security.sudo.wheelNeedsPassword = false;
2022-06-05 01:43:16 -03:00
nix = {
2022-08-20 17:46:03 -03:00
settings = {
2022-10-12 18:10:07 -03:00
substituters = [ "https://hyprland.cachix.org" "https://lelgenio.cachix.org" ];
2022-08-30 22:01:06 -03:00
trusted-public-keys = [
"hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
2022-10-12 18:10:07 -03:00
"lelgenio.cachix.org-1:W8tMlmDFLU/V+6DlChXjekxoHZpjgVHZpmusC4cueBc="
2022-08-30 22:01:06 -03:00
];
2022-08-20 17:46:03 -03:00
};
2022-06-05 01:43:16 -03:00
package = pkgs.nixFlakes; # or versioned attributes like nixVersions.nix_2_8
extraOptions = ''
experimental-features = nix-command flakes
'';
};
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. Its perfectly fine and recommended to leavecatenate(variables, "bootdev", bootdev)
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "22.05"; # Did you read the comment?
2022-07-21 00:32:09 -03:00
}