├── .envrc ├── .github ├── dependabot.yml └── workflows │ ├── nix.yml │ ├── update-flake-lock-individual.yml │ ├── update-flake-lock-zellij.yml │ └── update-flake-lock.yml ├── .gitignore ├── .mergify.yml ├── LICENSE.md ├── README.md ├── default-plugins.nix ├── default.nix ├── external-plugins.nix ├── flake.lock ├── flake.nix ├── justfile ├── shell.nix └── treefmt.toml /.envrc: -------------------------------------------------------------------------------- 1 | use_flake 2 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: "github-actions" 4 | directory: "/" 5 | schedule: 6 | interval: "weekly" 7 | -------------------------------------------------------------------------------- /.github/workflows/nix.yml: -------------------------------------------------------------------------------- 1 | name: "nix" 2 | on: 3 | pull_request: 4 | branches: [ main ] 5 | push: 6 | branches: [ main ] 7 | 8 | jobs: 9 | check: 10 | name: "nix flake check" 11 | runs-on: ubuntu-latest 12 | steps: 13 | - uses: actions/checkout@v4 14 | - uses: cachix/install-nix-action@v31 15 | with: 16 | extra_nix_config: | 17 | access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} 18 | - uses: DeterminateSystems/magic-nix-cache-action@v9 19 | with: 20 | diagnostic-endpoint: "" 21 | - uses: cachix/cachix-action@v16 22 | with: 23 | name: kenji 24 | # If you chose API tokens for write access OR if you have a private cache 25 | authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' 26 | - name: "nix flake check" 27 | run: nix flake check -Lvv 28 | build: 29 | name: "nix build" 30 | runs-on: ubuntu-latest 31 | steps: 32 | - uses: actions/checkout@v4 33 | - uses: cachix/install-nix-action@v31 34 | with: 35 | extra_nix_config: | 36 | access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} 37 | - uses: DeterminateSystems/magic-nix-cache-action@v9 38 | with: 39 | diagnostic-endpoint: "" 40 | - uses: cachix/cachix-action@v16 41 | with: 42 | name: kenji 43 | # If you chose API tokens for write access OR if you have a private cache 44 | authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' 45 | - name: "nix build" 46 | run: nix build -Lvvv --no-update-lock-file --show-trace --print-build-logs 47 | nix-develop: 48 | name: "nix develop" 49 | runs-on: ubuntu-latest 50 | steps: 51 | - uses: actions/checkout@v4 52 | - uses: DeterminateSystems/magic-nix-cache-action@v9 53 | with: 54 | diagnostic-endpoint: "" 55 | - uses: cachix/install-nix-action@v31 56 | with: 57 | extra_nix_config: | 58 | access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} 59 | - uses: cachix/cachix-action@v16 60 | with: 61 | name: kenji 62 | # If you chose API tokens for write access OR if you have a private cache 63 | authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' 64 | - name: "nix develop" 65 | run: nix develop -Lvvv 66 | format: 67 | name: "treefmt" 68 | runs-on: ubuntu-latest 69 | steps: 70 | - uses: actions/checkout@v4 71 | - uses: cachix/install-nix-action@v31 72 | with: 73 | extra_nix_config: | 74 | access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} 75 | - uses: DeterminateSystems/magic-nix-cache-action@v9 76 | with: 77 | diagnostic-endpoint: "" 78 | - uses: cachix/cachix-action@v16 79 | with: 80 | name: kenji 81 | # If you chose API tokens for write access OR if you have a private cache 82 | authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' 83 | - name: "nix shell treefmt" 84 | run: nix develop .#fmtShell --command treefmt --fail-on-change 85 | actionlint: 86 | name: "actionlint" 87 | runs-on: ubuntu-latest 88 | steps: 89 | - uses: actions/checkout@v4 90 | - uses: cachix/install-nix-action@v31 91 | with: 92 | extra_nix_config: | 93 | access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} 94 | - uses: DeterminateSystems/magic-nix-cache-action@v9 95 | with: 96 | diagnostic-endpoint: "" 97 | - uses: cachix/cachix-action@v16 98 | with: 99 | name: kenji 100 | # If you chose API tokens for write access OR if you have a private cache 101 | authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' 102 | - name: "nix shell actionlint" 103 | run: nix develop .#actionlintShell --command actionlint 104 | -------------------------------------------------------------------------------- /.github/workflows/update-flake-lock-individual.yml: -------------------------------------------------------------------------------- 1 | name: update-flake-lock-individual 2 | # This workflow is intended for individual updates of the inputs, 3 | # in case the update-flake-lock action fails. 4 | on: 5 | workflow_dispatch: # allows manual triggering 6 | schedule: 7 | - cron: '0 7 * * SUN' # runs weekly on sunday at 07:00 8 | 9 | jobs: 10 | input-lockfile-flake-utils: 11 | runs-on: ubuntu-latest 12 | environment: "update" 13 | steps: 14 | - name: Checkout repository 15 | uses: actions/checkout@v4 16 | - name: Install Nix 17 | uses: cachix/install-nix-action@v31 18 | with: 19 | extra_nix_config: | 20 | access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} 21 | - name: Update flake.lock 22 | uses: DeterminateSystems/update-flake-lock@v24 23 | with: 24 | token: ${{ secrets.GH_TOKEN_FOR_UPDATES }} 25 | pr-labels: | 26 | dependencies 27 | nix 28 | inputs: flake-utils 29 | branch: update_input_action_flake_utils 30 | pr-title: "flake.lock: update flake-utils" 31 | input-lockfile-nixpkgs: 32 | runs-on: ubuntu-latest 33 | environment: "update" 34 | steps: 35 | - name: Checkout repository 36 | uses: actions/checkout@v4 37 | - name: Install Nix 38 | uses: cachix/install-nix-action@v31 39 | with: 40 | extra_nix_config: | 41 | access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} 42 | - name: Update flake.lock 43 | uses: DeterminateSystems/update-flake-lock@v24 44 | with: 45 | token: ${{ secrets.GH_TOKEN_FOR_UPDATES }} 46 | pr-labels: | 47 | dependencies 48 | nix 49 | inputs: nixpkgs 50 | branch: update_input_action_nixpkgs 51 | pr-title: "flake.lock: update nixpkgs" 52 | input-lockfile-rust-overlay: 53 | runs-on: ubuntu-latest 54 | environment: "update" 55 | steps: 56 | - name: Checkout repository 57 | uses: actions/checkout@v4 58 | - name: Install Nix 59 | uses: cachix/install-nix-action@v31 60 | with: 61 | extra_nix_config: | 62 | access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} 63 | - name: Update flake.lock 64 | uses: DeterminateSystems/update-flake-lock@v24 65 | with: 66 | token: ${{ secrets.GH_TOKEN_FOR_UPDATES }} 67 | pr-labels: | 68 | dependencies 69 | nix 70 | inputs: rust-overlay 71 | branch: update_input_action_rust_overlay 72 | pr-title: "flake.lock: update rust-overlay" 73 | -------------------------------------------------------------------------------- /.github/workflows/update-flake-lock-zellij.yml: -------------------------------------------------------------------------------- 1 | name: update-flake-lock-zellij 2 | on: 3 | workflow_dispatch: # allows manual triggering 4 | schedule: 5 | - cron: '0 0 * * *' # runs daily at 00:00 6 | 7 | jobs: 8 | lockfile: 9 | runs-on: ubuntu-latest 10 | environment: update 11 | steps: 12 | - name: Checkout repository 13 | uses: actions/checkout@v4 14 | - name: Install Nix 15 | uses: cachix/install-nix-action@v31 16 | with: 17 | extra_nix_config: | 18 | access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} 19 | - uses: DeterminateSystems/magic-nix-cache-action@v9 20 | with: 21 | diagnostic-endpoint: "" 22 | - name: Update flake.lock zellij input 23 | uses: DeterminateSystems/update-flake-lock@v24 24 | with: 25 | token: ${{ secrets.GH_TOKEN_FOR_UPDATES }} 26 | inputs: zellij 27 | branch: update_input_action_zellij 28 | pr-title: "flake.lock: update zellij" 29 | pr-labels: | 30 | dependencies 31 | automated 32 | nix 33 | # - name: setup git 34 | # run: | 35 | # set -xe 36 | # git config user.name github-actions[bot] 37 | # git config user.email 41898282+github-actions[bot]@users.noreply.github.com 38 | # nix build .#zellij.src.outPath 39 | # cp -r -L ./result ./vendor 40 | # sudo chmod -R a+w ./vendor/ 41 | # nix develop --command cargo update --manifest-path ./vendor/Cargo.toml 42 | # git add ./vendor/Cargo.lock 43 | # git commit -m "$(date)" 44 | # git push 45 | # shell: bash 46 | 47 | -------------------------------------------------------------------------------- /.github/workflows/update-flake-lock.yml: -------------------------------------------------------------------------------- 1 | name: update-flake-lock 2 | on: 3 | workflow_dispatch: # allows manual triggering 4 | schedule: 5 | - cron: '0 0 * * 0' # runs weekly on Sunday at 00:00 6 | 7 | jobs: 8 | lockfile: 9 | runs-on: ubuntu-latest 10 | environment: update 11 | steps: 12 | - name: Checkout repository 13 | uses: actions/checkout@v4 14 | - name: Install Nix 15 | uses: cachix/install-nix-action@v31 16 | with: 17 | extra_nix_config: | 18 | access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} 19 | - name: Update flake.lock 20 | uses: DeterminateSystems/update-flake-lock@v24 21 | with: 22 | token: ${{ secrets.GH_TOKEN_FOR_UPDATES }} 23 | pr-labels: | 24 | dependencies 25 | automated 26 | nix 27 | 28 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | zellij/ 2 | zellij-plugins/ 3 | zellij-upstream/ 4 | target/ 5 | result 6 | result/ 7 | .cargo/ 8 | .direnv/ 9 | -------------------------------------------------------------------------------- /.mergify.yml: -------------------------------------------------------------------------------- 1 | pull_request_rules: 2 | - name: automatic merge on CI success 3 | conditions: 4 | - check-success= nix flake check 5 | - check-success= nix build 6 | - check-success= nix develop 7 | - check-success= treefmt 8 | - check-success= actionlint 9 | - or: 10 | - author=a-kenji 11 | - author=a-kenji-buildbot 12 | - author=github-actions[bot] 13 | - or: 14 | - "title=flake.lock: Update" 15 | - "title=flake.lock: update zellij" 16 | - "title=flake.lock: update rust-overlay" 17 | - "title=flake.lock: update flake-utils" 18 | - "title=flake.lock: update nixpkgs" 19 | actions: 20 | merge: 21 | method: merge 22 | delete_head_branch: {} 23 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) Alex Kenji Berthold 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Zellij Nix Environment 2 | supports `direnv && lorri` 3 | 4 | - dependencies: 5 | have `nix` installed (with flake support) 6 | 7 | # usage: 8 | 9 | - devshell 10 | `nix develop` 11 | 12 | - run package 13 | `nix run` 14 | 15 | - build package 16 | `nix build` 17 | 18 | The default outputs will build the plugins from source, making them patchable. 19 | For example `packages.x86_64-linux.default` and `plugins.x86_64-linux.compact-bar. 20 | ` 21 | 22 | # Outputs 23 | ```bash 24 | nix flake show github:a-kenji/zellij-nix 25 | ``` 26 | 27 | Example output adjusted (systems omitted & commented): 28 | ``` 29 | github:a-kenji/zellij-nix 30 | ├───apps 31 | │ └───x86_64-linux 32 | │ ├───default: app 33 | │ └───zellij-upstream: app 34 | ├───devShells 35 | │ └───x86_64-linux 36 | │ ├───default: development environment 'zellij' 37 | ├───overlays 38 | │ ├───default: Nixpkgs overlay 39 | │ └───nightly: Nixpkgs overlay 40 | ├───packages 41 | │ └───x86_64-linux 42 | │ ├───default: package 'zellij' 43 | │ ├───zellij: package 'zellij' # Builds plugins from source, making them patcheable. 44 | │ └───zellij-upstream: package 'zellij' # Doesn't build plugins. 45 | └───plugins: unknown 46 | └───x86_64-linux 47 | ├───compact-bar: package 'compact-bar' 48 | ├───status-bar: package 'status-bar' 49 | ├───session-manager: package 'session-manager' 50 | ├───strider: package 'strider' 51 | └───tab-bar: package 'tab-bar' 52 | ``` 53 | -------------------------------------------------------------------------------- /default-plugins.nix: -------------------------------------------------------------------------------- 1 | { 2 | cargo, 3 | cargoLock, 4 | pkgs, 5 | protobuf, 6 | rustc, 7 | src, 8 | stdenv, 9 | binaryen, 10 | optimize ? true, 11 | wasmTarget ? "wasm32-wasip1", 12 | }: 13 | let 14 | makeDefaultPlugin = 15 | name: 16 | (pkgs.makeRustPlatform { inherit cargo rustc; }).buildRustPackage { 17 | inherit 18 | cargoLock 19 | name 20 | src 21 | stdenv 22 | ; 23 | nativeBuildInputs = [ 24 | binaryen 25 | protobuf 26 | ]; 27 | buildPhase = '' 28 | cargo build --package ${name} --release --target=${wasmTarget} 29 | mkdir -p $out/bin; 30 | ''; 31 | installPhase = 32 | if optimize then 33 | '' 34 | wasm-opt \ 35 | -Oz target/${wasmTarget}/release/${name}.wasm \ 36 | -o $out/bin/${name}.wasm \ 37 | --enable-bulk-memory 38 | '' 39 | else 40 | '' 41 | mv \ 42 | target/${wasmTarget}/release/${name}.wasm \ 43 | $out/bin/${name}.wasm 44 | ''; 45 | doCheck = false; 46 | }; 47 | in 48 | { 49 | compact-bar = makeDefaultPlugin "compact-bar"; 50 | configuration = makeDefaultPlugin "configuration"; 51 | session-manager = makeDefaultPlugin "session-manager"; 52 | status-bar = makeDefaultPlugin "status-bar"; 53 | strider = makeDefaultPlugin "strider"; 54 | tab-bar = makeDefaultPlugin "tab-bar"; 55 | } 56 | -------------------------------------------------------------------------------- /default.nix: -------------------------------------------------------------------------------- 1 | (import ( 2 | let 3 | lock = builtins.fromJSON (builtins.readFile ./flake.lock); 4 | in 5 | fetchTarball { 6 | url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz"; 7 | sha256 = lock.nodes.flake-compat.locked.narHash; 8 | } 9 | ) { src = ./.; }).defaultNix 10 | -------------------------------------------------------------------------------- /external-plugins.nix: -------------------------------------------------------------------------------- 1 | { 2 | cargo, 3 | cargoLock, 4 | pkgs, 5 | protobuf, 6 | rustc, 7 | src, 8 | stdenv, 9 | binaryen, 10 | optimize ? true, 11 | wasmTarget ? "wasm32-wasip1", 12 | }: 13 | let 14 | makePlugin = 15 | name: 16 | (pkgs.makeRustPlatform { inherit cargo rustc; }).buildRustPackage { 17 | inherit 18 | cargoLock 19 | name 20 | src 21 | stdenv 22 | ; 23 | nativeBuildInputs = [ 24 | binaryen 25 | protobuf 26 | ]; 27 | buildPhase = '' 28 | cargo build --package ${name} --release --target=${wasmTarget} 29 | mkdir -p $out/bin; 30 | ''; 31 | installPhase = 32 | if optimize then 33 | '' 34 | wasm-opt \ 35 | -Oz target/${wasmTarget}/release/${name}.wasm \ 36 | -o $out/bin/${name}.wasm \ 37 | --enable-bulk-memory 38 | substituteInPlace dev.kdl --replace 'file:target/${wasmTarget}/debug/multitask.wasm' "${placeholder "out"}" 39 | mkdir -p $out/share; 40 | cp dev.kdl $out/share/multitask.kdl 41 | '' 42 | else 43 | '' 44 | mv \ 45 | target/${wasmTarget}/release/${name}.wasm \ 46 | $out/bin/${name}.wasm 47 | ''; 48 | doCheck = false; 49 | }; 50 | in 51 | { 52 | multitask = makePlugin "multitask"; 53 | } 54 | -------------------------------------------------------------------------------- /flake.lock: -------------------------------------------------------------------------------- 1 | { 2 | "nodes": { 3 | "flake-compat": { 4 | "flake": false, 5 | "locked": { 6 | "lastModified": 1733328505, 7 | "narHash": "sha256-NeCCThCEP3eCl2l/+27kNNK7QrwZB1IJCrXfrbv5oqU=", 8 | "owner": "edolstra", 9 | "repo": "flake-compat", 10 | "rev": "ff81ac966bb2cae68946d5ed5fc4994f96d0ffec", 11 | "type": "github" 12 | }, 13 | "original": { 14 | "owner": "edolstra", 15 | "repo": "flake-compat", 16 | "type": "github" 17 | } 18 | }, 19 | "flake-utils": { 20 | "inputs": { 21 | "systems": "systems" 22 | }, 23 | "locked": { 24 | "lastModified": 1731533236, 25 | "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", 26 | "owner": "numtide", 27 | "repo": "flake-utils", 28 | "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", 29 | "type": "github" 30 | }, 31 | "original": { 32 | "owner": "numtide", 33 | "repo": "flake-utils", 34 | "type": "github" 35 | } 36 | }, 37 | "multitask": { 38 | "flake": false, 39 | "locked": { 40 | "lastModified": 1742663229, 41 | "narHash": "sha256-D0wq5D8VFyfe0/ShLWS4Gs5fH0e78P79kdHjypelHas=", 42 | "owner": "imsnif", 43 | "repo": "multitask", 44 | "rev": "70d95002e040e2f2a0e90b5262f39f220219a9d7", 45 | "type": "github" 46 | }, 47 | "original": { 48 | "owner": "imsnif", 49 | "repo": "multitask", 50 | "type": "github" 51 | } 52 | }, 53 | "nixpkgs": { 54 | "locked": { 55 | "lastModified": 1748460289, 56 | "narHash": "sha256-7doLyJBzCllvqX4gszYtmZUToxKvMUrg45EUWaUYmBg=", 57 | "owner": "nixos", 58 | "repo": "nixpkgs", 59 | "rev": "96ec055edbe5ee227f28cdbc3f1ddf1df5965102", 60 | "type": "github" 61 | }, 62 | "original": { 63 | "owner": "nixos", 64 | "ref": "nixos-unstable", 65 | "repo": "nixpkgs", 66 | "type": "github" 67 | } 68 | }, 69 | "root": { 70 | "inputs": { 71 | "flake-compat": "flake-compat", 72 | "flake-utils": "flake-utils", 73 | "multitask": "multitask", 74 | "nixpkgs": "nixpkgs", 75 | "rust-overlay": "rust-overlay", 76 | "zellij": "zellij" 77 | } 78 | }, 79 | "rust-overlay": { 80 | "inputs": { 81 | "nixpkgs": [ 82 | "nixpkgs" 83 | ] 84 | }, 85 | "locked": { 86 | "lastModified": 1748746145, 87 | "narHash": "sha256-bwkCAK9pOyI2Ww4Q4oO1Ynv7O9aZPrsIAMMASmhVGp4=", 88 | "owner": "oxalica", 89 | "repo": "rust-overlay", 90 | "rev": "12a0d94a2f2b06714f747ab97b2fa546f46b460c", 91 | "type": "github" 92 | }, 93 | "original": { 94 | "owner": "oxalica", 95 | "repo": "rust-overlay", 96 | "type": "github" 97 | } 98 | }, 99 | "systems": { 100 | "locked": { 101 | "lastModified": 1681028828, 102 | "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", 103 | "owner": "nix-systems", 104 | "repo": "default", 105 | "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", 106 | "type": "github" 107 | }, 108 | "original": { 109 | "owner": "nix-systems", 110 | "repo": "default", 111 | "type": "github" 112 | } 113 | }, 114 | "zellij": { 115 | "flake": false, 116 | "locked": { 117 | "lastModified": 1746018011, 118 | "narHash": "sha256-t5yplpwSuE8LwA56R8umFqo4fE/VtxUsFIyB/brm+uI=", 119 | "owner": "zellij-org", 120 | "repo": "zellij", 121 | "rev": "226f5dc854e26ddfa4dd087f6e4cb99b0230da74", 122 | "type": "github" 123 | }, 124 | "original": { 125 | "owner": "zellij-org", 126 | "repo": "zellij", 127 | "type": "github" 128 | } 129 | } 130 | }, 131 | "root": "root", 132 | "version": 7 133 | } 134 | -------------------------------------------------------------------------------- /flake.nix: -------------------------------------------------------------------------------- 1 | { 2 | description = "Zellij Nix Environment"; 3 | 4 | inputs = { 5 | multitask.url = "github:imsnif/multitask"; 6 | multitask.flake = false; 7 | nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; 8 | rust-overlay.url = "github:oxalica/rust-overlay"; 9 | rust-overlay.inputs.nixpkgs.follows = "nixpkgs"; 10 | 11 | flake-compat.url = "github:edolstra/flake-compat"; 12 | flake-compat.flake = false; 13 | 14 | flake-utils.url = "github:numtide/flake-utils"; 15 | 16 | zellij.url = "github:zellij-org/zellij"; 17 | zellij.flake = false; 18 | }; 19 | 20 | outputs = 21 | { 22 | self, 23 | nixpkgs, 24 | zellij, 25 | multitask, 26 | rust-overlay, 27 | flake-utils, 28 | ... 29 | }: 30 | let 31 | src = zellij; 32 | cargoTOML = builtins.fromTOML (builtins.readFile (src + "/Cargo.toml")); 33 | inherit (cargoTOML.package) version name; 34 | cargoLock = { 35 | lockFile = builtins.path { 36 | path = src + "/Cargo.lock"; 37 | name = "Cargo.lock"; 38 | }; 39 | allowBuiltinFetchGit = true; 40 | }; 41 | make-zellij = 42 | { 43 | makeRustPlatform, 44 | lib, 45 | stdenv, 46 | pkg-config, 47 | protobuf, 48 | openssl, 49 | perl, 50 | rust-bin, 51 | darwin, 52 | patchPlugins ? true, 53 | }: 54 | let 55 | rustToolchainTOML = rust-bin.fromRustupToolchainFile (src + /rust-toolchain.toml); 56 | rustc = rustToolchainTOML; 57 | cargo = rustToolchainTOML; 58 | in 59 | (makeRustPlatform { inherit cargo rustc; }).buildRustPackage { 60 | inherit 61 | cargoLock 62 | name 63 | src 64 | stdenv 65 | version 66 | ; 67 | nativeBuildInputs = [ 68 | pkg-config 69 | protobuf 70 | perl 71 | ]; 72 | 73 | buildInputs = 74 | [ 75 | openssl 76 | protobuf 77 | ] 78 | ++ lib.optionals stdenv.isDarwin ( 79 | with darwin.apple_sdk.frameworks; 80 | [ 81 | DiskArbitration 82 | Foundation 83 | ] 84 | ); 85 | 86 | patchPhase = 87 | if patchPlugins then 88 | '' 89 | cp ${ 90 | self.outputs.plugins.${stdenv.system}.configuration 91 | }/bin/configuration.wasm zellij-utils/assets/plugins/configuration.wasm 92 | cp ${ 93 | self.outputs.plugins.${stdenv.system}.tab-bar 94 | }/bin/tab-bar.wasm zellij-utils/assets/plugins/tab-bar.wasm 95 | cp ${ 96 | self.outputs.plugins.${stdenv.system}.status-bar 97 | }/bin/status-bar.wasm zellij-utils/assets/plugins/status-bar.wasm 98 | cp ${ 99 | self.outputs.plugins.${stdenv.system}.strider 100 | }/bin/strider.wasm zellij-utils/assets/plugins/strider.wasm 101 | cp ${ 102 | self.outputs.plugins.${stdenv.system}.compact-bar 103 | }/bin/compact-bar.wasm zellij-utils/assets/plugins/compact-bar.wasm 104 | cp ${ 105 | self.outputs.plugins.${stdenv.system}.session-manager 106 | }/bin/session-manager.wasm zellij-utils/assets/plugins/session-manager.wasm 107 | '' 108 | else 109 | ":"; 110 | meta = { 111 | description = "A terminal workspace with batteries included"; 112 | homepage = "https://zellij.dev/"; 113 | license = [ lib.licenses.mit ]; 114 | mainProgram = "zellij"; 115 | }; 116 | }; 117 | in 118 | # flake outputs 119 | flake-utils.lib.eachDefaultSystem ( 120 | system: 121 | let 122 | overlays = [ (import rust-overlay) ]; 123 | 124 | pkgs = import nixpkgs { inherit system overlays; }; 125 | 126 | rustToolchainTOML = pkgs.rust-bin.fromRustupToolchainFile (src + /rust-toolchain.toml); 127 | rustWasmToolchainTOML = rustToolchainTOML.override { 128 | extensions = [ ]; 129 | targets = [ "wasm32-wasip1" ]; 130 | }; 131 | 132 | devInputs = [ 133 | rustToolchainTOML 134 | pkgs.binaryen 135 | pkgs.mkdocs 136 | pkgs.just 137 | pkgs.protobuf 138 | ]; 139 | 140 | fmtInputs = [ 141 | pkgs.nixfmt-rfc-style 142 | pkgs.treefmt 143 | ]; 144 | 145 | defaultPlugins = pkgs.callPackage ./default-plugins.nix { 146 | inherit cargoLock src; 147 | rustc = rustWasmToolchainTOML; 148 | cargo = rustWasmToolchainTOML; 149 | }; 150 | 151 | externalPlugins = pkgs.callPackage ./external-plugins.nix rec { 152 | src = multitask; 153 | cargoLock = { 154 | lockFile = builtins.path { 155 | path = src + "/Cargo.lock"; 156 | name = "Cargo.lock"; 157 | }; 158 | allowBuiltinFetchGit = true; 159 | }; 160 | rustc = rustWasmToolchainTOML; 161 | cargo = rustWasmToolchainTOML; 162 | }; 163 | in 164 | rec { 165 | packages = rec { 166 | # The default build compiles the plugins from src 167 | default = zellij; 168 | zellij = pkgs.callPackage make-zellij { }; 169 | # The upstream build relies on precompiled binary plugins that are included in the upstream src 170 | zellij-upstream = pkgs.callPackage make-zellij { patchPlugins = false; }; 171 | }; 172 | plugins = { 173 | inherit (defaultPlugins) 174 | compact-bar 175 | configuration 176 | session-manager 177 | status-bar 178 | strider 179 | tab-bar 180 | ; 181 | inherit (externalPlugins) multitask; 182 | }; 183 | 184 | apps = { 185 | default = flake-utils.lib.mkApp { drv = packages.default; }; 186 | zellij-upstream = flake-utils.lib.mkApp { drv = packages.zellij-upstream; }; 187 | }; 188 | 189 | devShells = { 190 | default = pkgs.mkShell { 191 | inherit name; 192 | nativeBuildInputs = devInputs; 193 | RUST_BACKTRACE = 1; 194 | }; 195 | fmtShell = pkgs.mkShell { buildInputs = fmtInputs; }; 196 | actionlintShell = pkgs.mkShell { buildInputs = [ pkgs.actionlint ]; }; 197 | }; 198 | 199 | checks = { 200 | inherit (self.outputs.packages.${system}) default zellij-upstream; 201 | inherit (self.outputs.plugins.${system}) 202 | compact-bar 203 | configuration 204 | session-manager 205 | status-bar 206 | strider 207 | tab-bar 208 | multitask 209 | ; 210 | }; 211 | formatter = pkgs.nixfmt-rfc-style; 212 | } 213 | ) 214 | // { 215 | overlays = { 216 | default = final: _: { 217 | zellij = final.callPackage make-zellij { }; 218 | zellij-upstream = final.callPackage make-zellij { patchPlugins = false; }; 219 | }; 220 | nightly = final: _: { 221 | zellij-nightly = final.callPackage make-zellij { }; 222 | zellij-upstream-nightly = final.callPackage make-zellij { patchPlugins = false; }; 223 | }; 224 | }; 225 | }; 226 | } 227 | -------------------------------------------------------------------------------- /justfile: -------------------------------------------------------------------------------- 1 | fmt: 2 | nix develop --command treefmt 3 | flake-ci: 4 | git branch -D update_flake_lock_action 5 | git fetch origin 6 | git checkout update_flake_lock_action 7 | git commit --amend --no-edit 8 | git push origin update_flake_lock_action --force 9 | 10 | flake-ci-init: 11 | git fetch origin 12 | git checkout update_flake_lock_action 13 | git commit --amend --no-edit 14 | git push origin update_flake_lock_action --force 15 | 16 | update: 17 | nix flake update --commit-lock-file 18 | -------------------------------------------------------------------------------- /shell.nix: -------------------------------------------------------------------------------- 1 | (import ( 2 | let 3 | lock = builtins.fromJSON (builtins.readFile ./flake.lock); 4 | in 5 | fetchTarball { 6 | url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz"; 7 | sha256 = lock.nodes.flake-compat.locked.narHash; 8 | } 9 | ) { src = ./.; }).shellNix 10 | -------------------------------------------------------------------------------- /treefmt.toml: -------------------------------------------------------------------------------- 1 | [formatter.nix] 2 | command = "nixfmt" 3 | includes = ["*.nix"] 4 | --------------------------------------------------------------------------------