diff --git a/flake.lock b/flake.lock index 12d8c3c..537a652 100644 --- a/flake.lock +++ b/flake.lock @@ -760,15 +760,15 @@ "org-krita": { "flake": false, "locked": { - "lastModified": 1713037764, - "narHash": "sha256-EHJwe3G/k5/UWFfY+vEkCdKvKNCK7Oh3fFKgMUa87lw=", - "owner": "librephoenix", + "lastModified": 1619935377, + "narHash": "sha256-+HI8P0/LI8gdiCD7OiPKTAtLKrPt0REnQ+6oblHSHzU=", + "owner": "lepisma", "repo": "org-krita", - "rev": "6b85cf06f17dfcf9daeb6e045caea6df882bc4ff", + "rev": "7e334951b8de8f2f1c8cbe5068e7dfe6b9e9808f", "type": "github" }, "original": { - "owner": "librephoenix", + "owner": "lepisma", "repo": "org-krita", "type": "github" } @@ -805,22 +805,6 @@ "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": { @@ -934,7 +918,6 @@ "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 13250d4..3386aba 100644 --- a/flake.nix +++ b/flake.nix @@ -1,7 +1,10 @@ { description = "Flake of LibrePhoenix"; - outputs = inputs@{ self, ... }: + 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, ... }: let # ---- SYSTEM SETTINGS ---- # systemSettings = { @@ -48,9 +51,9 @@ # create patched nixpkgs nixpkgs-patched = - (import inputs.nixpkgs { system = systemSettings.system; }).applyPatches { + (import nixpkgs { system = systemSettings.system; }).applyPatches { name = "nixpkgs-patched"; - src = inputs.nixpkgs; + src = nixpkgs; patches = [ ./patches/emacs-no-version-check.patch ]; }; @@ -67,10 +70,10 @@ allowUnfree = true; allowUnfreePredicate = (_: true); }; - overlays = [ inputs.rust-overlay.overlays.default ]; + overlays = [ rust-overlay.overlays.default ]; })); - pkgs-stable = import inputs.nixpkgs-stable { + pkgs-stable = import nixpkgs-stable { system = systemSettings.system; config = { allowUnfree = true; @@ -78,11 +81,11 @@ }; }; - pkgs-emacs = import inputs.emacs-pin-nixpkgs { + pkgs-emacs = import emacs-pin-nixpkgs { system = systemSettings.system; }; - pkgs-kdenlive = import inputs.kdenlive-pin-nixpkgs { + pkgs-kdenlive = import kdenlive-pin-nixpkgs { system = systemSettings.system; }; @@ -91,17 +94,17 @@ # otherwise use patched nixos-unstable nixpkgs lib = (if ((systemSettings.profile == "homelab") || (systemSettings.profile == "worklab")) then - inputs.nixpkgs-stable.lib + nixpkgs-stable.lib else - inputs.nixpkgs.lib); + 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 - inputs.home-manager-stable + home-manager-stable else - inputs.home-manager-unstable); + home-manager-unstable); # Systems that can run tests: supportedSystems = [ "aarch64-linux" "i686-linux" "x86_64-linux" ]; @@ -120,6 +123,7 @@ 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 @@ -128,7 +132,16 @@ inherit pkgs-kdenlive; inherit systemSettings; inherit userSettings; - inherit inputs; + 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) phscroll; + inherit (inputs) mini-frame; + #inherit (inputs) nix-flatpak; + inherit (inputs) stylix; }; }; }; @@ -144,7 +157,8 @@ inherit pkgs-stable; inherit systemSettings; inherit userSettings; - inherit inputs; + inherit (inputs) stylix; + inherit (inputs) blocklist-hosts; }; }; }; @@ -215,11 +229,7 @@ flake = false; }; org-krita = { - url = "github:librephoenix/org-krita"; - flake = false; - }; - org-sliced-images = { - url = "github:jcfk/org-sliced-images"; + url = "github:lepisma/org-krita"; flake = false; }; phscroll = { diff --git a/profiles/work/home.nix b/profiles/work/home.nix index 16259ee..f99c628 100644 --- a/profiles/work/home.nix +++ b/profiles/work/home.nix @@ -1,4 +1,4 @@ -{ config, pkgs, pkgs-kdenlive, userSettings, ... }: +{ config, pkgs, pkgs-kdenlive, nix-doom-emacs, stylix, userSettings, ... }: { # Home Manager needs a bit of information about you and the paths it should @@ -9,6 +9,8 @@ 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 @@ -97,7 +99,6 @@ blender-hip cura curaengine_stable - openscad (stdenv.mkDerivation { name = "cura-slicer"; version = "0.0.7"; @@ -140,7 +141,6 @@ texinfo libffi zlib nodePackages.ungit - ventoy ]) ++ ([ pkgs-kdenlive.kdenlive ]); services.syncthing.enable = true; diff --git a/profiles/wsl/home.nix b/profiles/wsl/home.nix index 7fb8ee7..794d7e1 100644 --- a/profiles/wsl/home.nix +++ b/profiles/wsl/home.nix @@ -1,4 +1,4 @@ -{ config, pkgs, userSettings, ... }: +{ config, pkgs, nix-doom-emacs, stylix, userSettings, ... }: { # Home Manager needs a bit of information about you and the paths it should @@ -9,6 +9,8 @@ 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 0653a09..c7d2792 100644 --- a/system/security/blocklist.nix +++ b/system/security/blocklist.nix @@ -1,6 +1,6 @@ -{ inputs, ... }: +{ blocklist-hosts, ... }: -let blocklist = builtins.readFile "${inputs.blocklist-hosts}/alternates/gambling-porn/hosts"; +let blocklist = builtins.readFile "${blocklist-hosts}/alternates/gambling-porn/hosts"; in { networking.extraHosts = '' diff --git a/system/style/stylix.nix b/system/style/stylix.nix index 7b7bf6b..d8fe483 100644 --- a/system/style/stylix.nix +++ b/system/style/stylix.nix @@ -1,4 +1,4 @@ -{ lib, pkgs, inputs, userSettings, ... }: +{ lib, pkgs, stylix, userSettings, ... }: let themePath = "../../../themes/"+userSettings.theme+"/"+userSettings.theme+".yaml"; @@ -8,7 +8,7 @@ let backgroundSha256 = builtins.readFile (./. + "../../../themes/"+("/"+userSettings.theme)+"/backgroundsha256.txt"); in { - imports = [ inputs.stylix.nixosModules.stylix ]; + imports = [ stylix.nixosModules.stylix ]; stylix.autoEnable = false; stylix.polarity = themePolarity; diff --git a/user/app/doom-emacs/config.el b/user/app/doom-emacs/config.el index c83e31c..2779572 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) +(setq-default line-spacing 0.15) ; Automatic table of contents is nice (if (require 'toc-org nil t) @@ -437,8 +437,26 @@ 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) -(setq org-krita-extract-filename "preview.png") -(setq org-krita-scale 1) + +(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)))) (defun org-copy-link-to-clipboard-at-point () "Copy current link at point into clipboard (useful for images and links)" @@ -464,12 +482,6 @@ same directory as the org-buffer and insert a link to this file." :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 4add4e2..1df0023 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, inputs, userSettings, systemSettings, ... }: +{ config, lib, pkgs-emacs, pkgs-stable, userSettings, systemSettings, + org-nursery, org-yaap, org-side-tree, org-timeblock, org-krita, phscroll, mini-frame, ... }: 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,26 @@ in }; home.file.".emacs.d/org-yaap" = { - source = "${inputs.org-yaap}"; + source = "${org-yaap}"; recursive = true; }; home.file.".emacs.d/org-side-tree" = { - source = "${inputs.org-side-tree}"; + source = "${org-side-tree}"; recursive = true; }; home.file.".emacs.d/org-timeblock" = { - source = "${inputs.org-timeblock}"; + source = "${org-timeblock}"; recursive = true; }; home.file.".emacs.d/org-nursery" = { - source = "${inputs.org-nursery}"; + source = "${org-nursery}"; }; home.file.".emacs.d/org-krita" = { - source = "${inputs.org-krita}"; - }; - - home.file.".emacs.d/org-sliced-images" = { - source = "${inputs.org-sliced-images}"; + source = "${org-krita}"; }; home.file.".emacs.d/dashboard-logo.png".source = dashboardLogo; @@ -112,11 +108,11 @@ in }; home.file.".emacs.d/phscroll" = { - source = "${inputs.phscroll}"; + source = "${phscroll}"; }; home.file.".emacs.d/mini-frame" = { - source = "${inputs.mini-frame}"; + source = "${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 54a4fea..38d81f1 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) +(setq-default line-spacing 0.15) ; Automatic table of contents is nice (if (require 'toc-org nil t) @@ -514,8 +514,26 @@ 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) -(setq org-krita-extract-filename "preview.png") -(setq org-krita-scale 1) + +(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)))) #+END_SRC *** Copy Links/Files into Clipboard @@ -569,14 +587,6 @@ 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 @@ -1983,14 +1993,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, inputs, userSettings, systemSettings, ... }: +{ config, lib, pkgs-emacs, pkgs-stable, userSettings, systemSettings, + org-nursery, org-yaap, org-side-tree, org-timeblock, org-krita, phscroll, mini-frame, ... }: 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 +2074,26 @@ in }; home.file.".emacs.d/org-yaap" = { - source = "${inputs.org-yaap}"; + source = "${org-yaap}"; recursive = true; }; home.file.".emacs.d/org-side-tree" = { - source = "${inputs.org-side-tree}"; + source = "${org-side-tree}"; recursive = true; }; home.file.".emacs.d/org-timeblock" = { - source = "${inputs.org-timeblock}"; + source = "${org-timeblock}"; recursive = true; }; home.file.".emacs.d/org-nursery" = { - source = "${inputs.org-nursery}"; + source = "${org-nursery}"; }; home.file.".emacs.d/org-krita" = { - source = "${inputs.org-krita}"; - }; - - home.file.".emacs.d/org-sliced-images" = { - source = "${inputs.org-sliced-images}"; + source = "${org-krita}"; }; home.file.".emacs.d/dashboard-logo.png".source = dashboardLogo; @@ -2097,11 +2103,11 @@ in }; home.file.".emacs.d/phscroll" = { - source = "${inputs.phscroll}"; + source = "${phscroll}"; }; home.file.".emacs.d/mini-frame" = { - source = "${inputs.mini-frame}"; + source = "${mini-frame}"; }; home.file.".emacs.d/system-vars.el".text = '' diff --git a/user/app/ranger/rc.conf b/user/app/ranger/rc.conf index 6a8cdfa..c196c0d 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 0 +set preview_max_size 200000000 # The key hint lists up to this size have their sublists expanded. # Otherwise the submaps are replaced with "...". diff --git a/user/app/ranger/rifle.conf b/user/app/ranger/rifle.conf index e637fe0..3239a03 100644 --- a/user/app/ranger/rifle.conf +++ b/user/app/ranger/rifle.conf @@ -75,18 +75,8 @@ ext nes, has fceux, X = fceux "$1" #ext exe = wine "$1" name ^[mM]akefile$ = make -#------------------------------------------ -# 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 +#----------- FL STUDIO -------------- +ext flp = flstudio "$@" & &>/dev/null #-------------------------------------------- # Scripts @@ -222,6 +212,11 @@ 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" diff --git a/user/app/ranger/scope.sh b/user/app/ranger/scope.sh index 005469d..d58637e 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 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;; + ## 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;; - # 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,42 +265,29 @@ handle_image() { # ;; esac - openscad_image() { - TMPPNG="$(mktemp -t XXXXXXXXXX --suffix '.png')" - openscad --colorscheme="${OPENSCAD_COLORSCHEME}" \ - --imgsize="${OPENSCAD_IMGSIZE/x/,}" \ - -o "${TMPPNG}" "${1}" - mv "${TMPPNG}" "${IMAGE_CACHE_PATH}" - } + # openscad_image() { + # TMPPNG="$(mktemp -t xxxxxx.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 - ;; - stl) - openscad_image <(echo "import(\"${FULL_FILE_PATH}\");") && exit 6 - ;; - 3mf|amf|dxf|off|stl) - openscad_image <(echo "import(\"${FULL_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 + # ;; + # 3mf|amf|dxf|off|stl) + # openscad_image <(echo "import(\"${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/blockbench.nix b/user/pkgs/blockbench.nix new file mode 100644 index 0000000..4f852ae --- /dev/null +++ b/user/pkgs/blockbench.nix @@ -0,0 +1,58 @@ +{ 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 new file mode 100644 index 0000000..6ee0ea3 --- /dev/null +++ b/user/pkgs/impressive.nix @@ -0,0 +1,45 @@ +# 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 new file mode 100644 index 0000000..5fb86ef --- /dev/null +++ b/user/pkgs/pokefinder.nix @@ -0,0 +1,32 @@ +# 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/ranger.nix b/user/pkgs/ranger.nix index 4a56abb..5f579c7 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.bat}/bin/bat'" + --replace "DEFAULT_PAGER = 'less'" "DEFAULT_PAGER = '${lib.getBin pkgs.less}/bin/less'" # give image previews out of the box when building with w3m substituteInPlace ranger/config/rc.conf \ @@ -28,10 +28,5 @@ } ) ]; - home.packages = with pkgs; [ - poppler_utils - librsvg - ffmpegthumbnailer - ]; } diff --git a/user/pkgs/smartcalc.nix b/user/pkgs/smartcalc.nix new file mode 100644 index 0000000..8258f2a --- /dev/null +++ b/user/pkgs/smartcalc.nix @@ -0,0 +1,27 @@ +{ 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 f753928..468feed 100644 --- a/user/shell/cli-collection.nix +++ b/user/shell/cli-collection.nix @@ -1,4 +1,5 @@ { pkgs, ... }: + { # Collection of useful CLI apps home.packages = with pkgs; [ @@ -14,12 +15,16 @@ bat eza fd bottom ripgrep rsync unzip + tmux w3m pandoc hwinfo pciutils numbat - (pkgs.callPackage ../pkgs/pokemon-colorscripts.nix { }) + (pkgs.callPackage ../pkgs/smartcalc.nix { }) + #(pkgs.writeShellScriptBin "sc" ''smartcalc'') + #(pkgs.callPackage ../pkgs/pokemon-colorscripts.nix { }) + #(pkgs.python3Packages.callPackage ../pkgs/impressive.nix { }) (pkgs.writeShellScriptBin "airplane-mode" '' #!/bin/sh connectivity="$(nmcli n connectivity)" diff --git a/user/style/stylix.nix b/user/style/stylix.nix index c7d65d0..1fe5de0 100644 --- a/user/style/stylix.nix +++ b/user/style/stylix.nix @@ -1,4 +1,4 @@ -{ config, lib, pkgs, inputs, userSettings, ... }: +{ config, lib, pkgs, userSettings, ... }: let themePath = "../../../themes"+("/"+userSettings.theme+"/"+userSettings.theme)+".yaml"; @@ -7,9 +7,6 @@ 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;