Commit graph

20618 commits

Author SHA1 Message Date
Griffin Smith
fb0528c5da fix(tvix): Pass all args when auto-calling a function with an ellipsis
The command line options --arg and --argstr that are used by a bunch of
CLI commands to pass arguments to top-level functions in files go
through the same code-path as auto-calling top-level functions with
their default arguments - this, however, was only passing the arguments
that were *explicitly* mentioned in the formals of the function - in the
case of an as-pattern with an ellipsis (eg args @ { ... }) extra passed
arguments would get omitted. This fixes that to instead pass *all*
specified auto args in the case that our function has an ellipsis.

Submitted upstream at https://github.com/NixOS/nix/pull/3965

Fixes: #46
Change-Id: I32b7ee0e5bacf75b2bc43a3f0796f533f4bd5959
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1863
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
2020-08-28 01:18:19 +00:00
Griffin Smith
3bada1d41e refactor(tvix): Clean up MixEvalArgs internals
Previously, MixEvalArgs (a generic data type used to handle --arg,
--argstr, and -I arguments to `nix-build`, `nix eval`, etc.) was storing
the difference between --arg and --argstr by prepending a single
character (either 'E' or 'S') to the value of the arg. This is messy and
un-type-safe, so this commit refactors that to use a proper enum and a
std::pair, which allows us to add a switch and get totality checking.
yay, types!

Change-Id: I883f8db3136d05dda190fac0a1b494386c2ff87b
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1862
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
2020-08-28 01:18:19 +00:00
William Carroll
78172233f8 Add build, lint Emacs steps to post-receive pipeline
TL;DR:
- Define runEmacsScript to emacs/default.nix for ci/pipelines/post-receive
- Write script.el to call (load init.el) and catch any errors
- Lint Elisp with gonewest818/elisp-lint

Also nice how Buildkite supports :gnu: emojis!
2020-08-27 18:29:48 +01:00
William Carroll
d67dbec7e8 Clean up emacs/default.nix
- Prefer prepending wpcDir, vendorDir to EMACSLOADPATH instead of using the
  --directory flag
