Questions tagged [nix]

Questions about Nix, the purely functional package manager and its usage and configuration.

Filter by
Sorted by
Tagged with
0 votes
0 answers
29 views

Automatically execute `nix-user-chroot` when I start a terminal session (Steam Deck)

I am running Arch Linux on the Steam Deck. Steam Deck has a read only root file system which forces you to use Flatpak, or else to make the file system writable at the expense of wiping out, say, ...
user avatar
2 votes
1 answer
102 views

Which parameters does configuration.nix take?

My /etc/nixos/configuration.nix starts with { config, lib, modulesPath, pkgs, ... }:, because that's what was in whichever example I copied. A quick search through the NixOS manual, man nixos-generate-...
user avatar
  • 46.9k
0 votes
1 answer
121 views

How to keep PS1 when using nix-shell?

nix-shell changes PS1 to its own format. [nix-shell:~/snm]$ I tried adding check for "$IN_NIX_SHELL" inside ~/.bashrc, but it didn't work. The only work around I found is to run nix-shell ...
user avatar
  • 330
1 vote
0 answers
24 views

How to avoid infinite recursion when referring to `config.users.users.default.home` in `fileSystems`?

I have a LUKS-with-LVM drive which I want to manually mount like this: Log into GNOME Start Nautilus Click on the relevant drive Submit the password To do this I've had to change the default mount ...
user avatar
  • 46.9k
1 vote
1 answer
118 views

nix-shell equivalent of `make -C DIR`?

Is there a nix-shell equivalent to make -C DIR? Back before I had a Nix shell I used to run sudo make -C ~/dev/root install to configure my system, and with Nix shell I can't find any simpler way than ...
user avatar
  • 46.9k
0 votes
1 answer
47 views

How to temporarily disable auto-upgrade without a Nix rebuild?

While on a metered connection it would be really handy to be able to disable system.autoUpgrade without having to rebuild the entire system and use up several GB/days/$$$ worth of credit. Is this ...
user avatar
  • 46.9k
1 vote
2 answers
240 views

How to get the size of a Nix derivation?

Is it possible to figure out the size of a derivation after building it? For example, after nixos-rebuild, how much space does the new derivation take, excluding any storage savings because of ...
user avatar
  • 46.9k
0 votes
1 answer
144 views

Nix takes forever to copy file from cache

Last night I spent a long time trying to fix my nixos configuration and failed. So today I resumed work with the existing generation, but it seems something I did has broken my nix. Now when I run ...
user avatar
6 votes
2 answers
443 views

Which nix-package provides a given file/binary/command?

How can I figure out which nixpgs-package provides a given file/command, that may not be installed on the system? Other package managers offer this functionality as follows: apt has apt-file rpm has -...
user avatar
1 vote
1 answer
125 views

How to list package dependents on Nix?

I get this error: Package ‘python2.7-Pillow-6.2.2’ in /nix/store/...-nixos-21.05.1590.63ee5cd99a2/nixos/pkgs/development/python-modules/pillow/6.nix:19 is marked as insecure, refusing to evaluate. ...
user avatar
  • 330
0 votes
0 answers
223 views

How to `pyenv install` in NixOS?

The original problem: $ pyenv install Downloading Python-3.8.10.tar.xz... -> https://www.python.org/ftp/python/3.8.10/Python-3.8.10.tar.xz Installing Python-3.8.10... BUILD FAILED (NixOS 21.05....
user avatar
  • 46.9k
0 votes
0 answers
113 views

GPG card is only available for the currently logged in user

I'm currently trying to use my YubiKey 5 NFC as a smartcard with GPG Agent on NixOS. It works fine and if I'm logged in i can access the card: $ gpg --card-status Reader ...........: 1050:0407:X:0 ...
user avatar
0 votes
1 answer
156 views

How to use official Nix Docker image to test configuration?

I'm trying to build my Nix configuration in GitLab CI, to make sure any changes have at least a chance of working in NixOS. The official Nix Docker image has a very different structure from NixOS (...
user avatar
  • 46.9k
1 vote
1 answer
116 views

Reset NixOS container

Nixos containers can be created declaring them in the configuration.nix. Is there way to 'reset' them, hence delete all data, and recreate the container?
user avatar
1 vote
1 answer
255 views

How do I install a tarball with home-manager?

I’m really new to nix so a detailed explanation of the solution would be appreciated. I’m trying to add rnix-lsp to my home config. The instructions on the github page simply state to run a nix-env ...
user avatar
1 vote
1 answer
132 views

How to invoke `nix-shell` with the contents of an URL (e.g., a raw GitHub link)?

Saving it to file, and using that temporary file works fine, $ url="https://raw.githubusercontent.com/toraritte/shell.nixes/main/deno-latest-shell.nix" $ curl $url > default.nix $ nix-...
user avatar
  • 685
