diff --git a/flake.lock b/flake.lock index 2a356ad..b34bc04 100644 --- a/flake.lock +++ b/flake.lock @@ -230,11 +230,11 @@ ] }, "locked": { - "lastModified": 1758250706, - "narHash": "sha256-Jv/V+PNi5RyqCUK2V6YJ0iCqdLPutU69LZas85EBUaU=", + "lastModified": 1758719930, + "narHash": "sha256-DgHe1026Ob49CPegPMiWj1HNtlMTGQzfSZQQVlHC950=", "owner": "nix-community", "repo": "home-manager", - "rev": "363007f12930caf8b0ea59c0bf5be109c52ad0ef", + "rev": "142acd7a7d9eb7f0bb647f053b4ddfd01fdfbf1d", "type": "github" }, "original": { @@ -368,11 +368,11 @@ }, "nixpkgs_3": { "locked": { - "lastModified": 1758198701, - "narHash": "sha256-7To75JlpekfUmdkUZewnT6MoBANS0XVypW6kjUOXQwc=", + "lastModified": 1758427187, + "narHash": "sha256-pHpxZ/IyCwoTQPtFIAG2QaxuSm8jWzrzBGjwQZIttJc=", "owner": "nixos", "repo": "nixpkgs", - "rev": "0147c2f1d54b30b5dd6d4a8c8542e8d7edf93b5d", + "rev": "554be6495561ff07b6c724047bdd7e0716aa7b46", "type": "github" }, "original": { @@ -467,11 +467,11 @@ ] }, "locked": { - "lastModified": 1758007585, - "narHash": "sha256-HYnwlbY6RE5xVd5rh0bYw77pnD8lOgbT4mlrfjgNZ0c=", + "lastModified": 1758425756, + "narHash": "sha256-L3N8zV6wsViXiD8i3WFyrvjDdz76g3tXKEdZ4FkgQ+Y=", "owner": "Mic92", "repo": "sops-nix", - "rev": "f77d4cfa075c3de66fc9976b80e0c4fc69e2c139", + "rev": "e0fdaea3c31646e252a60b42d0ed8eafdb289762", "type": "github" }, "original": { @@ -520,11 +520,11 @@ "tinted-zed": "tinted-zed" }, "locked": { - "lastModified": 1757956156, - "narHash": "sha256-f0W7qbsCqpi6swQ5w8H+0YrAbNwsHgCFDkNRMTJjqrE=", + "lastModified": 1758716250, + "narHash": "sha256-PvOo4vSk7WAOhSifgL+rzExihquU9DOIOQPrUVuFHpE=", "owner": "danth", "repo": "stylix", - "rev": "0ce0103b498bb22f899ed8862d8d7f9503ed9cdb", + "rev": "526c882800837cce7676f3e11bb3e13e975c6032", "type": "github" }, "original": { diff --git a/modules/home/default.nix b/modules/home/default.nix index e587fc2..847a63b 100644 --- a/modules/home/default.nix +++ b/modules/home/default.nix @@ -1,6 +1,11 @@ -{ pkgs, lib, config, osConfig, ... }: -let cfg = osConfig.mods; - +{ + pkgs, + lib, + config, + osConfig, + ... +}: let + cfg = osConfig.mods; in { imports = [ ./terminal diff --git a/modules/home/desktop/development.nix b/modules/home/desktop/development.nix index 31a4064..cfa91fc 100644 --- a/modules/home/desktop/development.nix +++ b/modules/home/desktop/development.nix @@ -10,6 +10,50 @@ config = lib.mkIf config.mods.desktop.development.enable { # home.packages = with pkgs; [ i3-swallow ]; + programs.nyxt = { + enable = true; + config = '' + (in-package #:nyxt-user) + + (defvar *my-search-engines* + (list + (make-instance 'search-engine + :name "Searx" + :shortcut "s" + #+nyxt-4 :control-url #+nyxt-3 :search-url + ""https://search.muon.host/?q=~a";") + + (make-instance 'search-engine + :name "nixpkgs" + :shortcut "np" + #+nyxt-4 :control-url #+nyxt-3 :search-url + "https://search.nixos.org/packages?channel=unstable&query=~a"))) + + (make-instance 'search-engine + :name "nix options" + :shortcut "np" + #+nyxt-4 :control-url #+nyxt-3 :search-url + "https://search.nixos.org/options?channel=unstable&query=~a"))) + + (make-instance 'search-engine + :name "home-manager" + :shortcut "hm" + #+nyxt-4 :control-url #+nyxt-3 :search-url + "https://home-manager-options.extranix.com/?release=master&query=~a"))) + + + (define-configuration browser + ((restore-session-on-startup-p nil) + (default-new-buffer-url (quri:uri "https://online.bonjourr.fr/")) + (external-editor-program ("alacritty -e hx") + #+nyxt-4 + (search-engine-suggestions-p nil) + #+nyxt-4 + (search-engines (append %slot-default% *my-search-engines*)) + )) + ''; + }; + programs.qutebrowser = { enable = true; diff --git a/modules/home/desktop/i3.nix b/modules/home/desktop/i3.nix index f6bb38a..0c2021a 100644 --- a/modules/home/desktop/i3.nix +++ b/modules/home/desktop/i3.nix @@ -17,6 +17,23 @@ curl -H "authorization: $AUTH" https://share.muon.host/api/upload -F file=@/tmp/ss.png -H "Content-Type: multipart/form-data" -H "Format: date" -H "Image-Compression-Percent: 90" -H "No-JSON: true" | tr -d '\n' | xsel -ib; ''; }; + zmenu = with pkgs; + writeShellApplication { + name = "zmenu"; + runtimeInputs = [zellij zoxide wmctrl i3 rofi alacritty zsh]; + text = '' + ZPATH=$(zoxide query -l | sed -e "s|$HOME||g" | cut -b 2- | rofi -dmenu) + [[ -z "$ZPATH" ]] && exit + ZSESH=$(echo "$ZPATH" | tr / -) + ZWIND=$(wmctrl -l | grep "$ZSESH" || echo "") + cd "$ZPATH" + if [[ -z "$ZWIND" ]]; then + alacritty -T "$ZSESH" -e zsh -c "zellij -s $ZSESH -n compact || zellij a $ZSESH" + else + wmctrl -a "$ZSESH" + fi + ''; + }; in with lib; { options.mods.i3.enable = mkEnableOption "enables i3"; @@ -139,6 +156,7 @@ in "XF86AudioRaiseVolume" = "exec --no-startup-id pactl set-sink-volume 0 +2%"; "XF86AudioLowerVolume" = "exec --no-startup-id pactl set-sink-volume 0 -2%"; "Print" = "exec ${getExe fsss}"; + "${modifier}+z" = "exec ${getExe zmenu}"; "${modifier}+y" = "sticky toggle"; }); diff --git a/modules/home/desktop/media.nix b/modules/home/desktop/media.nix index 4d8cfce..2f4fe79 100644 --- a/modules/home/desktop/media.nix +++ b/modules/home/desktop/media.nix @@ -1,4 +1,9 @@ -{ pkgs, lib, config, ... }: { +{ + pkgs, + lib, + config, + ... +}: { options.mods.desktop.media.enable = lib.mkEnableOption "enables entertainment programs"; @@ -9,7 +14,7 @@ pavucontrol # Video - stremio + (callPackage ./packages/stremio-linux-shell.nix {}) # Podcasts gpodder diff --git a/modules/home/desktop/packages/stremio-linux-shell.nix b/modules/home/desktop/packages/stremio-linux-shell.nix new file mode 100644 index 0000000..79ca2fc --- /dev/null +++ b/modules/home/desktop/packages/stremio-linux-shell.nix @@ -0,0 +1,122 @@ +{ + lib, + stdenv, + rustPlatform, + fetchFromGitHub, + openssl, + pkg-config, + gtk3, + mpv, + libappindicator, + libxkbcommon, + libcef, + makeWrapper, + nodejs, + # fetchurl, + ... +}: let + # cef-rs expects a specific directory layout + # Copied from https://github.com/NixOS/nixpkgs/pull/428206 because im lazy + cef-path = stdenv.mkDerivation { + pname = "cef-path"; + version = libcef.version; + dontUnpack = true; + installPhase = '' + mkdir -p "$out" + find ${libcef}/lib -type f -name "*" -exec cp {} $out/ \; + find ${libcef}/libexec -type f -name "*" -exec cp {} $out/ \; + cp -r ${libcef}/share/cef/* $out/ + mkdir -p "$out/include" + cp -r ${libcef}/include/* "$out/include/" + ''; + postFixup = '' + strip $out/*.so* + ''; + }; + # NOTE stremio downloads server.js into XDG_DATA_DIR. Packaging it is not required. + # I'm patching this because I don't enjoy stremio downloading code at runtime. + # This and the postPatch are not needed if you're okay with stremio downloading server.js at runtime + # Latest server.js version found at https://www.strem.io/updater/server/check + # server = fetchurl rec { + # pname = "stremio-server"; + # version = "4.20.11"; + # url = "https://dl.strem.io/server/v${version}/desktop/server.js"; + # hash = "sha256-2QCwUlusNTGqbOmOGjyKOx0bHaoGmn9vy93qViXx95E="; + # meta.license = lib.licenses.unfree; + # }; +in + rustPlatform.buildRustPackage (finalAttrs: { + name = "stremio-linux-shell"; + version = "1.0.0-beta.11"; + + src = fetchFromGitHub { + owner = "Stremio"; + repo = "stremio-linux-shell"; + tag = "v${finalAttrs.version}"; + hash = "sha256-FNAeur5esDqBoYlmjUO6jdi1eC83ynbLxbjH07QZ++E="; + }; + + cargoHash = "sha256-9/28BCG51jPnKXbbzzNp7KQLMkLEugFQfwszRR9kmUw="; + + # The build scripts tries to download CEF binaries by default. + # Probably overkill since setting CEF_PATH should skip downloading binaries. + buildFeatures = [ + "offline-build" + ]; + + buildInputs = [ + openssl + gtk3 + mpv + libcef + ]; + + nativeBuildInputs = [ + makeWrapper + pkg-config + ]; + + #postPatch = '' + # substituteInPlace ./src/config.rs \ + # --replace-fail \ + # 'let file = data_dir.join(SERVER_FILE);' \ + # 'let file = PathBuf::from(r"${server}");' + + # substituteInPlace ./src/server.rs \ + # --replace-fail \ + # 'let should_download = self.config.version() != Some(latest_version.clone());' \ + # 'let should_download = false;' + #''; + + postInstall = '' + mkdir -p $out/share/applications + mkdir -p $out/share/icons/hicolor/scalable/apps + + mv $out/bin/stremio-linux-shell $out/bin/stremio + cp $src/data/com.stremio.Stremio.desktop $out/share/applications/com.stremio.Stremio.desktop + cp $src/data/icons/com.stremio.Stremio.svg $out/share/icons/hicolor/scalable/apps/com.stremio.Stremio.svg + + + wrapProgram $out/bin/stremio \ + --prefix LD_LIBRARY_PATH : ${lib.makeLibraryPath [libappindicator libxkbcommon]} \ + --prefix PATH : ${lib.makeBinPath [nodejs]}''; + + env.CEF_PATH = cef-path; + + meta = { + mainProgram = "stremio"; + description = "Modern media center that gives you the freedom to watch everything you want"; + homepage = "https://www.stremio.com/"; + # (Server-side) 4.x versions of the web UI are closed-source + license = with lib.licenses; [ + gpl3Only + # server.js is unfree + # unfree + ]; + maintainers = with lib.maintainers; [ + griffi-gh + {name = "nuko";} + ]; + platforms = lib.platforms.linux; + }; + })