NixOS is a Nix-based Linux distribution. Thanks to Nix, it supports atomic upgrades, rollbacks and multi-user package management, and it has a declarative approach to system configuration management that makes it easy to reproduce a configuration on another machine.
Questions tagged [nixos]
342 questions
18
votes
2 answers
How to add a file to /etc in NixOS?
What is the NixOS-way to put a configuration file in /etc?
E.g. I want to drop /etc/nanorc. I found some forum entries talking about programming it into /etc/nixos/configuration.nix, but could not find any documentation about that...

Robert Siemer
- 2,081
15
votes
4 answers
In nixos, how to remap caps lock to control?
I followed the instructions at this email thread, and placed
services.xserver.xkbOptions = "grp:alt_space_toggle, ctrl:swapcaps";
in my /etc/nixos/configuration.nix file, but even after rebuilding with $ nixos-rebuild switch, and rebooting with…

mherzl
- 1,509
14
votes
3 answers
In NixOS, how to add a user to the sudoers file?
I installed and am trying to get started with NixOS, and am trying to add my user to the sudoers file.
So that I'm not running all my commands as root I created a user following Chapter 7. User Management of the NixOS manual. That is, I ran
#…

mherzl
- 1,509
8
votes
2 answers
How to rebuild the configuration of a NixOS installation from Live CD?
I installed NixOS 18.03 from Ubuntu on another partition following the NixOS manual's "2.4. Installing from another Linux distribution" section. Everything went fine, but I did a couple idiotic things [?], namely:
Forgot to add the extra GRUB boot…

toraritte
- 1,080
5
votes
1 answer
Configuring programs and services from unstable channel in NixOS
I know that I can install a package from the unstable channel like this:
{ config, pkgs, ... }:
let
unstable-pkgs = import {};
in
{
environment.systemPackages = [ unstable-pkgs.chromium ]
}
This shows that import {};…

Matthew Piziak
- 412
5
votes
1 answer
Clean up package manager cache on nixos with full root partition
On Ubuntu when the root partition gets full you can always run apt-get autoremove, apt-get clean and apt-get autoclean to free up some space for the package manager to continue working. But the equivalent command on nixos seems to have some issues…

Rovanion
- 959
5
votes
2 answers
how to set custom xkb_keymap in nixos
I have following layout layouts/en_ru
xkb_keymap {
xkb_keycodes { include "evdev+aliases(qwerty)" };
xkb_geometry { include "pc(pc104)" };
xkb_types { include "complete" };
xkb_compat { include "complete" };
…

srghma
- 259
5
votes
1 answer
How to invalidate a source archive in the nix store
I ended up with the wrong source for a package in my nix store. This happened a while back so I'm not able to track down the log file to figure out how it happened. Any attempts I make to rebuild the same version of the package result in using the…

Ryne Everett
- 2,383
5
votes
2 answers
How do I make a self-signed certificate persist in nixos?
I have a nix expression that builds a virtualbox vm. As part of that process, I install a self-signed ssl certificate via
certfile = builtins.readFile ./certificate.crt
security.pki.certificates = [ certfile ];
That works fine. The problem is if…

Phil Hollenback
- 157
4
votes
2 answers
How to get /bin/bash on nixos
So I know I can change she-bangs to #!/usr/bin/env bash and I will do that for my scripts, but really I'd like to be able to just run the many many scripts with a #!/bin/bash she-bang. Sometimes it's easy to change, sometimes it isn't, because the…

Julia Path
- 143
4
votes
0 answers
How can I set the swappiness value of the Linux kernel with Nixos?
Following the brief mention of vm.swappiness in https://nixos.org/nixos/manual/options.html:
I've tried setting:
boot.kernel.sysctl = { "vm.swappiness" = 0;};
Within the usual hardware-configuration.nix. And I then did a nixos-rebuild switch and…

Chris Stryczynski
- 5,818
4
votes
1 answer
How to boot to single user mode in nixos
On a nixos installation how does one boot into single user mode?
On a typical linux installation one would set rw init=/sysroot/bin/sh on the bootloader. But nixos being nixos, it has a path that looks like…

Jev Björsell
- 141
4
votes
1 answer
In a new nixos derivation, based on a binary distribution, why am I getting an error referring to nativeBuildInputs?
I'm trying to make a nixos package from a program distributed in binary form only. Like most, links to the standard linker and to libraries don't match a nixos system, so I'm trying to create a new derivation that uses patchelf to update those link.…
4
votes
2 answers
NixOS: How do I change my group and clean up the bad configurations?
This is my current users expression
users.users = {
john = {
name = "john";
group = "users";
extraGroups = [
"wheel" "disk" "audio" "video" "networkmanager" "systemd-journal"
];
isNormalUser =…

John Mercier
- 268
3
votes
1 answer
Nixos X11 header files not found
When trying to build suckless/surf and suckless/st from source on NixOs, make cannot find X11 header files, e.g. X11/X.h and X11/Xatom.h. I do have Xlib installed. I also vaguely remember nixos put libraries in an interesting place, and I have seen…

rem
- 185