Commit graph

1095 commits

Author SHA1 Message Date
Vincent Ambo
e9431682b2 refactor: Move CI setup to separate Nix file
Instead of polluting the repository namespace with the list of CI
projects, move that to a separate file.

Currently the list of projects to be built by CI is still hardcoded,
but this will be fixed soon.
2019-12-09 10:58:09 +00:00
Vincent Ambo
a1ac598fa0 fix(overrides): Fix package importing for kontemplate 2019-12-09 04:27:40 +00:00
Vincent Ambo
b554b6274b fix(build): Install cachix from third_party 2019-12-09 03:46:19 +00:00
Vincent Ambo
7da979124f fix(third_party): Expose various other missing dependencies 2019-12-09 03:36:50 +00:00
Vincent Ambo
998a2ceb17 fix(third_party): Expose missing dependencies for Nixery 2019-12-09 03:19:03 +00:00
Vincent Ambo
97be9c1411 fix(third_party): Shuffle code around to be compatible with readTree
As per the previous commit these files were no longer being imported,
which is now fixed by moving them into separate subfolders.
2019-12-09 03:18:27 +00:00
Vincent Ambo
ff38ae6c5f fix(read-tree): Don't import default.nix sibling expression
If a folder contains a `default.nix`, Nix expressions contained in
adjacent files should not be imported (they might be things like a
`shell.nix` or a `deps.nix` which do not evaluate to derivations).

The tree traversal still continues for all children folders of a
folder with a `default.nix`.
2019-12-09 03:16:02 +00:00
Vincent Ambo
7044424f52 fix(writeElispBin): Add required nixpkgs attributes for elisp 2019-12-09 03:00:56 +00:00
Vincent Ambo
46e5a23937 fix: Amend import paths to use whitelisted nixpkgs 2019-12-09 02:55:22 +00:00
Vincent Ambo
39ba761663 feat(third_party): Explicitly expose packages from nixpkgs
Instead of exposing the entire package tree from nixpkgs, whitelist
individual packages explicitly so that they show up in
`pkgs.third_party`.

This makes it much easier to control external dependencies used by my
projects.

Bonus: It even includes a working `third_party.callPackage` with only
the whitelisted packages!
2019-12-09 02:55:04 +00:00
Vincent Ambo
77c64ed8f6 fix(build): Temporarily hardcode list of CI projects
Due to a missing feature in readTree I can't currently generate this
list automatically.
2019-12-09 02:52:11 +00:00
Vincent Ambo
01bad09eed refactor: Introduce new layout with nixpkgs in third_party
This is not the final layout yet, but makes it so that my top-level
attribute set is no longer overlaid into nixpkgs itself.

This is useful for other people who are importing my monorepo.
2019-12-09 02:40:48 +00:00
Vincent Ambo
688233acac feat: Add writeElispBin helper function
Exactly as the name suggests. Currently, passing arguments from the
CLI is not really supported.
2019-12-09 02:20:02 +00:00
Vincent Ambo
608a560ee8 refactor(read-tree): Remove deprecated 'builtins.toPath' call 2019-12-09 02:19:44 +00:00
Vincent Ambo
6a526620e2 feat(buildGo): Add 'overrideGo' argument overriding function
This makes it possible to override arguments to the Go builders
downstream in the style of `overrideAttrs` from standard nixpkgs
derivations.

For example, given a Nix value `foo` that builds a binary called `foo`
the name of this binary could be changed and a new dependency on
`somelib` added like so:

    foo.overrideGo(old: {
      name = "bar";
      deps = old.deps ++ [ somelib ];
    })
2019-12-09 01:07:21 +00:00
Vincent Ambo
d23716f354 refactor(read-tree): Keep traversing even if a default.nix is found
This makes it possible for people to drop a default.nix into folders
along the way that add additional things into the attribute set at
that level.

These default.nix files are imported and merged with the rest of the
traversal from that point on. In theory nothing stops a user from
putting a derivation into one of them, but the effects of merging that
derivation's underlying attribute set with random other things from
the traversal are undefined.