2 votes
2 answers
90 views

How do I determine which commit a channel references with Nixos?

I'd like to figure out the commit and date that a channel references. For example how can determine that for the nixos2009 channel below? sudo nix-channel --list nixos https://nixos.org/channels/nixos-...
user avatar
0 votes
1 answer
101 views

Unable to use -lfl on NixOS

I'm new to NixOS and I'm trying to build a project which uses Flex. I get the following error if I try and build the project /nix/store/b10shv9yqbgps47y0n8x7l7bq8fmp1i6-binutils-2.31.1/bin/ld: cannot ...
user avatar
  • 111
1 vote
1 answer
195 views

Execute bash inside subshells

Say I have a command that puts me into a subshell (e.g. nix-shell). If I have a bash script that goes enter-subshell echo hi the echo hi will wait to be executed until I exit the subshell. Is there ...
user avatar
  • 439
0 votes
1 answer
935 views

Wireguard client does not complete handshake on nixos

Mar 07 12:10:16 nixos kernel: wireguard: wg0: Handshake for peer 1 (192.248.152.91:58338) did not complete after 5 seconds, retrying (try 3) Mar 07 12:10:16 nixos kernel: wireguard: wg0: Sending ...
user avatar
1 vote
1 answer
218 views

What is Nix equivalent of "guix challenge"?

In Guix user can verify reproducibility of a package with guix challenge https://guix.gnu.org/manual/en/html_node/Invoking-guix-challenge.html. What is the Nix command for that?
user avatar
  • 330
1 vote
1 answer
1k views

How to force Nix to “install packages” by building them locally instead of downloading a pre-built binary?

