From 74c362e9ca1a1a752dbf51eddf23b033f62bdb7a Mon Sep 17 00:00:00 2001 From: Emmet Date: Sat, 13 Apr 2024 12:25:39 -0500 Subject: [PATCH 1/6] Removed a bunch of apps and added a few apps --- profiles/work/home.nix | 2 ++ user/pkgs/blockbench.nix | 58 ----------------------------------- user/pkgs/impressive.nix | 45 --------------------------- user/pkgs/pokefinder.nix | 32 ------------------- user/pkgs/smartcalc.nix | 27 ---------------- user/shell/cli-collection.nix | 7 +---- 6 files changed, 3 insertions(+), 168 deletions(-) delete mode 100644 user/pkgs/blockbench.nix delete mode 100644 user/pkgs/impressive.nix delete mode 100644 user/pkgs/pokefinder.nix delete mode 100644 user/pkgs/smartcalc.nix diff --git a/profiles/work/home.nix b/profiles/work/home.nix index f99c628..b219182 100644 --- a/profiles/work/home.nix +++ b/profiles/work/home.nix @@ -99,6 +99,7 @@ blender-hip cura curaengine_stable + openscad (stdenv.mkDerivation { name = "cura-slicer"; version = "0.0.7"; @@ -141,6 +142,7 @@ texinfo libffi zlib nodePackages.ungit + ventoy ]) ++ ([ pkgs-kdenlive.kdenlive ]); services.syncthing.enable = true; diff --git a/user/pkgs/blockbench.nix b/user/pkgs/blockbench.nix deleted file mode 100644 index 4f852ae..0000000 --- a/user/pkgs/blockbench.nix +++ /dev/null @@ -1,58 +0,0 @@ -{ lib, pkgs, ... }: - -{ - nixpkgs.overlays = [ - (self: super: - { - blockbench-electron = - super.blockbench-electron.overrideAttrs (oldAttrs: rec { - pname = "blockbench-electron"; - alias = "blockbench"; - version = "4.8.1"; - - src = super.fetchurl { - inherit pname version; - url = "https://github.com/JannisX11/blockbench/releases/download/v${version}/Blockbench_${version}.AppImage"; - sha256 = "sha256-CE2wDOt1WBcYmPs4sEyZ3LYvKLequFZH0B3huMYHlwA="; - name = "${pname}-${version}.AppImage"; - }; - - appimageContents = super.appimageTools.extractType2 { - inherit pname version; - name = "${pname}-${version}"; - inherit src; - }; - - dontUnpack = true; - dontConfigure = true; - dontBuild = true; - - nativeBuildInputs = [ super.makeWrapper ]; - - installPhase = '' - runHook preInstall - mkdir -p $out/bin $out/share/${pname} $out/share/applications - cp -a ${appimageContents}/{locales,resources} $out/share/${pname} - cp -a ${appimageContents}/blockbench.desktop $out/share/applications/${pname}.desktop - cp -a ${appimageContents}/usr/share/icons $out/share - substituteInPlace $out/share/applications/${pname}.desktop \ - --replace 'Exec=AppRun' 'Exec=${pname}' - runHook postInstall - ''; - - postFixup = '' - makeWrapper ${super.electron_22}/bin/electron $out/bin/${pname} \ - --add-flags $out/share/${pname}/resources/app.asar \ - --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ super.stdenv.cc.cc ]}" - - makeWrapper ${super.electron_22}/bin/electron $out/bin/${alias} \ - --add-flags $out/share/${pname}/resources/app.asar \ - --prefix LD_LIBRARY_PATH : "${lib.makeLibraryPath [ super.stdenv.cc.cc ]}" - ''; - }); - } - ) - ]; - - home.packages = [ pkgs.blockbench-electron ]; -} diff --git a/user/pkgs/impressive.nix b/user/pkgs/impressive.nix deleted file mode 100644 index 6ee0ea3..0000000 --- a/user/pkgs/impressive.nix +++ /dev/null @@ -1,45 +0,0 @@ -# THIS DOES NOT WORK YET! -{ lib, buildPythonPackage, pkgs, ... }: - -let name = "Impressive"; - _name = "impressive"; - version = "0.13.2"; -in - buildPythonPackage rec { - inherit name version; - - src = fetchTarball { - url = "https://sourceforge.net/projects/${_name}/files/${name}/${version}/${name}-${version}.tar.gz/download"; - sha256 = "sha256:0zbkqc29mgm93mysf3y5gvkaj4xxp1jv4ix1fqrcpfx3cricrkql"; - }; - - phases = "installPhase"; - - pyproject = false; - doCheck = false; - - propagatedBuildInputs = with pkgs; [ - python3Packages.pygame - python3Packages.pyopengl - python3Packages.pillow - python3Packages.pygame_sdl2 - python3Packages.pygame-gui - ffmpeg - mplayer - xdg-utils - ]; - - installPhase = '' - mkdir -p $out $out/bin $out/opt $out/share $out/share/doc $out/share/man - cp $src/impressive.py $out/opt - chmod +x $out/opt/impressive.py - ln -s $out/opt/impressive.py $out/bin/impressive - ''; - - meta = { - homepage = "https://impressive.sourceforge.net/"; - description = "the Chuck Norris of presentation software"; - license = lib.licenses.gpl2Only; - maintainers = []; - }; - } diff --git a/user/pkgs/pokefinder.nix b/user/pkgs/pokefinder.nix deleted file mode 100644 index 5fb86ef..0000000 --- a/user/pkgs/pokefinder.nix +++ /dev/null @@ -1,32 +0,0 @@ -# THIS DOESN'T WORK YET!!! -# I'M NOT SMART ENOUGH TO FIGURE THIS OUT XD -{ lib, stdenv, fetchgit, pkgs, ... }: - -let name = "pokefinder"; - version = "4.1.2"; -in - stdenv.mkDerivation { - inherit name version; - - src = fetchgit { - url = "https://github.com/Admiral-Fish/${name}"; - fetchSubmodules = true; - rev = "v${version}"; - sha256 = "sha256-ps8F6IcbCNybrZ02tbLNyB3YEvKlcYgCpv5Em7Riv+Q="; - }; - - buildInputs = with pkgs; [ qt6.full qt6.qttools ]; - nativeBuildInputs = with pkgs; [ python3 pkgs.cmake qt6.wrapQtAppsHook ]; - - cmakeFlags = [ - "-DCMAKE_BUILD_TYPE=RELEASE" - "-DCMAKE_PREFIX_PATH=${pkgs.qt6.full}" - ]; - - meta = { - homepage = "https://github.com/Admiral-Fish/PokeFinder"; - description = "Cross platform Pokémon RNG tool"; - license = lib.licenses.gpl3; - maintainers = []; - }; - } diff --git a/user/pkgs/smartcalc.nix b/user/pkgs/smartcalc.nix deleted file mode 100644 index 8258f2a..0000000 --- a/user/pkgs/smartcalc.nix +++ /dev/null @@ -1,27 +0,0 @@ -{ lib, pkgs, ... }: -let - rustPlatform = pkgs.makeRustPlatform { - cargo = pkgs.rust-bin.stable.latest.minimal; - rustc = pkgs.rust-bin.stable.latest.minimal; - }; -in -rustPlatform.buildRustPackage rec { - pname = "smartcalc-tui"; - version = "1.0.7"; - - src = fetchTarball { - url = "https://github.com/superhawk610/smartcalc-tui/archive/refs/tags/v1.0.7.tar.gz"; - sha256 = "1dv24rsj87avpbrmab0hy3v729fdqh1cfbvl1xsjmfn8y35z4m5m"; - }; - - cargoSha256 = "sha256-0AWsJccfzkUkpB6imibN6iUNDEx3vrX9kEgD98nXURw="; - - checkType = "debug"; - - meta = with lib; { - description = "Terminal UI for erhanbaris/smartcalc"; - homepage = "https://github.com/superhawk610/smartcalc-tui"; - license = licenses.mit; - maintainers = []; - }; -} diff --git a/user/shell/cli-collection.nix b/user/shell/cli-collection.nix index 468feed..f753928 100644 --- a/user/shell/cli-collection.nix +++ b/user/shell/cli-collection.nix @@ -1,5 +1,4 @@ { pkgs, ... }: - { # Collection of useful CLI apps home.packages = with pkgs; [ @@ -15,16 +14,12 @@ bat eza fd bottom ripgrep rsync unzip - tmux w3m pandoc hwinfo pciutils numbat - (pkgs.callPackage ../pkgs/smartcalc.nix { }) - #(pkgs.writeShellScriptBin "sc" ''smartcalc'') - #(pkgs.callPackage ../pkgs/pokemon-colorscripts.nix { }) - #(pkgs.python3Packages.callPackage ../pkgs/impressive.nix { }) + (pkgs.callPackage ../pkgs/pokemon-colorscripts.nix { }) (pkgs.writeShellScriptBin "airplane-mode" '' #!/bin/sh connectivity="$(nmcli n connectivity)" From 4c25bedde25d9f17498299007d2dabafc92c3770 Mon Sep 17 00:00:00 2001 From: Emmet Date: Sat, 13 Apr 2024 12:38:18 -0500 Subject: [PATCH 2/6] Added a lot more ranger file previews! --- user/app/ranger/rc.conf | 2 +- user/app/ranger/scope.sh | 93 +++++++++++++++++++++++----------------- user/pkgs/ranger.nix | 7 ++- 3 files changed, 60 insertions(+), 42 deletions(-) diff --git a/user/app/ranger/rc.conf b/user/app/ranger/rc.conf index c196c0d..6a8cdfa 100644 --- a/user/app/ranger/rc.conf +++ b/user/app/ranger/rc.conf @@ -256,7 +256,7 @@ set cd_tab_fuzzy false # Avoid previewing files larger than this size, in bytes. Use a value of 0 to # disable this feature. -set preview_max_size 200000000 +set preview_max_size 0 # The key hint lists up to this size have their sublists expanded. # Otherwise the submaps are replaced with "...". diff --git a/user/app/ranger/scope.sh b/user/app/ranger/scope.sh index d58637e..005469d 100755 --- a/user/app/ranger/scope.sh +++ b/user/app/ranger/scope.sh @@ -170,29 +170,29 @@ handle_image() { ## as above), but might fail for unsupported types. exit 7;; - ## Video - # video/*) - # # Get embedded thumbnail - # ffmpeg -i "${FILE_PATH}" -map 0:v -map -0:V -c copy "${IMAGE_CACHE_PATH}" && exit 6 - # # Get frame 10% into video - # ffmpegthumbnailer -i "${FILE_PATH}" -o "${IMAGE_CACHE_PATH}" -s 0 && exit 6 - # exit 1;; + # Video + video/*) + # Get frame 10% into video + ffmpegthumbnailer -i "${FILE_PATH}" -o "${IMAGE_CACHE_PATH}" -s 0 && exit 6 + # Get embedded thumbnail + ffmpeg -i "${FILE_PATH}" -map 0:v -map -0:V -c copy "${IMAGE_CACHE_PATH}" && exit 6 + exit 1;; - ## Audio - # audio/*) - # # Get embedded thumbnail - # ffmpeg -i "${FILE_PATH}" -map 0:v -map -0:V -c copy \ - # "${IMAGE_CACHE_PATH}" && exit 6;; + # Audio + audio/*) + # Get embedded thumbnail + ffmpeg -i "${FILE_PATH}" -map 0:v -map -0:V -c copy \ + "${IMAGE_CACHE_PATH}" && exit 6;; - ## PDF - # application/pdf) - # pdftoppm -f 1 -l 1 \ - # -scale-to-x "${DEFAULT_SIZE%x*}" \ - # -scale-to-y -1 \ - # -singlefile \ - # -jpeg -tiffcompression jpeg \ - # -- "${FILE_PATH}" "${IMAGE_CACHE_PATH%.*}" \ - # && exit 6 || exit 1;; + # PDF + application/pdf) + pdftoppm -f 1 -l 1 \ + -scale-to-x "${DEFAULT_SIZE%x*}" \ + -scale-to-y -1 \ + -singlefile \ + -jpeg -tiffcompression jpeg \ + -- "${FILE_PATH}" "${IMAGE_CACHE_PATH%.*}" \ + && exit 6 || exit 1;; ## ePub, MOBI, FB2 (using Calibre) @@ -205,7 +205,7 @@ handle_image() { # >/dev/null && exit 6 # exit 1;; - ## Font + # Font application/font*|application/*opentype) preview_png="/tmp/$(basename "${IMAGE_CACHE_PATH%.*}").png" if fontimage -o "${preview_png}" \ @@ -265,29 +265,42 @@ handle_image() { # ;; esac - # openscad_image() { - # TMPPNG="$(mktemp -t xxxxxx.png)" - # openscad --colorscheme="${OPENSCAD_COLORSCHEME}" \ - # --imgsize="${OPENSCAD_IMGSIZE/x/,}" \ - # -o "${TMPPNG}" "${1}" - # mv "${TMPPNG}" "${IMAGE_CACHE_PATH}" - # } + openscad_image() { + TMPPNG="$(mktemp -t XXXXXXXXXX --suffix '.png')" + openscad --colorscheme="${OPENSCAD_COLORSCHEME}" \ + --imgsize="${OPENSCAD_IMGSIZE/x/,}" \ + -o "${TMPPNG}" "${1}" + mv "${TMPPNG}" "${IMAGE_CACHE_PATH}" + } + FULL_FILE_PATH=$(readlink -f $FILE_PATH); case "${FILE_EXTENSION_LOWER}" in - ## 3D models - ## OpenSCAD only supports png image output, and ${IMAGE_CACHE_PATH} - ## is hardcoded as jpeg. So we make a tempfile.png and just - ## move/rename it to jpg. This works because image libraries are - ## smart enough to handle it. - # csg|scad) - # openscad_image "${FILE_PATH}" && exit 6 - # ;; - # 3mf|amf|dxf|off|stl) - # openscad_image <(echo "import(\"${FILE_PATH}\");") && exit 6 - # ;; + # 3D models + # OpenSCAD only supports png image output, and ${IMAGE_CACHE_PATH} + # is hardcoded as jpeg. So we make a tempfile.png and just + # move/rename it to jpg. This works because image libraries are + # smart enough to handle it. + csg|scad) + openscad_image "${FILE_PATH}" && exit 6 + ;; + stl) + openscad_image <(echo "import(\"${FULL_FILE_PATH}\");") && exit 6 + ;; + 3mf|amf|dxf|off|stl) + openscad_image <(echo "import(\"${FULL_FILE_PATH}\");") && exit 6 + ;; drawio) draw.io -x "${FILE_PATH}" -o "${IMAGE_CACHE_PATH}" \ --width "${DEFAULT_SIZE%x*}" && exit 6 + ;; + blend|blend~) + blender-thumbnailer "${FILE_PATH}" "${IMAGE_CACHE_PATH}" && exit 6 + ;; + kra|kra~) + unzip -pP "" -- "${FILE_PATH}" "mergedimage.png" > "${IMAGE_CACHE_PATH}" && exit 6 + ;; + xopp|xopp~) + xournalpp "${FILE_PATH}" --create-img "${IMAGE_CACHE_PATH}" && exit 6 exit 1;; esac } diff --git a/user/pkgs/ranger.nix b/user/pkgs/ranger.nix index 5f579c7..4a56abb 100644 --- a/user/pkgs/ranger.nix +++ b/user/pkgs/ranger.nix @@ -7,7 +7,7 @@ ranger = super.ranger.overrideAttrs (oldAttrs: rec { preConfigure = '' substituteInPlace ranger/__init__.py \ - --replace "DEFAULT_PAGER = 'less'" "DEFAULT_PAGER = '${lib.getBin pkgs.less}/bin/less'" + --replace "DEFAULT_PAGER = 'less'" "DEFAULT_PAGER = '${lib.getBin pkgs.bat}/bin/bat'" # give image previews out of the box when building with w3m substituteInPlace ranger/config/rc.conf \ @@ -28,5 +28,10 @@ } ) ]; + home.packages = with pkgs; [ + poppler_utils + librsvg + ffmpegthumbnailer + ]; } From 9af1be6b6918f81c1c8e6c0995c9126b52cf4717 Mon Sep 17 00:00:00 2001 From: Emmet Date: Sat, 13 Apr 2024 12:38:30 -0500 Subject: [PATCH 3/6] Fixed a lot of ranger file handlers --- user/app/ranger/rifle.conf | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/user/app/ranger/rifle.conf b/user/app/ranger/rifle.conf index 3239a03..e637fe0 100644 --- a/user/app/ranger/rifle.conf +++ b/user/app/ranger/rifle.conf @@ -75,8 +75,18 @@ ext nes, has fceux, X = fceux "$1" #ext exe = wine "$1" name ^[mM]akefile$ = make -#----------- FL STUDIO -------------- -ext flp = flstudio "$@" & &>/dev/null +#------------------------------------------ +# My applications +#------------------------------------------ +ext kra, has krita, X, flag f = krita "$@" &>/dev/null +ext kra~, has krita, X, flag f = krita "$@" &>/dev/null +ext blend, has blender, X, flag f = blender "$@" &>/dev/null +ext blend~, has blender, X, flag f = blender "$@" &>/dev/null +ext xopp, has xournalpp, X, flag f = xournalpp "$@" &>/dev/null +ext xopp~, has blender, X, flag f = xournalpp "$@" &>/dev/null +ext helio, has helio, X, flag f = helio "$@" &>/dev/null +ext kdenlive, has kdenlive-accel, X, flag f = kdenlive-accel "$@" &>/dev/null +ext flp, has flstudio, X, flag f = flstudio "$@" &>/dev/null #-------------------------------------------- # Scripts @@ -212,11 +222,6 @@ label pager, !mime ^text, !ext xml|json|csv|tex|py|pl|rb|js|sh|php = "$PAGER" # they are never triggered accidentally. # ###################################################################### -# My applications -ext kra = krita "$@" & &>/dev/null -ext blend* = blender "$@" & &>/dev/null -ext helio = helio "$@" & &>/dev/null -ext kdenlive = kdenlive-accel "$@" & &>/dev/null # Execute a file as program/script. mime application/x-executable = "$1" From 46387c6f578b8c886c85d6e320abf946aadd158f Mon Sep 17 00:00:00 2001 From: Emmet Date: Sat, 13 Apr 2024 15:01:22 -0500 Subject: [PATCH 4/6] Added org-sliced-images --- flake.lock | 17 +++++++++++++++++ flake.nix | 7 ++++++- user/app/doom-emacs/config.el | 8 +++++++- user/app/doom-emacs/doom.nix | 6 +++++- user/app/doom-emacs/doom.org | 16 ++++++++++++++-- 5 files changed, 49 insertions(+), 5 deletions(-) diff --git a/flake.lock b/flake.lock index 537a652..077cdb0 100644 --- a/flake.lock +++ b/flake.lock @@ -805,6 +805,22 @@ "type": "github" } }, + "org-sliced-images": { + "flake": false, + "locked": { + "lastModified": 1711408181, + "narHash": "sha256-ck3mGXtJJ0N8asGE4cRtWeJx5/iC+bTXw2cvZgePJqM=", + "owner": "jcfk", + "repo": "org-sliced-images", + "rev": "bd1141d6df6edfd9749c0bbf3a72836148c0e39d", + "type": "github" + }, + "original": { + "owner": "jcfk", + "repo": "org-sliced-images", + "type": "github" + } + }, "org-timeblock": { "flake": false, "locked": { @@ -918,6 +934,7 @@ "org-krita": "org-krita", "org-nursery": "org-nursery", "org-side-tree": "org-side-tree", + "org-sliced-images": "org-sliced-images", "org-timeblock": "org-timeblock", "org-yaap": "org-yaap", "phscroll": "phscroll", diff --git a/flake.nix b/flake.nix index 3386aba..6c3ee25 100644 --- a/flake.nix +++ b/flake.nix @@ -4,7 +4,7 @@ outputs = inputs@{ self, nixpkgs, nixpkgs-stable, emacs-pin-nixpkgs, kdenlive-pin-nixpkgs, home-manager-unstable, home-manager-stable, nix-doom-emacs, nix-straight, stylix, blocklist-hosts, rust-overlay, org-nursery, org-yaap, - org-side-tree, org-timeblock, org-krita, phscroll, mini-frame, ... }: + org-side-tree, org-timeblock, org-krita, org-sliced-images, phscroll, mini-frame, ... }: let # ---- SYSTEM SETTINGS ---- # systemSettings = { @@ -138,6 +138,7 @@ inherit (inputs) org-side-tree; inherit (inputs) org-timeblock; inherit (inputs) org-krita; + inherit (inputs) org-sliced-images; inherit (inputs) phscroll; inherit (inputs) mini-frame; #inherit (inputs) nix-flatpak; @@ -232,6 +233,10 @@ url = "github:lepisma/org-krita"; flake = false; }; + org-sliced-images = { + url = "github:jcfk/org-sliced-images"; + flake = false; + }; phscroll = { url = "github:misohena/phscroll"; flake = false; diff --git a/user/app/doom-emacs/config.el b/user/app/doom-emacs/config.el index 2779572..6f8735b 100644 --- a/user/app/doom-emacs/config.el +++ b/user/app/doom-emacs/config.el @@ -272,7 +272,7 @@ org-pretty-entities t org-ellipsis "…") -(setq-default line-spacing 0.15) +(setq-default line-spacing 0) ; Automatic table of contents is nice (if (require 'toc-org nil t) @@ -482,6 +482,12 @@ If FULL-MODE is not null, run full krita." :desc "Copy link/file at point into system clipbord (C-g to escape if copying a file)" "y y" 'org-copy-link-to-clipboard-at-point)) +(add-load-path! "~/.emacs.d/org-sliced-images") +(require 'org-sliced-images) +(defalias 'org-remove-inline-images #'org-sliced-images-remove-inline-images) +(defalias 'org-toggle-inline-images #'org-sliced-images-toggle-inline-images) +(defalias 'org-display-inline-images #'org-sliced-images-display-inline-images) + ;; Online images inside of org mode is pretty cool ;; This snippit is from Tobias on Stack Exchange ;; https://emacs.stackexchange.com/questions/42281/org-mode-is-it-possible-to-display-online-images diff --git a/user/app/doom-emacs/doom.nix b/user/app/doom-emacs/doom.nix index 1df0023..6824bd9 100644 --- a/user/app/doom-emacs/doom.nix +++ b/user/app/doom-emacs/doom.nix @@ -1,5 +1,5 @@ { config, lib, pkgs-emacs, pkgs-stable, userSettings, systemSettings, - org-nursery, org-yaap, org-side-tree, org-timeblock, org-krita, phscroll, mini-frame, ... }: + org-nursery, org-yaap, org-side-tree, org-timeblock, org-krita, org-sliced-images, phscroll, mini-frame, ... }: let themePolarity = lib.removeSuffix "\n" (builtins.readFile (./. + "../../../../themes"+("/"+userSettings.theme)+"/polarity.txt")); dashboardLogo = ./. + "/nix-" + themePolarity + ".png"; @@ -101,6 +101,10 @@ in source = "${org-krita}"; }; + home.file.".emacs.d/org-sliced-images" = { + source = "${org-sliced-images}"; + }; + home.file.".emacs.d/dashboard-logo.png".source = dashboardLogo; home.file.".emacs.d/scripts/copy-link-or-file/copy-link-or-file-to-clipboard.sh" = { source = ./scripts/copy-link-or-file/copy-link-or-file-to-clipboard.sh; diff --git a/user/app/doom-emacs/doom.org b/user/app/doom-emacs/doom.org index 38d81f1..aec8d8a 100644 --- a/user/app/doom-emacs/doom.org +++ b/user/app/doom-emacs/doom.org @@ -342,7 +342,7 @@ Doom Emacs is traditionally installed by cloning the repository ([[https://githu org-pretty-entities t org-ellipsis "…") -(setq-default line-spacing 0.15) +(setq-default line-spacing 0) ; Automatic table of contents is nice (if (require 'toc-org nil t) @@ -587,6 +587,14 @@ else fi exit #+END_SRC +*** Org Sliced Images +#+begin_src emacs-lisp :tangle config.el +(add-load-path! "~/.emacs.d/org-sliced-images") +(require 'org-sliced-images) +(defalias 'org-remove-inline-images #'org-sliced-images-remove-inline-images) +(defalias 'org-toggle-inline-images #'org-sliced-images-toggle-inline-images) +(defalias 'org-display-inline-images #'org-sliced-images-display-inline-images) +#+end_src *** Org Online Images #+BEGIN_SRC emacs-lisp :tangle config.el ;; Online images inside of org mode is pretty cool @@ -1994,7 +2002,7 @@ Any git package can be configured for a particular commit or branch: In order to have Nix load my Doom Emacs configuration [[./doom.nix][doom.nix]], which I source in the =imports= block of my [[../../../profiles/work/home.nix][home.nix]]. #+BEGIN_SRC nix :tangle doom.nix { config, lib, pkgs-emacs, pkgs-stable, userSettings, systemSettings, - org-nursery, org-yaap, org-side-tree, org-timeblock, org-krita, phscroll, mini-frame, ... }: + org-nursery, org-yaap, org-side-tree, org-timeblock, org-krita, org-sliced-images, phscroll, mini-frame, ... }: let themePolarity = lib.removeSuffix "\n" (builtins.readFile (./. + "../../../../themes"+("/"+userSettings.theme)+"/polarity.txt")); dashboardLogo = ./. + "/nix-" + themePolarity + ".png"; @@ -2096,6 +2104,10 @@ in source = "${org-krita}"; }; + home.file.".emacs.d/org-sliced-images" = { + source = "${org-sliced-images}"; + }; + home.file.".emacs.d/dashboard-logo.png".source = dashboardLogo; home.file.".emacs.d/scripts/copy-link-or-file/copy-link-or-file-to-clipboard.sh" = { source = ./scripts/copy-link-or-file/copy-link-or-file-to-clipboard.sh; From 7888439a8dbb8bfc91bc29cc5b64c07366b3769c Mon Sep 17 00:00:00 2001 From: Emmet Date: Sat, 13 Apr 2024 15:01:51 -0500 Subject: [PATCH 5/6] Forked org-krita --- flake.lock | 10 +++++----- flake.nix | 4 +--- user/app/doom-emacs/config.el | 22 ++-------------------- user/app/doom-emacs/doom.org | 22 ++-------------------- 4 files changed, 10 insertions(+), 48 deletions(-) diff --git a/flake.lock b/flake.lock index 077cdb0..12d8c3c 100644 --- a/flake.lock +++ b/flake.lock @@ -760,15 +760,15 @@ "org-krita": { "flake": false, "locked": { - "lastModified": 1619935377, - "narHash": "sha256-+HI8P0/LI8gdiCD7OiPKTAtLKrPt0REnQ+6oblHSHzU=", - "owner": "lepisma", + "lastModified": 1713037764, + "narHash": "sha256-EHJwe3G/k5/UWFfY+vEkCdKvKNCK7Oh3fFKgMUa87lw=", + "owner": "librephoenix", "repo": "org-krita", - "rev": "7e334951b8de8f2f1c8cbe5068e7dfe6b9e9808f", + "rev": "6b85cf06f17dfcf9daeb6e045caea6df882bc4ff", "type": "github" }, "original": { - "owner": "lepisma", + "owner": "librephoenix", "repo": "org-krita", "type": "github" } diff --git a/flake.nix b/flake.nix index 6c3ee25..8dd8d0e 100644 --- a/flake.nix +++ b/flake.nix @@ -123,7 +123,6 @@ modules = [ (./. + "/profiles" + ("/" + systemSettings.profile) + "/home.nix") # load home.nix from selected PROFILE - # inputs.nix-flatpak.homeManagerModules.nix-flatpak # Declarative flatpaks ]; extraSpecialArgs = { # pass config variables from above @@ -141,7 +140,6 @@ inherit (inputs) org-sliced-images; inherit (inputs) phscroll; inherit (inputs) mini-frame; - #inherit (inputs) nix-flatpak; inherit (inputs) stylix; }; }; @@ -230,7 +228,7 @@ flake = false; }; org-krita = { - url = "github:lepisma/org-krita"; + url = "github:librephoenix/org-krita"; flake = false; }; org-sliced-images = { diff --git a/user/app/doom-emacs/config.el b/user/app/doom-emacs/config.el index 6f8735b..c83e31c 100644 --- a/user/app/doom-emacs/config.el +++ b/user/app/doom-emacs/config.el @@ -437,26 +437,8 @@ same directory as the org-buffer and insert a link to this file." (add-load-path! "~/.emacs.d/org-krita") (require 'org-krita) (add-hook 'org-mode-hook 'org-krita-mode) - -(defun org-krita-show-link (link) - (org-krita-hide-link link) - (let* ((start (org-element-property :begin link)) - (end (org-element-property :end link)) - (overlay (make-overlay (+ start 0) (+ end 0))) - (kra-path (org-element-property :path link))) - (overlay-put overlay 'display (create-image (org-krita-extract-png kra-path) 'png t :scale 0.5)) - (push (cons kra-path overlay) org-krita-overlays))) - -(defun org-krita-edit (path &optional full-mode) - "Edit given PATH in krita canvasonly mode. - -If FULL-MODE is not null, run full krita." - (let ((kra-path (expand-file-name path))) - (when (f-exists-p kra-path) - (if full-mode - (call-process org-krita-executable nil 0 nil kra-path) - (call-process org-krita-executable nil 0 nil kra-path)) - (org-krita-add-watcher kra-path)))) +(setq org-krita-extract-filename "preview.png") +(setq org-krita-scale 1) (defun org-copy-link-to-clipboard-at-point () "Copy current link at point into clipboard (useful for images and links)" diff --git a/user/app/doom-emacs/doom.org b/user/app/doom-emacs/doom.org index aec8d8a..316f4d0 100644 --- a/user/app/doom-emacs/doom.org +++ b/user/app/doom-emacs/doom.org @@ -514,26 +514,8 @@ same directory as the org-buffer and insert a link to this file." (add-load-path! "~/.emacs.d/org-krita") (require 'org-krita) (add-hook 'org-mode-hook 'org-krita-mode) - -(defun org-krita-show-link (link) - (org-krita-hide-link link) - (let* ((start (org-element-property :begin link)) - (end (org-element-property :end link)) - (overlay (make-overlay (+ start 0) (+ end 0))) - (kra-path (org-element-property :path link))) - (overlay-put overlay 'display (create-image (org-krita-extract-png kra-path) 'png t :scale 0.5)) - (push (cons kra-path overlay) org-krita-overlays))) - -(defun org-krita-edit (path &optional full-mode) - "Edit given PATH in krita canvasonly mode. - -If FULL-MODE is not null, run full krita." - (let ((kra-path (expand-file-name path))) - (when (f-exists-p kra-path) - (if full-mode - (call-process org-krita-executable nil 0 nil kra-path) - (call-process org-krita-executable nil 0 nil kra-path)) - (org-krita-add-watcher kra-path)))) +(setq org-krita-extract-filename "preview.png") +(setq org-krita-scale 1) #+END_SRC *** Copy Links/Files into Clipboard From d558c9a91e7b185321f9bf6f0943445ec5775795 Mon Sep 17 00:00:00 2001 From: Emmet Date: Sat, 13 Apr 2024 15:21:51 -0500 Subject: [PATCH 6/6] Refactors flake inputs to be passed as single specialArg for simplicity --- flake.nix | 39 ++++++++++++----------------------- profiles/work/home.nix | 4 +--- profiles/wsl/home.nix | 4 +--- system/security/blocklist.nix | 4 ++-- system/style/stylix.nix | 4 ++-- user/app/doom-emacs/doom.nix | 20 +++++++++--------- user/app/doom-emacs/doom.org | 20 +++++++++--------- user/style/stylix.nix | 5 ++++- 8 files changed, 43 insertions(+), 57 deletions(-) diff --git a/flake.nix b/flake.nix index 8dd8d0e..13250d4 100644 --- a/flake.nix +++ b/flake.nix @@ -1,10 +1,7 @@ { description = "Flake of LibrePhoenix"; - outputs = inputs@{ self, nixpkgs, nixpkgs-stable, emacs-pin-nixpkgs, kdenlive-pin-nixpkgs, - home-manager-unstable, home-manager-stable, nix-doom-emacs, - nix-straight, stylix, blocklist-hosts, rust-overlay, org-nursery, org-yaap, - org-side-tree, org-timeblock, org-krita, org-sliced-images, phscroll, mini-frame, ... }: + outputs = inputs@{ self, ... }: let # ---- SYSTEM SETTINGS ---- # systemSettings = { @@ -51,9 +48,9 @@ # create patched nixpkgs nixpkgs-patched = - (import nixpkgs { system = systemSettings.system; }).applyPatches { + (import inputs.nixpkgs { system = systemSettings.system; }).applyPatches { name = "nixpkgs-patched"; - src = nixpkgs; + src = inputs.nixpkgs; patches = [ ./patches/emacs-no-version-check.patch ]; }; @@ -70,10 +67,10 @@ allowUnfree = true; allowUnfreePredicate = (_: true); }; - overlays = [ rust-overlay.overlays.default ]; + overlays = [ inputs.rust-overlay.overlays.default ]; })); - pkgs-stable = import nixpkgs-stable { + pkgs-stable = import inputs.nixpkgs-stable { system = systemSettings.system; config = { allowUnfree = true; @@ -81,11 +78,11 @@ }; }; - pkgs-emacs = import emacs-pin-nixpkgs { + pkgs-emacs = import inputs.emacs-pin-nixpkgs { system = systemSettings.system; }; - pkgs-kdenlive = import kdenlive-pin-nixpkgs { + pkgs-kdenlive = import inputs.kdenlive-pin-nixpkgs { system = systemSettings.system; }; @@ -94,17 +91,17 @@ # otherwise use patched nixos-unstable nixpkgs lib = (if ((systemSettings.profile == "homelab") || (systemSettings.profile == "worklab")) then - nixpkgs-stable.lib + inputs.nixpkgs-stable.lib else - nixpkgs.lib); + inputs.nixpkgs.lib); # use home-manager-stable if running a server (homelab or worklab profile) # otherwise use home-manager-unstable home-manager = (if ((systemSettings.profile == "homelab") || (systemSettings.profile == "worklab")) then - home-manager-stable + inputs.home-manager-stable else - home-manager-unstable); + inputs.home-manager-unstable); # Systems that can run tests: supportedSystems = [ "aarch64-linux" "i686-linux" "x86_64-linux" ]; @@ -131,16 +128,7 @@ inherit pkgs-kdenlive; inherit systemSettings; inherit userSettings; - inherit (inputs) nix-doom-emacs; - inherit (inputs) org-nursery; - inherit (inputs) org-yaap; - inherit (inputs) org-side-tree; - inherit (inputs) org-timeblock; - inherit (inputs) org-krita; - inherit (inputs) org-sliced-images; - inherit (inputs) phscroll; - inherit (inputs) mini-frame; - inherit (inputs) stylix; + inherit inputs; }; }; }; @@ -156,8 +144,7 @@ inherit pkgs-stable; inherit systemSettings; inherit userSettings; - inherit (inputs) stylix; - inherit (inputs) blocklist-hosts; + inherit inputs; }; }; }; diff --git a/profiles/work/home.nix b/profiles/work/home.nix index b219182..16259ee 100644 --- a/profiles/work/home.nix +++ b/profiles/work/home.nix @@ -1,4 +1,4 @@ -{ config, pkgs, pkgs-kdenlive, nix-doom-emacs, stylix, userSettings, ... }: +{ config, pkgs, pkgs-kdenlive, userSettings, ... }: { # Home Manager needs a bit of information about you and the paths it should @@ -9,8 +9,6 @@ programs.home-manager.enable = true; imports = [ - (if ((userSettings.editor == "emacs") || (userSettings.editor == "emacsclient")) then nix-doom-emacs.hmModule else null) - stylix.homeManagerModules.stylix (./. + "../../../user/wm"+("/"+userSettings.wm+"/"+userSettings.wm)+".nix") # My window manager selected from flake ../../user/shell/sh.nix # My zsh and bash config ../../user/shell/cli-collection.nix # Useful CLI apps diff --git a/profiles/wsl/home.nix b/profiles/wsl/home.nix index 794d7e1..7fb8ee7 100644 --- a/profiles/wsl/home.nix +++ b/profiles/wsl/home.nix @@ -1,4 +1,4 @@ -{ config, pkgs, nix-doom-emacs, stylix, userSettings, ... }: +{ config, pkgs, userSettings, ... }: { # Home Manager needs a bit of information about you and the paths it should @@ -9,8 +9,6 @@ programs.home-manager.enable = true; imports = [ - (if ((userSettings.editor == "emacs") || (userSettings.editor == "emacsclient")) then nix-doom-emacs.hmModule else null) - stylix.homeManagerModules.stylix ../../user/shell/sh.nix # My zsh and bash config ../../user/shell/cli-collection.nix # Useful CLI apps ../../user/app/doom-emacs/doom.nix # My doom emacs config diff --git a/system/security/blocklist.nix b/system/security/blocklist.nix index c7d2792..0653a09 100644 --- a/system/security/blocklist.nix +++ b/system/security/blocklist.nix @@ -1,6 +1,6 @@ -{ blocklist-hosts, ... }: +{ inputs, ... }: -let blocklist = builtins.readFile "${blocklist-hosts}/alternates/gambling-porn/hosts"; +let blocklist = builtins.readFile "${inputs.blocklist-hosts}/alternates/gambling-porn/hosts"; in { networking.extraHosts = '' diff --git a/system/style/stylix.nix b/system/style/stylix.nix index d8fe483..7b7bf6b 100644 --- a/system/style/stylix.nix +++ b/system/style/stylix.nix @@ -1,4 +1,4 @@ -{ lib, pkgs, stylix, userSettings, ... }: +{ lib, pkgs, inputs, userSettings, ... }: let themePath = "../../../themes/"+userSettings.theme+"/"+userSettings.theme+".yaml"; @@ -8,7 +8,7 @@ let backgroundSha256 = builtins.readFile (./. + "../../../themes/"+("/"+userSettings.theme)+"/backgroundsha256.txt"); in { - imports = [ stylix.nixosModules.stylix ]; + imports = [ inputs.stylix.nixosModules.stylix ]; stylix.autoEnable = false; stylix.polarity = themePolarity; diff --git a/user/app/doom-emacs/doom.nix b/user/app/doom-emacs/doom.nix index 6824bd9..4add4e2 100644 --- a/user/app/doom-emacs/doom.nix +++ b/user/app/doom-emacs/doom.nix @@ -1,11 +1,11 @@ -{ config, lib, pkgs-emacs, pkgs-stable, userSettings, systemSettings, - org-nursery, org-yaap, org-side-tree, org-timeblock, org-krita, org-sliced-images, phscroll, mini-frame, ... }: +{ config, lib, pkgs-emacs, pkgs-stable, inputs, userSettings, systemSettings, ... }: let themePolarity = lib.removeSuffix "\n" (builtins.readFile (./. + "../../../../themes"+("/"+userSettings.theme)+"/polarity.txt")); dashboardLogo = ./. + "/nix-" + themePolarity + ".png"; in { imports = [ + inputs.nix-doom-emacs.hmModule ../git/git.nix ../../shell/sh.nix ../../shell/cli-collection.nix @@ -79,30 +79,30 @@ in }; home.file.".emacs.d/org-yaap" = { - source = "${org-yaap}"; + source = "${inputs.org-yaap}"; recursive = true; }; home.file.".emacs.d/org-side-tree" = { - source = "${org-side-tree}"; + source = "${inputs.org-side-tree}"; recursive = true; }; home.file.".emacs.d/org-timeblock" = { - source = "${org-timeblock}"; + source = "${inputs.org-timeblock}"; recursive = true; }; home.file.".emacs.d/org-nursery" = { - source = "${org-nursery}"; + source = "${inputs.org-nursery}"; }; home.file.".emacs.d/org-krita" = { - source = "${org-krita}"; + source = "${inputs.org-krita}"; }; home.file.".emacs.d/org-sliced-images" = { - source = "${org-sliced-images}"; + source = "${inputs.org-sliced-images}"; }; home.file.".emacs.d/dashboard-logo.png".source = dashboardLogo; @@ -112,11 +112,11 @@ in }; home.file.".emacs.d/phscroll" = { - source = "${phscroll}"; + source = "${inputs.phscroll}"; }; home.file.".emacs.d/mini-frame" = { - source = "${mini-frame}"; + source = "${inputs.mini-frame}"; }; home.file.".emacs.d/system-vars.el".text = '' diff --git a/user/app/doom-emacs/doom.org b/user/app/doom-emacs/doom.org index 316f4d0..54a4fea 100644 --- a/user/app/doom-emacs/doom.org +++ b/user/app/doom-emacs/doom.org @@ -1983,14 +1983,14 @@ Any git package can be configured for a particular commit or branch: * Nix Integration In order to have Nix load my Doom Emacs configuration [[./doom.nix][doom.nix]], which I source in the =imports= block of my [[../../../profiles/work/home.nix][home.nix]]. #+BEGIN_SRC nix :tangle doom.nix -{ config, lib, pkgs-emacs, pkgs-stable, userSettings, systemSettings, - org-nursery, org-yaap, org-side-tree, org-timeblock, org-krita, org-sliced-images, phscroll, mini-frame, ... }: +{ config, lib, pkgs-emacs, pkgs-stable, inputs, userSettings, systemSettings, ... }: let themePolarity = lib.removeSuffix "\n" (builtins.readFile (./. + "../../../../themes"+("/"+userSettings.theme)+"/polarity.txt")); dashboardLogo = ./. + "/nix-" + themePolarity + ".png"; in { imports = [ + inputs.nix-doom-emacs.hmModule ../git/git.nix ../../shell/sh.nix ../../shell/cli-collection.nix @@ -2064,30 +2064,30 @@ in }; home.file.".emacs.d/org-yaap" = { - source = "${org-yaap}"; + source = "${inputs.org-yaap}"; recursive = true; }; home.file.".emacs.d/org-side-tree" = { - source = "${org-side-tree}"; + source = "${inputs.org-side-tree}"; recursive = true; }; home.file.".emacs.d/org-timeblock" = { - source = "${org-timeblock}"; + source = "${inputs.org-timeblock}"; recursive = true; }; home.file.".emacs.d/org-nursery" = { - source = "${org-nursery}"; + source = "${inputs.org-nursery}"; }; home.file.".emacs.d/org-krita" = { - source = "${org-krita}"; + source = "${inputs.org-krita}"; }; home.file.".emacs.d/org-sliced-images" = { - source = "${org-sliced-images}"; + source = "${inputs.org-sliced-images}"; }; home.file.".emacs.d/dashboard-logo.png".source = dashboardLogo; @@ -2097,11 +2097,11 @@ in }; home.file.".emacs.d/phscroll" = { - source = "${phscroll}"; + source = "${inputs.phscroll}"; }; home.file.".emacs.d/mini-frame" = { - source = "${mini-frame}"; + source = "${inputs.mini-frame}"; }; home.file.".emacs.d/system-vars.el".text = '' diff --git a/user/style/stylix.nix b/user/style/stylix.nix index 1fe5de0..c7d65d0 100644 --- a/user/style/stylix.nix +++ b/user/style/stylix.nix @@ -1,4 +1,4 @@ -{ config, lib, pkgs, userSettings, ... }: +{ config, lib, pkgs, inputs, userSettings, ... }: let themePath = "../../../themes"+("/"+userSettings.theme+"/"+userSettings.theme)+".yaml"; @@ -7,6 +7,9 @@ let backgroundSha256 = builtins.readFile (./. + "../../../themes/"+("/"+userSettings.theme)+"/backgroundsha256.txt"); in { + + imports = [ inputs.stylix.homeManagerModules.stylix ]; + home.file.".currenttheme".text = userSettings.theme; stylix.autoEnable = false; stylix.polarity = themePolarity;