summaryrefslogtreecommitdiff
path: root/Omni/Bild.nix
diff options
context:
space:
mode:
Diffstat (limited to 'Omni/Bild.nix')
-rw-r--r--Omni/Bild.nix109
1 files changed, 76 insertions, 33 deletions
diff --git a/Omni/Bild.nix b/Omni/Bild.nix
index fdfa3b8..f36f8f9 100644
--- a/Omni/Bild.nix
+++ b/Omni/Bild.nix
@@ -1,14 +1,24 @@
-{ nixpkgs ? import ./Bild/Nixpkgs.nix }:
-
-let
+{nixpkgs ? import ./Bild/Nixpkgs.nix}: let
constants = import ./Bild/Constants.nix;
# expose some attrs from stable, keep this minimal and simple
- stable = let stable = nixpkgs.nixos-24_11;
+ stable = let
+ stable = nixpkgs.nixos-24_11;
in {
- inherit (stable)
- sources lib makeWrapper ccacheStdenv haskell sbcl python312 nixos mkShell
- dockerTools pkgs;
+ inherit
+ (stable)
+ sources
+ lib
+ makeWrapper
+ ccacheStdenv
+ haskell
+ sbcl
+ python312
+ nixos
+ mkShell
+ dockerTools
+ pkgs
+ ;
stdenv = stable.ccacheStdenv;
};
@@ -19,13 +29,16 @@ let
# makeSourcesPath :: [pkgset] -> str
makeSourcesPath = with stable;
sources:
- lib.trivial.pipe sources [
- (builtins.map lib.attrsets.attrValues)
- lib.lists.flatten
- (builtins.filter (pkg: pkg != null))
- (builtins.map (pkg: if pkg ? src then pkg.src else pkg))
- (lib.strings.concatStringsSep ":")
- ];
+ lib.trivial.pipe sources [
+ (builtins.map lib.attrsets.attrValues)
+ lib.lists.flatten
+ (builtins.filter (pkg: pkg != null))
+ (builtins.map (pkg:
+ if pkg ? src
+ then pkg.src
+ else pkg))
+ (lib.strings.concatStringsSep ":")
+ ];
# this is the main library definitions, recursive references can be made with
# `self.thing`, like in Python objects
@@ -42,7 +55,8 @@ let
# all available packages
deps = import ./Bild/Deps/Haskell.nix;
- packages = self.lib.attrsets.getAttrs self.haskell.deps
+ packages =
+ self.lib.attrsets.getAttrs self.haskell.deps
stable.haskell.packages."${constants.ghcCompiler}";
# make a ghc with dependencies
@@ -78,10 +92,11 @@ let
]);
};
- lisp = { sbclWith = stable.sbcl.withPackages; };
+ lisp = {sbclWith = stable.sbcl.withPackages;};
python = {
- packages = self.lib.attrsets.getAttrs (import ./Bild/Deps/Python.nix)
+ packages =
+ self.lib.attrsets.getAttrs (import ./Bild/Deps/Python.nix)
stable.python312.pkgs;
pythonWith = stable.python312.withPackages;
buildPythonApplication = stable.python312.pkgs.buildPythonApplication;
@@ -93,9 +108,34 @@ let
# exposed packages for inclusion in builds
pkgs = with stable.pkgs; {
- inherit bat bc cmark universal-ctags datasette deadnix fd figlet fzf git
- git-branchless gitlint groff guile hlint indent jq lolcat mypy nixfmt
- ormolu pkg-config ripgrep rustc tree wemux;
+ inherit
+ alejandra
+ bat
+ bc
+ cmark
+ universal-ctags
+ datasette
+ deadnix
+ fd
+ figlet
+ fzf
+ git
+ git-branchless
+ gitlint
+ groff
+ guile
+ hlint
+ indent
+ jq
+ lolcat
+ mypy
+ ormolu
+ pkg-config
+ ripgrep
+ rustc
+ tree
+ wemux
+ ;
llama-cpp = unstable.llama-cpp;
# can't put this in the dev namespace because it pulls in openai with
# python311, which conflicts with any other usage of openai with
@@ -124,18 +164,18 @@ let
../Omni/Test.hs
];
};
- nativeBuildInputs = [ self.haskell.ghcPackageSetBild ];
- buildInputs = [ self.makeWrapper ];
+ nativeBuildInputs = [self.haskell.ghcPackageSetBild];
+ buildInputs = [self.makeWrapper];
propagatedBuildInputs = with self.pkgs; [
pkg-config
git
# this is just to get access to ghc-pkg in bild
- (self.haskell.ghcWith (_: [ ]))
+ (self.haskell.ghcWith (_: []))
# lisp deps, remove this when i implement nix builds for lisp
guile
(self.lisp.sbclWith
- (p: with p; [ alexandria ])) # just enough to build Example.lisp
+ (p: with p; [alexandria])) # just enough to build Example.lisp
];
strictDeps = true;
ghcVersion = self.haskell.ghcVersion;
@@ -158,11 +198,11 @@ let
installPhase = ''
wrapProgram $out/bin/bild \
--prefix PATH : ${
- self.lib.makeBinPath [
- self.haskell.ghcPackageSetBild
- self.pkgs.git
- ]
- } \
+ self.lib.makeBinPath [
+ self.haskell.ghcPackageSetBild
+ self.pkgs.git
+ ]
+ } \
--set GHC_PACKAGE_PATH \
$out/lib/ghc-$ghcVersion/package.conf.d
'';
@@ -177,7 +217,8 @@ let
HOSTNAME = "nix-sandbox";
# we need to remove the $src root because bild expects paths relative to the
# working directory:
- TARGET = "."
+ TARGET =
+ "."
+ self.lib.strings.removePrefix (toString src) (toString target);
buildPhase = ''
export CODEROOT=$(pwd)
@@ -242,14 +283,16 @@ let
# build an os image for a digital ocean droplet
droplet = cfg:
- (stable.nixos ({ modulesPath, ... }: {
+ (stable.nixos ({modulesPath, ...}: {
imports = [
"${toString modulesPath}/virtualisation/digital-ocean-image.nix"
(_args: cfg)
];
- })).digitalOceanImage;
+ }))
+ .digitalOceanImage;
# build a docker image
image = stable.dockerTools.buildImage;
};
-in self
+in
+ self