From 7b554234b2c3bcb0ab5dd2ca902560444e31dd87 Mon Sep 17 00:00:00 2001 From: Ophestra Date: Mon, 17 Mar 2025 09:49:18 +0900 Subject: [PATCH] nix: clean up devShells Signed-off-by: Ophestra --- flake.nix | 96 +++++++++++++++++++++++++++---------------------------- 1 file changed, 47 insertions(+), 49 deletions(-) diff --git a/flake.nix b/flake.nix index b1929d5..9a10c4d 100644 --- a/flake.nix +++ b/flake.nix @@ -115,19 +115,52 @@ }; fsu = pkgs.callPackage ./cmd/fsu/package.nix { inherit (self.packages.${system}) fortify; }; - dist = pkgs.runCommand "${fortify.name}-dist" { inherit (self.devShells.${system}.default) buildInputs; } '' - # go requires XDG_CACHE_HOME for the build cache - export XDG_CACHE_HOME="$(mktemp -d)" + dist = + pkgs.runCommand "${fortify.name}-dist" + { + buildInputs = + with pkgs; + [ + go + gcc + ] + # buildInputs + ++ ( + with pkgsStatic; + [ + musl + libffi + libseccomp + acl + wayland + wayland-protocols + ] + ++ (with xorg; [ + libxcb + libXau + libXdmcp + ]) + ) + # nativeBuildInputs + ++ [ + pkg-config + wayland-scanner + makeBinaryWrapper + ]; + } + '' + # go requires XDG_CACHE_HOME for the build cache + export XDG_CACHE_HOME="$(mktemp -d)" - # get a different workdir as go does not like /build - cd $(mktemp -d) \ - && cp -r ${fortify.src}/. . \ - && chmod +w cmd && cp -r ${fsu.src}/. cmd/fsu/ \ - && chmod -R +w . + # get a different workdir as go does not like /build + cd $(mktemp -d) \ + && cp -r ${fortify.src}/. . \ + && chmod +w cmd && cp -r ${fsu.src}/. cmd/fsu/ \ + && chmod -R +w . - export FORTIFY_VERSION="v${fortify.version}" - ./dist/release.sh && mkdir $out && cp -v "dist/fortify-$FORTIFY_VERSION.tar.gz"* $out - ''; + export FORTIFY_VERSION="v${fortify.version}" + ./dist/release.sh && mkdir $out && cp -v "dist/fortify-$FORTIFY_VERSION.tar.gz"* $out + ''; fhs = pkgs.buildFHSEnv { pname = "fortify-fhs"; @@ -174,47 +207,12 @@ pkgs = nixpkgsFor.${system}; in { - default = pkgs.mkShell { - buildInputs = - with pkgs; - [ - go - gcc - ] - # buildInputs - ++ ( - with pkgsStatic; - [ - musl - libffi - libseccomp - acl - wayland - wayland-protocols - ] - ++ (with xorg; [ - libxcb - libXau - libXdmcp - ]) - ) - # nativeBuildInputs - ++ [ - pkg-config - wayland-scanner - makeBinaryWrapper - ]; - }; - + default = pkgs.mkShell { inherit (fortify) buildInputs; }; + withPackage = pkgs.mkShell { buildInputs = [ fortify ] ++ fortify.buildInputs; }; fhs = fhs.env; - withPackage = nixpkgsFor.${system}.mkShell { - buildInputs = [ self.packages.${system}.fortify ] ++ self.devShells.${system}.default.buildInputs; - }; - generateDoc = let - pkgs = nixpkgsFor.${system}; inherit (pkgs) lib; doc = @@ -233,7 +231,7 @@ sed -i '/*Declared by:*/,+1 d' $out ''; in - nixpkgsFor.${system}.mkShell { + pkgs.mkShell { shellHook = '' exec cat ${docText} > options.md '';