diff options
Diffstat (limited to 'flake.nix')
| -rw-r--r-- | flake.nix | 150 |
1 files changed, 96 insertions, 54 deletions
@@ -95,72 +95,114 @@ packages = forAllSystems ( system: let + inherit (self.packages.${system}) fortify; pkgs = nixpkgsFor.${system}; in { default = self.packages.${system}.fortify; - fortify = pkgs.callPackage ./package.nix { }; + + 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)" + + # get a different workdir as go does not like /build + cd $(mktemp -d) && cp -r ${fortify.src}/. . && chmod -R +w . + + 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"; + inherit (fortify) version; + targetPkgs = + pkgs: + with pkgs; + [ + go + gcc + pkg-config + wayland-scanner + ] + ++ ( + with pkgs.pkgsStatic; + [ + musl + libffi + acl + wayland + wayland-protocols + ] + ++ (with xorg; [ + libxcb + libXau + libXdmcp + + xorgproto + ]) + ); + extraOutputsToInstall = [ "dev" ]; + profile = '' + export PKG_CONFIG_PATH="/usr/share/pkgconfig:$PKG_CONFIG_PATH" + ''; + }; } ); - devShells = forAllSystems (system: { - default = nixpkgsFor.${system}.mkShell { - buildInputs = with nixpkgsFor.${system}; self.packages.${system}.fortify.buildInputs; - }; + devShells = forAllSystems ( + system: + let + inherit (self.packages.${system}) fortify fhs; + pkgs = nixpkgsFor.${system}; + in + { + default = pkgs.mkShell { + buildInputs = + with pkgs; + [ + go + gcc + ] + ++ fortify.buildInputs + ++ fortify.nativeBuildInputs; + }; - fhs = nixpkgsFor.${system}.buildFHSEnv { - pname = "fortify-fhs"; - inherit (self.packages.${system}.fortify) version; - targetPkgs = - pkgs: with pkgs; [ - go - gcc - pkg-config - acl - wayland - wayland-scanner - wayland-protocols - xorg.libxcb - ]; - extraOutputsToInstall = [ "dev" ]; - profile = '' - export PKG_CONFIG_PATH="/usr/share/pkgconfig:$PKG_CONFIG_PATH" - ''; - }; + fhs = fhs.env; - withPackage = nixpkgsFor.${system}.mkShell { - buildInputs = - with nixpkgsFor.${system}; - self.packages.${system}.fortify.buildInputs ++ [ self.packages.${system}.fortify ]; - }; + withPackage = nixpkgsFor.${system}.mkShell { + buildInputs = [ self.packages.${system}.fortify ] ++ self.devShells.${system}.default.buildInputs; + }; - generateDoc = - let - pkgs = nixpkgsFor.${system}; - inherit (pkgs) lib; + generateDoc = + let + pkgs = nixpkgsFor.${system}; + inherit (pkgs) lib; - doc = - let - eval = lib.evalModules { - specialArgs = { - inherit pkgs; + doc = + let + eval = lib.evalModules { + specialArgs = { + inherit pkgs; + }; + modules = [ ./options.nix ]; }; - modules = [ ./options.nix ]; - }; - cleanEval = lib.filterAttrsRecursive (n: _: n != "_module") eval; - in - pkgs.nixosOptionsDoc { inherit (cleanEval) options; }; - docText = pkgs.runCommand "fortify-module-docs.md" { } '' - cat ${doc.optionsCommonMark} > $out - sed -i '/*Declared by:*/,+1 d' $out - ''; - in - nixpkgsFor.${system}.mkShell { - shellHook = '' - exec cat ${docText} > options.md - ''; - }; - }); + cleanEval = lib.filterAttrsRecursive (n: _: n != "_module") eval; + in + pkgs.nixosOptionsDoc { inherit (cleanEval) options; }; + docText = pkgs.runCommand "fortify-module-docs.md" { } '' + cat ${doc.optionsCommonMark} > $out + sed -i '/*Declared by:*/,+1 d' $out + ''; + in + nixpkgsFor.${system}.mkShell { + shellHook = '' + exec cat ${docText} > options.md + ''; + }; + } + ); }; } |
