Nix / NixOS

2809 readers
18 users here now

Main links

Videos

founded 3 years ago
MODERATORS
1
 
 

Fair warning, I used Claude for a lot of the details. Architecturally, it's my design.


Got NixOS running on my reMarkable Pro Paper Move (codename: chiappa) because when I got this tiny tablet, it was with the goal of replacing my iPad Mini (which I mainly used to read books on anyway) and wanting to use something that ran Linux (I use NixOS on every other machine I touch except my Phone...).

Finally got around to (helping Claude) port NixOS though so now, besides having my config live alongside the rest of my machines, I can boot right into KOReader and not play silly games with Xochitl everytime I reboot. Plus, being my own NixOS config, I can (WIP/testing) load/use other applications with ease.

The details and how to set it up are mostly in the NixOS flake/associated repo over here:

https://github.com/gitman-101111/remarkable-nixos

If you want to use the e-ink bridge/associated tools to port to another OS of your choice (I tried and succeeded in porting to PostmarketOS but they have a strict no generative AI policy), you can use this repo (which the flake also references):

https://github.com/gitman-101111/chiappa

All the hardware works with KOReader with some minor patching. Feel free to play around with different configurations, etc.

Details on the setup and specifics are in the repos.

Lastly, I wouldn't recommend this to people unfamiliar with NixOS or at least some Linux experience. There's a lot of information here on how to essentially brick your device lol. Be careful out there! :)

2
 
 

Pretty much the title. Please bear with me, since I'm sort of a beginner 😅

I am trying to use nixpak to sandbox iamb, but for whatever reason, it doesn't start up and run properly. Here's the relevant section of the config

