Skip to content

Commit

Permalink
adding nix packaging
Browse files Browse the repository at this point in the history
  • Loading branch information
tanneberger committed Nov 14, 2023
1 parent 266f44f commit f2ae35d
Show file tree
Hide file tree
Showing 4 changed files with 145 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ pnpm-debug.log*

# macOS-specific files
.DS_Store

result
23 changes: 23 additions & 0 deletions derivation.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{ domain, mkPnpmPackage, pkg-config, vips, nodePackages_latest}:

mkPnpmPackage {
src = ./.;

installInPlace = true;

postPatch = ''
substituteInPlace ascii.config.ts \
--replace 'ascii.coffee' '${domain}'
'';

script = "build";

nativeBuildInputs = [pkg-config vips nodePackages_latest.pnpm];
buildInputs = [pkg-config vips nodePackages_latest.pnpm];


installPhase = ''
mkdir -p $out/bin
cp -r ./dist/* $out/bin/
'';
}
85 changes: 85 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 36 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
pnpm2nix = {
url = "github:nzbr/pnpm2nix-nzbr";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-utils.follows = "flake-utils";
};

flake-utils.url = "github:numtide/flake-utils";
};

outputs = { self, nixpkgs, pnpm2nix, flake-utils, ... }:
flake-utils.lib.eachDefaultSystem
(system:
let
pkgs = nixpkgs.legacyPackages.${system};
package-ascii-coffee = pkgs.callPackage ./derivation.nix {
domain = "ascii.coffee";
mkPnpmPackage = pnpm2nix.packages."${system}".mkPnpmPackage;
};
in
rec {
checks = packages;
packages = {
ascii-coffee-website = package-ascii-coffee;
default = package-ascii-coffee;
};
}
) // {
overlays.default = final: prev: {
inherit (self.packages.${prev.system})
ascii-coffee-website;
};
};
}

0 comments on commit f2ae35d

Please sign in to comment.