By "install packages" I mean to evaluate Nix build expressions (using nix-env, nix-shell -p, etc.) to build from source instead of using a substitute. Originally posted on Stackoverflow but [...
user avatar
  • 685
0 votes
1 answer
174 views

NixOs Attribute Error with unstable package on stable release

I’m trying to install material shell which is only in unstable right now. I’m using the guide from the wiki to install a package from unstable along with this post on adding unstable without using a ...
user avatar
  • 101
0 votes
1 answer
219 views

List all gc-roots that reference Nix package

I'm trying to remove package X entirely from my /nix/store/, but nix-garbage-collect wont remove it as its probably referenced by some garbage collection root (gc-root) somewhere. Is it possible to ...
user avatar
  • 681
1 vote
0 answers
25 views

Nix -- how to use addAutoPatchelfSearchPath correctly?

I'm packaging a tool that includes some shared objects natively, and I think the right approach to add those objects to the rpath is to use the addAutoPatchelfSearchPath function to the installPhase ...
user avatar
0 votes
0 answers
38 views

How to register nix package after building?

I know that a nix package from repository can be installed via: nix-env -i package-name After that command executable file is on the path and it everything fine. On project page I spot that a nix ...
user avatar
3 votes
1 answer
1k views

Grow a Nix-based system from scratch?

Is it possible to grow a Nix (the package manager, not nixos the distro) based linux system from scratch? More specifically: AFAIK Nix provides infrastructural packages like glibc, gcc, linux kernel, ...
user avatar
  • 131
1 vote
0 answers
852 views

Help debugging sshfs error: "fusermount3: mount failed: Operation not permitted"

I have spent a considerable amount of time trying to debug where the issue lies but am unable to find a fix. I am working on a 32bit CentOS system and have installed sshfs and fuse via nix. When I ...
user avatar
  • 33
0 votes
0 answers
735 views

Building docker image with Nix dockerTools.buildImage - no internet access in build script?

I'm trying to build a simple docker image as mentioned here http://lethalman.blogspot.com/2016/04/cheap-docker-images-with-nix_15.html, but it seems there is no network/internet access in the build ...
user avatar
0 votes
1 answer
139 views

Nix config to configure qemu vm to mount direct partition

I'd like to do what is mentioned here: https://wiki.archlinux.org/index.php/QEMU#Mounting_a_partition_of_the_guest_on_the_host - essentially mount a partition directly on the VM - this is so I can use ...
user avatar
1 vote
1 answer
121 views

How to use specific verion of nixpkgs (on macOS)?

How can I point my nix installation (on macOS) to a specific version of nixpkgs? I'm trying to ensure that my home and office computers always use the same versions of all packages.
user avatar
  • 111
4 votes
1 answer
2k views

How to add home-manager to my configuration.nix?

I want to add the home-manager channel to my configuration.nix, then install home-manager I don't have experience with NixOS. A simple code snippet is much appreciated, if possible.
user avatar
2 votes
1 answer
861 views

How to use Firefox Policies in NixOs / How to add config files to a Nix package?

I need to deploy my Firefox configured and with extensions in NixOS. I want to do that declaratively (in configuration.nix) and I do not want to use home-manager. Via user profile: Configuring ...
user avatar
  • 153
0 votes
1 answer
264 views

Nixos where is the path to my generation / system configuration derivation?

I'd like to get the root path to the generation / system configuration derivation. Is this path stored somewhere perhaps? My understanding is that there is a 'derivation' made for your system ...
user avatar
1 vote
0 answers
21 views

Why does `nix-store -q --tree` show autodependencies?

I'm trying to better understand nix, so I'm working through this nix pill. nix-store -q --tree does show dependencies as a tree, but for each dependency A it always says A depends on A: ➤ nix-store -...
user avatar
  • 1,491
4 votes
1 answer
582 views

How can I determine the package version that is cached in Hydra for Nix nixpkgs?

I was trying to build an old Haskell project with an older nixpkgs channel/branch (18.03). On my first attempt of building it, I specified the compiler version as ghc843... However when building - it ...
user avatar
0 votes
0 answers
558 views

Nixos VM no IPv4 address assigned via dhcpcd

I'm using a vm setup with the following options: qemu.networkingOptions = [ "-device e1000,netdev=abc,mac=52:55:00:d1:55:02" "-netdev ...
user avatar
2 votes
2 answers
947 views

How to rollback a channel to a previous Nixos generation?

$ sudo nix-env --list-generations --profile /nix/var/nix/profiles/system ... 600 2020-01-25 21:01:11 601 2020-02-03 13:44:19 602 2020-02-09 14:06:20 603 2020-02-09 14:11:11 ...
user avatar
0 votes
2 answers
957 views

Setup network between VMs using tap network with Nix?

I'm trying to have a network shared between multiple VMs. I've tried adding: qemu.networkingOptions = [ "-nic user,model=virtio-net-pci" ...
user avatar
0 votes
0 answers
105 views

Where to put mutable data (logging, data)

New Nix user here. I'm trying to create a derivation for Blazegraph from the tgz release available here. Inside it are multiple folders such as bin/, conf/, data/, lib/, log/, pid/ and war/. The ...
user avatar
  • 101
2 votes
0 answers
225 views

How can I ignore binary caches when running nix-channel commands?

Quite often, I'm away from home where I have a binary cache set for 192.168.0.6 and I run into errors like so: sudo nix-channel --update unpacking channels... warning: unable to download 'http://192....
user avatar
1 vote
1 answer
232 views

How can I list all nix store paths referenced in a build generation?

I'm trying to debug an issue where a nixos configuration on one machine, has the an application accessible in the path (it's listed in /run/current-system/sw/bin), while on another machine with the ...
user avatar
0 votes
1 answer
154 views

Empty string syntax inside vimrc defined via nix home-manager

I want to use home-manager to declare my vim configuration inside a nix-expression with the extraConfig option. I'm trying to run the example .vimrc configuration from coc.nvim and one line reads: ...
user avatar
  • 3
2 votes
1 answer
2k views

How to clone a private git repository in a nix derivation

{ nixpkgs ? import <nixpkgs> {} }:nixpkgs.pkgs.fetchgitPrivate { url = "ssh://git@gitlab.com/trycatchchris/blog.git"; rev = "0f5fe7ebf0724eb17aea4141e0cf3f1758a6d716"; ...
user avatar
0 votes
1 answer
125 views

Nixos configuration use pinned nixpkgs for specific package

So my nixos-rebuild fails to build due to the recent error of: https://github.com/NixOS/nixpkgs/issues/74916 I thought I'd give a go at trying to fix this, by referencing a previous commit's package ...
user avatar
1 vote
1 answer
459 views

In Nix, how can I build a package that has a Python post-install script?

I'm trying to make a Nix derivation for Foliate, and this is my first real derivation, so I don't really know what I'm doing yet. Here's what I have so far. It builds and installs, but fails with ...
user avatar
  • 1,110
0 votes
1 answer
104 views

Setting up Kubespray python project on Nixos

nix-shell -p libffi openssl python37Packages.virtualenv python37Packages.virtualenvwrapper python37Packages.pip python37Packages.setuptools ... Collecting certifi>=2017.4.17 (from requests>=2.21....
user avatar
1 vote
1 answer
176 views

How to refer to another user's properties in Nix expression?

I want to set root's startGid and startUid to the GID and UID of another user. How can I do that without hardcoding them? I've tried several variations on the following: users.users = { root = {...
user avatar
  • 46.9k
5 votes
1 answer
455 views

Debugging why nix is building a package unnecessarily when it should be in nixpkgs binary cache?

I asked this question in the IRC channel, but thought I'd document it here for my own as well as other's reference. I have a shell.nix file that is taking a long time to build, in particular it seems ...
user avatar
5 votes
1 answer
576 views

Nixos how can I search for packages in a specific channel?

nix-env -v -qaP '*' currently returns all the packages available from all my channels. How can I specify to return packages from a specific channel for example unstable / 18.03?
user avatar