summaryrefslogtreecommitdiff
path: root/nix-ontopof-docker2.example.nix
diff options
context:
space:
mode:
authorMike Vink <ivi@vinkies.net>2024-10-18 11:50:09 +0000
committerMike Vink <ivi@vinkies.net>2024-10-18 11:50:09 +0000
commit209da81aff39a5cb1a16986dc4fe3b24715943f6 (patch)
tree62e4146beed1f9a48c9bf6e566b96a6a0b48f815 /nix-ontopof-docker2.example.nix
parent5e3e5ad843e5eb3f69c4e2ce9af241febb6d7d95 (diff)
update linter
Diffstat (limited to 'nix-ontopof-docker2.example.nix')
-rw-r--r--nix-ontopof-docker2.example.nix157
1 files changed, 157 insertions, 0 deletions
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);
+ };
+}