Nix / NixOS

2332 readers
30 users here now

Main links

Videos

founded 2 years ago
MODERATORS
1
 
 

Sascha Koenig looks to have some quality deep guides around NixOS!

2
3
4
5
 
 

Nixgl: https://github.com/nix-community/nixGL

Also, it seems like this requires the latest "stateversion", since this is a new feature.

This is pretty big, because it makes it easy to use applications that use the GPU from nixpkgs on non Nixos systems.

6
1
submitted 1 month ago* (last edited 1 month ago) by recursive_recursion@lemmy.ca to c/nix@programming.dev
 
 

I forgot that I shared this a week ago.
It's licensed under AGPL-3.0.

One of my thoughts is to add pictures of how the system looks with this config.

My current questions are:

  • What do you think could be improved?
  • What would you like to see?
7
 
 

Thought this would be fun and potentially handy for others to share. I recently did some work with Typst, and the template I ended up using made use of fonts not in my system install.

I was curious if you could use fonts in a nix-shell. Simply adding a font package via nix-shell doesn't make it accesible to applications. Thanks to this forum post, I ran a test using makeFontsConf, and it works! The way I used it it does require a .nix file, but I'm sure you could turn it into some one-line magic.

{ pkgs ? import <nixpkgs> {} }:

let
  fontsConf = pkgs.makeFontsConf {
    fontDirectories = [
      pkgs.font-awesome
      pkgs.fira
      pkgs.noto-fonts
      pkgs.roboto
    ];
  };
in

pkgs.mkShell {
  nativeBuildInputs = with pkgs.buildPackages; [ typst ];

  shellHook = ''
    export FONTCONFIG_FILE="${fontsConf}"
  '';
}
8
1
submitted 1 month ago* (last edited 1 month ago) by phantomwise@lemmy.ml to c/nix@programming.dev
 
 

Hi! I'm trying out Nix and I'm trying to set up and organize everything. Usually I put all my configs in a directory which is also a git repo and synced to my NAS, using the same subfolders they'd be in, and use GNU Stow to symlink the top-level folders (/dotfiles/home/ to /home/username/, /dotfiles/etc to /etc and /dotfiles/usr to /usr) and let it do its thing. Would it cause problems to also do that for configuration.nix?

On Arch I already had a /dotfiles/etc symlinked to /etc for my custom keyboard layouts, which worked fine... until the update which moved the location of the GUI keyboard layouts. It prevented the update so I undid the symlinks, updated, and put them again to the new location... but somehow it broke everything except the tty and no Wayland compositor I tried would work anymore (and there went my record of having never broken Arch since the first install over a year ago 😅 )

So I'm kinda wary of doing it on an even more critical file... but also I'm very lazy and having everything in a single repo is very convenient... How do you do it?

9
 
 

Basically the title. I would like apps that auto detect system theme to see it as dark mode. I’ve come across post after post of doing this with home manager, but I’d like to just do it in my base nix config. I tried a few different ways to declare what I thought was being done in the home manager tutorials in my config, but none of it worked. Any help would be greatly appreciated!

10
11
12
 
 

Ich würd gerne für einen Kollegen und mich zwei TShirts mit dem "Ansible? Nein Danke" Print bestellen. Redbubble ist ja schlecht von der Qualität, ich finde aber auch keine hochauflösende File um es wo anders drucken zu lassen. Wer kann hier vielleicht helfen? @nix

13
 
 

https://web.archive.org/save/https%3A%2F%2Ftypekmatus.blogspot.com%2F2025%2F05%2Fre-recenzia-nixos-ako-sa-pouziva.html

Use the translator in the sidebar to translate the page.

Asi pred rokom som napísal kontroverzný článok na kontroverziu v NixOS. Áno, viem, je to paradox. Potom som prešiel na Fedoru od napísania tohoto článku, pričom ju stále používam na mojom Macu, lebo tam mám dôležité veci. Ale teraz po roku som sa rozhodol, že NixOS vyskúšam znova, tentokrát ale ako používateľ, ktorý nesleduje dianie okolo NixOS (na fórum tejto distribúcie som sa prihlásil iba teraz, aby som mohol ľahšie dohľadať príspevok a skopírovať odkaz naň). Poďme sa pozrieť, ako som si ho nastavil.


14
 
 

The idea behind the first requirement was that I want to be able to reduce the creation of the logo to a few simple parameters. Additionally, if I can generate the SVG files programmatically, I can programmatically generate the Branding Guide and Media Kit. I’m calling this approach “Branding as Code” (BaC)

That sounds neat, and quite in the spirit of Nix itself! This PR looks to be the work in progress mentioned:

15
 
 

I just want to know from you how you (or how you would) pass options to packages you develop with flakes.

I am currently writing a widget bar using Astal and then import the flake in my NixOS flake and use the package.default output in home.packages. I'd like to also style this bar according to my Stylix theme, how do you do something like this?

