@emattiza@hachyderm.io avatar

emattiza

@emattiza@hachyderm.io

Sr Software Engineer @ Axuall. Python, Typescript, Vue3, React, and any thing that lets me use FP. Spare time Rust and Purescript.

This profile is from a federated server and may be incomplete. Browse more on the original instance.

beausimensen, to golang
@beausimensen@phpc.social avatar

Has anyone worked with , (with or without nix-shell), and GoLand?

My first passes at researching this doesn't show me many promising results. Some vscode discussion suggest launching vscode from the CLI after entering the shell.nix-enabled project directory, but not sure how I feel about that.

emattiza,
@emattiza@hachyderm.io avatar

@beausimensen https://o.librepush.net/solutions/nix/developing-python-rust-projects-on-nixos/ may be partially helpful. Happy to pick a go project and show the setup if that would help

emattiza,
@emattiza@hachyderm.io avatar

@beausimensen so i ran this from a fresh gitpod workspace (just my way of getting a relatively clean slate to start from with nix and direnv), and can run goland with the right config from the following branch. having a package definition is a big help, and this shoots you right into a develop shell on the package where you can do the manual build steps afterwards (thanks to direnv and use flake). https://github.com/emattiza/otel-cli/compare/main...emattiza:otel-cli:add-nix-flake?expand=1

emattiza,
@emattiza@hachyderm.io avatar
emattiza,
@emattiza@hachyderm.io avatar

@beausimensen was just trying to show the diff, thats the branch. basically you can put a flake in a subfolder (or root, your choice really) and then put the package definition in there too. having a default package in the nix flake means nix develop calls will use the buildEnv of the default package in the new shell. direnv use flake hooks it up so you run nix develop on directory enter. going into goland after this should pick up the go from nix instead of system.

emattiza,
@emattiza@hachyderm.io avatar

@beausimensen you've got it right! you just enter directory, direnv does it's thing and pops you into a shell with all the deps of the package definition. then you can enter goland . once direnv is done, and open goland. the stuff in application.nix is whats in nixos/nixpkgs for this exact project, because i maintain that derivation and wrote some of it along with Colin. the preCheck and passthru are learned from maintaining nixpkgs derivations.

beausimensen, to golang
@beausimensen@phpc.social avatar

Working with and and running into an issue I'm not sure how to search for an answer.

I've installed libusb1.dev. I'm importing gouvc (“github.com/ginuerzh/go-uvc”) in main.go. Running "go build main.go" results in:

./libuvc-binding.h:1276:10: fatal error: 'libusb.h' file not found  
#include <libusb.h>  
 ^~~~~~~~~~  

What am I missing to help go to find the libusb1 headers?

/nix/store/7yjy4s3za889nnz0pgip6yb3pkj7d1mg-libusb-1.0.26-dev/include/libusb-1.0/libusb.h

emattiza,
@emattiza@hachyderm.io avatar

@beausimensen might be a similar buildGoModule derivation that has libusb1 as a buildinput? pkg-config in your nativeBuildInputs? https://github.com/NixOS/nixpkgs/blob/718f5903d7d64af2300080b677124742df93f15d/pkgs/tools/security/bettercap/default.nix#L8

emattiza,
@emattiza@hachyderm.io avatar

@beausimensen oh apologies! you're doing impure builds with go build in a dev shell (or global go compiler install from nix) then? what i proposed would help with a nix-build type situation with nix as the one calling "go build" under the hood

If it's non-nix builds like that, you're gonna generally have a rough go of it without doing your own flag manipulation (makefiles can help with that though).

emattiza,
@emattiza@hachyderm.io avatar

@beausimensen there's probably something, but i would at this point be more inclined (given you want to use libusb from nix) to structure the app through a nix build rather than a manual one with impure dependencies. If it's open source, i'd be happy to take a stab at writing for ya. otherwise, i could also write a dummy program with just the bits you need and make sure it has a devShell available for manual builds?

emattiza,
@emattiza@hachyderm.io avatar

@beausimensen i think your devShell has exports like NIX_LDFLAGS that may have all you need then? particularly if buildInputs contains libusb?

emattiza,
@emattiza@hachyderm.io avatar

@beausimensen https://gist.github.com/emattiza/a7589b9ea1c59ff999d912e790f49acc, ill comment with the exports that are available and how to run

emattiza,
@emattiza@hachyderm.io avatar

@beausimensen updated with a shell.nix with go and libusb, and the exports that nix makes when you use a devshell

mblayman, to django
@mblayman@mastodon.social avatar

🐍 Sometimes the best way to support a customer on a #Django project is to see their problem first hand from their account. This article shows how to do that responsibly with django-hijack. https://www.mattlayman.com/blog/2020/hijack-to-help-customers/

emattiza,
@emattiza@hachyderm.io avatar

@mblayman Little typo there on your pip install code block in this

emattiza,
@emattiza@hachyderm.io avatar

@mblayman It was a scroll bug, sorry to bother! My fault

danderson, to random
@danderson@hachyderm.io avatar

Okay I've now written enough Elixir+Phoenix to ship something modestly spiffy, and I'm reaching the point of framework fatigue, I think. In particular, the breaking point in Phoenix is the second you have to make a form that doesn't match the shape of your data model, things suddenly get pretty unpleasant.

Not unmanageable, just... enough to make me pine for Go again, and less frame/more work.

emattiza,
@emattiza@hachyderm.io avatar

@danderson Big fan of tanstack query in vue and react for remote data management. State management pinia or zustand, but thats small when tanstack query does most of the work you would need state managers for.

