From 965ac78482b39f2c7824e06599e64be61ca60d01 Mon Sep 17 00:00:00 2001 From: "Alexandre Cavalheiro S. Tiago da Silva" Date: Tue, 16 Jan 2024 11:33:01 -0300 Subject: [PATCH] chore: format all files to nixpkgs standards --- flake.nix | 54 +++++++++++++++--------------- hardware-configuration.nix | 18 ++++++---- home-manager.nix | 23 ++++++++++++- nixos.nix | 27 +++++++-------- programs/fish/config.nix | 4 +-- programs/git.nix | 10 +++--- programs/mangohud.nix | 6 ++-- programs/obs-studio.nix | 2 +- programs/waybar.nix | 64 ++++++++++++++++++------------------ programs/wezterm/config.nix | 2 +- theming/catppuccin-qt5ct.nix | 61 +++++++++++++++++----------------- theming/sddm.nix | 2 +- 12 files changed, 152 insertions(+), 121 deletions(-) diff --git a/flake.nix b/flake.nix index 11db1ba..681353a 100644 --- a/flake.nix +++ b/flake.nix @@ -23,34 +23,36 @@ custom-neovim.url = "github:wizardlink/neovim"; }; - outputs = { - self, - nixpkgs, - home-manager, - hyprland, - ... - }@inputs: { - nixosConfigurations.nixos = - let - system = "x86_64-linux"; - modules = [ - ./nixos.nix + outputs = + { self + , nixpkgs + , home-manager + , hyprland + , ... + }@inputs: { + nixosConfigurations.nixos = + let + system = "x86_64-linux"; + modules = [ + ./nixos.nix - hyprland.nixosModules.default - { - programs.hyprland.enable = true; - } + hyprland.nixosModules.default + { + programs.hyprland.enable = true; + } - home-manager.nixosModules.home-manager - { - home-manager.useGlobalPkgs = true; - home-manager.useUserPackages = true; + home-manager.nixosModules.home-manager + { + home-manager.useGlobalPkgs = true; + home-manager.useUserPackages = true; - home-manager.extraSpecialArgs = inputs; - home-manager.users.wizardlink = import ./home-manager.nix; - } - ]; - in + home-manager.extraSpecialArgs = inputs; + home-manager.users.wizardlink = import ./home-manager.nix; + } + ]; + in nixpkgs.lib.nixosSystem { inherit system modules; }; - }; + + formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixpkgs-fmt; + }; } diff --git a/hardware-configuration.nix b/hardware-configuration.nix index 4f506ea..7ef132d 100644 --- a/hardware-configuration.nix +++ b/hardware-configuration.nix @@ -5,7 +5,8 @@ { imports = - [ (modulesPath + "/installer/scan/not-detected.nix") + [ + (modulesPath + "/installer/scan/not-detected.nix") ]; boot.initrd.availableKernelModules = [ "nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ]; @@ -14,27 +15,32 @@ boot.extraModulePackages = [ ]; fileSystems."/" = - { device = "/dev/disk/by-uuid/65e4c115-aff0-4c0e-8799-7309a25ecab6"; + { + device = "/dev/disk/by-uuid/65e4c115-aff0-4c0e-8799-7309a25ecab6"; fsType = "ext4"; }; fileSystems."/boot" = - { device = "/dev/disk/by-uuid/2EFE-3A26"; + { + device = "/dev/disk/by-uuid/2EFE-3A26"; fsType = "vfat"; }; fileSystems."/mnt/ssd" = - { device = "/dev/disk/by-uuid/f27f2224-d351-46fd-89f5-991de36166ad"; + { + device = "/dev/disk/by-uuid/f27f2224-d351-46fd-89f5-991de36166ad"; fsType = "ext4"; }; fileSystems."/mnt/internal" = - { device = "/dev/disk/by-uuid/b8541c0d-9146-4388-b217-431f196957cc"; + { + device = "/dev/disk/by-uuid/b8541c0d-9146-4388-b217-431f196957cc"; fsType = "ext4"; }; fileSystems."/mnt/media" = - { device = "/dev/disk/by-uuid/52c17b8b-46c1-4870-b86c-c3b9f4bd4434"; + { + device = "/dev/disk/by-uuid/52c17b8b-46c1-4870-b86c-c3b9f4bd4434"; fsType = "ext4"; }; diff --git a/home-manager.nix b/home-manager.nix index 4610ad1..45e218e 100644 --- a/home-manager.nix +++ b/home-manager.nix @@ -39,7 +39,7 @@ # or # # /etc/profiles/per-user/wizardlink/etc/profile.d/hm-session-vars.sh - # if you don't want to manage your shell through Home Manager. + # if you don't want to manage your shell through Home Manager. home.sessionVariables = { EDITOR = "nvim"; NIXOS_OZONE_WL = "1"; @@ -129,6 +129,27 @@ libsForQt5.qtwayland qt6Packages.qtstyleplugin-kvantum qt6Packages.qtwayland + + # 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" ]; + }) + ) ]; # diff --git a/nixos.nix b/nixos.nix index 4fe14d8..578d284 100644 --- a/nixos.nix +++ b/nixos.nix @@ -10,7 +10,8 @@ ## imports = - [ # Include the results of the hardware scan. + [ + # Include the results of the hardware scan. ./hardware-configuration.nix # Include service configuration ./services/caddy.nix @@ -74,15 +75,15 @@ # Open ports in the firewall. networking.firewall = { allowedTCPPorts = [ - 80 # HTTP - 11753 # OpenRCT2 - 443 # SSL + 80 # HTTP + 11753 # OpenRCT2 + 443 # SSL ]; allowedUDPPorts = [ - 2626 # Dolphin emulator - 11753 # OpenRCT2 - 27015 # Source games + 2626 # Dolphin emulator + 11753 # OpenRCT2 + 27015 # Source games ]; allowedTCPPortRanges = [ @@ -141,12 +142,12 @@ # Enable the OpenSSH daemon. services.openssh = { - enable = true; + enable = true; - settings = { - PasswordAuthentication = false; - PermitRootLogin = "no"; - }; + settings = { + PasswordAuthentication = false; + PermitRootLogin = "no"; + }; }; ## @@ -287,7 +288,7 @@ ## Hardware specific openrazer-daemon # Razor products back-end - polychromatic # and it's Front-end + polychromatic # and it's Front-end ]; # Some programs need SUID wrappers, can be configured further or are diff --git a/programs/fish/config.nix b/programs/fish/config.nix index ae0ef2f..c2540e9 100644 --- a/programs/fish/config.nix +++ b/programs/fish/config.nix @@ -33,11 +33,11 @@ fish_prompt.body = '' set_color CC241D echo '&' (set_color normal) - ''; + ''; fzf_edit.body = '' fzf --multi --bind 'enter:become(nvim {+})' - ''; + ''; }; }; } diff --git a/programs/git.nix b/programs/git.nix index 10efa40..c7d6e42 100644 --- a/programs/git.nix +++ b/programs/git.nix @@ -27,7 +27,7 @@ extraConfig = { core = { - # Set the editor to be used by GIT + # Set the editor to be used by GIT editor = "nvim"; # Custom .gitignore @@ -38,13 +38,13 @@ }; color = { - # Use colors in GIT commmands. - ui = "auto"; + # Use colors in GIT commmands. + ui = "auto"; }; commit = { - # https://help.github.com/articles/signing-commits-using-gpg/ - gpgsign = true; + # https://help.github.com/articles/signing-commits-using-gpg/ + gpgsign = true; }; tag = { diff --git a/programs/mangohud.nix b/programs/mangohud.nix index 6674c2e..4aa1860 100644 --- a/programs/mangohud.nix +++ b/programs/mangohud.nix @@ -27,7 +27,7 @@ cpu_mhz = true; cpu_load_change = true; cpu_load_value = [ 60 90 ]; - cpu_load_color= [ "39F900" "FDFD09" "B22222" ]; + cpu_load_color = [ "39F900" "FDFD09" "B22222" ]; # IO Statistics @@ -48,7 +48,7 @@ fps_color = [ "B22222" "FDFD09" "39F900" ]; frametime = true; frame_timing = true; # Display graphs - histogram = true; # ^ + histogram = true; # ^ # Show whether gamemode is enabled for the application. gamemode = true; @@ -57,7 +57,7 @@ no_display = true; # Where to output log files. - output_folder=/home/wizardlink/.config/MangoHud; + output_folder = /home/wizardlink/.config/MangoHud; }; }; } diff --git a/programs/obs-studio.nix b/programs/obs-studio.nix index d175659..8d872f0 100644 --- a/programs/obs-studio.nix +++ b/programs/obs-studio.nix @@ -1,7 +1,7 @@ { pkgs, ... }: { - programs.obs-studio = + programs.obs-studio = { enable = true; plugins = with pkgs.obs-studio-plugins; [ diff --git a/programs/waybar.nix b/programs/waybar.nix index aac4f8f..d8b7ecc 100644 --- a/programs/waybar.nix +++ b/programs/waybar.nix @@ -4,8 +4,8 @@ enable = true; package = (pkgs.waybar.overrideAttrs (oldAttrs: { - mesonFlags = oldAttrs.mesonFlags ++ [ "-Dexperimental=true" ]; - }) + mesonFlags = oldAttrs.mesonFlags ++ [ "-Dexperimental=true" ]; + }) ); settings = { @@ -14,30 +14,30 @@ position = "top"; modules-left = [ "hyprland/submap" - "hyprland/workspaces" - "custom/arrow10" - "hyprland/window" + "hyprland/workspaces" + "custom/arrow10" + "hyprland/window" ]; modules-right = [ "custom/arrow9" - "pulseaudio" - "custom/arrow8" - "network" - "custom/arrow7" - "memory" - "custom/arrow6" - "cpu" - "custom/arrow5" - "temperature" - "custom/arrow4" - "battery" - "custom/arrow3" - "hyprland/language" - "custom/arrow2" - "tray" - "clock#date" - "custom/arrow1" - "clock#time" + "pulseaudio" + "custom/arrow8" + "network" + "custom/arrow7" + "memory" + "custom/arrow6" + "cpu" + "custom/arrow5" + "temperature" + "custom/arrow4" + "battery" + "custom/arrow3" + "hyprland/language" + "custom/arrow2" + "tray" + "clock#date" + "custom/arrow1" + "clock#time" ]; # Module configuration @@ -56,10 +56,10 @@ format-alt = "{icon} {power}W"; format-icons = [ "" - "" - "" - "" - "" + "" + "" + "" + "" ]; tooltip = false; }; @@ -137,7 +137,7 @@ car = ""; default = [ "" - "" + "" ]; }; scroll-step = 1; @@ -151,10 +151,10 @@ format = "{icon} {temperatureC}°"; format-icons = [ "" - "" - "" - "" - "" + "" + "" + "" + "" ]; tooltip = false; }; diff --git a/programs/wezterm/config.nix b/programs/wezterm/config.nix index e05bd98..73aabb6 100644 --- a/programs/wezterm/config.nix +++ b/programs/wezterm/config.nix @@ -4,6 +4,6 @@ programs.wezterm = { enable = true; extraConfig = builtins.readFile ./wezterm.lua; - package = (pkgs.callPackage ./package.nix {}); + package = (pkgs.callPackage ./package.nix { }); }; } diff --git a/theming/catppuccin-qt5ct.nix b/theming/catppuccin-qt5ct.nix index 9a798af..a207fb2 100644 --- a/theming/catppuccin-qt5ct.nix +++ b/theming/catppuccin-qt5ct.nix @@ -1,37 +1,38 @@ -{ - fetchFromGitHub, - flavor ? "Mocha", - lib, - stdenvNoCC -}: let - validFlavors = ["Frappe" "Latte" "Macchiato" "Mocha"]; +{ fetchFromGitHub +, flavor ? "Mocha" +, lib +, stdenvNoCC +}: +let + validFlavors = [ "Frappe" "Latte" "Macchiato" "Mocha" ]; pname = "catppucin-qt5ct"; in - lib.checkListOfEnum "${pname}: flavors" validFlavors [ flavor ] +lib.checkListOfEnum "${pname}: flavors" validFlavors [ flavor ] - stdenvNoCC.mkDerivation { - inherit pname; - version = "unstable-2023-10-24"; + stdenvNoCC.mkDerivation +{ + inherit pname; + version = "unstable-2023-10-24"; - src = fetchFromGitHub { - owner = "catppuccin"; - repo = "qt5ct"; - rev = "89ee948e72386b816c7dad72099855fb0d46d41e"; - sha256 = "sha256-t/uyK0X7qt6qxrScmkTU2TvcVJH97hSQuF0yyvSO/qQ="; - }; + src = fetchFromGitHub { + owner = "catppuccin"; + repo = "qt5ct"; + rev = "89ee948e72386b816c7dad72099855fb0d46d41e"; + sha256 = "sha256-t/uyK0X7qt6qxrScmkTU2TvcVJH97hSQuF0yyvSO/qQ="; + }; - nativeBuildInputs = [ ]; - buildInputs = [ ]; + nativeBuildInputs = [ ]; + buildInputs = [ ]; - postPatch = '' - export HOME=$(mktemp -d) - cp -r themes/* $HOME/.config/qt5ct/colors/ - ''; + postPatch = '' + export HOME=$(mktemp -d) + cp -r themes/* $HOME/.config/qt5ct/colors/ + ''; - meta = with lib; { - description = "Catppuccin for qt5ct"; - homepage = "https://github.com/catppuccin/qt5ct"; - license = licenses.mit; - maintainers = with maintainers; [ ]; - }; - } + meta = with lib; { + description = "Catppuccin for qt5ct"; + homepage = "https://github.com/catppuccin/qt5ct"; + license = licenses.mit; + maintainers = with maintainers; [ ]; + }; +} diff --git a/theming/sddm.nix b/theming/sddm.nix index f15fc44..7a8fff3 100644 --- a/theming/sddm.nix +++ b/theming/sddm.nix @@ -22,5 +22,5 @@ pkgs.stdenv.mkDerivation { cd $out/ rm Background.jpg cp -r ${image} $out/Background.jpg - ''; + ''; }