environment.systemPackages = [
      (mkNixPak {
        config = { pkgs, sloth, ... }: {
          app.package = pkgs.iamb;

          bubblewrap = {
            network = true;
            shareIpc = false;
            dieWithParent = true;

            bind.rw = [
              [
                (sloth.mkdir (sloth.concat' sloth.homeDir "/Downloads/iamb"))
                (sloth.concat' sloth.homeDir "/Downloads")
              ]

              (sloth.mkdir (sloth.concat' sloth.xdgConfigHome "/iamb"))
              (sloth.mkdir (sloth.concat' sloth.xdgDataHome "/iamb"))
              (sloth.mkdir (sloth.concat' sloth.xdgStateHome "/iamb"))
              (sloth.mkdir (sloth.concat' sloth.xdgCacheHome "/iamb"))

            ];

            bind.ro = [
            "/etc"
            "/usr"
            # To mount the systemd resolution stuff and so on
            "/run/systemd"
            ];

            apivfs = {
              proc = true;
              dev = true;
            };

            bind.dev = [
              "/dev"
            ];

            tmpfs = [
              (sloth.mkdir "/tmp/iamb")
            ];

            env = {
                TERMINFO = "${pkgs.kitty}/lib/kitty/terminfo";
            };
          };

        };
      }).config.env
];

The full config can be found here

The following bubblewrap command works as-is on nixos, and doesn't lead to any errors whatsoever:

bwrap --ro-bind /usr /usr \
--ro-bind /etc /etc \
--proc /proc \
--ro-bind /home/innocentzero/.local/state/nix/profile /home/innocentzero/.local/state/nix/profile \
--ro-bind /nix/store /nix/store \
--ro-bind /run/systemd /run/systemd \
--dev /dev \
--tmpfs /tmp \
--unshare-all \
--share-net \
--die-with-parent \
--bind /home/innocentzero/.config/iamb /home/innocentzero/.config/iamb \
--bind /home/innocentzero/.cache/iamb /home/innocentzero/.cache/iamb \
--bind /home/innocentzero/.local/share/iamb /home/innocentzero/.local/share/iamb \
iamb

However, executing the nixpak wrapped iamb produces the following (including the control characters):

^[[?62;4;22;28;52c^[[6;25;11t^[[0n* Logging in for @innocentzer0:cyberia.club...

Any ideas/suggestions? I'm not sure how exactly to get this to work. From what I see in the nixpak module, the generated command should be about the same. Any help is appreciated. Thanks!

3
 
 

This may be an unusual thing but I realised that use nix run a lot instead of putting the package in my nixos configuration. It's often on packages I run at most once every 3 days

Am I the only one that does that?

4
 
 

I need to find out how much garbage can be cleared when 'nix-collect-garbage -d' is run for a personal project but I haven't been able to find any answer about this on documentations and DDG.

I've tried 'du -sh /nix/store' but it would print the size everything in /nix/store however 'nix-collect-garbage -d' does not remove everything when it's executed so that's not gonna work. I've also tried executing "nix-store --gc --print-dead | grep '^/nix*'" ('--print-dead' produces output that which contains store paths that are not live and will not be used, with respect to roots) and then executing "stat -c '%s'" on each path ('stat -c "%s" $file_name' produces output containing the bytes of the concerned file in bytes) however that doesn't seem to work as well for some unknown reason as they all seem to add up to a few kilobytes (despite the actual amount that 'nix-collect-garbage -d' deletes being about 400MB).

I know that the code below is extremely shit but that's because that's not my main project but a separate script solely for trying to find out what I am doing wrong and how I can properly implement this in my main project.

Thanks for any help!

`#!/usr/bin/env bash

tmp() {

declare -a str byt

str=( $(nix-store --gc --print-dead 2>/dev/null | grep '/nix*') )

for garbage in "${str[@]}"; do

    byt+=( $( stat -c '%s' $garbage ) )

done

total=0

for filesize in "${byt[@]}"; do

    total=$(( $total + $filesize ))

done

convertedtotal="$(( ( $total / 1024 ) /1024  ))MB"

echo "$total"

echo "$convertedtotal"

}

tmp`

Some responses from people on other platforms that did not work perfectly:

"I had the same issue a couple months back, i asked claude back then and got: sudo nix-store --gc --print-dead 2>/dev/null | xargs -I{} du -s {} 2>/dev/null | awk '{sum += $1} END {printf "%.2f GB\n", sum/1024/1024}'"

And

"```

bytes=$(

nix-store --gc --print-dead |

xargs du -sb |

awk '{s+=$1} END {print s}'

)

numfmt --to=iec "$bytes"


some like this should work for you"

Both of them had one issue: 

`$ nix-store --gc --print-dead | grep '^/nix*' | xargs du -sh | awk '{ print $1 }'

finding garbage collector roots...

determining live/dead paths...

8.0K

8.0K

8.0K

4.0K

1.6M

1.9M

8.0K

2.3M

8.0K

45M

4.0K

4.0K

8.0K

4.0K

4.0K

4.0K

684K

8.0K

8.0K

4.0K

8.0K

8.0K

7.7M

692K

4.0K

728K

8.0K

8.8M

344K

492K

4.0K

572K

8.0K

1.1M

4.0K

4.0K

8.0K

4.0K

8.0K

36K

8.0K

8.0K

8.0K

4.0K

4.0K

8.0K

# All of that is about 72MB.

$ nix-collect-garbage -d

removing old generations of profile /home/north/.local/state/nix/profiles/home-manager

removing old generations of profile /home/north/.local/state/nix/profiles/profile

finding garbage collector roots...

deleting garbage...

deleting '/nix/store/vdixm6r047a3rw1wx8pqsjh40nl886jj-kate-26.04.2.drv'

deleting '/nix/store/s5i0c135x2x5dz9ah01zxvl3prywqb30-kate-26.04.2.tar.xz.drv'

...

deleting '/nix/store/rivv4fh68mkqnc4v225mflmi3a9damcj-xfconf-4.20.0'

deleting '/nix/store/9nj1k063j54qfxzcm49dspwwl1sxhqs0-libxfce4util-4.20.1'

deleting unused links...

note: hard linking is currently saving 0.0 KiB

46 store paths deleted, 64.8 MiB freed`

Now what's strange is that 'nix-store --gc --print-dead' outputs these 46 paths (which add up to ~72MB) and 'nix-collect-garbage -d' deletes 46 paths but somehow, 64.8 MiB, which is about 68MB, is freed instead of 72MB. I tried to replicate this again and it worked, there's always some amount of inaccuracy. Of course, a few megabytes don't matter but this can create significant inaccuracies on systems with more cache, but this definitely is a lot better.
5
 
 

So I came here while researching for the problems with qt5 theme. So in the archi wiki it says -

3.1 QGtk3Style
This is a platform theme built into qt5-base starting with version 5.7.0 [2] and qt6-base. It can be used to style Qt5 and Qt6 applications according to current GTK3 style. It can be enabled by setting the following environment variable: QT_QPA_PLATFORMTHEME=gtk3. 

I am on nixos and if i set the same envionment variable qt6 apps like pcmanfm-qt, qbittorrent correctly use the same colors as my gtk3 theme, but it seems qt5 apps (like wpa_supplicant_gui, keepassxc, picard) even though in logs they seem to load the plugin, dont theme accordingly and show the default white color. I just want to know is the plugin abandoned? Meaning its no use trying to wait for it to update and be fixed or should i just switch to qtstyleplugins for qt5 apps?


I Can confirm this if i run

QT_DEBUG_PLUGINS=1 QT_QPA_PLATFORMTHEME=gtk3 wpa_gui 2>&1 | grep -i gtk3

and logs show

QFactoryLoader::QFactoryLoader() looking at "/nix/store/64qmp7fap3740hxd2bsnpy10s9ndy5qx-qtbase-5.15.18-bin/lib/qt-5.15.18/plugins/platformthemes/libqgtk3.so"
Found metadata in lib /nix/store/.../libqgtk3.so, metadata=
            "gtk3"
    "className": "QGtk3ThemePlugin",
Got keys from plugin meta data ("gtk3")
loaded library "/nix/store/.../libqgtk3.so"

  • Note: The old qt5-styleplugins do work just need to set the variabled to gtk3 instead of gtk2

Side by side comparison

  • qbittorrent (qt6 app)
Its using qt6, i can confirm
nix why-depends nixpkgs#qbittorrent nixpkgs#qt6.qtbase
/nix/store/i8r2n73xzlxk7sfchjlkdxajs8jbqbv0-qbittorrent-5.2.1
└───/nix/store/wzvm2pvf98a71v0scgfhmi01lqcxahfr-qtbase-6.11.0

f0137705-cf5e-4308-a19d-9858555b8163-image.png

  • picard (qt5 app)
Its using qt5, i can confirm
nix why-depends nixpkgs#picard nixpkgs#qt5.qtbase
/nix/store/wzqlnryvnjl95a93fiwwivlbz3ypixk7-picard-2.13.3
└───/nix/store/64qmp7fap3740hxd2bsnpy10s9ndy5qx-qtbase-5.15.18-bin

aa8041b4-f523-4779-a880-3b3e3d8e37d0-image.png


I can confirm the same behaviour for the other aforementioned apps.

6
 
 

Sorry if this is an ignorant question. I love Nix, but as a user it feels absurd that changing an option from true to false in a home-manager managed config file that then gets transpiled from Nix to TOML, for instance, takes like 10 seconds on a decently modern machine.

In my world that kind of transpilation should be instant. I get that there's more happening behind the scenes than just doing Nix -> TOML, but still. Imagine if the transpilation of config files were instant, so you could have home-manager automagically do the transpilation every time you save the file. That would be awesome, especially for programs that support hot-reloading like Hyprland or Niri.

Is this a Nix issue or a home-manager issue? How much of speedup would it yield to rewrite Nix and/or home-manager in a faster language like Zig or Rust?

7
 
 

"Faust et al." is about to be published as a result of the Akademie AIR residency I did last year at Schmiede.

It's an algorithmic #comic where I drew, by hand, a conversation with a tuned Gemma3 model in Ollama (run locally on my laptop).

Conversation is around power, knowledge, agency and anthropomorphizing A.I.

I used Ollama and @Krita on a @nix machine

https://e.pcloud.link/publink/show?code=XZUxYcZmG8TU5VVQiVJuYnonGYVWuLLv79k

8
 
 

cross-posted from: https://lemy.lol/post/66477718

9
10
 
 

I've been having trouble rebuilding my system for a few days now. The issue seems to be that a commit to nixpkgs-xr/xrizer added an aarch64 patch. There's been a commit that removes this patch but I can't seem to pull it with nix flake update which makes me think my flake might never have been working properly (although I'm getting the home-manager, stylix and unstable packages I've selected). Could someone please review my flake.nix and tell me if I'm doing something wrong?

{
  description = "Core Flake";

  inputs = {
    # Official NixOS Packages v25.11
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11";
    home-manager = {
      url = "github:nix-community/home-manager/release-25.11";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    nixpkgs-xr.url = "github:nix-community/nixpkgs-xr";

    unstable = {
      url = "github:NixOS/nixpkgs/nixos-unstable";
    };

    stylix = {
        url =  "github:nix-community/stylix/release-25.11";
        inputs.nixpkgs.follows = "nixpkgs";
        };
  };

  outputs = inputs@ { nixpkgs, nixpkgs-xr, unstable, home-manager, stylix, ... }: {
    nixosConfigurations.nixos = nixpkgs.lib.nixosSystem {
      modules = [
        # Import my existing configuration.nix
        ./configuration.nix

        nixpkgs-xr.nixosModules.nixpkgs-xr

        home-manager.nixosModules.home-manager
        {
          home-manager.useGlobalPkgs = true;
          home-manager.useUserPackages = true;
          home-manager.users.professor = import ./home.nix;
        }

        stylix.nixosModules.stylix

        {
        nixpkgs.overlays = [
          (final: prev: {
            unstable = import unstable {
                inherit (final) config;
                inherit (final.stdenv.hostPlatform) system;
                };
          })

        ];
        }
      ];
    };
  };
}
11
 
 

With Hyprland moving to Lua, I may make the switch to Lua-based configuration for my Hyprland and Neovim based workflow.

I went with nvf over stock Neovim so that I could handle everything in one language (Nix) as much as possible. I have a few Lua snippets, but that's all.

Now with Hyprland making the switch to Lua as well, I've been considering importing dedicated Lua files into my Nix config.

So, what do you do? Write Nix as much as possible? Use Nix to import your Lua/yaml/etc config? Write other languages as snippets in your .nix files?

12
 
 

I'll start. I just discovered this one. It shows asterisks (*********) while you type your sudo password:

security.sudo.extraConfig = # sh
  ''
    Defaults pwfeedback # Make typed password visible as asterisks
  '';
13
 
 

From my own post: cross-posted from: https://lemmy.world/post/47418159


I've just set up bees on my laptop.

  • It's been running for 40 minutes now
  • I went from 28G to 58G free space on my 2 TB SSD
  • Without deleting anything

I'm genuinely amazed.
Idk why, but I thought this was more of a gimmick for some reason, but nah it works well.

Can highly recommend :3


See https://github.com/Zygo/bees for the project if you wanna learn more.

Here's all I did on my system (NixOS), see !nix@programming.dev

  1. I put this in my NixOS config:
services.beesd.filesystems.root = {
  spec = "UUID=dfabb360-7fde-4b06-a884-03c8d217d877";
  hashTableSizeMB = 8192;
};
  1. I ran this command
cd /etc/nixos && sudo nixos-rebuild switch |& nom
# tho just running sudo nixos-rebuild switch in the correct dir would be sufficient

And it just started giving me more space on my disk :3


PS: it's been 49 minutes now, and I'm at 72G free 🎉
(the CPU has been maxed out the entire time, keep that in mind)

14
 
 

Hey guys, I have a project which I want to cross-compile to windows (because I don't want to install windows on my machine, nor do I plan on developing on windows) and eventually MacOS.

All I really need is to know that it will compile for & run on windows.

This is what I tried, but I'm not sure what the best approach is here. Searching online didn't yield any conclusive results either.

{
  description = "cross-compile dev env";

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
  };

  outputs = { nixpkgs, ... }:
    let
      supportedSystems = ["x86_64-linux"];
      eachSystem = fn: nixpkgs.lib.genAttrs supportedSystems (system:
        fn nixpkgs.legacyPackages.${system}
      );
    in
    {
      #1 this is what I tried at first,
      # but it created conflicts in the environment (obviously)
      devShells = eachSystem (pkgs: {
        default = pkgs.mkShell.override { stdenv = pkgs.gcc15.stdenv; } {
          packages = with pkgs; [
            ...
            pkgsCross.mingwW64.buildPackages.gcc15
          ];
        };
      });

      #2 this is probably a better solution?
      devShells = eachSystem (pkgs: let packages = with pkgs; [
        ...
      ]; in {
        default = pkgs.mkShell.override { stdenv = pkgs.gcc15.stdenv; } {
          inherit packages;
        };

        windows = pkgs.pkgsCross.mingwW64.mkShell { 
          inherit packages;
        };
      });
    };
}

The project is just a C program which compiles using a Makefile. I stripped out dependencies etc. from the flake.

15
 
 

You probably already know that Nix Flakes does not recognize files in your project if you do not track them by Git, and if you do not want to add them directly, you can use the --intent-to-add flag:

git add --intent-to-add <file>

This makes Git track the file, but it is not staged. Example:

$ touch file
$ git add --intent-to-add file
$ git status -s file
 A file

So it will not be part of your next commit, but it will be registered to Flakes.

Recently, I was packaging a few NPM packages for my workflow migration. I ran into an issue with pkgs.buildNpmPackage where this section of the package.json was causing an issue (minimized):

{
  "scripts": {
    "copy-python": "mkdir -p lib/python && cp -r python/* lib/python/",
  }
}

Specifically:

> > mkdir -p lib/python && cp -r python/* lib/python/
>
> cp: cannot stat 'python/*': No such file or directory

This confused me because the python directory clearly existed in the root and was tracked by Git:

$ git ls-files python
python/mcp-bridge

When I inspected the type of directory, I saw that it was a submodule, so I assumed that was related:

$ git submodule status
 97f3c0d411065258679ee8d56f270fc5c7fc1a98 python/mcp-bridge (remotes/origin/feat/mcpm-aider)

I first assumed that it wasn't pulled, so I naturally ran:

$ git submodule update --init --recursive

But that didn't resolve the issue. Turns out that Nix Flakes does not copy submodule directories either, even though they are part of Git.

To fix this, you just have to supply the ?submodules=1 attribute:

$ nix run ".?submodules=1"

Obviously, make sure that you use the quotes because your shell may have issues:

$ nix run .?submodules=1
zsh: no matches found: .?submodules=1

If you use nix-direnv for your projects, you can integrate this into your .envrc:

use flake '.?submodules=1'

Hope this helps other people if they happen to be stuck with a situation like this.

16
 
 

I just updated my nixpkgs input and now thenodejs-20.20.2 package (prolly used by another package and idk why) is flagged as insecure, no big deal i just gotta add it to nixpkgs.config.permittedInsecurePackages, which I do:

  nixpkgs.config.permittedInsecurePackages = [
    "nodejs-20.20.2"
    "electron-38.8.4"
  ];

Execpt that it STILL doesn't rebuild and tells me the same error message as when I didn't have added it to the permitted insecure packages

       error: Refusing to evaluate package 'nodejs-20.20.2' in /nix/store/1hb1glkkpl6vjjpfrwzmvjyvhcyqfxfk-source/pkgs/development/web/nodejs/nodejs.nix:689 because it is marked as insecure

       Known issues:
        - This NodeJS release has reached its end of life. See https://nodejs.org/en/about/releases/.

       You can install it anyway by allowing this package, using the
       following methods:

       a) To temporarily allow all insecure packages, you can use an environment
          variable for a single invocation of the nix tools:

            $ export NIXPKGS_ALLOW_INSECURE=1

          Note: When using `nix shell`, `nix build`, `nix develop`, etc with a flake,
                then pass `--impure` in order to allow use of environment variables.

       b) for `nixos-rebuild` you can add ‘nodejs-20.20.2’ to
          `nixpkgs.config.permittedInsecurePackages` in the configuration.nix,
          like so:

            {
              nixpkgs.config.permittedInsecurePackages = [
                "nodejs-20.20.2"
              ];
            }

       c) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
          ‘nodejs-20.20.2’ to `permittedInsecurePackages` in
          ~/.config/nixpkgs/config.nix, like so:

            {
              permittedInsecurePackages = [
                "nodejs-20.20.2"
              ];
            }

not sure what to do when the option to allow insecure packages does not allow insecure packages, weirdly enough tho it works just fine with

17
 
 

There's a bunch of talks happening at 4:30 but are you wondering what to do after them at 5? Consider checking out one of the open spaces.

Starting at 05:00 PM:

Room 102A: @nix
Room 102C: --dangerously-skip-permissions, Safely
S-3: PyCon Running
S-4: CV/Resume Workshop

#PyConUS #PyConUSOpenSpaces #PyConUS2026

18
 
 

A short-ish post by me on how to use SMB3 (not the plumber game) with NixOS.

19
 
 

I went through an entire experience trying to fix broken/missing icons in gtk apps. I use kde plasma as my DE with breeze and breeze icons.

Adwaita and hicolor and stuff are installed, but apps like ghostty and trayscale were explicitly looking for icons only adwaita provides.

KDE was reporting "hicolor" as the gtk icon no matter what I tried for awhile. Finally fixed it with a three pronged fix. This issue happens on a fresh nixos install installing plasma and gtk and the related icon sets and booting up any gtk apps that use adwaita specific icons (which I believe is any app that uses libadwaita). So this should be helpful.

EDIT

So that broke after a reboot, turns out there was still a race condition with dconf

I've updated the doc, but here's how we fixed the fix

The override service (Layer 3) was silently failing since deployment. gsettings requires compiled GNOME schemas (gschemas.compiled) which NixOS+KDE does not have anywhere in the system path — only Steam runtimes had them. The service exited with No schemas installed and status 1. Icons appeared to work initially because home-manager's dconf.settings wrote the correct value at activation time, and kde-gtk-config hadn't overwritten it yet. After a reboot/relogin cycle, kde-gtk-config would stomp it back to "breeze" and the broken service couldn't fix it. Fix: Replace gsettings with dconf write — dconf operates directly on the database without needing compiled schemas:

ExecStart = "${pkgs.glib}/bin/gsettings set org.gnome.desktop.interface icon-theme Adwaita";

# After (works everywhere):
ExecStart = "${pkgs.dconf}/bin/dconf write /org/gnome/desktop/interface/icon-theme \"'Adwaita'\"";

Note the nested quoting: dconf expects a GVariant string, so the value must be 'Adwaita' (with single quotes inside the double quotes).

Lesson: On NixOS with KDE (no GNOME), never use gsettings in systemd services or scripts. Always use dconf directly. gsettings is a convenience wrapper that requires schema compilation — a GNOME-ecosystem assumption that doesn't hold on KDE-only NixOS.

20
21
 
 

I need to use multiple ? in one of my flake input's url, the issue is only the first ? gets registered but not the second. I've tried github:SteamClientHomebrew/Millennium?tag=latest?dir=packages/nix which returns this:

error:
       … while updating the lock file of flake 'git+file:///home/claymorwan/.dotfiles?dir=NixOS'

       … while updating the flake input 'millennium'

       error: path '«github:SteamClientHomebrew/Millennium/fcb0e5627deecf2fc03067ee3dfb63d37e8e82d4»/flake.nix' does not exist

Then I've tried github:SteamClientHomebrew/Millennium?dir=packages/nix?tag=latest which returns this:

error:
       … while updating the lock file of flake 'git+file:///home/claymorwan/.dotfiles?dir=NixOS'

       … while updating the flake input 'millennium'

       error: path '«github:SteamClientHomebrew/Millennium/fcb0e5627deecf2fc03067ee3dfb63d37e8e82d4»/packages/nix?tag=latest/flake.nix' does not exist

I've also tried to write the input differently like this

millenium = {
  type = "github";
  owner = "SteamClientHomebrew";
  repo = "Millennium";
  tag = "latest";
  dir = "packages/nix";
  inputs.nixpkgs.follows = "nixpkgs";
}

which also didn't work and returns this

error:
       … while evaluating flake input
         at /home/claymorwan/.dotfiles/NixOS/flake.nix:48:5:
           47|
           48|     millennium = {
             |     ^
           49|       type = "github";

       error: input attribute 'tag' not supported by scheme 'github'

So not really sure how to set that up

22
23
 
 

Skills are basically markdown documents providing documentation/instructions for LLMs.

As an example, I would like to have a "Nix/NixOS skill" available to opencode when I'm in my NixOS configuration directory. For example one from agentskills.io . What's the best way to install that with Nix?

There seem to be some non-Nix tools for doing this, like skills.

I did some searching online but I couldn't find a simple solution to this.

24
25
view more: next ›