kat, to python
@kat@is.burntout.org avatar

I did some Haskell a few years ago.. but I always go back to python for actual work...

I do miss type signatures though.. like.. I don't need to test for str or int.. it's just built-in

I wonder if this will be good

https://coconut.readthedocs.io

I'm a shit programmer though

emattiza,
@emattiza@hachyderm.io avatar

@kat I get huge joy out of using it, particularly optional chaining and safe attribute gets. So many KeyError or AttributeError in python that just disappear with explicit defensive types and good language support from coconut.

Janik, to NixOS
@Janik@chaos.social avatar

Hello fediverse, is anyone in the bubble aware of a module-system to json schema generator?

emattiza,
@emattiza@hachyderm.io avatar

@Janik i kind of wondered how this was done in nil (nix language server), and found this https://github.com/oxalica/nil/blob/main/crates/nix-interop/src/nixos_options.nix. Maybe there is something in the xml doc generators for option sets that would help?

Dekker1, to random

I started with . I've loved the general idea of their package management for a while, but the system seems a lot more complex than I would have liked.

I'm now struggling with an issue to create my own flake, but I'm disappointed that no one has responded so far in what seems like such an active community (https://discourse.nixos.org/t/compilation-error-when-using-cbc-package-as-part-of-a-flake-on-macos/36745). Maybe it is not as MacOS friendly as I thought.

emattiza,
@emattiza@hachyderm.io avatar

@Dekker1 This looks alright? arm darwin or x86? May give it a go on my system. Great docs on your post.

emattiza,
@emattiza@hachyderm.io avatar

The cbc derivation may need a stdenv override for clang? https://nixos.wiki/wiki/Using_Clang_instead_of_GCC

emattiza,
@emattiza@hachyderm.io avatar

@Dekker1 Bummer. I do think this may be related? https://github.com/NixOS/nixpkgs/issues/272156

emattiza,
@emattiza@hachyderm.io avatar

@Dekker1 Maybe a locked older revision of nixpkgs without those cbc changes you pulled? Glad you got it working!

pfm, to python
@pfm@edolas.world avatar

I've got this little program and it doesn't work as I expect it to:

from asyncio import start_server, run
from email import message_from_bytes
from email.policy import SMTPUTF8

async def handle_client(reader, writer):
    data = b''
    async for line in reader:
        data += line

    msg = message_from_bytes(data, policy=SMTPUTF8)
    print(f'Received key for {msg}')

    writer.close()
    await writer.wait_closed()
    print('Finished handling')

async def main():
    server = await start_server(handle_client, 'localhost', 10822)
    async with server:
        await server.serve_forever()

if __name__ == '__main__':
    run(main())

Then I send it a message with the following command:

nc localhost 10822 < input.txt

But nc doesn't exit. I have to interrupt it (Ctrl+C) and then my little program receives an EOF and finishes processing input. I don't understand this behaviour.

Any hints?

emattiza,
@emattiza@hachyderm.io avatar

@pfm You should run gnu-netcat with the right netcat option. Probably nc not sending eof at end of stdin

gnomon, to random
@gnomon@mastodon.social avatar

It has been: [0] (zero) days since ten minutes of reimplementing @cadey 's JSON-to-sqlite3 pattern¹ for a new data schema has turned a multi-hour slog of a task into a 0.03ms query that can now be documented and reused by the rest of the team

side-eyes the Splunk cluster consuming thousands of dollars of opex and engineer time every month while working orders of magnitude less well than a shell script

¹: https://xeiaso.net/blog/sqlite-json-munge-2022-01-04/

emattiza,
@emattiza@hachyderm.io avatar

@gnomon @cadey Kind of want to see this in duckdb now...

geraldew, to python
@geraldew@fosstodon.org avatar

One of the curious things about on Ubuntu is that Python is essentially pre-installed with the Linux distribution. That seems to be because Ubuntu itself uses Python quite a bit for various parts of its setup and routine processes.
Not a complaint as it works well for me, and in a way makes a good "fence" in which I can code and avoid non-stock dependencies.
For Foldatry, I only need to have "python3-tk" added via the admin account.
Wonder if anyone has mapped that out across distros.

emattiza,
@emattiza@hachyderm.io avatar
davidism, to random
@davidism@mas.to avatar

I have a giant .sql file describing the giant schema dumped from an Oracle database. I don't have Oracle Database installed. Know any good tools to explore the tables/relations? It's way too big for a graph diagram. It has to run locally, no uploading it somewhere.

emattiza,
@emattiza@hachyderm.io avatar

@davidism DDL Data Source in Datagrip? No clue on foss that might do it

fasterthanlime, to random
@fasterthanlime@hachyderm.io avatar

> To answer this question, I had to look back 20 years into computer science history to stumble into NFSv3.

I'm listening.

https://about.xethub.com/blog/nfs-fuse-why-we-built-nfs-server-rust

emattiza,
@emattiza@hachyderm.io avatar

@arch @fasterthanlime I can give a review and build test for aarch64 linux

  • All
  • Subscribed
  • Moderated
  • Favorites
  • provamag3
  • kavyap
  • DreamBathrooms
  • cisconetworking
  • magazineikmin
  • InstantRegret
  • Durango
  • thenastyranch
  • Youngstown
  • rosin
  • slotface
  • mdbf
  • khanakhh
  • tacticalgear
  • JUstTest
  • everett
  • modclub
  • Leos
  • cubers
  • ngwrru68w68
  • ethstaker
  • osvaldo12
  • GTA5RPClips
  • anitta
  • megavids
  • normalnudes
  • tester
  • lostlight
  • All magazines