nixos-configs/common/pkgs/discommit/flake.nix
matt1432 981c4251a6
All checks were successful
Discord / discord commits (push) Has been skipped
chore: add TODOs and small refactor
2024-01-04 03:39:14 -05:00

59 lines
1.3 KiB
Nix

{
# TODO: make this into a public github action
#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
];
};
});
};
}