Nix / NixOS

2547 readers
1 users here now

Main links

Videos

founded 2 years ago
MODERATORS
51
 
 

I have a folder with some cool nixos configurations that i ripgrep through when im looking for inspiration on how to do things.
Anyone got recommendations for configs where people do cool stuff? Feel free to drop your configs as well, its just fun to look at other people's systems!

PS: I know this is generic, but i think im looking for answers of all kinds so that works
Also here is my config since im asking

52
53
 
 

While the OP video didn't merit posting, I think the resulting comment thread is worth sharing to join the discussion.

54
15
submitted 4 months ago* (last edited 4 months ago) by Zangoose@lemmy.world to c/nix@programming.dev
 
 

I'm working on switching over to NixOS on my desktop and one of the last things I haven't got fully working is my neovim config. My LSP's are able to start, and all of them work fine except for clangd. For some reason, it can't find C/C++ header files for any installed libraries. I have all of the LSPs themselves installed through Mason in Neovim, and I have programs.nix-ld.enable = true enabled so they can be run correctly.

screenshot showing 'file not found' error on '#include <fcntl.h>'

screenshot showing 'file not found' error on '#include <SDL2/SDL2.h>'

Here is the shell.nix file I'm using for this project:

{ pkgs ? import <nixpkgs> {} }:
pkgs.mkShell.override { stdenv = pkgs.gccStdenv; } {
  nativeBuildInputs = with pkgs.buildPackages; [
    glibc libgcc
    clang-tools libclang
    SDL2 SDL2_image SDL2_sound
  ]; 
  CPATH = pkgs.lib.makeSearchPathOutput "dev" "include" pkgs.glibc pkgs.SDL2 pkgs.SDL2_Image pkgs.SDL2_sound;
}

Is there something extra I need to do to get clangd to find the C headers being used by the project? when I actually run gcc it compiles fine, it just can't seem to find them correctly in Neovim

Edit: Forgot to mention that I'm using this shell with direnv and launching nvim directly from the same shell that I'm compiling from

55
 
 

nix-book

I also made a NixOS Blog with an RSS FEED

I've been working on these for a while now, they are a work in progress and evolve daily. I tried to frame it from a point of no assumptions on prior experience. Constructive feedback welcome, I want to continue making this a better resource. Thanks!

56
57
58
 
 

https://github.com/mcdonc/.nixconfig/blob/master/videos/nix-serve/script.rst


Btw, why is remote caching with substituter so iffy with NixOS? I encountered the same issues demonstrated in the video. It's not obvious why an offline substituter should block a local rebuild unless there is some nix option denoting as optional or required. Or why some matching entries in the remote nix-serve store are ignored (or untrusted?)

59
60
 
 
61
 
 

For example, compose2nix lets you build nixos configuration for containers defined in a docker compose compose.yml. But this step happens offline. You have to first ad hoc generate the config from the compose.yml and then use that generated output in your config.

It seems obvious to me that the best user experience would be to write a flake/module that let's you just point to a compose file directly in your config. On rebuild, it would parse the compose file and build the appropriate config.

But I've not really seen that. These projects that convert from one package mamagement scheme or config file to another (xxx2nix projects) work using this preprocessing step. More examples include pip2nix and cargo2nix.

Given how common this pattern is, I suspect there is something preventing generating at rebuild time from being feasible, or at least easy. Does anyone have ideas for why this is? Thanks.

62
63
64
 
 

Just discovered this article recently from a related thread:

65
 
 

Sequel to prior series discussed:

66
 
 

The image shows what happens when i boot on the ISO, i get the error:

x sysroot-nix-rrv\v2dstore.mount - /sysroot/nix/.rc-store
    Loaded: loaded (/nix/store/1779scwag89fja51b1q7jg5savcj5tyrlnltrd-fstab; generated)
    Active: failed (Result: exit-code) since Tue 2023-07-29 18:37:53 UTC; 35s ago
Invocation: 94ea87636cc24a4c83d8e147275a8124
    Where: /sysroot/nix/.rc-store
    What: /iso/nix-store.squashfs
    Docs: man:fstab(f)
    man:systemd-fstab-generator(8)
    Item peak: 1.9M
    CPU: 9ms
