about summary refs log tree commit diff
AgeCommit message (Collapse)AuthorFilesLines
2020-08-20 Move /home/wpcarro/nixpkgs-channels to /var/libWilliam Carroll2-2/+2
My builds are still failing. This time with... ``` error: getting status of /home/wpcarro/nixpkgs-channels: Permission denied ``` ...what confused me was the following: ```shell $ sudo -u buildkite-agent-socrates stat /home/wpcarro/nixpkgs-channels permission denied ``` But `ls -al /home/wpcarro | grep nixpkgs-channels` showed `r-w` for all users... Thankfully @riking on ##tvl told me that I should check the permissions for /home/wpcarro and /home... After running `ls -al /home`, I saw `---` for all user... I then reproduced the error by running: ```shell $ sudo -u buildkite-agent-socrates stat /home permission denied ``` Great! So then I moved nixpkgs-channels to /var/lib/buildkite-agent-socrates. @edef recommended that I read more about DynamicUser= setting for systemd, which looks relevant after I took a cursory glance. I'll also want a more declarative way to manager this, but I'm making small improvements every day.
2020-08-20 Move buildkite's SSH key out of /home/wpcarro into /etc/sshWilliam Carroll1-0/+1
After enabling buildkite-agent using NixOS, it runs as its own user, buildkite-agent-socrates, which does not have its own home directory. I moved the SSH key that I made when running buildkite-agent as wpcarro into /etc/ssh and `chown`'d it for buildkite-agent-socrates.
2020-08-20 Enable services.buildkite-agentsWilliam Carroll1-7/+7
Instead of enabling `buildkite-agent` ad hoc, use NixOS to configure it.
2020-08-20 Add CI build status badge to top-level READMEWilliam Carroll1-0/+2
Wahoo!
2020-08-20 Support build-briefcase.shWilliam Carroll3-2/+7
For now, I'm supporting two CI pipelines: - build-socrates - build-briefcase Conceptually, build-briefcase should cover what build-socrates does now, but eventually I would like build-socrates to call `switch-to-configuration` so that all of my websites, etc. stay fresh.
2020-08-20 Disable failing goals/default.nixWilliam Carroll4-7/+2
Disabling failing packages until I can get a working CI build.
2020-08-20 Revise previous opinions about absolute paths GT <bracket-notation>William Carroll11-21/+12
Unforeseen problem: `buildkite-agent` runs its builds in a separate directory, so if I want the `nix-build` command to build the newly checked out code, I need to set <briefcase> to the CWD.
2020-08-20 Attempt nix-build instead of nixos-rebuild switchWilliam Carroll5-33/+17
I've encountered a few problems with attempting to support nixos-rebuild: - the activation step requires `sudo` privileges - the `buildkite-agent` runs on the same machine, socrates, that is rebuilding itself. This means that when the activation step runs, it will attempt to restart `buildkite-agent` when the agent is still working I'm slowly removing places in my nix code that rely on '<bracket>' notation, so that I no longer depend on NIX_PATH being set. I still have more work to do. {covid-uk,sandbox}/default.nix are breaking when I attempt to run my build-socrates.sh script locally, so I'm temporarily disabling them until I can get CI working as I expect.
2020-08-20 Prefer nixos-rebuild to the rebuild scriptWilliam Carroll1-4/+6
The rebuild script calls sudo, which I won't need as I test running buildkite-agent prefixed with `sudo` or as the root user.
2020-08-20 Define buildkite-agent userWilliam Carroll1-0/+7
I'd like my buildkite-agent to run as its own user, so I'm defining that user here.
2020-08-20 Log all polkit actions to find action.id for nixos-rebuildWilliam Carroll1-0/+6
I would like to setup a polkit rule to allow `buildkite-agent` (i.e. a forthcoming user) to call `nixos-rebuild`. I need to know the `action.id` before I can write a reliable rule.
2020-08-20 Debug $USER in build-socrates.shWilliam Carroll1-1/+1
Attempting to see what $USER the buildkite-agent is when it runs.
2020-08-20 Debug build-socrates.shWilliam Carroll1-1/+4
- using `set -euo pipefail` for setting recommended failure-modes - using `set -x` and `echo "$PATH"` to debug my failing build Sidenote: I find BuildKite's documentation quite helpful!
2020-08-20 Attempt to build Socrates using BuildKiteWilliam Carroll3-1/+9
Let's see what happens...
2020-08-20 Set -Wall and cleanup warningsWilliam Carroll2-9/+11
I should have done this from the start.
2020-08-20 Create an assessment directoryWilliam Carroll10-0/+359
I've been doing a few take-home assessment recently, all of which I've attempted to solve using Haskell. I'm having a good time, and I'm noticing strong and weak points with my Haskell programming. I always attempt to apply any feedback a reviewer gives me, and I'm storing my first drafts, second attempts, and feedback here for now. This recently attempt was for a role at Jane Street.
2020-08-20 List directories first in dired viewWilliam Carroll1-0/+1
Ideally I'd use exa insted of ls, but I cannot seem to support that yet.
2020-08-20 Restore shell.nixWilliam Carroll1-0/+10
I believe `use_nix` looks for shell.nix and then default.nix files, so I was wrong earlier when I said that I could get rid of shell.nix files altogether. I need to learn more about `use_nix` and getting environments from default.nix files.
2020-08-20 Drop support for wpc/find-fileWilliam Carroll2-9/+1
Cleaning things up...
2020-08-20 Prefer direnv's use_nix to shell.nixWilliam Carroll2-10/+1
I find it bothersome to share the list of Haskell dependencies between my default.nix and shell.nix files. A few days ago, I created a THIRD file, shared.nix, that defined the shared code b/w default.nix and shell.nix. This DRY'd things up, but it also added a new file, which I didn't like. Today I learned that direnv integrates with Nix using a function called `use_nix`. Voila! I typically already have .envrc files per-project, so this doesn't add any unnecessary files, and it allows me to delete my shell.nix files. I would use `lorri`, except that I encountered issues using Lorri on my work computer, which I'm not interested in attempting to resolve now.
2020-08-20 Change GET /mimi to GET /helloWilliam Carroll1-4/+8
Timing myself to see how long it takes me to publish a change.
2020-08-20 Define the monoserver as a systemd serviceWilliam Carroll1-0/+10
Much better than manually running: ```shell $ cd ~/briefcase && git pull --rebase origin master $ nix-rebuild switch $ nix-build -A zoo $ pkill zoo $ ./result/zoo & $ job -l $ disown %<job-number> ```
2020-08-20 Add GET /mimi to zooWilliam Carroll1-1/+5
Proving to my girlfriend that the zoo works.
2020-08-20 Add host field for nginx JSON logsWilliam Carroll1-0/+1
I'd like to filter logs from {blog,git,zoo}.wpcarro.dev, etc.
2020-08-20 Remove logging prefix from Nginx logsWilliam Carroll1-9/+10
Problem: The JSON that Nginx outputs cannot be successfully parsed by journaldriver because Nginx prefixes it with "socrates nginx:". Adding `nohostname` to `access_log` should solve this problem. I borrow this from @tazjin's most recent definition of `commonHttpConfig`.
2020-08-20 Use journaldriver to view journald logs from SocratesWilliam Carroll1-0/+7
Attempting to use @tazjin's delightful simple logging library!
2020-08-20 Disabling the monzo-token-serverWilliam Carroll1-21/+19
I haven't used this since I wrote it... and now the .tokens attribute is missing and it's screwing up my other deployment... *sigh*
2020-08-20 Forward zoo.wpcarro.dev connections to :8000William Carroll2-0/+8
Right now the 8000 port is hard-coded into the zoo server, which isn't ideal, but "it works" (TM).
2020-08-20 Move shift-time into top-level //zooWilliam Carroll5-23/+30
I'm still unsure whether or not this is a good idea, but experimenting is a good way to find out!
2020-08-20 Support parsing and shifting timeWilliam Carroll4-20/+130
TL;DR: - Adds string-conversions library - Adds tests for remaining units and repeating requests - Adds a REPL in main
2020-08-20 Support parsing second shiftsWilliam Carroll5-0/+125
Parse inputs like -10s into 10 second shifts back in time.
2020-08-20 Support POST /create-payment-intentWilliam Carroll7-5/+118
Interact with Stripe's payment_intents API endpoint. I'm not committing the index.html that contains client-side code that interacts with the /create-payment-intent endpoint, but it contains sensitive information, so I'm omitting it for now. TL;DR: - Define POST /create-payment-intent endpoint - Include envStripeAPIKey in Context record - Define a top-level Stripe module for making API calls - Define types and instances that align with Stripes request and response types - Depend on the Req library: a higher-level library than http-client
2020-08-13 Prefer project.el to projectileWilliam Carroll2-1/+42
Today @tazjin told me about Emacs's built-in project.el library, which he recommended that I extend to support monorepo-specific tooling. It worked like a charm! Now when I press "<leader>f", it will resolve to either the nearest file named default.nix or directory name .git.
2020-08-13 Set Emacs current-project to ~/briefcaseWilliam Carroll1-1/+1
I don't rely on this often, so it's best to leave it as the top-level directory for briefcase.
2020-08-13 Document ghcExtensions argumentWilliam Carroll1-3/+3
Missed documenting this the first time...
2020-08-12 Consume buildHaskell functionsWilliam Carroll3-57/+45
Use the newly defined `buildHaskell` function for a few of my existing Haskell projects. So far, it works as intended!
2020-08-12 Support buildHaskellWilliam Carroll2-9/+41
Use Nix and Briefcase to easily create Haskell executables. I'd eventually like to support something like: briefcase.buildHaskell.project that let me define a few top-level values (e.g. ghcExtensions) and would give me a ghci environment with the proper `.ghci` settings so that my development environment mirrored my build environment... baby steps, though.
2020-08-12 Define alias for cd-ing to ~/briefcaseWilliam Carroll1-3/+13
Small but useful alias.
2020-08-12 Prefer snake-shift instead of a row-by-row shiftWilliam Carroll5-37/+57
Per the assignment's instructions, the `Shift n` operation should treat the *entire keyboard* like a cycle and shift that. I was erroneously treating *each row* like a cycle and shifting those one-by-one. This change fixes that. In addition, it also: - Updates README.md with expected inputs and outputs - Updates test suite - Adds `split` dependency to {default,shell}.nix
2020-08-12 Adds property tests to generically test keyboard transformationsWilliam Carroll1-1/+25
Tests: - HorizontalFlip - VerticalFlip - Shift n
2020-08-12 Prefer literal, not computed, examples in the unit testsWilliam Carroll1-21/+19
TL:DR: - Remove unused imports: Test.QuickCheck and Control.Exception - Remove calls to `reverse` and `Utils.rotate` with their results
2020-08-12 Provide more useful instructions for building this projectWilliam Carroll3-18/+67
TL;DR: - include a default.nix to allow users to build an named executable - emphasize in the README that the user needs Nix to build this project - pin nixpkgs to a specific commit and fetch it from GitHub
2020-08-12 Generate coords function from existing qwerty keyboardWilliam Carroll1-44/+8
Per my take-home assignment's reviewer's comments, with which for the record I agree, I should generate the character->coordinate table from my existing qwerty keyboard definition. The best part is: by doing this I found a bug: Notice how the original '0' character was mapped to the Coordinate (0,0)... thus every subsequent digit key (i.e. the first row) is off-by-one.
2020-08-10 Drop support for ServantT transformer type for serverWilliam Carroll3-16/+59
After burning a few hours wrestling with the type system, I decided to revert to the simpler `Server API` type instead of the `ServantT` transformer type. The problem is that I couldn't write a MonadError instance for `RIO Context`, which is my `AppM` (i.e. application monad). Using `throwIO` in the server handlers results in 500 errors, which is not what I wanted. I'm still pretty fuzzy about what's happening; I now know that exception handling in Haskell is pretty gnaryly. I may revisit this at a later time when my knowledge is more extensive. For now: time to fry bigger fish. An easier abstract is for me to pass `T.Context` into `server` as an argument, which after all is what a Reader does. TL;DR: - Read server, client ports from .envrc - Define a top-level Failure type (empty for now) - Define a top-level Success type - Define App as RIO Context (Either Failure Success)
2020-08-09 Prefer ServantT for server to consume App contextWilliam Carroll2-24/+33
Long story -> short: I'd like to access my App monad from within my Servant handlers. While this code type-checks, I'm not sure it's working as intended. Needing to change throwError to throwIO fails the "smell test". I expect to refactor this code, but I'm calling it a night for now.
2020-08-09 Replace Prelude with RIOWilliam Carroll7-39/+95
I believe RIO stands for: "ReaderT <something-something> IO", which is a nod to the top-level application data type: ```haskell -- This is a simplification newtype RIO env a = RIO { runRIO :: ReaderT env a () } ``` I read about RIO from an FP-Complete blog post a few months ago, and now I'm excited to try it out for a real project. Bon voyage!
2020-08-09 Move Haskell-related shell.nix code into its own shell.nixWilliam Carroll2-11/+19
I'm getting tired of: ```shell $ cd <project-root> $ nix-shell $ cd src/server $ ghci Main.hs ``` Instead: ```shell $ cd <project-root>/src/server $ ghci Main.hs ```
2020-08-09 Sketch database schemaWilliam Carroll1-0/+41
Defining a few tables in init.sql to sketch a few records that I need to persist.
2020-08-09 Initialize a default.nix for nix-buildWilliam Carroll1-0/+27
As the previous commit mentions, I'm attempting to build and deploy this project with `nix-shell` and `nix-build` instead of `cabal` and `stack`. I'm in the Hamburg airport right now, and my internet connection isn't stable enough to test this, so I'm committing it until I can more robustly test it.
2020-08-09 Add common language extensions to .ghciWilliam Carroll6-9/+5
I'd like to see if I can avoid using `cabal` and `stack` and build and deploy this application using `nix-shell` and `nix-build` only. Let's see how that goes.