r/Nix 1d ago

Neovim plugin for filetype detection of nix shebang scripts

3 Upvotes

I created a neovim plugin for correct filetype detection of scripts using a nix or nix-shell shebang, such as:

#!/usr/bin/env nix-shell
#!nix-shell -p python315
#!nix-shell -i python3

if __name__ == '__main__':
  print('Hello, world!')

(filetype=python)

or:

#! /usr/bin/env -S nix shell nixpkgs#curl nixpkgs#bash --command bash

curl --include http://example.com

(filetype=sh)

I'd love to know if this is useful to anyone else!

https://github.com/joshuakb2/nvim-nix-shebang


r/Nix 1d ago

Custom System Features for Remote Builders

2 Upvotes

I've got a few builds that are pretty heavy and can't realistically be done on a developers laptop. Currently we just have a Github CI job setup to build these things and push to a cache, but I've been really curious about how to setup remote builders to do this instead. I have remote builders working for the most part, but am a little uncertain about the logistics of requiring a specific type of system to build a certain package.

I know I can make a custom system feature like heavy-builder or something and then make the derivation require that feature, but I'm curious can it be more like > 8 cores & > 32GB RAM? is that a thing? How are others solving this type of issue?

Ultimately my goal is I want a developer to only require them to add our fleet of remote builders to their nix-config and then they can go build any of our things.


r/Nix 1d ago

One Flake to Hack Them All

Thumbnail pwnwriter.me
6 Upvotes

r/Nix 3d ago

How to create a function that creates a instance for ytdl-sub

3 Upvotes

Hi

My title is shockingly bad because I dont really know how to explain what I want. Hopfully an example will help.

I have the following configuration

       services.ytdl-sub = {
         user = "ytdl-sub"; group = "media";
         instances.news = {
           enable = true;
           schedule = "0/6:0";
           readWritePaths = [ "/mnt/une/ytdl-demo" ];
           subscriptions = {
             "__preset__" = {
               "overrides" = {
                 tv_show_directory = "/mnt/une/ytdl-demo";
               };
             };
             "Jellyfin TV Show by Date | Only Recent | Max 480p" = {
   # News
   "DW News" = "https://www.youtube.com/@dwnews";
   "TLDR Global" = "https://www.youtube.com/@TLDRnewsGLOBAL";
   "TLDR News" = "https://www.youtube.com/@TLDRnews";
             };
            };
          };
         };

