add flake.nix

This commit is contained in:
lia
2025-09-14 12:16:34 +02:00
parent 48f1b29083
commit 6ee8b07d06
5 changed files with 315 additions and 164 deletions

38
flake.nix Normal file
View File

@@ -0,0 +1,38 @@
{
description = "cutie flake ~";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
gitignore = { url = "github:hercules-ci/gitignore.nix"; flake = false; };
flake-utils.url = "github:numtide/flake-utils";
rustup.url = "github:oxalica/rust-overlay";
};
outputs = inputs@{ self, nixpkgs, flake-utils, rustup, ... }:
flake-utils.lib.eachSystem [ "x86_64-linux" ] (system: let
overlays = [ (import rustup) ];
pkgs = import nixpkgs { inherit system overlays; };
libPath = with pkgs; lib.makeLibraryPath [
libGL libxkbcommon
wayland wayland-utils
musl musl-fts musl-obstack
makeWrapper pkg-config gcc
libiconv libtool autoconf automake
];
gitignoreSrc = pkgs.callPackage inputs.gitignore { };
in rec {
packages.hello = pkgs.callPackage ./default.nix { inherit gitignoreSrc; };
legacyPackages = packages;
defaultPackage = packages.hello;
devShell = pkgs.mkShell {
CARGO_INSTALL_ROOT = "${toString ./.}/.cargo";
RUST_SRC_PATH = "${pkgs.rustPlatform.rustLibSrc}";
LD_LIBRARY_PATH = libPath;
buildInputs = with pkgs; [ (rust-bin.selectLatestNightlyWith (toolchain: toolchain.complete.override {
targets = [ "x86_64-unknown-linux-musl" "wasm32-unknown-unknown" ];
})) ];
};
});
}