diff --git a/flake.nix b/flake.nix index 955b083..8608d69 100644 --- a/flake.nix +++ b/flake.nix @@ -33,6 +33,10 @@ }; homeConfigurations.ahnwuoa = home-manager.lib.homeManagerConfiguration { inherit pkgs; + extraSpecialArgs = rec { + username = "ahnwuoa"; + homeDirectory = "/home/${username}"; + }; modules = [ user/home.nix overlays diff --git a/user/home.nix b/user/home.nix index db3350e..46b858e 100644 --- a/user/home.nix +++ b/user/home.nix @@ -1,11 +1,11 @@ -{ config, pkgs, ... }: +{ config, pkgs, username, homeDirectory, ... }: -let - username = "ahnwuoa"; - homeDirectory = "/home/${username}"; - mkln = x: config.lib.file.mkOutOfStoreSymlink "${homeDirectory}/.local/nixos/user/${x}"; -in { + imports = [ + ./xdg.nix + ./theme.nix + ]; + home.username = username; home.homeDirectory = homeDirectory; @@ -88,82 +88,5 @@ in pwninit patchelf ]; - xdg.configFile.alacritty.source = mkln "config/alacritty"; - xdg.configFile.awesome.source = mkln "config/awesome"; - xdg.configFile.bash.source = mkln "config/bash"; - xdg.configFile.fcitx5.source = config/fcitx5; - xdg.configFile.fontconfig.source = config/fontconfig; - xdg.configFile."gdb/gdbinit.py".source = config/gdb/gdbinit.py; - xdg.configFile."gdb/gdbinit".text = '' - source ${pkgs.pwndbg}/share/pwndbg/gdbinit.py - source ~/.config/gdb/gdbinit.py - ''; - xdg.configFile.git.source = config/git; - xdg.configFile.lsd.source = config/lsd; - xdg.configFile.picom.source = config/picom; - xdg.configFile.python.source = config/python; - xdg.configFile.qt5ct.source = config/qt5ct; - xdg.configFile.readline.source = config/readline; - xdg.configFile."starship.toml".source = config/starship.toml; - xdg.configFile.sx.source = mkln "config/sx"; - xdg.configFile."tmux/tmux.conf".text = (builtins.readFile config/tmux/tmux.conf) + '' - run ${pkgs.tmuxPlugins.vim-tmux-navigator.rtp} - run ${pkgs.tmuxPlugins.sessionist.rtp} - ''; - fonts.fontconfig.enable = false; - qt = { - enable = true; - platformTheme.name = "qtct"; - style.name = "breeze"; - style.package = pkgs.libsForQt5.breeze-qt5; - }; - gtk = { - enable = true; - gtk2.configLocation = "${config.xdg.configHome}/gtk-2.0/gtkrc"; - gtk2.extraConfig = "gtk-recent-files-max-age = 0"; - gtk3.extraConfig = { gtk-recent-files-limit = 0; }; - theme = { - name = "Breeze"; - package = pkgs.libsForQt5.breeze-gtk; - }; - }; - home.pointerCursor = { - name = "breeze_cursors"; - package = pkgs.libsForQt5.breeze-qt5; - size = 24; - gtk.enable = true; - }; - home.file.".icons/default/index.theme".enable = false; - home.file.".icons/breeze_cursors".enable = false; - xdg.mimeApps.enable = true; - xdg.mimeApps.defaultApplications = let - image = "nsxiv.desktop"; - browser = "firefox.desktop"; - text = "nvim.desktop"; - media = "mpv.desktop"; - in { - "image/jpeg" = image; - "image/png" = image; - "image/gif" = media; - - "audio/mpeg" = media; - "audio/ogg" = media; - "audio/vorbis" = media; - "audio/x-vorbis+ogg" = media; - - "video/mp4" = media; - "video/mpeg" = media; - - "text/plain" = text; - "application/xml" = text; - }; - xdg.portal = { - enable = true; - configPackages = [ pkgs.libsForQt5.xdg-desktop-portal-kde ]; - extraPortals = [ pkgs.libsForQt5.xdg-desktop-portal-kde ]; - config.common.default = "kde"; - }; - xdg.dataFile."recently-used.xbel".text = ""; - xdg.dataFile."RecentDocuments".text = ""; home.stateVersion = "24.05"; } diff --git a/user/theme.nix b/user/theme.nix new file mode 100644 index 0000000..1ca18f2 --- /dev/null +++ b/user/theme.nix @@ -0,0 +1,27 @@ +{ config, pkgs, ... }: + +{ + qt = { + enable = true; + platformTheme.name = "qtct"; + style.name = "breeze"; + style.package = pkgs.libsForQt5.breeze-qt5; + }; + gtk = { + enable = true; + gtk2.extraConfig = "gtk-recent-files-max-age = 0"; + gtk3.extraConfig = { gtk-recent-files-limit = 0; }; + theme = { + name = "Breeze"; + package = pkgs.libsForQt5.breeze-gtk; + }; + }; + home.pointerCursor = { + name = "breeze_cursors"; + package = pkgs.libsForQt5.breeze-qt5; + size = 24; + gtk.enable = true; + }; + home.file.".icons/default/index.theme".enable = false; + home.file.".icons/breeze_cursors".enable = false; +} diff --git a/user/xdg.nix b/user/xdg.nix new file mode 100644 index 0000000..7a97387 --- /dev/null +++ b/user/xdg.nix @@ -0,0 +1,60 @@ +{ config, pkgs, homeDirectory, ... }: + +let + mkln = x: config.lib.file.mkOutOfStoreSymlink "${homeDirectory}/.local/nixos/user/${x}"; +in { + xdg.configFile.alacritty.source = mkln "config/alacritty"; + xdg.configFile.awesome.source = mkln "config/awesome"; + xdg.configFile.bash.source = mkln "config/bash"; + xdg.configFile.fcitx5.source = config/fcitx5; + xdg.configFile.fontconfig.source = config/fontconfig; + xdg.configFile."gdb/gdbinit.py".source = config/gdb/gdbinit.py; + xdg.configFile."gdb/gdbinit".text = '' + source ${pkgs.pwndbg}/share/pwndbg/gdbinit.py + source ~/.config/gdb/gdbinit.py + ''; + xdg.configFile.git.source = config/git; + xdg.configFile.lsd.source = config/lsd; + xdg.configFile.picom.source = config/picom; + xdg.configFile.python.source = config/python; + xdg.configFile.qt5ct.source = config/qt5ct; + xdg.configFile.readline.source = config/readline; + xdg.configFile."starship.toml".source = config/starship.toml; + xdg.configFile.sx.source = mkln "config/sx"; + xdg.configFile."tmux/tmux.conf".text = (builtins.readFile config/tmux/tmux.conf) + '' + run ${pkgs.tmuxPlugins.vim-tmux-navigator.rtp} + run ${pkgs.tmuxPlugins.sessionist.rtp} + ''; + fonts.fontconfig.enable = false; + gtk.gtk2.configLocation = "${config.xdg.configHome}/gtk-2.0/gtkrc"; + xdg.dataFile."recently-used.xbel".text = ""; + xdg.dataFile."RecentDocuments".text = ""; + xdg.mimeApps.enable = true; + xdg.mimeApps.defaultApplications = let + image = "nsxiv.desktop"; + browser = "firefox.desktop"; + text = "nvim.desktop"; + media = "mpv.desktop"; + in { + "image/jpeg" = image; + "image/png" = image; + "image/gif" = media; + + "audio/mpeg" = media; + "audio/ogg" = media; + "audio/vorbis" = media; + "audio/x-vorbis+ogg" = media; + + "video/mp4" = media; + "video/mpeg" = media; + + "text/plain" = text; + "application/xml" = text; + }; + xdg.portal = { + enable = true; + configPackages = [ pkgs.libsForQt5.xdg-desktop-portal-kde ]; + extraPortals = [ pkgs.libsForQt5.xdg-desktop-portal-kde ]; + config.common.default = "kde"; + }; +}