{ description = "ssp-reader: a reader for the .ssp document abstraction, in Gleam"; inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; outputs = { self, nixpkgs }: let system = "x86_64-linux"; # adjust for aarch64-linux / darwin pkgs = import nixpkgs { inherit system; }; name = "ssp_reader"; /* The builder, nix-gleam's, kept here in nix-gleam/ (see the README there). It fetches each Hex dependency on its own, with the checksum gleam has already written into manifest.toml, so there is no hash in this file to keep up to date, and nothing a run of gleam could make come out differently. */ inherit (pkgs.callPackage ./nix-gleam { }) buildGleamApplication; in { packages.${system} = { default = self.packages.${system}.${name}; /* The reader as an escript: precompiled Erlang in a single file, which needs only erlang to run, no gleam and no dependencies. Verified reproducible: a second export is byte identical. nix-gleam builds an erlang-shipment by default; the build phase is replaced, its configure phase having already put the dependencies in place. */ ${name} = buildGleamApplication { pname = name; version = "2.1.0"; src = ./.; nativeBuildInputs = [ pkgs.makeWrapper ]; buildPhase = '' runHook preBuild export HOME=$TMPDIR gleam export escript runHook postBuild ''; installPhase = '' runHook preInstall mkdir -p $out/bin install -m755 ${name} $out/bin/${name} wrapProgram $out/bin/${name} \ --prefix PATH : ${pkgs.lib.makeBinPath [ pkgs.beamPackages.erlang pkgs.coreutils ]} runHook postInstall ''; meta = { description = "reads a .ssp document abstraction and says what is in it"; mainProgram = name; }; }; }; devShells.${system}.default = pkgs.mkShell { packages = [ pkgs.gleam pkgs.beamPackages.erlang pkgs.rebar3 ]; }; }; }