diff --git a/configs/common.nix b/configs/common.nix index 502b08a..8d75731 100644 --- a/configs/common.nix +++ b/configs/common.nix @@ -5,13 +5,16 @@ _utils, agenix, camasca, - hjem, + home-manager, nixpkgs, nix-index-database, vencord, ... }: let + username = "leo"; + stateVersion = "24.11"; + rootPassword = _utils.setupSingleSecret config "rootPassword" { }; secrets = _utils.setupSharedSecrets config { secrets = [ "userPassword" ]; @@ -20,10 +23,10 @@ in { imports = [ agenix.nixosModules.default - hjem.nixosModules.default + home-manager.nixosModules.home-manager nix-index-database.nixosModules.nix-index - (lib.mkAliasOptionModule [ "hj" ] [ "hjem" "users" "leo" "files" ]) + (lib.mkAliasOptionModule [ "hm" ] [ "home-manager" "users" username ]) rootPassword.generate secrets.generate @@ -68,17 +71,21 @@ in wget ]; - hjem = { - clobberByDefault = true; - users.leo.files = { - ".ssh/config".text = '' - Host * - ForwardAgent yes - AddKeysToAgent yes - ''; + hm = { + home = { inherit stateVersion; }; + + programs.ssh = { + enable = true; + addKeysToAgent = "yes"; + forwardAgent = true; }; }; + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + }; + i18n.defaultLocale = "en_US.UTF-8"; networking = { @@ -189,7 +196,7 @@ in time.timeZone = "Europe/Paris"; users.users = { - leo = { + "${username}" = { isNormalUser = true; shell = pkgs.fish; extraGroups = [ @@ -218,5 +225,5 @@ in # this value at the release version of the first install of this system. # Before changing this value read the documentation for this option # (e.g. man configuration.nix or on https://nixos.org/nixos/options.html). - system.stateVersion = lib.mkDefault "24.11"; # Did you read the comment? + system.stateVersion = lib.mkDefault stateVersion; # Did you read the comment? } diff --git a/configs/desktop.nix b/configs/desktop.nix index 7b6b0fc..5538560 100644 --- a/configs/desktop.nix +++ b/configs/desktop.nix @@ -14,7 +14,6 @@ ../programs/ghostty.nix ../programs/gnome.nix ../programs/java.nix - ../programs/neovim/neovide.nix ]; boot = { @@ -45,30 +44,8 @@ sbctl wl-clipboard - chromium - (discord.override { - withOpenASAR = true; - withVencord = true; - }) - gimp3 - gparted - idea-wrapped - mpv - obsidian - strawberry - teams-for-linux - thunderbird - vscode - niigo-miku-cursors patchouli-cursors - - # libreoffice stuff - libreoffice-qt6-fresh - hunspell - hunspellDicts.en_US - hunspellDicts.fr-moderne - ]; sessionVariables = { @@ -100,6 +77,32 @@ enable32Bit = true; }; + hm.imports = [ ../programs/neovim/neovide.nix ]; + hm.home = { + packages = with pkgs; [ + chromium + (discord.override { + withOpenASAR = true; + withVencord = true; + }) + gimp3 + gparted + idea-wrapped + mpv + obsidian + strawberry + teams-for-linux + thunderbird + vscode + + # libreoffice stuff + libreoffice-qt6-fresh + hunspell + hunspellDicts.en_US + hunspellDicts.fr-moderne + ]; + }; + i18n.extraLocaleSettings = { LC_ADDRESS = "fr_FR.UTF-8"; LC_IDENTIFICATION = "fr_FR.UTF-8"; diff --git a/configs/laptop.nix b/configs/laptop.nix index 4c38bca..7f97765 100644 --- a/configs/laptop.nix +++ b/configs/laptop.nix @@ -2,7 +2,6 @@ lib, pkgs, config, - _utils, ... }: { @@ -33,10 +32,8 @@ # hyprland stuff services.blueman = lib.mkIf config.programs.hyprland.enable { enable = true; }; - hj.".config/hypr/hyprland.conf".text = _utils.toHyprconf { - exec-once = with pkgs; [ - "${lib.getExe networkmanagerapplet}" - "${lib.getExe' blueman "blueman-applet"}" - ]; - }; + hm.wayland.windowManager.hyprland.settings.exec-once = with pkgs; [ + "${lib.getExe networkmanagerapplet}" + "${lib.getExe' blueman "blueman-applet"}" + ]; } diff --git a/flake.lock b/flake.lock index 017c881..cd16f97 100644 --- a/flake.lock +++ b/flake.lock @@ -3,7 +3,9 @@ "agenix": { "inputs": { "darwin": [], - "home-manager": [], + "home-manager": [ + "home-manager" + ], "nixpkgs": [ "nixpkgs" ], @@ -143,23 +145,23 @@ "type": "github" } }, - "hjem": { + "home-manager": { "inputs": { "nixpkgs": [ "nixpkgs" ] }, "locked": { - "lastModified": 1746355589, - "narHash": "sha256-LguszqsDBTtdBxblQTtN7vOAYmfoe43aHkB8aK1dChE=", - "owner": "feel-co", - "repo": "hjem", - "rev": "77b37eeb583d43e1c723119a69c906235174ce57", + "lastModified": 1746413188, + "narHash": "sha256-i6BoiQP0PasExESQHszC0reQHfO6D4aI2GzOwZMOI20=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "8a318641ac13d3bc0a53651feaee9560f9b2d89a", "type": "github" }, "original": { - "owner": "feel-co", - "repo": "hjem", + "owner": "nix-community", + "repo": "home-manager", "type": "github" } }, @@ -281,7 +283,7 @@ "flake-parts": "flake-parts", "flake-utils": "flake-utils", "getchvim": "getchvim", - "hjem": "hjem", + "home-manager": "home-manager", "lanzaboote": "lanzaboote", "mystia": "mystia", "nix-index-database": "nix-index-database", diff --git a/flake.nix b/flake.nix index 9be34c3..af39522 100644 --- a/flake.nix +++ b/flake.nix @@ -68,7 +68,7 @@ url = "github:uku3lig/agenix"; inputs.nixpkgs.follows = "nixpkgs"; inputs.systems.follows = "systems"; - inputs.home-manager.follows = ""; + inputs.home-manager.follows = "home-manager"; inputs.darwin.follows = ""; }; @@ -89,8 +89,8 @@ inputs.nixpkgs.follows = "nixpkgs"; }; - hjem = { - url = "github:feel-co/hjem"; + home-manager = { + url = "github:nix-community/home-manager"; inputs.nixpkgs.follows = "nixpkgs"; }; diff --git a/global/utils.nix b/global/utils.nix index 3efb923..a98b0a5 100644 --- a/global/utils.nix +++ b/global/utils.nix @@ -111,62 +111,4 @@ alias = builtins.toString (pkgs.writeTextDir filename content) + "/"; tryFiles = "${filename} =${builtins.toString status}"; }; - - # https://github.com/nix-community/home-manager/blob/ec71b5162848e6369bdf2be8d2f1dd41cded88e8/modules/lib/generators.nix#L4-L61 - toHyprconf = - attrs: - let - inherit (lib) - all - concatMapStringsSep - concatStrings - concatStringsSep - filterAttrs - foldl - generators - hasPrefix - isAttrs - isList - mapAttrsToList - replicate - ; - - indentLevel = 0; - importantPrefixes = [ "$" ]; - initialIndent = concatStrings (replicate indentLevel " "); - - toHyprconf' = - indent: attrs: - let - sections = filterAttrs (n: v: isAttrs v || (isList v && all isAttrs v)) attrs; - - mkSection = - n: attrs: - if lib.isList attrs then - (concatMapStringsSep "\n" (a: mkSection n a) attrs) - else - '' - ${indent}${n} { - ${toHyprconf' " ${indent}" attrs}${indent}} - ''; - - mkFields = generators.toKeyValue { - listsAsDuplicateKeys = true; - inherit indent; - }; - - allFields = filterAttrs (n: v: !(isAttrs v || (isList v && all isAttrs v))) attrs; - - isImportantField = - n: _: foldl (acc: prev: if hasPrefix prev n then true else acc) false importantPrefixes; - - importantFields = filterAttrs isImportantField allFields; - - fields = builtins.removeAttrs allFields (mapAttrsToList (n: _: n) importantFields); - in - mkFields importantFields - + concatStringsSep "\n" (mapAttrsToList mkSection sections) - + mkFields fields; - in - toHyprconf' initialIndent attrs; } diff --git a/programs/alacritty.nix b/programs/alacritty.nix index da06c3d..f59a58f 100644 --- a/programs/alacritty.nix +++ b/programs/alacritty.nix @@ -3,23 +3,24 @@ pkgs, ... }: -let - toml = pkgs.formats.toml { }; - - theme = pkgs.fetchurl { - # url = "https://raw.githubusercontent.com/catppuccin/alacritty/ce476fb41f307d90f841c1a4fd7f0727c21248b2/catppuccin-macchiato.toml"; - url = "https://raw.githubusercontent.com/rose-pine/alacritty/3c3e36eb5225b0eb6f1aa989f9d9e783a5b47a83/dist/rose-pine.toml"; - hash = "sha256-MheSmzz02ZLAOS2uaclyazu6E//eikcdFydFfkio0/U="; - }; - themeAttr = builtins.fromTOML (builtins.readFile theme); -in { - hj.".config/alacritty/alacritty.toml".source = toml.generate "alacritty.toml" ( - lib.recursiveUpdate themeAttr { - font = { - normal.family = "Iosevka Nerd Font"; - size = 12; + hm.programs.alacritty = + let + theme = pkgs.fetchurl { + # url = "https://raw.githubusercontent.com/catppuccin/alacritty/ce476fb41f307d90f841c1a4fd7f0727c21248b2/catppuccin-macchiato.toml"; + url = "https://raw.githubusercontent.com/rose-pine/alacritty/3c3e36eb5225b0eb6f1aa989f9d9e783a5b47a83/dist/rose-pine.toml"; + hash = "sha256-MheSmzz02ZLAOS2uaclyazu6E//eikcdFydFfkio0/U="; }; - } - ); + + themeAttr = builtins.fromTOML (builtins.readFile theme); + in + { + enable = true; + settings = lib.recursiveUpdate themeAttr { + font = { + normal.family = "Iosevka Nerd Font"; + size = 12; + }; + }; + }; } diff --git a/programs/fish.nix b/programs/fish.nix index 42657e5..824094b 100644 --- a/programs/fish.nix +++ b/programs/fish.nix @@ -6,16 +6,17 @@ fishPlugins.hydro ]; - hj.".config/fish/config.fish".text = '' - function fish_greeting - end + hm.programs.fish = { + enable = true; - if status is-interactive + interactiveShellInit = '' set --global hydro_symbol_git_dirty "*" set --global hydro_color_pwd blue set --global hydro_color_git magenta set --global hydro_color_prompt green set --global hydro_color_duration yellow - end - ''; + ''; + + functions.fish_greeting = ""; + }; } diff --git a/programs/fuzzel.nix b/programs/fuzzel.nix index 7baf6ac..a3c224a 100644 --- a/programs/fuzzel.nix +++ b/programs/fuzzel.nix @@ -1,24 +1,24 @@ -{ lib, pkgs, ... }: { - environment.systemPackages = [ pkgs.fuzzel ]; + hm.programs.fuzzel = { + enable = true; + settings = { + main = { + font = "Iosevka Nerd Font:size=16"; + dpi-aware = false; + horizontal-pad = 20; + }; - hj.".config/fuzzel/fuzzel.ini".text = lib.generators.toINI { } { - main = { - font = "Iosevka Nerd Font:size=16"; - dpi-aware = false; - horizontal-pad = 20; - }; + border.radius = 8; - border.radius = 8; - - colors = { - background = "24273aff"; # base - border = "91d7e3cc"; # sky - text = "cad3f5ff"; # text - match = "a6da95ff"; # green - selection = "f4dbd6ff"; # rosewater - selection-text = "181926ff"; # crust - selection-match = "40a02bff"; # latte green + colors = { + background = "24273aff"; # base + border = "91d7e3cc"; # sky + text = "cad3f5ff"; # text + match = "a6da95ff"; # green + selection = "f4dbd6ff"; # rosewater + selection-text = "181926ff"; # crust + selection-match = "40a02bff"; # latte green + }; }; }; } diff --git a/programs/games.nix b/programs/games.nix index dc83c4e..0b09711 100644 --- a/programs/games.nix +++ b/programs/games.nix @@ -5,7 +5,7 @@ xpadneo.enable = true; }; - environment.systemPackages = with pkgs; [ + hm.home.packages = with pkgs; [ obs-studio osu-lazer-bin krita diff --git a/programs/ghostty.nix b/programs/ghostty.nix index 477f94b..bb7ae9c 100644 --- a/programs/ghostty.nix +++ b/programs/ghostty.nix @@ -1,12 +1,14 @@ -{ pkgs, ... }: { - environment.systemPackages = [ pkgs.ghostty ]; - - hj.".config/ghostty/config".text = '' - font-family = Iosevka Term - font-feature = -calt - font-feature = -dlig - font-size = 12 - theme = light:catppuccin-latte,dark:catppuccin-mocha - ''; + hm.programs.ghostty = { + enable = true; + settings = { + theme = "light:catppuccin-latte,dark:catppuccin-mocha"; + font-family = "Iosevka Term"; + font-size = 12; + font-feature = [ + "-calt" + "-dlig" + ]; + }; + }; } diff --git a/programs/git.nix b/programs/git.nix index 8218619..0ba006b 100644 --- a/programs/git.nix +++ b/programs/git.nix @@ -1,36 +1,36 @@ -{ lib, pkgs, ... }: +{ config, ... }: { - environment.systemPackages = with pkgs; [ - git - gh - ]; + programs.git.enable = true; - hj = { - ".gitconfig".text = lib.generators.toGitINI { - user = { - name = "uku"; - email = "hi@uku.moe"; - signingKey = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIN+7+KfdOrhcnHayxvOENUeMx8rE4XEIV/AxMHiaNUP8"; + hm.programs = { + git = { + inherit (config.programs.git) enable package; + userName = "uku"; + userEmail = "hi@uku.moe"; + + signing = { + format = "ssh"; + key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIN+7+KfdOrhcnHayxvOENUeMx8rE4XEIV/AxMHiaNUP8"; + signByDefault = true; }; - commit = { - gpgSign = true; - verbose = true; - }; + # delta.enable = true; - gpg.format = "ssh"; - tag.gpgSign = true; - core.autocrlf = "input"; - diff.submodule = "log"; - init.defaultBranch = "main"; - merge.conflictStyle = "zdiff3"; - push.autoSetupRemote = true; - rebase.autoStash = true; - status.submoduleSummary = true; - submodule.recurse = true; + extraConfig = { + init.defaultBranch = "main"; + core.autocrlf = "input"; + push.autoSetupRemote = true; + merge.conflictStyle = "zdiff3"; + rebase.autoStash = true; + status.submoduleSummary = true; + diff.submodule = "log"; + submodule.recurse = true; + commit.verbose = true; + }; }; - ".config/gh/config.yml".text = lib.generators.toYAML { } { + gh = { + enable = true; settings.git_protocol = "ssh"; }; }; diff --git a/programs/gnome.nix b/programs/gnome.nix index 852786f..fa1f145 100644 --- a/programs/gnome.nix +++ b/programs/gnome.nix @@ -16,6 +16,14 @@ terminal = "ghostty"; }; + hm.programs.gnome-shell = { + enable = true; + extensions = with pkgs.gnomeExtensions; [ + { package = appindicator; } + { package = dash-to-panel; } + ]; + }; + # ssh-agent is provided by gnome-keyring-daemon # (mabye soon by gcr, see NixOS/nixpkgs#140824) programs.ssh.startAgent = lib.mkForce false; @@ -24,8 +32,6 @@ systemPackages = [ adw-gtk3 gnome-tweaks - gnomeExtensions.appindicator - gnomeExtensions.dash-to-panel ]; gnome.excludePackages = [ diff --git a/programs/hyprland-misc.nix b/programs/hyprland-misc.nix index 36e7bd7..f37e79e 100644 --- a/programs/hyprland-misc.nix +++ b/programs/hyprland-misc.nix @@ -1,7 +1,8 @@ { pkgs, ... }: { # utility packages for hyprland, since you know it's not a DE - environment.systemPackages = with pkgs; [ + + hm.home.packages = with pkgs; [ gnome.gnome-calculator mate.eom nwg-look diff --git a/programs/hyprland.nix b/programs/hyprland.nix index 3bc0936..ae83972 100644 --- a/programs/hyprland.nix +++ b/programs/hyprland.nix @@ -1,7 +1,6 @@ { lib, pkgs, - _utils, ... }: { @@ -24,163 +23,168 @@ xdg.portal.extraPortals = with pkgs; [ xdg-desktop-portal-gtk ]; - environment.systemPackages = with pkgs; [ - hyprpaper - hyprpicker - wl-clipboard - cliphist - swayidle - swappy - grimblast - playerctl - polkit_gnome - ]; + hm = { + home.packages = with pkgs; [ + hyprpaper + hyprpicker + wl-clipboard + cliphist + swayidle + swappy + grimblast + playerctl + polkit_gnome + ]; - hj.".config/hypr/hyprland.conf".text = - let - inherit (lib) getExe getExe'; - keys = [ - "ampersand" - "eacute" - "quotedbl" - "apostrophe" - "parenleft" - "minus" - "egrave" - "underscore" - "ccedilla" - "agrave" - ]; - in - with pkgs; - _utils.toHyprconf { - "$mod" = "SUPER"; - "$wl-paste" = getExe' wl-clipboard "wl-paste"; - "$wpctl" = getExe' wireplumber "wpctl"; + wayland.windowManager.hyprland = { + enable = true; + settings = + let + inherit (lib) getExe getExe'; + keys = [ + "ampersand" + "eacute" + "quotedbl" + "apostrophe" + "parenleft" + "minus" + "egrave" + "underscore" + "ccedilla" + "agrave" + ]; + in + with pkgs; + { + "$mod" = "SUPER"; + "$wl-paste" = getExe' wl-clipboard "wl-paste"; + "$wpctl" = getExe' wireplumber "wpctl"; - monitor = lib.mkDefault ",highres,auto,1"; + monitor = lib.mkDefault ",highres,auto,1"; - env = [ - "WLR_DRM_NO_ATOMIC,1" - "SDL_VIDEODRIVER,wayland" - "MOZ_ENABLE_WAYLAND,1" - "_JAVA_AWT_WM_NONREPARENTING,1" - "NIXOS_OZONE_WL,1" - ]; + env = [ + "WLR_DRM_NO_ATOMIC,1" + "SDL_VIDEODRIVER,wayland" + "MOZ_ENABLE_WAYLAND,1" + "_JAVA_AWT_WM_NONREPARENTING,1" + "NIXOS_OZONE_WL,1" + ]; - exec-once = [ - "${getExe waybar}" - "${getExe hyprpaper}" - "${getExe swayidle} -w" - "${polkit_gnome}/libexec/polkit-gnome-authentication-agent-1" - "$wl-paste --type text --watch ${getExe cliphist} store" - "$wl-paste --type image --watch ${getExe cliphist} store" - ]; + exec-once = [ + "${getExe waybar}" + "${getExe hyprpaper}" + "${getExe swayidle} -w" + "${polkit_gnome}/libexec/polkit-gnome-authentication-agent-1" + "$wl-paste --type text --watch ${getExe cliphist} store" + "$wl-paste --type image --watch ${getExe cliphist} store" + ]; - input = { - kb_layout = "fr"; - follow_mouse = 1; + input = { + kb_layout = "fr"; + follow_mouse = 1; - touchpad.drag_lock = true; + touchpad.drag_lock = true; - sensitivity = -0.1; - accel_profile = "flat"; - }; + sensitivity = -0.1; + accel_profile = "flat"; + }; - general = { - gaps_in = 0; - gaps_out = 0; - border_size = 0; + general = { + gaps_in = 0; + gaps_out = 0; + border_size = 0; - allow_tearing = true; - }; + allow_tearing = true; + }; - decoration = { - drop_shadow = false; - blur.enabled = true; - }; + decoration = { + drop_shadow = false; + blur.enabled = true; + }; - animations = { - enabled = true; + animations = { + enabled = true; - animation = [ - "windows, 1, 2, default" - "windowsOut, 1, 2, default, popin 90%" - "fade, 1, 2, default" - "workspaces, 1, 3, default" - ]; - }; + animation = [ + "windows, 1, 2, default" + "windowsOut, 1, 2, default, popin 90%" + "fade, 1, 2, default" + "workspaces, 1, 3, default" + ]; + }; - dwindle = { - pseudotile = true; - preserve_split = true; - force_split = 2; - }; + dwindle = { + pseudotile = true; + preserve_split = true; + force_split = 2; + }; - gestures.workspace_swipe = true; + gestures.workspace_swipe = true; - windowrulev2 = [ - "float, class:^(pavucontrol)$" + windowrulev2 = [ + "float, class:^(pavucontrol)$" - "suppressevent maximize, class:^(firefox)$" - "float, title:^(Picture-in-Picture)$" - "float, class:^(firefox)$, title:^()$" # notifications + "suppressevent maximize, class:^(firefox)$" + "float, title:^(Picture-in-Picture)$" + "float, class:^(firefox)$, title:^()$" # notifications - "immediate, class:^(cs2)$" - "immediate, class:^(osu.*)$" - "immediate, class:^(steam_app_1229490)$" # ultrakill - # "immediate, class:^(steam_app_\d+)$" - # "immediate, class:^(steam_app_322170)$" - ]; + "immediate, class:^(cs2)$" + "immediate, class:^(osu.*)$" + "immediate, class:^(steam_app_1229490)$" # ultrakill + # "immediate, class:^(steam_app_\d+)$" + # "immediate, class:^(steam_app_322170)$" + ]; - bind = - [ - "$mod, Return, exec, ${getExe alacritty}" - "$mod SHIFT, A, killactive," - "$mod SHIFT, E, exit," - "$mod SHIFT, Space, togglefloating," - "$mod, D, exec, ${getExe fuzzel}" - "$mod, F, fullscreen, 0" - "$mod, P, pseudo," # dwindle - "$mod, J, togglesplit," # dwindle - - # audio - ",XF86AudioRaiseVolume, exec, $wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+" - ",XF86AudioLowerVolume, exec, $wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-" - ",XF86AudioMute, exec, $wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle" - ",XF86AudioMicMute, exec, $wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle" - ",XF86AudioPause, exec, ${getExe playerctl} play-pause" - ",XF86AudioPlay, exec, ${getExe playerctl} play-pause" - ",XF86AudioNext, exec, ${getExe playerctl} next" - ",XF86AudioPrev, exec, ${getExe playerctl} previous" - - # backlight - ",XF86MonBrightnessUp, exec, ${getExe' light "light"} -A 5" - ",XF86MonBrightnessDown, exec, ${getExe' light "light"} -U 5" - - # screenshot - ",Print, exec, ${getExe grimblast} --freeze save area - | ${getExe swappy} -f -" - ] - ++ - # Switch workspaces with mod + [0-9] - # Move active window to a workspace with mod + SHIFT + [0-9] - lib.flatten ( - builtins.map ( - i: - let - key = builtins.elemAt keys (i - 1); - in + bind = [ - "$mod, ${key}, workspace, ${toString i}" - "$mod SHIFT, ${key}, movetoworkspace, ${toString i}" - ] - ) (lib.range 1 10) - ); + "$mod, Return, exec, ${getExe alacritty}" + "$mod SHIFT, A, killactive," + "$mod SHIFT, E, exit," + "$mod SHIFT, Space, togglefloating," + "$mod, D, exec, ${getExe fuzzel}" + "$mod, F, fullscreen, 0" + "$mod, P, pseudo," # dwindle + "$mod, J, togglesplit," # dwindle - bindm = [ - "$mod, mouse:272, movewindow" - "$mod, mouse:273, resizewindow" - "$mod SHIFT, mouse:272, resizewindow" - ]; + # audio + ",XF86AudioRaiseVolume, exec, $wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+" + ",XF86AudioLowerVolume, exec, $wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-" + ",XF86AudioMute, exec, $wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle" + ",XF86AudioMicMute, exec, $wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle" + ",XF86AudioPause, exec, ${getExe playerctl} play-pause" + ",XF86AudioPlay, exec, ${getExe playerctl} play-pause" + ",XF86AudioNext, exec, ${getExe playerctl} next" + ",XF86AudioPrev, exec, ${getExe playerctl} previous" + + # backlight + ",XF86MonBrightnessUp, exec, ${getExe' light "light"} -A 5" + ",XF86MonBrightnessDown, exec, ${getExe' light "light"} -U 5" + + # screenshot + ",Print, exec, ${getExe grimblast} --freeze save area - | ${getExe swappy} -f -" + ] + ++ + # Switch workspaces with mod + [0-9] + # Move active window to a workspace with mod + SHIFT + [0-9] + lib.flatten ( + builtins.map ( + i: + let + key = builtins.elemAt keys (i - 1); + in + [ + "$mod, ${key}, workspace, ${toString i}" + "$mod SHIFT, ${key}, movetoworkspace, ${toString i}" + ] + ) (lib.range 1 10) + ); + + bindm = [ + "$mod, mouse:272, movewindow" + "$mod, mouse:273, resizewindow" + "$mod SHIFT, mouse:272, resizewindow" + ]; + }; }; + }; } diff --git a/programs/neovim/neovide.nix b/programs/neovim/neovide.nix index 300a55f..5e78385 100644 --- a/programs/neovim/neovide.nix +++ b/programs/neovim/neovide.nix @@ -1,6 +1,7 @@ -{ pkgs, ... }: +# home-manager module { - environment.systemPackages = [ pkgs.neovide ]; - - hj.".config/neovide/config.toml".text = "fork = true"; + programs.neovide = { + enable = true; + settings.fork = true; + }; } diff --git a/programs/rust.nix b/programs/rust.nix index 1affa7e..ea33595 100644 --- a/programs/rust.nix +++ b/programs/rust.nix @@ -8,8 +8,8 @@ let toml = pkgs.formats.toml { }; in { - hj.".cargo/config.toml".source = toml.generate "config.toml" { - build.target-dir = "${config.hjem.users.leo.directory}/.cargo/target"; + hm.home.file.".cargo/config.toml".source = toml.generate "config.toml" { + build.target-dir = "${config.hm.home.homeDirectory}/.cargo/target"; target.x86_64-unknown-linux-gnu = { linker = "${lib.getExe pkgs.clang}"; diff --git a/programs/starship/default.nix b/programs/starship/default.nix index d7cb632..135da01 100644 --- a/programs/starship/default.nix +++ b/programs/starship/default.nix @@ -1,24 +1,13 @@ -{ lib, pkgs, ... }: -let - toml = pkgs.formats.toml { }; -in { - environment.systemPackages = [ pkgs.starship ]; + hm.programs.starship = { + enable = true; + settings = { + add_newline = false; - hj = { - ".config/starship.toml" = - toml.generate "starship.toml" { - add_newline = false; - - directory = { - truncation_length = 3; - truncation_symbol = "…/"; - }; - } - // (import ./nerd-font.nix); - - ".config/fish/config.fish".text = lib.mkAfter '' - starship init fish | source - ''; + directory = { + truncation_length = 3; + truncation_symbol = "…/"; + }; + } // (import ./nerd-font.nix); }; } diff --git a/programs/waybar/default.nix b/programs/waybar/default.nix index 5a4b4c9..0290b19 100644 --- a/programs/waybar/default.nix +++ b/programs/waybar/default.nix @@ -5,92 +5,93 @@ ... }: { - environment.systemPackages = [ pkgs.waybar ]; + hm.programs.waybar = { + enable = true; + style = ./style.css; - hj = { - ".config/waybar/style.css".source = ./style.css; + settings = [ + { + position = "bottom"; + layer = "top"; + height = 24; + spacing = 2; - ".config/waybar/config".text = builtins.toJSON { - position = "bottom"; - layer = "top"; - height = 24; - spacing = 2; + modules-left = [ "hyprland/workspaces" ]; + modules-center = [ ]; + modules-right = + [ "memory" ] + ++ lib.optionals (builtins.elem "amdgpu" config.services.xserver.videoDrivers) [ + "custom/gpu-usage" + ] + ++ [ + "cpu" + "wireplumber" + ] + ++ lib.optionals config.services.power-profiles-daemon.enable [ "battery" ] + ++ lib.optionals config.programs.light.enable [ "backlight" ] + ++ [ + "clock" + "tray" + ]; - modules-left = [ "hyprland/workspaces" ]; - modules-center = [ ]; - modules-right = - [ "memory" ] - ++ lib.optionals (builtins.elem "amdgpu" config.services.xserver.videoDrivers) [ - "custom/gpu-usage" - ] - ++ [ - "cpu" - "wireplumber" - ] - ++ lib.optionals config.services.power-profiles-daemon.enable [ "battery" ] - ++ lib.optionals config.programs.light.enable [ "backlight" ] - ++ [ - "clock" - "tray" - ]; - - "hyprland/workspaces" = { - format = "{name}"; - on-click = "activate"; - sort-by-number = true; - }; - - tray = { - icon-size = 16; - spacing = 10; - }; - - clock = { - format-alt = "{:%Y-%m-%d %H:%M:%S}"; - interval = 1; - }; - - cpu = { - format = "CPU {usage}%"; - tooltip = false; - interval = 2; - }; - - memory = { - format = "RAM {}%"; - interval = 2; - }; - - backlight = { - format = "LGT {percent}%"; - scroll-step = 5; - }; - - battery = { - states = { - low = 15; + "hyprland/workspaces" = { + format = "{name}"; + on-click = "activate"; + sort-by-number = true; }; - format = "BAT {capacity}%"; - format-charging = "BAT+ {capacity}%"; - format-plugged = "BAT+ {capacity}%"; - format-low = "BAT! {capacity}%"; - interval = 5; - }; - wireplumber = { - scroll-step = 5; - format = "VOL {volume}%"; - format-muted = "muted"; - on-click = "${lib.getExe' pkgs.wireplumber "wpctl"} set-mute @DEFAULT_AUDIO_SINK@ toggle"; - on-click-right = "${lib.getExe pkgs.pavucontrol}"; - }; + tray = { + icon-size = 16; + spacing = 10; + }; - "custom/gpu-usage" = { - exec = "cat /sys/class/hwmon/hwmon*/device/gpu_busy_percent"; - format = "GPU {}%"; - return-type = ""; - interval = 2; - }; - }; + clock = { + format-alt = "{:%Y-%m-%d %H:%M:%S}"; + interval = 1; + }; + + cpu = { + format = "CPU {usage}%"; + tooltip = false; + interval = 2; + }; + + memory = { + format = "RAM {}%"; + interval = 2; + }; + + backlight = { + format = "LGT {percent}%"; + scroll-step = 5; + }; + + battery = { + states = { + low = 15; + }; + format = "BAT {capacity}%"; + format-charging = "BAT+ {capacity}%"; + format-plugged = "BAT+ {capacity}%"; + format-low = "BAT! {capacity}%"; + interval = 5; + }; + + wireplumber = { + scroll-step = 5; + format = "VOL {volume}%"; + format-muted = "muted"; + on-click = "${lib.getExe' pkgs.wireplumber "wpctl"} set-mute @DEFAULT_AUDIO_SINK@ toggle"; + on-click-right = "${lib.getExe pkgs.pavucontrol}"; + }; + + "custom/gpu-usage" = { + exec = "cat /sys/class/hwmon/hwmon*/device/gpu_busy_percent"; + format = "GPU {}%"; + return-type = ""; + interval = 2; + }; + } + ]; }; } diff --git a/systems/fuji/default.nix b/systems/fuji/default.nix index 46fe50a..c1fb41a 100644 --- a/systems/fuji/default.nix +++ b/systems/fuji/default.nix @@ -1,4 +1,4 @@ -{ pkgs, _utils, ... }: +{ pkgs, ... }: { imports = [ ./nvidia.nix @@ -7,16 +7,20 @@ services.xserver.videoDrivers = [ "amdgpu" ]; - environment.systemPackages = with pkgs; [ - wineWowPackages.waylandFull - ]; - - hj.".config/hypr/hyprland.conf".text = _utils.toHyprconf { - monitor = "DP-1,3840x2160@144,0x0,1.5"; - xwayland.force_zero_scaling = true; - env = [ - "GDK_SCALE,1.5" - "XCURSOR_SIZE,24" + hm = { + home.packages = with pkgs; [ + wineWowPackages.waylandFull ]; + + wayland.windowManager.hyprland.settings = { + monitor = "DP-1,3840x2160@144,0x0,1.5"; + + xwayland.force_zero_scaling = true; + + env = [ + "GDK_SCALE,1.5" + "XCURSOR_SIZE,24" + ]; + }; }; } diff --git a/systems/fuji/nvidia.nix b/systems/fuji/nvidia.nix index d22d70c..e77dab7 100644 --- a/systems/fuji/nvidia.nix +++ b/systems/fuji/nvidia.nix @@ -2,7 +2,6 @@ lib, pkgs, config, - _utils, ... }: { @@ -38,12 +37,10 @@ }; }; - hj.".config/hypr/hyprland.conf".text = _utils.toHyprconf { - env = [ - "XDG_SESSION_TYPE,wayland" - "GBM_BACKEND,nvidia-drm" - "__GLX_VENDOR_LIBRARY_NAME,nvidia" - "NVD_BACKEND,direct" - ]; - }; + hm.wayland.windowManager.hyprland.settings.env = [ + "XDG_SESSION_TYPE,wayland" + "GBM_BACKEND,nvidia-drm" + "__GLX_VENDOR_LIBRARY_NAME,nvidia" + "NVD_BACKEND,direct" + ]; } diff --git a/systems/mottarone/default.nix b/systems/mottarone/default.nix index 8315878..07d28fe 100644 --- a/systems/mottarone/default.nix +++ b/systems/mottarone/default.nix @@ -29,14 +29,9 @@ in i18n.defaultLocale = lib.mkForce "fr_FR.UTF-8"; - hj = { - ".gitconfig".text = lib.generators.toGitINI { - include.path = "~/.config/git/work_config"; - }; - - ".ssh/config".text = lib.mkBefore '' - Include work_config - ''; + hm.programs = { + git.includes = [ { path = "~/.config/git/work_config"; } ]; + ssh.includes = [ "work_config" ]; }; networking.firewall.allowedTCPPorts = [ 8000 ];