From d1cacc3fa8c829320a447f238c3894a28a183bf9 Mon Sep 17 00:00:00 2001 From: Aram Drevekenin Date: Tue, 20 Dec 2022 12:24:19 +0100 Subject: [PATCH] chore(repo): remove nix support (#2038) --- .envrc | 1 - .git-blame-ignore-revs | 17 -- .github/workflows/e2e.yml | 5 - .github/workflows/nix-develop.yml | 72 ------- .github/workflows/update-flake-lock.yml | 24 --- .gitignore | 5 - .nix/crate2nix.nix | 45 ---- .nix/default.nix | 14 -- .nix/devShell.nix | 11 - .nix/plugins.nix | 53 ----- .nix/shell.nix | 14 -- .nix/zellij.nix | 275 ------------------------ CONTRIBUTING.md | 14 -- README.md | 1 - flake.lock | 101 --------- flake.nix | 17 -- treefmt.toml | 3 - 17 files changed, 672 deletions(-) delete mode 100644 .envrc delete mode 100644 .git-blame-ignore-revs delete mode 100644 .github/workflows/nix-develop.yml delete mode 100644 .github/workflows/update-flake-lock.yml delete mode 100644 .nix/crate2nix.nix delete mode 100644 .nix/default.nix delete mode 100644 .nix/devShell.nix delete mode 100644 .nix/plugins.nix delete mode 100644 .nix/shell.nix delete mode 100644 .nix/zellij.nix delete mode 100644 flake.lock delete mode 100644 flake.nix delete mode 100644 treefmt.toml diff --git a/.envrc b/.envrc deleted file mode 100644 index 3550a30f2..000000000 --- a/.envrc +++ /dev/null @@ -1 +0,0 @@ -use flake diff --git a/.git-blame-ignore-revs b/.git-blame-ignore-revs deleted file mode 100644 index d65fd7988..000000000 --- a/.git-blame-ignore-revs +++ /dev/null @@ -1,17 +0,0 @@ -# This file contains a list of commits that are not likely what you -# are looking for in a blame, such as mass reformatting or renaming. -# You can set this file as a default ignore file for blame by running -# the following command. -# -# $ git config blame.ignoreRevsFile .git-blame-ignore-revs -# -# fix: small lints - https://github.com/zellij-org/zellij/commit/9544a09786ef39ed741db166c5052cade45fde91 -9544a09786ef39ed741db166c5052cade45fde91 -# fix: typos - https://github.com/zellij-org/zellij/commit/16b53aa52f73e5ee7383889dc7a422d27be22ef0 -16b53aa52f73e5ee7383889dc7a422d27be22ef0 -# add(style): add trailing commas in match blocks - https://github.com/zellij-org/zellij/commit/67d2673cae60954e8287c2a1f58a21a56e066afb -67d2673cae60954e8287c2a1f58a21a56e066afb -# clippy fixes -3de59dac42c05de43beba2f7d09b07111c711394 -# chore: move `nix` directory -47540d7cabae144f032c0fc4972e7c9af5ab5e8d diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 959bf7ec0..44fd6d5cb 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -30,11 +30,6 @@ jobs: options: -v ${{ github.workspace }}/target:/usr/src/zellij --name ssh steps: - uses: actions/checkout@v3 - - uses: cachix/install-nix-action@v18 - - uses: cachix/cachix-action@v12 - with: - name: zellij - authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' - name: Add WASM target run: rustup target add wasm32-wasi - name: Install musl-tools diff --git a/.github/workflows/nix-develop.yml b/.github/workflows/nix-develop.yml deleted file mode 100644 index 9b34a4633..000000000 --- a/.github/workflows/nix-develop.yml +++ /dev/null @@ -1,72 +0,0 @@ -# This is a workflow, consisting of jobs that only need to be run, -# once `*nix`, or `flake.lock` files change -name: nix-develop - -on: - push: - branches: - - main - paths: - - '**.nix' - - 'flake.lock' - - 'rust-toolchain' - pull_request: - branches: - - main - paths: - - '**.nix' - - 'flake.lock' - - 'rust-toolchain' - -jobs: - check: - runs-on: ubuntu-latest - name: "nix check" - timeout-minutes: 5 - steps: - - uses: actions/checkout@v3 - with: - # Nix Flakes doesn't work on shallow clones - fetch-depth: 0 - - uses: cachix/install-nix-action@v18 - - uses: cachix/cachix-action@v12 - with: - name: zellij - # If you chose API tokens for write access OR if you have a private cache - authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' - - run: nix develop .#fmtShell --command treefmt --fail-on-change - ## nix flake check still fails on IFD - #- run: nix flake check --print-build-logs --show-trace - develop: - runs-on: ubuntu-latest - name: "nix develop" - timeout-minutes: 10 - steps: - - uses: actions/checkout@v3 - with: - # Nix Flakes doesn't work on shallow clones - fetch-depth: 0 - - uses: cachix/install-nix-action@v18 - - uses: cachix/cachix-action@v12 - with: - name: zellij - # If you chose API tokens for write access OR if you have a private cache - authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' - - run: nix develop --profile devShell - build: - runs-on: ubuntu-latest - name: "nix build" - timeout-minutes: 35 - steps: - - uses: actions/checkout@v3 - with: - # Nix Flakes doesn't work on shallow clones - fetch-depth: 0 - - uses: cachix/install-nix-action@v18 - - uses: cachix/cachix-action@v12 - with: - name: zellij - # If you chose API tokens for write access OR if you have a private cache - authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' - - run: | - nix build || nix build --substituters 'https://cache.nixos.org' --extra-substituters '' diff --git a/.github/workflows/update-flake-lock.yml b/.github/workflows/update-flake-lock.yml deleted file mode 100644 index fb70b3455..000000000 --- a/.github/workflows/update-flake-lock.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: update-flake-lock -on: - workflow_dispatch: # allows manual triggering - schedule: - - cron: '0 0 1 * *' # runs on the first of every month at 00:00 - -jobs: - lockfile: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - name: Install Nix - uses: cachix/install-nix-action@v18 - with: - extra_nix_config: | - access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} - - name: Update flake.lock - uses: DeterminateSystems/update-flake-lock@v15 - with: - token: ${{ secrets.GH_TOKEN_FOR_UPDATES }} - pr-labels: | - dependencies - nix diff --git a/.gitignore b/.gitignore index c02e62784..4087f342c 100644 --- a/.gitignore +++ b/.gitignore @@ -4,8 +4,3 @@ target/ .vim .DS_Store /assets/man/zellij.1 - -# nix -.direnv/ -result -result-* diff --git a/.nix/crate2nix.nix b/.nix/crate2nix.nix deleted file mode 100644 index a127a8d30..000000000 --- a/.nix/crate2nix.nix +++ /dev/null @@ -1,45 +0,0 @@ -{ - pkgs, - crate2nix, - name, - src, - patchPhase, - postInstall, - nativeBuildInputs, - desktopItems, - meta, -}: let - inherit - (import "${crate2nix}/tools.nix" {inherit pkgs;}) - generatedCargoNix - ; - darwinBuildInputs = pkgs.lib.optionals pkgs.stdenv.isDarwin [ - pkgs.darwin.apple_sdk.frameworks.DiskArbitration - pkgs.darwin.apple_sdk.frameworks.Foundation - ]; - - project = - import - (generatedCargoNix { - inherit name src; - }) - { - inherit pkgs; - buildRustCrateForPkgs = pkgs: - pkgs.buildRustCrate.override { - defaultCrateOverrides = - pkgs.defaultCrateOverrides - // { - # Crate dependency overrides go here - zellij = attrs: { - inherit postInstall desktopItems meta name nativeBuildInputs patchPhase; - buildInputs = darwinBuildInputs; - }; - sysinfo = attrs: { - buildInputs = darwinBuildInputs; - }; - }; - }; - }; -in - project.workspaceMembers.zellij.build diff --git a/.nix/default.nix b/.nix/default.nix deleted file mode 100644 index 7d346e2df..000000000 --- a/.nix/default.nix +++ /dev/null @@ -1,14 +0,0 @@ -(import - ( - let - lock = builtins.fromJSON (builtins.readFile ../flake.lock); - in - fetchTarball { - url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz"; - sha256 = lock.nodes.flake-compat.locked.narHash; - } - ) - { - src = ../.; - }) -.defaultNix diff --git a/.nix/devShell.nix b/.nix/devShell.nix deleted file mode 100644 index 261234f65..000000000 --- a/.nix/devShell.nix +++ /dev/null @@ -1,11 +0,0 @@ -{ - mkShell, - buildInputs, - nativeBuildInputs, -}: -mkShell { - name = "zj-dev-env"; - inherit buildInputs nativeBuildInputs; - ### Environment Variables - RUST_BACKTRACE = 1; -} diff --git a/.nix/plugins.nix b/.nix/plugins.nix deleted file mode 100644 index f3e1c8b7a..000000000 --- a/.nix/plugins.nix +++ /dev/null @@ -1,53 +0,0 @@ -{ - pkgs, - root, - cargo, - rustc, - cargoLock, - nativeBuildInputs, - buildInputs, -}: let - ignoreSource = [ - ".git" - ".github" - "docs" - "example" - "target" - ".editorconfig" - ".envrc" - ".git-blame-ignore-revs" - "CHANGELOG.md" - "CODE_OF_CONDUCT.md" - "CONTRIBUTING.md" - "GOVERNANCE.md" - "LICENSE.md" - "docker-compose.yml" - ]; - src = pkgs.nix-gitignore.gitignoreSource ignoreSource root; - - makeDefaultPlugin = name: - (pkgs.makeRustPlatform {inherit cargo rustc;}).buildRustPackage { - inherit - src - name - cargoLock - buildInputs - nativeBuildInputs - ; - buildPhase = '' - cargo build --package ${name} --release --target=wasm32-wasi - mkdir -p $out/bin; - #cp target/wasm32-wasi/release/${name}.wasm $out/bin/${name}.wasm - wasm-opt \ - -O target/wasm32-wasi/release/${name}.wasm \ - -o $out/bin/${name}.wasm - ''; - installPhase = ":"; - checkPhase = ":"; - }; -in { - status-bar = makeDefaultPlugin "status-bar"; - tab-bar = makeDefaultPlugin "tab-bar"; - strider = makeDefaultPlugin "strider"; - compact-bar = makeDefaultPlugin "compact-bar"; -} diff --git a/.nix/shell.nix b/.nix/shell.nix deleted file mode 100644 index 628151cf9..000000000 --- a/.nix/shell.nix +++ /dev/null @@ -1,14 +0,0 @@ -(import - ( - let - lock = builtins.fromJSON (builtins.readFile ../flake.lock); - in - fetchTarball { - url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz"; - sha256 = lock.nodes.flake-compat.locked.narHash; - } - ) - { - src = ../.; - }) -.shellNix diff --git a/.nix/zellij.nix b/.nix/zellij.nix deleted file mode 100644 index 05ed07b70..000000000 --- a/.nix/zellij.nix +++ /dev/null @@ -1,275 +0,0 @@ -{ - self, - nixpkgs, - rust-overlay, - flake-utils, - flake-compat, - crate2nix, -}: -flake-utils.lib.eachSystem [ - "aarch64-linux" - "aarch64-darwin" - "i686-linux" - "x86_64-darwin" - "x86_64-linux" -] -(system: let - overlays = [(import rust-overlay)]; - - pkgs = import nixpkgs {inherit system overlays;}; - pkgsMusl = import nixpkgs { - inherit system overlays; - crossSystem = {config = "x86_64-unknown-linux-musl";}; - }; - - crate2nixPkgs = import nixpkgs { - inherit system; - overlays = [ - (self: _: { - rustc = rustToolchainToml; - cargo = rustToolchainToml; - }) - ]; - }; - - crate2nixMsrvPkgs = import nixpkgs { - inherit system; - overlays = [ - (self: _: { - rustc = msrvToolchain; - cargo = msrvToolchain; - }) - ]; - }; - - name = "zellij"; - pname = name; - root = self; - - ignoreSource = [".git" "target" "example"]; - - src = pkgs.nix-gitignore.gitignoreSource ignoreSource root; - - cargoToml = builtins.fromTOML (builtins.readFile (src + "/Cargo.toml")); - toolchainToml = builtins.fromTOML (builtins.readFile (src + "/rust-toolchain.toml")); - rustToolchainToml = pkgs.rust-bin.fromRustupToolchainFile (src + "/rust-toolchain.toml"); - - msrvToolchain = pkgs.rust-bin.fromRustupToolchain { - channel = cargoToml.package.rust-version; - components = toolchainToml.toolchain.components; - targets = toolchainToml.toolchain.targets; - }; - - cargoLock = { - lockFile = builtins.path { - path = src + "/Cargo.lock"; - name = "Cargo.lock"; - }; - }; - cargo = rustToolchainToml; - rustc = rustToolchainToml; - cargoMSRV = msrvToolchain; - rustcMSRV = msrvToolchain; - - buildInputs = [ - # in order to run tests - pkgs.openssl - ] ++ ( - pkgs.lib.optionals pkgs.stdenv.isDarwin [ - pkgs.darwin.apple_sdk.frameworks.DiskArbitration - pkgs.darwin.apple_sdk.frameworks.Foundation - ] - ); - - nativeBuildInputs = [ - # for openssl/openssl-sys - pkgs.pkg-config - - # generates manpages - pkgs.mandown - - pkgs.installShellFiles - pkgs.copyDesktopItems - ]; - - defaultPlugins = [ - plugins.compact-bar - plugins.status-bar - plugins.tab-bar - plugins.strider - ]; - - pluginNativeBuildInputs = [ - pkgs.pkg-config - # optimizes wasm binaries - pkgs.binaryen - ]; - - devInputs = [ - rustToolchainToml - - pkgs.cargo-make - pkgs.rust-analyzer - - # optimizes wasm binaries - pkgs.binaryen - - # used for snapshotting the e2e tests - pkgs.cargo-insta - ]; - - fmtInputs = [ - pkgs.alejandra - pkgs.treefmt - ]; - - plugins = import ./plugins.nix { - inherit root pkgs cargo rustc cargoLock buildInputs; - nativeBuildInputs = pluginNativeBuildInputs; - }; - - postInstall = '' - mandown ./docs/MANPAGE.md > ./zellij.1 - installManPage ./zellij.1 - - # explicit behavior - $out/bin/zellij setup --generate-completion bash > ./completions.bash - installShellCompletion --bash --name ${pname}.bash ./completions.bash - $out/bin/zellij setup --generate-completion fish > ./completions.fish - installShellCompletion --fish --name ${pname}.fish ./completions.fish - $out/bin/zellij setup --generate-completion zsh > ./completions.zsh - installShellCompletion --zsh --name _${pname} ./completions.zsh - - install -Dm644 ./assets/logo.png $out/share/icons/hicolor/scalable/apps/zellij.png - - copyDesktopItems - ''; - patchPhase = '' - cp ${plugins.tab-bar}/bin/tab-bar.wasm assets/plugins/tab-bar.wasm - cp ${plugins.status-bar}/bin/status-bar.wasm assets/plugins/status-bar.wasm - cp ${plugins.strider}/bin/strider.wasm assets/plugins/strider.wasm - cp ${plugins.compact-bar}/bin/compact-bar.wasm assets/plugins/compact-bar.wasm - ''; - - desktopItems = [ - (pkgs.makeDesktopItem { - type = "Application"; - inherit name; - desktopName = "zellij"; - terminal = true; - genericName = "Terminal multiplexer"; - comment = "Manage your terminal applications"; - exec = "zellij"; - icon = "zellij"; - categories = ["ConsoleOnly"]; - }) - ]; - meta = with pkgs.lib; { - homepage = "https://github.com/zellij-org/zellij/"; - description = "A terminal workspace with batteries included"; - license = [licenses.mit]; - }; -in rec { - packages.default = packages.zellij-native; - # crate2nix - better incremental builds, but uses ifd - packages.zellij = crate2nixPkgs.callPackage ./crate2nix.nix { - inherit - name - src - crate2nix - desktopItems - postInstall - patchPhase - meta - ; - nativeBuildInputs = nativeBuildInputs ++ defaultPlugins; - }; - - packages.zellij-crate-msrv = crate2nixMsrvPkgs.callPackage ./crate2nix.nix { - inherit - name - src - crate2nix - desktopItems - postInstall - patchPhase - meta - ; - nativeBuildInputs = nativeBuildInputs ++ defaultPlugins; - }; - - # native nixpkgs support - keep supported - packages.zellij-native = (pkgs.makeRustPlatform {inherit cargo rustc;}).buildRustPackage { - inherit - src - name - cargoLock - buildInputs - postInstall - patchPhase - desktopItems - meta - ; - nativeBuildInputs = nativeBuildInputs ++ defaultPlugins; - }; - # native nixpkgs support - msrv - packages.zellij-msrv = - (pkgs.makeRustPlatform { - cargo = cargoMSRV; - rustc = rustcMSRV; - }) - .buildRustPackage { - inherit - src - name - cargoLock - buildInputs - postInstall - patchPhase - desktopItems - meta - ; - nativeBuildInputs = nativeBuildInputs ++ defaultPlugins; - }; - - packages.plugins-compact = plugins.compact-bar; - packages.plugins-status-bar = plugins.status-bar; - packages.plugins-tab-bar = plugins.tab-bar; - packages.plugins-strider = plugins.strider; - - defaultPackage = packages.zellij; - - # nix run - apps.zellij = flake-utils.lib.mkApp {drv = packages.zellij;}; - defaultApp = apps.zellij; - - devShells = { - zellij = pkgs.callPackage ./devShell.nix { - inherit buildInputs; - nativeBuildInputs = nativeBuildInputs ++ devInputs ++ fmtInputs; - }; - fmtShell = pkgs.mkShell { - name = "fmt-shell"; - nativeBuildInputs = fmtInputs; - }; - e2eShell = pkgs.pkgsMusl.mkShell { - name = "e2e-shell"; - nativeBuildInputs = [ - pkgs.cargo-make - pkgs.pkgsMusl.cargo - ]; - }; - }; - - devShell = devShells.zellij; -}) -// rec { - overlays = { - default = final: prev: rec { - zellij = self.packages.${prev.system}.zellij; - }; - nightly = final: prev: rec { - zellij-nightly = self.packages.${prev.system}.zellij; - }; - }; -} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 612dc4b25..7281175bb 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -48,20 +48,6 @@ version `wasm-opt --version` > 97, for it's command `wasm-opt`. To run `test`, you will need the package `pkg-config` and a version of `openssl`. -
-Should you be a `nix` (linux/macOs) user, you can use the following -commands in order to get set up: (expand) - -- `nix develop` -Download and set up dependencies. -- `nix build` -Build the binary in the `result` directory. (--release) -- `nix run` -Run the binary. -- `cachix use zellij` -Will use our binary cache as a substituter. -
- ## Running the end-to-end tests Zellij includes some end-to-end tests which test the whole application as a black-box from the outside. These tests work by running a docker container which contains the Zellij binary, connecting to it via ssh, sending some commands and comparing the output received against predefined snapshots. diff --git a/README.md b/README.md index bdc8a148b..f31f4dfe9 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,6 @@ Discord Chat Matrix Chat Zellij documentation - Built with nix

diff --git a/flake.lock b/flake.lock deleted file mode 100644 index e591e449a..000000000 --- a/flake.lock +++ /dev/null @@ -1,101 +0,0 @@ -{ - "nodes": { - "crate2nix": { - "flake": false, - "locked": { - "lastModified": 1668990393, - "narHash": "sha256-6E+heekdZ1UfCseEQiCafnkRky80BaB6m0+bwIOx2ws=", - "owner": "kolloch", - "repo": "crate2nix", - "rev": "e4414cc2579d6ab11e9542f49eeb302b451bf0e2", - "type": "github" - }, - "original": { - "owner": "kolloch", - "repo": "crate2nix", - "type": "github" - } - }, - "flake-compat": { - "flake": false, - "locked": { - "lastModified": 1668681692, - "narHash": "sha256-Ht91NGdewz8IQLtWZ9LCeNXMSXHUss+9COoqu6JLmXU=", - "owner": "edolstra", - "repo": "flake-compat", - "rev": "009399224d5e398d03b22badca40a37ac85412a1", - "type": "github" - }, - "original": { - "owner": "edolstra", - "repo": "flake-compat", - "type": "github" - } - }, - "flake-utils": { - "locked": { - "lastModified": 1667395993, - "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, - "nixpkgs": { - "locked": { - "lastModified": 1669542132, - "narHash": "sha256-DRlg++NJAwPh8io3ExBJdNW7Djs3plVI5jgYQ+iXAZQ=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "a115bb9bd56831941be3776c8a94005867f316a7", - "type": "github" - }, - "original": { - "owner": "nixos", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" - } - }, - "root": { - "inputs": { - "crate2nix": "crate2nix", - "flake-compat": "flake-compat", - "flake-utils": "flake-utils", - "nixpkgs": "nixpkgs", - "rust-overlay": "rust-overlay" - } - }, - "rust-overlay": { - "inputs": { - "flake-utils": [ - "flake-utils" - ], - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1669775522, - "narHash": "sha256-6xxGArBqssX38DdHpDoPcPvB/e79uXyQBwpBcaO/BwY=", - "owner": "oxalica", - "repo": "rust-overlay", - "rev": "3158e47f6b85a288d12948aeb9a048e0ed4434d6", - "type": "github" - }, - "original": { - "owner": "oxalica", - "repo": "rust-overlay", - "type": "github" - } - } - }, - "root": "root", - "version": 7 -} diff --git a/flake.nix b/flake.nix deleted file mode 100644 index 42abf4825..000000000 --- a/flake.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ - description = "Zellij, a terminal workspace with batteries included"; - - inputs = { - nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; - flake-utils.url = "github:numtide/flake-utils"; - rust-overlay.url = "github:oxalica/rust-overlay"; - rust-overlay.inputs.nixpkgs.follows = "nixpkgs"; - rust-overlay.inputs.flake-utils.follows = "flake-utils"; - flake-compat.url = "github:edolstra/flake-compat"; - flake-compat.flake = false; - crate2nix.url = "github:kolloch/crate2nix"; - crate2nix.flake = false; - }; - - outputs = {...} @ args: import .nix/zellij.nix args; -} diff --git a/treefmt.toml b/treefmt.toml deleted file mode 100644 index fe5d1f37e..000000000 --- a/treefmt.toml +++ /dev/null @@ -1,3 +0,0 @@ -[formatter.nix] -command = "alejandra" -includes = ["*.nix"]