Jul 29 19:37:53 hostruc systemdf11: Mounting /sysroot/nix/.rc-store...
Jul 29 19:37:53 hostruc mountt2531: mount: /sysroot/nix/.rc-store: failed to setup loop device for /iso/nix-store.squashfs.
Jul 29 19:37:53 hostruc systemdf11: sysroot-nix-rrv\v2dstore.mount: Mount process exited, code-exited, status=82/n/a
Jul 29 19:37:53 hostruc systemdf11: sysroot-nix-rrv\v2dstore.mount: Failed with result: exit-code .
Jul 29 19:37:53 hostruc systemdf11: Failed to mount /sysroot/nix/.rc-store.

and I am pretty confident this is because I have initrd systemd on a iso build, so does anyone know how I can fix this issue in either my flake where i set how the iso is built or in main.nix (which i linked), which is about initrd settings main.nix (imported in configuration.nix): https://pastebin.com/3VVv4epH flake.nix: https://pastebin.com/yzVrJ0YJ

Image

67
68
 
 

I want to edit .desktop files of some nixpkgs for customization, but they are located in /run/current-system/sw/share/applications.. and are readable only.

One possible solution would be to copy them to ~/.local/share/applications but duplicating doesnt sit right with me (this would be my last resort tho).

I would prefer to override the parameters I want to change somehow preferably in my configuration.nix only.

69
 
 

Hi all,

Since intel-media-sdk-23.2.2 + has been marked as vulnerable in NixPkgs ( commit ) is there an alternative for enabling Jellyfin hardware transcoding on an Intel i5-8500? Thanks!

70
6
submitted 4 months ago* (last edited 4 months ago) by hyveltjuven@lemmy.world to c/nix@programming.dev
 
 

Hi, new NixOS user here.

Liking it so far but just hit an issue that I'm having trouble getting past. Pages in firefox cannot access my geolocation, even after I hit allow when the page asks for permission. Same with the default Gnome maps app, it just places me in a central location of my countrys capital (I don't live in the capital).

I've added the following to my configuration.nix file and rebuilt but it made no difference.

 # Geolocation
  services.geoclue2.enable = true;

  environment.sessionVariables = {
    # Allows geolocation in firefox
    MOZ_ENABLE_WAYLAND = "1"; 
  };

What am I missing?

71
 
 

Hello guys,

I made a group for nix and nixos for those who want to have casual talk about it in a signal group. I chose Signal since it's e2ee and very seamless to use. You can now hide phone numbers and add usernames in Signal so anonymity can still be a priority.

I hope to see your guys there!

72
73
11
submitted 5 months ago* (last edited 4 months ago) by beegnyoshi@lemmy.zip to c/nix@programming.dev
 
 

Hey all. Last time I searched about how to make LazyVim "just work" in nixos (which it didn't mostly because of mason and treesitter) was a few years ago, so maybe if I were to try to do it again nowadays I would find a better solution but anyway.

When I first switched to nixos, I already had my neovim config, and I wanted it to just work in my new system. I didn't want to rewrite it in nix or manually install treesitter grammar packages or lsps. Alas, due to nixos not following FHS, it didn't work.

So, a few days ago, here's what I seem to have found as a solution: Adding this:

      (pkgs.buildFHSEnv {
        name = "nvim";
        multiPkgs = pkgs:
          with pkgs; [
            libz # For codelldb to work
            icu # For marksman to work
          ];
        targetPkgs = pkgs:
          with pkgs; [
            neovim
            # Whatever other things you need inside neovim
            gnumake # for compiling some plugins
          ];
        runScript = "nvim";
      })

To my environment.systemPackages.

Note that I wasn't using steam-run because I remember I got a ton of errors when I tried it a few years ago, though it seemed to work normally when I tried it just now. I still think that this is a better way to go about it than to use steam-run nvim every time, though. I also haven't tested this all that much, so it might have some sort of caveat I have yet to discover.

Hopefully this post helps someone.

Edit: Added icu for marksman

74
 
 

In this video, I show you how to turn your phone into a mobile typewriter using NixOS, Emacs, Org Roam, and Syncthing — no Google, no distractions.

Not very touch friendly yet, and not sure if anyone has gotten the cellar radios to work with a SIM carrier.

75
 
 

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

view more: ‹ prev next ›