From ecbe0c069c31fc79975cd10f9bf345fc30d98f9d Mon Sep 17 00:00:00 2001 From: "Alexandre Cavalheiro S. Tiago da Silva" Date: Mon, 24 Jun 2024 03:20:30 -0300 Subject: [PATCH] fix: move to nixfmt-rfc-style instead of nixpkgs-fmt --- flake.nix | 16 ++++++-- hardware-configuration.nix | 37 +++++++++++++---- home-manager.nix | 54 +++++++++++++------------ kernel/zenergy.nix | 17 +++++--- nixos.nix | 39 ++++++++++-------- programs/fish/default.nix | 8 +++- programs/git.nix | 16 ++++++-- programs/hyprland/default.nix | 2 +- programs/mangohud.nix | 33 ++++++++++++--- programs/neovim/default.nix | 2 +- programs/neovim/lua/plugins/none-ls.lua | 4 +- programs/vtsls/package.nix | 17 ++++++-- programs/waybar.nix | 19 +++++++-- services/caddy.nix | 3 +- 14 files changed, 184 insertions(+), 83 deletions(-) diff --git a/flake.nix b/flake.nix index 28bfa66..ae5d3a2 100644 --- a/flake.nix +++ b/flake.nix @@ -10,9 +10,17 @@ }; }; - outputs = { self, home-manager, nixpkgs, ... }@inputs: - let system = "x86_64-linux"; - in { + outputs = + { + self, + home-manager, + nixpkgs, + ... + }@inputs: + let + system = "x86_64-linux"; + in + { nixosConfigurations."nixos" = let specialArgs = inputs; @@ -31,6 +39,6 @@ in nixpkgs.lib.nixosSystem { inherit system specialArgs modules; }; - formatter."${system}" = nixpkgs.legacyPackages.${system}.nixpkgs-fmt; + formatter."${system}" = nixpkgs.legacyPackages.${system}.nixfmt-rfc-style; }; } diff --git a/hardware-configuration.nix b/hardware-configuration.nix index 60a6183..b1ec4d1 100644 --- a/hardware-configuration.nix +++ b/hardware-configuration.nix @@ -1,13 +1,25 @@ # 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, ... }: +{ + config, + lib, + pkgs, + modulesPath, + ... +}: { imports = [ (modulesPath + "/installer/scan/not-detected.nix") ]; - boot.initrd.availableKernelModules = - [ "nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ]; + boot.initrd.availableKernelModules = [ + "nvme" + "xhci_pci" + "ahci" + "usbhid" + "usb_storage" + "sd_mod" + ]; boot.initrd.kernelModules = [ ]; boot.kernelModules = [ "kvm-amd" ]; boot.extraModulePackages = [ ]; @@ -25,19 +37,29 @@ fileSystems."/mnt/ssd" = { device = "/dev/disk/by-uuid/f27f2224-d351-46fd-89f5-991de36166ad"; fsType = "ext4"; - options = [ "defaults" "nofail" ]; + options = [ + "defaults" + "nofail" + ]; }; fileSystems."/mnt/internal" = { device = "/dev/disk/by-uuid/b8541c0d-9146-4388-b217-431f196957cc"; fsType = "ext4"; - options = [ "defaults" "nofail" ]; + options = [ + "defaults" + "nofail" + ]; }; fileSystems."/mnt/media" = { device = "/dev/disk/by-uuid/52c17b8b-46c1-4870-b86c-c3b9f4bd4434"; fsType = "ext4"; - options = [ "defaults" "nofail" ]; + options = [ + "defaults" + "nofail" + ]; + }; }; swapDevices = [ ]; @@ -51,6 +73,5 @@ # networking.interfaces.enp5s0.useDHCP = lib.mkDefault true; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - hardware.cpu.amd.updateMicrocode = - lib.mkDefault config.hardware.enableRedistributableFirmware; + hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; } diff --git a/home-manager.nix b/home-manager.nix index f8ce032..a982173 100644 --- a/home-manager.nix +++ b/home-manager.nix @@ -125,22 +125,28 @@ # Create an FHS environment using the command `fhs`, enabling the execution of non-NixOS packages in NixOS! ( - let base = pkgs.appimageTools.defaultFhsEnvArgs; - in pkgs.buildFHSUserEnv (base // { - name = "fhs"; - targetPkgs = pkgs: - ( - # pkgs.buildFHSUserEnv provides only a minimal FHS environment, - # lacking many basic packages needed by most software. - # Therefore, we need to add them manually. - # - # pkgs.appimageTools provides basic packages required by most software. - (base.targetPkgs pkgs) ++ (with pkgs; [ nodejs ]) - ); - profile = "export FHS=1"; - runScript = "bash"; - extraOutputsToInstall = [ "dev" ]; - }) + let + base = pkgs.appimageTools.defaultFhsEnvArgs; + in + pkgs.buildFHSUserEnv ( + base + // { + name = "fhs"; + targetPkgs = + pkgs: + ( + # pkgs.buildFHSUserEnv provides only a minimal FHS environment, + # lacking many basic packages needed by most software. + # Therefore, we need to add them manually. + # + # pkgs.appimageTools provides basic packages required by most software. + (base.targetPkgs pkgs) ++ (with pkgs; [ nodejs ]) + ); + profile = "export FHS=1"; + runScript = "bash"; + extraOutputsToInstall = [ "dev" ]; + } + ) ) ]; @@ -152,8 +158,7 @@ # plain files is through 'home.file'. home.file = { # Cattpuccin theme for fish shell. - ".config/fish/themes/Catppuccin-Frappe.theme".source = - ./programs/fish/Catppuccin-Frappe.theme; + ".config/fish/themes/Catppuccin-Frappe.theme".source = ./programs/fish/Catppuccin-Frappe.theme; # Configuration for gamemode, for running games with optimizations. ".config/gamemode.ini".source = ./programs/gamemode.ini; @@ -164,11 +169,11 @@ ## Kvantum's theme configuration. ".config/Kvantum/Catppuccin-Frappe-Lavender" = { source = "${ - pkgs.catppuccin-kvantum.override { - accent = "Lavender"; - variant = "Frappe"; - } - }/share/Kvantum/Catppuccin-Frappe-Lavender"; + pkgs.catppuccin-kvantum.override { + accent = "Lavender"; + variant = "Frappe"; + } + }/share/Kvantum/Catppuccin-Frappe-Lavender"; }; ".config/Kvantum/kvantum.kvconfig".text = '' @@ -180,8 +185,7 @@ ## Themeing configuration for qt5 and qt6 ".config/qt5ct/colors".source = ./theming/qt5ct; - ".config/qt6ct/colors".source = - ./theming/qt5ct; # We use the qt5ct because it's the SAME spec + ".config/qt6ct/colors".source = ./theming/qt5ct; # We use the qt5ct because it's the SAME spec ## # Configure pipewire for microphone noise supression. diff --git a/kernel/zenergy.nix b/kernel/zenergy.nix index 9a77d48..00d20c2 100644 --- a/kernel/zenergy.nix +++ b/kernel/zenergy.nix @@ -1,4 +1,10 @@ -{ lib, stdenv, fetchFromGitHub, kernel, kmod }: +{ + lib, + stdenv, + fetchFromGitHub, + kernel, + kmod, +}: let kernelDirectory = "${kernel.dev}/lib/modules/${kernel.modDirVersion}/build"; @@ -16,12 +22,13 @@ stdenv.mkDerivation { nativeBuildInputs = [ kmod ] ++ kernel.moduleBuildDependencies; - hardeningDisable = [ "format" "pic" ]; - - makeFlags = kernel.makeFlags ++ [ - "KDIR=${kernelDirectory}" + hardeningDisable = [ + "format" + "pic" ]; + makeFlags = kernel.makeFlags ++ [ "KDIR=${kernelDirectory}" ]; + makeTargets = [ "modules_install" ]; preBuild = '' diff --git a/nixos.nix b/nixos.nix index 4752538..155d26c 100644 --- a/nixos.nix +++ b/nixos.nix @@ -19,7 +19,10 @@ ]; # Enable experimental features - nix.settings.experimental-features = [ "nix-command" "flakes" ]; + nix.settings.experimental-features = [ + "nix-command" + "flakes" + ]; # Enable automatic garbage collection. nix.gc = { @@ -91,15 +94,17 @@ 8211 # Palworld ]; - allowedTCPPortRanges = [{ - from = 1714; - to = 1764; - } # KDEConnect + allowedTCPPortRanges = [ + { + from = 1714; + to = 1764; + } # KDEConnect ]; - allowedUDPPortRanges = [{ - from = 1714; - to = 1764; - } # KDEConnect + allowedUDPPortRanges = [ + { + from = 1714; + to = 1764; + } # KDEConnect ]; }; # Or disable the firewall altogether. @@ -115,7 +120,13 @@ users.users.wizardlink = { createHome = true; description = "Alexandre Cavalheiro"; - extraGroups = [ "networkmanager" "wheel" "postgresql" "docker" "openrazer" ]; + extraGroups = [ + "networkmanager" + "wheel" + "postgresql" + "docker" + "openrazer" + ]; initialPassword = "wizardlink"; isNormalUser = true; @@ -214,15 +225,11 @@ xdg.portal = { enable = true; - extraPortals = with pkgs; [ - xdg-desktop-portal-hyprland - ]; + extraPortals = with pkgs; [ xdg-desktop-portal-hyprland ]; config = { common = { - default = [ - "hyprland" - ]; + default = [ "hyprland" ]; }; }; }; diff --git a/programs/fish/default.nix b/programs/fish/default.nix index 8ca63ad..946bf8f 100644 --- a/programs/fish/default.nix +++ b/programs/fish/default.nix @@ -28,9 +28,13 @@ zoxide init --cmd cd fish | source ''; - shellAbbrs = { z = "zoxide"; }; + shellAbbrs = { + z = "zoxide"; + }; - shellAliases = { del = "trash_file"; }; + shellAliases = { + del = "trash_file"; + }; functions = { fish_prompt.body = '' diff --git a/programs/git.nix b/programs/git.nix index 30f536b..c7d6e42 100644 --- a/programs/git.nix +++ b/programs/git.nix @@ -47,9 +47,13 @@ gpgsign = true; }; - tag = { gpgsign = true; }; + tag = { + gpgsign = true; + }; - difftool = { prompt = true; }; + difftool = { + prompt = true; + }; mergetool = { # https://www.git-scm.com/docs/git-mergetool#Documentation/git-mergetool.txt---no-prompt @@ -75,9 +79,13 @@ signingkey = "A1D3A2B4E14BD7C0445BB749A5767B54367CFBDF"; }; - pull = { ff = "only"; }; + pull = { + ff = "only"; + }; - init = { defaultBranch = "main"; }; + init = { + defaultBranch = "main"; + }; credential = { helper = "/usr/libexec/git-core/git-credential-libsecret"; diff --git a/programs/hyprland/default.nix b/programs/hyprland/default.nix index a90e5b9..b631706 100644 --- a/programs/hyprland/default.nix +++ b/programs/hyprland/default.nix @@ -247,7 +247,7 @@ bind = $mainMod SHIFT, J, movewindow, d bindm = $mainMod, mouse:272, movewindow bindm = $mainMod, mouse:273, resizewindow - + # Volume changes binde = , XF86AudioRaiseVolume, exec, wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 1%+ binde = , XF86AudioLowerVolume, exec, wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 1%- diff --git a/programs/mangohud.nix b/programs/mangohud.nix index a98090b..a03c3c3 100644 --- a/programs/mangohud.nix +++ b/programs/mangohud.nix @@ -15,8 +15,15 @@ gpu_fan = true; gpu_junction_temp = true; gpu_load_change = true; - gpu_load_color = [ "39F900" "FDFD09" "B22222" ]; - gpu_load_value = [ 60 90 ]; + gpu_load_color = [ + "39F900" + "FDFD09" + "B22222" + ]; + gpu_load_value = [ + 60 + 90 + ]; gpu_mem_clock = true; gpu_mem_temp = true; gpu_power = true; @@ -26,8 +33,15 @@ # CPU Statistics cpu_load_change = true; - cpu_load_color = [ "39F900" "FDFD09" "B22222" ]; - cpu_load_value = [ 60 90 ]; + cpu_load_color = [ + "39F900" + "FDFD09" + "B22222" + ]; + cpu_load_value = [ + 60 + 90 + ]; cpu_mhz = true; cpu_power = true; cpu_stats = true; @@ -46,8 +60,15 @@ # FPS Statistics fps = true; fps_color_change = true; - fps_value = [ 60 90 ]; - fps_color = [ "B22222" "FDFD09" "39F900" ]; + fps_value = [ + 60 + 90 + ]; + fps_color = [ + "B22222" + "FDFD09" + "39F900" + ]; frametime = true; frame_timing = true; # Display graphs histogram = true; # ^ diff --git a/programs/neovim/default.nix b/programs/neovim/default.nix index 32604d5..7078b35 100644 --- a/programs/neovim/default.nix +++ b/programs/neovim/default.nix @@ -34,7 +34,7 @@ # Nix nil - nixpkgs-fmt + nixfmt-rfc-style # TypeScript (callPackage ../vtsls/package.nix { }) diff --git a/programs/neovim/lua/plugins/none-ls.lua b/programs/neovim/lua/plugins/none-ls.lua index 2bf5082..6132628 100644 --- a/programs/neovim/lua/plugins/none-ls.lua +++ b/programs/neovim/lua/plugins/none-ls.lua @@ -12,9 +12,7 @@ return { -- https://github.com/nvimtools/none-ls.nvim/tree/main/lua/null-ls/builtins/diagnostics config.sources = { -- Set a formatter - -- null_ls.builtins.formatting.stylua, - -- null_ls.builtins.formatting.prettier, - null_ls.builtins.formatting.nixpkgs_fmt, + null_ls.builtins.formatting.nixfmt, null_ls.builtins.formatting.prettier, null_ls.builtins.formatting.stylua, } diff --git a/programs/vtsls/package.nix b/programs/vtsls/package.nix index 147780b..fe824ae 100644 --- a/programs/vtsls/package.nix +++ b/programs/vtsls/package.nix @@ -1,7 +1,8 @@ -{ lib -, buildNpmPackage -, fetchFromGitHub -, importNpmLock +{ + lib, + buildNpmPackage, + fetchFromGitHub, + importNpmLock, }: buildNpmPackage rec { @@ -28,4 +29,12 @@ buildNpmPackage rec { npmConfigHook = importNpmLock.npmConfigHook; dontNpmPrune = true; + + meta = with lib; { + description = "LSP wrapper around TypeScript extension bundled with VSCode."; + homepage = "https://github.com/yioneko/vtsls"; + license = licenses.mit; + maintainers = with maintainers; [ wizardlink ]; + platforms = platforms.all; + }; } diff --git a/programs/waybar.nix b/programs/waybar.nix index 14cb554..57aff3a 100644 --- a/programs/waybar.nix +++ b/programs/waybar.nix @@ -1,4 +1,5 @@ -{ ... }: { +{ ... }: +{ programs.waybar = { enable = true; @@ -92,7 +93,13 @@ critical-threshold = 90; interval = 5; format = "{icon} {temperatureC}°"; - format-icons = [ "" "" "" "" "" ]; + format-icons = [ + "" + "" + "" + "" + "" + ]; tooltip = false; }; @@ -110,7 +117,13 @@ format-charging-full = " {capacity}%"; format-full = "{icon} {capacity}%"; format-alt = "{icon} {power}W"; - format-icons = [ "" "" "" "" "" ]; + format-icons = [ + "" + "" + "" + "" + "" + ]; tooltip = false; }; diff --git a/services/caddy.nix b/services/caddy.nix index 2d6f8cb..ef9a55c 100644 --- a/services/caddy.nix +++ b/services/caddy.nix @@ -1,4 +1,5 @@ -{ ... }: { +{ ... }: +{ services.caddy = { enable = true;