-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
190 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,9 @@ | ||
# [[file:~/Git/Github/C++/Forks/structureFactor/literateNix.org::finalNix][finalNix]] | ||
# Nix skeleton for compiler, cmake, boost. | ||
# Dependencies (boost and the rest) are built with selected compiler (for ABI compatibility). | ||
# Examples: | ||
# nix-shell --argstr compiler gcc5 --run 'mkdir build && cd build && cmake .. && cmake --build .' | ||
# nix-shell --argstr compiler gcc6 --run 'mkdir build && cd build && cmake .. && cmake --build .' | ||
# nix-shell --argstr compiler clang_38 --run 'mkdir build && cd build && cmake .. && cmake --build .' | ||
{ nixpkgs ? import <nixpkgs> {}, compiler ? "clang" }: | ||
let | ||
stdenv = nixpkgs.overrideCC nixpkgs.stdenv nixpkgs.${compiler}; | ||
in rec { | ||
myProject = stdenv.mkDerivation { | ||
name = "supaaYoda"; | ||
version = "dev-0.1"; | ||
nativeBuildInputs = [ nixpkgs.boost nixpkgs.lua nixpkgs.cmake nixpkgs.luarocks nixpkgs.blas nixpkgs.conan nixpkgs.libyaml ]; | ||
buildInputs = [ ]; | ||
}; | ||
} | ||
# finalNix ends here | ||
# [[file:~/Git/Github/C++/Forks/structureFactor/literateNix.org::*Project%20Root][Project Root:1]] | ||
# Define | ||
let | ||
# Import | ||
buildpkgs = import ./nix {}; | ||
in | ||
# Pass to | ||
buildpkgs.yodaStruct | ||
# Project Root:1 ends here |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# [[file:~/Git/Github/C++/Forks/structureFactor/literateNix.org::*Project%20Source][Project Source:1]] | ||
# Usage Example | ||
# nix-shell --argstr compiler gcc5 --run bash | ||
# nix-shell --argstr compiler clang --run bash | ||
# something ? default value ---- Variable declration | ||
# pattern : body ---- Function prototype | ||
{ nixpkgs ? import ./nixpkgs | ||
, compiler ? "clang" | ||
}: | ||
# Define | ||
let overlay = self: buildpkgs: with buildpkgs; { | ||
# All the other nix files | ||
fetchJSON = import ./fetchJSON.nix { inherit (buildpkgs) fetchFromGitHub; }; | ||
# Package for testing | ||
catch2 = callPackage ./catch2.nix {}; | ||
conan = callPackage ./pkgs/conan/conan.nix { }; | ||
# Program expression | ||
yodaStruct = callPackage ./yodaStruct.nix {}; | ||
}; in | ||
# Ensure reproducibility | ||
nixpkgs { | ||
config = {}; | ||
overlays = [overlay]; | ||
} | ||
# Project Source:1 ends here |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# [[file:~/Git/Github/C++/Forks/structureFactor/literateNix.org::*Helper%20Functions][Helper Functions:1]] | ||
{ fetchFromGitHub }: | ||
|
||
# fetches the source described in the <package>.src.json | ||
|
||
# path to the .src.json | ||
path: | ||
let | ||
data = builtins.fromJSON (builtins.readFile path); | ||
in | ||
fetchFromGitHub { inherit (data) owner repo rev sha256; } | ||
# Helper Functions:1 ends here |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
source $stdenv/setup | ||
mkdir pureBuild && cd pureBuild | ||
cmake -DCMAKE_BUILD_TYPE=Release | ||
make |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# [[file:~/Git/Github/C++/Forks/structureFactor/literateNix.org::*Entry][Entry:1]] | ||
# Define | ||
let | ||
spec = builtins.fromJSON (builtins.readFile ./default.src.json); | ||
fetchTarball = import ./fetchTarball-compat.nix; | ||
src = fetchTarball { | ||
url = "https://github.com/${spec.owner}/${spec.repo}/archive/${spec.rev}.tar.gz"; | ||
sha256 = spec.sha256; | ||
}; | ||
in | ||
import src | ||
# Entry:1 ends here |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"owner": "NixOS", | ||
"repo": "nixpkgs-channels", | ||
"branch": "nixos-18.09", | ||
"rev": "ae002fe44e96b868c62581e8066d559ca2179e01", | ||
"sha256": "1bawyz3ksw2sihv6vsgbvhdm4kn63xrrj5bavg6mz5mxml9rji89" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# [[file:~/Git/Github/C++/Forks/structureFactor/literateNix.org::*Using%20the%20JSON][Using the JSON:2]] | ||
# fetchTarball version that is compatible between all the versions of Nix | ||
{ url, sha256 }@attrs: | ||
let | ||
inherit (builtins) lessThan nixVersion fetchTarball; | ||
in | ||
if lessThan nixVersion "1.12" then | ||
fetchTarball { inherit url; } | ||
else | ||
fetchTarball attrs | ||
# Using the JSON:2 ends here |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# [[file:~/Git/Github/C++/Forks/structureFactor/literateNix.org::*Conan][Conan:3]] | ||
{ lib, python3, fetchpatch, git }: | ||
|
||
let newPython = python3.override { | ||
packageOverrides = self: super: { | ||
distro = super.distro.overridePythonAttrs (oldAttrs: rec { | ||
version = "1.2.0"; | ||
src = oldAttrs.src.override { | ||
inherit version; | ||
sha256 = "1vn1db2akw98ybnpns92qi11v94hydwp130s8753k6ikby95883j"; | ||
}; | ||
}); | ||
node-semver = super.node-semver.overridePythonAttrs (oldAttrs: rec { | ||
version = "0.2.0"; | ||
src = oldAttrs.src.override { | ||
inherit version; | ||
sha256 = "1080pdxrvnkr8i7b7bk0dfx6cwrkkzzfaranl7207q6rdybzqay3"; | ||
}; | ||
}); | ||
future = super.future.overridePythonAttrs (oldAttrs: rec { | ||
version = "0.16.0"; | ||
src = oldAttrs.src.override { | ||
inherit version; | ||
sha256 = "1nzy1k4m9966sikp0qka7lirh8sqrsyainyf8rk97db7nwdfv773"; | ||
}; | ||
}); | ||
tqdm = super.tqdm.overridePythonAttrs (oldAttrs: rec { | ||
version = "4.28.1"; | ||
src = oldAttrs.src.override { | ||
inherit version; | ||
sha256 = "1fyybgbmlr8ms32j7h76hz5g9xc6nf0644mwhc40a0s5k14makav"; | ||
}; | ||
}); | ||
}; | ||
}; | ||
|
||
in newPython.pkgs.buildPythonApplication rec { | ||
version = "1.9.1"; | ||
pname = "conan"; | ||
|
||
src = newPython.pkgs.fetchPypi { | ||
inherit pname version; | ||
sha256 = "0mn69ps84w8kq76zba2gnlqlp855a6ksbl1l6pd1gkjlp9ry0hnf"; | ||
}; | ||
checkInputs = [ | ||
git | ||
] ++ (with newPython.pkgs; [ | ||
nose | ||
parameterized | ||
mock | ||
webtest | ||
codecov | ||
]); | ||
|
||
propagatedBuildInputs = with newPython.pkgs; [ | ||
requests fasteners pyyaml pyjwt colorama patch | ||
bottle pluginbase six distro pylint node-semver | ||
future pygments mccabe deprecation tqdm | ||
]; | ||
|
||
checkPhase = '' | ||
export HOME="$TMP/conan-home" | ||
mkdir -p "$HOME" | ||
''; | ||
|
||
meta = with lib; { | ||
homepage = https://conan.io; | ||
description = "Decentralized and portable C/C++ package manager"; | ||
license = licenses.mit; | ||
platforms = platforms.linux; | ||
}; | ||
} | ||
# Conan:3 ends here |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"owner": "conan-io", | ||
"repo": "conan", | ||
"branch": "release/1.9.1", | ||
"rev": "bcb6080d98e7d4e5ed6fafdeb9f3e254c03123e4", | ||
"sha256": "1bm1c43aswz69rvxp6z61gn310x9k77ixih64kprhdwwzqn1ja4c" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# [[file:~/Git/Github/C++/Forks/structureFactor/literateNix.org::*Expression][Expression:1]] | ||
# Using patterns, and white space negligence | ||
{ clangStdenv | ||
, lua | ||
, conan | ||
, luaPackages | ||
, lib | ||
, boost | ||
, cmake }: | ||
clangStdenv.mkDerivation { | ||
name = "yodaStruct"; | ||
src = lib.cleanSource ../.; | ||
nativeBuildInputs = [ | ||
cmake | ||
lua | ||
conan | ||
]; | ||
buildInputs = [ | ||
boost | ||
luaPackages.luafilesystem | ||
]; | ||
} | ||
# Expression:1 ends here |