diff options
| -rw-r--r-- | machines/vm-aarch64.nix | 8 | ||||
| -rwxr-xr-x | mut/bin/maimpick | 2 | ||||
| -rw-r--r-- | mut/neovim/fnl/conf/pkgs/lint.fnl | 1 | ||||
| -rw-r--r-- | nix-ontopof-docker2.example.nix | 157 |
4 files changed, 163 insertions, 5 deletions
diff --git a/machines/vm-aarch64.nix b/machines/vm-aarch64.nix index 2b195a4..21c4a06 100644 --- a/machines/vm-aarch64.nix +++ b/machines/vm-aarch64.nix @@ -22,10 +22,10 @@ programs.nix-ld.enable = true; hm.xsession.initExtra = '' - ${pkgs.xorg.xset}/bin/xset r rate 230 30 - ${pkgs.open-vm-tools}/bin/vmware-user-suid-wrapper - wal -R - dwm + ${pkgs.xorg.xset}/bin/xset r rate 230 30 + ${pkgs.open-vm-tools}/bin/vmware-user-suid-wrapper + wal -R + dwm ''; environment.systemPackages = with pkgs; [ kubernetes-helm diff --git a/mut/bin/maimpick b/mut/bin/maimpick index 00a0c98..f2a5f2b 100755 --- a/mut/bin/maimpick +++ b/mut/bin/maimpick @@ -12,7 +12,7 @@ clip() { case "$(printf "a selected area\\ncurrent window\\nfull screen\\na selected area (save)\\ncurrent window (save)\\nfull screen (save)" | dmenu -l 6 -i -p "Screenshot which area?")" in "a selected area") maim -u -s | clip ;; - "current window") + "current window") echo "$(xdotool getactivewindow)" maim -q -d 0.2 -i "$(xdotool getactivewindow)" | clip ;; "full screen") maim -q -d 0.2 | clip ;; diff --git a/mut/neovim/fnl/conf/pkgs/lint.fnl b/mut/neovim/fnl/conf/pkgs/lint.fnl index d9a3c13..078dc3e 100644 --- a/mut/neovim/fnl/conf/pkgs/lint.fnl +++ b/mut/neovim/fnl/conf/pkgs/lint.fnl @@ -16,6 +16,7 @@ {:formatters_by_ft {:python [:ruff_format :isort] :go [:goimports] + :nix [:alejandra] :terraform [:terraform_fmt] :hcl [:terraform_fmt]} :format_on_save diff --git a/nix-ontopof-docker2.example.nix b/nix-ontopof-docker2.example.nix new file mode 100644 index 0000000..a996c32 --- /dev/null +++ b/nix-ontopof-docker2.example.nix @@ -0,0 +1,157 @@ + +{ + description = "Nix packages on top of docker pattern"; + + inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; + + outputs = { self, nixpkgs }: + let + + # System types to support. + supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ]; + + # Helper function to generate an attrset '{ x86_64-linux = f "x86_64-linux"; ... }'. + forAllSystems = nixpkgs.lib.genAttrs supportedSystems; + + # Nixpkgs instantiated for supported system types. + nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; }); + + in + { + + # Requires dirty nixbld with access to docker daemon + packages = forAllSystems (system: + let + pkgs = nixpkgsFor.${system}; + + # from: https://github.com/nix-community/home-manager/blob/70824bb5c790b820b189f62f643f795b1d2ade2e/modules/programs/neovim.nix#L412 + neovimConfig = pkgs.neovimUtils.makeNeovimConfig { + viAlias = true; + vimAlias = true; + withPython3 = false; + withRuby = false; + withNodeJs = false; + extraPython3Packages = _: []; + extraLuaPackages = _: []; + + plugins = with pkgs.vimPlugins; [ + # highlighting + nvim-treesitter.withAllGrammars + playground + gruvbox-material + kanagawa-nvim + lsp_lines-nvim + gitsigns-nvim + vim-helm + lualine-nvim + + # external + oil-nvim + vim-fugitive + venn-nvim + gv-vim + zoxide-vim + obsidian-nvim + go-nvim + + # Coding + fzf-lua + nvim-lspconfig + null-ls-nvim + lsp_signature-nvim + nvim-dap + nvim-dap-ui + nvim-nio + nvim-dap-python + luasnip + vim-test + nvim-lint + vim-surround + conform-nvim + trouble-nvim + vim-easy-align + nvim-comment + + # cmp + nvim-cmp + cmp-cmdline + cmp-nvim-lsp + cmp-buffer + cmp-path + cmp_luasnip + + # conjure + vim-racket + nvim-parinfer + hotpot-nvim + ]; + customRC = ""; + }; + + neovim-package = pkgs.wrapNeovimUnstable pkgs.neovim-unwrapped (neovimConfig + // { + wrapRc = false; + }); + + st-terminfo = with pkgs; stdenv.mkDerivation rec { + pname = "st-terminfo"; + version = "0.9.2"; + + src = fetchurl { + url = "https://dl.suckless.org/st/st-${version}.tar.gz"; + hash = "sha256-ayFdT0crIdYjLzDyIRF6d34kvP7miVXd77dCZGf5SUs="; + }; + + nativeBuildInputs = [ ncurses ]; + + outputs = [ "out" ]; + + buildPhase = '' + echo no build + ''; + installPhase = '' + export HOME=$(mktemp -d) + mkdir -p "$out/share/terminfo" + cat st.info | tic -x -o "$out/share/terminfo" - + ''; + }; + + nvim-container = pkgs.dockerTools.buildImage { + name = "nvim-container"; + tag = "latest"; + copyToRoot = pkgs.buildEnv { + extraPrefix = "/usr"; + name = "neovim-nix-ide-usr"; + paths = with pkgs; [ + neovim-package + docker-client + zoxide + xclip + k9s + st-terminfo + ]; + }; + }; +# # TODO: this is just for me +# RUN curl -sSL https://raw.githubusercontent.com/Shourai/st/refs/heads/master/st.info | tic -x - + in + { + nvim-container-install = pkgs.writeShellScriptBin "nvim-container-install" '' + #!/bin/sh + docker image load -i ${nvim-container} + Dockerfile="/tmp/$(id -u)/nix-ontop-docker" + mkdir -p "$(dirname "$Dockerfile")" + cat <<DOCKERFILE >"$Dockerfile" + FROM pionativedev.azurecr.io/pionative/pnsh-ide-support:latest + COPY --from=nvim-container:latest /usr /usr + DOCKERFILE + docker build -f "$Dockerfile" -t pionativedev.azurecr.io/pionative/pnsh-nvim:latest -- . + ''; + }); + + # The default package for 'nix build'. This makes sense if the + # flake provides only one package or there is a clear "main" + # package. + defaultPackage = forAllSystems (system: self.packages.${system}.neovim-container); + }; +} |
