Format project with official nixfmt formatter (#21)

* Set nix official formatter for the flake

* format the entire project
This commit is contained in:
Gaétan Lepage
2025-10-15 22:09:51 +02:00
committed by GitHub
parent 98b3c63572
commit fba993c589
34 changed files with 375 additions and 281 deletions
+14 -6
View File
@@ -9,20 +9,26 @@
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
}; };
outputs = inputs @ { outputs =
inputs@{
self, self,
nixpkgs, nixpkgs,
hyprland, hyprland,
nix-colors, nix-colors,
home-manager, home-manager,
}: { }:
{
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixfmt-tree;
nixosModules = { nixosModules = {
default = { default =
{
config, config,
lib, lib,
pkgs, pkgs,
... ...
}: { }:
{
imports = [ imports = [
(import ./modules/nixos/default.nix inputs) (import ./modules/nixos/default.nix inputs)
]; ];
@@ -35,13 +41,15 @@
}; };
homeManagerModules = { homeManagerModules = {
default = { default =
{
config, config,
lib, lib,
pkgs, pkgs,
osConfig ? { }, osConfig ? { },
... ...
}: { }:
{
imports = [ imports = [
nix-colors.homeManagerModules.default nix-colors.homeManagerModules.default
(import ./modules/home-manager/default.nix inputs) (import ./modules/home-manager/default.nix inputs)
+14 -6
View File
@@ -1,4 +1,5 @@
config: let config:
let
cfg = config.omarchy; cfg = config.omarchy;
wallpapers = { wallpapers = {
"tokyo-night" = [ "tokyo-night" = [
@@ -22,11 +23,18 @@ config: let
}; };
# Handle wallpaper path for generated themes and overrides # Handle wallpaper path for generated themes and overrides
wallpaper_path = if (cfg.theme == "generated_light" || cfg.theme == "generated_dark") || (cfg.theme_overrides.wallpaper_path != null) wallpaper_path =
then toString cfg.theme_overrides.wallpaper_path if
else let (cfg.theme == "generated_light" || cfg.theme == "generated_dark")
|| (cfg.theme_overrides.wallpaper_path != null)
then
toString cfg.theme_overrides.wallpaper_path
else
let
selected_wallpaper = builtins.elemAt (wallpapers.${cfg.theme}) 0; selected_wallpaper = builtins.elemAt (wallpapers.${cfg.theme}) 0;
in "~/Pictures/Wallpapers/${selected_wallpaper}"; in
in { "~/Pictures/Wallpapers/${selected_wallpaper}";
in
{
inherit wallpaper_path; inherit wallpaper_path;
} }
+4 -2
View File
@@ -2,10 +2,12 @@
config, config,
pkgs, pkgs,
... ...
}: let }:
let
cfg = config.omarchy; cfg = config.omarchy;
palette = config.colorScheme.palette; palette = config.colorScheme.palette;
in { in
{
home.file = { home.file = {
".config/btop/themes/${cfg.theme}.theme" = { ".config/btop/themes/${cfg.theme}.theme" = {
text = '' text = ''
+25 -13
View File
@@ -1,26 +1,36 @@
inputs: { inputs:
{
config, config,
pkgs, pkgs,
lib, lib,
... ...
}: let }:
packages = import ../packages.nix {inherit pkgs lib; exclude_packages = config.omarchy.exclude_packages;}; let
packages = import ../packages.nix {
inherit pkgs lib;
exclude_packages = config.omarchy.exclude_packages;
};
themes = import ../themes.nix; themes = import ../themes.nix;
# Handle theme selection - either predefined or generated # Handle theme selection - either predefined or generated
selectedTheme = if (config.omarchy.theme == "generated_light" || config.omarchy.theme == "generated_dark") selectedTheme =
then null if (config.omarchy.theme == "generated_light" || config.omarchy.theme == "generated_dark") then
else themes.${config.omarchy.theme}; null
else
themes.${config.omarchy.theme};
# Generate color scheme from wallpaper for generated themes # Generate color scheme from wallpaper for generated themes
generatedColorScheme = if (config.omarchy.theme == "generated_light" || config.omarchy.theme == "generated_dark") generatedColorScheme =
then (inputs.nix-colors.lib.contrib { inherit pkgs; }).colorSchemeFromPicture { if (config.omarchy.theme == "generated_light" || config.omarchy.theme == "generated_dark") then
(inputs.nix-colors.lib.contrib { inherit pkgs; }).colorSchemeFromPicture {
path = config.omarchy.theme_overrides.wallpaper_path; path = config.omarchy.theme_overrides.wallpaper_path;
variant = if config.omarchy.theme == "generated_light" then "light" else "dark"; variant = if config.omarchy.theme == "generated_light" then "light" else "dark";
} }
else null; else
in { null;
in
{
imports = [ imports = [
(import ./hyprland.nix inputs) (import ./hyprland.nix inputs)
(import ./hyprlock.nix inputs) (import ./hyprlock.nix inputs)
@@ -47,9 +57,11 @@ in {
}; };
home.packages = packages.homePackages; home.packages = packages.homePackages;
colorScheme = if (config.omarchy.theme == "generated_light" || config.omarchy.theme == "generated_dark") colorScheme =
then generatedColorScheme if (config.omarchy.theme == "generated_light" || config.omarchy.theme == "generated_dark") then
else inputs.nix-colors.colorSchemes.${selectedTheme.base16-theme}; generatedColorScheme
else
inputs.nix-colors.colorSchemes.${selectedTheme.base16-theme};
gtk = { gtk = {
enable = true; enable = true;
+2 -1
View File
@@ -1,4 +1,5 @@
{...}: { { ... }:
{
programs.direnv = { programs.direnv = {
enable = true; enable = true;
enableZshIntegration = true; enableZshIntegration = true;
+2 -1
View File
@@ -1,4 +1,5 @@
{...}: { { ... }:
{
fonts.fontconfig = { fonts.fontconfig = {
enable = true; enable = true;
defaultFonts = { defaultFonts = {
+4 -2
View File
@@ -2,10 +2,12 @@
config, config,
pkgs, pkgs,
... ...
}: let }:
let
cfg = config.omarchy; cfg = config.omarchy;
palette = config.colorScheme.palette; palette = config.colorScheme.palette;
in { in
{
programs.ghostty = { programs.ghostty = {
enable = true; enable = true;
settings = { settings = {
+4 -2
View File
@@ -1,6 +1,8 @@
{config, ...}: let { config, ... }:
let
cfg = config.omarchy; cfg = config.omarchy;
in { in
{
programs.git = { programs.git = {
enable = true; enable = true;
userName = cfg.full_name; userName = cfg.full_name;
+2 -1
View File
@@ -1,4 +1,5 @@
{...}: { { ... }:
{
services.hypridle = { services.hypridle = {
enable = true; enable = true;
settings = { settings = {
+4 -2
View File
@@ -1,8 +1,10 @@
inputs: { inputs:
{
config, config,
pkgs, pkgs,
... ...
}: { }:
{
imports = [ ./hyprland/configuration.nix ]; imports = [ ./hyprland/configuration.nix ];
wayland.windowManager.hyprland = { wayland.windowManager.hyprland = {
enable = true; enable = true;
+2 -1
View File
@@ -2,7 +2,8 @@
config, config,
pkgs, pkgs,
... ...
}: { }:
{
wayland.windowManager.hyprland.settings = { wayland.windowManager.hyprland.settings = {
exec-once = [ exec-once = [
# "hypridle & mako & waybar & fcitx5" # "hypridle & mako & waybar & fcitx5"
+5 -5
View File
@@ -2,13 +2,13 @@
config, config,
pkgs, pkgs,
... ...
}: let }:
let
cfg = config.omarchy; cfg = config.omarchy;
in { in
{
wayland.windowManager.hyprland.settings = { wayland.windowManager.hyprland.settings = {
bind = bind = cfg.quick_app_bindings ++ [
cfg.quick_app_bindings
++ [
"SUPER, space, exec, wofi --show drun --sort-order=alphabetical" "SUPER, space, exec, wofi --show drun --sort-order=alphabetical"
"SUPER SHIFT, SPACE, exec, pkill -SIGUSR1 waybar" "SUPER SHIFT, SPACE, exec, pkill -SIGUSR1 waybar"
# "SUPER CTRL, SPACE, exec, ~/.local/share/omarchy/bin/swaybg-next" # "SUPER CTRL, SPACE, exec, ~/.local/share/omarchy/bin/swaybg-next"
@@ -3,9 +3,11 @@
pkgs, pkgs,
lib, lib,
... ...
}: let }:
let
cfg = config.omarchy; cfg = config.omarchy;
in { in
{
imports = [ imports = [
./autostart.nix ./autostart.nix
./bindings.nix ./bindings.nix
+5 -5
View File
@@ -4,7 +4,8 @@
pkgs, pkgs,
osConfig ? { }, osConfig ? { },
... ...
}: let }:
let
cfg = config.omarchy; cfg = config.omarchy;
hasNvidiaDrivers = builtins.elem "nvidia" osConfig.services.xserver.videoDrivers; hasNvidiaDrivers = builtins.elem "nvidia" osConfig.services.xserver.videoDrivers;
nvidiaEnv = [ nvidiaEnv = [
@@ -12,12 +13,11 @@
"LIBVA_DRIVER_NAME,nvidia" "LIBVA_DRIVER_NAME,nvidia"
"__GLX_VENDOR_LIBRARY_NAME,nvidia" "__GLX_VENDOR_LIBRARY_NAME,nvidia"
]; ];
in { in
{
wayland.windowManager.hyprland.settings = { wayland.windowManager.hyprland.settings = {
# Environment variables # Environment variables
env = env = (lib.optionals hasNvidiaDrivers nvidiaEnv) ++ [
(lib.optionals hasNvidiaDrivers nvidiaEnv)
++ [
"GDK_SCALE,${toString cfg.scale}" "GDK_SCALE,${toString cfg.scale}"
# Cursor size # Cursor size
+2 -1
View File
@@ -3,7 +3,8 @@
lib, lib,
pkgs, pkgs,
... ...
}: { }:
{
wayland.windowManager.hyprland.settings = { wayland.windowManager.hyprland.settings = {
# Environment variables # Environment variables
# https://wiki.hyprland.org/Configuring/Variables/#input # https://wiki.hyprland.org/Configuring/Variables/#input
+9 -4
View File
@@ -2,13 +2,18 @@
config, config,
pkgs, pkgs,
... ...
}: let }:
hexToRgba = hex: alpha: let let
in "rgba(${hex}${alpha})"; hexToRgba =
hex: alpha:
let
in
"rgba(${hex}${alpha})";
inactiveBorder = hexToRgba config.colorScheme.palette.base09 "aa"; inactiveBorder = hexToRgba config.colorScheme.palette.base09 "aa";
activeBorder = hexToRgba config.colorScheme.palette.base0D "aa"; activeBorder = hexToRgba config.colorScheme.palette.base0D "aa";
in { in
{
wayland.windowManager.hyprland.settings = { wayland.windowManager.hyprland.settings = {
general = { general = {
gaps_in = 5; gaps_in = 5;
+2 -1
View File
@@ -2,7 +2,8 @@
config, config,
pkgs, pkgs,
... ...
}: { }:
{
wayland.windowManager.hyprland.settings = { wayland.windowManager.hyprland.settings = {
windowrule = [ windowrule = [
# See https://wiki.hyprland.org/Configuring/Window-Rules/ for more # See https://wiki.hyprland.org/Configuring/Window-Rules/ for more
+6 -3
View File
@@ -1,9 +1,11 @@
inputs: { inputs:
{
config, config,
pkgs, pkgs,
lib, lib,
... ...
}: let }:
let
palette = config.colorScheme.palette; palette = config.colorScheme.palette;
convert = inputs.nix-colors.lib.conversions.hexToRGBString; convert = inputs.nix-colors.lib.conversions.hexToRGBString;
selected_wallpaper_path = (import ../../lib/selected-wallpaper.nix config).wallpaper_path; selected_wallpaper_path = (import ../../lib/selected-wallpaper.nix config).wallpaper_path;
@@ -12,7 +14,8 @@ inputs: {
surfaceRgb = "rgb(${convert ", " palette.base02})"; surfaceRgb = "rgb(${convert ", " palette.base02})";
foregroundRgb = "rgb(${convert ", " palette.base05})"; foregroundRgb = "rgb(${convert ", " palette.base05})";
foregroundMutedRgb = "rgb(${convert ", " palette.base04})"; foregroundMutedRgb = "rgb(${convert ", " palette.base04})";
in { in
{
programs.hyprlock = { programs.hyprlock = {
enable = true; enable = true;
settings = { settings = {
+4 -2
View File
@@ -2,9 +2,11 @@
config, config,
pkgs, pkgs,
... ...
}: let }:
let
selected_wallpaper_path = (import ../../lib/selected-wallpaper.nix config).wallpaper_path; selected_wallpaper_path = (import ../../lib/selected-wallpaper.nix config).wallpaper_path;
in { in
{
home.file = { home.file = {
"Pictures/Wallpapers" = { "Pictures/Wallpapers" = {
source = ../../config/themes/wallpapers; source = ../../config/themes/wallpapers;
+4 -2
View File
@@ -2,9 +2,11 @@
config, config,
pkgs, pkgs,
... ...
}: let }:
let
cfg = config.omarchy; cfg = config.omarchy;
in { in
{
services.mako = { services.mako = {
enable = true; enable = true;
+2 -1
View File
@@ -1,3 +1,4 @@
{...}: { { ... }:
{
programs.starship.enable = true; programs.starship.enable = true;
} }
+6 -3
View File
@@ -2,11 +2,13 @@
config, config,
pkgs, pkgs,
... ...
}: let }:
let
cfg = config.omarchy; cfg = config.omarchy;
themes = import ../themes.nix; themes = import ../themes.nix;
theme = themes.${cfg.theme}; theme = themes.${cfg.theme};
in { in
{
programs.vscode = { programs.vscode = {
enable = true; enable = true;
profiles.default = { profiles.default = {
@@ -23,7 +25,8 @@ in {
# // cfg.vscode_settings; # // cfg.vscode_settings;
extensions = with pkgs.vscode-extensions; extensions =
with pkgs.vscode-extensions;
[ [
bbenoist.nix bbenoist.nix
vscodevim.vim vscodevim.vim
+16 -5
View File
@@ -1,13 +1,16 @@
inputs: { inputs:
{
config, config,
pkgs, pkgs,
... ...
}: let }:
let
palette = config.colorScheme.palette; palette = config.colorScheme.palette;
convert = inputs.nix-colors.lib.conversions.hexToRGBString; convert = inputs.nix-colors.lib.conversions.hexToRGBString;
backgroundRgb = "rgb(${convert ", " palette.base00})"; backgroundRgb = "rgb(${convert ", " palette.base00})";
foregroundRgb = "rgb(${convert ", " palette.base05})"; foregroundRgb = "rgb(${convert ", " palette.base05})";
in { in
{
home.file = { home.file = {
".config/waybar/" = { ".config/waybar/" = {
source = ../../config/waybar; source = ../../config/waybar;
@@ -86,7 +89,13 @@ in {
tooltip = false; tooltip = false;
}; };
network = { network = {
format-icons = ["󰤯" "󰤟" "󰤢" "󰤥" "󰤨"]; format-icons = [
"󰤯"
"󰤟"
"󰤢"
"󰤥"
"󰤨"
];
format = "{icon}"; format = "{icon}";
format-wifi = "{icon}"; format-wifi = "{icon}";
format-ethernet = "󰀂"; format-ethernet = "󰀂";
@@ -155,7 +164,9 @@ in {
on-click-right = "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"; # Updated command on-click-right = "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"; # Updated command
max-volume = 150; # Optional: allow volume over 100% max-volume = 150; # Optional: allow volume over 100%
}; };
tray = {spacing = 13;}; tray = {
spacing = 13;
};
power-profiles-daemon = { power-profiles-daemon = {
format = "{icon}"; format = "{icon}";
tooltip-format = "Power profile: {profile}"; tooltip-format = "Power profile: {profile}";
+2 -1
View File
@@ -2,7 +2,8 @@
config, config,
pkgs, pkgs,
... ...
}: { }:
{
home.file = { home.file = {
".config/wofi/style.css" = { ".config/wofi/style.css" = {
text = '' text = ''
+2 -1
View File
@@ -1,4 +1,5 @@
{...}: { { ... }:
{
programs.zoxide = { programs.zoxide = {
enable = true; enable = true;
enableZshIntegration = true; enableZshIntegration = true;
+4 -3
View File
@@ -1,4 +1,5 @@
{...}: { { ... }:
{
programs.zsh = { programs.zsh = {
enable = true; enable = true;
autosuggestion.enable = true; autosuggestion.enable = true;
@@ -7,11 +8,11 @@
plugins = [ plugins = [
{ {
name = "plugins/git"; name = "plugins/git";
tags = [from:oh-my-zsh]; tags = [ "from:oh-my-zsh" ];
} }
{ {
name = "fdellwing/zsh-bat"; name = "fdellwing/zsh-bat";
tags = [as:command]; tags = [ "as:command" ];
} }
]; ];
}; };
+2 -1
View File
@@ -1,4 +1,5 @@
{...}: { { ... }:
{
programs = { programs = {
_1password.enable = true; _1password.enable = true;
_1password-gui.enable = true; _1password-gui.enable = true;
+2 -1
View File
@@ -1,4 +1,5 @@
{pkgs, ...}: { { pkgs, ... }:
{
virtualisation.containers.enable = true; virtualisation.containers.enable = true;
virtualisation = { virtualisation = {
docker.enable = true; docker.enable = true;
+6 -3
View File
@@ -1,11 +1,14 @@
inputs: { inputs:
{
config, config,
pkgs, pkgs,
... ...
}: let }:
let
cfg = config.omarchy; cfg = config.omarchy;
packages = import ../packages.nix { inherit pkgs; }; packages = import ../packages.nix { inherit pkgs; };
in { in
{
imports = [ imports = [
(import ./hyprland.nix inputs) (import ./hyprland.nix inputs)
(import ./system.nix) (import ./system.nix)
+4 -2
View File
@@ -1,8 +1,10 @@
inputs: { inputs:
{
config, config,
pkgs, pkgs,
... ...
}: { }:
{
programs.hyprland = { programs.hyprland = {
enable = true; enable = true;
# package = inputs.hyprland.packages.${pkgs.system}.hyprland; # package = inputs.hyprland.packages.${pkgs.system}.hyprland;
+8 -3
View File
@@ -3,10 +3,15 @@
pkgs, pkgs,
lib, lib,
... ...
}: let }:
let
cfg = config.omarchy; cfg = config.omarchy;
packages = import ../packages.nix {inherit pkgs lib; exclude_packages = cfg.exclude_packages;}; packages = import ../packages.nix {
in { inherit pkgs lib;
exclude_packages = cfg.exclude_packages;
};
in
{
security.rtkit.enable = true; security.rtkit.enable = true;
services.pulseaudio.enable = false; services.pulseaudio.enable = false;
services.pipewire = { services.pipewire = {
+12 -4
View File
@@ -1,4 +1,8 @@
{pkgs, lib, exclude_packages ? []}: {
pkgs,
lib,
exclude_packages ? [ ],
}:
let let
# Essential Hyprland packages - cannot be excluded # Essential Hyprland packages - cannot be excluded
hyprlandPackages = with pkgs; [ hyprlandPackages = with pkgs; [
@@ -33,7 +37,9 @@ let
]; ];
# Discretionary packages - can be excluded by user # Discretionary packages - can be excluded by user
discretionaryPackages = with pkgs; [ discretionaryPackages =
with pkgs;
[
# TUIs # TUIs
lazygit lazygit
lazydocker lazydocker
@@ -54,7 +60,8 @@ let
# Containers # Containers
docker-compose docker-compose
ffmpeg ffmpeg
] ++ lib.optionals (pkgs.system == "x86_64-linux") [ ]
++ lib.optionals (pkgs.system == "x86_64-linux") [
typora typora
dropbox dropbox
spotify spotify
@@ -63,7 +70,8 @@ let
# Only allow excluding discretionary packages to prevent breaking the system # Only allow excluding discretionary packages to prevent breaking the system
filteredDiscretionaryPackages = lib.lists.subtractLists exclude_packages discretionaryPackages; filteredDiscretionaryPackages = lib.lists.subtractLists exclude_packages discretionaryPackages;
allSystemPackages = hyprlandPackages ++ systemPackages ++ filteredDiscretionaryPackages; allSystemPackages = hyprlandPackages ++ systemPackages ++ filteredDiscretionaryPackages;
in { in
{
# Regular packages # Regular packages
systemPackages = allSystemPackages; systemPackages = allSystemPackages;