Skip Navigation

hallettj

@hallettj.leminal.space.ap.tdpl.io

6 Posts22 Comments0 Memberships

Joined September 2026

  • programming Can someone please dumb Gleam's `use` down for me?

    Yes, it's syntactic sugar that avoids the "marching pyramid of doom". You can see the difference in the example code from that page:

     gleam
    pub fn with_use() -> Result(String, Nil) {
      use username <- result.try(get_username())
      use password <- result.try(get_password())
      use greeting <- result.map(log_in(username, password))
      greeting <> ", " <> username
    }
    
    pub fn without_use() -> Result(String, Nil) {
      result.try(get_username(), fn(username) {
        result.try(get_password(), fn(password) {
          result.map(log_in(username, password), fn(greeting) {
            greeting <> ", " <> username
          })
        })
      })
    }

    The result is less indentation, and fewer braces, so less syntactic noise. Plus you don't have to figure out which closing brace is which when you make changes. Regarding your comment I don't think I agree that it hides the underlying concept since the information is all still there: you swap out the fn keyword and a pair of braces for the use keyword, a left arrow. So if you know what you're reading use signals an inline function inside a call-site with an unusual argument notation. Syntactically it's similar to the await keyword in JavaScript. (But use is much simpler - await conceptually conceals calls to .then). Before async/await the marching pyramid of doom was a common complaint about async javascript, especially from people offended by not being allowed to use threads. The syntactic simplification also has a strong resemblance to Haskell's "do notation", complete with the left-arrow syntax. But like with await, do notation conceals calls to the bind operator (>>=) which is Haskell's version of flatMap / then.

    6 1
  • nix Genuinely cannot install NixOS on a VPS

    I did some reading, and I think your problem is there is a race-condition in the timing of that by-partlabel disk device symlink showing up. I found this comment that explains the issue. That repo isn't related to your situation, but I think the fix is. The comment links to a git change that adds a wait in a disko script to avoid the race condition. Looking at the nixos-anywhere docs, it looks like you have a disko.nix configuration in your setup. Try editing it to use that fix.

    6 1
  • programming The case against Makefiles

    There should be a universal build system that is declarative, handles interdependent build steps, skips building outputs that are still fresh, but that checks freshness in a way that's more robust than tracking modification times, manages parallel execution intelligently, and that manages arbitrary external dependencies. Oh hey, it's Nix!

    1 1
  • programming Twelve years of distributed SQLite

    Sqlite is amazing! It's simple to set up, there is no db server process, you get extremely low latency. Testing is simplified because you can run tests against an in-memory database.

    I haven't tried rqlite, but I have an API service that runs Litestream. That gives me a database backup that I can rewind to different points in time, and it lets me recreate the production database state locally for troubleshooting.

    1 0
  • programming Please help me to revert a git commit (Fixed)

    Not a direct answer, but I've really been liking jj. You can use it as a friendlier git frontend. It has fewer possible states (for example there are no revert-in-progress, rebase-in-progress, etc., or detached head states); and there is an undo command that really does undo any operation.

    2 0
  • programming FTC chair suggests AI developers should be liable for conduct of agents

    It's important to hold people accountable, but it's also important to consider regulation that might be needed specifically for AI. I'm concerned this might be similar to the "guns don't kill people" framing that's used to resist gun control.

    Plus, this is more attention on those hacking test exercises that led to AIs doing hacking. That's a distraction from the real causes of concern around AI: environmental impact, job loss, fraud

    8 1
  • nix Accidentally removed ~/.local/state/nix/profiles/profile

    I would've thought that running switch again would put things back. But I might be able to help you out by sharing the structure of symlinks I have on my machine. First, a couple of ideas to try. You probably lost your Nix user profile state in addition to Home Manager state. According to my searching I think some Nix commands should recreate the profile links for you. Try running nix profile list and see if that puts anything back in ~/.local/state/nix/profiles/. If it does that might get you to a point where running switch will get you going again. Another idea: Home Manager generations have store paths that look like this:

     
    /nix/store/0k18msqsz0cdh751a9nv3grvfg8ajn2q-home-manager-generation

    Each of those has an executable called activate. Running one of those might get you set up again - possibly in a pretty old generation. I think that's a procedure you can normally use to roll back to a previous generation. I'd find a store path ending in home-manager-generation, and give it a go. I have ~/.nix-profile linked to /home/jesse/.local/state/nix/profiles/profile. I believe that's the Nix / NixOS user profile rather than Home Manager specifically, but I think that's an important piece. You're probably aware, but you can recreate that and other links with commands like ln -s $HOME/.local/state/nix/profiles/profile $HOME/.nix-profile. My Nix state in .local is in ~/.local/state/nix/profiles/ which has content like this:

     
    home-manager -> home-manager-229-link
    home-manager-227-link -> /nix/store/74awmvpikhvhi3rgn8c9iznvyc6fdi9j-home-manager-generation
    home-manager-228-link -> /nix/store/w2bcxdvi5ak3rbqkpjzksgrk02xvkzsr-home-manager-generation
    home-manager-229-link -> /nix/store/nfngszmd3yi9i0r5mkmy56yavjsxxv3a-home-manager-generation
    profile -> profile-290-link
    profile-288-link -> /nix/store/pcjlhf0m8iprnglvfv5mwi6rf41yqrfd-user-environment
    profile-289-link -> /nix/store/zq3lh6hr8nbm3n15avqcdjv7rlzaqr25-user-environment
    profile-290-link -> /nix/store/skfbszbmc7b7i55rj91zqi9r9vv2c59a-user-environment

    So that's both Home Manager generations, and Nix user profile generations. All symlinks, or symlinks to symlinks. I don't know if the generation number is stored in state somewhere. You might be able to pick an arbitrary number, pick an arbitrary home-manager-generation store path, and create the corresponding chain of two symlinks.

    0 1