mirror of
https://github.com/stoatchat/stoatchat.git
synced 2026-10-31 13:37:42 +00:00
feat(nix): migrate to flake and remove default.nix (#1019)
Signed-off-by: en <54501296+2hexed@users.noreply.github.com>
This commit is contained in:
@@ -48,8 +48,7 @@ Before getting started, you'll want to install:
|
||||
- Git
|
||||
- mold (optional, faster compilation)
|
||||
|
||||
> A **default.nix** is available for Nix users!
|
||||
> Run `nix-shell` to activate mise.
|
||||
> **Flake** is available for Nix users! Run `nix develop` to enter the dev shell.
|
||||
|
||||
As a heads-up, the development environment uses the following ports:
|
||||
|
||||
|
||||
43
default.nix
43
default.nix
@@ -1,43 +0,0 @@
|
||||
{ pkgs ? import (fetchTarball {
|
||||
url = "https://github.com/NixOS/nixpkgs/archive/77ef7a29d276c6d8303aece3444d61118ef71ac2.tar.gz";
|
||||
sha256 = "0pm4l48jq8plzrrrisimahxqlcpx7qqq9c99hylmf7p3zlc3phsy";
|
||||
}) {},
|
||||
}:
|
||||
|
||||
let
|
||||
nix-ld-libs = pkgs.buildEnv {
|
||||
name = "nix-ld-libs";
|
||||
paths = with pkgs; [
|
||||
stdenv.cc.cc.lib
|
||||
zlib
|
||||
openssl.out
|
||||
dav1d
|
||||
];
|
||||
pathsToLink = [ "/lib" ];
|
||||
};
|
||||
|
||||
in pkgs.mkShell {
|
||||
packages = with pkgs; [
|
||||
mise
|
||||
cargo-binstall
|
||||
(writeShellScriptBin "fish" ''
|
||||
exec ${pkgs.fish}/bin/fish -C 'mise activate fish | source' "$@"
|
||||
'')
|
||||
];
|
||||
|
||||
buildInputs = with pkgs; [
|
||||
pkg-config
|
||||
openssl.dev
|
||||
dav1d
|
||||
];
|
||||
|
||||
shellHook = ''
|
||||
export TMPDIR=/tmp
|
||||
export NIX_LD="${pkgs.stdenv.cc.libc}/lib/ld-linux-x86-64.so.2"
|
||||
export NIX_LD_LIBRARY_PATH="${nix-ld-libs}/lib"
|
||||
export LD_LIBRARY_PATH="${nix-ld-libs}/lib''${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
|
||||
|
||||
export MISE_NODE_COMPILE=false
|
||||
eval "$(mise activate bash)"
|
||||
'';
|
||||
}
|
||||
27
flake.lock
generated
Normal file
27
flake.lock
generated
Normal file
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"nodes": {
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1790185690,
|
||||
"narHash": "sha256-xJ+X4hBtOcAFGBOe5nAMyMUeF9foJBmIOu3NjBqBycU=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "4975466d324710c576dc11ad614684e6bd8cad8e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
||||
58
flake.nix
Normal file
58
flake.nix
Normal file
@@ -0,0 +1,58 @@
|
||||
{
|
||||
description = "Development environment for stoatchat";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs }:
|
||||
let
|
||||
supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
|
||||
forEachSystem = nixpkgs.lib.genAttrs supportedSystems;
|
||||
in
|
||||
{
|
||||
devShells = forEachSystem (system:
|
||||
let
|
||||
pkgs = import nixpkgs { inherit system; };
|
||||
|
||||
nix-ld-libs = pkgs.buildEnv {
|
||||
name = "nix-ld-libs";
|
||||
paths = with pkgs; [
|
||||
stdenv.cc.cc.lib
|
||||
zlib
|
||||
openssl.out
|
||||
dav1d
|
||||
];
|
||||
pathsToLink = [ "/lib" ];
|
||||
};
|
||||
in
|
||||
{
|
||||
default = pkgs.mkShell {
|
||||
packages = with pkgs; [
|
||||
mise
|
||||
cargo-binstall
|
||||
pkg-config
|
||||
openssl
|
||||
openssl.dev
|
||||
meson
|
||||
ninja
|
||||
mold
|
||||
nasm
|
||||
];
|
||||
|
||||
shellHook = ''
|
||||
# Crucial for rust openssl-sys compilation via cargo
|
||||
export PKG_CONFIG_PATH="\({pkgs.openssl.dev}/lib/pkgconfig:\){pkgs.dav1d}/lib/pkgconfig\({PKG_CONFIG_PATH:+:\)PKG_CONFIG_PATH}"
|
||||
export OPENSSL_DIR="${pkgs.openssl.dev}"
|
||||
export OPENSSL_LIB_DIR="${pkgs.openssl.out}/lib"
|
||||
|
||||
export MISE_NODE_COMPILE=false
|
||||
if command -v mise &> /dev/null; then
|
||||
eval "$(mise activate bash)"
|
||||
fi
|
||||
'';
|
||||
};
|
||||
}
|
||||
);
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user