Skip to content

Commit

Permalink
Merge pull request #40 from dark-voyage/main
Browse files Browse the repository at this point in the history
feat: nixification
  • Loading branch information
ismoilovdevml authored Dec 26, 2024
2 parents d081ae8 + 6097d08 commit 4b10972
Show file tree
Hide file tree
Showing 4 changed files with 127 additions and 3 deletions.
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Nodejs and package manager
*.local
.eslintcache
.next
Expand All @@ -15,10 +16,10 @@ build/
.env
.envrc

# svelte
dist-ssr
# Nix
/result

# editor directories and files
# Editor directories and files
.idea
.DS_Store
*.suo
Expand Down
61 changes: 61 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 = "Telegram bot for Xinux community";

inputs = {
# Too old to work with most libraries
# nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05";

# Perfect!
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";

# The flake-utils library
flake-utils.url = "github:numtide/flake-utils";
};

outputs = {
self,
nixpkgs,
flake-utils,
...
}:
flake-utils.lib.eachDefaultSystem
(
system: let
pkgs = nixpkgs.legacyPackages.${system};
in {
# Nix script formatter
formatter = pkgs.alejandra;

# Development environment
devShells.default = import ./shell.nix {inherit pkgs;};
}
);
}
29 changes: 29 additions & 0 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{pkgs ? import <nixpkgs> {}}: let
getLibFolder = pkg: "${pkg}/lib";
in
pkgs.stdenv.mkDerivation {
name = "devops-journey-shell";

buildInputs = with pkgs; [
# Package managers
pnpm
yarn

# Runtime engines
nodejs_22

# Nextjs dependencies
vips
];

shellHook = ''
printf "Installing pnpm dependencies\n"
pnpm install
printf "Adding node_modules to PATH\n"
export PATH="$PWD/node_modules/.bin/:$PATH"
printf "Adding necessary aliases\n"
alias scripts='jq ".scripts" package.json'
'';
}

0 comments on commit 4b10972

Please sign in to comment.