chore(nix): add support for flakes

This commit is contained in:
Mahyar Mirrashed
2025-03-10 16:26:18 -07:00
parent 3986df8e8a
commit 23f6f5dfd4
3 changed files with 63 additions and 0 deletions

1
.envrc Normal file
View File

@ -0,0 +1 @@
use flake

27
flake.lock generated Normal file
View File

@ -0,0 +1,27 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1741445498,
"narHash": "sha256-F5Em0iv/CxkN5mZ9hRn3vPknpoWdcdCyR0e4WklHwiE=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "52e3095f6d812b91b22fb7ad0bfc1ab416453634",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-24.11",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}

35
flake.nix Normal file
View File

@ -0,0 +1,35 @@
{
description = "Flake for github:Infisical/infisical repository.";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
};
outputs = { self, nixpkgs }: {
devShells.aarch64-darwin.default = let
pkgs = nixpkgs.legacyPackages.aarch64-darwin;
in
pkgs.mkShell {
packages = with pkgs; [
git
lazygit
nodejs_20
];
shellHook = ''
# Define a writable directory for global npm packages
export NPM_CONFIG_PREFIX="$HOME/.npm-global"
export PATH="$NPM_CONFIG_PREFIX/bin:$PATH"
# Ensure the directory exists
mkdir -p "$NPM_CONFIG_PREFIX"
# Install Infisical CLI only if it's not already installed
if ! command -v infisical &>/dev/null; then
npm install -g @infisical/cli
fi
'';
};
};
}