nix-format and remove obsolete obsidian derivation

This commit is contained in:
Haak Saxberg 2021-10-10 14:00:02 -07:00
parent 570c2753a7
commit 64f5af878d
9 changed files with 37 additions and 83 deletions

View file

@ -1,6 +1,7 @@
{ pkgs, ... }: { pkgs, ... }:
let let
in with builtins; in
with builtins;
{ {
programs.direnv = { programs.direnv = {
enable = true; enable = true;

View file

@ -29,7 +29,8 @@ let
sha256 = "0i0p21jkrx99n3dnm5xvnw8n963c67l4lgl4iwngz0psdzwxphkw"; sha256 = "0i0p21jkrx99n3dnm5xvnw8n963c67l4lgl4iwngz0psdzwxphkw";
}; };
}; };
in with builtins; in
with builtins;
{ {
programs.neovim = { programs.neovim = {
enable = true; enable = true;

View file

@ -1,17 +1,17 @@
local nvim_lsp = require("lspconfig") local nvim_lsp = require("lspconfig")
local format_async = function(err, _, result, _, bufnr) -- local format_async = function(err, _, result, _, bufnr)
if err ~= nil or result == nil then return end -- if err ~= nil or result == nil then return end
if not vim.api.nvim_buf_get_option(bufnr, "modified") then -- if not vim.api.nvim_buf_get_option(bufnr, "modified") then
local view = vim.fn.winsaveview() -- local view = vim.fn.winsaveview()
vim.lsp.util.apply_text_edits(result, bufnr) -- vim.lsp.util.apply_text_edits(result, bufnr)
vim.fn.winrestview(view) -- vim.fn.winrestview(view)
if bufnr == vim.api.nvim_get_current_buf() then -- if bufnr == vim.api.nvim_get_current_buf() then
vim.api.nvim_command("noautocmd :update") -- vim.api.nvim_command("noautocmd :update")
end -- end
end -- end
end -- end
vim.lsp.handlers["textDocument/formatting"] = format_async -- vim.lsp.handlers["textDocument/formatting"] = format_async
local on_attach = function(client, bufnr) local on_attach = function(client, bufnr)
local buf_map = vim.api.nvim_buf_set_keymap local buf_map = vim.api.nvim_buf_set_keymap

View file

@ -1,50 +0,0 @@
{ stdenv, writeScript, gtk3, appimageTools }:
# run this function like so:
# nix-shell --run obsidian -p "callPackage ./path/to/this/file.nix {}"
let
inherit (appimageTools) extractType2 wrapType2;
name = "obsidian";
src = ~/Downloads/Obsidian-0.6.7.AppImage;
# you can add more paths as required
xdg_dirs = builtins.concatStringsSep ":" [
"${gtk3}/share/gsettings-schemas/${gtk3.name}"
];
# not necessary, here for debugging purposes
# adapted from the original runScript of appimageTools
extracted_source = extractType2 { inherit name src; };
debugScript = writeScript "run" ''
#!${stdenv.shell}
export APPDIR=${extracted_source}
export APPIMAGE_SILENT_INSTALL=1
# >>> inspect the script running environment here <<<
echo "INSPECT: ''${GIO_EXTRA_MODULES:-no extra modules!}"
echo "INSPECT: ''${GSETTINGS_SCHEMA_DIR:-no schemas!}"
echo "INSPECT: ''${XDG_DATA_DIRS:-no data dirs!}"
cd $APPDIR
exec ./AppRun "$@"
'';
in wrapType2 {
inherit name src;
# for debugging purposes only
#runScript = debugScript;
extraPkgs = pkgs: with pkgs; [
# put runtime dependencies if any here
];
# the magic happens here
# other potential variables of interest:
# GIO_EXTRA_MODULES, GSETTINGS_SCHEMA_DIR
profile = ''
export XDG_DATA_DIRS="${xdg_dirs}''${XDG_DATA_DIRS:+:"''$XDG_DATA_DIRS"}"
'';
}

View file

@ -23,7 +23,8 @@ let
tree tree
ripgrep ripgrep
]; ];
in with builtins; in
with builtins;
{ {
# Let Home Manager install and manage itself. # Let Home Manager install and manage itself.
programs.home-manager.enable = true; programs.home-manager.enable = true;

View file

@ -6,7 +6,8 @@
{ {
imports = imports =
[ # Include the results of the hardware scan. [
# Include the results of the hardware scan.
/etc/nixos/hardware-configuration.nix /etc/nixos/hardware-configuration.nix
]; ];