nixos-configs/common/pkgs/discommit/flake.nix

59 lines
1.3 KiB
Nix
Raw Normal View History

2023-12-22 16:20:10 -05:00
{
#inputs.main.url = "path:../../../";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
outputs = {
self,
#main,
nixpkgs,
...
}: let
#nixpkgs = main.inputs.nixpkgs;
supportedSystems = ["x86_64-linux"];
perSystem = attrs:
nixpkgs.lib.genAttrs supportedSystems (system: let
pkgs = nixpkgs.legacyPackages.${system};
in
attrs system pkgs);
in {
packages = perSystem (system: pkgs: {
discommit = pkgs.buildNpmPackage {
name = "discommit";
src = ./.;
npmDepsHash = "sha256-/Ryhmg7phHHWniWQock95wAJz4TNYDDsLBEXcICz9ao=";
nativeBuildInputs = with pkgs; [
typescript
nodejs_20
];
buildPhase = ''
tsc -p tsconfig.json
'';
installPhase = ''
mkdir -p $out/bin
mv node_modules package.json $out
chmod +x ./build/index.js
cp -a ./build/index.js $out/bin/discommit
'';
};
default = self.packages.${system}.discommit;
});
formatter = perSystem (_: pkgs: pkgs.alejandra);
devShells = perSystem (_: pkgs: {
default = pkgs.mkShell {
packages = with pkgs; [
alejandra
git
nodejs_20
typescript
];
};
});
};
}