From 7cebbf2f09b94545741df27303887aa168dbf170 Mon Sep 17 00:00:00 2001 From: Daniel Langbein Date: Mon, 1 Jan 2024 16:21:47 +0100 Subject: [PATCH] obsidian from unstable --- modules/nur-and-unstable.nix | 16 +++++++++++++++- modules/obsidian.nix | 22 ++++++++++++++-------- 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/modules/nur-and-unstable.nix b/modules/nur-and-unstable.nix index 9bdc231..a5ae8b5 100644 --- a/modules/nur-and-unstable.nix +++ b/modules/nur-and-unstable.nix @@ -1,4 +1,4 @@ -{ config, pkgs, ... }: +{ config, pkgs, lib, ... }: { # How NUR (or unstable) can be imported without `niv`. #nixpkgs.config.packageOverrides = pkgs: { @@ -15,6 +15,20 @@ # Import unstable with niv. unstable = import (import ../nix/sources.nix).unstable { inherit pkgs; + + # "unstable" `nixpkgs.config` has to be configured here where we import it. + # https://github.com/NixOS/nixpkgs/issues/69347#issuecomment-534573461 + config = { + + # Required for unstable.obsidian (see obsidan.nix) + allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ + "obsidian" + ]; + permittedInsecurePackages = [ + "electron-25.9.0" + ]; + + }; }; }; diff --git a/modules/obsidian.nix b/modules/obsidian.nix index 2857da5..4e47858 100644 --- a/modules/obsidian.nix +++ b/modules/obsidian.nix @@ -1,17 +1,23 @@ { config, pkgs, lib, ... }: { - nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ - "obsidian" - ]; + # TODO. + # As of 01.01.2024, the Electron version of Obsidian does not find some GL libraries. + # Temporary workaround (https://github.com/NixOS/nixpkgs/issues/268490#issuecomment-1817991394): + # export LD_LIBRARY_PATH=$(nix --extra-experimental-features nix-command --extra-experimental-features flakes build --print-out-paths --no-link nixpkgs#libGL)/lib + # obsidian - # TODO: Disallow insecure Electron version. - nixpkgs.config.permittedInsecurePackages = [ - "electron-25.9.0" - ]; + # This `config` is only for "stable" `nixpkgs`, not for "unstable". + # See nur-and-unstable.nix +# nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ +# "obsidian" +# ]; + # TODO go back to stable nixpkgs. + # As of 01.01.2024, obsidian did not start on Wayland and it is using an insecure Electron version. + # Thus, we are currently running it from unstable. users.users.yoda = { packages = with pkgs; [ - obsidian # Markdown notes + unstable.obsidian # Markdown notes ]; }; }