Statically link binaries
Some checks failed
Test, Build, and Release / test (push) Failing after 50s
Test, Build, and Release / build (push) Has been skipped

This commit is contained in:
James Eversole 2025-02-07 18:32:09 -06:00
parent 0a505172b4
commit ad1918aa6f

View File

@ -2,46 +2,57 @@
description = "tricu";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
nixpkgs = {
url = "https://github.com/nh2/nixpkgs/archive/ede5282c487a1fd2de64303ba59adad6726f1225.tar.gz";
type = "tarball";
flake = false;
};
static-haskell-nix = {
url = "github:nh2/static-haskell-nix";
flake = false;
};
};
outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
packageName = "tricu";
containerPackageName = "${packageName}-container";
outputs = { self, nixpkgs, static-haskell-nix }:
let
system = "x86_64-linux";
compiler = "ghc948";
packageName = "tricu";
customGHC = pkgs.haskellPackages.ghcWithPackages (hpkgs: with hpkgs; [
megaparsec
]);
haskellPackages = pkgs.haskellPackages;
enableSharedExecutables = false;
enableSharedLibraries = false;
tricu = pkgs.haskell.lib.justStaticExecutables self.packages.${system}.default;
in {
packages.${packageName} =
haskellPackages.callCabal2nix packageName self rec {};
packages.default = self.packages.${system}.${packageName};
defaultPackage = self.packages.${system}.default;
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
haskellPackages.cabal-install
haskellPackages.ghc-events
haskellPackages.ghcid
customGHC
upx
];
inputsFrom = builtins.attrValues self.packages.${system};
overlay = self: super: {
haskell = super.haskell // {
packages = super.haskell.packages // {
${compiler} = super.haskell.packages.${compiler}.override {
overrides = final: prev: {
${packageName} = prev.callCabal2nix packageName ./. {};
};
};
};
};
devShell = self.devShells.${system}.default;
};
});
overlays = [overlay];
normalPkgs = import nixpkgs { inherit overlays system; };
survey = import "${static-haskell-nix}/survey" { inherit compiler normalPkgs; };
tricuStatic = survey.haskellPackages.${packageName};
in {
packages.${system}.default = tricuStatic;
devShells.default = normalPkgs.mkShell {
buildInputs = with normalPkgs; [
normalPkgs.haskellPackages.cabal-install
normalPkgs.haskellPackages.ghc-events
normalPkgs.haskellPackages.ghcid
normalPkgs.upx
];
inputsFrom = builtins.attrValues self.packages.${system};
};
devShell = self.devShells.${system}.default;
};
}