Refactor packages

Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
2025-02-23 23:52:29 +00:00
parent 3360e7f8c3
commit 0ae8128304
108 changed files with 11012 additions and 3025 deletions

View File

@@ -0,0 +1,12 @@
{ pkgs, ... }:
{
nixpkgs.overlays = [
(final: prev: {
nix-update = prev.nix-update.overrideAttrs (oldAttrs: {
patches = oldAttrs.patches or [ ] ++ [ ./source-attribute.patch ];
});
})
];
environment.systemPackages = with pkgs; [ nix-update ];
}

View File

@@ -0,0 +1,127 @@
diff --git a/nix_update/__init__.py b/nix_update/__init__.py
index 89bbe45..93f9322 100644
--- a/nix_update/__init__.py
+++ b/nix_update/__init__.py
@@ -124,6 +124,12 @@ def parse_args(args: list[str]) -> Options:
default=[],
)
+ parser.add_argument(
+ "--src-attr",
+ help="Src attribute",
+ default="src",
+ )
+
a = parser.parse_args(args)
extra_flags = ["--extra-experimental-features", "flakes nix-command"]
if a.system:
@@ -146,6 +152,7 @@ def parse_args(args: list[str]) -> Options:
version=a.version,
version_preference=VersionPreference.from_str(a.version),
attribute=a.attribute,
+ source_attribute=a.src_attr,
test=a.test,
version_regex=a.version_regex,
review=a.review,
diff --git a/nix_update/eval.py b/nix_update/eval.py
index 1767056..f85ea69 100644
--- a/nix_update/eval.py
+++ b/nix_update/eval.py
@@ -105,12 +105,19 @@ class Package:
def eval_expression(
escaped_import_path: str,
attr: str,
+ source_attr: str,
flake: bool,
system: str | None,
override_filename: str | None,
) -> str:
system = f'"{system}"' if system else "builtins.currentSystem"
+ source_attrs = source_attr.rpartition(".")
+ source_attr_last = source_attrs[-1] or source_attr
+ source_attr_all_but_last = (
+ f".{source_attrs[0]}" if source_attr_last != source_attr else ""
+ )
+
if flake:
sanitize_position = (
f"""
@@ -164,8 +171,8 @@ let
raw_version_position
else if pkg ? isPhpExtension then
raw_version_position
- else if (builtins.unsafeGetAttrPos "src" pkg) != null then
- sanitizePosition (builtins.unsafeGetAttrPos "src" pkg)
+ else if (builtins.unsafeGetAttrPos "{source_attr_last}" pkg) != null then
+ sanitizePosition (builtins.unsafeGetAttrPos "{source_attr_last}" pkg{source_attr_all_but_last})
else
sanitizePosition (positionFromMeta pkg);
in {{
@@ -174,11 +181,11 @@ in {{
inherit raw_version_position;
filename = position.file;
line = position.line;
- urls = pkg.src.urls or null;
- url = pkg.src.url or null;
- rev = pkg.src.rev or null;
- tag = pkg.src.tag or null;
- hash = pkg.src.outputHash or null;
+ urls = pkg.{source_attr}.urls or null;
+ url = pkg.{source_attr}.url or null;
+ rev = pkg.{source_attr}.rev or null;
+ tag = pkg.{source_attr}.tag or null;
+ hash = pkg.{source_attr}.outputHash or null;
go_modules = pkg.goModules.outputHash or null;
go_modules_old = pkg.go-modules.outputHash or null;
cargo_deps = pkg.cargoDeps.outputHash or null;
@@ -205,7 +212,7 @@ in {{
mix_deps = pkg.mixFodDeps.outputHash or null;
tests = builtins.attrNames (pkg.passthru.tests or {{}});
has_update_script = {has_update_script};
- src_homepage = pkg.src.meta.homepage or null;
+ src_homepage = pkg.{source_attr}.meta.homepage or null;
changelog = pkg.meta.changelog or null;
maintainers = pkg.meta.maintainers or null;
}}"""
@@ -215,6 +222,7 @@ def eval_attr(opts: Options) -> Package:
expr = eval_expression(
opts.escaped_import_path,
opts.escaped_attribute,
+ opts.source_attribute,
opts.flake,
opts.system,
opts.override_filename,
diff --git a/nix_update/options.py b/nix_update/options.py
index 2d07b77..ab5c305 100644
--- a/nix_update/options.py
+++ b/nix_update/options.py
@@ -8,6 +8,7 @@ from .version.version import VersionPreference
@dataclass
class Options:
attribute: str
+ source_attribute: str = "src"
flake: bool = False
version: str = "stable"
version_preference: VersionPreference = VersionPreference.STABLE
@@ -33,4 +34,7 @@ class Options:
def __post_init__(self) -> None:
self.escaped_attribute = ".".join(map(json.dumps, self.attribute.split(".")))
+ self.escaped_source_attribute = ".".join(
+ map(json.dumps, self.source_attribute.split("."))
+ )
self.escaped_import_path = json.dumps(self.import_path)
diff --git a/nix_update/update.py b/nix_update/update.py
index 82b7bc5..464bf3d 100644
--- a/nix_update/update.py
+++ b/nix_update/update.py
@@ -155,7 +155,7 @@ def git_prefetch(x: tuple[str, tuple[str, str]]) -> tuple[str, str]:
def update_src_hash(opts: Options, filename: str, current_hash: str) -> None:
- target_hash = nix_prefetch(opts, "src")
+ target_hash = nix_prefetch(opts, opts.source_attribute)
replace_hash(filename, current_hash, target_hash)

View File

@@ -14,10 +14,13 @@
];
};
registry.self.flake = inputs.self;
channel.enable = false;
gc.automatic = true;
optimise.automatic = true;
registry.self.flake = inputs.self;
extraOptions = ''
!include ${config.sops.secrets."nix/accessTokens/github".path}
'';

View File

