diff --git a/.envrc b/.envrc index 1d953f4..3550a30 100644 --- a/.envrc +++ b/.envrc @@ -1 +1 @@ -use nix +use flake diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..0b27cdc --- /dev/null +++ b/flake.lock @@ -0,0 +1,27 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1734083684, + "narHash": "sha256-5fNndbndxSx5d+C/D0p/VF32xDiJCJzyOqorOYW4JEo=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "314e12ba369ccdb9b352a4db26ff419f7c49fa84", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-24.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..265c47a --- /dev/null +++ b/flake.nix @@ -0,0 +1,34 @@ +{ + description = "spectrum-analyzer Rust crate"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11"; + }; + + outputs = + { self, nixpkgs }@inputs: + { + devShells.x86_64-linux.default = + let + pkgs = inputs.nixpkgs.legacyPackages.x86_64-linux; + + # Mainly runtime deps of the examples, not the base lib. + runtimeDeps = with pkgs; [ + alsa-lib + fontconfig + libxkbcommon + xorg.libXcursor + xorg.libX11 + ]; + in + pkgs.mkShell { + packages = + with pkgs; + [ + pkg-config + ] + ++ runtimeDeps; + LD_LIBRARY_PATH = "${pkgs.lib.makeLibraryPath runtimeDeps}"; + }; + }; +} diff --git a/shell.nix b/shell.nix deleted file mode 100644 index 59bf4be..0000000 --- a/shell.nix +++ /dev/null @@ -1,17 +0,0 @@ -{ pkgs ? import {} }: - pkgs.mkShell rec { - nativeBuildInputs = with pkgs; [ - pkg-config - cargo-nextest - ]; - - buildInputs = with pkgs; [ - alsa-lib - fontconfig - libxkbcommon - xorg.libXcursor - xorg.libX11 - ]; - - LD_LIBRARY_PATH = "${pkgs.lib.makeLibraryPath buildInputs}"; -}