diff --git a/README.md b/README.md index 3929f58e6..1abecbb03 100644 --- a/README.md +++ b/README.md @@ -64,6 +64,39 @@ Connect to remote machines via SSH/SFTP to work with remote codebases. Emdash su - AppImage (x64): https://github.com/generalaction/emdash/releases/latest/download/emdash-x86_64.AppImage - Debian package (x64): https://github.com/generalaction/emdash/releases/latest/download/emdash-amd64.deb +### NixOS / Nix Flake + +This repository exposes a Nix flake with `packages..emdash`. You can run it directly: + +```bash +nix run github:generalaction/emdash +``` + +To install it as part of a NixOS or home-manager configuration, add the flake input and use the package: + +```nix +# flake.nix +{ + inputs.emdash.url = "github:generalaction/emdash"; + + # ... in your outputs: + # packages = [ inputs.emdash.packages.${system}.default ]; +} +``` + +> **Note:** The `pnpmDeps` hash is pinned against the flake's own nixpkgs. If you +> override `emdash.inputs.nixpkgs.follows` to a different nixpkgs, the pnpm version +> may differ and produce a hash mismatch. In that case, run `nix build` once — Nix +> will print the correct hash in the error — then apply it: +> +> ```nix +> inputs.emdash.packages.${pkgs.system}.default.overrideAttrs (old: { +> pnpmDeps = old.pnpmDeps.overrideAttrs { +> outputHash = ""; +> }; +> }); +> ``` + ### Release Overview **[Latest Releases (macOS • Windows • Linux)](https://github.com/generalaction/emdash/releases/latest)** diff --git a/flake.nix b/flake.nix index 5639f1513..bfdae29fb 100644 --- a/flake.nix +++ b/flake.nix @@ -9,7 +9,7 @@ outputs = { self, nixpkgs, flake-utils, ... }: flake-utils.lib.eachDefaultSystem (system: let - pkgs = import nixpkgs { inherit system; }; + pkgs = import nixpkgs { localSystem = system; }; lib = pkgs.lib; packageJson = builtins.fromJSON (builtins.readFile ./package.json); pnpmPackageManager = packageJson.packageManager or ""; @@ -84,10 +84,10 @@ pkgs.automake pkgs.coreutils ] - ++ lib.optionals pkgs.stdenv.isDarwin [ + ++ lib.optionals pkgs.stdenv.hostPlatform.isDarwin [ pkgs.libiconv ] - ++ lib.optionals pkgs.stdenv.isLinux [ + ++ lib.optionals pkgs.stdenv.hostPlatform.isLinux [ pkgs.libsecret pkgs.sqlite pkgs.zlib @@ -96,7 +96,7 @@ ]; cleanSrc = lib.cleanSource ./.; emdashPackage = - if pkgs.stdenv.isLinux then + if pkgs.stdenv.hostPlatform.isLinux then pkgs.stdenv.mkDerivation rec { pname = "emdash"; version = packageJson.version; @@ -144,16 +144,15 @@ pkgs.libdrm pkgs.pango pkgs.cairo - pkgs.xorg.libX11 - pkgs.xorg.libXcomposite - pkgs.xorg.libXdamage - pkgs.xorg.libXext - pkgs.xorg.libXfixes - pkgs.xorg.libXrandr - pkgs.xorg.libxcb + pkgs.libx11 + pkgs.libxcomposite + pkgs.libxdamage + pkgs.libxext + pkgs.libxfixes + pkgs.libxrandr + pkgs.libxcb pkgs.libxkbcommon pkgs.expat - pkgs.mesa.drivers ]; env = { HOME = "$TMPDIR/emdash-home";