From 6cf4c1f9d4d1e54db91386c901ed68d56a076ed7 Mon Sep 17 00:00:00 2001 From: L-Nafaryus Date: Sat, 20 Apr 2024 01:34:48 +0500 Subject: [PATCH] update: devShells: inputs --- devShells/bonfire.nix | 8 ++++++++ devShells/default.nix | 29 ++++++++++++++++++----------- devShells/go.nix | 11 +++++++++-- devShells/netgen.nix | 18 ++++++------------ devShells/openfoam.nix | 12 +++++------- devShells/rust-x11.nix | 28 +++++++++++++++------------- devShells/rust.nix | 8 +++++--- flake.nix | 2 +- 8 files changed, 67 insertions(+), 49 deletions(-) create mode 100644 devShells/bonfire.nix diff --git a/devShells/bonfire.nix b/devShells/bonfire.nix new file mode 100644 index 0000000..2a2a804 --- /dev/null +++ b/devShells/bonfire.nix @@ -0,0 +1,8 @@ +{ crane-lib, pkgs, ... }: +crane-lib.devShell { + packages = with pkgs; [ + # nil + jq + cachix + ]; +} diff --git a/devShells/default.nix b/devShells/default.nix index 27c735c..0a9bf6e 100644 --- a/devShells/default.nix +++ b/devShells/default.nix @@ -1,23 +1,30 @@ # self.devShells.${system} # -{ self, nixpkgs, crane, ... }: +{ self, nixpkgs, ... }: let forAllSystems = nixpkgs.lib.genAttrs [ "x86_64-linux" ]; nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; }); -in forAllSystems(system: let +in forAllSystems(system: + let environment = { pkgs = nixpkgsFor.${system}; - bpkgs = self.packages.${system}; - blib = self.lib; - cranelib = crane.lib.${system}; - in { + + bonfire = self; + bonfire-lib = self.lib; + bonfire-pkgs = self.packages.${system}; + + crane = self.inputs.crane; + crane-lib = self.inputs.crane.lib.${system}; + }; in { - netgen = import ./netgen.nix { inherit pkgs bpkgs; }; + default = import ./bonfire.nix environment; - openfoam = import ./openfoam.nix { inherit pkgs bpkgs; }; + netgen = import ./netgen.nix environment; - rust = import ./rust.nix { inherit pkgs cranelib; }; - rust-x11 = import ./rust-x11.nix { inherit pkgs cranelib; }; + openfoam = import ./openfoam.nix environment; - go = import ./go.nix { inherit pkgs; }; + rust = import ./rust.nix environment; + rust-x11 = import ./rust-x11.nix environment; + + go = import ./go.nix environment; }) diff --git a/devShells/go.nix b/devShells/go.nix index 6f55fe7..bfbf28e 100644 --- a/devShells/go.nix +++ b/devShells/go.nix @@ -1,4 +1,11 @@ { pkgs, ... }: -pkgs.mkShell { - buildInputs = with pkgs; [ go gopls gotools go-tools golangci-lint gnumake ]; +pkgs.mkShellNoCC { + packages = with pkgs; [ + go + gopls + gotools + go-tools + golangci-lint + gnumake + ]; } diff --git a/devShells/netgen.nix b/devShells/netgen.nix index 32b7cea..de15aab 100644 --- a/devShells/netgen.nix +++ b/devShells/netgen.nix @@ -1,15 +1,9 @@ -{ pkgs, bpkgs, ... }: -let - python = pkgs.python3.withPackages(ps: []); - -in pkgs.mkShellNoCC { - packages = with pkgs; [ - bpkgs.netgen - python +{ pkgs, bonfire-pkgs, ... }: +pkgs.mkShellNoCC { + packages = [ + bonfire-pkgs.netgen + pkgs.python3 ]; - shellHook = '' - export PYTHONPATH="${python}/${python.sitePackages}" - export PYTHONPATH="$PYTHONPATH:${bpkgs.netgen}/${python.sitePackages}" - ''; + shellHook = bonfire-pkgs.netgen.passthru.shellHook; } diff --git a/devShells/openfoam.nix b/devShells/openfoam.nix index f18fe4e..86e290b 100644 --- a/devShells/openfoam.nix +++ b/devShells/openfoam.nix @@ -1,11 +1,9 @@ -{ pkgs, bpkgs, ... }: +{ pkgs, bonfire-pkgs, ... }: pkgs.mkShellNoCC { - packages = with pkgs; [ - bpkgs.openfoam - mpi + packages = [ + bonfire-pkgs.openfoam + pkgs.mpi ]; - shellHook = '' - . ${bpkgs.openfoam}/OpenFOAM-${bpkgs.openfoam.major}/etc/bashrc - ''; + shellHook = bonfire-pkgs.openfoam.passthru.shellHook; } diff --git a/devShells/rust-x11.nix b/devShells/rust-x11.nix index 349ad85..c6fbc4f 100644 --- a/devShells/rust-x11.nix +++ b/devShells/rust-x11.nix @@ -1,21 +1,23 @@ -{ pkgs, cranelib, ... }: -cranelib.devShell { +{ pkgs, crane-lib, ... }: +crane-lib.devShell rec { packages = with pkgs; [ - libGL - xorg.libXi xorg.libX11 xorg.libXcursor xorg.libXrandr lld - libxkbcommon + pkg-config + libGL vulkan-loader + vulkan-headers + vulkan-tools + vulkan-validation-layers + xorg.libXi + xorg.libX11 + xorg.libXcursor + xorg.libXrandr + libxkbcommon + libudev-zero + alsa-lib ]; shellHook = '' - export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${ - with pkgs; lib.makeLibraryPath [ - libGL - xorg.libX11 xorg.libXi xorg.libXcursor xorg.libXrandr - libxkbcommon - vulkan-loader - ] - }" + export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${pkgs.lib.makeLibraryPath packages}" ''; } diff --git a/devShells/rust.nix b/devShells/rust.nix index bb1ab54..2f29c32 100644 --- a/devShells/rust.nix +++ b/devShells/rust.nix @@ -1,4 +1,6 @@ -{ pkgs, cranelib, ... }: -cranelib.devShell { - packages = []; +{ pkgs, crane-lib, ... }: +crane-lib.devShell { + packages = [ + pkgs.cargo-watch + ]; } diff --git a/flake.nix b/flake.nix index 301ef97..8484b68 100644 --- a/flake.nix +++ b/flake.nix @@ -65,6 +65,6 @@ apps = import ./apps { inherit self nixpkgs; }; - devShells = import ./devShells { inherit self nixpkgs crane; }; + devShells = import ./devShells { inherit self nixpkgs; }; }; }