From 3b411b0c6d7b52997392383329fb826fa769790b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Eug=C3=AAnio?= Date: Mon, 27 May 2024 12:29:42 -0300 Subject: [PATCH] configuration: extract nixos config into more files --- system/bluetooth.nix | 14 +++++ system/configuration.nix | 120 +++------------------------------------ system/containers.nix | 11 ++++ system/fonts.nix | 9 +++ system/locale.nix | 12 ++++ system/network.nix | 24 ++++++++ system/sound.nix | 11 ++++ system/steam.nix | 3 + system/users.nix | 20 +++++++ 9 files changed, 111 insertions(+), 113 deletions(-) create mode 100644 system/bluetooth.nix create mode 100644 system/containers.nix create mode 100644 system/fonts.nix create mode 100644 system/locale.nix create mode 100644 system/network.nix create mode 100644 system/sound.nix create mode 100644 system/users.nix diff --git a/system/bluetooth.nix b/system/bluetooth.nix new file mode 100644 index 0000000..20eb72e --- /dev/null +++ b/system/bluetooth.nix @@ -0,0 +1,14 @@ +{ pkgs, ... }: { + services.blueman.enable = true; + hardware.bluetooth = { + enable = true; + settings = { + General = { + DiscoverableTimeout = 0; + # Discoverable = true; + AlwaysPairable = true; + }; + Policy = { AutoEnable = true; }; + }; + }; +} diff --git a/system/configuration.nix b/system/configuration.nix index e72bcff..130ca7d 100644 --- a/system/configuration.nix +++ b/system/configuration.nix @@ -9,6 +9,13 @@ ./boot.nix ./thunar.nix ./nix.nix + ./fonts.nix + ./sound.nix + ./bluetooth.nix + ./locale.nix + ./users.nix + ./containers.nix + ./network.nix ]; boot.kernelPackages = pkgs.linuxPackages_latest; @@ -18,108 +25,9 @@ programs.adb.enable = true; services.udev.packages = [ pkgs.android-udev-rules ]; - # 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; - # Open kde connect ports - programs.kdeconnect.enable = true; - - # Set your time zone. - time.timeZone = "America/Sao_Paulo"; - environment.variables.TZ = config.time.timeZone; - # Select internationalisation properties. - i18n.defaultLocale = "pt_BR.utf8"; - - # Enable the GNOME Desktop Environment. - # services.xserver.displayManager.gdm.enable = true; - # services.xserver.desktopManager.gnome.enable = true; - # services.xserver.displayManager.autologin.user = "lelgenio"; - - # Configure keymap in X11 - services.xserver.xkb = { - layout = "us"; - variant = "colemak"; - }; - console.keyMap = "colemak"; - # Enable CUPS to print documents. - # services.printing.enable = true; - services.flatpak.enable = true; - virtualisation.docker.enable = true; - virtualisation.docker.autoPrune.enable = true; - virtualisation.docker.autoPrune.dates = "monthly"; - virtualisation.docker.autoPrune.flags = [ "--all --volumes" ]; - - programs.extra-container.enable = true; - - programs.firejail.enable = true; - - security.rtkit.enable = true; - services.openssh = { - enable = true; - ports = [ 9022 ]; - settings = { - PermitRootLogin = "no"; - PasswordAuthentication = false; - KbdInteractiveAuthentication = false; - }; - }; - # programs.ssh = { - # startAgent = true; - # extraConfig = '' - # AddKeysToAgent yes - # ''; - # }; - - ## Enable sound with pipewire. - sound.enable = true; - hardware.pulseaudio.enable = false; - services.pipewire = { - enable = true; - wireplumber.enable = true; - pulse.enable = true; - alsa.enable = true; - jack.enable = true; - }; - - services.blueman.enable = true; - hardware.bluetooth = { - enable = true; - settings = { - General = { - DiscoverableTimeout = 0; - # Discoverable = true; - AlwaysPairable = true; - }; - Policy = { AutoEnable = true; }; - }; - }; - # Enable touchpad support (enabled default in most desktopManager). services.libinput.enable = true; - # Define a user account. Don't forget to set a password with ‘passwd’. - users.mutableUsers = false; - users.users.lelgenio = { - isNormalUser = true; - description = "Leonardo Eugênio"; - hashedPassword = "$y$j9T$0e/rczjOVCy7PuwC3pG0V/$gTHZhfO4wQSlFvbDyfghbCnGI2uDI0a52zSrQ/yOA5A"; - extraGroups = [ "networkmanager" "wheel" "docker" "adbusers" "bluetooth" "corectrl" "vboxusers" ]; - shell = pkgs.fish; - openssh.authorizedKeys.keys = [ - "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCxR/w+38b2lX90yNBqhq3mUmkn1WGu6GAPhN1tVp2ZjYRJNV/+5gWCnTtOWYtDx35HmK/spQ2Qy8X9ttkzORa24fysNx1Iqn/TiXhD7eIJjbGPnrOpIKTkW5/uB3SD/P5NBSa06//BaqJU4sBlG79hoXRpod052hQtdpTVDiMCIV+iboWPKqopmJJfWdBtVnHXs9rep0htPRExxGslImFk7Z6xjcaHyCpIQZPlOGf+sGsmUU7jRqzvZFV8ucIdbnAlMHrU4pepNFhuraESyZVTa/bi9sw0iozXp5Q5+5thMebEslmT1Z771kI4sieDy+O4r8c0Sx2/VY1UAzcpq1faggc3YB01MTh+tiEC6xdMvZLrQGL1NBWjHleMyL53GU5ERluC0vXJF3Hv3BGGBDfXWbrEm5n06DHr2apRVJGC0LwiQ7Woud1X4V4X1pKSusxCVMjT2lmcOwV6YhKhB2sowJc1OdMx4+tL0UWE+YKSZgBHfolwk6ml0F4EO9nnUHc= lelgenio@i15" - ]; - }; - users.users.root.initialHashedPassword = "$y$j9T$E3aBBSSq0Gma8hZD9L7ov0$iCGDW4fqrXWfHO0qodBYYgMFA9CpIraoklHcPbJJrM3"; - - # services.getty.autologinUser = "lelgenio"; - programs.fish.enable = true; - - programs.dzgui.enable = true; - programs.dzgui.package = inputs.dzgui-nix.packages.${pkgs.system}.default; - packages.media-packages.enable = true; environment.systemPackages = with pkgs; [ pavucontrol @@ -130,21 +38,7 @@ gnome3.adwaita-icon-theme # default gnome cursors ]; - fonts.enableDefaultPackages = true; - fonts.packages = with pkgs; [ - noto-fonts - noto-fonts-cjk - noto-fonts-emoji - nerdfonts_fira_hack - ]; - services.geoclue2.enable = true; - # programs.qt5ct.enable = true; - # Some programs need SUID wrappers, can be configured further or are - # started in user sessions. - # programs.mtr.enable = true; - services.pcscd.enable = true; - security.sudo.wheelNeedsPassword = false; systemd.extraConfig = '' DefaultTimeoutStopSec=10s diff --git a/system/containers.nix b/system/containers.nix new file mode 100644 index 0000000..c2c2941 --- /dev/null +++ b/system/containers.nix @@ -0,0 +1,11 @@ +{ pkgs, ... }: { + services.flatpak.enable = true; + virtualisation.docker.enable = true; + virtualisation.docker.autoPrune.enable = true; + virtualisation.docker.autoPrune.dates = "monthly"; + virtualisation.docker.autoPrune.flags = [ "--all --volumes" ]; + + programs.extra-container.enable = true; + + programs.firejail.enable = true; +} diff --git a/system/fonts.nix b/system/fonts.nix new file mode 100644 index 0000000..e6d4ccd --- /dev/null +++ b/system/fonts.nix @@ -0,0 +1,9 @@ +{ pkgs, ... }: { + fonts.enableDefaultPackages = true; + fonts.packages = with pkgs; [ + noto-fonts + noto-fonts-cjk + noto-fonts-emoji + nerdfonts_fira_hack + ]; +} diff --git a/system/locale.nix b/system/locale.nix new file mode 100644 index 0000000..bb344c7 --- /dev/null +++ b/system/locale.nix @@ -0,0 +1,12 @@ +{ pkgs, config, ... }: { + time.timeZone = "America/Sao_Paulo"; + environment.variables.TZ = config.time.timeZone; + i18n.defaultLocale = "pt_BR.utf8"; + + # Configure keymap in X11 + services.xserver.xkb = { + layout = "us"; + variant = "colemak"; + }; + console.keyMap = "colemak"; +} diff --git a/system/network.nix b/system/network.nix new file mode 100644 index 0000000..c8ebdd9 --- /dev/null +++ b/system/network.nix @@ -0,0 +1,24 @@ +{ pkgs, ... }: { + # 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; + # Open kde connect ports + programs.kdeconnect.enable = true; + + # Enable CUPS to print documents. + # services.printing.enable = true; + + security.rtkit.enable = true; + services.openssh = { + enable = true; + ports = [ 9022 ]; + settings = { + PermitRootLogin = "no"; + PasswordAuthentication = false; + KbdInteractiveAuthentication = false; + }; + }; +} diff --git a/system/sound.nix b/system/sound.nix new file mode 100644 index 0000000..3cdbf58 --- /dev/null +++ b/system/sound.nix @@ -0,0 +1,11 @@ +{ pkgs, ... }: { + sound.enable = true; + hardware.pulseaudio.enable = false; + services.pipewire = { + enable = true; + wireplumber.enable = true; + pulse.enable = true; + alsa.enable = true; + jack.enable = true; + }; +} diff --git a/system/steam.nix b/system/steam.nix index 3a60930..ce94c3d 100644 --- a/system/steam.nix +++ b/system/steam.nix @@ -17,4 +17,7 @@ protontricks bottles ]; + + programs.dzgui.enable = true; + programs.dzgui.package = inputs.dzgui-nix.packages.${pkgs.system}.default; } diff --git a/system/users.nix b/system/users.nix new file mode 100644 index 0000000..2334897 --- /dev/null +++ b/system/users.nix @@ -0,0 +1,20 @@ +{ pkgs, ... }: { + security.sudo.wheelNeedsPassword = false; + + # services.getty.autologinUser = "lelgenio"; + programs.fish.enable = true; + + # Define a user account. Don't forget to set a password with ‘passwd’. + users.mutableUsers = false; + users.users.lelgenio = { + isNormalUser = true; + description = "Leonardo Eugênio"; + hashedPassword = "$y$j9T$0e/rczjOVCy7PuwC3pG0V/$gTHZhfO4wQSlFvbDyfghbCnGI2uDI0a52zSrQ/yOA5A"; + extraGroups = [ "networkmanager" "wheel" "docker" "adbusers" "bluetooth" "corectrl" "vboxusers" ]; + shell = pkgs.fish; + openssh.authorizedKeys.keys = [ + "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCxR/w+38b2lX90yNBqhq3mUmkn1WGu6GAPhN1tVp2ZjYRJNV/+5gWCnTtOWYtDx35HmK/spQ2Qy8X9ttkzORa24fysNx1Iqn/TiXhD7eIJjbGPnrOpIKTkW5/uB3SD/P5NBSa06//BaqJU4sBlG79hoXRpod052hQtdpTVDiMCIV+iboWPKqopmJJfWdBtVnHXs9rep0htPRExxGslImFk7Z6xjcaHyCpIQZPlOGf+sGsmUU7jRqzvZFV8ucIdbnAlMHrU4pepNFhuraESyZVTa/bi9sw0iozXp5Q5+5thMebEslmT1Z771kI4sieDy+O4r8c0Sx2/VY1UAzcpq1faggc3YB01MTh+tiEC6xdMvZLrQGL1NBWjHleMyL53GU5ERluC0vXJF3Hv3BGGBDfXWbrEm5n06DHr2apRVJGC0LwiQ7Woud1X4V4X1pKSusxCVMjT2lmcOwV6YhKhB2sowJc1OdMx4+tL0UWE+YKSZgBHfolwk6ml0F4EO9nnUHc= lelgenio@i15" + ]; + }; + users.users.root.initialHashedPassword = "$y$j9T$E3aBBSSq0Gma8hZD9L7ov0$iCGDW4fqrXWfHO0qodBYYgMFA9CpIraoklHcPbJJrM3"; +}