Nix / NixOS

2753 readers
2 users here now

Main links

Videos

founded 3 years ago
MODERATORS
101
 
 

Any suggested changes since this was published a year prior?

102
103
 
 

Any notable advance in this regard as compared to when the original article was published in 2015?

104
105
 
 

I recently reinstalled my nixos (long story). but for some reason, tailscale refuses to install. when i reinstalled, i just copied over my configuration.nix to replace the default one from the install (not sure if that is part of the problem?). or maybe its just broken right now, and i need to wait it out?

...

ok tailscale.com/net/tstun 0.034s

ok tailscale.com/packages/deb 0.028s

--- FAIL: TestGetList (0.00s)

portlist_test.go:19: seek /proc/net/tcp: illegal seek

--- FAIL: TestIgnoreLocallyBoundPorts (0.00s)

portlist_test.go:40: seek /proc/net/tcp: illegal seek

--- FAIL: TestPoller (0.00s)

portlist_test.go:61: seek /proc/net/tcp: illegal seek

FAIL

FAIL tailscale.com/portlist 0.016s

FAIL

error: builder for '/nix/store/18r5bq5bx8n79mgpv69mnfjq8w7z05b0-tailscale-1.82.5.drv' failed with exit code 1

error: 1 dependencies of derivation '/nix/store/pd0225japsibj036hgfzj48q960wx8k4-system-generators.drv' failed to build

error: 1 dependencies of derivation '/nix/store/572pg1xc24wdd01v7cyvvrdijn7qb20y-system-path.drv' failed to build

error: 1 dependencies of derivation '/nix/store/hln81111gkd51fzm7napkb40wd3rx9ig-nixos-system-wwt-25.05.809261.7c815e513adb.drv' failed to build

106
 
 

It does not require root, user namespaces support or disabling SELinux, but it relies on proot and other hacks instead. It uses a fork of Termux-the-terminal-emulator app, but has no relation to Termux-the-distro.

107
108
109
1
submitted 9 months ago* (last edited 9 months ago) by Novocirab@feddit.org to c/nix@programming.dev
 
 

I'm on a fresh installation with KDE. Kate is available, but what's the best way to get (n)vim up and running, or better yet, Helix? (I'm new to Nix. I do have a good amount of Linux experience though.)

110
111
 
 

Hi, I'm currently using a script to update my various NixOS hosts from a central machine, using the nh utility (https://github.com/nix-community/nh). By default, the command nh os switch . -H "..." --target-host "..." outputs the dependency graph of the build, as well as all the build logs. I like the dependency graph, however the build logs tend to push the diff result of the previous builds off of the terminal screen, so I have to watch the whole time in case I miss it. I've tried using the --no-nom flag, however this removed the dependency graph also. Is there a way in bash of selectively suppressing the build logs but not the dependency graph? Or is this an issue to raise with the project itself? The full bash script I'm using is shown below:

#!/usr/bin/env bash
# From: https://discourse.nixos.org/t/deploy-nixos-configurations-on-other-machines/22940/8

hosts=($(echo `nix eval .#nixosConfigurations --apply 'pkgs: builtins.concatStringsSep " " (builtins.attrNames pkgs)'` | xargs ))
skip=(
    "..."
)

rsa_key="$HOME/.config/sops-nix/secrets/keys/nixos-deploy-key"
export NIX_SSHOPTS="-t -i $rsa_key"

for host in "${hosts[@]}"
do
    # Check if the host is in the skip list
    if [[ " ${skip[*]} " =~ " ${host} " ]];then
        continue
    fi

    fqdn="$host"
    echo " ### $fqdn ### "
    echo

    initDir=($(ssh -i $rsa_key $host "readlink /run/current-system"))

    # Build config and list changes
    nh os switch . -H "$host" --target-host "deploy@$fqdn"

    ssh -i $rsa_key $host "nvd diff $initDir /run/current-system"
    echo
done

Any help is greatly appreciated, thanks!

112
113
 
 

For those who prefer to have a reference or need assistance troubleshooting, the accompanying GitHub repository, nix-intro-examples, includes the full project and all intermediate steps, captured through commits.

114
115
 
 

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

116
117
 
 

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

118
1
submitted 9 months ago* (last edited 9 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

119
 
 

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!

120
121
122
 
 

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?)

123
124
 
 
125
 
 

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.

view more: ‹ prev next ›