nixos-configs/common/pkgs/discommit/flake.nix
matt1432 38364b9b84
Some checks failed
Discord / discord commits (push) Has been cancelled
ci: finish discommit
2023-12-22 16:20:10 -05:00

59 lines
1.3 KiB
Nix

{
#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
];
};
});
};
}