diff --git a/.envrc b/.envrc index 30da14f..a8d08c3 100644 --- a/.envrc +++ b/.envrc @@ -1,5 +1,8 @@ -export DIRENV_WARN_TIMEOUT=20s +use flake .nix -eval "$(devenv direnvrc)" - -use devenv +if on_git_branch; then + echo + git status --short --branch + echo + git fetch +fi diff --git a/.gitignore b/.gitignore index 785767a..3357b94 100644 --- a/.gitignore +++ b/.gitignore @@ -2,10 +2,3 @@ # Ignore build outputs from performing a nix-build or `nix build` command result result-* - -# Devenv -.devenv* -devenv.local.nix - -# direnv -.direnv diff --git a/.nix/flake.lock b/.nix/flake.lock new file mode 100644 index 0000000..2ac74d2 --- /dev/null +++ b/.nix/flake.lock @@ -0,0 +1,25 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1729665710, + "narHash": "sha256-AlcmCXJZPIlO5dmFzV3V2XF6x/OpNWUV8Y/FMPGd8Z4=", + "rev": "2768c7d042a37de65bb1b5b3268fc987e534c49d", + "revCount": 696158, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/NixOS/nixpkgs/0.1.696158%2Brev-2768c7d042a37de65bb1b5b3268fc987e534c49d/0192bd28-d6c0-735c-ab86-8ab9d12f7d62/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/NixOS/nixpkgs/0.1.%2A.tar.gz" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/.nix/flake.nix b/.nix/flake.nix new file mode 100644 index 0000000..0cbe327 --- /dev/null +++ b/.nix/flake.nix @@ -0,0 +1,32 @@ +{ + description = "A flake editing flake"; + + inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1.*.tar.gz"; + + outputs = { nixpkgs, ... }: + let + supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]; + forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f { + pkgs = import nixpkgs { inherit system; }; + }); + in + { + devShells = forEachSupportedSystem ({ pkgs }: { + default = pkgs.mkShell.override + { + # Override stdenv in order to change compiler: + # stdenv = pkgs.clangStdenv; + } + { + packages = with pkgs; [ + pre-commit + commitizen + ]; + + shellHook = '' + pre-commit install --allow-missing-config --hook-type pre-commit --hook-type commit-msg + ''; + }; + }); + }; +} diff --git a/devenv.lock b/devenv.lock deleted file mode 100644 index 5bda4b0..0000000 --- a/devenv.lock +++ /dev/null @@ -1,103 +0,0 @@ -{ - "nodes": { - "devenv": { - "locked": { - "dir": "src/modules", - "lastModified": 1742320965, - "owner": "cachix", - "repo": "devenv", - "rev": "6bde92766ddd3ee1630029a03d36baddd51934e2", - "type": "github" - }, - "original": { - "dir": "src/modules", - "owner": "cachix", - "repo": "devenv", - "type": "github" - } - }, - "flake-compat": { - "flake": false, - "locked": { - "lastModified": 1733328505, - "owner": "edolstra", - "repo": "flake-compat", - "rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec", - "type": "github" - }, - "original": { - "owner": "edolstra", - "repo": "flake-compat", - "type": "github" - } - }, - "git-hooks": { - "inputs": { - "flake-compat": "flake-compat", - "gitignore": "gitignore", - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1742300892, - "owner": "cachix", - "repo": "git-hooks.nix", - "rev": "ea26a82dda75bee6783baca6894040c8e6599728", - "type": "github" - }, - "original": { - "owner": "cachix", - "repo": "git-hooks.nix", - "type": "github" - } - }, - "gitignore": { - "inputs": { - "nixpkgs": [ - "git-hooks", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1709087332, - "owner": "hercules-ci", - "repo": "gitignore.nix", - "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", - "type": "github" - }, - "original": { - "owner": "hercules-ci", - "repo": "gitignore.nix", - "type": "github" - } - }, - "nixpkgs": { - "locked": { - "lastModified": 1733477122, - "owner": "cachix", - "repo": "devenv-nixpkgs", - "rev": "7bd9e84d0452f6d2e63b6e6da29fe73fac951857", - "type": "github" - }, - "original": { - "owner": "cachix", - "ref": "rolling", - "repo": "devenv-nixpkgs", - "type": "github" - } - }, - "root": { - "inputs": { - "devenv": "devenv", - "git-hooks": "git-hooks", - "nixpkgs": "nixpkgs", - "pre-commit-hooks": [ - "git-hooks" - ] - } - } - }, - "root": "root", - "version": 7 -} diff --git a/devenv.nix b/devenv.nix deleted file mode 100644 index 1a6c6f8..0000000 --- a/devenv.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ pkgs, ... }: - -{ - packages = with pkgs; [ - git - ]; - - git-hooks.hooks = { - commitizen.enable = true; - }; -} diff --git a/devenv.yaml b/devenv.yaml deleted file mode 100644 index 116a2ad..0000000 --- a/devenv.yaml +++ /dev/null @@ -1,15 +0,0 @@ -# yaml-language-server: $schema=https://devenv.sh/devenv.schema.json -inputs: - nixpkgs: - url: github:cachix/devenv-nixpkgs/rolling - -# If you're using non-OSS software, you can set allowUnfree to true. -# allowUnfree: true - -# If you're willing to use a package that's vulnerable -# permittedInsecurePackages: -# - "openssl-1.1.1w" - -# If you have more than one devenv you can merge them -#imports: -# - ./backend diff --git a/flake.lock b/flake.lock index 79d56c8..b3174e7 100644 --- a/flake.lock +++ b/flake.lock @@ -7,11 +7,11 @@ ] }, "locked": { - "lastModified": 1742447757, - "narHash": "sha256-Q0KXcHQmum8L6IzGhhkVhjFMKY6BvYa/rhmLP26Ws8o=", + "lastModified": 1734093295, + "narHash": "sha256-hSwgGpcZtdDsk1dnzA0xj5cNaHgN9A99hRF/mxMtwS4=", "owner": "nix-community", "repo": "home-manager", - "rev": "94605dcadefeaff6b35c8931c9f38e4f4dc7ad0a", + "rev": "66c5d8b62818ec4c1edb3e941f55ef78df8141a8", "type": "github" }, "original": { @@ -22,11 +22,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1742288794, - "narHash": "sha256-Txwa5uO+qpQXrNG4eumPSD+hHzzYi/CdaM80M9XRLCo=", + "lastModified": 1734119587, + "narHash": "sha256-AKU6qqskl0yf2+JdRdD0cfxX4b9x3KKV5RqA6wijmPM=", "owner": "nixos", "repo": "nixpkgs", - "rev": "b6eaf97c6960d97350c584de1b6dcff03c9daf42", + "rev": "3566ab7246670a43abd2ffa913cc62dad9cdf7d5", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 8737aba..0fe7fb7 100644 --- a/flake.nix +++ b/flake.nix @@ -59,6 +59,27 @@ vimwikiPath = "~/vimwiki"; }; }; + "ubuntu" = home-manager.lib.homeManagerConfiguration { + inherit pkgs; + + modules = [ + ./shell + ./git + ./gpg + ./neovim + ./horsch.nix + ]; + + extraSpecialArgs = { + user = "ubuntu"; + userName = "Michael Mandl"; + userEmail = "michael.mandl@horsch.com"; + gpgSigningKey = "088ED38F036C7AF2"; + gpgSSHKeys = [ "AEB2BF3FF9CF9529E9A3C6F1A202D21686FF9278" ]; + theme = "dark"; + vimwikiPath = "~/vimwiki"; + }; + }; }; }; } diff --git a/git/default.nix b/git/default.nix index 5248c25..183cddd 100644 --- a/git/default.nix +++ b/git/default.nix @@ -4,10 +4,6 @@ programs = { less.enable = true; git-credential-oauth.enable = true; - git-worktree-switcher = { - enable = true; - enableZshIntegration = true; - }; git = { enable = true; @@ -30,35 +26,14 @@ }; extraConfig = { - branch.sort = "-committerdate"; + core.editor = "nvim"; + core.pager = "less -FX"; - core = { - editor = "nvim"; - fsmonitor = true; - pager = "less -FX"; - untrackedCache = true; - }; + diff.ignoreSubmodules = "none"; - column.ui = "auto"; - - commit.verbose = true; - - diff = { - algorithm = "histogram"; - colorMoved = "plain"; - ignoreSubmodules = "none"; - mnemonicPrefix = true; - renames = true; - }; - - fetch = { - all = true; - parallel = 8; - prune = true; - pruneTags = true; - recurseSubmodules = true; - writeCommitGraph = true; - }; + fetch.parallel = 8; + fetch.writeCommitGraph = true; + fetch.recurseSubmodules = true; format.pretty = "format:%C(yellow)%h %Cblue%>(12)%ad %C(red)%G? %Cgreen%<(7,trunc)%aN%Cred%d %Creset%s"; @@ -66,45 +41,27 @@ log.date = "relative"; - merge = { - conflictstyle = "zdiff3"; - ff = false; - tool = "nvim"; - }; + merge.ff = false; + merge.tool = "nvim"; - mergetool.nvim.cmd = "nvim -d $BASE $LOCAL $REMOTE $MERGED -c 'DiffviewOpen'"; - mergetool.nvim.trustExitCode = false; + mergetool.nvim.cmd = "nvim -f -c \"Gdiffsplit!\" \"$MERGED\""; mergetool.prompt = false; pager.difftool = true; pull.rebase = true; - push = { - autoSetupRemote = true; - default = "simple"; - followTags = true; - recurseSubmodules = "on-demand"; - }; + push.recurseSubmodules = "on-demand"; - rebase = { - qutoSquash = true; - autoStash = true; - updateRefs = true; - }; + rebase.autostash = true; - rerere = { - autoupdate = true; - enabled = true; - }; + rerere.enabled = true; status.submoduleSummary = true; submodule.fetchJobs = 8; submodule.recurse = true; - tag.sort = "version:refname"; - worktree.guessRemote = true; }; diff --git a/horsch/github.nix b/horsch/github.nix index 92c4697..2015359 100644 --- a/horsch/github.nix +++ b/horsch/github.nix @@ -1,35 +1,11 @@ -{ pkgs, lib, ... }: +{ ... }: { - nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ - "gh-copilot" - ]; + programs.gh = { + enable = true; - programs = { - gh = { - enable = true; - - settings = { - git_protocol = "ssh"; - }; - - extensions = with pkgs; [ - gh-copilot - gh-dash - ]; - }; - - gh-dash = { - enable = true; - - settings = { - defaults = { - preview = { - open = true; - width = 64; - }; - }; - }; + settings = { + git_protocol = "ssh"; }; }; } diff --git a/neovim/default.nix b/neovim/default.nix index c3324d0..d138ddf 100644 --- a/neovim/default.nix +++ b/neovim/default.nix @@ -15,9 +15,6 @@ # auto-close brackets, etc nvim-autopairs - # trailing whirespaces - vim-better-whitespace - # better wildmenu wilder-nvim @@ -41,7 +38,6 @@ nvim-treesitter-textobjects nvim-ts-context-commentstring markdown-preview-nvim # use({ "iamcco/markdown-preview.nvim", run = ":call mkdp#util#install()" }) - render-markdown-nvim toggleterm-nvim nvim-notify comment-nvim @@ -59,7 +55,6 @@ vim-flog git-blame-nvim nvim-web-devicons # used by diffview-nvim - diffview-nvim # snippets friendly-snippets @@ -89,12 +84,6 @@ none-ls-nvim lsp_lines-nvim lsp-inlayhints-nvim - lspkind-nvim - - # Copilot - copilot-lua - copilot-cmp - CopilotChat-nvim # debugging nvim-dap @@ -102,9 +91,6 @@ # vim-wiki vimwiki - - # firenvim - firenvim ]; withNodeJs = true; @@ -126,8 +112,6 @@ nixd nixpkgs-fmt bitbake-language-server - pyright - (python3.withPackages (ps: with ps; [ pep8 autopep8 @@ -153,12 +137,8 @@ require("local_toggleterm") require("local_notify") require("local_comment") - - if vim.g.started_by_firenvim ~= true then - require("local_lualine") - require("local_tabline") - end - + require("local_lualine") + require("local_tabline") require("local_indent-blankline") require("local_gitsigns") require("local_luasnip") @@ -178,34 +158,6 @@ require("nvim-autopairs").setup({}) require("neogen").setup({ snippet_engine = "luasnip" }) - - require("local_firenvim") - - require("CopilotChat").setup({ - highlight_headers = false, - separator = "---", - error_header = "> [!ERROR] Error", - window = { - layout = "float", - width = 0.8, - height = 0.8, - }, - }) - - require("diffview").setup({ - view = { - merge_tool = { - layout = "diff4_mixed", - disable_diagnostics = true, - } - } - }) - - require("render-markdown").setup({ - file_types = { "markdown", "vimwiki", "copilot-chat" }, - }) - - vim.g.strip_whitespace_on_save = 1 ''; }; }; @@ -234,5 +186,4 @@ home.file.".config/nvim/lua/local_dap.lua".source = ./dap.lua; home.file.".config/nvim/lua/local_illuminate.lua".source = ./illuminate.lua; home.file.".config/nvim/lua/local_wilder.lua".source = ./wilder.lua; - home.file.".config/nvim/lua/local_firenvim.lua".source = ./firenvim.lua; } diff --git a/neovim/firenvim.lua b/neovim/firenvim.lua deleted file mode 100644 index 260bbd2..0000000 --- a/neovim/firenvim.lua +++ /dev/null @@ -1,38 +0,0 @@ -if vim.g.started_by_firenvim ~= true then - return -end - -vim.g.firenvim_config = { - globalSettings = { alt = "all" }, - localSettings = { - [".*"] = { - cmdline = "neovim", - content = "text", - priority = 0, - selector = "textarea", - takeover = "never" - } - } -} - -vim.api.nvim_create_autocmd('UIEnter', { - callback = function() - local client = vim.api.nvim_get_chan_info(vim.v.event.chan).client - if client ~= nil and client.name == "Firenvim" then - vim.o.laststatus = 0 - end - end -}) - -vim.api.nvim_create_autocmd({ 'TextChanged', 'TextChangedI' }, { - callback = function() - if vim.g.timer_started == true then - return - end - vim.g.timer_started = true - vim.fn.timer_start(500, function() - vim.g.timer_started = false - vim.cmd('silent write') - end) - end -}) diff --git a/neovim/keymaps.lua b/neovim/keymaps.lua index 310744b..2179b03 100644 --- a/neovim/keymaps.lua +++ b/neovim/keymaps.lua @@ -20,7 +20,6 @@ nnoremap("g", ":0Git") -- vim-flog nnoremap("G", ":Flog -all -date=relative -open-cmd=new") -nnoremap("F", ":Flog -path=% -date=relative -open-cmd=new") -- telescope local telescope = require("telescope.builtin") @@ -68,6 +67,3 @@ vim.cmd('nnoremap * v:hlsearch ? ":nohlsearch" : "*"') -- insert-map jj/jk to escape require("better_escape").setup() - --- open Copilot Chat window -nnoremap("cc", ":lua require('CopilotChat').open()") diff --git a/neovim/lspconfig.lua b/neovim/lspconfig.lua index 51d1fe1..ea85b43 100644 --- a/neovim/lspconfig.lua +++ b/neovim/lspconfig.lua @@ -113,7 +113,6 @@ local servers = { } } }, - ["pyright"] = {}, ["texlab"] = {}, ["yamlls"] = { yaml = { diff --git a/neovim/nvim-cmp.lua b/neovim/nvim-cmp.lua index 1bc45ac..098ce04 100644 --- a/neovim/nvim-cmp.lua +++ b/neovim/nvim-cmp.lua @@ -7,12 +7,6 @@ end local cmp = require("cmp") local luasnip = require("luasnip") -local copilot_lua = require("copilot") -local copilot_cmp = require("copilot_cmp") -local lspkind = require("lspkind") - -copilot_lua.setup({}) -copilot_cmp.setup({}) cmp.setup({ snippet = { @@ -21,7 +15,6 @@ cmp.setup({ end }, sources = cmp.config.sources({ - { name = "copilot" }, { name = "nvim_lsp" }, { name = "nvim_lsp_signature_help" }, { name = "luasnip" }, @@ -63,18 +56,18 @@ cmp.setup({ documentation = cmp.config.window.bordered(), }, formatting = { - format = lspkind.cmp_format({ - mode = "symbol", - maxwidth = { - menu = 50, - abbr = 50, - }, - ellipsis_char = "...", - show_labelDetails = true, - symbol_map = { - Copilot = "", + fields = { "menu", "abbr", "kind" }, + format = function(entry, item) + local menu_icon = { + nvim_lsp = "λ", + luasnip = "⋗", + buffer = "Ω", + path = "🖿", } - }), + + item.menu = menu_icon[entry.source.name] + return item + end, }, }) diff --git a/private.nix b/private.nix index 4944525..9df6b32 100644 --- a/private.nix +++ b/private.nix @@ -1,4 +1,4 @@ -{ pkgs, user, lib, ... }: +{ pkgs, user, ... }: { home.username = user; @@ -13,8 +13,7 @@ thunderbird keepassxc light - # element-desktop-wayland - element-desktop + element-desktop-wayland darktable kubectl kubectx @@ -26,11 +25,6 @@ evince inkscape chromium - zoom-us - ]; - - nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ - "zoom" ]; programs.home-manager.enable = true; @@ -40,6 +34,5 @@ ./kitty.nix ./nextcloud.nix ./sway - ./private/ssh.nix ]; } diff --git a/private/ssh.nix b/private/ssh.nix deleted file mode 100644 index 0a603ba..0000000 --- a/private/ssh.nix +++ /dev/null @@ -1,19 +0,0 @@ -{ ... }: - -{ - programs = { - ssh = { - enable = true; - matchBlocks = { - tc-0x = { - host = "tc-*"; - user = "root"; - }; - ed-0x = { - host = "ed-*"; - user = "root"; - }; - }; - }; - }; -} diff --git a/shell/default.nix b/shell/default.nix index 82caa42..dcddb25 100644 --- a/shell/default.nix +++ b/shell/default.nix @@ -1,13 +1,11 @@ { pkgs, ... }: { home.packages = with pkgs; [ - devenv difftastic dust htop jq nh - sshfs unzip xclip ]; diff --git a/shell/direnv.nix b/shell/direnv.nix index bfff889..005868d 100644 --- a/shell/direnv.nix +++ b/shell/direnv.nix @@ -4,7 +4,6 @@ programs = { direnv = { enable = true; - silent = true; enableZshIntegration = true; nix-direnv.enable = true; }; diff --git a/shell/shell_aliases.nix b/shell/shell_aliases.nix index 1ab320f..2b39161 100644 --- a/shell/shell_aliases.nix +++ b/shell/shell_aliases.nix @@ -7,7 +7,7 @@ gs = "git status"; gd = "git diff"; gf = "git fetch"; - gfg = "git fetch --no-recurse-submodules && git graph --all --max-count 32"; + gfp = "git fetch --prune"; k = "kubectl"; ww = "nvim -c VimwikiIndex"; };