From 64f5af878d9a274042521a6c722a14161cb68c6b Mon Sep 17 00:00:00 2001 From: Haak Saxberg Date: Sun, 10 Oct 2021 14:00:02 -0700 Subject: [PATCH] nix-format and remove obsolete obsidian derivation --- nix/home/commandline.nix | 2 +- nix/home/desktop.nix | 2 +- nix/home/programs/direnv/default.nix | 5 ++- nix/home/programs/git/default.nix | 2 +- nix/home/programs/nvim/default.nix | 25 ++++++------ nix/home/programs/nvim/nvim-lspconfig.lua | 24 +++++------ nix/home/programs/obsidianmd/default.nix | 50 ----------------------- nix/home/universal.nix | 5 ++- nix/system/configuration.nix | 5 ++- 9 files changed, 37 insertions(+), 83 deletions(-) delete mode 100644 nix/home/programs/obsidianmd/default.nix diff --git a/nix/home/commandline.nix b/nix/home/commandline.nix index 048af40..193edfa 100644 --- a/nix/home/commandline.nix +++ b/nix/home/commandline.nix @@ -7,7 +7,7 @@ let ]; in { - imports = [(import ./universal.nix)]; + imports = [ (import ./universal.nix) ]; services.lorri.enable = true; xdg.enable = true; diff --git a/nix/home/desktop.nix b/nix/home/desktop.nix index 33a81f4..041121b 100644 --- a/nix/home/desktop.nix +++ b/nix/home/desktop.nix @@ -22,7 +22,7 @@ let ]; in { - imports = [(import ./commandline.nix)] ++ [(import ./programs/rofi)]; + imports = [ (import ./commandline.nix) ] ++ [ (import ./programs/rofi) ]; home = { packages = defaultPkgs ++ gnomePkgs; diff --git a/nix/home/programs/direnv/default.nix b/nix/home/programs/direnv/default.nix index 8fedccb..ac7ac6c 100644 --- a/nix/home/programs/direnv/default.nix +++ b/nix/home/programs/direnv/default.nix @@ -1,6 +1,7 @@ -{pkgs, ...}: +{ pkgs, ... }: let -in with builtins; +in +with builtins; { programs.direnv = { enable = true; diff --git a/nix/home/programs/git/default.nix b/nix/home/programs/git/default.nix index 51ee80d..e2db4ae 100644 --- a/nix/home/programs/git/default.nix +++ b/nix/home/programs/git/default.nix @@ -2,7 +2,7 @@ let in - { +{ programs.git = { enable = true; userName = "Haak Saxberg"; diff --git a/nix/home/programs/nvim/default.nix b/nix/home/programs/nvim/default.nix index a35a369..13659dd 100644 --- a/nix/home/programs/nvim/default.nix +++ b/nix/home/programs/nvim/default.nix @@ -29,7 +29,8 @@ let sha256 = "0i0p21jkrx99n3dnm5xvnw8n963c67l4lgl4iwngz0psdzwxphkw"; }; }; -in with builtins; +in +with builtins; { programs.neovim = { enable = true; @@ -116,17 +117,17 @@ in with builtins; { plugin = nvim-lspconfig; config = '' - lua << EOF - ${readFile ( - pkgs.substituteAll { - src = ./nvim-lspconfig.lua; - # since both of these are used for actually configuring the system, - # we'll probably always want them around. - lua_ls = pkgs.sumneko-lua-language-server; - rnix_lsp = pkgs.rnix-lsp; - } - ) } - EOF + lua << EOF + ${readFile ( + pkgs.substituteAll { + src = ./nvim-lspconfig.lua; + # since both of these are used for actually configuring the system, + # we'll probably always want them around. + lua_ls = pkgs.sumneko-lua-language-server; + rnix_lsp = pkgs.rnix-lsp; + } + ) } + EOF ''; } { diff --git a/nix/home/programs/nvim/nvim-lspconfig.lua b/nix/home/programs/nvim/nvim-lspconfig.lua index ced4cb5..2b45c9f 100644 --- a/nix/home/programs/nvim/nvim-lspconfig.lua +++ b/nix/home/programs/nvim/nvim-lspconfig.lua @@ -1,17 +1,17 @@ local nvim_lsp = require("lspconfig") -local format_async = function(err, _, result, _, bufnr) - if err ~= nil or result == nil then return end - if not vim.api.nvim_buf_get_option(bufnr, "modified") then - local view = vim.fn.winsaveview() - vim.lsp.util.apply_text_edits(result, bufnr) - vim.fn.winrestview(view) - if bufnr == vim.api.nvim_get_current_buf() then - vim.api.nvim_command("noautocmd :update") - end - end -end -vim.lsp.handlers["textDocument/formatting"] = format_async +-- local format_async = function(err, _, result, _, bufnr) +-- if err ~= nil or result == nil then return end +-- if not vim.api.nvim_buf_get_option(bufnr, "modified") then +-- local view = vim.fn.winsaveview() +-- vim.lsp.util.apply_text_edits(result, bufnr) +-- vim.fn.winrestview(view) +-- if bufnr == vim.api.nvim_get_current_buf() then +-- vim.api.nvim_command("noautocmd :update") +-- end +-- end +-- end +-- vim.lsp.handlers["textDocument/formatting"] = format_async local on_attach = function(client, bufnr) local buf_map = vim.api.nvim_buf_set_keymap diff --git a/nix/home/programs/obsidianmd/default.nix b/nix/home/programs/obsidianmd/default.nix deleted file mode 100644 index d2f3ebd..0000000 --- a/nix/home/programs/obsidianmd/default.nix +++ /dev/null @@ -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"}" - ''; -} diff --git a/nix/home/universal.nix b/nix/home/universal.nix index f3695e7..2accc9c 100644 --- a/nix/home/universal.nix +++ b/nix/home/universal.nix @@ -13,7 +13,7 @@ let cargoSha256 = "17lr4pc2fjcgvx0p4vpkwx3mg9jadb4lygbwri0blmnkqql8xlh3"; nativeBuildInputs = [ pkgs.pkgconfig ]; - buildInputs = [ pkgs.openssl ] ++ (if pkgs.stdenv.isDarwin then [ pkgs.libiconv pkgs.darwin.apple_sdk.frameworks.Security ] else []); + buildInputs = [ pkgs.openssl ] ++ (if pkgs.stdenv.isDarwin then [ pkgs.libiconv pkgs.darwin.apple_sdk.frameworks.Security ] else [ ]); }; defaultPkgs = with pkgs; [ @@ -23,7 +23,8 @@ let tree ripgrep ]; -in with builtins; +in +with builtins; { # Let Home Manager install and manage itself. programs.home-manager.enable = true; diff --git a/nix/system/configuration.nix b/nix/system/configuration.nix index 2f20d6c..3456768 100644 --- a/nix/system/configuration.nix +++ b/nix/system/configuration.nix @@ -6,7 +6,8 @@ { imports = - [ # Include the results of the hardware scan. + [ + # Include the results of the hardware scan. /etc/nixos/hardware-configuration.nix ]; @@ -137,7 +138,7 @@ extraGroups = [ "wheel" # Enable ‘sudo’ for the user. "networkmanager" # Allow the user to manage networks - ]; + ]; }; users.extraUsers.haak = {