From f7b9c710063510f8f9400b085b3f08c3a5a394fd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Eug=C3=AAnio?= Date: Mon, 7 Nov 2022 11:24:40 -0300 Subject: [PATCH] support for gnome desktop --- flake.nix | 13 +++--- hosts/monolith.nix | 4 +- hosts/pixie.nix | 41 +++++++++---------- hosts/rainbow.nix | 55 ++++++++++++------------- overlays/default.nix | 84 +++++++++++++++++++-------------------- scripts/default.nix | 4 +- system/configuration.nix | 10 ++--- system/gnome.nix | 16 ++++++++ system/media-packages.nix | 3 +- system/sway.nix | 4 ++ user/chat.nix | 4 +- user/firefox.nix | 16 ++++---- user/fzf.nix | 14 +++---- user/home.nix | 9 ++--- user/sway.nix | 1 + user/theme.nix | 16 ++++---- user/variables.nix | 1 + user/waybar.nix | 3 +- 18 files changed, 155 insertions(+), 143 deletions(-) create mode 100644 system/gnome.nix diff --git a/flake.nix b/flake.nix index acd4a35..3936d81 100644 --- a/flake.nix +++ b/flake.nix @@ -35,6 +35,7 @@ }; outputs = inputs@{ nixpkgs, nixpkgs-unstable, home-manager, nur, ... }: let + inherit (import ./user/variables.nix) desktop; system = "x86_64-linux"; pkgs = import nixpkgs { inherit system; @@ -43,14 +44,13 @@ lib = nixpkgs.lib; common_modules = [ ./system/configuration.nix - ./system/sway.nix # nur.nixosModules.nur inputs.hyprland.nixosModules.default { programs.hyprland.enable = true; # programs.hyprland.package = null; } - (import ./overlays (inputs // {inherit system;})) + (import ./overlays (inputs // { inherit system; })) home-manager.nixosModules.home-manager { home-manager.useGlobalPkgs = true; @@ -61,7 +61,8 @@ # arguments to home.nix home-manager.extraSpecialArgs = { inherit inputs; }; } - ]; + ] ++ lib.optional (desktop == "sway") ./system/sway.nix + ++ lib.optional (desktop == "gnome") ./system/gnome.nix; in { nixosConfigurations = { i15 = lib.nixosSystem { @@ -70,10 +71,8 @@ }; monolith = lib.nixosSystem { inherit system; - modules = [ - ./hosts/monolith.nix - ./system/gitlab-runner.nix - ] ++ common_modules; + modules = [ ./hosts/monolith.nix ./system/gitlab-runner.nix ] + ++ common_modules; }; rainbow = lib.nixosSystem { inherit system; diff --git a/hosts/monolith.nix b/hosts/monolith.nix index f79b928..b99c52c 100644 --- a/hosts/monolith.nix +++ b/hosts/monolith.nix @@ -1,8 +1,8 @@ # Do not modify this file! It was generated by ‘nixos-generate-config’ # and may be overwritten by future invocations. Please make changes # to /etc/nixos/configuration.nix instead. -{ config, lib, pkgs, modulesPath, ... }: let - btrfs_options = [ "compress=zstd:3" "noatime" ]; +{ config, lib, pkgs, modulesPath, ... }: +let btrfs_options = [ "compress=zstd:3" "noatime" ]; in { imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; boot.initrd.availableKernelModules = diff --git a/hosts/pixie.nix b/hosts/pixie.nix index 5d44e92..776bcb4 100644 --- a/hosts/pixie.nix +++ b/hosts/pixie.nix @@ -4,33 +4,33 @@ { config, lib, pkgs, modulesPath, ... }: { - imports = - [ (modulesPath + "/installer/scan/not-detected.nix") - ]; + imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; - boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" ]; + boot.initrd.availableKernelModules = + [ "nvme" "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" ]; boot.initrd.kernelModules = [ ]; boot.kernelModules = [ "kvm-amd" ]; boot.extraModulePackages = [ ]; - fileSystems."/" = - { device = "/dev/mapper/pixie"; - fsType = "btrfs"; - options = [ "subvol=nixos" ]; - }; + fileSystems."/" = { + device = "/dev/mapper/pixie"; + fsType = "btrfs"; + options = [ "subvol=nixos" ]; + }; - boot.initrd.luks.devices."pixie".device = "/dev/disk/by-uuid/f4ae5858-d2d6-4cd1-a054-bf5147a9a928"; + boot.initrd.luks.devices."pixie".device = + "/dev/disk/by-uuid/f4ae5858-d2d6-4cd1-a054-bf5147a9a928"; - fileSystems."/home" = - { device = "/dev/mapper/pixie"; - fsType = "btrfs"; - options = [ "subvol=home" ]; - }; + fileSystems."/home" = { + device = "/dev/mapper/pixie"; + fsType = "btrfs"; + options = [ "subvol=home" ]; + }; - fileSystems."/boot/efi" = - { device = "/dev/disk/by-uuid/B1BB-15DD"; - fsType = "vfat"; - }; + fileSystems."/boot/efi" = { + device = "/dev/disk/by-uuid/B1BB-15DD"; + fsType = "vfat"; + }; swapDevices = [ ]; @@ -45,7 +45,8 @@ # networking.interfaces.enp4s0.useDHCP = lib.mkDefault true; # networking.interfaces.veth74f3ffc.useDHCP = lib.mkDefault true; - hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + hardware.cpu.amd.updateMicrocode = + lib.mkDefault config.hardware.enableRedistributableFirmware; networking.hostName = "pixie"; # Define your hostname. } diff --git a/hosts/rainbow.nix b/hosts/rainbow.nix index 0c15174..b161930 100644 --- a/hosts/rainbow.nix +++ b/hosts/rainbow.nix @@ -1,42 +1,42 @@ # Do not modify this file! It was generated by ‘nixos-generate-config’ # and may be overwritten by future invocations. Please make changes # to /etc/nixos/configuration.nix instead. -{ config, lib, pkgs, modulesPath, ... }: let - btrfs_options = [ "compress=zstd:3" "noatime" ]; +{ config, lib, pkgs, modulesPath, ... }: +let btrfs_options = [ "compress=zstd:3" "noatime" ]; in { - imports = - [ (modulesPath + "/installer/scan/not-detected.nix") - ]; + imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; - boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" ]; + boot.initrd.availableKernelModules = + [ "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" ]; boot.initrd.kernelModules = [ ]; boot.kernelModules = [ "kvm-intel" ]; boot.extraModulePackages = [ ]; - fileSystems."/" = - { device = "/dev/disk/by-uuid/a242e1fd-6848-4504-909f-ab8b61f97c8e"; - fsType = "btrfs"; - options = [ "subvol=@nixos" ] ++ btrfs_options; - }; + fileSystems."/" = { + device = "/dev/disk/by-uuid/a242e1fd-6848-4504-909f-ab8b61f97c8e"; + fsType = "btrfs"; + options = [ "subvol=@nixos" ] ++ btrfs_options; + }; - boot.initrd.luks.devices."main".device = "/dev/disk/by-uuid/9b24d79f-e018-4d70-84a9-5a1b49a6c610"; + boot.initrd.luks.devices."main".device = + "/dev/disk/by-uuid/9b24d79f-e018-4d70-84a9-5a1b49a6c610"; - fileSystems."/home" = - { device = "/dev/disk/by-uuid/a242e1fd-6848-4504-909f-ab8b61f97c8e"; - fsType = "btrfs"; - options = [ "subvol=@home" ] ++ btrfs_options; - }; + fileSystems."/home" = { + device = "/dev/disk/by-uuid/a242e1fd-6848-4504-909f-ab8b61f97c8e"; + fsType = "btrfs"; + options = [ "subvol=@home" ] ++ btrfs_options; + }; - fileSystems."/boot/efi" = - { device = "/dev/disk/by-uuid/DC3B-5753"; - fsType = "vfat"; - }; + fileSystems."/boot/efi" = { + device = "/dev/disk/by-uuid/DC3B-5753"; + fsType = "vfat"; + }; - fileSystems."/swap" = - { device = "/dev/disk/by-uuid/a242e1fd-6848-4504-909f-ab8b61f97c8e"; - fsType = "btrfs"; - options = [ "subvol=@swap" ]; - }; + fileSystems."/swap" = { + device = "/dev/disk/by-uuid/a242e1fd-6848-4504-909f-ab8b61f97c8e"; + fsType = "btrfs"; + options = [ "subvol=@swap" ]; + }; swapDevices = [{ device = "/swap/swapfile"; @@ -51,7 +51,8 @@ in { # networking.interfaces.enp1s0.useDHCP = lib.mkDefault true; powerManagement.cpuFreqGovernor = lib.mkDefault "powersave"; - hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; + hardware.cpu.intel.updateMicrocode = + lib.mkDefault config.hardware.enableRedistributableFirmware; networking.hostName = "rainbow"; # Define your hostname. } diff --git a/overlays/default.nix b/overlays/default.nix index f46c8b3..bb00475 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -1,44 +1,44 @@ -(inputs@{ system, ... }: {pkgs, ...}: { - nixpkgs.overlays = [ - inputs.nur.overlay - (import ../scripts) - (import ./sway.nix) - (final: prev: { - unstable = inputs.nixpkgs-unstable.legacyPackages.${prev.system}; - }) - (final: prev: { - uservars = import ../user/variables.nix; - dhist = inputs.dhist.packages.${system}.dhist; - mpvpaper = inputs.wegank.packages.${prev.system}.mpvpaper; - alacritty = (prev.unstable.alacritty.overrideAttrs - (old-alacritty: rec { +(inputs@{ system, ... }: + { pkgs, ... }: { + nixpkgs.overlays = [ + inputs.nur.overlay + (import ../scripts) + (import ./sway.nix) + (final: prev: { + unstable = inputs.nixpkgs-unstable.legacyPackages.${prev.system}; + }) + (final: prev: { + uservars = import ../user/variables.nix; + dhist = inputs.dhist.packages.${system}.dhist; + mpvpaper = inputs.wegank.packages.${prev.system}.mpvpaper; + alacritty = (prev.unstable.alacritty.overrideAttrs (old-alacritty: rec { src = inputs.alacritty-sixel; - cargoDeps = old-alacritty.cargoDeps.overrideAttrs - (prev.lib.const { - inherit src; - outputHash = "sha256-svZ/ySK09m4KVJE5LBLtD7ZEoExGwpFn4UP5tfhGKMc="; - }); + cargoDeps = old-alacritty.cargoDeps.overrideAttrs (prev.lib.const { + inherit src; + outputHash = "sha256-svZ/ySK09m4KVJE5LBLtD7ZEoExGwpFn4UP5tfhGKMc="; + }); })); - ranger = (prev.ranger.overridePythonAttrs (old-ranger: rec { - src = inputs.ranger-sixel; - checkInputs = [ ]; - propagatedBuildInputs = with prev.python3Packages; - old-ranger.propagatedBuildInputs ++ [ astroid pylint pytest ]; - })); - material-wifi-icons = final.stdenv.mkDerivation rec { - name = "material-wifi-icons"; - src = inputs.material-wifi-icons; - installPhase = let dest = "$out/share/fonts/${name}"; - in '' - mkdir -p ${dest} - cp material-wifi.ttf ${dest} - ''; - }; - papirus_red = (final.unstable.papirus-icon-theme.override { color = "red"; }); - orchis_theme_compact = - (final.orchis-theme.override { tweaks = [ "compact" "solid" ]; }); - nerdfonts_fira_hack = - (final.nerdfonts.override { fonts = [ "FiraCode" "Hack" ]; }); - }) - ]; -}) + ranger = (prev.ranger.overridePythonAttrs (old-ranger: rec { + src = inputs.ranger-sixel; + checkInputs = [ ]; + propagatedBuildInputs = with prev.python3Packages; + old-ranger.propagatedBuildInputs ++ [ astroid pylint pytest ]; + })); + material-wifi-icons = final.stdenv.mkDerivation rec { + name = "material-wifi-icons"; + src = inputs.material-wifi-icons; + installPhase = let dest = "$out/share/fonts/${name}"; + in '' + mkdir -p ${dest} + cp material-wifi.ttf ${dest} + ''; + }; + papirus_red = + (final.unstable.papirus-icon-theme.override { color = "red"; }); + orchis_theme_compact = + (final.orchis-theme.override { tweaks = [ "compact" "solid" ]; }); + nerdfonts_fira_hack = + (final.nerdfonts.override { fonts = [ "FiraCode" "Hack" ]; }); + }) + ]; + }) diff --git a/scripts/default.nix b/scripts/default.nix index ff75521..424f94f 100644 --- a/scripts/default.nix +++ b/scripts/default.nix @@ -27,8 +27,8 @@ wpass = [ final.wdmenu fd pass sd wl-clipboard wtype ]; screenshotsh = [ capitaine-cursors grim slurp jq sway wl-clipboard xdg-user-dirs ]; - volumesh = [ pulseaudio libnotify ]; - pulse_sink = [ pulseaudio pamixer final.wdmenu ]; + volumesh = [ pulseaudio libnotify ]; + pulse_sink = [ pulseaudio pamixer final.wdmenu ]; } // lib.mapAttrs import_script { wdmenu = ./wdmenu.nix; wlauncher = ./wlauncher.nix; diff --git a/system/configuration.nix b/system/configuration.nix index 6db80df..03963d3 100644 --- a/system/configuration.nix +++ b/system/configuration.nix @@ -2,9 +2,7 @@ # your system. Help is available in the configuration.nix(5) man page # and in the NixOS manual (accessible by running ‘nixos-help’). { config, pkgs, ... }: { - imports = [ - ./media-packages.nix - ]; + imports = [ ./media-packages.nix ]; packages.media-packages.enable = true; # Bootloader. @@ -31,12 +29,12 @@ time.timeZone = "America/Sao_Paulo"; # Select internationalisation properties. i18n.defaultLocale = "pt_BR.utf8"; - # Enable the X11 windowing system. - services.xserver.enable = false; + # 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 = { layout = "us"; @@ -53,7 +51,7 @@ ## Enable sound with pipewire. sound.enable = true; - # hardware.pulseaudio.enable = true; + hardware.pulseaudio.enable = false; services.pipewire = { enable = true; wireplumber.enable = true; diff --git a/system/gnome.nix b/system/gnome.nix new file mode 100644 index 0000000..a856af6 --- /dev/null +++ b/system/gnome.nix @@ -0,0 +1,16 @@ +# 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, ... }: { + # Enable the X11 windowing system. + services.xserver.enable = true; + # Enable the GNOME Desktop Environment. + services.xserver.displayManager.gdm.enable = true; + services.xserver.desktopManager.gnome.enable = true; + # services.xserver.displayManager.autologin.user = "lelgenio"; + environment.systemPackages = with pkgs; + with gnome; [ + gnome-tweaks + dconf-editor + ]; +} diff --git a/system/media-packages.nix b/system/media-packages.nix index d3c4255..9828561 100644 --- a/system/media-packages.nix +++ b/system/media-packages.nix @@ -1,6 +1,5 @@ { config, pkgs, lib, ... }: -let - cfg = config.packages.media-packages; +let cfg = config.packages.media-packages; in { options.packages.media-packages = { enable = lib.mkEnableOption "media packages"; diff --git a/system/sway.nix b/system/sway.nix index c4ca282..97a7bb7 100644 --- a/system/sway.nix +++ b/system/sway.nix @@ -1,4 +1,8 @@ { pkgs, ... }: { + + # Enable the X11 windowing system. + services.xserver.enable = false; + # enable sway window manager programs.sway = { enable = true; diff --git a/user/chat.nix b/user/chat.nix index 65c8e1d..75e7d91 100644 --- a/user/chat.nix +++ b/user/chat.nix @@ -29,9 +29,7 @@ in { }; }; - home.packages = with pkgs; [ - tdesktop - ]; + home.packages = with pkgs; [ tdesktop ]; home.activation = { install_flatpaks = lib.hm.dag.entryAfter [ "writeBoundary" ] '' diff --git a/user/firefox.nix b/user/firefox.nix index e440f39..6d3b3eb 100644 --- a/user/firefox.nix +++ b/user/firefox.nix @@ -1,5 +1,5 @@ { config, pkgs, lib, font, ... }: -let inherit (import ./variables.nix) key theme color accent font; +let inherit (import ./variables.nix) desktop; in { config = { programs.firefox = { @@ -16,23 +16,21 @@ in { main = { isDefault = true; settings = { - "devtools.theme" = "dark"; + "devtools.theme" = "auto"; "toolkit.legacyUserProfileCustomizations.stylesheets" = true; - "browser.tabs.inTitlebar" = 0; + "browser.tabs.inTitlebar" = if desktop == "sway" then 0 else 1; "media.ffmpeg.vaapi.enabled" = true; - "media.ffvpx.enabled" = false; - "media.av1.enabled" = false; + "media.ffvpx.enabled" = true; + "media.av1.enabled" = true; "gfx.webrender.all" = true; }; - userChrome = '' + userChrome = lib.mkIf (desktop == "sway") '' #titlebar { display: none !important; } ''; }; }; }; - home.sessionVariables = { - MOZ_ENABLE_WAYLAND = "1"; - }; + home.sessionVariables = { MOZ_ENABLE_WAYLAND = "1"; }; }; } diff --git a/user/fzf.nix b/user/fzf.nix index 8311c73..89b8def 100644 --- a/user/fzf.nix +++ b/user/fzf.nix @@ -1,5 +1,6 @@ { config, pkgs, lib, inputs, ... }: -let inherit (import ./variables.nix) key theme color accent font; +let + inherit (import ./variables.nix) key theme color accent font; colors = { "bg+" = color.bg_light; @@ -21,14 +22,13 @@ in { enable = true; fileWidgetCommand = "${pkgs.fd}/bin/fd --type f"; - fileWidgetOptions = [ "--preview '${pkgs.bat}/bin/bat --style=numbers --color=always {}'" ]; + fileWidgetOptions = + [ "--preview '${pkgs.bat}/bin/bat --style=numbers --color=always {}'" ]; changeDirWidgetCommand = "${pkgs.fd}/bin/fd --type d"; - changeDirWidgetOptions = [ "--preview '${pkgs.exa}/bin/exa -T L3 | head -200'" ]; + changeDirWidgetOptions = + [ "--preview '${pkgs.exa}/bin/exa -T L3 | head -200'" ]; - defaultOptions = [ - color_opts - preview_opts - ]; + defaultOptions = [ color_opts preview_opts ]; }; } diff --git a/user/home.nix b/user/home.nix index 9b5ac46..6ef75bc 100644 --- a/user/home.nix +++ b/user/home.nix @@ -1,5 +1,5 @@ { config, pkgs, lib, inputs, ... }: -let inherit (import ./variables.nix) key theme color accent font; +let inherit (import ./variables.nix) key theme color accent font desktop; in { imports = [ @@ -8,7 +8,6 @@ in { ./kakoune.nix ./fish.nix ./firefox.nix - ./sway.nix ./hyprland.nix ./alacritty.nix ./git.nix @@ -24,9 +23,9 @@ in { ./bmenu.nix ./fzf.nix ./ranger - ./theme.nix inputs.hyprland.homeManagerModules.default - ]; + ] ++ lib.optional (desktop == "sway") ./sway.nix; + # Home Manager needs a bit of information about you and the # paths it should manage. home.username = "lelgenio"; @@ -77,14 +76,12 @@ in { libsForQt5.qtstyleplugins qt5.qtsvg - ## Network speedtest-cli nmap miniupnpc deluge - ## Programming vscode rustup diff --git a/user/sway.nix b/user/sway.nix index e34d8b2..f6f4e84 100644 --- a/user/sway.nix +++ b/user/sway.nix @@ -25,6 +25,7 @@ let fi ''; in { + imports = [ ./theme.nix ]; config = { wayland.windowManager.sway = let mod = "Mod4"; diff --git a/user/theme.nix b/user/theme.nix index 9e316cd..5d93fcf 100644 --- a/user/theme.nix +++ b/user/theme.nix @@ -34,7 +34,7 @@ with pkgs.uservars; { [Appearance] # color_scheme_path=/nix/store/f07mk0vrm47jxw3y5v99hxncy0w4vcyq-qt5ct-1.5/share/qt5ct/colors/darker.conf custom_palette=false - icon_theme=${ icon_theme } + icon_theme=${icon_theme} standard_dialogs=default style=kvantum-dark @@ -46,18 +46,16 @@ with pkgs.uservars; { services.xsettingsd = { enable = true; settings = { - "Gtk/FontName" = "${ font.interface } ${toString font.size.small }"; - "Net/ThemeName" = "${ gtk_theme }"; - "Net/IconThemeName" = "${ icon_theme }"; - "Gtk/CursorThemeName" = "${ cursor_theme }"; + "Gtk/FontName" = "${font.interface} ${toString font.size.small}"; + "Net/ThemeName" = "${gtk_theme}"; + "Net/IconThemeName" = "${icon_theme}"; + "Gtk/CursorThemeName" = "${cursor_theme}"; "Gtk/CursorThemeSize" = 24; - "Net/SoundThemeName" = "freedesktop" ; + "Net/SoundThemeName" = "freedesktop"; }; }; - home.sessionVariables = { - QT_QPA_PLATFORMTHEME = "qt5ct"; - }; + home.sessionVariables = { QT_QPA_PLATFORMTHEME = "qt5ct"; }; home.packages = with pkgs; [ libsForQt5.qt5ct libsForQt5.qtstyleplugin-kvantum diff --git a/user/variables.nix b/user/variables.nix index 68c487f..df9d77a 100644 --- a/user/variables.nix +++ b/user/variables.nix @@ -96,4 +96,5 @@ in rec { }; dmenu = "bmenu"; + desktop = "sway"; } diff --git a/user/waybar.nix b/user/waybar.nix index 79b781e..73405af 100644 --- a/user/waybar.nix +++ b/user/waybar.nix @@ -102,7 +102,8 @@ in { format-bluetooth-muted = ""; format-muted = "ﱝ"; format-icons = { - "alsa_output.pci-0000_09_00.4.analog-stereo" = [ " 奄" " 奔" " 墳" ]; + "alsa_output.pci-0000_09_00.4.analog-stereo" = + [ " 奄" " 奔" " 墳" ]; headphone = [ " 奄" " 奔" " 墳" ]; handsfree = "";