git.fiddlerwoaroof.com
flake.nix
74ac734a
 {
   inputs = {
     nixpkgs = {
       type = "github";
       owner = "nixos";
       repo = "nixpkgs";
     };
06f89842
     flake-utils.url = "github:numtide/flake-utils";
74ac734a
   };
 
   outputs = {
     self,
     nixpkgs,
06f89842
     flake-utils,
22923805
   }: let
   in
06f89842
     flake-utils.lib.eachDefaultSystem (system: let
3655558c
       pkgs = import nixpkgs {
         inherit system;
       };
22923805
       build_zig = deriv @ {nativeBuildInputs ? [], ...}:
         pkgs.stdenv.mkDerivation ({
             dontConfigure = true;
 
             preBuild = ''
               export HOME=$TMPDIR
             '';
 
             installPhase = ''
               runHook preInstall
               zig build -Drelease-safe -Dcpu=baseline --prefix $out install
               runHook postInstall
             '';
           }
           // deriv
           // {
             nativeBuildInputs = [pkgs.zig_0_10] ++ nativeBuildInputs;
           });
8f1d472a
       writeZsh = pkgs.writers.makeScriptWriter {interpreter = "${pkgs.zsh}/bin/zsh";};
06f89842
       socat = pkgs.socat;
22923805
     in {
3655558c
       devShells.default = pkgs.mkShell {
         buildInputs = [pkgs.zig_0_10 socat];
74ac734a
       };
22923805
       devShell = self.devShells.default;
       packages.default = build_zig {
3655558c
         pname = "sigexec";
         version = "0.0.2";
         src = ./.;
 
22923805
         meta = with pkgs.lib; {
           homepage = "https://github.com/fiddlerwoaroof/sigexec";
           description = "A simple utility that runs a command with each line sent over a socket.";
           license = licenses.mit;
           platforms = platforms.linux ++ platforms.darwin;
         };
08feb2e1
       };
8f1d472a
       apps.do-test = {
         type = "app";
         program = toString (writeZsh "test.zsh" ''
           PATH="$PATH:${self.packages.${system}.default}/bin:${socat}/bin"
           ${(builtins.readFile ./test.zsh)}
         '');
       };
06f89842
     });
74ac734a
 }