Created
February 11, 2019 23:55
-
-
Save benley/a31f0635cca3f5bff4eeccf48c6789a7 to your computer and use it in GitHub Desktop.
nix monorepo example layout
This file contains hidden or 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
{ "url": "https://github.com/nixos/nixpkgs/archive/804c227b83faa017c377eb899d18e5931e0ad936.tar.gz" } |
This file contains hidden or 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
with rec { | |
versionFile = ./.version; | |
repoVersion = if builtins.pathExists versionFile | |
then builtins.readFile versionFile | |
else "dev"; | |
nixpkgsSrc = fetchTarball (builtins.fromJSON (builtins.readFile ./.nixpkgs.json)); | |
pkgs = import nixpkgsSrc { | |
config = {}; | |
overlays = [(import ./pkgs_overlay.nix)]; | |
}; | |
}; | |
{ docker_tag ? pkgs.lib.removeSuffix "\n" repoVersion }: | |
let myPkgs = self: | |
rec { | |
inherit (self) lib callPackage; | |
recurseInto = target: overrides: self.recurseIntoAttrs (lib.callPackagesWith self target overrides); | |
inherit docker_tag; | |
local_app_1 = recurseInto ./src/local_app_1 {}; | |
local_app_2 = recurseInto ./src/local_app_2 {}; | |
local_app_3 = recurseInto ./src/local_app_3 {}; | |
}; | |
in | |
# This calls myPkgs with a combined packageset of itself, our overlay, and | |
# nixpkgs. Then the part that gets exposed to the "outside" is just the things | |
# defined in myPkgs. Believe it or not, this does not result in infinite | |
# recursion. | |
myPkgs (pkgs // myPkgs pkgs) |
This file contains hidden or 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
self: super: | |
rec { | |
inherit (super) fetchFromGitHub callPackage; | |
python = super.python.override { | |
packageOverrides = callPackage ./python-packages.nix {}; | |
}; | |
} |
This file contains hidden or 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
{ fetchFromGitHub }: self: super: | |
{ | |
herp_derp_python_example = self.callPackage ./src/herp_derp_python_example {}; | |
} |
This file contains hidden or 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
#!/bin/sh | |
set -xe | |
rev=$(curl -L https://nixos.org/channels/nixpkgs-unstable/git-revision) | |
url="https://github.com/nixos/nixpkgs/archive/${rev}.tar.gz" | |
cat > .nixpkgs.json <<EOF | |
{ "url": "$url" } | |
EOF | |
echo "Updated .nixpkgs.json" >&2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment