From 98be8e8da406c201f72ef9460030e8ca2c6fceed Mon Sep 17 00:00:00 2001 From: Yorick Barbanneau Date: Sat, 30 Dec 2023 13:45:59 +0100 Subject: [PATCH 1/6] Convert Zathura configuration to module --- home-manager/zathura.nix | 13 ----------- hosts/luci/home-config.nix | 3 +++ .../application/zathura/default.nix | 23 +++++++++++++++++++ modules/home-manager/default.nix | 1 + nixos/default.nix | 1 - 5 files changed, 27 insertions(+), 14 deletions(-) delete mode 100644 home-manager/zathura.nix create mode 100644 modules/home-manager/application/zathura/default.nix diff --git a/home-manager/zathura.nix b/home-manager/zathura.nix deleted file mode 100644 index cd1d000..0000000 --- a/home-manager/zathura.nix +++ /dev/null @@ -1,13 +0,0 @@ -_: { - programs.zathura = { - enable = true; - options = { - selection-clipboard = "clipboard"; - font = "Fira Sans 12"; - recolor = true; - }; - }; - xdg.mimeApps.defaultApplications = { - "application/pdf" = "org.pwmt.zathura.desktop"; - }; -} diff --git a/hosts/luci/home-config.nix b/hosts/luci/home-config.nix index 246d67d..9a488b1 100644 --- a/hosts/luci/home-config.nix +++ b/hosts/luci/home-config.nix @@ -1,5 +1,8 @@ { ... }: { config.modules = { + application = { + zathura.enable = true; + }; cli.neovim.enable = true; cli.vifm.enable = true; video.kdenlive.enable = false; diff --git a/modules/home-manager/application/zathura/default.nix b/modules/home-manager/application/zathura/default.nix new file mode 100644 index 0000000..d710830 --- /dev/null +++ b/modules/home-manager/application/zathura/default.nix @@ -0,0 +1,23 @@ +{ lib, config, ... }: +with lib; +let + cfg = config.modules.application.zathura; +in +{ + options.modules.application.zathura = { + enable = mkEnableOption "enable Zathura PDF viewer"; + }; + config = mkIf cfg.enable { + programs.zathura = { + enable = true; + options = { + selection-clipboard = "clipboard"; + font = "Fira Sans 12"; + recolor = true; + }; + }; + xdg.mimeApps.defaultApplications = { + "application/pdf" = "org.pwmt.zathura.desktop"; + }; + }; +} diff --git a/modules/home-manager/default.nix b/modules/home-manager/default.nix index 0e02297..b82e41e 100644 --- a/modules/home-manager/default.nix +++ b/modules/home-manager/default.nix @@ -1,6 +1,7 @@ { ... }: { imports = [ + ./application/zathura ./cli/neovim ./cli/vifm ./cli/zsh diff --git a/nixos/default.nix b/nixos/default.nix index 261945c..a874dbd 100644 --- a/nixos/default.nix +++ b/nixos/default.nix @@ -67,7 +67,6 @@ ] ++ (if hostConfig.desktop then [ ../home-manager/foot.nix - ../home-manager/zathura.nix ../home-manager/imv.nix ../home-manager/mpv ] From e2df40e518ae05db4b1a14ec6b7c6e84c497dc9d Mon Sep 17 00:00:00 2001 From: Yorick Barbanneau Date: Sat, 30 Dec 2023 17:42:26 +0100 Subject: [PATCH 2/6] Convert Imv configuration to module --- home-manager/imv.nix | 5 ----- .../home-manager/application/imv/default.nix | 18 ++++++++++++++++++ modules/home-manager/default.nix | 1 + nixos/default.nix | 1 - 4 files changed, 19 insertions(+), 6 deletions(-) delete mode 100644 home-manager/imv.nix create mode 100644 modules/home-manager/application/imv/default.nix diff --git a/home-manager/imv.nix b/home-manager/imv.nix deleted file mode 100644 index 0d69bfe..0000000 --- a/home-manager/imv.nix +++ /dev/null @@ -1,5 +0,0 @@ -_: { - programs.imv = { - enable = true; - }; -} diff --git a/modules/home-manager/application/imv/default.nix b/modules/home-manager/application/imv/default.nix new file mode 100644 index 0000000..84ab5d1 --- /dev/null +++ b/modules/home-manager/application/imv/default.nix @@ -0,0 +1,18 @@ +{ lib, config, ... }: +with lib; +let + cfg = config.modules.application.zathura; +in +{ + options.modules.application.imv = { + enable = mkEnableOption "enable IMV image viewer"; + }; + config = mkIf cfg.enable { + programs.imv = { + enable = true; + }; + xdg.mimeApps.defaultApplications = { + "image/*" = "imv-dir.desktop"; + }; + }; +} diff --git a/modules/home-manager/default.nix b/modules/home-manager/default.nix index b82e41e..008e886 100644 --- a/modules/home-manager/default.nix +++ b/modules/home-manager/default.nix @@ -1,6 +1,7 @@ { ... }: { imports = [ + ./application/imv ./application/zathura ./cli/neovim ./cli/vifm diff --git a/nixos/default.nix b/nixos/default.nix index a874dbd..75dd0b5 100644 --- a/nixos/default.nix +++ b/nixos/default.nix @@ -67,7 +67,6 @@ ] ++ (if hostConfig.desktop then [ ../home-manager/foot.nix - ../home-manager/imv.nix ../home-manager/mpv ] else [] From d48773e9afafcce24754041767e7cd0c059ef328 Mon Sep 17 00:00:00 2001 From: Yorick Barbanneau Date: Sat, 30 Dec 2023 18:22:35 +0100 Subject: [PATCH 3/6] Convert MPV configuration to module --- home-manager/mpv/default.nix | 5 ----- hosts/luci/home-config.nix | 1 + modules/home-manager/default.nix | 1 + modules/home-manager/video/mpv/default.nix | 24 ++++++++++++++++++++++ nixos/default.nix | 1 - 5 files changed, 26 insertions(+), 6 deletions(-) delete mode 100644 home-manager/mpv/default.nix create mode 100644 modules/home-manager/video/mpv/default.nix diff --git a/home-manager/mpv/default.nix b/home-manager/mpv/default.nix deleted file mode 100644 index 700eb46..0000000 --- a/home-manager/mpv/default.nix +++ /dev/null @@ -1,5 +0,0 @@ -_: { - programs.mpv = { - enable = true; - }; -} diff --git a/hosts/luci/home-config.nix b/hosts/luci/home-config.nix index 9a488b1..a3dd6a0 100644 --- a/hosts/luci/home-config.nix +++ b/hosts/luci/home-config.nix @@ -2,6 +2,7 @@ config.modules = { application = { zathura.enable = true; + mpv.enable = true; }; cli.neovim.enable = true; cli.vifm.enable = true; diff --git a/modules/home-manager/default.nix b/modules/home-manager/default.nix index 008e886..5fe7f9b 100644 --- a/modules/home-manager/default.nix +++ b/modules/home-manager/default.nix @@ -9,6 +9,7 @@ ./desktop/sway ./gaming/lutris ./video/kdenlive + ./video/mpv ./web/firefox ./web/qutebrowser/default.nix ./web/webcord diff --git a/modules/home-manager/video/mpv/default.nix b/modules/home-manager/video/mpv/default.nix new file mode 100644 index 0000000..aa1c873 --- /dev/null +++ b/modules/home-manager/video/mpv/default.nix @@ -0,0 +1,24 @@ +{ lib, config, ... }: +with lib; +let + cfg = config.modules.video.mpv; +in +{ + options.modules.video.mpv = { + enable = mkEnableOption "enable MPV video player"; + }; + config = mkIf cfg.enable { + programs.mpv = { + enable = true; + config = { + hwdec = auto-safe; + vo = gpu; + profile = gpu-hq; + gpu-context = wayland; + }; + }; + xdg.mimeApps.defaultApplications = { + "video/*" = "mpv.desktop"; + }; + }; +} diff --git a/nixos/default.nix b/nixos/default.nix index 75dd0b5..3bc4b56 100644 --- a/nixos/default.nix +++ b/nixos/default.nix @@ -67,7 +67,6 @@ ] ++ (if hostConfig.desktop then [ ../home-manager/foot.nix - ../home-manager/mpv ] else [] ) ++ lib.optional ( From 018242e2a53a02eb7a5b63bd3c183f59f3883df5 Mon Sep 17 00:00:00 2001 From: Yorick Barbanneau Date: Sat, 30 Dec 2023 20:05:33 +0100 Subject: [PATCH 4/6] Add video hardware acceleration --- hosts/luci/hardware-configuration.nix | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/hosts/luci/hardware-configuration.nix b/hosts/luci/hardware-configuration.nix index 96ffe4b..16697bb 100644 --- a/hosts/luci/hardware-configuration.nix +++ b/hosts/luci/hardware-configuration.nix @@ -51,8 +51,16 @@ nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; - hardware.opengl.enable = true; - hardware.opengl.driSupport = true; + hardware.opengl = { + enable = true; + driSupport = true; + extraPackages = with pkgs; [ + intel-media-driver + vaapiVdpau + libvdpau-va-gl + ]; + }; + virtualisation.virtualbox.host.enable = true; users.extraGroups.vboxusers.members = [ "ephase" ]; From a8ec1a644cf0c50116eed2ea26959046144a8228 Mon Sep 17 00:00:00 2001 From: Yorick Barbanneau Date: Sat, 30 Dec 2023 20:07:54 +0100 Subject: [PATCH 5/6] Convert MPV configuration to module --- hosts/luci/home-config.nix | 11 ++++++++--- modules/home-manager/video/mpv/default.nix | 8 ++++---- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/hosts/luci/home-config.nix b/hosts/luci/home-config.nix index a3dd6a0..af30a63 100644 --- a/hosts/luci/home-config.nix +++ b/hosts/luci/home-config.nix @@ -2,11 +2,16 @@ config.modules = { application = { zathura.enable = true; + }; + cli = { + neovim.enable = true; + vifm.enable = true; + zsh.enable = true; + }; + video = { + kdenlive.enable = false; mpv.enable = true; }; - cli.neovim.enable = true; - cli.vifm.enable = true; - video.kdenlive.enable = false; web.firefox.enable = true; web.qutebrowser.enable = true; web.webcord.enable = true; diff --git a/modules/home-manager/video/mpv/default.nix b/modules/home-manager/video/mpv/default.nix index aa1c873..f208476 100644 --- a/modules/home-manager/video/mpv/default.nix +++ b/modules/home-manager/video/mpv/default.nix @@ -11,10 +11,10 @@ in programs.mpv = { enable = true; config = { - hwdec = auto-safe; - vo = gpu; - profile = gpu-hq; - gpu-context = wayland; + hwdec = "auto-safe"; + vo = "gpu"; + profile = "gpu-hq"; + gpu-context = "wayland"; }; }; xdg.mimeApps.defaultApplications = { From bdbc0e76146d06b2fc788d9887ea9988522fafd6 Mon Sep 17 00:00:00 2001 From: Yorick Barbanneau Date: Sat, 30 Dec 2023 20:08:29 +0100 Subject: [PATCH 6/6] Update Firefox preferences --- modules/home-manager/web/firefox/conf/preferences.nix | 3 +++ modules/home-manager/web/firefox/conf/suggest.nix | 5 +++-- modules/home-manager/web/firefox/conf/theme.nix | 2 ++ modules/home-manager/web/firefox/default.nix | 2 ++ 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/modules/home-manager/web/firefox/conf/preferences.nix b/modules/home-manager/web/firefox/conf/preferences.nix index 9158bf0..f7ad1a3 100644 --- a/modules/home-manager/web/firefox/conf/preferences.nix +++ b/modules/home-manager/web/firefox/conf/preferences.nix @@ -40,4 +40,7 @@ "browser.startup.homepage_override.mstone" = "ignore"; "browser.aboutHomeSnippets.updateUrl" = ""; + +# Restore session when restart + "browser.sessionstore.resume_session_once" = true; } diff --git a/modules/home-manager/web/firefox/conf/suggest.nix b/modules/home-manager/web/firefox/conf/suggest.nix index 34c01fc..bd5adbb 100644 --- a/modules/home-manager/web/firefox/conf/suggest.nix +++ b/modules/home-manager/web/firefox/conf/suggest.nix @@ -15,10 +15,11 @@ "browser.urlbar.suggest.trending" = false; "browser.urlbar.suggest.weather" = false; "browser.urlbar.suggest.searches" = false; + "browser.urlbar.suggest.topsites" = false; -# Disable Search Keyword +# Enable Search Keyword # When you mistype some url, Firefox starts a search even from urlbar. This # feature is useful for quick searching, but may harm your privacy, when it's # unintended. - "keyword.enabled" = false; + "keyword.enabled" = true; } diff --git a/modules/home-manager/web/firefox/conf/theme.nix b/modules/home-manager/web/firefox/conf/theme.nix index 1e77222..94e8e94 100644 --- a/modules/home-manager/web/firefox/conf/theme.nix +++ b/modules/home-manager/web/firefox/conf/theme.nix @@ -30,5 +30,7 @@ # disable funsking malwares "browser.newtabpage.activity-stream.improvesearch.topSiteSearchShortcuts.havePinned" = ""; + "browser.newtabpage.activity-stream.improvesearch.topSiteSearchShortcuts.searchEngines" = ""; + "browser.newtabpage.activity-stream.improvesearch.topSiteSearchShortcuts" = false; "browser.newtabpage.pinned" = ""; } diff --git a/modules/home-manager/web/firefox/default.nix b/modules/home-manager/web/firefox/default.nix index 018c873..f9295ce 100644 --- a/modules/home-manager/web/firefox/default.nix +++ b/modules/home-manager/web/firefox/default.nix @@ -61,6 +61,8 @@ in "Bing".metaData.hidden = true; "Google".metaData.hidden = true; "Amazon.fr".metaData.hidden = true; + "Facebook".metaData.hidden = true; + "youtube".metaData.hidden = true; }; }; settings = merge [