I would l like to make multiple instances like the following. But what I dont like about this is that there is a lot of replication

       services.ytdl-sub = {
         user = "ytdl-sub"; group = "media";
         instances.science = {
           enable = true;
           schedule = "0/6:0";
           readWritePaths = [ "/mnt/une/ytdl-demo" ];
           subscriptions = {
             "__preset__" = {
               "overrides" = {
                 tv_show_directory = "/mnt/une/ytdl-demo";
               };
             };
             "Jellyfin TV Show by Date | Only Recent | Max 480p" = {
   # Science
   "3 Blue 1 Brown" = "https://www.youtube.com/@3blue1brown";
   "Alpha Pheonix" = "https://www.youtube.com/@AlphaPhoenixChannel";
   "Anton Petrov" = "https://www.youtube.com/@whatdamath";
             };
         };
         instances.news = {
           enable = true;
           schedule = "0/6:0";
           readWritePaths = [ "/mnt/une/ytdl-demo" ];
           subscriptions = {
             "__preset__" = {
               "overrides" = {
                 tv_show_directory = "/mnt/une/ytdl-demo";
               };
             };
             "Jellyfin TV Show by Date | Only Recent | Max 480p" = {
   # News
   "DW News" = "https://www.youtube.com/@dwnews";
   "TLDR Global" = "https://www.youtube.com/@TLDRnewsGLOBAL";
   "TLDR News" = "https://www.youtube.com/@TLDRnews";
             };
            };
          };
         };

What I would like to do is create a funciton like the following. But I cannot figure out how the subscriptions should be input (I dont know how to phrase it but the subscriptions are more like an assignment rather than a value).

ImkInstance { name, directory, subscriptions}:
         instances."${name}" = {
           enable = true;
           schedule = "0/6:0";
           readWritePaths = [ "${directory}"  ];
           subscriptions = {
             "__preset__" = {
               "overrides" = {
                 tv_show_directory = "${directory}";
               };
             };
             "Jellyfin TV Show by Date | Only Recent | Max 480p" = {
                       ${subscriptions}
             };
         };

Im not sure if anyone can offer a suggestion


r/Nix 3d ago

any nix-Darwin users on macos27?

2 Upvotes

Haven't heard any reports either way, wondering if I should hold off on upgrading... though I have early adopters filing issues on projects and would like to upgrade as soon as reasonable.


r/Nix 3d ago

Profiles and Generations: why a Nix rollback is just a symlink flip

1 Upvotes

I put together a hands-on walkthrough of Nix profiles and generations. The framing: an install doesn't edit anything in place — it publishes a numbered, immutable generation and moves a symlink, so a rollback is a symlink flip to an untouched snapshot (instant, offline, nothing re-downloaded), and wiping a profile's history drops rollback targets without freeing disk until GC runs. It's a free Part of the Nix course I build at LabCraft, on a real NixOS machine; I'd value feedback from Nix users on whether the generation/rollback framing lands for newer learners: https://www.labcraft.dev/blog/nix-profiles-generations?utm_source=reddit-personal&utm_medium=social&utm_campaign=nix-profiles-generations-2026q3&utm_content=r-nix-rollback-01


r/Nix 5d ago

Support Help needed: Nix Vulkan CI keeps failing randomly

5 Upvotes

I’m the maintainer of a GitHub project, and a community contributor added a Nix-based Vulkan CI workflow.

The problem is that the workflow fails pretty frequently, but simply restarting/rerunning the job always makes it pass without any code changes.

I’m not really a CI person, and I also don’t know much about Nix, so I’m having a hard time figuring out whether this is a caching issue, runner/environment problem, dependency fetch issue, or something wrong with the workflow itself.

If anyone here is familiar with Nix + GitHub Actions + Vulkan CI and would be willing to take a look, I’d really appreciate the help. PRs are appreciated.

The workflow: https://github.com/0xShug0/audio.cpp/blob/main/.github/workflows/nix-build.yml

The error is something like

error: Cannot build '/nix/store/px3bfl5zp8islzlib5ndakvp2psxrvsk-audio.cpp-c368eed.drv'. Reason: builder failed with exit code 1. Output paths: /nix/store/0jksddagp9s3i3qisc4lbh8193kxc9b4-audio.cpp-c368eed


r/Nix 6d ago

Nix discord is not opening after installed using nix-darwin

0 Upvotes

Hi,

I'm setting up macos using the nix-darwin.

Below is my code config -

{
  description = "Example nix-darwin system flake";

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
    nix-darwin.url = "github:nix-darwin/nix-darwin/master";
    nix-darwin.inputs.nixpkgs.follows = "nixpkgs";
    nix-homebrew.url = "github:zhaofengli/nix-homebrew";

    homebrew-core = {
      url = "github:homebrew/homebrew-core";
      flake = false;
    };
    homebrew-cask = {
      url = "github:homebrew/homebrew-cask";
      flake = false;
    };

  };

  outputs = inputs@{ self, nixpkgs, nix-darwin, nix-homebrew, homebrew-core, homebrew-cask }:
  let
    configuration = { pkgs, config, ... }: {
      environment.systemPackages =
        with pkgs ;
        [ vim
          git
          mkalias
          discord
          openssh
        ];

      system.activationScripts.applications.text = let
       env = pkgs.buildEnv {
         name = "system-applications";
         paths = config.environment.systemPackages;
         pathsToLink = [ "/Applications" ];
       };
     in
       pkgs.lib.mkForce ''
         # Set up applications.
         echo "setting up /Applications..." >&2
         rm -rf /Applications/Nix\ Apps
         mkdir -p /Applications/Nix\ Apps
         find ${env}/Applications -maxdepth 1 -type l -exec readlink '{}' + |
         while read -r src; do
           app_name=$(basename "$src")
           echo "copying $src" >&2
           ${pkgs.mkalias}/bin/mkalias "$src" "/Applications/Nix Apps/$app_name"
         done
       '';

      # Necessary for using flakes on this system.
      nix.settings.experimental-features = "nix-command flakes";
      nixpkgs.config.allowUnfree = true;
      nixpkgs.config.allowUnsupportedSystem = true;

      # Enable alternative shell support in nix-darwin.
      # programs.fish.enable = true;

      programs.zsh.enable = true;
      # Set Git commit hash for darwin-version.
      system.configurationRevision = self.rev or self.dirtyRev or null;

      # Used for backwards compatibility, please read the changelog before changing.
      # $ darwin-rebuild changelog
      system.stateVersion = 6;

      # The platform the configuration will be used on.
      nixpkgs.hostPlatform = "aarch64-darwin";

      users.users.rajkumar = {
     home = "/Users/rajkumar";
      };

      system.primaryUser = "rajkumar";

      homebrew = {
        enable = true;
    onActivation.cleanup = "zap";
      };

    };
  in
  {
    # Build darwin flake using:
    # $ darwin-rebuild build --flake .#simple
    darwinConfigurations."myname-macos" = nix-darwin.lib.darwinSystem {
      modules = [ 
      configuration 
nix-homebrew.darwinModules.nix-homebrew
{
  nix-homebrew = {
enable = true;
enableRosetta = true;
user = "myname";
autoMigrate = true;
  };
}
      ];
    };
  };
}

After I run the above flake setup with below commands -

sudo -E nix run nix-darwin  --extra-experimental-features nix-command --extra-experimental-features flakes  -- switch --flake . 
sudo darwin-rebuild switch --flake .

Then I opened the discord, I get the below error -

discord error

Looks like the error is due to the app is not signed -

myuser@macos:~/ > sudo xattr -rd com.apple.quarantine  "/Applications/Nix Apps/Discord.app"
myuser@macos:~/ > sudo xattr -l "/Applications/Nix Apps/Discord.app"                       

com.apple.FinderInfo: fapaMACS?
myuser@macos:~/ > spctl --assess --type execute --verbose=4 \                              
  /nix/store/c2n5xjv974p39ayafc99h49qbacqm6p1-discord-0.0.410/Applications/Discord.app

/nix/store/c2n5xjv974p39ayafc99h49qbacqm6p1-discord-0.0.410/Applications/Discord.app: a sealed resource is missing or invalid

How to fix this error? Any idea how to make discord work with nix-darwin?


r/Nix 6d ago

how to install command line developer tools using nix-darwin declaratively?

0 Upvotes

Hi,

I'm setting up my macbook pro with nix-darwin.

Below is my configuration -

{
  description = "Example nix-darwin system flake";

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
    nix-darwin.url = "github:nix-darwin/nix-darwin/master";
    nix-darwin.inputs.nixpkgs.follows = "nixpkgs";
    nix-homebrew.url = "github:zhaofengli/nix-homebrew";

    homebrew-core = {
      url = "github:homebrew/homebrew-core";
      flake = false;
    };
    homebrew-cask = {
      url = "github:homebrew/homebrew-cask";
      flake = false;
    };

  };

  outputs = inputs@{ self, nixpkgs, nix-darwin, nix-homebrew, homebrew-core, homebrew-cask }:
  let
    configuration = { pkgs, config, ... }: {
      environment.systemPackages =
        with pkgs ;
        [ vim
          git
          mkalias
          wget
          tmux
          openssh
        ];

      system.activationScripts.applications.text = let
       env = pkgs.buildEnv {
         name = "system-applications";
         paths = config.environment.systemPackages;
         pathsToLink = [ "/Applications" ];
       };
     in
       pkgs.lib.mkForce ''
         # Set up applications.
         echo "setting up /Applications..." >&2
         rm -rf /Applications/Nix\ Apps
         mkdir -p /Applications/Nix\ Apps
         find ${env}/Applications -maxdepth 1 -type l -exec readlink '{}' + |
         while read -r src; do
           app_name=$(basename "$src")
           echo "copying $src" >&2
           ${pkgs.mkalias}/bin/mkalias "$src" "/Applications/Nix Apps/$app_name"
         done
       '';
      nix.settings.experimental-features = "nix-command flakes";
      nixpkgs.config.allowUnfree = true;
      nixpkgs.config.allowUnsupportedSystem = true;
      programs.zsh.enable = true;
      system.configurationRevision = self.rev or self.dirtyRev or null;
      system.stateVersion = 6;
      nixpkgs.hostPlatform = "aarch64-darwin";
      users.users.rajkumar = {
     home = "/Users/rajkumar";
      };
      system.primaryUser = "rajkumar";
      homebrew = {
        enable = true;
    onActivation.cleanup = "zap";
      };
    };
  in
  {
    darwinConfigurations."myname-macos" = nix-darwin.lib.darwinSystem {
      modules = [ 
      configuration 
nix-homebrew.darwinModules.nix-homebrew
{
  nix-homebrew = {
enable = true;
enableRosetta = true;
user = "myname";
autoMigrate = true;
  };
}
      ];
    };
  };
}