- Remove --load ${wpcPackageEl} because init.el calls (require 'wpc-package)
- Surround $@ in 2x-quotes
2020-08-27 18:25:14 +01:00
William Carroll
a1a2f0bbbd Remove exported DEPOT env var from wpcarros-emacs
wpcarros-emacs no longer depends on this being set.
2020-08-27 17:31:25 +01:00
William Carroll
eb0e1d8c5d Prefer builtins.path
Following the advice of Domen's nix.dev anti-patterns, I'm preferring something
like...

```nix
builtins.path { path = /path/to/some.where; name = "some.where"; }
```

...to

```nix
/path/to/some/where
```

While the former is more verbose, it will fail to build when the path doesn't
exist, which I prefer.
2020-08-27 17:31:15 +01:00
Vincent Ambo
4ff9d5dee8 feat: Implement automatic CI target detection for the depot
Automatically walk the entire depot tree and pick out things that are
"buildable", then include them in the attribute `ci.targets` (which is
now also the target for CI builds).

A long time ago, in a land far away, we (well, I, at the time) had a
prototype of this which ran into constant issues with infinite
recursions while trying to walk the tree. In fact, this is why
readTree originally gained the `__readTree`-attribute which marks
things that were imported automatically.

Based on some code edef whipped up earlier (with the breakthrough
being that we also add the attribute to top-level folders, which
suddenly resolves a whole bunch of problems), I've now implemented
this actually working version.

At the moment all builds still happen as one big bag of builds, but at
some point we will granularise this.

Change-Id: I86f12ce7f63dae98e7e5c6646a4e9d220de783f2
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1854
Tested-by: BuildkiteCI
Reviewed-by: kanepyork <rikingcoding@gmail.com>
Reviewed-by: glittershark <grfn@gws.fyi>
2020-08-26 23:49:32 +00:00
Vincent Ambo
88317aea0d fix(besadii): Remove unused Nix code from the derivation
This was used previously when build granularity was besadii's task,
which it no longer is.

Change-Id: I6df2db1ed4730a7953199b7b48aa9ad916418b22
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1853
Tested-by: BuildkiteCI
Reviewed-by: kanepyork <rikingcoding@gmail.com>
2020-08-26 23:49:32 +00:00
Vincent Ambo
5ad61ee408 chore: Add __readTree attributes on systems that need to be built
This is a temporary state (TODO added) to be picked up by the new CI
logic.

Change-Id: Id4702740ffd18325088e2a8a0c6157a8cee7ccf7
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1852
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
2020-08-26 23:49:32 +00:00
Vincent Ambo
eb3c4a3c11 fix(3p/haskell_overlay): Fix imports and remove unused file
Change-Id: I1973bc1b11442dc8150c3b07bd06a6f94c4c4380
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1851
Tested-by: BuildkiteCI
Reviewed-by: glittershark <grfn@gws.fyi>
Reviewed-by: kanepyork <rikingcoding@gmail.com>
2020-08-26 23:49:32 +00:00
Vincent Ambo
7e6b3e1b42 chore: Add meta.ci=false to various broken projects
These projects, which are not currently included in CI runs, don't
build at the moment.

Upcoming logic changes would mean that we would start including them
in CI, which is undesirable until they're fixed - but I'm not going to
be doing that now.

Change-Id: I7c337e098be8bff00db6d99fc7236a695f5a85f5
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1850
Tested-by: BuildkiteCI
Reviewed-by: kanepyork <rikingcoding@gmail.com>
2020-08-26 23:49:32 +00:00
Vincent Ambo
970f90c711 fix(multi/home-manager): Prevent readTree failures on home-manager.nix
This file is not a readTree-compatible Nix file, but rather a NixOS
module. At some point it should be moved elsewhere and .skip-subtree'd
to avoid this issue.

Change-Id: If1b3f7cc80084af1f44036b8b9272f7b76438c2c
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1849
Tested-by: BuildkiteCI
Reviewed-by: multi <depot@in-addr.xyz>
2020-08-26 23:49:32 +00:00
Vincent Ambo
dbda84bac3 fix(readTree): Add __readTree attribute to folders
This is required to automatically walk the tree (see subsequent
commits).

Note: Lisp packages are removed from the CI builds in this commit
because the attrValues of third_party.lisp will contain an element
that is simply `true`, which causes a type error.

These packages are re-added when CI refactoring is complete.

Change-Id: I21e2b719e6c7161c23d2867a216f4daa1c6c8394
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1848
Tested-by: BuildkiteCI
Reviewed-by: glittershark <grfn@gws.fyi>
2020-08-26 23:49:32 +00:00
Vincent Ambo
475d41f698 chore(glittershark): Temporarily skip grfn's subtree
... explanation within.

Change-Id: Ia357d30577fcc8b3d8ebc85288683e50cc318fea
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1847
Tested-by: BuildkiteCI
Reviewed-by: glittershark <grfn@gws.fyi>
2020-08-26 23:49:32 +00:00
Vincent Ambo
8acbde4e15 chore(third_party): Skip subtrees of large external projects
Change-Id: Icef3900f9d1e55fd15c5286a794293368c33492c
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1846
Tested-by: BuildkiteCI
Reviewed-by: kanepyork <rikingcoding@gmail.com>
2020-08-26 23:49:32 +00:00
Vincent Ambo
468ffcd4b6 fix(tvlc): Do not call mkDerivation in default.nix
This should actually just be an attribute set.

Change-Id: Idea1a9f7cfbb2eecd7e6342c6b5aeb66d3f3441a
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1845
Tested-by: BuildkiteCI
Reviewed-by: kanepyork <rikingcoding@gmail.com>
2020-08-26 23:49:32 +00:00
Vincent Ambo
2bf806b21a chore(tazjin/dt): Move project into user folder
... missed this when going multi-user.

Change-Id: If2c9f24555f82e944e3cebb45b2a13801cc1f35e
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1844
Tested-by: BuildkiteCI
Reviewed-by: kanepyork <rikingcoding@gmail.com>
2020-08-26 23:49:32 +00:00
Vincent Ambo
bc5d4672aa fix: Remove ./presentations from top-level
This folder doesn't exist, it's part of my user folder now. We didn't
notice because nothing is walking the tree.

Change-Id: Idc6f20a8e4806a158c598fd63d381ab07934be1e
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1843
Tested-by: BuildkiteCI
Reviewed-by: kanepyork <rikingcoding@gmail.com>
2020-08-26 23:49:32 +00:00
Vincent Ambo
e90242d029 chore(net): Remove mushroom
We don't need to build this anymore.

Change-Id: I0ddd4ec3db9eb4774553003e18c5503b0f431810
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1842
Reviewed-by: tazjin <mail@tazj.in>
Reviewed-by: lukegb <lukegb@tvl.fyi>
Tested-by: BuildkiteCI
2020-08-26 22:21:10 +00:00
William Carroll
ea0788fd62 Delete unused parts of bookmark.el
Trimming more fat.
2020-08-26 18:30:10 +01:00
Vincent Ambo
dec32be0d7 fix(tazjin/emacs): Override vterm's internal title generator
This used to be part of the public interface, but was removed and
replaced with a (less useful) format string.

Change-Id: I387557c20c2eddde16974c3fcad1712569db5325
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1841
Reviewed-by: tazjin <mail@tazj.in>
Tested-by: BuildkiteCI
2020-08-26 11:15:41 +00:00
Kane York
a9650041bb feat(tools/tvlc): pass list of derivations to depot-scanner
You can now provide a list of Nix derivations to tvlc to get a git worktree + sparse-checkout containing only the paths needed to build the specified derivations.

Known bugs: even though //third_party is only passed to readdir(), git doesn't know this and includes all of //third_party/*.

Change-Id: I9dccebd3fbff4bb04ebd568175cf0a7e37d71ab3
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1826
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
2020-08-25 22:34:02 +00:00
William Carroll
8fef6c0408 Remove bookmark for <depot>
Since depot now support cs.tvl.fyi, I don't need this, and that is a *massive*
upgrade.
2020-08-25 14:20:46 +01:00
William Carroll
8eed16dc67 Replace calls to (getenv "BRIEFCASE") with constants/briefcase
I would prefer to define constants/briefcase in terms of `(getenv "BRIEFCASE")`
and assert that `(f-exists? (getenv "BRIEFCASE"))`, in one location:
constants.el
2020-08-25 14:19:19 +01:00
William Carroll
21ce27b0ca Prefer <leader>jb to <leader>jd for searching all of briefcase
Feels more natural...
2020-08-25 14:16:41 +01:00
William Carroll
504cf0daab Delete org-helpers
I'm trying to tidy things up, so I'm trying to apply some of the principles from
"Essentialism" to my Emacs configuration.
2020-08-25 14:15:58 +01:00
William Carroll
23a41528bb Remove unnecessary TODO
The Nix expression that builds `wpcarros-emacs` sets BRIEFCASE, so the .envrc
isn't relied on.
2020-08-25 14:02:32 +01:00
William Carroll
64afb11d60 Remove unnecessary code from wpc-nix.el
TL;DR:
- Prefer `(getenv "BRIEFCASE")` to `(f-expand "~/briefcase")`. I should audit my
  Emacs for references to ~/briefcase and replace those calls with `getenv`.
- Remove calls setting <nixpkgs> and <depot> and rely exclusively on <briefcase>
- Prefer ~/nixpkgs-channels to ~/nixpkgs.

Notes:
- I need a better way of calling `home-manager switch` that resides within my
  briefcase
2020-08-25 13:55:14 +01:00
Griffin Smith
e539242032 feat(gs/emacs): Make cider test report popup bigger
Change-Id: I72a7af7cbbcde3eee7ef1e61d1a431a2f7779c62
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1839
Reviewed-by: glittershark <grfn@gws.fyi>
Tested-by: BuildkiteCI
2020-08-24 16:01:37 +00:00
Griffin Smith
a57f1469ef fix(owothia): Use correct articles
I'm an owothia, owo

Change-Id: I59d523268851e792067e10d440147d12409c60f5
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1833
Tested-by: BuildkiteCI
Reviewed-by: eta <eta@theta.eu.org>
2020-08-24 15:11:20 +00:00
William Carroll
7a1e56e7d1 Prefer simpler, more idiomatic project-find-function
This version avoids installed all of the custom `cl-defmethods` for a
`'monorepo` type and instead uses the existing `'transient`.
2020-08-24 11:19:47 +01:00
Vincent Ambo
35b214ae9f feat(tazjin/emacs): Add magit-find-file-worktree function
This will look up a file in the current worktree of the git repository
enclosing `default-directory'.

In combination with project-find-file this lets me toggle between
switching to a file within a project, and within the whole depot.

Change-Id: Ie1011f10051fc2c4bd4279b0944a79c7edf92f3b
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1838
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
2020-08-23 23:47:46 +00:00
Vincent Ambo
937469509b feat(tazjin/emacs): Add depot-aware project.el extension
If this ends up working well I'll extract it to tvl.el

Change-Id: I83722abf33a3346ccc7957c8d64d6381b15c6ee9
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1837
Tested-by: BuildkiteCI
Reviewed-by: isomer <isomer@tvl.fyi>
2020-08-23 22:48:04 +00:00
Griffin Smith
7a344fbb5e feat(nix/buildLisp): Expose an sbcl attribute
Expose an `sbcl` attribute on packages and programs, to allow for easier
development either with SLY or on a REPL.

Change-Id: Ide4d087a5223561e1fe192ef32dc593c54b5a20e
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1834
Tested-by: BuildkiteCI
Reviewed-by: tazjin <mail@tazj.in>
2020-08-23 22:21:17 +00:00
Vincent Ambo
d4824b64f6 feat(whitby): Enable log forwarding via journaldriver
Change-Id: I474159acfe514f6f2eb7867e4eba854016590ab1
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1836
Tested-by: BuildkiteCI
Reviewed-by: isomer <isomer@tvl.fyi>
2020-08-23 20:45:18 +00:00
Vincent Ambo
1cf11317ca refactor(tvix/libutil): Mark single-argument constructors explicit
This is the clang-tidy lint 'google-explicit-constructor'.

There's a whole bunch of breakage that was introduced by this, and we
had to opt out a few types of this (esp. the string formatting crap).

In some cases minor other changes have been done to keep the code
working, instead of converting between types (e.g. an explicit
comparison operator implementation for nix::Pid).

Change-Id: I12e1ca51a6bc2c882dba81a2526b9729d26988e7
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1832
Tested-by: BuildkiteCI
Reviewed-by: kanepyork <rikingcoding@gmail.com>
Reviewed-by: glittershark <grfn@gws.fyi>
2020-08-23 11:58:44 +00:00
William Carroll
7ab86f5423 Abandon the pre-receive hook
I wanted Gitea to call Buildkite's pre-receive pipeline and either accept or
reject the incoming code depending on the outcome. The problem is that I can
only *create* builds from Gitea's pre-receive hook.

Now I'm left with two options:
1. run the lint-secrets step in post-receive
2. run `/nix/store/<hash>/git-secrets --scan-history $REPO_PATH` in Gitea

As far as I can tell, I cannot define Gitea hooks in Nix, which is unfortunate;
otherwise, option 2 would appeal more.

I'm doing option one for now.
2020-08-22 23:27:44 +01:00
William Carroll
4241339963 Define Buildkite pipelines corresponding to git server hooks
I think maintaining a 1:1 correspondence with the git server hook makes sense
right now. Let's try it out!
2020-08-22 23:27:44 +01:00
William Carroll
098ca0da15 Ensure that the build step "depends on" the lint step
This way, if the lint step fails, the build step doesn't run. Nice!
2020-08-22 23:27:44 +01:00
William Carroll
3f9352b118 Remove --add-provider step from briefcase lint
So it turns out that I was wrong and that .git/config is stateful. Multiple
calls to --add-provider will append the same provider each time...

Instead I'm defining secret-patterns.txt and version-controlling it.

Then:
- dev-side: I'm adding `providers = cat ci/secret-patterns.txt` to .git/config
- ci-side:  I'm adding `providers = cat ci/secret-patterns.txt` to .git/config

Unfortunately this is ad-hoc configuration ci-side, which I would like to
avoid. The good news is that my pre-commit hooks and failures from git-secrets
should now align with my CI, since they're both reading from
secret-patterns.txt. One step backwards... two steps forwards?
2020-08-22 23:27:44 +01:00
William Carroll
92fa785e75 Call --add-provider during lint stage
I'm also `cat .git/config` because I think the Buildkite destroys the
.git/config file for each build, but I want to verify that. If it does, I prefer
that because it seems to share the spirit of the "Destroy Your Darlings" essay.
2020-08-22 23:27:44 +01:00
William Carroll
aeeaed605e Log git information during briefcase's lint stage
I would like to find out what the state of the repo is during pre-receive hook.
2020-08-22 23:27:44 +01:00
William Carroll
0644e1f740 Replace build badge
Changed pipelines = new badge.
2020-08-22 23:27:44 +01:00
William Carroll
fa645acf5c Prefer :nix: emoji
Buildkite support language extensions as emojis!
2020-08-21 14:00:11 +01:00
William Carroll
36399df006 Use emojis for build, lint steps
Y'know... the important stuff
2020-08-21 13:51:47 +01:00
William Carroll
fd626d907e Remove debugging information
Problem: my dev machine returns a different value for `git config --get-all
secrets.patterns` than my CI machine... I ran `git-secrets --register-aws` to
get additional coverage, but it's still not the same. I created an issue on the
git-secrets GH repo to get better troubleshooting advice, but I don't need the
logging info. anymore, so I'm removing it.
2020-08-21 12:31:03 +01:00
William Carroll
56e4d9f9b5 Debugging briefcase pipeline
Somehow `git-secrets --scan-history` is exiting non-zero, when I don't think it
should. Logging some environment information to get a better idea of what's
going on.
2020-08-21 11:25:16 +01:00
William Carroll
f53b08e4a0 Call --scan-history
My current pipeline is succeeding with a false-positive. After this change, it
should return a true-negative.
2020-08-21 11:22:52 +01:00
William Carroll
3f3cba7c32 Define BuildKite pipelines in Nix
After a handful of failed attempts to run lint-secrets.sh due to a missing
`git-secrets` executable on my git server, I decided that now was a good time to
use Nix to define my BuildKite pipelines.

TL;DR:
- Delete ci/scripts directory
- Define ci/pipelines/{briefcase,socrates}.nix

Outside of this repository:
- I logged into my admin account at git.wpcarro.dev and changed my Gitea
  post-receive hook to trigger the briefcase pipeline
- I logged into my BuildKite account, deleted my build-briefcase pipeline,
  created a new briefcase pipeline that called:

  ```shell
  nix-build -A ci.pipelines.briefcase -o briefcase.yaml
  buildkite-agent pipeline upload briefcase.yaml
  ```

One day I will audit all of my ad-hoc, non-mono-repo activity (like the steps I
listed above) and attempt to fit everything herein... one step at a time,
though!
2020-08-21 11:12:57 +01:00
Vincent Ambo
1443298657 style(tvix): Add missing braces in expressions
The previous clang-tidy invocation missed some header files, which has
now been rectified.

Change-Id: I31547754fbf52f439dc7aeefb08ab90bd50c4156
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1831
Reviewed-by: glittershark <grfn@gws.fyi>
Tested-by: BuildkiteCI
2020-08-21 03:55:56 +00:00