• 0 Posts
  • 3 Comments
Joined 1 year ago
cake
Cake day: May 6th, 2025

help-circle

  • At least you were intellectually honest about NixOS rather than blaming them.

    I swear by it but had a year or two where I was struggling. Particularly with languages like Python, it can be tough to train yourself in the Nix way (or to wrap compilation and dependency management into the nix paradigm in this case). With languages like Haskell though, the Nix way goes hand-in-hand with it.

    I’ve found Zig to work well with Nix. And there are ways to use Nix REALLY elegantly with Python

    Here’s an example of how you’d provision a super simple nix flake dev environment in x86_64 Linux for undetected web scraping with Python

    
    # save this as flake.nix then run nix develop in the root of the repo
    
    {
      description = "Web 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
          '';
        };
      });
    }
    
    

  • OP:

    i SwItChEd On BlEeDiNg EdGe BuIlDs ThEn CaN’t UnDeRsTaNd WhY i NeEd To BuIlD tHe LaTeSt SoFtWaRe FrOm SoUrCe. It MuSt Be NiXoS’s FaUlT tHaT i DiDn’T bOtHeR tO lEaRn HoW nIxOs WoRkS bEfOrE sWiTcHiNg On FeAtUrEs ThAt ArE lItErAlLy LaBeLeD “uNsTaBlE”. pS. oH yEaH. bEfOrE sOmEoNe MeNtIoNs It, I kNoW tHe SoLuTiOn BuT wOn’T bOtHeR tO pOsT iT bEcAuSe I jUsT wAnTeD tO pUbLiClY sHiT oN aNd HaMpEr NiXoS’s ChAnCeS oF wIdEsPrEaD aDoPtIoN bEcAuSe It Is HaRd FoR mE. wHaT oThEr LiNuX dIsTrOs Do YoU tHiNk ArE rUn By UtTeR bOnEhEaDs ThAt BuIlD sTuFf ThAt MuSt Be FlAwEd Or WrOnG bEcAuSe YoU cAn’T gEt It To WoRk On ThE fIrSt TrY?

    # /etc/nixos/configuration.nix
    
    nix.settings = {
      substituters = [
        "https://nix-community.cachix.org/"
      ];
      trusted-public-keys = [
        "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
      ];
    };