Skip to content

feat: Nix Shell #799

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# For flake's devShell:
use flake .



# Below are env vars:

#
# Required
#

# If in production mode:

# DEV=False
export PROD_DATABASE_URL=""
export PROD_TOKEN=""

# If in development mode:

# DEV=True
export DEV_DATABASE_URL=""
export DEV_TOKEN=""

#
# Optional
#

export INFLUXDB_TOKEN=""
export INFLUXDB_URL=""
export INFLUXDB_ORG=""

export SENTRY_URL=""

export PROD_COG_IGNORE_LIST="rolecount,mail" # These are ATL specific cogs that are not needed in Tux unless you are ATL
export DEV_COG_IGNORE_LIST=

export GITHUB_APP_ID=
export GITHUB_CLIENT_ID=""
export GITHUB_CLIENT_SECRET=""
export GITHUB_PUBLIC_KEY=""
export GITHUB_INSTALLATION_ID=

export GITHUB_PRIVATE_KEY_BASE64=""

export GITHUB_REPO_URL=
export GITHUB_REPO_OWNER=
export GITHUB_REPO=

export MAILCOW_API_KEY=
export MAILCOW_API_URL=
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ __pycache__/

# Replit
*.replit
*.nix

# C extensions
*.so
Expand Down Expand Up @@ -172,4 +171,7 @@ tux/extensions/*

# misc
slim.report.json
prisma_binaries/
prisma_binaries/

# direnv
.direnv/
28 changes: 28 additions & 0 deletions flake.lock

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

33 changes: 33 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
description = "All Thing's Linux discord bot - Tux";

inputs.nixpkgs = {
type = "github";
owner = "NixOS";
repo = "nixpkgs";
ref = "nixos-unstable";
};

outputs = {
self,
nixpkgs,
...
}:
let
supportedSystems = [
"x86_64-linux"
"x86_64-darwin"
"aarch64-linux"
"aarch64-darwin"
];

forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
in {
devShells = forAllSystems (system: let
pkgs = nixpkgs.legacyPackages.${system};
in {
tux = pkgs.callPackage ./shell.nix { inherit pkgs; };
default = self.devShells.${system}.tux;
});
};
}
18 changes: 18 additions & 0 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{ pkgs ? import <nixpkgs> {} }:

pkgs.mkShell {
packages = with pkgs; [
python313
poetry
git
jq
];

shellHook = ''
# enters the user's preferred shell using a more robust method
$(getent passwd $(id -un) | cut -d: -f7 | tr -d '\n')

# exits after child shell exits
exit
'';
}