From 8d36da17cab32530f4a0ec79432b1b5a7f744d90 Mon Sep 17 00:00:00 2001 From: Jakub Trzeciak Date: Thu, 19 Oct 2023 10:06:57 +0200 Subject: Overlays and more --- flake.nix | 17 ++-- home-manager/dmenu-bluetooth.nix | 19 ----- home-manager/firefox.nix | 21 +++++ home-manager/home.nix | 8 +- home-manager/sxrc | 3 + nixos/configuration.nix | 51 +++++++++--- nixpkgs.nix | 8 ++ overlays/default.nix | 23 ++++++ pkgs/default.nix | 8 ++ pkgs/dmenu-bluetooth/default.nix | 19 +++++ pkgs/mercury-browser/default.nix | 149 +++++++++++++++++++++++++++++++++++ pkgs/neo-comic-mono-font/default.nix | 45 +++++++++++ 12 files changed, 331 insertions(+), 40 deletions(-) delete mode 100644 home-manager/dmenu-bluetooth.nix create mode 100644 nixpkgs.nix create mode 100644 overlays/default.nix create mode 100644 pkgs/default.nix create mode 100644 pkgs/dmenu-bluetooth/default.nix create mode 100644 pkgs/mercury-browser/default.nix create mode 100644 pkgs/neo-comic-mono-font/default.nix diff --git a/flake.nix b/flake.nix index d79d2b6..5381a8f 100644 --- a/flake.nix +++ b/flake.nix @@ -28,12 +28,19 @@ system = "x86_64-linux"; - pkgs = import nixpkgs { - inherit system; - }; - lib = nixpkgs.lib; + #pkgs = import nixpkgs { + # inherit system; + #}; + #lib = nixpkgs.lib; in { - #overlays = import ./overlays {inherit inputs;}; + # Your custom packages + # Acessible through 'nix build', 'nix shell', etc + packages = ( + let pkgs = nixpkgs.legacyPackages.${system}; + in import ./pkgs { inherit pkgs; }); + + # Your custom packages and modifications, exported as overlays + overlays = import ./overlays {inherit inputs;}; # NixOS configuration entrypoint # Available through 'nixos-rebuild --flake .#your-hostname' diff --git a/home-manager/dmenu-bluetooth.nix b/home-manager/dmenu-bluetooth.nix deleted file mode 100644 index 73af067..0000000 --- a/home-manager/dmenu-bluetooth.nix +++ /dev/null @@ -1,19 +0,0 @@ -{ stdenv, fetchurl, dmenu }: - -let - dmenu-bluetooth = fetchurl { - url = "https://raw.githubusercontent.com/Layerex/dmenu-bluetooth/e6fbfbdb1c968b591523ed7de932cde10628876e/dmenu-bluetooth"; - sha256 = "sha256-N7pCl9kLvJ2+ljczOWhaNJPLej62JWrF+uWlLp+l6lE="; - }; -in stdenv.mkDerivation rec { - pname = "dmenu-bluetooth"; - version = "0.0.1"; - - unpackPhase = "true"; - srcs = []; - - postInstall = '' - mkdir -p $out/bin - install ${dmenu-bluetooth} $out/bin/dmenu-bluetooth - ''; -} diff --git a/home-manager/firefox.nix b/home-manager/firefox.nix index 820354c..0a3b922 100644 --- a/home-manager/firefox.nix +++ b/home-manager/firefox.nix @@ -1,6 +1,7 @@ { config, pkgs, theme, ... }: let + firefox-i2p = pkgs.writeShellScriptBin "firefox-i2p" ''firefox -p i2p''; firefox-work = pkgs.writeShellScriptBin "firefox-work" ''firefox -p work''; # Show all packages - `nix flake show "gitlab:rycee/nur-expressions?dir=pkgs/firefox-addons"` @@ -64,6 +65,25 @@ in { }; profiles = { + i2p = { + isDefault = false; id = 2; + name = "i2p"; + + settings = { + "javascript.enabled" = false; + "keyword.enabled" = true; + + "network.proxy.type" = 1; + "network.proxy.share_proxy_settings" = true; + + "network.proxy.http" = "127.0.0.1"; + "network.proxy.http_port" = 4444; + + "network.proxy.ssl" = "127.0.0.1"; + "network.proxy.ssl_port" = 4444; + }; + }; + work = { isDefault = false; id = 1; name = "work"; @@ -83,6 +103,7 @@ in { }; home.packages = [ + firefox-i2p firefox-work ]; } diff --git a/home-manager/home.nix b/home-manager/home.nix index 10f46be..7c0c4de 100644 --- a/home-manager/home.nix +++ b/home-manager/home.nix @@ -6,7 +6,7 @@ let }; lux-scheme = builtins.fetchurl { - url = "https://git.jptrzy.xyz/lux-theme/plain/lux-theme.yaml?h=main"; + url = "https://git.jptrzy.xyz/lux-theme/plain/lux-theme.yaml"; }; nix-colors-lib = nix-colors.lib.contrib { inherit pkgs; }; @@ -37,6 +37,8 @@ in { home.packages = [ pkgs.picom pkgs.libnotify + pkgs.birdtray + pkgs.dmenu-bluetooth #pkgs.pureref pkgs.hplipWithPlugin @@ -46,9 +48,6 @@ in { (import ./sh/colors.nix {inherit pkgs; }) (import ./sh/yt.nix {inherit pkgs; }) (import ./sh/mpv.nix {inherit pkgs; }) - (import ./dmenu-bluetooth.nix { - inherit (pkgs) stdenv fetchurl dmenu; - }) ]; nixpkgs.config.packageOverrides = pkgs: { @@ -114,6 +113,7 @@ in { enable = true; shellAliases = { + calculator = "${pkgs.bc}/bin/bc -l"; nr = "sudo nixos-rebuild switch"; hr = "home-manager switch"; se = "sudoedit"; diff --git a/home-manager/sxrc b/home-manager/sxrc index 8128afb..b7ae3fa 100755 --- a/home-manager/sxrc +++ b/home-manager/sxrc @@ -18,6 +18,9 @@ xautolock -lockaftersleep -time 10 -locker slock & dwmblocks & +#birdtray & +pulseaudio --start & + exec dbus-launch dwm 2>> $HOME/.cache/dwm.log # ssh-agent / exec dbus-launch diff --git a/nixos/configuration.nix b/nixos/configuration.nix index 580f03b..509d6fb 100644 --- a/nixos/configuration.nix +++ b/nixos/configuration.nix @@ -1,17 +1,14 @@ # Edit this configuration file to define what should be installed on # your system. Help is available in the configuration.nix(5) man page # and in the NixOS manual (accessible by running `nixos-help`). - -{ hostname, username, config, pkgs, ... }: +{ inputs, outputs, hostname, username, config, pkgs, ... }: let dmenu-src = builtins.fetchTarball "https://git.jptrzy.xyz/dmenu/snapshot/master.tar.gz"; #dwm-src = builtins.fetchTarball "https://git.jptrzy.xyz/dwm/snapshot/master.tar.gz"; dwmblocks-src = builtins.fetchTarball "https://git.jptrzy.xyz/dwmblocks/snapshot/master.tar.gz"; - neo-comic-mono-font = builtins.fetchTarball "https://git.jptrzy.xyz/neo-comic-mono-font/snapshot/master.tar.gz"; sent-src = builtins.fetchTarball "https://git.jptrzy.xyz/sent/snapshot/master.tar.gz"; slock-src = builtins.fetchTarball "https://git.jptrzy.xyz/slock/snapshot/master.tar.gz"; - dwm-src = /home/${username}/.local/src/dwm; in { system.stateVersion = "23.05"; # Did you read the comment? @@ -131,6 +128,27 @@ in { }; services = { + i2pd = { + enable = true; + enableIPv6 = true; + + websocket = { + enable = true; + port = 7070; + }; + + proto = { + sam.enable = true; + + http.enable = true; + + httpProxy = { + enable = true; + port = 4444; + }; + }; + }; + logind.extraConfig = '' HandleLidSwitch=suspend ''; @@ -154,13 +172,13 @@ in { }; }; - #printing = { - # enable = true; - # drivers = [ - # pkgs.hplip - # pkgs.hplipWithPlugin - # ]; - #}; + printing = { + enable = true; + drivers = [ + pkgs.hplip + pkgs.hplipWithPlugin + ]; + }; avahi = { enable = true; @@ -205,7 +223,8 @@ in { font-awesome # For dwmblocks nerdfonts # For nnn - (import "${neo-comic-mono-font}") + neo-comic-mono-font + #(import "${neo-comic-mono-font}") ]; # Gaming @@ -217,6 +236,10 @@ in { # Suckless Overlays nixpkgs.overlays = [ + outputs.overlays.additions + outputs.overlays.modifications + outputs.overlays.unstable-packages + (final: prev: { dmenu = prev.dmenu.overrideAttrs (old: { src = dmenu-src; }); dwm = prev.dwm.overrideAttrs (old: { src = dwm-src; }); @@ -294,6 +317,10 @@ in { xautolock fragments # Torrent client libresprite + ldtk + betterbird + libreoffice-qt + mercury-browser # Gnome Apps without Gnome gnome.adwaita-icon-theme libsecret gnome.seahorse diff --git a/nixpkgs.nix b/nixpkgs.nix new file mode 100644 index 0000000..041de40 --- /dev/null +++ b/nixpkgs.nix @@ -0,0 +1,8 @@ +# A nixpkgs instance that is grabbed from the pinned nixpkgs commit in the lock file +# This is useful to avoid using channels when using legacy nix commands +let lock = (builtins.fromJSON (builtins.readFile ./flake.lock)).nodes.nixpkgs.locked; +in +import (fetchTarball { + url = "https://github.com/nixos/nixpkgs/archive/${lock.rev}.tar.gz"; + sha256 = lock.narHash; +}) diff --git a/overlays/default.nix b/overlays/default.nix new file mode 100644 index 0000000..a13ea3c --- /dev/null +++ b/overlays/default.nix @@ -0,0 +1,23 @@ +# This file defines overlays +{inputs, ...}: { + # This one brings our custom packages from the 'pkgs' directory + additions = final: _prev: import ../pkgs {pkgs = final;}; + + # This one contains whatever you want to overlay + # You can change versions, add patches, set compilation flags, anything really. + # https://nixos.wiki/wiki/Overlays + modifications = final: prev: { + # example = prev.example.overrideAttrs (oldAttrs: rec { + # ... + # }); + }; + + # When applied, the unstable nixpkgs set (declared in the flake inputs) will + # be accessible through 'pkgs.unstable' + unstable-packages = final: _prev: { + unstable = import inputs.nixpkgs-unstable { + system = final.system; + config.allowUnfree = true; + }; + }; +} diff --git a/pkgs/default.nix b/pkgs/default.nix new file mode 100644 index 0000000..54dd028 --- /dev/null +++ b/pkgs/default.nix @@ -0,0 +1,8 @@ +# Custom packages, that can be defined similarly to ones from nixpkgs +# You can build them using 'nix build .#example' or (legacy) 'nix-build -A example' + +{ pkgs ? (import ../nixpkgs.nix) { } }: { + mercury-browser = pkgs.callPackage ./mercury-browser { }; + dmenu-bluetooth = pkgs.callPackage ./dmenu-bluetooth { }; + neo-comic-mono-font = pkgs.callPackage ./neo-comic-mono-font { }; +} diff --git a/pkgs/dmenu-bluetooth/default.nix b/pkgs/dmenu-bluetooth/default.nix new file mode 100644 index 0000000..73af067 --- /dev/null +++ b/pkgs/dmenu-bluetooth/default.nix @@ -0,0 +1,19 @@ +{ stdenv, fetchurl, dmenu }: + +let + dmenu-bluetooth = fetchurl { + url = "https://raw.githubusercontent.com/Layerex/dmenu-bluetooth/e6fbfbdb1c968b591523ed7de932cde10628876e/dmenu-bluetooth"; + sha256 = "sha256-N7pCl9kLvJ2+ljczOWhaNJPLej62JWrF+uWlLp+l6lE="; + }; +in stdenv.mkDerivation rec { + pname = "dmenu-bluetooth"; + version = "0.0.1"; + + unpackPhase = "true"; + srcs = []; + + postInstall = '' + mkdir -p $out/bin + install ${dmenu-bluetooth} $out/bin/dmenu-bluetooth + ''; +} diff --git a/pkgs/mercury-browser/default.nix b/pkgs/mercury-browser/default.nix new file mode 100644 index 0000000..7502c58 --- /dev/null +++ b/pkgs/mercury-browser/default.nix @@ -0,0 +1,149 @@ +{ lib +, stdenv +, fetchurl +, autoPatchelfHook +, dpkg +, wrapGAppsHook +, alsa-lib +, browserpass +, bukubrow +, cairo +, cups +, dbus +, dbus-glib +, ffmpeg +, fontconfig +, freetype +, fx_cast_bridge +, glib +, glibc +, gnome-browser-connector +, gtk3 +, harfbuzz +, libcanberra +, libdbusmenu +, libdbusmenu-gtk3 +, libglvnd +, libjack2 +, libkrb5 +, libnotify +, libpulseaudio +, libva +, lyx +, mesa +, nspr +, nss +, opensc +, pango +, pciutils +, pipewire +, plasma5Packages +, sndio +, speechd +, tridactyl-native +, udev +, uget-integrator +, vulkan-loader +, xdg-utils +, xorg +}: + +stdenv.mkDerivation rec { + pname = "mercury-browser"; + version = "115.4.0"; + + src = fetchurl { + url = + "https://github.com/Alex313031/Mercury/releases/download/v.${version}/mercury-browser_${version}_amd64.deb"; + hash = "sha256-78b2QEgf312TDBIy4lXzYUBtTfdNui3VJBbyDfXqOtc="; + }; + + nativeBuildInputs = [ autoPatchelfHook dpkg wrapGAppsHook ]; + + buildInputs = [ + stdenv.cc.cc.lib + alsa-lib + browserpass + bukubrow + cairo + cups + dbus + dbus-glib + ffmpeg + fontconfig + freetype + fx_cast_bridge + glib + glibc + gnome-browser-connector + gtk3 + harfbuzz + libcanberra + libdbusmenu + libdbusmenu-gtk3 + libglvnd + libjack2 + libkrb5 + libnotify + libpulseaudio + libva + lyx + mesa + nspr + nss + opensc + pango + pciutils + pipewire + plasma5Packages.plasma-browser-integration + sndio + speechd + tridactyl-native + udev + uget-integrator + vulkan-loader + xdg-utils + xorg.libxcb + xorg.libX11 + xorg.libXcursor + xorg.libXcomposite + xorg.libXdamage + xorg.libXext + xorg.libXfixes + xorg.libXi + xorg.libXrandr + xorg.libXrender + xorg.libXtst + xorg.libXxf86vm + ]; + + installPhase = '' + runHook preInstall + + mkdir -p $out + cp -r usr/* $out + + substituteInPlace $out/share/applications/mercury-browser.desktop \ + --replace Exec=mercury-browser Exec=$out/bin/mercury-browser \ + --replace StartupWMClass=mercury StartupWMClass=mercury-default \ + --replace Icon=mercury Icon=$out/share/icons/hicolor/512x512/apps/mercury.png + addAutoPatchelfSearchPath $out/lib/mercury + substituteInPlace $out/bin/mercury-browser \ + --replace 'export LD_LIBRARY_PATH' "export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:${ + lib.makeLibraryPath buildInputs + }:$out/lib/mercury" \ + --replace /usr $out + + runHook postInstall + ''; + + meta = with lib; { + description = "Compiler-optimized private Firefox fork"; + homepage = "https://thorium.rocks/mercury"; + maintainers = with lib.maintainers; [ redxtech ]; + sourceProvenance = with sourceTypes; [ binaryNativeCode ]; + license = licenses.mpl20; + platforms = [ "x86_64-linux" ]; + mainProgram = "mercury-browser"; + }; +} diff --git a/pkgs/neo-comic-mono-font/default.nix b/pkgs/neo-comic-mono-font/default.nix new file mode 100644 index 0000000..7351f09 --- /dev/null +++ b/pkgs/neo-comic-mono-font/default.nix @@ -0,0 +1,45 @@ +{ stdenv, fetchurl, python311, wget, fontforge, python311Packages, lib }: let + cousine-font = fetchurl { + url = "https://github.com/google/fonts/raw/main/apache/cousine/Cousine-Regular.ttf"; + sha256 = "sha256-aeHqWet3ABQgTlF0+AV1D5p5PbSiUx5lFrMLdGDUcLM="; + }; + + comic-shans-font = fetchurl { + url = "https://github.com/shannpersand/comic-shanns/raw/master/v2/comic%20shanns.otf"; + sha256 = "sha256-ogAILIIBbTnwUYzUSdX6VIbbSo7kuXihDUOZpVo1fVQ="; + }; +in stdenv.mkDerivation rec { + pname = "neo-comic-mono-font"; + version = "0.0.1"; + + src = builtins.fetchTarball "https://git.jptrzy.xyz/neo-comic-mono-font/snapshot/neo-comic-mono-font-221bf59c1f75f8db922a3688dc5d282b0868e21a.tar.gz"; + + buildInputs = [ + python311 + python311Packages.fontforge + wget + fontforge + ]; + + buildPhase = '' + mkdir -p vendor build + + ln -sf "${cousine-font}" vendor/cousine.ttf + ln -sf "${comic-shans-font}" vendor/comic-shanns.otf + + python generate.py + ''; + + installPhase = '' + local out_font="$out/share/fonts/neo-comic" + install -m444 -Dt "$out_font" "build/"*.ttf + ''; + + meta = with lib; { + description = "Mono font created basing on Comic Shanns"; + homepage = "https://github.com/jptrzy/neo-comic-mono-font"; + license = licenses.mit; + maintainers = [ maintainers.jp3 ]; + platforms = platforms.all; + }; +} -- cgit v1.2.3