This feature is being introduced for a slight revamp of the thirdParty
layout.
2019-12-02 15:05:54 +00:00
Vincent Ambo
9d6792609f
Merge pull request #10 from tazjin/feat/buildGo-dot-nix
Introduce Bazel-style Nix build system for Go
2019-11-27 15:47:52 +00:00
Vincent Ambo
0bd085f5d6 chore(overrides): Import buildGo.nix from external repository 2019-11-27 15:20:24 +00:00
Vincent Ambo
28e587b348 docs: Add README file that describes project usage & background 2019-11-27 15:14:43 +00:00
Vincent Ambo
9280cf9715 feat(buildGo): Add support for gRPC packages
Introduces buildGo.grpc which is like buildGo.proto, but adds
dependencies on the gRPC libraries.
2019-11-26 12:28:10 +00:00
Vincent Ambo
d3e8774a8e feat(proto): Add protobuf & gRPC dependencies via external
Moves the Protobuf & gRPC dependencies to a separate file which uses
buildGo.external to build the dependencies.

The versions are pinned at master of 2019-11-26.
2019-11-26 12:28:10 +00:00
Vincent Ambo
8b6b08b814 feat(buildGo): Add 'srcOnly' and 'targets' parameters for external
Adds two new parameters to buildGo.external:

* `srcOnly` toggles whether the created derivation should contain only
  the source code, or the built package.

  This is useful in situations where some sub-packages of a larger
  package are needed and the build should be deferred to the package
  depending on them.

  It defaults to false, meaning that external packages are built by
  default.

* `targets` controls which "sub-packages" of the target package are
  built. It defaults to building all sub-packages.
2019-11-26 12:21:58 +00:00
Vincent Ambo
7d26550c11 feat(buildGo): Add support for building "external" Go libraries
Adds a buildGo.external function that can build packages following the
default go-tool package layout. Dependencies work the same way as they
do for other buildGo-packages, but instead of being passed straight to
the compiler a fake GOPATH is assembled using a symlink forest.

External currently supports very few direct configuration options and
was primarily created to build the protobuf packages, but it is also
useful for including external dependencies in buildGo-native projects.

The previous complex build logic for the protobuf package has been
replaced with a call to `external`.
2019-11-25 16:45:21 +00:00
Vincent Ambo
580bd88622 feat(buildGo): Add x_defs support 2019-11-25 15:34:59 +00:00
Vincent Ambo
43f91c44bd feat(read-tree): Pass in-tree location to imported package sets
Passes the location from the root at which packages are imported on to
all packages.

The path is passed in as a parameter called 'locatedAt' which contains
a list of strings with each individual path component.

For example, the blog source in `services/tazblog` will have a list
with `[ "services" "tazblog" ]` passed in as the `locatedAt`
attribute.

This can be used for enabling features such as path-specific imports
when using things like buildGo.
2019-11-25 15:32:02 +00:00
Vincent Ambo
48ed487bdd refactor(read-tree): Idiomatic 'attrsToList' instead of weird hack 2019-11-25 15:10:31 +00:00
Vincent Ambo
473421dbb8 feat(example): Demonstrate usage of x_defs flag to buildGo.program 2019-11-24 20:41:29 +00:00
Vincent Ambo
0fd7466922 feat(buildGo): Add support for x_defs option in buildGo.program
This lets users define an attribute set with link time options.
2019-11-24 20:41:01 +00:00
Vincent Ambo
071babf148 feat(example): Add an example for how to use buildGo builders 2019-11-24 20:34:30 +00:00
Vincent Ambo
d441e035aa feat: Add support for Protobuf-generated libraries
Adds a 'buildGo.proto' function which takes a single .proto file as
its source and generates a corresponding Go library which can then be
imported.

'proto' takes these arguments (Yants-style type definition):

struct "protoArgs" {
  # required:
  name = string;
  proto = path;

