Skip to content

Commit

Permalink
stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaelsgirao committed Dec 22, 2023
1 parent 0ff306a commit cd7e5e7
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 55 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ shell.nix
.direnv
.pre-commit-config.yaml
.env
result
12 changes: 12 additions & 0 deletions dockerImage.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{ dockerTools, hello }:


dockerTools.buildImage {

name = "hello-docker";

config = {

Cmd = [ "${hello}/bin/hello" ];
};
}
48 changes: 16 additions & 32 deletions flake.lock

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

59 changes: 41 additions & 18 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
{
inputs = {
nixpkgs.url = "flake:nixpkgs";
flake-parts.url = "github:hercules-ci/flake-parts";
flake-parts = {
url = "github:hercules-ci/flake-parts";
inputs.nixpkgs-lib.follows = "nixpkgs";
};
pre-commit-hooks-nix = {
url = "github:cachix/pre-commit-hooks.nix";
inputs.nixpkgs.follows = "nixpkgs";
Expand Down Expand Up @@ -39,11 +42,24 @@
# module parameters provide easy access to attributes of the same
# system.

packages = rec {
default = ist-discord-bot-env;
ist-discord-bot-env = pkgs.callPackage ./package.nix { };
packages =
let
ist-discord-bot-env = pkgs.callPackage ./package.nix { };
binStub = pkgs.writeShellScriptBin "ist-discord-bot"
''
exec ${pkgs.nodejs_18}/bin/node ${ist-discord-bot-env}/lib/node_modules/ist-discord-bot
'';

};
in
rec {
default = ist-discord-bot;
# adds symlinks of hello and stack to current build and prints "links added"
ist-discord-bot =
pkgs.symlinkJoin { name = "ist-discord-bot"; paths = [ ist-discord-bot-env binStub ]; };

inherit ist-discord-bot-env;
# docker-img = pkgs.callPackage ./dockerImage.nix { };
};

devShells.default = pkgs.mkShell {
#Add executable packages to the nix-shell environment.
Expand All @@ -65,26 +81,33 @@
${config.pre-commit.installationScript}
'';
};
pre-commit = {
check.enable = true;
settings.settings = {
deadnix.edit = true;
};
settings.hooks = {
actionlint.enable = true;
# denolint.enable = true;
deadnix.enable = true;
statix.enable = true;
markdownlint.enable = true;
prettier.enable = true;

pre-commit.settings.hooks = {
treefmt.enable = true;
gitleaks = {
enable = true;
name = "gitleaks";
description = "Prevents commiting secrets";
entry = "${pkgs.gitleaks}/bin/gitleaks protect --verbose --redact --staged";
pass_filenames = false;
};
actionlint.enable = true;
};

treefmt.projectRootFile = ./flake.nix;
treefmt.programs = {
nixpkgs-fmt.enable = true;
yamlfmt.enable = true;
nixpkgs-fmt.enable = true;
shellcheck.enable = true;
shfmt.enable = true;
mdformat.enable = true;
deadnix.enable = true;
statix.enable = true;
prettier.enable = true;
statix.disabled-lints = [
"repeated_keys"
];

};
};
};
Expand Down
11 changes: 6 additions & 5 deletions package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,21 @@ buildNpmPackage rec {
pname = "ist-discord-bot";
version = "2.8.4";

src = ./.;
src = lib.cleanSource ./.;

# npmDepsHash = lib.fakeHash;

# npmDepsHash = lib.fakeHash;
npmDepsHash = "sha256-GtacSNGPLBd+8YpPJwIVRjffPFTMjSaVoCNVVAm2Zmo=";

dontNpmBuild = true;

configurePhase = ''
${nodePackages.prisma}/bin/prisma generate
${nodePackages.prisma}/bin/prisma generate
'';

buildPhase = ''
${typescript}/bin/tsc;
'';
'';

postBuildPhase = ''
set -exu
Expand Down

0 comments on commit cd7e5e7

Please sign in to comment.