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"; description = "tricu";
inputs = { inputs = {
nixpkgs.url = "github:NixOS/nixpkgs"; nixpkgs = {
flake-utils.url = "github:numtide/flake-utils"; 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 }: outputs = { self, nixpkgs, static-haskell-nix }:
flake-utils.lib.eachDefaultSystem (system: let
let system = "x86_64-linux";
pkgs = nixpkgs.legacyPackages.${system}; compiler = "ghc948";
packageName = "tricu"; packageName = "tricu";
containerPackageName = "${packageName}-container";
customGHC = pkgs.haskellPackages.ghcWithPackages (hpkgs: with hpkgs; [ overlay = self: super: {
megaparsec haskell = super.haskell // {
]); packages = super.haskell.packages // {
${compiler} = super.haskell.packages.${compiler}.override {
haskellPackages = pkgs.haskellPackages; overrides = final: prev: {
${packageName} = prev.callCabal2nix packageName ./. {};
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};
}; };
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;
};
} }