[-] secana@programming.dev 5 points 1 year ago

Many small companies use it for their internal crates, as kellnr builds and host the corresponding rustdocs, too. Another prevalent use-case is as a crates.io cache to speed a build times or lower the network traffic.

[-] secana@programming.dev 6 points 2 years ago

An honorable goal 😀

1

Hi!

I've ran into an issue with nix develop shells.

My setup:

  • Nix Darwin (macos)
  • Custom TLS certificates installed via nix darwin

Everything works as expected with the installed certificates, but as soon as I enter into a development shell with nix develop, the certificates are not available and thus, I get TLS errors that break whatever I'm doing in the dev shell. If I use an impure development shell, the issue disappears.

Is there a way to use pure nix develop shells which respect the installed certificates?

19

Hi rustaceans! What are you working on this week? Did you discover something new, you want to share?

1

Hi! I would like to host a transparent proxy for cache.nixos.org on my local kubernetes cluster.

I took the following NGINX config https://nixos.wiki/wiki/FAQ/Private_Cache_Proxy and created all the folders on the mounted storage.

This is the kubernetes deployment:

apiVersion: v1
kind: PersistentVolume
metadata:
  name: nix-cache-volume
spec:
  capacity:
    storage: 500Gi
  storageClassName: manual
  accessModes:
    - ReadWriteOnce
  hostPath:
    path: "/mnt/k8s/nix-cache" # Needs exists before PV is created!
  persistentVolumeReclaimPolicy: Retain
***
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: nix-cache-pvc
spec:
  accessModes:
    - ReadWriteOnce
  storageClassName: manual
  resources:
    requests:
      storage: 500Gi
***
apiVersion: apps/v1
kind: Deployment
metadata:
  name: nix-cache
spec:
  replicas: 1
  selector:
    matchLabels:
      app: nix-cache
  template:
    metadata:
      labels:
        app: nix-cache
        name: nix-cache
    spec:
      volumes:
        - name: nix-cache-storage
          persistentVolumeClaim:
            claimName: nix-cache-pvc
        - name: nix-cache-config
          configMap:
            name: nix-cache-config
      containers:
        - name: nix-cache
          image: nginx:1.27.0 
          ports:
            - containerPort: 80
          volumeMounts:
            - name: nix-cache-storage
              mountPath: /data
            - name: nix-cache-config
              mountPath: /etc/nginx/sites-available/default
          resources:
            limits:
              memory: "512Mi"
              cpu: "300m"
            requests:
              memory: "256Mi"
              cpu: "200m"
***
apiVersion: v1
kind: Service
metadata:
  name: nix-cache
spec:
  selector:
    app: nix-cache
  ports:
    - protocol: TCP
      port: 80
      targetPort: 80
***
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: nix-cache-ingress
  annotations:
    traefik.ingress.kubernetes.io/router.tls: "true"
spec:
  rules:
    - host: "nix-cache.raspi.home"
      http:
        paths:
          - pathType: Prefix
            path: "/"
            backend:
              service:
                name: nix-cache
                port:
                  number: 80
  tls:
    - secretName: nix-cache-raspi-home-tls
      hosts:
        - "nix-cache.raspi.home"
***
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
  name: nix-cache.raspi.home
spec:
  commonName: nix-cache.raspi.home
  dnsNames:
    - "nix-cache.raspi.home"
  secretName: nix-cache-raspi-home-tls
  issuerRef:
    name: ca-issuer
    kind: ClusterIssuer
***
apiVersion: v1
kind: ConfigMap
metadata:
  name: nix-cache-config
data:
  nginx.conf: |
    server {
      listen 80;
      server_name nix-cache.raspi.home;

      location ~ ^/nix-cache-info {
        proxy_store        on;
        proxy_store_access user:rw group:rw all:r;
        proxy_temp_path    /data/nginx/nix-cache-info/temp;
        root               /data/nginx/nix-cache-info/store;

        proxy_set_header Host "cache.nixos.org";
        proxy_pass https://cache.nixos.org/;
      }

      location ~^/nar/.+$ {
        proxy_store        on;
        proxy_store_access user:rw group:rw all:r;
        proxy_temp_path    /data/nginx/nar/temp;
        root               /data/nginx/nar/store;

        proxy_set_header Host "cache.nixos.org";
        proxy_pass https://cache.nixos.org/;
      }
    }