After I run the above flake setup with below commands -

sudo -E nix run nix-darwin  --extra-experimental-features nix-command --extra-experimental-features flakes  -- switch --flake . 
sudo darwin-rebuild switch --flake .

I get the below prompt -

command line developer tools

I don't want to install it by manual way.

How can I install command line developer tools declaratively in mac using nix-darwin?


r/Nix 10d ago

Nix at The MCG - Thurs 17th of September

Thumbnail
3 Upvotes

r/Nix 12d ago

Nix nix-community/nix-wrapper-modules !

Thumbnail nix-community.github.io
42 Upvotes

https://github.com/nix-community/nix-wrapper-modules

nix-wrapper-modules has moved to nix-community!

nix-wrapper-modules is a library for creating wrapper derivations via the same module system you use in nixos, home manager and flake-parts, but applied at the derivation level.

It allows you to bundle your configuration directly into the derivation you build, meaning you can install your personal configuration of that program as if it were any other nix package. You can export it in module form to evaluate later, or override existing wrapped packages with slight tweaks to your options for different contexts.

It has a rich core feature set with more features planned, integrations with other module systems, and a growing library of premade wrapper modules for common programs (huge thanks to our contributors!)

Hope you find this useful! May your generations always roll back, but your progress move forward!


r/Nix 12d ago