@@ -9,7 +9,12 @@
environment = {
persistence."/persist"."/etc/ssh/ssh_host_ed25519_key" = { };
systemPackages = with pkgs; [ sops ];
systemPackages = with pkgs; [
sops
age
ssh-to-age
];
};
sops.age = {

View File

@@ -7,8 +7,12 @@
lib,
pkgs,
inputs,
system,
...
}:
let
hmConfig = config.home-manager.users.${user};
in
{
home-manager.users.${user} = {
imports = [ inputs.ags.homeManagerModules.default ];
@@ -19,12 +23,15 @@
systemd.enable = true;
extraPackages = with pkgs; [
inputs.ags.packages.${pkgs.system}.hyprland
inputs.ags.packages.${pkgs.system}.tray
inputs.ags.packages.${system}.hyprland
inputs.ags.packages.${system}.tray
sassc
hyprland
nixos-icons
(pkgs.callPackage ../cliphist/rofi.nix { })
(import ../cliphist/rofi.nix {
rofi = hmConfig.programs.rofi.finalPackage;
inherit lib pkgs;
})
];
};

View File

@@ -43,12 +43,13 @@ in
finalPackage = mkOption {
type = package;
description = "The clipbook rofi package.";
default = pkgs.callPackage ./rofi.nix {
default = import ./rofi.nix {
rofi = config.programs.rofi.finalPackage;
bookmarks = builtins.mapAttrs (_: bookmark: {
type = if bookmark.source != null then "file" else "text";
content = if bookmark.source != null then bookmark.source else bookmark.text;
}) cfg.bookmarks;
inherit lib pkgs;
};
readOnly = true;
};

View File

@@ -70,7 +70,10 @@ in
wayland.windowManager.hyprland.settings.bind =
let
cliphist-rofi = lib.meta.getExe (
pkgs.callPackage ./rofi.nix { rofi = hmConfig.programs.rofi.finalPackage; }
import ./rofi.nix {
rofi = hmConfig.programs.rofi.finalPackage;
inherit pkgs lib;
}
);
cliphist = lib.meta.getExe pkgs.cliphist;
in

View File

@@ -2,8 +2,15 @@
user ? throw "user argument is required",
home ? throw "home argument is required",
}:
{ config, pkgs, ... }:
{
config,
inputs,
pkgs,
system,
...
}:
let
selfPkgs = inputs.self.packages.${system};
hmConfig = config.home-manager.users.${user};
in
{
@@ -23,71 +30,60 @@ in
"/cache"."${home}/.cache/darktable" = { };
};
home-manager.users.${user} =
let
lua-scripts = pkgs.fetchFromGitHub {
owner = "darktable-org";
repo = "lua-scripts";
rev = "daa0877b4c25b91e4b71afc1ef8ffcba6018f7b2";
hash = "sha256-NNGAq1zgKqWLhKBPgm7kFZq4xwvescxnCAwovSF9r4k=";
};
hald-clut = pkgs.fetchFromGitHub {
owner = "cedeber";
repo = "hald-clut";
rev = "3b3180f82d4dcea1e6e8c5648473539a910d7f49";
hash = "sha256-R8vyYmcsfk49QsSV3v0QblXcO6U0oIfDyxbHPLwSMdo=";
};
in
{
home = {
packages = with pkgs; [
home-manager.users.${user} = {
home = {
packages =
with pkgs;
with selfPkgs;
[
darktable
exiftool
(pkgs.callPackage ./publish { })
darktable-ghost-cms-publish
];
sessionVariables = {
GHOST_URL = "https://photos.karaolidis.com";
GHOST_ADMIN_API_KEY_PATH = hmConfig.sops.secrets."jupiter/photos.karaolidis.com/admin".path;
};
sessionVariables = {
GHOST_URL = "https://photos.karaolidis.com";
GHOST_ADMIN_API_KEY_PATH = hmConfig.sops.secrets."jupiter/photos.karaolidis.com/admin".path;
};
xdg.configFile = {
"darktable/darktablerc".source = (pkgs.formats.keyValue { }).generate "darktablerc" {
"compress_xmp_tags" = "never";
"database/create_snapshot" = "once a day";
"rating_one_double_tap" = true;
"run_crawler_on_start" = true;
"ui_last/theme" = "darktable-elegant-darker";
"ui_last/grouping" = true;
"plugins/darkroom/lut3d/def_path" = "${home}/.config/darktable/luts";
"opencl" = false;
"plugins/lighttable/overlays/1/0" = 0;
"plugins/lighttable/overlays/1/1" = 3;
"plugins/lighttable/overlays/1/2" = 3;
"plugins/darkroom/modulegroups/last_preset" = "modules: all";
"session/base_directory_pattern" = "${home}/Pictures/Darktable";
"session/filename_pattern" =
"$(EXIF.YEAR)-$(EXIF.MONTH)-$(EXIF.DAY)_$(EXIF.HOUR)-$(EXIF.MINUTE)-$(EXIF.SECOND)_$(CONFLICT_PADDING).$(FILE_EXTENSION)";
"session/sub_directory_pattern" = "";
"setup_import_directory" = true;
"lua/script_manager/check_update" = false;
};
"darktable/luarc".text = ''
require "tools/script_manager"
require "tools/publish"
'';
"darktable/lua/lib".source = "${lua-scripts}/lib";
"darktable/lua/tools/script_manager.lua".source = "${lua-scripts}/tools/script_manager.lua";
"darktable/lua/tools/publish.lua".source = ./publish/publish.lua;
"darktable/luts".source = "${hald-clut}/HaldCLUT";
};
sops.secrets."jupiter/photos.karaolidis.com/admin".sopsFile =
../../../../../../secrets/personal/secrets.yaml;
};
xdg.configFile = {
"darktable/darktablerc".source = (pkgs.formats.keyValue { }).generate "darktablerc" {
"compress_xmp_tags" = "never";
"database/create_snapshot" = "once a day";
"rating_one_double_tap" = true;
"run_crawler_on_start" = true;
"ui_last/theme" = "darktable-elegant-darker";
"ui_last/grouping" = true;
"plugins/darkroom/lut3d/def_path" = "${home}/.config/darktable/luts";
"opencl" = false;
"plugins/lighttable/overlays/1/0" = 0;
"plugins/lighttable/overlays/1/1" = 3;
"plugins/lighttable/overlays/1/2" = 3;
"plugins/darkroom/modulegroups/last_preset" = "modules: all";
"session/base_directory_pattern" = "${home}/Pictures/Darktable";
"session/filename_pattern" =
"$(EXIF.YEAR)-$(EXIF.MONTH)-$(EXIF.DAY)_$(EXIF.HOUR)-$(EXIF.MINUTE)-$(EXIF.SECOND)_$(CONFLICT_PADDING).$(FILE_EXTENSION)";
"session/sub_directory_pattern" = "";
"setup_import_directory" = true;
"lua/script_manager/check_update" = false;
};
"darktable/luarc".text = ''
require "tools/script_manager"
require "tools/publish"
'';
"darktable/lua/lib".source = "${selfPkgs.darktable-lua-scripts}/lib";
"darktable/lua/tools/script_manager.lua".source =
"${selfPkgs.darktable-lua-scripts}/tools/script_manager.lua";
"darktable/lua/tools/publish.lua".source =
"${selfPkgs.darktable-ghost-cms-publish}/lib/darktable-ghost-cms-publish/publish.lua";
"darktable/luts".source = selfPkgs.darktable-hald-clut;
};
sops.secrets."jupiter/photos.karaolidis.com/admin".sopsFile =
../../../../../../secrets/personal/secrets.yaml;
};
}

View File

@@ -1,2 +0,0 @@
node_modules/
build/

View File

@@ -1,29 +0,0 @@
{ pkgs, lib, ... }:
pkgs.stdenv.mkDerivation rec {
pname = "darktable-publish";
version = "1.0.0";
src = ./.;
npmSrc = pkgs.buildNpmPackage ({
inherit src pname version;
npmDepsHash = "sha256-vBJIIuryC/zRvp9oKBVuCDTycPOpzgsLebU55CiIb7I=";
dontNpmBuild = true;
installPhase = ''
cp -r . $out
'';
});
# FIXME: https://github.com/NixOS/nixpkgs/issues/255890
wrapper = pkgs.writeShellApplication {
name = pname;
runtimeInputs = with pkgs; [ bun ];
text = ''
bun ${npmSrc}/src/index.ts "$@"
'';
};
installPhase = ''
mkdir -p $out/bin
cp ${lib.meta.getExe wrapper} $out/bin/
'';
}

View File

@@ -1,11 +0,0 @@
import globals from "globals";
import pluginJs from "@eslint/js";
import tseslint from "typescript-eslint";
/** @type {import('eslint').Linter.Config[]} */
export default [
{ files: ["**/*.{js,mjs,cjs,ts}"] },
{ languageOptions: { globals: globals.browser } },
pluginJs.configs.recommended,
...tseslint.configs.recommended,
];

File diff suppressed because it is too large Load Diff

View File

@@ -1,24 +0,0 @@
{
"name": "publish",
"module": "src/index.ts",
"type": "module",
"devDependencies": {
"@eslint/js": "^9.17.0",
"@types/bun": "latest",
"@types/jsonwebtoken": "^9.0.7",
"eslint": "^9.17.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-prettier": "^5.2.1",
"globals": "^15.14.0",
"prettier": "^3.4.2",
"typescript-eslint": "^8.18.1"
},
"peerDependencies": {
"typescript": "^5.0.0"
},
"dependencies": {
"commander": "^12.1.0",
"exiftool-vendored": "^29.0.0",
"jsonwebtoken": "^9.0.2"
}
}

View File

@@ -1,133 +0,0 @@
local dt = require "darktable"
local df = require "lib/dtutils.file"
local os = require "os"
-- Some fucking bullshit happening right here.
function os.capture(command, raw)
local f = assert(io.popen(command, 'r'))
local s = assert(f:read('*a'))
f:close()
if raw then return s end
s = string.gsub(s, '^%s+', '')
s = string.gsub(s, '%s+$', '')
s = string.gsub(s, '[\n\r]+', ' ')
return s
end
local publish_title = dt.new_widget("entry") {
placeholder = "Post Title",
tooltip = "enter title for the post"
}
local publish_slug = dt.new_widget("entry") {
placeholder = "post-slug",
tooltip = "enter slug for the post (URL-friendly)"
}
local publish_keywords = dt.new_widget("entry") {
placeholder = "keywords (space-separated)",
tooltip = "enter keywords (tags) for the post"
}
local strip_gps_checkbox = dt.new_widget("check_button") {
label = "Strip GPS data",
value = false,
tooltip = "remove GPS metadata from files before uploading"
}
local widget = dt.new_widget("box") {
orientation = "vertical",
publish_title,
publish_slug,
publish_keywords,
strip_gps_checkbox
}
local function initialize(_, _, images, _, extra_data)
extra_data.exported_files = {}
extra_data.cleanup_files = {}
if publish_title.text == "" then
extra_data.title = df.get_basename(images[1].filename)
else
extra_data.title = publish_title.text
end
if publish_slug.text == "" then
extra_data.slug = df.get_basename(images[1].filename)
else
extra_data.slug = publish_slug.text
end
extra_data.keywords = publish_keywords.text
extra_data.strip_gps = strip_gps_checkbox.value
return images
end
local function store(_, image, _, filename, _, _, _, extra_data)
if extra_data.strip_gps then
local command = string.format("exiftool -gps:all= -overwrite_original '%s'", filename)
os.execute(command)
end
if image.is_raw then
local original_path = image.path .. "/" .. image.filename
local raw_filename = original_path
if extra_data.strip_gps then
local tmpfile = os.tmpname()
local command = string.format("exiftool -gps:all= -o '%s' '%s'", tmpfile, original_path)
os.execute(command)
table.insert(extra_data.cleanup_files, tmpfile)
raw_filename = tmpfile
end
table.insert(extra_data.exported_files, filename .. ":" .. raw_filename)
else
table.insert(extra_data.exported_files, filename)
end
end
local function finalize(_, _, extra_data)
local files_arg = table.concat(extra_data.exported_files, " ")
local command = string.format(
"darktable-publish --title '%s' --slug '%s' %s",
extra_data.title, extra_data.slug, files_arg
)
if extra_data.keywords ~= "" then
command = command .. string.format(" --keywords %s", extra_data.keywords)
end
-- Ignore that I use an external tool (written in JavaScript god forbid)
-- I am _not_ doing JSON generation and web requests in Lua
local result = os.capture(command)
if result and result:match("^http") then
dt.print("Post published: " .. result)
else
dt.print("Failed to publish post.")
end
local command = string.format("xdg-open %s", result)
os.execute(command)
for _, tmpfile in ipairs(extra_data.cleanup_files) do
os.remove(tmpfile)
end
end
local function supported(_, _)
return true
end
dt.register_storage(
"ghost_publish",
"publish to Ghost CMS",
store,
finalize,
supported,
initialize,
widget
)

View File

@@ -1,110 +0,0 @@
import { sign } from "jsonwebtoken";
import { file } from "bun";
const getAdminApiKey = async () => {
const keyPath = process.env.GHOST_ADMIN_API_KEY_PATH;
if (!keyPath) {
throw new Error(
"Environment variable GHOST_ADMIN_API_KEY_PATH is not set.",
);
}
const keyFile = file(keyPath);
if (!(await keyFile.exists())) {
throw new Error(`Key file not found at path: ${keyPath}`);
}
return await keyFile.text();
};
const getEndpoint = () => {
const endpoint = process.env.GHOST_URL;
if (!endpoint) {
throw new Error("Environment variable GHOST_URL is not set.");
}
return endpoint;
};
const createJwt = (key: string) => {
const [id, secret] = key.split(":");
if (!id || !secret) {
throw new Error("Invalid API key format. Expected format: {id}:{secret}");
}
return sign({}, Buffer.from(secret, "hex"), {
keyid: id,
algorithm: "HS256",
expiresIn: "5m",
audience: `/admin/`,
});
};
const upload = async (
slug: string,
path: string,
type: string | undefined,
): Promise<any> => {
const endpoint = getEndpoint();
const fullEndpoint = `${endpoint}${slug}`;
const key = await getAdminApiKey();
const token = createJwt(key);
const f = Bun.file(path, { type });
const formData = new FormData();
formData.append("file", f);
const response = await fetch(fullEndpoint, {
method: "POST",
headers: {
Authorization: `Ghost ${token}`,
},
body: formData,
});
if (!response.ok) {
throw new Error(
`Failed to upload to ${fullEndpoint}: ${response.status} ${response.statusText}`,
);
}
return await response.json();
};
export const uploadImage = async (imagePath: string): Promise<string> => {
const slug = `/ghost/api/admin/images/upload`;
return (await upload(slug, imagePath, "image/jpeg")).images[0].url;
};
export const uploadFile = async (filePath: string): Promise<string> => {
const slug = `/ghost/api/admin/files/upload`;
return (await upload(slug, filePath, undefined)).files[0].url;
};
export const uploadPost = async (post: any): Promise<string> => {
const endpoint = getEndpoint();
const fullEndpoint = `${endpoint}/ghost/api/admin/posts`;
const key = await getAdminApiKey();
const token = createJwt(key);
const response = await fetch(fullEndpoint, {
method: "POST",
headers: {
Authorization: `Ghost ${token}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
posts: [post],
}),
});
if (!response.ok) {
throw new Error(
`Failed to upload to ${fullEndpoint}: ${response.status} ${response.statusText}`,
);
}
return (await response.json()).posts[0].url;
};

View File

@@ -1,48 +0,0 @@
import { exiftool } from "exiftool-vendored";
import type { FileInfo } from "./files";
export interface ShootingConditions {
make: string;
model: string;
lensMake: string;
lensModel: string;
focalLength: string;
focalLength35: string;
shutterSpeed: string;
fStop: string;
iso: string;
timestamp: string;
}
export const extractShootingConditions = async (
fileInfo: FileInfo,
): Promise<ShootingConditions> => {
const path = fileInfo.rawPath ?? fileInfo.jpegPath;
try {
const exifData = await exiftool.read(path);
return {
make: exifData.Make ?? "Unknown",
model: exifData.Model ?? "Unknown",
lensMake: exifData.LensMake ?? "Unknown",
lensModel: exifData.LensModel ?? "Unknown",
focalLength: exifData.FocalLength ?? "Unknown",
focalLength35: exifData.FocalLengthIn35mmFormat ?? "Unknown",
shutterSpeed: exifData.ExposureTime ?? "Unknown",
fStop: exifData.FNumber?.toString() ?? "Unknown",
iso: exifData.ISO?.toString() ?? "Unknown",
timestamp: new Date(
(exifData.CreateDate?.toString() as string).replace(/\./g, ":"),
).toISOString(),
};
} catch (error: any) {
throw new Error(
`Failed to extract EXIF data from ${path}: ${error.message}`,
);
}
};
export const createImageCaption = (exif: ShootingConditions) => {
return `${exif.make} ${exif.model}, ${exif.lensMake} ${exif.lensModel} @ ${exif.focalLength} (${exif.focalLength35}), ${exif.shutterSpeed} s, f/${exif.fStop}, ISO ${exif.iso}`;
};

View File

@@ -1,66 +0,0 @@
import { basename, extname } from "path";
export interface FileInfo {
jpegPath: string;
jpegSize: number;
rawPath?: string;
rawSize?: number;
}
export const getBasenameWithoutExtension = (path: string): string => {
const base = basename(path);
const extension = extname(path);
return base.slice(0, -extension.length);
};
export const getBasenameWithExtension = (path: string): string => {
return basename(path);
};
export const prepareFiles = async (files: string[]): Promise<FileInfo[]> => {
if (files.length > 10) {
throw new Error("Up to 10 files are allowed at a time.");
}
const parsedFiles: FileInfo[] = [];
for (const pair of files) {
const parts = pair.split(/(?<!\\):/);
const jpegPath = parts[0].replace(/\\:/g, ":");
const rawPath = parts[1]?.replace(/\\:/g, ":");
const jpegFile = Bun.file(jpegPath);
if (!(await jpegFile.exists())) {
throw new Error(`JPEG file not found: ${jpegPath}`);
}
const jpegSize = jpegFile.size;
if (!rawPath) {
parsedFiles.push({
jpegPath,
jpegSize,
rawPath: undefined,
rawSize: undefined,
});
continue;
}
const rawFile = Bun.file(rawPath);
if (!(await rawFile.exists())) {
throw new Error(`RAW file not found: ${rawPath}`);
}
const rawSize = rawFile.size;
parsedFiles.push({
jpegPath,
jpegSize,
rawPath: rawPath,
rawSize: rawSize,
});
}
return parsedFiles;
};

View File

@@ -1,112 +0,0 @@
import { Command } from "commander";
import { createFileNode, createImageNode, createHeadingNode } from "./lexical";
import { extractShootingConditions, createImageCaption } from "./exif";
import { uploadFile, uploadImage, uploadPost } from "./api";
import { getBasenameWithExtension, prepareFiles } from "./files";
new Command()
.name("darktable-publish")
.description("Publish files to GHOST CMS with optional metadata.")
.option("-t, --title [string]", "Specify the title")
.option("-s, --slug [string]", "Specify the slug")
.option("-k, --keywords [string...]", "Specify blog post keywords (tags)")
.argument("<files...>", "Files to process")
.action(async (files, options) => {
if (!options.title) {
throw new Error("Please specify a title.");
}
if (!options.slug) {
throw new Error("Please specify a slug.");
}
const parsedFiles = await prepareFiles(files);
const [
shootingConditions,
uploadedJpegImages,
uploadedJpegFiles,
uploadedRawFiles,
] = await Promise.all([
Promise.all(parsedFiles.map(extractShootingConditions)),
Promise.all(parsedFiles.map((f) => uploadImage(f.jpegPath))),
Promise.all(parsedFiles.map((f) => uploadFile(f.jpegPath))),
Promise.all(
parsedFiles.map((f) =>
f.rawPath ? uploadFile(f.rawPath) : Promise.resolve(undefined),
),
),
]);
const aggregatedFiles = parsedFiles.map((file, index) => ({
...file,
shootingConditions: shootingConditions[index],
uploadedJpegImage: uploadedJpegImages[index],
uploadedJpegFile: uploadedJpegFiles[index],
uploadedRawFile: uploadedRawFiles[index],
}));
const result: any = {
root: {
children: [],
direction: "ltr",
format: "",
indent: 0,
type: "root",
version: 1,
},
};
if (aggregatedFiles.length > 1) {
aggregatedFiles.slice(1).forEach((file) =>
result.root.children.push(
createImageNode({
src: file.uploadedJpegImage,
caption: createImageCaption(file.shootingConditions),
}),
),
);
}
result.root.children.push(createHeadingNode("Downloads", "h2"));
aggregatedFiles.forEach((file) => {
result.root.children.push(
createFileNode({
src: file.uploadedJpegFile,
name: getBasenameWithExtension(file.jpegPath),
size: file.jpegSize,
}),
);
if (file.uploadedRawFile && file.rawPath && file.rawSize) {
result.root.children.push(
createFileNode({
src: file.uploadedRawFile,
name: getBasenameWithExtension(file.rawPath),
size: file.rawSize,
}),
);
}
});
const post = {
title: options.title,
slug: options.slug,
lexical: JSON.stringify(result),
feature_image: aggregatedFiles[0].uploadedJpegImage,
feature_image_caption: createImageCaption(
aggregatedFiles[0].shootingConditions,
),
status: "published",
visibility: "public",
tags: options.keywords,
published_at: aggregatedFiles[0].shootingConditions.timestamp,
};
const url = await uploadPost(post);
console.log(url);
process.exit(0);
})
.parse();

View File

@@ -1,50 +0,0 @@
export const createTextNode = (text: string) => ({
detail: 0,
format: 0,
mode: "normal",
style: "",
text,
type: "extended-text",
version: 1,
});
export const createHeadingNode = (text: string, level: string) => ({
children: [createTextNode(text)],
direction: "ltr",
format: "",
indent: 0,
type: "extended-heading",
version: 1,
tag: level,
});
export interface ImageInput {
src: string;
caption: string;
}
export const createImageNode = (image: ImageInput) => {
return {
type: "image",
version: 1,
cardWidth: "wide",
...image,
};
};
export interface FileInput {
src: string;
name: string;
size: number;
}
export const createFileNode = (file: FileInput) => {
return {
type: "file",
src: file.src,
fileTitle: file.name,
fileName: file.name,
fileCaption: "",
fileSize: file.size,
};
};

View File

@@ -1,24 +0,0 @@
{
"compilerOptions": {
// Enable latest features
"lib": ["ESNext", "DOM"],
"target": "ESNext",
"module": "ESNext",
"moduleDetection": "force",
"jsx": "react-jsx",
"allowJs": true,
// Bundler mode
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"verbatimModuleSyntax": true,
"noEmit": true,
// Best practices
"strict": true,
"skipLibCheck": true,
"noFallthroughCasesInSwitch": true,
// Some stricter flags (disabled by default)
"noUnusedLocals": false,
"noUnusedParameters": false,
"noPropertyAccessFromIndexSignature": false
}
}

View File

@@ -1,27 +0,0 @@
{ pkgs, ... }:
pkgs.buildNpmPackage rec {
pname = "obsidian.plugins.better-word-count";
version = "0.10.1";
src = pkgs.fetchFromGitHub {
owner = "karaolidis";
rev = "8ff00d7e9aed03d8cf38215b742a2a2251cc2ea2";
# owner = "lukeleppan";
repo = "better-word-count";
# rev = version;
hash = "sha256-wA0vycuUHr7icgAJ/d85j3bbwqlefXnSyRUXgCmqyOE=";
};
patches = [ ./package-lock.patch ];
makeCacheWritable = true;
npmDepsHash = "sha256-K+NGIKsSNzGHGcAofsl0WcNsTFt/y38zUdGUZL013xg=";
npmPackFlags = [ "--ignore-scripts" ];
installPhase = ''
mkdir -p $out
cp ./manifest.json $out/manifest.json
cp ./dist/main.js $out/main.js
cp ./src/styles.css $out/styles.css
'';
}

View File

@@ -1,35 +0,0 @@
diff --git a/package-lock.json b/package-lock.json
index 3fa99a5..71302ec 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -15,7 +15,7 @@
},
"devDependencies": {
"@codemirror/commands": "^6.1.2",
- "@codemirror/language": "https://github.com/lishid/cm-language",
+ "@codemirror/language": "https://github.com/karaolidis/cm-language#package-lock",
"@codemirror/search": "^6.2.2",
"@codemirror/state": "^6.1.2",
"@codemirror/view": "^6.4.0",
@@ -49,7 +49,7 @@
},
"node_modules/@codemirror/language": {
"version": "6.10.1",
- "resolved": "git+ssh://git@github.com/lishid/cm-language.git#2644bfc27afda707a7e1f3aedaf3ca7120f63cd9",
+ "resolved": "git+ssh://git@github.com/karaolidis/cm-language.git#d6238f0a9e17e20d604cee67a47d3a93b00dd41c",
"dev": true,
"dependencies": {
"@codemirror/state": "^6.0.0",
diff --git a/package.json b/package.json
index 2537f1e..ba6bfff 100644
--- a/package.json
+++ b/package.json
@@ -24,7 +24,7 @@
"license": "MIT",
"devDependencies": {
"@codemirror/commands": "^6.1.2",
- "@codemirror/language": "https://github.com/lishid/cm-language",
+ "@codemirror/language": "https://github.com/karaolidis/cm-language#package-lock",
"@codemirror/search": "^6.2.2",
"@codemirror/state": "^6.1.2",
"@codemirror/view": "^6.4.0",

View File

@@ -1,30 +0,0 @@
{ pkgs, ... }:
pkgs.stdenv.mkDerivation rec {
pname = "obsidian.plugins.custom-sort";
version = "3.1.2";
src = pkgs.fetchFromGitHub {
owner = "SebastianMC";
repo = "obsidian-custom-sort";
rev = version;
hash = "sha256-a6t0+mzzXQsgUwZ3m3UvF3N83ajGmxalsnD8beAVAr0=";
};
offlineCache = pkgs.fetchYarnDeps {
yarnLock = src + "/yarn.lock";
hash = "sha256-J/+LJWaco2QRwZx8Ry3G5DiJB6J21iOn5GBeY5EY4+g=";
};
nativeBuildInputs = with pkgs; [
nodejs
yarnConfigHook
yarnBuildHook
npmHooks.npmInstallHook
];
installPhase = ''
mkdir -p $out
cp ./manifest.json $out/manifest.json
cp ./dist/main.js $out/main.js
'';
}

View File

@@ -1,25 +0,0 @@
{ pkgs, ... }:
pkgs.buildNpmPackage rec {
pname = "obsidian.plugins.dataview";
version = "0.5.67";
src = pkgs.fetchFromGitHub {
owner = "blacksmithgu";
repo = "obsidian-dataview";
rev = version;
hash = "sha256-AbK1J1a8bqkPCe9dqADAfR/q/j/kRGa8qouj9GJQErc=";
};
patches = [ ./package-lock.patch ];
makeCacheWritable = true;
npmDepsHash = "sha256-FsPLpWcS27VWrDm5G1ZT6zvfOfYmKNLHzmjiXEmpGKE=";
npmPackFlags = [ "--ignore-scripts" ];
installPhase = ''
mkdir -p $out
cp ./manifest.json $out/manifest.json
cp ./build/main.js $out/main.js
cp ./styles.css $out/styles.css
'';
}

View File

@@ -1,90 +0,0 @@
diff --git a/package-lock.json b/package-lock.json
index 0c1b0bd..df26135 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,15 +1,15 @@
{
"name": "obsidian-dataview",
- "version": "0.5.66",
+ "version": "0.5.67",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "obsidian-dataview",
- "version": "0.5.66",
+ "version": "0.5.67",
"license": "MIT",
"dependencies": {
- "@codemirror/language": "https://github.com/lishid/cm-language",
+ "@codemirror/language": "https://github.com/karaolidis/cm-language#package-lock",
"@codemirror/state": "^6.0.1",
"@codemirror/view": "^6.0.1",
"emoji-regex": "^10.0.0",
@@ -687,29 +687,28 @@
"dev": true
},
"node_modules/@codemirror/language": {
- "version": "6.6.0",
- "resolved": "git+ssh://git@github.com/lishid/cm-language.git#1aadcc247f20ccfda76424a9f853dbb4ee203fdc",
- "license": "MIT",
+ "version": "6.10.1",
+ "resolved": "git+ssh://git@github.com/karaolidis/cm-language.git#d6238f0a9e17e20d604cee67a47d3a93b00dd41c",
"dependencies": {
"@codemirror/state": "^6.0.0",
- "@codemirror/view": "^6.0.0",
- "@lezer/common": "^1.0.0",
+ "@codemirror/view": "^6.23.0",
+ "@lezer/common": "^1.1.0",
"@lezer/highlight": "^1.0.0",
"@lezer/lr": "^1.0.0",
"style-mod": "^4.0.0"
}
},
"node_modules/@codemirror/state": {
- "version": "6.2.1",
- "resolved": "https://registry.npmjs.org/@codemirror/state/-/state-6.2.1.tgz",
- "integrity": "sha512-RupHSZ8+OjNT38zU9fKH2sv+Dnlr8Eb8sl4NOnnqz95mCFTZUaiRP8Xv5MeeaG0px2b8Bnfe7YGwCV3nsBhbuw=="
+ "version": "6.4.1",
+ "resolved": "https://registry.npmjs.org/@codemirror/state/-/state-6.4.1.tgz",
+ "integrity": "sha512-QkEyUiLhsJoZkbumGZlswmAhA7CBU02Wrz7zvH4SrcifbsqwlXShVXg65f3v/ts57W3dqyamEriMhij1Z3Zz4A=="
},
"node_modules/@codemirror/view": {
- "version": "6.19.0",
- "resolved": "https://registry.npmjs.org/@codemirror/view/-/view-6.19.0.tgz",
- "integrity": "sha512-XqNIfW/3GaaF+T7Q1jBcRLCPm1NbrR2DBxrXacSt1FG+rNsdsNn3/azAfgpUoJ7yy4xgd8xTPa3AlL+y0lMizQ==",
+ "version": "6.28.4",
+ "resolved": "https://registry.npmjs.org/@codemirror/view/-/view-6.28.4.tgz",
+ "integrity": "sha512-QScv95fiviSQ/CaVGflxAvvvDy/9wi0RFyDl4LkHHWiMr/UPebyuTspmYSeN5Nx6eujcPYwsQzA6ZIZucKZVHQ==",
"dependencies": {
- "@codemirror/state": "^6.1.4",
+ "@codemirror/state": "^6.4.0",
"style-mod": "^4.1.0",
"w3c-keyname": "^2.2.4"
}
@@ -1133,9 +1132,9 @@
}
},
"node_modules/@lezer/common": {
- "version": "1.0.4",
- "resolved": "https://registry.npmjs.org/@lezer/common/-/common-1.0.4.tgz",
- "integrity": "sha512-lZHlk8p67x4aIDtJl6UQrXSOP6oi7dQR3W/geFVrENdA1JDaAJWldnVqVjPMJupbTKbzDfFcePfKttqVidS/dg=="
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/@lezer/common/-/common-1.2.1.tgz",
+ "integrity": "sha512-yemX0ZD2xS/73llMZIK6KplkjIjf2EvAHcinDi/TfJ9hS25G0388+ClHt6/3but0oOxinTcQHJLDXh6w1crzFQ=="
},
"node_modules/@lezer/highlight": {
"version": "1.1.6",
diff --git a/package.json b/package.json
index db15b53..d3605a0 100644
--- a/package.json
+++ b/package.json
@@ -47,7 +47,7 @@
"rollup-plugin-web-worker-loader": "^1.6.1"
},
"dependencies": {
- "@codemirror/language": "https://github.com/lishid/cm-language",
+ "@codemirror/language": "https://github.com/karaolidis/cm-language#package-lock",
"@codemirror/state": "^6.0.1",
"@codemirror/view": "^6.0.1",
"emoji-regex": "^10.0.0",

View File

@@ -1,47 +0,0 @@
{ pkgs, ... }:
pkgs.buildNpmPackage rec {
pname = "obsidian.plugins.excalidraw";
version = "2.8.3";
pkg = pkgs.fetchFromGitHub {
owner = "zsviczian";
repo = "obsidian-excalidraw-plugin";
rev = version;
hash = "sha256-vfswTT+FzzcddUQSoy6xseE+PzsWtRx8RkYzqGn6wFQ=";
};
mathjaxToSVG = pkgs.buildNpmPackage {
pname = "obsidian.plugins.excalidraw.mathjaxToSVG";
version = "1.0.0";
src = "${pkg}/MathjaxToSVG";
npmDepsHash = "sha256-AosKWlX08dpXNQ2YlrfR6jEInmU02Ztf26nmV19Jxok=";
configurePhase = ''
mkdir dist
'';
installPhase = ''
mkdir -p $out
cp ./dist/index.js $out/index.js
'';
};
src = pkg;
patches = [ ./package-lock.patch ];
npmDepsHash = "sha256-6Y22TD6BMljRGrL/qT54F7bFXcQbY1bQ5GuKEqAXIwY=";
npmPackFlags = [ "--ignore-scripts" ];
configurePhase = ''
mkdir dist
mkdir -p ./MathjaxToSVG/dist
cp ${mathjaxToSVG}/index.js ./MathjaxToSVG/dist/index.js
'';
installPhase = ''
mkdir -p $out
cp ./dist/manifest.json $out/manifest.json
cp ./dist/main.js $out/main.js
cp ./dist/styles.css $out/styles.css
'';
}

View File

@@ -1,24 +0,0 @@
{ pkgs, ... }:
pkgs.buildNpmPackage rec {
pname = "obsidian.plugins.folder-note";
version = "0.7.3";
src = pkgs.fetchFromGitHub {
owner = "karaolidis";
rev = "2d14ccb5179beb48c3df87108170aeda067584ac";
# owner = "xpgo";
repo = "obsidian-folder-note-plugin";
# rev = version;
hash = "sha256-Ub0u+hMbkzxeUjzVmA61S0ClXR9E3KrYTqhrJBQj0Wg=";
};
npmDepsHash = "sha256-4v6QwwooxsXy+mbiKriylpKa8NOK8pWZixezY+H6wxo=";
npmPackFlags = [ "--ignore-scripts" ];
installPhase = ''
mkdir -p $out
cp ./manifest.json $out/manifest.json
cp ./main.js $out/main.js
cp ./styles.css $out/styles.css
'';
}

View File

@@ -1,31 +0,0 @@
{ pkgs, ... }:
pkgs.stdenv.mkDerivation rec {
pname = "obsidian.plugins.kanban";
version = "2.0.51";
src = pkgs.fetchFromGitHub {
owner = "mgmeyers";
repo = "obsidian-kanban";
rev = version;
hash = "sha256-NahypggwPrub2KxRBAn54ZpEInP1V+6l/xmUKUt6myA=";
};
offlineCache = pkgs.fetchYarnDeps {
yarnLock = src + "/yarn.lock";
hash = "sha256-eof2W9Ja4RlmjQ0SnaF/jadHX3GRkCRrMwZU2z0M/Jk=";
};
nativeBuildInputs = with pkgs; [
nodejs
yarnConfigHook
yarnBuildHook
npmHooks.npmInstallHook
];
installPhase = ''
mkdir -p $out
cp ./manifest.json $out/manifest.json
cp ./main.js $out/main.js
cp ./styles.css $out/styles.css
'';
}

View File

@@ -1,35 +0,0 @@
{ pkgs, ... }:
pkgs.stdenv.mkDerivation rec {
pname = "obsidian.plugins.languagetool";
version = "0.3.7";
src = pkgs.fetchFromGitHub {
owner = "karaolidis";
rev = "a7bb62f767decbd55b14702c35e24954459e77ca";
# owner = "Clemens-E";
repo = "obsidian-languagetool-plugin";
# rev = version;
hash = "sha256-LeSK9ctdKW6P3AoOWHxHmGxIlOXDOVd1nhsWXdRSiZY=";
};
patches = [ ./settings-notification.patch ];
offlineCache = pkgs.fetchYarnDeps {
yarnLock = src + "/yarn.lock";
hash = "sha256-749RGQmg9Mte7TR6k3qP6xcb8+rj/C60LYLbF8j8gNc=";
};
nativeBuildInputs = with pkgs; [
nodejs
yarnConfigHook
yarnBuildHook
npmHooks.npmInstallHook
];
installPhase = ''
mkdir -p $out
cp ./manifest.json $out/manifest.json
cp ./main.js $out/main.js
cp ./styles.css $out/styles.css
'';
}

View File

@@ -1,12 +0,0 @@
diff --git a/src/index.ts b/src/index.ts
index 00cccfe..43e6107 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -42,7 +42,6 @@ export default class LanguageToolPlugin extends Plugin {
try {
await this.saveSettings();
await this.loadSettings();
- new Notice('updated LanguageTool Settings, please confirm your server URL in the settings tab', 10000);
} catch (e) {
console.error(e);
}

View File

@@ -1,22 +0,0 @@
{ pkgs, ... }:
pkgs.buildNpmPackage rec {
pname = "obsidian.plugins.linter";
version = "1.28.0";
src = pkgs.fetchFromGitHub {
owner = "platers";
repo = "obsidian-linter";
rev = version;
hash = "sha256-pMcVowcV0k/OcG6cITRxt3HOA5QJDaery6upLPWSxpM=";
};
npmDepsHash = "sha256-XgOgAJoRXhQIQNnubU0uL7e7SGJvRhWvPktMNZN5F5U=";
npmPackFlags = [ "--ignore-scripts" ];
installPhase = ''
mkdir -p $out
cp ./manifest.json $out/manifest.json
cp ./main.js $out/main.js
cp ./src/styles.css $out/styles.css
'';
}

View File

@@ -1,24 +0,0 @@
{ pkgs, ... }:
pkgs.buildNpmPackage rec {
pname = "obsidian.plugins.map-view";
version = "5.0.2";
src = pkgs.fetchFromGitHub {
owner = "karaolidis";
rev = "e1d2737f20e8667417b040b4dcad020aa6de84d3";
# owner = "esm7";
repo = "obsidian-map-view";
# rev = version;
hash = "sha256-Tmp8/li82BHVY3pLwi5l86NTXzfzrcRMZFMVNWiItXE=";
};
npmDepsHash = "sha256-BsiFThkaZHQcayTuI5uvD5uD710eDVPgkANSj7Qd5S0=";
npmPackFlags = [ "--ignore-scripts" ];
installPhase = ''
mkdir -p $out
cp ./dist/manifest.json $out/manifest.json
cp ./dist/main.js $out/main.js
cp ./dist/styles.css $out/styles.css
'';
}

View File

@@ -1,24 +0,0 @@
{ pkgs, ... }:
pkgs.buildNpmPackage rec {
pname = "obsidian.plugins.minimal-settings";
version = "8.1.1";
src = pkgs.fetchFromGitHub {
owner = "karaolidis";
rev = "5a69fb195726cc61ae3ca9b14fb1a78862397529";
# owner = "kepano";
repo = "obsidian-minimal-settings";
# rev = version;
hash = "sha256-FPZMdOcwkCnCN0v3IgiFnhBLrnuqU7DR7XE+qheYdZE=";
};
npmDepsHash = "sha256-E8CPsBmuV51GC3N5qxz8haa249vMfm3TZyZVsyPwfkg=";
npmPackFlags = [ "--ignore-scripts" ];
installPhase = ''
mkdir -p $out
cp ./manifest.json $out/manifest.json
cp ./main.js $out/main.js
cp ./styles.css $out/styles.css
'';
}

View File

@@ -1,22 +0,0 @@
{ pkgs, ... }:
pkgs.buildNpmPackage rec {
pname = "obsidian.plugins.outliner";
version = "4.8.1";
src = pkgs.fetchFromGitHub {
owner = "vslinko";
repo = "obsidian-outliner";
rev = version;
hash = "sha256-LfkK1c3khA75UZQMJStvV2bccHTz4eMqtEIC8jPFKBM=";
};
npmDepsHash = "sha256-EVSunBtuOo93Zhq95u80j/MArRZaAyKdcwUz61qHXiQ=";
npmPackFlags = [ "--ignore-scripts" ];
installPhase = ''
mkdir -p $out
cp ./manifest.json $out/manifest.json
cp ./main.js $out/main.js
cp ./styles.css $out/styles.css
'';
}

View File

@@ -1,21 +0,0 @@
{ pkgs, ... }:
pkgs.buildNpmPackage rec {
pname = "obsidian.plugins.read-it-later";
version = "0.11.4";
src = pkgs.fetchFromGitHub {
owner = "DominikPieper";
repo = "obsidian-ReadItLater";
rev = version;
hash = "sha256-Favp5YhRTYhMGsLuPWiFwmU3zA3vwZkkdXABBVy7NNs=";
};
npmDepsHash = "sha256-PUQc3qM/pjJkkO3zpCmga8eO8XaNxyeZAw+0GNPg5Ro=";
npmPackFlags = [ "--ignore-scripts" ];
installPhase = ''
mkdir -p $out
cp ./manifest.json $out/manifest.json
cp ./main.js $out/main.js
'';
}

View File

@@ -1,33 +0,0 @@
{ pkgs, ... }:
pkgs.stdenv.mkDerivation rec {
pname = "obsidian.plugins.style-settings";
version = "1.0.9";
src = pkgs.fetchFromGitHub {
owner = "karaolidis";
rev = "21f29b7aea728d9040ed209cddb7d9f05c68be1f";
# owner = "mgmeyers";
repo = "obsidian-style-settings";
# rev = version;
hash = "sha256-6xyp5PE4mhKYP3Lc4vKUG/N3aqBhHGwsCuzfVkq1jwM=";
};
offlineCache = pkgs.fetchYarnDeps {
yarnLock = src + "/yarn.lock";
hash = "sha256-tqX09XWI3ZL9bXVdjgsAEuvfCAjnyWj5uSWGFbNApds=";
};
nativeBuildInputs = with pkgs; [
nodejs
yarnConfigHook
yarnBuildHook
npmHooks.npmInstallHook
];
installPhase = ''
mkdir -p $out
cp ./manifest.json $out/manifest.json
cp ./main.js $out/main.js
cp ./styles.css $out/styles.css
'';
}

View File

@@ -1,31 +0,0 @@
{ pkgs, ... }:
pkgs.stdenv.mkDerivation rec {
pname = "obsidian.plugins.tasks";
version = "7.15.0";
src = pkgs.fetchFromGitHub {
owner = "obsidian-tasks-group";
repo = "obsidian-tasks";
rev = version;
hash = "sha256-BF9ye4ocE6vZh+ChkmuLkQpNWtH425EX0EHQs+wbTZc=";
};
offlineCache = pkgs.fetchYarnDeps {
yarnLock = src + "/yarn.lock";
hash = "sha256-Tf1K048Ox+hImIfrdBWQHsiDe+3FGUQLFBcf/Bbbo1U=";
};
nativeBuildInputs = with pkgs; [
nodejs
yarnConfigHook
yarnBuildHook
npmHooks.npmInstallHook
];
installPhase = ''
mkdir -p $out
cp ./manifest.json $out/manifest.json
cp ./main.js $out/main.js
cp ./styles.css $out/styles.css
'';
}

View File

@@ -1,23 +0,0 @@
{ pkgs, ... }:
pkgs.buildNpmPackage rec {
pname = "obsidian.plugins.url-into-selection";
version = "1.7.0";
src = pkgs.fetchFromGitHub {
owner = "karaolidis";
rev = "9f85d59be28797b7ef16c452fa3c4093f60b3bab";
# owner = "denolehov";
repo = "obsidian-url-into-selection";
# rev = version;
hash = "sha256-MQV8CMzCha0MUGLh4c1WuHVXRiCPEwtSgd3Xoj/81hA=";
};
npmDepsHash = "sha256-tThyrhezHZ29JUzx5sy2SfoZIGYP0DOQBctxYB5O1P4=";
npmPackFlags = [ "--ignore-scripts" ];
installPhase = ''
mkdir -p $out
cp ./manifest.json $out/manifest.json
cp ./main.js $out/main.js
'';
}

View File

@@ -1,27 +0,0 @@
{ pkgs, ... }:
pkgs.buildNpmPackage rec {
pname = "obsidian.themes.minimal";
version = "7.7.18";
src = pkgs.fetchFromGitHub {
owner = "kepano";
repo = "obsidian-minimal";
rev = version;
hash = "sha256-zOUOE8EQlnnOmEhkWQmT28eH2Yk7fgkNvbxjJzLXio8=";
};
npmDepsHash = "sha256-PzsZv/On8ci6EkF3WE4aez3/jQu5AqyJxFUzJk+Pn0c=";
npmPackFlags = [ "--ignore-scripts" ];
nativeBuildInputs = with pkgs; [ sass ];
buildPhase = ''
npx grunt cssmin
'';
installPhase = ''
mkdir -p $out
cp ./manifest.json $out/manifest.json
cp ./theme.css $out/theme.css
'';
}

View File

@@ -6,9 +6,12 @@
config,
lib,
pkgs,
inputs,
system,
...
}:
let
selfPkgs = inputs.self.packages.${system};
hmConfig = config.home-manager.users.${user};
in
{
@@ -73,7 +76,7 @@ in
communityPlugins = [
{
pkg = pkgs.callPackage ./config/plugins/better-word-count { };
pkg = selfPkgs.obsidian-plugin-better-word-count;
options = {
statusBar = [
{
@@ -99,7 +102,7 @@ in
};
}
{
pkg = pkgs.callPackage ./config/plugins/custom-sort { };
pkg = selfPkgs.obsidian-plugin-custom-sort;
options = {
suspended = false;
statusBarEntryEnabled = false;
@@ -110,7 +113,7 @@ in
};
}
{
pkg = pkgs.callPackage ./config/plugins/dataview { };
pkg = selfPkgs.obsidian-plugin-dataview;
options = {
enableDataviewJs = true;
enableInlineDataviewJs = true;
@@ -120,7 +123,7 @@ in
};
}
{
pkg = pkgs.callPackage ./config/plugins/excalidraw { };
pkg = selfPkgs.obsidian-plugin-excalidraw;
options = {
folder = "Inbox";
templateFilePath = "Templates";
@@ -143,14 +146,14 @@ in
};
}
{
pkg = pkgs.callPackage ./config/plugins/folder-note { };
pkg = selfPkgs.obsidian-plugin-folder-note;
options = {
folderNoteHide = false;
folderNoteStrInit = "";
};
}
{
pkg = pkgs.callPackage ./config/plugins/kanban { };
pkg = selfPkgs.obsidian-plugin-kanban;
options = {
move-tags = true;
move-dates = true;
@@ -164,7 +167,7 @@ in
};
}
{
pkg = pkgs.callPackage ./config/plugins/languagetool { };
pkg = selfPkgs.obsidian-plugin-languagetool;
options = {
shouldAutoCheck = true;
pickyMode = true;
@@ -173,7 +176,7 @@ in
};
}
{
pkg = pkgs.callPackage ./config/plugins/linter { };
pkg = selfPkgs.obsidian-plugin-linter;
options = {
lintOnSave = true;
displayChanged = false;
@@ -313,7 +316,7 @@ in
};
}
{
pkg = pkgs.callPackage ./config/plugins/map-view { };
pkg = selfPkgs.obsidian-plugin-map-view;
options = {
"markerIconRules" = [
{
@@ -399,20 +402,20 @@ in
};
}
{
pkg = pkgs.callPackage ./config/plugins/minimal-settings { };
pkg = selfPkgs.obsidian-plugin-minimal-settings;
options = {
editorFont = "var(--font-monospace)";
};
}
{
pkg = pkgs.callPackage ./config/plugins/outliner { };
pkg = selfPkgs.obsidian-plugin-outliner;
options = {
styleLists = false;
stickCursor = "never";
};
}
{
pkg = pkgs.callPackage ./config/plugins/read-it-later { };
pkg = selfPkgs.obsidian-plugin-read-it-later;
options = {
inboxDir = "Inbox";
assetsDir = "Inbox/assets";
@@ -498,9 +501,9 @@ in
textSnippetNote = "%content%";
};
}
(pkgs.callPackage ./config/plugins/style-settings { })
(selfPkgs.obsidian-plugin-style-settings)
{
pkg = pkgs.callPackage ./config/plugins/tasks { };
pkg = selfPkgs.obsidian-plugin-tasks;
options = {
globalQuery = "short mode";
globalFilter = "#todo";
@@ -646,12 +649,12 @@ in
};
};
}
(pkgs.callPackage ./config/plugins/url-into-selection { })
(selfPkgs.obsidian-plugin-url-into-selection)
];
cssSnippets = [ ./config/snippets/file-explorer-separators.css ];
themes = [ (pkgs.callPackage ./config/themes/minimal { }) ];
themes = [ selfPkgs.obsidian-theme-minimal ];
hotkeys = {
"command-palette:open" = [ { key = "F1"; } ];

View File

@@ -6,7 +6,7 @@
config,
inputs,
lib,
pkgs,
system,
...
}:
let
@@ -28,7 +28,7 @@ in
programs.spicetify =
let
spicePkgs = inputs.spicetify-nix.legacyPackages.${pkgs.system};
spicePkgs = inputs.spicetify-nix.legacyPackages.${system};
in
{
enable = true;

View File

@@ -21,75 +21,76 @@ in
programs.vscode = {
enable = true;
mutableExtensionsDir = false;
extensions = with pkgs.vscode-extensions; [
mkhl.direnv
mhutchie.git-graph
ms-vsliveshare.vsliveshare
naumovs.color-highlight
];
profiles.default = {
extensions = with pkgs.vscode-extensions; [
mkhl.direnv
mhutchie.git-graph
ms-vsliveshare.vsliveshare
naumovs.color-highlight
];
userSettings = {
"diffEditor.ignoreTrimWhitespace" = false;
"editor.accessibilitySupport" = "off";
"editor.cursorBlinking" = "phase";
"editor.cursorSmoothCaretAnimation" = "on";
"editor.fontFamily" = builtins.concatStringsSep ", " hmConfig.theme.font.monospace.names;
"editor.fontLigatures" = true;
"editor.fontSize" = hmConfig.theme.font.size;
"editor.formatOnPaste" = true;
"editor.formatOnSave" = true;
"editor.formatOnType" = true;
"editor.indentSize" = "tabSize";
"editor.inlineSuggest.enabled" = true;
"editor.largeFileOptimizations" = false;
"editor.linkedEditing" = true;
"editor.renderFinalNewline" = "on";
"editor.smoothScrolling" = true;
"editor.stickyScroll.enabled" = true;
"editor.suggestSelection" = "first";
"editor.tabSize" = 2;
"editor.unicodeHighlight.includeComments" = true;
"editor.unicodeHighlight.nonBasicASCII" = true;
"explorer.confirmDelete" = false;
"explorer.confirmDragAndDrop" = false;
"explorer.confirmPasteNative" = false;
"extensions.autoCheckUpdates" = false;
"extensions.autoUpdate" = false;
"extensions.ignoreRecommendations" = true;
"files.autoSave" = "afterDelay";
"files.eol" = "\n";
"files.insertFinalNewline" = true;
"files.trimFinalNewlines" = true;
"files.trimTrailingWhitespace" = true;
"git.allowForcePush" = true;
"git.alwaysSignOff" = true;
"git.autofetch" = "all";
"git.closeDiffOnOperation" = true;
"git.confirmForcePush" = false;
"git.confirmSync" = false;
"git.enableCommitSigning" = true;
"git.enableSmartCommit" = true;
"git.ignoreRebaseWarning" = true;
"git.openRepositoryInParentFolders" = "always";
"git.path" = lib.meta.getExe pkgs.git;
"mergeEditor.diffAlgorithm" = "advanced";
"security.workspace.trust.enabled" = false;
"telemetry.telemetryLevel" = "off";
"terminal.external.linuxExec" = "kitty";
"terminal.integrated.confirmOnExit" = "hasChildProcesses";
"terminal.integrated.copyOnSelection" = true;
"terminal.integrated.fontFamily" =
builtins.concatStringsSep ", " hmConfig.theme.font.monospace.names;
"terminal.integrated.fontSize" = hmConfig.theme.font.size;
"update.mode" = "none";
"window.autoDetectColorScheme" = true;
"window.autoDetectHighContrast" = false;
"window.menuBarVisibility" = "toggle";
"workbench.editor.historyBasedLanguageDetection" = true;
"workbench.list.smoothScrolling" = true;
userSettings = {
"diffEditor.ignoreTrimWhitespace" = false;
"editor.accessibilitySupport" = "off";
"editor.cursorBlinking" = "phase";
"editor.cursorSmoothCaretAnimation" = "on";
"editor.fontFamily" = builtins.concatStringsSep ", " hmConfig.theme.font.monospace.names;
"editor.fontLigatures" = true;
"editor.fontSize" = hmConfig.theme.font.size;
"editor.formatOnPaste" = true;
"editor.formatOnSave" = true;
"editor.formatOnType" = true;
"editor.indentSize" = "tabSize";
"editor.inlineSuggest.enabled" = true;
"editor.largeFileOptimizations" = false;
"editor.linkedEditing" = true;
"editor.renderFinalNewline" = "on";
"editor.smoothScrolling" = true;
"editor.stickyScroll.enabled" = true;
"editor.suggestSelection" = "first";
"editor.tabSize" = 2;
"editor.unicodeHighlight.includeComments" = true;
"editor.unicodeHighlight.nonBasicASCII" = true;
"explorer.confirmDelete" = false;
"explorer.confirmDragAndDrop" = false;
"explorer.confirmPasteNative" = false;
"extensions.autoCheckUpdates" = false;
"extensions.autoUpdate" = false;
"extensions.ignoreRecommendations" = true;
"files.autoSave" = "afterDelay";
"files.eol" = "\n";
"files.insertFinalNewline" = true;
"files.trimFinalNewlines" = true;
"files.trimTrailingWhitespace" = true;
"git.allowForcePush" = true;
"git.alwaysSignOff" = true;
"git.autofetch" = "all";
"git.closeDiffOnOperation" = true;
"git.confirmForcePush" = false;
"git.confirmSync" = false;
"git.enableCommitSigning" = true;
"git.enableSmartCommit" = true;
"git.ignoreRebaseWarning" = true;
"git.openRepositoryInParentFolders" = "always";
"git.path" = lib.meta.getExe pkgs.git;
"mergeEditor.diffAlgorithm" = "advanced";
"security.workspace.trust.enabled" = false;
"telemetry.telemetryLevel" = "off";
"terminal.external.linuxExec" = "kitty";
"terminal.integrated.confirmOnExit" = "hasChildProcesses";
"terminal.integrated.copyOnSelection" = true;
"terminal.integrated.fontFamily" =
builtins.concatStringsSep ", " hmConfig.theme.font.monospace.names;
"terminal.integrated.fontSize" = hmConfig.theme.font.size;
"update.mode" = "none";
"window.autoDetectColorScheme" = true;
"window.autoDetectHighContrast" = false;
"window.menuBarVisibility" = "toggle";
"workbench.editor.historyBasedLanguageDetection" = true;
"workbench.list.smoothScrolling" = true;
};
};
};

View File

@@ -5,7 +5,7 @@
...
}:
lib.mkIf config.programs.vscode.languages.c.enable {
programs.vscode.extensions = with pkgs.vscode-extensions; [
programs.vscode.profiles.default.extensions = with pkgs.vscode-extensions; [
ms-vscode.cpptools
ms-vscode.cmake-tools
];

View File

@@ -5,5 +5,7 @@
...
}:
lib.mkIf config.programs.vscode.languages.docker.enable {
programs.vscode.extensions = with pkgs.vscode-extensions; [ ms-azuretools.vscode-docker ];
programs.vscode.profiles.default.extensions = with pkgs.vscode-extensions; [
ms-azuretools.vscode-docker
];
}

View File

@@ -5,5 +5,5 @@
...
}:
lib.mkIf config.programs.vscode.languages.go.enable {
programs.vscode.extensions = with pkgs.vscode-extensions; [ golang.go ];
programs.vscode.profiles.default.extensions = with pkgs.vscode-extensions; [ golang.go ];
}

View File

@@ -5,7 +5,7 @@
...
}:
lib.mkIf config.programs.vscode.languages.java.enable {
programs.vscode = {
programs.vscode.profiles.default = {
extensions =
with pkgs;
with vscode-extensions;

View File

@@ -5,5 +5,5 @@
...
}:
lib.mkIf config.programs.vscode.languages.jinja.enable {
programs.vscode.extensions = with pkgs.vscode-extensions; [ wholroyd.jinja ];
programs.vscode.profiles.default.extensions = with pkgs.vscode-extensions; [ wholroyd.jinja ];
}

View File

@@ -5,5 +5,5 @@
...
}:
lib.mkIf config.programs.vscode.languages.lua.enable {
programs.vscode.extensions = with pkgs.vscode-extensions; [ sumneko.lua ];
programs.vscode.profiles.default.extensions = with pkgs.vscode-extensions; [ sumneko.lua ];
}

View File

@@ -5,5 +5,7 @@
...
}:
lib.mkIf config.programs.vscode.languages.markdown.enable {
programs.vscode.extensions = with pkgs.vscode-extensions; [ yzhang.markdown-all-in-one ];
programs.vscode.profiles.default.extensions = with pkgs.vscode-extensions; [
yzhang.markdown-all-in-one
];
}

View File

@@ -5,7 +5,7 @@
...
}:
lib.mkIf config.programs.vscode.languages.nix.enable {
programs.vscode = {
programs.vscode.profiles.default = {
userSettings = {
"nix.enableLanguageServer" = true;
"nix.serverPath" = lib.meta.getExe pkgs.nil;

View File

@@ -5,7 +5,7 @@
...
}:
lib.mkIf config.programs.vscode.languages.python.enable {
programs.vscode.extensions = with pkgs.vscode-extensions; [
programs.vscode.profiles.default.extensions = with pkgs.vscode-extensions; [
ms-python.python
ms-python.vscode-pylance
ms-python.debugpy

View File

@@ -5,7 +5,7 @@
...
}:
lib.mkIf config.programs.vscode.languages.rest.enable {
programs.vscode = {
programs.vscode.profiles.default = {
extensions = with pkgs.vscode-extensions; [ humao.rest-client ];
userSettings = {

View File

@@ -5,5 +5,7 @@
...
}:
lib.mkIf config.programs.vscode.languages.python.enable {
programs.vscode.extensions = with pkgs.vscode-extensions; [ rust-lang.rust-analyzer ];
programs.vscode.profiles.default.extensions = with pkgs.vscode-extensions; [
rust-lang.rust-analyzer
];
}

View File

@@ -5,7 +5,7 @@
...
}:
lib.mkIf config.programs.vscode.languages.sas.enable {
programs.vscode = {
programs.vscode.profiles.default = {
extensions = with pkgs.vscode-extensions; [ sas.sas-lsp ];
userSettings = {

View File

@@ -5,5 +5,7 @@
...
}:
lib.mkIf config.programs.vscode.languages.sops.enable {
programs.vscode.extensions = with pkgs.vscode-extensions; [ signageos.signageos-vscode-sops ];
programs.vscode.profiles.default.extensions = with pkgs.vscode-extensions; [
signageos.signageos-vscode-sops
];
}

View File

@@ -5,7 +5,7 @@
...
}:
lib.mkIf config.programs.vscode.languages.svelte.enable {
programs.vscode = {
programs.vscode.profiles.default = {
userSettings = {
"svelte.enable-ts-plugin" = true;
};

View File

@@ -1,11 +1,6 @@
{
config,
lib,
pkgs,
...
}:
{ config, lib, ... }:
lib.mkIf config.programs.vscode.languages.typescript.enable {
programs.vscode.userSettings = {
programs.vscode.profiles.default.userSettings = {
"typescript.updateImportsOnFileMove.enabled" = "always";
};
}

View File

@@ -5,5 +5,5 @@
...
}:
lib.mkIf config.programs.vscode.languages.yaml.enable {
programs.vscode.extensions = with pkgs.vscode-extensions; [ redhat.vscode-yaml ];
programs.vscode.profiles.default.extensions = with pkgs.vscode-extensions; [ redhat.vscode-yaml ];
}

View File

@@ -51,7 +51,7 @@ in
];
config = {
programs.vscode = {
programs.vscode.profiles.default = {
extensions =
with pkgs.vscode-extensions;
[ ]

View File

@@ -0,0 +1,11 @@
{ pkgs, ... }:
{
bun = import ./bun { inherit pkgs; };
c = import ./c { inherit pkgs; };
go = import ./go { inherit pkgs; };
java = import ./java { inherit pkgs; };
nix = import ./nix { inherit pkgs; };
nodejs = import ./nodejs { inherit pkgs; };
python = import ./python { inherit pkgs; };
rust = import ./rust { inherit pkgs; };
}