From f3c7e2b6c4b1555987071291f18cb29663b13b7e Mon Sep 17 00:00:00 2001 From: Nydragon Date: Sun, 30 Jun 2024 16:34:47 +0200 Subject: [PATCH] refactor: move scripts into nixpkgs via packageOverrides --- flake.nix | 10 +++- home/default.nix | 8 +--- home/fish/default.nix | 1 + home/neovim/default.nix | 2 +- home/sway/default.nix | 9 ++-- hosts/brontes/configuration.nix | 1 + hosts/brontes/home.nix | 83 ++++++++++++++++----------------- hosts/marr/home.nix | 82 +++++++++++++++----------------- modules/fonts.nix | 6 ++- modules/home-manager.nix | 1 + modules/programs/firefox.nix | 28 +++++++---- 11 files changed, 117 insertions(+), 114 deletions(-) diff --git a/flake.nix b/flake.nix index 395f850..992a321 100644 --- a/flake.nix +++ b/flake.nix @@ -20,8 +20,16 @@ pkgs = import nixpkgs { inherit system; - config.allowUnfree = true; overlays = [ overlays.calibre ]; + config = { + allowUnfree = true; + packageOverrides = pkgs: { + custom = { + scripts = import ./home/scripts { inherit pkgs; }; + }; + }; + }; + }; lib = nixpkgs.lib; diff --git a/home/default.nix b/home/default.nix index 57d1dc8..befa696 100644 --- a/home/default.nix +++ b/home/default.nix @@ -1,8 +1,2 @@ # This file contains default settings used across different systems -{ - programs.nix-index = { - enable = true; - enableFishIntegration = true; - enableBashIntegration = true; - }; -} +{ } diff --git a/home/fish/default.nix b/home/fish/default.nix index 81b3e8c..5a44500 100644 --- a/home/fish/default.nix +++ b/home/fish/default.nix @@ -12,6 +12,7 @@ sd = ''cd "$(dirname "$HOME/$(env --chdir ~ fzf)")"''; mkdir = "mkdir --parent"; cp = "cp -i"; + mv = "mv -i"; }; functions = let diff --git a/home/neovim/default.nix b/home/neovim/default.nix index ce549c4..db1f912 100644 --- a/home/neovim/default.nix +++ b/home/neovim/default.nix @@ -19,7 +19,6 @@ # Formatter python311Packages.black # Python formatter - #rPackages.styler # R formatter clang-tools nodePackages_latest.prettier # JSON, JS, TS formatter yamlfmt # YAML formatter @@ -27,6 +26,7 @@ rustfmt # Rust formatter shfmt # Shell, Bash etc. nixfmt-rfc-style + stylua # lua formatter # Misc ripgrep diff --git a/home/sway/default.nix b/home/sway/default.nix index a51eaf6..0de6574 100644 --- a/home/sway/default.nix +++ b/home/sway/default.nix @@ -15,9 +15,6 @@ wayland.windowManager.sway = let - screenshot = (import ../scripts { inherit pkgs; }).screenshot; - set-background = (import ../scripts { inherit pkgs; }).set-background; - homeDirectory = config.home.homeDirectory; term = "${pkgs.alacritty}/bin/alacritty"; filemanager = "${pkgs.gnome.nautilus}/bin/nautilus"; @@ -93,8 +90,8 @@ "--locked XF86AudioPause" = "exec ${pkgs.playerctl}/bin/playerctl play-pause"; "--locked XF86AudioNext" = "exec ${pkgs.playerctl}/bin/playerctl next"; "--locked XF86AudioPrev" = "exec ${pkgs.playerctl}/bin/playerctl previous"; - "Print" = "exec ${screenshot}/bin/screenshot"; - "${mod}+u" = "exec ${screenshot}/bin/screenshot"; + "Print" = "exec ${pkgs.custom.scripts.screenshot}/bin/screenshot"; + "${mod}+u" = "exec ${pkgs.custom.scripts.screenshot}/bin/screenshot"; #: Workspace movement {{{ "--input-device=${inputs.kb.builtin} ${mod}+ampersand" = "workspace number 1"; "--input-device=${inputs.kb.builtin} ${mod}+eacute" = "workspace number 2"; @@ -127,7 +124,7 @@ { command = "${pkgs.kdeconnect}/bin/kdeconnect-indicator"; } { command = "${pkgs.protonmail-bridge-gui}/bin/protonmail-bridge-gui --no-window"; } { - command = "${set-background}/bin/set-background -f ${wallpaper}"; + command = "${pkgs.custom.scripts.set-background}/bin/set-background -f ${wallpaper}"; always = true; } { diff --git a/hosts/brontes/configuration.nix b/hosts/brontes/configuration.nix index 8d39182..0dce519 100644 --- a/hosts/brontes/configuration.nix +++ b/hosts/brontes/configuration.nix @@ -13,6 +13,7 @@ ../../modules ./home.nix ]; + boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; diff --git a/hosts/brontes/home.nix b/hosts/brontes/home.nix index 5deb4f7..d31ebd5 100644 --- a/hosts/brontes/home.nix +++ b/hosts/brontes/home.nix @@ -33,52 +33,49 @@ stateVersion = config.system.stateVersion; inherit username; - packages = - let - scripts = import ../../home/scripts/list.nix { inherit pkgs; }; - programs = with pkgs; [ - keepassxc - kdeconnect - nextcloud-client - cliphist - digikam - fragments - element-desktop - libreoffice - loupe - gnome.seahorse - gimp - vlc - pavucontrol - thunderbird - keepassxc - gnome.nautilus - lollypop - protonmail-bridge-gui - varia - signal-desktop - calibre - alacritty + packages = with pkgs; [ + keepassxc + kdeconnect + nextcloud-client + cliphist + digikam + fragments + element-desktop + libreoffice + loupe + gnome.seahorse + gimp + vlc + pavucontrol + thunderbird + keepassxc + gnome.nautilus + lollypop + protonmail-bridge-gui + varia + signal-desktop + calibre + alacritty + tagger - # proprietary - obsidian + # proprietary + obsidian - # CLI tools - delta - fzf - jhead - fdupes - exiftool - sshfs - zip - unzip - lazygit - fd - ripgrep + # CLI tools + delta + fzf + jhead + fdupes + exiftool + sshfs + zip + unzip + lazygit + fd + ripgrep - ]; - in - programs ++ scripts; + custom.scripts.nixedit + ]; }; }; } diff --git a/hosts/marr/home.nix b/hosts/marr/home.nix index 05d5da3..0c31d27 100644 --- a/hosts/marr/home.nix +++ b/hosts/marr/home.nix @@ -38,52 +38,46 @@ stateVersion = config.system.stateVersion; inherit username; - packages = - let - pk = with pkgs; [ - digikam - fragments - element-desktop - libreoffice - loupe - gnome.seahorse - gimp - vlc - thunderbird - keepassxc - gnome.nautilus - lollypop - protonmail-bridge-gui - varia - signal-desktop - calibre + packages = with pkgs; [ + digikam + fragments + element-desktop + libreoffice + loupe + gnome.seahorse + gimp + vlc + thunderbird + keepassxc + gnome.nautilus + lollypop + protonmail-bridge-gui + varia + signal-desktop + calibre - # Proprietary - postman - mongodb-compass - obsidian + # Proprietary + postman + mongodb-compass + obsidian - # CLI tools - delta - fzf - jhead - fdupes - exiftool - sshfs - zip - unzip - lazygit - fd - ripgrep - swaybg - ]; - scripts = with import ../../home/scripts { inherit pkgs; }; [ - screenshot - set-background - nixedit - ]; - in - scripts ++ pk; + # CLI tools + delta + fzf + jhead + fdupes + exiftool + sshfs + zip + unzip + lazygit + fd + ripgrep + swaybg + + custom.scripts.screenshot + custom.scripts.set-background + ]; }; }; } diff --git a/modules/fonts.nix b/modules/fonts.nix index ddfd88a..dba8609 100644 --- a/modules/fonts.nix +++ b/modules/fonts.nix @@ -1,7 +1,9 @@ { pkgs, ... }: { - fonts = with pkgs; { - packages = [ + fonts = { + enableDefaultPackages = true; + fontDir.enable = true; + packages = with pkgs; [ (nerdfonts.override { fonts = [ "Noto" ]; }) d2coding jigmo diff --git a/modules/home-manager.nix b/modules/home-manager.nix index 937d5d1..74075a1 100644 --- a/modules/home-manager.nix +++ b/modules/home-manager.nix @@ -1,5 +1,6 @@ { home-manager = { backupFileExtension = "backup"; + useGlobalPkgs = true; }; } diff --git a/modules/programs/firefox.nix b/modules/programs/firefox.nix index 9708b53..975be19 100644 --- a/modules/programs/firefox.nix +++ b/modules/programs/firefox.nix @@ -29,16 +29,24 @@ lib.mkIf config.programs.firefox.enable { AutofillCreditCardEnabled = false; AutofillAddressEnabled = false; # Check about:support for extension/add-on ID strings. - ExtensionSettings = { - "uBlock0@raymondhill.net" = { - install_url = "https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/latest.xpi"; - installation_mode = "normal_install"; - }; - "firefox-translations-addon@mozilla.org" = { - install_url = "https://addons.mozilla.org/firefox/downloads/latest/firefox-translations/latest.xpi"; - installation_mode = "normal_install"; - }; - }; + # WARNING: Does not seem to install extension, i.e useless + ExtensionSettings = + let + extension = shortId: uuid: { + name = uuid; + value = { + install_url = "https://addons.mozilla.org/en-US/firefox/downloads/latest/${shortId}/latest.xpi"; + installation_mode = "force_installed"; + }; + }; + in + builtins.listToAttrs [ + (extension "ublock-origin" "uBlock0@raymondhill.net") + (extension "firefox-translations" "firefox-translations-addon@mozilla.org") + (extension "private-relay" "private-relay@firefox.com") + (extension "decentraleyes" "jid1-BoFifL9Vbdl2zQ@jetpack") + (extension "duckduckgo-for-firefox" "ddg@search.mozilla.org") + ]; FirefoxHome = { Search = true; TopSites = false;