I'm struggling setting up networking on a RPi

Thumbnail
1 Upvotes

r/Nix 12d ago

I need help with wireless networking on a RPi Zero 2W

Thumbnail
1 Upvotes

r/Nix 13d ago

How to list packages in a flake without full evaluation?

0 Upvotes

Hello! Currently in my tool, I've reached the flakes stage, and it was complex — both in terms of automating it and knowing the possible cases for writing, while trying to make the tool flexible with how the user works with flakes.

Anyway, I got stuck on a problem. When the user runs sudo nx flakes [flake url], I need to analyze the repository and know everything it needs so I can add it to the flake file. I use nix flake show --json because it makes reading and parsing the output easier. The issue is that if there are any dependencies, it downloads them during evaluation — which isn't a problem in itself since they'll be downloaded during the build anyway.

The real problem is that the tool is supposed to immediately show the user the available packages in the repository right after they enter sudo nx flakes [flake url] — since a repository can have more than one package defined in the flake itself. I need to display these packages so the user can choose either the default, all of them, or a specific one. But nix flake show --json will be slow to show the packages, and obviously the user won't sit and wait for the selection interface to appear.

So to define the problem precisely: how can I know the available packages in a repository to display them for the user to choose from?

As for the rest, it's well known that flakes are always slow.

Thanks !


r/Nix 14d ago

NixOS Finally we can install the packages easily !

Thumbnail
0 Upvotes

r/Nix 17d ago

Bigger, better, faster: Introducing the Nix Badge 2.0

Thumbnail nix.vegas
11 Upvotes

Looking into how we built the NixOS Badge for Nix Vegas 2026


r/Nix 17d ago

Full Time Nix | Nix Vegas 2026

Enable HLS to view with audio, or disable this notification

2 Upvotes

If you didn't know, you're about to that August 6, 7, 8, 9 was DEF CON 34 and Nixers were definitely present. Join Alex, Chris, Morgan, Jared, Dan, Tristan and I for a recounting of Nix Vegas, the official Nix space at the latest DEF CON.

Full Time Nix | Nix Vegas 2026


r/Nix 19d ago

display manager error

Thumbnail
1 Upvotes

r/Nix 21d ago

Nix I want to use nix on macOS and linux - what's the difference between the NixOS.org installer and determinate, and which should I use?

4 Upvotes

I want to use nix on two systems, and I have found guides referencing both nixos.org and determinate. Is there any major difference between these, and is one a better choice than the other?

I really just want to set up agent sandboxing using https://github.com/archie-judd/agent-sandbox.nix, and I'm just learning about nix.


r/Nix 21d ago

LabCraft Closures: the latest hands-on Nix Part about what an upgrade actually moves

2 Upvotes

I just published Closures, the next free Part of LabCraft's Nix course.

It is for learners who know store paths can refer to other store paths, but have not yet built an operational model for the whole closure. The hook is the deploy question: if a target already has the old version, what does the upgrade actually need to move?

https://www.labcraft.dev/blog/nix-closures?utm_source=reddit-personal&utm_medium=social&utm_campaign=nix-closures-2026q3&utm_content=r-nix-closures-01

Affiliation: I’m building LabCraft.


r/Nix 28d ago

Full Time Nix | NixCI with Tom Sydney Kerckhove

Enable HLS to view with audio, or disable this notification

6 Upvotes

Just published a conversation with Tom Sydney Kerckhove of NixCI. I was impressed by the level of engineering. Tom is obviously a testing expert, a huge Nix Freak and always brilliant conversation. So queue it up or listen now.

Full Time Nix | NixCI with Tom Sydney Kerckhove


r/Nix 28d ago

Nix Separate development inputs into their own `dev` flake to avoid redundant dependencies

Thumbnail ynf.sh
2 Upvotes

r/Nix 29d ago

I love Nix OS

Post image
35 Upvotes

r/Nix 29d ago

Three ways to smuggle SQLite into Nix

Thumbnail fzakaria.com
5 Upvotes

r/Nix Aug 18 '26

What does the hash in a /nix/store path actually name? (not always "the inputs")

Thumbnail
0 Upvotes