mirror of https://github.com/voidlizard/hbs2
Initial static builds for HBS2
Use `nix build .#static` to start building
This commit is contained in:
parent
4a8f734584
commit
be86429c4b
29
flake.lock
29
flake.lock
|
@ -85,12 +85,15 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"flake-utils": {
|
"flake-utils": {
|
||||||
|
"inputs": {
|
||||||
|
"systems": "systems"
|
||||||
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1644229661,
|
"lastModified": 1726560853,
|
||||||
"narHash": "sha256-1YdnJAsNy69bpcjuoKdOYQX0YxZBiCYZo4Twxerqv7k=",
|
"narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=",
|
||||||
"owner": "numtide",
|
"owner": "numtide",
|
||||||
"repo": "flake-utils",
|
"repo": "flake-utils",
|
||||||
"rev": "3cecb5b042f7f209c56ffd8371b2711a290ec797",
|
"rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -154,7 +157,9 @@
|
||||||
},
|
},
|
||||||
"haskell-flake-utils": {
|
"haskell-flake-utils": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flake-utils": "flake-utils"
|
"flake-utils": [
|
||||||
|
"flake-utils"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1707809372,
|
"lastModified": 1707809372,
|
||||||
|
@ -291,6 +296,7 @@
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"bytestring-mmap": "bytestring-mmap",
|
"bytestring-mmap": "bytestring-mmap",
|
||||||
"db-pipe": "db-pipe",
|
"db-pipe": "db-pipe",
|
||||||
|
"flake-utils": "flake-utils",
|
||||||
"fuzzy": "fuzzy",
|
"fuzzy": "fuzzy",
|
||||||
"haskell-flake-utils": "haskell-flake-utils",
|
"haskell-flake-utils": "haskell-flake-utils",
|
||||||
"hspup": "hspup",
|
"hspup": "hspup",
|
||||||
|
@ -365,6 +371,21 @@
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://git.hbs2.net/JAuk1UJzZfbDGKVazSQU5yYQ3NGfk4gVeZzBCduf5TgQ"
|
"url": "https://git.hbs2.net/JAuk1UJzZfbDGKVazSQU5yYQ3NGfk4gVeZzBCduf5TgQ"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"systems": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1681028828,
|
||||||
|
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"root": "root",
|
"root": "root",
|
||||||
|
|
250
flake.nix
250
flake.nix
|
@ -5,7 +5,11 @@ inputs = {
|
||||||
|
|
||||||
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
||||||
# haskell-flake-utils.url = "github:ivanovs-4/haskell-flake-utils";
|
# haskell-flake-utils.url = "github:ivanovs-4/haskell-flake-utils";
|
||||||
haskell-flake-utils.url = "github:ivanovs-4/haskell-flake-utils/master";
|
flake-utils.url = "github:numtide/flake-utils";
|
||||||
|
haskell-flake-utils = { # we don't use haskell-flake-utils directly, but we override input evrywhere
|
||||||
|
url = "github:ivanovs-4/haskell-flake-utils/master";
|
||||||
|
inputs.flake-utils.follows = "flake-utils";
|
||||||
|
};
|
||||||
hspup.url = "github:voidlizard/hspup";
|
hspup.url = "github:voidlizard/hspup";
|
||||||
hspup.inputs.nixpkgs.follows = "nixpkgs";
|
hspup.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
hspup.inputs.haskell-flake-utils.follows = "haskell-flake-utils";
|
hspup.inputs.haskell-flake-utils.follows = "haskell-flake-utils";
|
||||||
|
@ -41,124 +45,146 @@ inputs = {
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, nixpkgs, haskell-flake-utils, ... }@inputs:
|
outputs = { self, nixpkgs, flake-utils, ... }@inputs:
|
||||||
let
|
flake-utils.lib.eachSystem ["x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin"]
|
||||||
packageNames = [
|
(system:
|
||||||
"hbs2"
|
|
||||||
"hbs2-peer"
|
|
||||||
"hbs2-core"
|
|
||||||
"hbs2-storage-simple"
|
|
||||||
"hbs2-git"
|
|
||||||
"hbs2-git-dashboard"
|
|
||||||
"hbs2-qblf"
|
|
||||||
"hbs2-keyman"
|
|
||||||
"hbs2-keyman-direct-lib"
|
|
||||||
"hbs2-fixer"
|
|
||||||
"hbs2-cli"
|
|
||||||
"hbs2-sync"
|
|
||||||
"fixme-new"
|
|
||||||
];
|
|
||||||
in
|
|
||||||
haskell-flake-utils.lib.simpleCabalProject2flake {
|
|
||||||
inherit self nixpkgs;
|
|
||||||
systems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
|
|
||||||
name = "hbs2";
|
|
||||||
|
|
||||||
haskellFlakes = with inputs; [
|
|
||||||
suckless-conf
|
|
||||||
db-pipe
|
|
||||||
];
|
|
||||||
|
|
||||||
inherit packageNames;
|
|
||||||
|
|
||||||
packageDirs = {
|
|
||||||
"hbs2" = "./hbs2";
|
|
||||||
"hbs2-tests" = "./hbs2-tests";
|
|
||||||
"hbs2-core" = "./hbs2-core";
|
|
||||||
"hbs2-storage-simple" = "./hbs2-storage-simple";
|
|
||||||
"hbs2-peer" = "./hbs2-peer";
|
|
||||||
"hbs2-keyman" = "./hbs2-keyman/hbs2-keyman";
|
|
||||||
"hbs2-keyman-direct-lib" = "./hbs2-keyman/hbs2-keyman-direct-lib";
|
|
||||||
"hbs2-git" = "./hbs2-git";
|
|
||||||
"hbs2-git-dashboard" = "./hbs2-git-dashboard";
|
|
||||||
"hbs2-fixer" = "./hbs2-fixer";
|
|
||||||
"hbs2-cli" = "./hbs2-cli";
|
|
||||||
"hbs2-sync" = "./hbs2-sync";
|
|
||||||
"fixme-new" = "./fixme-new";
|
|
||||||
};
|
|
||||||
|
|
||||||
hpPreOverrides = {pkgs, ...}: final: prev: ((with pkgs; {
|
|
||||||
saltine = prev.callCabal2nix "saltine" inputs.saltine { inherit (pkgs) libsodium; };
|
|
||||||
scotty = final.callHackage "scotty" "0.21" { };
|
|
||||||
bytestring-mmap = prev.callCabal2nix "bytestring-mmap" inputs.bytestring-mmap {};
|
|
||||||
skylighting-lucid = final.callHackage "skylighting-lucid" "1.0.4" { };
|
|
||||||
# wai-app-file-cgi = final.callHackage "wai-app-file-cgi" "3.1.11" { };
|
|
||||||
# htags = final.callHackage "htags" "1.0.1" { };
|
|
||||||
}) //
|
|
||||||
(with haskell-flake-utils.lib;
|
|
||||||
with pkgs.haskell.lib;
|
|
||||||
let
|
let
|
||||||
donts = [
|
packageNames =
|
||||||
(jailbreakUnbreak pkgs)
|
topLevelPackages ++ keymanPackages;
|
||||||
# dontBenchmark
|
|
||||||
|
keymanPackages =
|
||||||
|
[
|
||||||
|
"hbs2-keyman"
|
||||||
|
"hbs2-keyman-direct-lib"
|
||||||
|
];
|
||||||
|
|
||||||
|
topLevelPackages =
|
||||||
|
[
|
||||||
|
"hbs2"
|
||||||
|
"hbs2-peer"
|
||||||
|
"hbs2-core"
|
||||||
|
"hbs2-storage-simple"
|
||||||
|
"hbs2-git"
|
||||||
|
"hbs2-git-dashboard"
|
||||||
|
"hbs2-qblf"
|
||||||
|
"hbs2-fixer"
|
||||||
|
"hbs2-cli"
|
||||||
|
"hbs2-sync"
|
||||||
|
"fixme-new"
|
||||||
|
];
|
||||||
|
|
||||||
|
pkgs = import nixpkgs {
|
||||||
|
inherit system;
|
||||||
|
overlays = [defaultOverlay];
|
||||||
|
};
|
||||||
|
|
||||||
|
defaultOverlay = final: prev:
|
||||||
|
(prev.lib.composeManyExtensions
|
||||||
|
[
|
||||||
|
overlay
|
||||||
|
inputs.suckless-conf.overlays.default
|
||||||
|
inputs.db-pipe.overlays.default
|
||||||
|
]) final prev;
|
||||||
|
|
||||||
|
packagePostOverrides = pkg: with pkgs.haskell.lib.compose; pkgs.lib.pipe pkg [
|
||||||
|
disableExecutableProfiling
|
||||||
|
disableLibraryProfiling
|
||||||
|
dontBenchmark
|
||||||
dontCoverage
|
dontCoverage
|
||||||
|
dontDistribute
|
||||||
|
dontHaddock
|
||||||
|
dontHyperlinkSource
|
||||||
|
doStrip
|
||||||
|
enableDeadCodeElimination
|
||||||
|
justStaticExecutables
|
||||||
|
|
||||||
dontCheck
|
dontCheck
|
||||||
|
|
||||||
|
(overrideCabal (drv: {
|
||||||
|
preBuild = ''
|
||||||
|
export GIT_HASH="${self.rev or self.dirtyRev or "dirty"}"
|
||||||
|
'';
|
||||||
|
}))
|
||||||
];
|
];
|
||||||
in tunePackages pkgs prev {
|
|
||||||
wai-app-file-cgi = donts;
|
|
||||||
}
|
|
||||||
));
|
|
||||||
|
|
||||||
packagePostOverrides = { pkgs }: with pkgs; with haskell.lib; [
|
|
||||||
disableExecutableProfiling
|
|
||||||
disableLibraryProfiling
|
|
||||||
dontBenchmark
|
|
||||||
dontCoverage
|
|
||||||
dontDistribute
|
|
||||||
dontHaddock
|
|
||||||
dontHyperlinkSource
|
|
||||||
doStrip
|
|
||||||
enableDeadCodeElimination
|
|
||||||
justStaticExecutables
|
|
||||||
|
|
||||||
dontCheck
|
jailbreakUnbreak = pkg:
|
||||||
|
pkgs.haskell.lib.doJailbreak (pkg.overrideAttrs (_: { meta = { }; }));
|
||||||
(compose.overrideCabal (drv: {
|
|
||||||
preBuild = ''
|
|
||||||
export GIT_HASH="${self.rev or self.dirtyRev or "dirty"}"
|
|
||||||
'';
|
|
||||||
}))
|
|
||||||
|
|
||||||
];
|
|
||||||
|
|
||||||
shell = {pkgs, ...}:
|
|
||||||
pkgs.haskellPackages.shellFor {
|
|
||||||
packages = _: pkgs.lib.attrsets.attrVals packageNames pkgs.haskellPackages;
|
|
||||||
# withHoogle = true;
|
|
||||||
buildInputs = (
|
|
||||||
with pkgs.haskellPackages; ([
|
|
||||||
ghcid
|
|
||||||
cabal-install
|
|
||||||
haskell-language-server
|
|
||||||
hoogle
|
|
||||||
# htags
|
|
||||||
text-icu
|
|
||||||
magic
|
|
||||||
pkgs.icu72
|
|
||||||
pkgs.openssl
|
|
||||||
weeder
|
|
||||||
])
|
|
||||||
++
|
|
||||||
[ pkgs.pkg-config
|
|
||||||
inputs.hspup.packages.${pkgs.system}.default
|
|
||||||
]
|
|
||||||
);
|
|
||||||
|
|
||||||
shellHook = ''
|
|
||||||
export GIT_HASH="${self.rev or self.dirtyRev or "dirty"}"
|
|
||||||
'';
|
|
||||||
|
|
||||||
|
overlay = final: prev: let pkgs = prev; in
|
||||||
|
{
|
||||||
|
haskellPackages = pkgs.haskellPackages.override {
|
||||||
|
overrides = new: old: with pkgs.haskell.lib;
|
||||||
|
{
|
||||||
|
scotty = new.callHackage "scotty" "0.21" { };
|
||||||
|
bytestring-mmap = jailbreakUnbreak old.bytestring-mmap; # old.callCabal2nix "bytestring-mmap" inputs.bytestring-mmap {};
|
||||||
|
skylighting-lucid = new.callHackage "skylighting-lucid" "1.0.4" { };
|
||||||
|
wai-app-file-cgi = dontCoverage (dontCheck (jailbreakUnbreak old.wai-app-file-cgi));
|
||||||
|
saltine = old.callCabal2nix "saltine" inputs.saltine { inherit (pkgs) libsodium; };
|
||||||
|
}
|
||||||
|
// pkgs.lib.genAttrs topLevelPackages (name:
|
||||||
|
old.callCabal2nix name "${self}/${name}" {})
|
||||||
|
// pkgs.lib.genAttrs keymanPackages (name:
|
||||||
|
old.callCabal2nix name "${self}/hbs2-keyman/${name}" {});
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
|
||||||
|
makePackages = pkgs:
|
||||||
|
pkgs.lib.mapAttrs
|
||||||
|
(_name: packagePostOverrides) # we can't apply overrides inside our overlay because it will remove linking info
|
||||||
|
(pkgs.lib.getAttrs packageNames pkgs.haskellPackages);
|
||||||
|
|
||||||
|
# dynamic packages don't work at the moment, because
|
||||||
|
# ivanovs-4/bytestring-mmap doesn't compile with ghc 9.4
|
||||||
|
# and bytestring-mmap doesn't compire with ghc > 9.6
|
||||||
|
packagesDynamic = makePackages pkgs;
|
||||||
|
packagesStatic = makePackages pkgs.pkgsStatic;
|
||||||
|
in {
|
||||||
|
legacyPackages = pkgs;
|
||||||
|
|
||||||
|
packages =
|
||||||
|
packagesDynamic //
|
||||||
|
{
|
||||||
|
default =
|
||||||
|
pkgs.symlinkJoin {
|
||||||
|
name = "hbs2-all";
|
||||||
|
paths = builtins.attrValues packagesDynamic;
|
||||||
|
};
|
||||||
|
static =
|
||||||
|
pkgs.symlinkJoin {
|
||||||
|
name = "hbs2-static";
|
||||||
|
paths = builtins.attrValues packagesStatic;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
devShell.default = pkgs.haskellPackages.shellFor {
|
||||||
|
packages = _: pkgs.lib.attrsets.attrVals packageNames pkgs.haskellPackages;
|
||||||
|
# withHoogle = true;
|
||||||
|
buildInputs = (
|
||||||
|
with pkgs.haskellPackages; [
|
||||||
|
ghcid
|
||||||
|
cabal-install
|
||||||
|
haskell-language-server
|
||||||
|
hoogle
|
||||||
|
# htags
|
||||||
|
text-icu
|
||||||
|
magic
|
||||||
|
pkgs.icu72
|
||||||
|
pkgs.openssl
|
||||||
|
weeder
|
||||||
|
]
|
||||||
|
++
|
||||||
|
[ pkgs.pkg-config
|
||||||
|
inputs.hspup.packages.${pkgs.system}.default
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
shellHook = ''
|
||||||
|
export GIT_HASH="${self.rev or self.dirtyRev or "dirty"}"
|
||||||
|
'';
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||||
|
{-# LANGUAGE CPP #-}
|
||||||
module HBS2.Git.Web.Html.Fixme where
|
module HBS2.Git.Web.Html.Fixme where
|
||||||
|
|
||||||
import HBS2.Git.DashBoard.Prelude
|
import HBS2.Git.DashBoard.Prelude
|
||||||
|
@ -20,6 +21,10 @@ import Data.List qualified as List
|
||||||
import Web.Scotty.Trans as Scotty
|
import Web.Scotty.Trans as Scotty
|
||||||
|
|
||||||
|
|
||||||
|
#if __GLASGOW_HASKELL__ < 906
|
||||||
|
import Control.Applicative -- add liftA2 into scope
|
||||||
|
#endif
|
||||||
|
|
||||||
instance ToHtml (H FixmeKey) where
|
instance ToHtml (H FixmeKey) where
|
||||||
toHtmlRaw (H k) = toHtmlRaw $ take 10 $ show $ pretty k
|
toHtmlRaw (H k) = toHtmlRaw $ take 10 $ show $ pretty k
|
||||||
toHtml (H k) = toHtml $ take 10 $ show $ pretty k
|
toHtml (H k) = toHtml $ take 10 $ show $ pretty k
|
||||||
|
@ -93,5 +98,3 @@ repoFixme q@(FromParams p') lww = do
|
||||||
, hxSwap_ "afterend"
|
, hxSwap_ "afterend"
|
||||||
] do
|
] do
|
||||||
td_ [colspan_ "3"] mempty
|
td_ [colspan_ "3"] mempty
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
{-# LANGUAGE CPP #-}
|
||||||
|
|
||||||
module HBS2.Git.Web.Html.Issue (issuePage) where
|
module HBS2.Git.Web.Html.Issue (issuePage) where
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,6 +22,9 @@ import Data.Text qualified as Text
|
||||||
import Lucid.Base
|
import Lucid.Base
|
||||||
import Lucid.Html5 hiding (for_)
|
import Lucid.Html5 hiding (for_)
|
||||||
|
|
||||||
|
#if __GLASGOW_HASKELL__ < 906
|
||||||
|
import Control.Applicative -- add liftA2 into scope
|
||||||
|
#endif
|
||||||
|
|
||||||
data IssueOptionalArg w t = IssueOptionalArg w t
|
data IssueOptionalArg w t = IssueOptionalArg w t
|
||||||
|
|
||||||
|
@ -146,5 +151,3 @@ issuePage repo@(RepoLww lww) f = rootPage do
|
||||||
where
|
where
|
||||||
trim before seize txt =
|
trim before seize txt =
|
||||||
Text.lines txt & drop before & take seize & Text.unlines
|
Text.lines txt & drop before & take seize & Text.unlines
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue