nixos-config/system/configuration.nix

202 lines
7.3 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
# bash script to let dbus know about important env variables and
# 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 {
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
gsettings set $gnome_schema gtk-theme 'Dracula'
2022-07-15 22:03:57 -03:00
'';
2022-06-12 23:47:05 -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";
# 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-16 14:24:09 -03:00
services.greetd = let
swayConfig = pkgs.writeText "greetd-sway-config" ''
# `-l` activates layer-shell mode. Notice that `swaymsg exit` will run after gtkgreet.
exec "${pkgs.greetd.gtkgreet}/bin/gtkgreet -l -c sway; swaymsg exit"
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
extraPortals = [ pkgs.xdg-desktop-portal-gtk ];
gtkUsePortal = true;
};
2022-06-09 23:16:20 -03:00
services.flatpak.enable = true;
2022-06-05 01:43:16 -03:00
virtualisation.docker.enable = true;
# Enable sound with pipewire.
sound.enable = true;
hardware.pulseaudio.enable = true;
security.rtkit.enable = true;
services.pipewire.enable = true;
# 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";
extraGroups = [ "networkmanager" "wheel" "docker"];
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";
};
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
# vim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
# wget
git
2022-07-16 02:12:18 -03:00
pinentry-curses
2022-06-05 01:43:16 -03:00
firefox
vscode
micro
fd
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
configure-gtk
wayland
glib # gsettings
dracula-theme # gtk theme
gnome3.adwaita-icon-theme # default gnome cursors
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-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-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-06-05 01:43:16 -03:00
nix = {
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-16 02:12:18 -03:00
}