To use the cache I added it to the substituters.

  nix.settings.substituters = [
    "https://nix-cache.raspi.home/"
  ];

But when I try to use it, get the error:

# Trigger a download
nix develop nixpkgs#just
# Error message
warning: 'https://nix-cache.raspi.home/' does not appear to be a binary cache

In the logs of the NGINX I see the following error:

2024/08/03 12:09:30 [error] 31#31: *3 open() "/usr/share/nginx/html/nix-cache-info" failed (2: No such file or directory), client: 10.42.2.7, server: localhost, request: "GET /nix-cache-info HTTP/1 │
│ 10.42.2.7 - - [03/Aug/2024:12:09:30 +0000] "GET /nix-cache-info HTTP/1.1" 404 153 "-" "curl/8.8.0 Nix/2.18.5" "10.42.2.1"                                                                             │
│ 10.42.2.7 - - [03/Aug/2024:12:09:30 +0000] "PUT /nix-cache-info HTTP/1.1" 405 157 "-" "curl/8.8.0 Nix/2.18.5" "10.42.2.1"    

Any ideas whats wrong? I'm neither an nix nor an nginx expert, so maybe it is something really simple but I cannot figure it out.

22

Hi rustaceans! What are you working on this week? Did you discover something new, you want to share?

[-] secana@programming.dev 4 points 2 years ago

Unfortunately not. But I try to work on it a few hours every week in my spare time. I think that having an easy and free crate registry is crucial for the adaption of Rust in the commercial space. Companies don't want to share their code publicly on crates.io. My full time job is in the IT security sector. My hope is that by pushing Rust as a safe language, we can close some fundamental design flaws that languages like C/C++ introduced and make software landscape more secure.

16

Hi rustaceans! What are you working on this week? Did you discover something new, you want to share?

36
20

Hi rustaceans! What are you working on this week? Did you discover something new, you want to share?

14

Hi rustaceans! What are you working on this week? Did you discover something new, you want to share?

16

Hi rustaceans! What are you working on this week? Did you discover something new, you want to share?

[-] secana@programming.dev 7 points 2 years ago

I get the feeling that there are much more game engines in rust, than games :P

24

Hi rustaceans! What are you working on this week? Did you discover something new, you want to share?

20

Hi rustaceans! What are you working on this week? Did you discover something new, you want to share?

11

Hi rustaceans! What are you working on this week? Did you discover something new, you want to share?

[-] secana@programming.dev 4 points 2 years ago

I released the next minor version of https://kellnr.io which support the display of crates, cached from crates.io, in the UI now. For the first iteration of that feature, they are only shown and searchable in the crate overview and a click forwards to crates.io, as not all meta information is stored in kellnr, for cached crates. That may change in the future, if someone requests it.

[-] secana@programming.dev 4 points 2 years ago

Yeah, real world duties have priority over programming rust. Unfortunately.

[-] secana@programming.dev 6 points 2 years ago

I started to implement a new feature for https://kellnr.io. Currently, only private crates are displayed in the UI, but the users wished for the possibility to display cached crates from crates.io, as well. Hopefully a new version will be out in the next days, with the new feature.

[-] secana@programming.dev 4 points 2 years ago

I had the same experience. If you can live with a gpl license, maybe https://slint.dev/ is an alternative. I'll wait which UI framework becomes the predominantly one, before I start using rust for gui stuff.

[-] secana@programming.dev 5 points 2 years ago

I added stream support to https://github.com/GDATASoftwareAG/vaas but unfortunately didn't find time to work on any other project, as my free time goes into plastering walls in the real world.

[-] secana@programming.dev 5 points 2 years ago

That's true. If you are a rust beginner, you find so many good posts on Reddit for simple questions just by googling. Lemmy never pops up with a good answer.

[-] secana@programming.dev 7 points 2 years ago

I'll try to post more. Maybe cross posting from here to Mastodon helps. I've the impression that the Rust community is more active there.

[-] secana@programming.dev 7 points 2 years ago

Any advantages over distrobox? Sounds very similar.

view more: ‹ prev next ›

secana

0 post score
0 comment score
joined 2 years ago