mirror of
https://github.com/maciej-bendkowski/generic-boltzmann-brain.git
synced 2024-08-17 08:30:30 +03:00
Nix flake devShell and build system
This commit is contained in:
parent
135133db2c
commit
986eb9766b
22
default.nix
Normal file
22
default.nix
Normal file
@ -0,0 +1,22 @@
|
||||
{ mkDerivation, base, containers, mtl, multiset, process
|
||||
, lib, tasty, tasty-hunit
|
||||
# python package needed at test and run time, undeclared in .cabal file
|
||||
, paganini-hs, paganini
|
||||
}:
|
||||
mkDerivation {
|
||||
pname = "generic-boltzmann-brain";
|
||||
version = "0.1.0.0";
|
||||
src = ./.;
|
||||
libraryHaskellDepends = [
|
||||
base containers mtl multiset process tasty tasty-hunit
|
||||
];
|
||||
testHaskellDepends = [
|
||||
base
|
||||
tasty
|
||||
tasty-hunit
|
||||
paganini-hs
|
||||
paganini
|
||||
];
|
||||
homepage = "https://github.com/maciej-bendkowski/generic-boltzmann-brain#readme";
|
||||
license = lib.licenses.bsd3;
|
||||
}
|
95
flake.lock
Normal file
95
flake.lock
Normal file
@ -0,0 +1,95 @@
|
||||
{
|
||||
"nodes": {
|
||||
"flake-utils": {
|
||||
"locked": {
|
||||
"lastModified": 1667395993,
|
||||
"narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"flake-utils_2": {
|
||||
"locked": {
|
||||
"lastModified": 1605370193,
|
||||
"narHash": "sha256-YyMTf3URDL/otKdKgtoMChu4vfVL3vCMkRqpGifhUn0=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "5021eac20303a61fafe17224c087f5519baed54d",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1676150441,
|
||||
"narHash": "sha256-Nfeua9Ua/dGHOQpzOjLtkyMyW/ysQCvZJ9Dd74QQSNk=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "6d87734c880d704f6ee13e5c0fe835b98918c34e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1676060830,
|
||||
"narHash": "sha256-OZJKL08qbLW2xMPNPTgidbC25MrkllUonoFs/JOX4y8=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "9943fcc75d4e43c3116b408b0f93e682927ffbb4",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nixos",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"paganini-hs": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils_2",
|
||||
"nixpkgs": "nixpkgs_2"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1676297967,
|
||||
"narHash": "sha256-uN0uDqErRwPkmSQd2Guu6b01HldI8n5KAhdjR0ETEew=",
|
||||
"owner": "maciej-bendkowski",
|
||||
"repo": "paganini-hs",
|
||||
"rev": "214013fdc8aa274d2e92d50484bc0f840bf77f18",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "maciej-bendkowski",
|
||||
"repo": "paganini-hs",
|
||||
"rev": "214013fdc8aa274d2e92d50484bc0f840bf77f18",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"flake-utils": "flake-utils",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"paganini-hs": "paganini-hs"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
"version": 7
|
||||
}
|
108
flake.nix
Normal file
108
flake.nix
Normal file
@ -0,0 +1,108 @@
|
||||
{
|
||||
description = "Generic Boltzmann Brain";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
|
||||
flake-utils.url = "github:numtide/flake-utils";
|
||||
paganini-hs.url = "github:maciej-bendkowski/paganini-hs/214013fdc8aa274d2e92d50484bc0f840bf77f18";
|
||||
};
|
||||
|
||||
outputs =
|
||||
{
|
||||
self
|
||||
, nixpkgs
|
||||
, flake-utils
|
||||
, paganini-hs
|
||||
, ...
|
||||
}@inputs:
|
||||
flake-utils.lib.eachSystem [ "x86_64-linux" ] (system:
|
||||
let
|
||||
|
||||
name = "generic-boltzmann-brain";
|
||||
compiler = "ghc925";
|
||||
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
config = {
|
||||
allowUnfree = true;
|
||||
allowBroken = true;
|
||||
allowUnsupportedSystem = true;
|
||||
};
|
||||
};
|
||||
|
||||
optas = p: with p;
|
||||
(
|
||||
buildPythonPackage rec {
|
||||
pname = "optas";
|
||||
version = "1.0.3";
|
||||
src = fetchPypi {
|
||||
inherit pname version;
|
||||
sha256 = "sha256-92aaW9ZxvRy/dfYhw7IS+lfDAP2UuBuJhNDNTW7Xkzc=";
|
||||
};
|
||||
doCheck = false;
|
||||
}
|
||||
);
|
||||
|
||||
paganini = p: with p;
|
||||
(
|
||||
buildPythonPackage rec {
|
||||
pname = "paganini";
|
||||
version = "1.5.0";
|
||||
src = fetchPypi {
|
||||
inherit pname version;
|
||||
sha256 = "sha256-hsDqONhBPQlgQHKBh5tdp/pzoXynUz7ztXXILrGgslo=";
|
||||
};
|
||||
doCheck = false;
|
||||
propagatedBuildInputs = [
|
||||
pkgs.python3Packages.numpy
|
||||
pkgs.python3Packages.sympy
|
||||
pkgs.python3Packages.scipy
|
||||
pkgs.python3Packages.networkx
|
||||
pkgs.python3Packages.cvxpy
|
||||
(optas p)
|
||||
];
|
||||
}
|
||||
);
|
||||
|
||||
pythonPackages = p: with p; [
|
||||
(optas p)
|
||||
(paganini p)
|
||||
];
|
||||
|
||||
haskellPackages = pkgs.haskell.packages.${compiler}.override {
|
||||
overrides = self: super: {
|
||||
"${name}" = (self.callCabal2nix "generic-boltzmann-brain" ./. {}).overrideAttrs(
|
||||
old: {
|
||||
nativeBuildInputs = old.nativeBuildInputs ++ [
|
||||
(pkgs.python3.withPackages pythonPackages)
|
||||
];
|
||||
}
|
||||
);
|
||||
|
||||
paganini-hs = pkgs.haskell.lib.dontCheck (
|
||||
super.callCabal2nix "paganini-hs" paganini-hs {});
|
||||
};
|
||||
};
|
||||
|
||||
devShell = haskellPackages.shellFor {
|
||||
withHoogle = true; # Provides docs, optional.
|
||||
packages = p: [
|
||||
p.generic-boltzmann-brain
|
||||
];
|
||||
buildInputs = [
|
||||
haskellPackages.stack
|
||||
haskellPackages.haskell-language-server
|
||||
haskellPackages.hlint
|
||||
haskellPackages.fourmolu
|
||||
(pkgs.python3.withPackages pythonPackages)
|
||||
];
|
||||
};
|
||||
|
||||
defaultPackage = haskellPackages."${name}";
|
||||
derive = import ./.;
|
||||
|
||||
in
|
||||
{
|
||||
inherit derive defaultPackage devShell;
|
||||
});
|
||||
}
|
Loading…
Reference in New Issue
Block a user