diff --git a/.github/workflows/nix_continuous.yml b/.github/workflows/nix_continuous.yml new file mode 100644 index 00000000000..eb495af380e --- /dev/null +++ b/.github/workflows/nix_continuous.yml @@ -0,0 +1,38 @@ +name: nix_continuous + +on: + schedule: + - cron: "10 3 * * *" + push: + branches: + - main + paths: + - '**/*.rs' + - '.github/workflows/nix.yml' + - 'nix/**' + +jobs: + lints: + name: Build + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Install nix + uses: DeterminateSystems/nix-installer-action@main + - name: Cache build artifacts + uses: DeterminateSystems/magic-nix-cache-action@main + - name: Check flake inputs + uses: DeterminateSystems/flake-checker-action@main + with: + flake-lock-path: ./nix/flake.lock + ignore-missing-flake-lock: false + - name: Setup Cachix + uses: cachix/cachix-action@v27 + with: + name: wezterm + authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' + - name: Build default package + run: | + nix build ./nix --json \ + | jq -r '.[].outputs | to_entries[].value' \ + | cachix push wezterm diff --git a/docs/install/linux.md b/docs/install/linux.md index d19b691713d..a7109f6065d 100644 --- a/docs/install/linux.md +++ b/docs/install/linux.md @@ -286,6 +286,91 @@ hide: $ brew rm wezterm $ brew install --HEAD wezterm ``` +=== "Nix/NixOS" + + ## Nix + + WezTerm is available in nixpkgs as `wezterm`. + + ```nix + { + # configuration.nix + + environment.systemPackages = [ + pkgs.wezterm + ] + } + ``` + + ### Flake + + If you need a newer version use the flake. Use the cachix if you want to avoid building WezTerm from source. + + The flake is in the `nix` directory, so the url will be something like `github:wez/wezterm?dir=nix` + + Here's an example for NixOS configurations: + + ```nix + { + inputs.wezterm.url = "github:wez/wezterm?dir=nix"; + # ... + + outputs = inputs @ {nixpkgs, ...}:{ + nixosConfigurations.HOSTNAME = nixpkgs.lib.nixosSystem { + specialArgs = { inherit inputs; }; # Make sure you pass inputs through to your nixosConfiguration like this + modules = [ + # ... + ]; + }; + }; + } + ``` + And for home-manager you can do the following: + + ```nix + # flake.nix + + { + inputs.wezterm.url = "github:wez/wezterm?dir=nix"; + # ... + + outputs = inputs @ {nixpkgs, home-manager, ...}:{ + homeConfigurations."user@HOSTNAME" = home-manager.lib.homeManagerConfiguration { + pkgs = nixpkgs.legacyPackages.x86_64-linux; + extraSpecialArgs = { inherit inputs; }; # Pass inputs to homeManagerConfiguration + modules = [ + ./home.nix + ]; + }; + }; + } + ``` + ```nix + # home.nix + + {inputs, pkgs, ...}:{ + programs.wezterm = { + enable = true; + package = inputs.wezterm.packages.${pkgs.system}.default; + }; + } + ``` + + + ### Cachix + + Successful builds of the nightly nix action are pushed to this binary cache. + + ```nix + # nixosConfiguration module + { + nix.settings = { + substituters = ["https://wezterm.cachix.org"]; + trusted-public-keys = ["wezterm.cachix.org-1:kAbhjYUC9qvblTE+s7S+kl5XM1zVa4skO+E/1IDWdH0="]; + }; + } + ``` + === "Raw" ## Raw Linux Binary