16
17
 
 

I'm trying to write a Nix package for a closed-source, precompiled binary with an unusual twist. The binary is statically-linked, but it contains an embedded binary that is dynamically-linked. Is there some way I can use patchelf or another tool to path the interpreter path in the embedded binary?

The embedded binary does not have any runtime library dependencies, but it does need an interpreter which it expects at the hard-coded path /lib64/ld-linux-x86-64.so.2. It is embedded using the golang "embed" library.

I have a workaround that wraps the binary using buildFHSEnv. That works, but the resulting closure is about 300 MB bigger than it needs to be.

18
19
20
 
 

As the title says. Want that i can have a single config for my systems and just require a single line to install and configure software which i always use in a bundle(office, specific programming applications, server applications,...).

21
1
submitted 3 months ago* (last edited 3 months ago) by SpiderUnderUrBed@lemmy.zip to c/nix@programming.dev
 
 

https://pastebin.com/30Bh23EV and this:

  DVfio.configuration = {
        systemd.tmpfiles.rules = [
          "f /tmp/enable-vfio-switch 0644 spiderunderurbed users -"
        ];
        environment.variables = {
          KWIN_DRM_DEVICES = lib.mkForce "";
        };
        environment.extraInit = ''
                export KWIN_DRM_DEVICES=$(${vfio}/bin/vfio)
        '';
  };

So there is a issue with my configuration, so, you dont really need to understand nix, just like, look at my qemu hook script, its in plain sh, and the stuff above might be self explanitory, the issue is, my nvidia drivers are still being used, despite, setting KWIN_DRM_DEVICES to card0 so the logs of libvirtd looks something like this: https://pastebin.com/TaKrsY9S if setting kwin_drm_devices to my gpu card does not work, i dont know what does and can use help

22
 
 

The situation: you're trying to build something, but one of your configured substituters (a.k.a binary caches) is either offline, or having a moment of being very slow. Nix doesn't automatically time out, and skip that cache. No, you just can't build. You want to disable the problem cache so you can get on with your life. But since you use NixOS you need to run nixos-rebuild to update your substituter settings. A rebuild means hitting the problem cache...

When I've run into this problem I've thought, "I really need a way to selectively disable a cache in the nix build command." Previously I've had a hard time searching for such an option. Today I found it! Here it is:

$ nix build --option substituters "https://cache.nixos.org/ https://nix-community.cachix.org/"

or

$ nixos-rebuild build --option substituters "https://cache.nixos.org/ https://nix-community.cachix.org/"

The flag --option overrides settings that are normally read from /etc/nix/nix.conf. The idea here is instead of specifying a cache to disable, you list all of the caches that you do want to use.

Unless you are running as a "trusted user" you can't use this method to use substituters that aren't already configured because that would be a security problem. That means that substituter URLs need to be exactly the same as they are specified in /etc/nix/nix.conf including query parameters like ?priority.

I run into the misbehaving cache problem in two situations:

  • From time to time I get an error from cachix. I think it might be something like the cache claims to have a store path, but then actually downloading it fails. I'm not sure. Anyway the cache error makes the whole build command fail.
  • Sometimes garnix, as helpful as it is for avoiding expensive rebuilds on my slow laptop, gets very slow serving large packages like slack and google-chrome. These are unfree so they aren't cached on cache.nixos.org which usually takes precedence over garnix for unmodified nixpkgs packages. But since I build my nixos config on garnix the unfree packages do get cached there. I could wait all day for my nixos rebuild, or I could bypass the cache, download binaries from their original URLs, and be done in seconds.
23
 
 

Hello!

I'm getting back into NixOS again and i want to refactor my config heavily. Does anyone have any tips, advice or criticism on it? TIA.

https://codeberg.org/fxomt/nixos

24
 
 

cross-posted from: https://lemmy.world/post/27854420

On fediverse at @linuxprepper@podcast.james.network

cross-posted from: https://lemmy.world/post/27825913

Click for comprehensive shownotes with detailed links

  • Linuxfest Northwest
  • Audience Suggestion - Forgejo
  • Television Fuzzy Finder
  • Uptime Kuma- Monitoring
  • Dockje - Docker Compose Manager
  • Homebox - Inventory Management
  • Ameridroid Sponsor
  • Whisper AI - Speech to Text
  • Themio Stereotool
  • scp - SSH based Copy
  • ffmpeg audio extraction
  • Getting a New Laptop
  • Ubuntu adopting uutils
  • Podcasting 2.0 support - State of the Podcast
  • Spread the Word! Help promote the show. Send in feedback.

If you enjoy the show, please help spread the word. Thanks!

25
 
 

Edit: It was a portal error. needed to add xdg-portal-hyprland to extraPortals option. [nixos + hyprland user]

Plz help! I am enclosing related files

dotfiles - contain all nixos and firefox configs

firefox file - I don't think this file is the problem

view more: next ›