From 52ea8a9f459735c057cf286ccede8eecd291b10f Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Fri, 20 Oct 2023 16:28:35 +0300 Subject: [PATCH 1/3] flake: provide containerized builds --- flake/packages.nix | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/flake/packages.nix b/flake/packages.nix index a9937b8..cb46e74 100644 --- a/flake/packages.nix +++ b/flake/packages.nix @@ -1,6 +1,5 @@ {inputs, ...}: { perSystem = { - self', system, config, pkgs, @@ -19,16 +18,43 @@ docs-manpages = docs.manPages; docs-json = docs.options.json; + # Build and open the built manual in your system browser docs-html-wrapped = pkgs.writeScriptBin "docs-html-wrapped" '' #!${pkgs.stdenv.shell} # use xdg-open to open the docs in the browser ${pkgs.xdg_utils}/bin/xdg-open ${docs.manual.html} ''; - # nvim configs + # Exposed neovim configurations nix = config.legacyPackages.neovim-nix; maximal = config.legacyPackages.neovim-maximal; default = config.legacyPackages.neovim-nix; + + # Publisged docker images + docker-nix = let + inherit (pkgs) bash gitFull buildEnv dockerTools; + inherit (config.legacyPackages) neovim-nix; + in + dockerTools.buildImage { + name = "neovim-flake-nix"; + tag = "latest"; + + copyToRoot = buildEnv { + name = "neovim-root"; + pathsToLink = ["/bin"]; + paths = [ + neovim-nix + gitFull + bash + ]; + }; + + config = { + Cmd = ["${neovim-nix}/bin/nvim"]; + WorkingDir = "/home/neovim/demo"; + Volumes = {"/home/neovim/demo" = {};}; + }; + }; } // ( if !(builtins.elem system ["aarch64-darwin" "x86_64-darwin"]) From 75e24e000bb66c740c17c5912bad181cb7e221a7 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Sun, 22 Oct 2023 00:45:54 +0300 Subject: [PATCH 2/3] CI: build and publish exposed docker package --- .github/workflows/docker.yml | 58 ++++++++++++++++++++++++++++++++++++ flake/packages.nix | 4 +-- 2 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/docker.yml diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..06c3944 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,58 @@ +name: "Publish Docker Image" +on: + workflow_dispatch: + pull_request: + branches: + - main + tags: + - "v*" + push: + branches: + - main + tags: + - "v*" + +jobs: + build-docker-image: + name: "Build Docker Image" + runs-on: ubuntu-latest + + permissions: + contents: read + packages: write + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install Nix + uses: DeterminateSystems/nix-installer-action@main + - name: Magic Nix Cache + uses: DeterminateSystems/magic-nix-cache-action@main + + - name: Build Docker Image + run: nix build .#docker-nix --print-build-logs + + - name: Load & Tag Built Docker Image + run: | + docker load -i result && + docker tag neovim-flake:latest notashelf/neovim-flake:latest + + - name: Log into DockerHub + uses: docker/login-action@master + with: + username: notashelf + password: ${{ secrets.DOCKER_ACCESS_TOKEN }} + + - name: Push to DockerHub + run: docker push notashelf/neovim-flake:latest + + - name: Log into ghcr + uses: docker/login-action@master + with: + registry: "ghcr.io" + username: "${{ github.actor }}" + password: "${{ secrets.GITHUB_TOKEN }}" + + - name: Publish Docker Image (Github Packages) + run: docker push notashelf/neovim-flake:latest diff --git a/flake/packages.nix b/flake/packages.nix index cb46e74..bcf11e9 100644 --- a/flake/packages.nix +++ b/flake/packages.nix @@ -30,13 +30,13 @@ maximal = config.legacyPackages.neovim-maximal; default = config.legacyPackages.neovim-nix; - # Publisged docker images + # Published docker images docker-nix = let inherit (pkgs) bash gitFull buildEnv dockerTools; inherit (config.legacyPackages) neovim-nix; in dockerTools.buildImage { - name = "neovim-flake-nix"; + name = "neovim-flake"; tag = "latest"; copyToRoot = buildEnv { From 7af120cf0d5f8f37dbb51e040104ff06961d5b0a Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Mon, 23 Oct 2023 17:57:41 +0300 Subject: [PATCH 3/3] docs/README: add docker usage instructions --- .github/README.md | 64 +++++++++++++++++++++++++++++++++++------------ 1 file changed, 48 insertions(+), 16 deletions(-) diff --git a/.github/README.md b/.github/README.md index ca5bfb5..780e34b 100644 --- a/.github/README.md +++ b/.github/README.md @@ -62,13 +62,14 @@ ### Using `nix` CLI -If you would like to try out the configuration before even thinking about installing it, you can run: +If you would like to try out the configuration before even thinking about installing it, you can run the following command ```console nix run github:notashelf/neovim-flake ``` -to get a feel for the base configuration. The package exposes `.#nix` as the default package. You may use `.#nix`, `.#tidal` or `.#maximal` to get different configurations. +This will get you a feel for the base configuration and UI design. The flake exposes `#nix` as the default package, providing minimal language support and various +utilities.You may also use `#nix`, `#tidal` or `#maximal` to get try out different configurations. It is as simple as changing the target output to get a different configuration. For example, to get a configuration with `tidal` support, run: @@ -76,37 +77,64 @@ It is as simple as changing the target output to get a different configuration. nix run github:notashelf/neovim-flake#tidal ``` -Similar instructions will apply for `nix profile install`. +Similar instructions will apply for `nix profile install`. However, you are recommended to instead use the module system as described in the manual. -P.S. The `maximal` configuration is _massive_ and will take a while to build. To get a feel for the configuration, use the default `nix` or `tidal` configurations. +> [!NOTE] +> The `maximal` configuration is _massive_ and will take a while to build. To get a feel for the configuration, use the default `nix` or `tidal` configurations. +> Should you choose to try out the `maximal` configuration, using the binary cache as described in the manual is _strongly_ recommended. + +### Docker + +As of version 0.5, an image for the `nix` output is published to Dockerhub and GitHub packages with each tagged release. If you do not have Nix installed +on your system, you may run neovim within a container using your favorite tool. +The following command will open the current directory in neovim with necessary tools bootstrapped. + +```console +docker run -v `pwd`:/home/neovim/demo --rm -it notashelf/neovim-flake:latest +``` + +The available registeres are `ghcr.io` and `dockerhub` for the time being. Adjust to your liking. ## Documentation -See the [neovim-flake Manual](https://notashelf.github.io/neovim-flake/) for detailed installation guide(s), configuration, available options, and release notes. +See the [neovim-flake Manual](https://notashelf.github.io/neovim-flake/) for detailed installation guides, configurations, available options, release notes +and more. -If you want to dive right into trying **neovim-flake** you can get a fully featured configuration with `nix` language support by running: +If you want to dive right into trying **neovim-flake** you can get a fully featured configuration with `nix` +language support by running: ```console nix run github:notashelf/neovim-flake ``` -Please create an issue on the [issue tracker](../../../issues) if you find the documentation lacking or confusing. I also appreciate any contributions to the documentation. +Please create an issue on the [issue tracker](../../../issues) if you find the documentation lacking or confusing. +I also appreciate any contributions to the documentation. ## Help -You can create an issue on the [issue tracker](../../../issues) to ask questions or report bugs. I am not yet on spaces like matrix or IRC, so please use the issue tracker for now. +You can create an issue on the [issue tracker](../../../issues) to ask questions or report bugs. +I am not yet on spaces like matrix or IRC, so please use the issue tracker for now. ## Contributing -I am always looking for new ways to help improve this flake. If you would like to contribute, please read the [contributing guide](CONTRIBUTING.md) before submitting a pull request. You can also create an issue on the [issue tracker](../../../issues) before submitting a pull request if you would like to discuss a feature or bug fix. +I am always looking for new ways to help improve this flake. If you would like to contribute, please read +the [contributing guide](CONTRIBUTING.md) before submitting a pull request. You can also create an +issue on the [issue tracker](../../../issues) before submitting a pull request if you would like to discuss +a feature or bug fix. ## Philosophy -The philosophy behind this flake configuration is to create an easily configurable and reproducible Neovim environment. While it does sacrifice in size -(which I know some users will find _disagreeable_), it offers a lot of flexibility and customizability in exchange for the large size of the flake inputs. -The KISS (Keep it simple, stupid) principle has been abandoned here, however, you _can_ ultimately leverage the flexibility of this flake to declare a configuration that follows KISS principles, it is very easy to bring your own plugins and configurations from non-nix. What this flake is meant to be does eventually fall into your hands. Whether you are a developer, writer, or live coder, you can quickly craft a config that suits every project's need. Think of it like a distributionof Neovim that takes advantage of pinning vim plugins and third party dependencies (such as tree-sitter grammars, language servers, and more). +The philosophy behind this flake configuration is to create an easily configurable and reproducible Neovim environment. +While it does sacrifice in size (which I know some users will find _disagreeable_), it offers a lot of flexibility and customizability in +exchange for the large size of the flake inputs. The "KISS" (Keep it simple, stupid) principle has mostly been abandoned here, however, you _can_ +ultimately leverage the flexibility of this flake to declare a configuration that follows KISS principles, as it is very easy to bring your +own plugins and configurations from non-nix. What this flake is meant to be does eventually fall into your hands. Whether you are a +developer, writer, or live coder, you can quickly craft a config that suits every project's need. Think of it like a distribution of Neovim that you have +full control over. A distribution that takes advantage of pinning vim plugins and third party dependencies (such as tree-sitter grammars, language servers, and more). -One should never get a broken config when setting options. If setting multiple options results in a broken Neovim, file an issue! Each plugin knows when another plugin which allows for smart configuration of keybindings and automatic setup of things like completion sources and languages. +One should never get a broken config when setting options. If setting multiple options results in a broken Neovim, file an issue! +Each plugin knows when another plugin which allows for smart configuration of keybindings and automatic setup of things +like completion sources and languages. ## FAQ @@ -119,17 +147,21 @@ instead of the `maximal` output. This will reduce size by a lot, but you will lo **Q**: Will you try to make this flake smaller?
-**A**: Yes. As a matter of fact, I am actively working on making this flake smaller. Unfortunately the process of providing everything possible by itself makes the flake large. Best I can do is to optimize the flake as much as possible by selecting plugins that are small and fast. And the binary cache, so at least you don't have to build it from source. +**A**: Yes. As a matter of fact, I am actively working on making this flake smaller. Unfortunately the process of providing everything +possible by itself makes the flake large. Best I can do is to optimize the flake as much as possible by selecting plugins that +are small and fast. And the binary cache, so at least you don't have to build it from source.

**Q**: Will you use a plugin manager/language server installer?
-**A**: No. If you feel the need to ask that question, then you have missed the whole point of using nix and ultimately this flake. The whole reason we use nix is to be able to handle EVERYTHING declaratively, well including the LSP and plugin installations. +**A**: No. If you feel the need to ask that question, then you have missed the whole point of using nix and ultimately this flake. +The whole reason we use nix is to be able to handle EVERYTHING declaratively, well including the LSP and plugin installations.

**Q**: Can you add _X_?
-**A**: Maybe. Open an issue using the appropriate template and I will consider it. I do not intend to add _every plugin that is in existence_, but I will consider it, should it offer something useful to the flake. +**A**: Maybe. Open an issue using the appropriate template and I will consider it. I do not intend to +add _every plugin that is in existence_, but I will consider it, should it offer something useful to the flake. ## Credits