Plutus, Haskell, Nix, Purescript, Swift/Kotlin. laser-focused on FP: formality, purity, and totality; repulsed by pragmatic, unsafe, “move fast and break things” approaches


AC24 1DE5 AE92 3B37 E584 02BA AAF9 795E 393B 4DA0

  • 11 Posts
  • 30 Comments
Joined 1 year ago
cake
Cake day: June 17th, 2023

help-circle






  • I’d look into building all of that in a flake just so you can encapsulate (and have a central version control of) all of your dependencies in case something does change.

    I’m a bit of a Nix dork but I tend to try and declare my entire dev stack in a flake so it can follow me to every machine. It offers some of the “it works on every machine” guarantees that Docker offers while also forcing the compilation of the stack to happen natively (or at least pulls in some content addressed cache that offers security by being the exact hash for the whole dependency graph). I like that

    Here’s how I used the Nix way to declare an interactive Python scraper the other day. With this method, I can lock dependencies between machines as a matter of course without having to use Docker:

    {
      description = “Weed Scraper”;
    
      inputs = {
        nixpkgs.url = “github:NixOS/nixpkgs?ref=nixpkgs-unstable”;
        utils.url = “github:numtide/flake-utils”;
      };
    
      outputs = { self, nixpkgs, utils }: utils.lib.eachSystem [“x86_64-linux”] (system: let
        pkgs = import nixpkgs { system = system; };
      in rec {
        packages = {
          pythonEnv =
            pkgs.python3.withPackages (ps: with ps; [ webdriver-manager openpyxl pandas requests beautifulsoup4 websocket-client selenium keyboard ]);
        };
    
        devShell = pkgs.mkShell {
          buildInputs = [
            pkgs.chromium
            pkgs.undetected-chromedriver
            packages.pythonEnv
          ];
    
          shellHook = ‘’
            export PATH=${pkgs.chromium}/bin:${pkgs.undetected-chromedriver}/bin:$PATH
          ‘’;
        };
      });
    } 
    




  • Yes for sure. Actually Nix is pretty long in the tooth and there are better implementations of Eelco’s brilliant idea. It’s just that they have a lot less effort, ubiquity, and hype behind them. GUIX is a good example of that. They literally can build an OS from scratch. I find Nix to be rock solid, so I stick with it. But, it’s an idea (all dependencies being content addressed in an immutable folder structure) to allow complexity that isn’t even achievable on FHS style systems.

    For example: THE main feature is that you could have a different version of say Python (for the sake of this example) installed for each dependency in your system and they would just work alongside each other due to their unique, hash based folder locations. Each folder is named based on the sha256 hash of the dependency graph, which has powerful implications. Because of this hash, they’re effectively hermetically sealed from each other and cannot step on each other. This is the very definition of Nix and taken far enough to define a whole OS is SUPER powerful concept.

    Shit, I’m rambling. Maybe I’ll pause to let you guide my rant. ;)




  • Very true. I made a point of doing it by forking an already working nix-config from github that used what I wanted to use. This one drew me in because it used xmonad along with home-manager and flakes. Honestly, it really WAS pretty confusing at first (due to that setup using secrets and git-crypt to obfuscate some of the files) but Nix had some helpful error messages that allowed me to finally get it working in a VM. Then, I got it installed as my daily driver when it was stable enough. Today, I provision all of my different systems in my network (ARM, x86, Nix-Darwin, Nix on a routers and network gear, etc) using one nix-config that contains all of the machine configs as different outputs.














  • demesisx@infosec.pubtoProgrammer Humor@programming.devTypescript
    link
    fedilink
    English
    arrow-up
    7
    ·
    edit-2
    6 months ago

    I have. Edit; I haven’t 🤣 didn’t see the .js at the end of that word so some of the following is probably irrelevant, though I’ll leave it because it took me a while to type it out. Haha

    I’d probably be more interested in it if I were being forced by my day job to work in the JVM. I happen to be in a situation where I am my own boss working on projects completely alone and the tech I pick comes from months of wasting time making perfect the enemy of good. I know that raises quite a few red flags but I can’t help the way that they made me. Haha 🥴

    From what I’ve gathered from Joseph Gordon Bell at the (IMO best software engineering podcast ever) Co-Recursive podcast, Scala sacrifices some of the purity and safety by its dependence on the the Java cargo cult. Partly, this is also a drawback of Purescript for me (since it’s intended to compile to JavaScript) but Purescript is starting to be able to escape that fate. Also, I’m a HUGE fan of Haskell syntax.

    From your perspective, what pros and cons do you see if I were comparing Scala to Purescript?

    Ps. The one that is actually really making me take notice lately is OCaml for the browser.