  # optional:
  extraDeps = list goLib; # defaults to [ ]
  protocFlags = option string;
}

Note that proto libraries will automatically have dependencies for the
required protobuf Go libraries added to them.

gRPC is not (yet) supported.
2019-11-24 20:17:17 +00:00
Vincent Ambo
24225580e8 feat: Check in buildGo with program & package builders 2019-11-23 15:25:11 +00:00
Vincent Ambo
5126815846 chore: initial commit 2019-11-23 15:24:50 +00:00
Vincent Ambo
f1655c5cbb fix(tools): Enable CI runs for tools.gotest 2019-11-22 16:29:43 +00:00
Vincent Ambo
1619f58d78 feat(tools): Add 'gotest' program to demonstrate pkgs.buildGo
This is a tiny program that does nothing but exists to demonstrate
pkgs.buildGo by building a program that depends on a local library as
well as a protobuf definition.
2019-11-22 16:28:22 +00:00
Vincent Ambo
9ea0363e6f fix(buildGo): Use stable build ID when linking outputs
This is another step towards build reproducibility, which Go is
traditionally very bad at.
2019-11-22 16:14:52 +00:00
Vincent Ambo
8710df08c8 fix(buildGo): Ensure names of proto-generated files are correct 2019-11-22 16:14:35 +00:00
Vincent Ambo
5a89a0265b refactor(buildGo): Minor cleanups of buildGo implementation 2019-11-22 16:14:14 +00:00
Vincent Ambo
78ca29dd23 feat(buildGo): Introduce Bazel-style Nix builders for Go 2019-11-21 10:55:10 +00:00
Vincent Ambo
ae53bf30c3
Merge pull request #9 from tazjin/feat/read-tree
Configure automatic package layouts via repository structure
2019-11-15 23:46:13 +00:00
Vincent Ambo
ecd54d58b1 fix(k8s): Adjust blog image name to match new repo layout 2019-11-15 23:37:22 +00:00
Vincent Ambo
45d63bce17 feat(nix): Filter projects that should be built by CI
Instead of specifying CI projects manually, this filters them to move
the CI configuration into the derivations `meta` attributes.
2019-11-15 23:25:41 +00:00
Vincent Ambo
c1c379848a chore(nix): Move files around to conform to new read-tree layout
Broadly speaking, the following things are included:

* there is now a uniform `args` struct that is passed to all
  derivations, package headers have been changed appropriately
* overrides are now loaded from a separate `override` folder just
  using read-tree.nix
* third-party packages have moved into the `third_party` attribute set
2019-11-15 15:26:08 +00:00
Vincent Ambo
4d852e2ef7 feat(build): Add initial read-tree.nix implementation
This file can read a directory tree into a package set structure,
paving the way for getting rid of top-level mapping in default.nix.
2019-11-15 14:52:23 +00:00
Vincent Ambo
8e53dec88c chore: Remove unstable channel (no longer in use) 2019-11-14 13:44:03 +00:00
Vincent Ambo
9ba4bbb609
Merge pull request #8 from tazjin/feat/nixcon
Add demo setup for NixCon
2019-10-26 13:59:58 +02:00
Vincent Ambo
161f1b5e85 feat(nixcon-demo): Add CLI mode for NixCon demo
Maybe a bit more sane than trying to do a network based setup.
2019-10-26 13:50:42 +02:00
Vincent Ambo
8ffe811d46 feat(services): Add nixcon-demo service with simple web server 2019-10-26 13:27:56 +02:00
Vincent Ambo
2be1fff251 feat(third_party): Add naersk to package set 2019-10-26 13:27:41 +02:00
Vincent Ambo
9eabf6236f fix: Enable building of broken packages
Happstack is currently erroneously (afaict) marked as broken.
2019-10-26 12:10:21 +02:00
Vincent Ambo
374d55d190 chore(k8s): Bump deployed Nixery version 2019-10-26 12:02:55 +02:00