obsidian: init (#1918)

Closes: https://github.com/nix-community/stylix/issues/1903
Link: https://github.com/nix-community/stylix/discussions/452
Link: https://github.com/nix-community/stylix/pull/1918

Reviewed-by: https://github.com/TheColorman
Reviewed-by: NAHO <90870942+trueNAHO@users.noreply.github.com>
This commit is contained in:
Michael Golden 2025-10-01 03:53:23 -04:00 committed by GitHub
parent fe74ba4ade
commit 126e6c7625
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 159 additions and 0 deletions

View file

@ -40,6 +40,17 @@
matrix = "@noodlez1232:matrix.org";
name = "Nathaniel Barragan";
};
TheColorman = {
email = "nixpkgs@colorman.me";
github = "TheColorman";
githubId = 18369995;
keys = [
{
fingerprint = "3D8C A43C FBA2 5D28 0196 19F0 AB11 0475 B417 291D";
}
];
name = "colorman";
};
TheMaxMur = {
email = "muravjev.mak@yandex.ru";
github = "TheMaxMur";
@ -141,6 +152,12 @@
];
name = "Mateus Auler";
};
michaelgoldenn = {
email = "Michael.Golden0278@gmail.com";
github = "michaelgoldenn";
githubId = 95949544;
name = "Michael Golden";
};
mightyiam = {
email = "mightyiampresence@gmail.com";
github = "mightyiam";

98
modules/obsidian/hm.nix Normal file
View file

@ -0,0 +1,98 @@
{
mkTarget,
lib,
...
}:
mkTarget {
name = "obsidian";
humanName = "Obsidian";
extraOptions.vaultNames = lib.mkOption {
description = "The obsidian vault names to apply styling on.";
type = lib.types.listOf lib.types.str;
default = [ ];
};
configElements = [
(
{ cfg, fonts }:
{
programs.obsidian = {
defaultSettings.appearance = {
"interfaceFontFamily" = fonts.sansSerif.name;
"monospaceFontFamily" = fonts.monospace.name;
"baseFontSize" = fonts.sizes.applications;
};
vaults = lib.genAttrs cfg.vaultNames (_: {
settings.appearance = {
"interfaceFontFamily" = fonts.sansSerif.name;
"monospaceFontFamily" = fonts.monospace.name;
"baseFontSize" = fonts.sizes.applications;
};
});
};
}
)
(
{
cfg,
colors,
polarity,
}:
{
programs.obsidian.defaultSettings.cssSnippets = with colors.withHashtag; [
{
name = "Stylix Config";
text = ''
.theme-${polarity} {
/* Base Colors */
--color-base-00: ${base00};
--color-base-05: ${base00};
--color-base-10: ${base00};
--color-base-20: ${base01};
--color-base-25: ${base01};
--color-base-30: ${base02};
--color-base-35: ${base02};
--color-base-40: ${base03};
--color-base-50: ${base03};
--color-base-60: ${base04};
--color-base-70: ${base04};
--color-base-100: ${base05};
--color-accent: ${base0E};
--color-accent-1: ${base0E};
}
'';
}
];
programs.obsidian.vaults = lib.genAttrs cfg.vaultNames (_: {
settings.cssSnippets = with colors.withHashtag; [
{
name = "Stylix Config";
text = ''
.theme-${polarity} {
/* Base Colors */
--color-base-00: ${base00};
--color-base-05: ${base00};
--color-base-10: ${base00};
--color-base-20: ${base01};
--color-base-25: ${base01};
--color-base-30: ${base02};
--color-base-35: ${base02};
--color-base-40: ${base03};
--color-base-50: ${base03};
--color-base-60: ${base04};
--color-base-70: ${base04};
--color-base-100: ${base05};
--color-accent: ${base0E};
--color-accent-1: ${base0E};
}
'';
}
];
});
}
)
];
}

View file

@ -0,0 +1,9 @@
{ lib, ... }:
{
name = "Obsidian";
homepage = "https://obsidian.md";
maintainers = with lib.maintainers; [
TheColorman
michaelgoldenn
];
}

View file

@ -0,0 +1,29 @@
{ lib, pkgs, ... }:
let
package = pkgs.obsidian;
in
{
nixpkgs.config.allowUnfreePredicate =
pkg:
builtins.elem (lib.getName pkg) [
"obsidian"
];
stylix.testbed.ui.application = {
name = "obsidian";
inherit package;
};
home-manager.sharedModules =
let
vault = "stylix";
in
lib.singleton {
programs.obsidian = {
enable = true;
vaults.${vault}.enable = true;
inherit package;
};
stylix.targets.obsidian.vaultNames = [ vault ];
};
}

View file

@ -42,6 +42,12 @@
{ fingerprint = "36BC 916D DD4E B1EE EE82 4BBF DC95 900F 6DA7 9992"; }
];
};
michaelgoldenn = {
email = "Michael.Golden0278@gmail.com";
name = "Michael Golden";
github = "michaelgoldenn";
githubId = 95949544;
};
osipog = {
email = "osibluber@protonmail.com";
name = "Osi Bluber";