Sample Header Ad - 728x90

Unix & Linux Stack Exchange

Q&A for users of Linux, FreeBSD and other Unix-like operating systems

Latest Questions

6 votes
1 answers
5022 views
How to disable root password in NixOS?
I tried setting `users.users.root.hashedPassword = "*";` similar to `sudo passwd -d root` or user { 'root': password => '*', require => Package[ruby-shadow], } in [Puppet][1], but after `sudo nixos-rebuild switch` I'm still able to `su -` with the old password. [1]: https://gitlab.com/victor-engmark...
I tried setting users.users.root.hashedPassword = "*"; similar to sudo passwd -d root or user { 'root': password => '*', require => Package[ruby-shadow], } in Puppet , but after sudo nixos-rebuild switch I'm still able to su - with the old password.
l0b0 (53368 rep)
Jul 23, 2019, 10:09 AM • Last activity: Jul 30, 2025, 07:04 PM
4 votes
2 answers
3231 views
Is there a faster alternative than `nixos-rebuild switch` when updating services?
Often I'm configuring a new service and having to run `nixos-rebuild switch` for the changes to take effect. For example setting up a configuration for a webserver. However the `nixos-rebuild switch` takes quite a few seconds to run. Is there a quicker alternative to rebuild just a subset of my Nixo...
Often I'm configuring a new service and having to run nixos-rebuild switch for the changes to take effect. For example setting up a configuration for a webserver. However the nixos-rebuild switch takes quite a few seconds to run. Is there a quicker alternative to rebuild just a subset of my Nixos configuration? I did notice a --fast parameter - however this does not seem to make much of any difference.
Chris Stryczynski (6603 rep)
Feb 16, 2019, 11:32 AM • Last activity: Jul 24, 2025, 07:07 PM
0 votes
1 answers
2047 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 handshake initiation to peer 1 (192.248.152.91:58338) This seems to work correctly if I set allowed IPs t...
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 handshake initiation to peer 1 (192.248.152.91:58338) This seems to work correctly if I set allowed IPs to something other than 0.0.0.0 - my understanding is it will only send connections to these ips via the wireguard VPN.
networking.firewall = {
      enable = false;
    };

  # Enable Wireguard
  networking.wireguard.interfaces = {
    wg0 = {
      ips = [ "10.66.66.2/32" ];
      listenPort = 58338; # to match firewall allowedUDPPorts (without this wg uses random port numbers)
      privateKey= "************************";

      peers = [

        {
          publicKey = "***************";
          presharedKey = "*****************";

          allowedIPs = [ "0.0.0.0/0" ];
          #allowedIPs = [ "10.66.66.1" "94.130.178.87" ];

          endpoint = "192.248.152.91:58338"; # ToDo: route to endpoint not automatically configured https://wiki.archlinux.org/index.php/WireGuard#Loop_routing  https://discourse.nixos.org/t/solved-minimal-firewall-setup-for-wireguard-client/7577 

          # Send keepalives every 25 seconds. Important to keep NAT tables alive.
          persistentKeepalive = 25;
        }
      ];
    };
  };
I've read through https://discourse.nixos.org/t/solved-minimal-firewall-setup-for-wireguard-client/7577/4 however even after adding an ip route with ip route add 192.248.152.91 via 10.66.66.1 dev wg0 it does not seem to have any change in behaviour.
root@nixos> ip route                                                                                                ~
default dev wg0 scope link 
default via 10.0.2.2 dev eth0 proto dhcp src 10.0.2.15 metric 202 
10.0.2.0/24 dev eth0 proto dhcp scope link src 10.0.2.15 metric 202 
192.248.152.91 via 10.66.66.1 dev wg0
Chris Stryczynski (6603 rep)
Mar 7, 2021, 12:14 PM • Last activity: Jul 15, 2025, 01:00 PM
30 votes
3 answers
20145 views
How do I modify my hosts file in Nixos?
Seems my hosts file (`/etc/hosts`) points to `/nix/store/gds7bha3bx0a22pnzw93pgf0666anpyr-etc-hosts` and is read only. How am I meant to modify this file?
Seems my hosts file (/etc/hosts) points to /nix/store/gds7bha3bx0a22pnzw93pgf0666anpyr-etc-hosts and is read only. How am I meant to modify this file?
Chris Stryczynski (6603 rep)
Dec 17, 2018, 03:32 PM • Last activity: Jun 19, 2025, 10:36 PM
1 votes
4 answers
4603 views
How to install and run docker with nix
I'm using Debian on WSL. Nix is already install. I install docker with this command: nix-env -iA nixpkgs.docker I want to start the daemon : systemctl start docker > Failed to connect to bus: No such file or directory **update** FYI $XDG_RUNTIME_DIR= /mnt/wslg/runtime-dir $UID=1000 $DBUS_SESSION_BUS...
I'm using Debian on WSL. Nix is already install. I install docker with this command: nix-env -iA nixpkgs.docker I want to start the daemon : systemctl start docker > Failed to connect to bus: No such file or directory **update** FYI $XDG_RUNTIME_DIR= /mnt/wslg/runtime-dir $UID=1000 $DBUS_SESSION_BUS_ADDRESS has no value ls -l /mnt/wslg/runtime-dir >drwx------ 4 pierre pierre 120 Dec 26 00:41 runtime-dir I can access the bus. But I need to use sudo sudo systemctl start docker Now I have this problem > Failed to start docker.service: Unit docker.service not found. I think docker.service is this file: /etc/systemd/system/docker.service But it doesn't exist on my OS. I'Ve tried to uninstall and reinstall docker with nix. To no avails I think that it is linked: https://discourse.nixos.org/t/docker-packages-systemd-unit-files-dont-work-on-ubuntu/12160 sudo cp ~/.nix-profile/etc/systemd/system/docker.service /etc/systemd/system/docker.service sudo cp ~/.nix-profile/etc/systemd/system/docker.sock /var/run/docker.sock sudo systemctl enable docker Failed to start docker.service: Unit docker.socket not found. >Failed to start docker.service: Unit docker.socket not found. After reading this link , I use this command in order to the know where I should replace docker.socket file. : systemctl list-sockets --all But no docker.socket is listed **update I have made all the commands from scratch. Now I have this problem A dependency job for docker.service failed. See 'journalctl -xe' for details.
Pierre-olivier Gendraud (109 rep)
Dec 26, 2022, 08:05 AM • Last activity: Jun 3, 2025, 10:10 PM
0 votes
1 answers
40 views
How to set package cofigurations in nix packge without nixos
I have installed a Nix package on my ubuntu os, that depends on `doas`, and for it to function, it's binary need's to have the suid bit set - and it isn't in the default `nix-env` installation. On NixOS you can enable a suid wrapper for doas ([nixos wiki][1]), but that has to be put into `/etc/nixos...
I have installed a Nix package on my ubuntu os, that depends on doas, and for it to function, it's binary need's to have the suid bit set - and it isn't in the default nix-env installation. On NixOS you can enable a suid wrapper for doas (nixos wiki ), but that has to be put into /etc/nixos/configuration.nix, which doesn't exist out of NixOS. Does anyone know how to set that configuration value or get doas to function in a different way
Stas Badzi (103 rep)
May 6, 2025, 09:30 PM • Last activity: May 8, 2025, 05:28 PM
0 votes
0 answers
19 views
weird background when neovim plugins create panels
I'm not 100% sure how to describe the problem, but there's this background color applied to the editor whenever Telescope, NerdTree, or CtrlP display. Incase it wasn't obvious [nixos is configuring neovim](https://github.com/danhab99/dotfiles/tree/448a482f06431d28f778750f86e16692451c5d7d/modules/neo...
I'm not 100% sure how to describe the problem, but there's this background color applied to the editor whenever Telescope, NerdTree, or CtrlP display. Incase it wasn't obvious [nixos is configuring neovim](https://github.com/danhab99/dotfiles/tree/448a482f06431d28f778750f86e16692451c5d7d/modules/neovim) . How do I remove this background? > *Telescope* telescope > *NerdTree* nerdtree > *Ctrl+P* ctrlp
Dan (111 rep)
Apr 11, 2025, 03:16 AM
0 votes
1 answers
52 views
nix builds wrong package
Using `nix build` with the flake.nix below, the build should fail since the references github repository does not exist. Yet, whenever I build the flake, while it shows `ecsdsddsdse.fghfghfghfghgfh` as the package, it just builds paho-mqtt (that was referenced there a while ago). Apparently, my nix...
Using nix build with the flake.nix below, the build should fail since the references github repository does not exist. Yet, whenever I build the flake, while it shows ecsdsddsdse.fghfghfghfghgfh as the package, it just builds paho-mqtt (that was referenced there a while ago). Apparently, my nix installation somehow remembers the repository referenced a while ago (paho-mqtt) and always fetches that, regardless of what I actually write as owner and repo. I have already removed /nix and reinstalled without any results. Does anyone have an idea why it fetches the wrong repo?
{
  description = "Nix flake for packaging modpoll (a Poetry application) from GitHub";

  inputs = {
    nixpkgs.url = "nixpkgs/nixos-unstable";  # Latest Nixpkgs
    utils.url = "github:numtide/flake-utils";
  };

  outputs = { self, nixpkgs, utils, poetry2nix }:
    let
      system = "x86_64-linux";
      pkgs = import nixpkgs {
        inherit system;
      };

      pname = "modpoll";
      version = "1.2.0";

      updatedPahoMqtt = pkgs.python3Packages.buildPythonPackage rec {
        pname = "dsfsdfsdf";
        version = "fghfghfghfghgfh";
        format = "setuptools";

        src = pkgs.fetchFromGitHub {
          owner = "ecsdsddsdse";
          repo = "pdsfsdfsdfh";
          rev = "sdfsdfsdf";
          hash = "sha256-9nH6xROVpmI+iTKXfwv2Ar1PAmWbEunI3HO0pZyK6Rh";
        };
      };

      app = pkgs.python3Packages.buildPythonPackage rec {
        inherit version pname;
        pyproject = true;

        dependencies = [
          updatedPahoMqtt
          pkgs.python3Packages.poetry-core
        ];

        src = pkgs.fetchPypi rec {
          inherit pname version;
          sha256 = "sha256-t69tvHqQNeNs3iErcq49Rcq2LtCiQkmNiVxhGZtMaF8=";
        };
      };
    in
      {
        packages.x86_64-linux.default = app;
      };
}
Daniel D. (65 rep)
Sep 3, 2024, 11:11 AM • Last activity: Apr 9, 2025, 05:33 PM
1 votes
1 answers
1968 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 any way to write a script that behaves the same as manually typing out both lines in order...
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 any way to write a script that behaves the same as manually typing out both lines in order? In other words, subsequent commands get executed in the newly invoked shell? Edit: it seems what I'm looking to do doesn't have a general solution.
Mason (519 rep)
Mar 10, 2021, 02:36 AM • Last activity: Mar 26, 2025, 03:04 AM
2 votes
1 answers
1539 views
How to get the path of installed package in the nix store?
My package is installed with a `configuration.nix` ```nix { config, pkgs, lib, ... }: { environment.systemPackages = with pkgs; [ my-package ]; } ``` **How can I query for the path of `my-package` in the nix store?** I am looking for something as simple as `which my_executable`, but for packages in...
My package is installed with a configuration.nix
{ config, pkgs, lib, ... }:
{
  environment.systemPackages = with pkgs; [
    my-package
  ];
}
**How can I query for the path of my-package in the nix store?** I am looking for something as simple as which my_executable, but for packages in the nix store. Example usage
$ my_search my-package [--store /path/to/nix/store]
/path/to/nix/store/qpmg2piws75wmy1619ryh0dhwi9638ni-my_package-1.5.6
Notes: - It has to give me the path for the generation and/or derivation currently in use - It shouldn't have to require an internet connection, nor should it try to build anything. my_package might require agreement to specific licenses and needs to allow unfree packages that can get in the way of re-building. Example: the package segger-jlink-headless - If the package was installed by root (for example on NixOS), can I have a command that doesn't require root privileges? I can always provide the path /nix/store/ if needed. - which my_package_executable does not work if a package does not contain an executable in the PATH. Other References: https://unix.stackexchange.com/questions/414287/how-to-find-the-correct-version-of-an-installed-package-in-nix-store https://nixos.wiki/wiki/Cheatsheet Discourse answer seems out of date (not working for me): https://discourse.nixos.org/t/how-to-get-a-package-path-in-nix-store-which-not-containing-a-bin-dir/4653/5 : In my case, nix eval errors out when provided with the package I installed (see installation step above)
$ nix eval nixpkgs.my-package.outPath
error: getting status of '/home//nixpkgs.my-package.outPath': No such file or directory
AlexLoss (183 rep)
Feb 12, 2025, 09:11 AM • Last activity: Feb 12, 2025, 06:28 PM
0 votes
1 answers
800 views
Configure vscode in Nixos
My Nixos uses tmpfs as the root filesystem, and I want to configure VSCode in Home Manager. I want to ask you, which files or folders should VSCode persist? vscode.nix: ``` { pkgs , ... } @ args: { programs.vscode = { enable = true; package = pkgs.vscode; userSettings = { ##### VsCode Settings #####...
My Nixos uses tmpfs as the root filesystem, and I want to configure VSCode in Home Manager. I want to ask you, which files or folders should VSCode persist? vscode.nix:
{ pkgs
, ...
} @ args:

{
  programs.vscode = {
    enable = true;
    package = pkgs.vscode;
    userSettings = {
    
      ##### VsCode Settings #####
      ## Commonly Used
      "files.autoSave" = "onFocusChange";
      "editor.fontSize" = 14;
      "editor.fontFamily" = "'Droid Sans Mono', 'monospace', monospace";
      "editor.tabSize" = 4;
      "editor.renderWhitespace" = "selection";
      "editor.cursorStyle" = "line";
      "editor.multiCursorModifier" = "alt";
      "editor.insertSpaces" = true;
      "editor.wordWrap" = "off";
      "files.exclude" = {
        "**/.git" = true;
        "**/.svn" = true;
        "**/.hg" = true;
        "**/CVS" = true;
        "**/.DS_Store" = true;
        "**/Thumbs.db" = true;
      };
      "files.associations" = { };
      "workbench.editor.enablePreview" = true;

      ## Text Editor


      ## WorkBench
      "workbench.colorTheme" = "Default Dark+";
      "workbench.startupEditor" = "none";

      ## Window
      "window.autoDetectColorScheme" = false;

      ## Features
      #### Explorer
      "explorer.confirmDelete" = false;
      "explorer.confirmDragAndDrop" = false;
      "explorer.enableDragAndDrop" = false;

      ## Application
      #### Update
      "update.mode" = "none";
      "update.showReleaseNotes" = false;

      ## Security
      #### Workspace
      "security.workspace.trust.enabled" = false;
      "security.workspace.trust.startupPrompt" = "never";
      "security.workspace.trust.emptyWindow" = false;
      "security.workspace.trust.untrustedFiles" = "open";
      "security.workspace.trust.banner" = "never";

      ## Extensions
      #### Copilot
      "github.copilot.advanced" = { };
      "github.copilot.editor.enableAutoCompletions" = true;
      "github.copilot.enable" = {
        "*" = true;
        "plaintext" = false;
        "markdown" = false;
        "scminput" = false;
        "yaml" = false;
        "python" = true;
        "javascript" = true;
      };
      #### NixIDE
      "nix.enableLanguageServer" = true;
      "nix.formatterPath" = "nixpkgs-fmt";
      "nix.serverPath" = "nixd";
      "nix.serverSettings" = {
        "nixd" = {
          "eval" = { };
          "formatting" = {
            "command" = "nixpkgs-fmt";
          };
          "options" = {
            "enable" = true;
            "target" = {
              "args" = [ ];
              ## NixOS options
              # "installable" = "#nixosConfigurations..options";
              ## Flake-parts options
              # "installable" = "#debug.options";
              ## Home-manager options
              # "installable" = "#homeConfigurations..options";
            };
          };
        };
      };

    };
    extensions = with pkgs.vscode-extensions; [
      # Github Copilot
      github.copilot
      # Nix Language
      jnoortheen.nix-ide
    ];
  };

  home.packages = with pkgs;[
    # Nix Language
    nixd
    nixpkgs-fmt
  ];

  # Impermanence Persistent For VsCode
  home.persistence."/nix/persistent${config.home.homeDirectory}" = {
    directories = [
      ".config/Code/User"
    ];
    files = [

    ];
    allowOther = false;
    removePrefixDirectory = false;
  };

}
Regarding the files where the login status of the plugin is saved, such as github.copilot, the current configuration will be invalid after I restart, and I need to log in again. What do I need to do? How to maintain these states?
Xiaoer (1 rep)
Feb 6, 2024, 05:45 PM • Last activity: Jan 7, 2025, 10:31 AM
1 votes
1 answers
221 views
Changing the GNUPG home directory on NixOS
I'm setting up NixOS 24.05 and I'm using the equivalent version of [Home Manager](https://github.com/nix-community/home-manager/). I'm trying to move the directory for GNUPG to `$HOME/.local/share/gnupg` also known as `$XDG_DATA_HOME/gnupg`. I know that `XDG_DATA_HOME` is set correctly prior to maki...
I'm setting up NixOS 24.05 and I'm using the equivalent version of [Home Manager](https://github.com/nix-community/home-manager/) . I'm trying to move the directory for GNUPG to $HOME/.local/share/gnupg also known as $XDG_DATA_HOME/gnupg. I know that XDG_DATA_HOME is set correctly prior to making this question. Running gpgconf --list-dirs gives me the following output:
sysconfdir:/etc/gnupg
bindir:/nix/store/wfwk6kv1mp5v94dly55c3ql1rwsqrky0-gnupg-2.4.5/bin
libexecdir:/nix/store/wfwk6kv1mp5v94dly55c3ql1rwsqrky0-gnupg-2.4.5/libexec
libdir:/nix/store/wfwk6kv1mp5v94dly55c3ql1rwsqrky0-gnupg-2.4.5/lib/gnupg
datadir:/nix/store/wfwk6kv1mp5v94dly55c3ql1rwsqrky0-gnupg-2.4.5/share/gnupg
localedir:/nix/store/wfwk6kv1mp5v94dly55c3ql1rwsqrky0-gnupg-2.4.5/share/locale
socketdir:/run/user/1000/gnupg
dirmngr-socket:/run/user/1000/gnupg/S.dirmngr
keyboxd-socket:/run/user/1000/gnupg/S.keyboxd
agent-ssh-socket:/run/user/1000/gnupg/S.gpg-agent.ssh
agent-extra-socket:/run/user/1000/gnupg/S.gpg-agent.extra
agent-browser-socket:/run/user/1000/gnupg/S.gpg-agent.browser
agent-socket:/run/user/1000/gnupg/S.gpg-agent
homedir:/home/hanna/.gnupg
Upon setting the GNUPGHOME environment variable or using Home Manager's programs.gpg.homedir option, neither of these resulted in the homedir setting changing in gpgconf and thus the directory always being created at that path. It does not seem to be respecting any settings I am setting to change this, and I'm hoping someone can help with this.
Hanna (11 rep)
Aug 28, 2024, 07:52 PM • Last activity: Dec 11, 2024, 08:26 AM
0 votes
1 answers
205 views
How to specify `--ignore-environment` for `nix develop` by configuration?
Is there a way to always invoke the command-line option: `--ignore-environment` for the `nix develop` command, by configuration in some config file? The value of this would be to ensure that a Nix Flake project will always invoke a pure Nix development shell on anyone's machine, since it would be in...
Is there a way to always invoke the command-line option: --ignore-environment for the nix develop command, by configuration in some config file? The value of this would be to ensure that a Nix Flake project will always invoke a pure Nix development shell on anyone's machine, since it would be in version control, avoiding the developer forgetting to invoke the command line option manually.
Neil (3530 rep)
Oct 7, 2024, 09:38 AM • Last activity: Oct 8, 2024, 07:22 AM
4 votes
4 answers
22740 views
How to install Python pip on Nixos?
I can't seem to find the appropriate package that install's `pip` on Nixos?
I can't seem to find the appropriate package that install's pip on Nixos?
Chris Stryczynski (6603 rep)
May 15, 2019, 03:43 PM • Last activity: Sep 1, 2024, 10:10 AM
29 votes
7 answers
25762 views
How to find the name of a Nix package to install it in configuration.nix?
Suppose I search for a package to install using [`nix-env`](https://nixos.org/nix/manual/#sec-nix-env)'s [`--query`](https://nixos.org/nix/manual/#idm46912466717184) operation: $ nix-env -qa 'aspell.*en' aspell-dict-en-7.1-0 I write this package name in `/etc/nixos/configuration.nix`, NixOS's main [...
Suppose I search for a package to install using [nix-env](https://nixos.org/nix/manual/#sec-nix-env) 's [--query](https://nixos.org/nix/manual/#idm46912466717184) operation: $ nix-env -qa 'aspell.*en' aspell-dict-en-7.1-0 I write this package name in /etc/nixos/configuration.nix, NixOS's main [configuration file](http://nixos.org/nixos/manual/index.html#ch-configuration) : environment.systemPackages = with pkgs; [ aspell-dict-en ]; Yet if I run sudo nixos-rebuild switch, NixOS command to [update the configuration](http://nixos.org/nixos/manual/index.html#sec-changing-config) and install all system-wide packages specified by [declaratively](http://nixos.org/nixos/manual/index.html#sec-declarative-package-mgmt) , it aborts with an error: error: undefined variable ‘aspell-dict-en’ at /etc/nixos/configuration.nix:44:5 I know that for many packages, although not all, the name that nix-env returns and the name one should specify in environment.systemPackages configuration option are different, but I don't understand the logic. How do I install a package that I found through nix-env?
Mirzhan Irkegulov (8768 rep)
Dec 18, 2015, 05:37 PM • Last activity: Aug 11, 2024, 05:32 PM
3 votes
4 answers
650 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-20.09 nixos-2003 https://nixos.org/channels/nixos-20.03 nixos2003 https://nixos.org/chann...
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-20.09 
nixos-2003 https://nixos.org/channels/nixos-20.03 
nixos2003 https://nixos.org/channels/nixos-20.03 
nixos2009 https://nixos.org/channels/nixos-20.09 
unstable https://nixos.org/channels/nixpkgs-unstable 
--- I can see ls /nix/var/nix/profiles/per-user/root/channels-*/manifest.nix shows us the channel generations.. Which the latest channel generation has the following content:
cat /nix/var/nix/profiles/per-user/root/channels-61-link/manifest.nix | nixfmt
[
  {
    meta = { };
    name = "nixos-20.09.2538.0cfd08f4881";
    out = {
      outPath =
        "/nix/store/7s917s7ipvq3zmbx5g3kssldwc029r8r-nixos-20.09.2538.0cfd08f4881";
    };
    outPath =
      "/nix/store/7s917s7ipvq3zmbx5g3kssldwc029r8r-nixos-20.09.2538.0cfd08f4881";
    outputs = [ "out" ];
    system = "x86_64-linux";
    type = "derivation";
  }
  {
    meta = { };
    name = "nixos-2003-20.03.3324.929768261a3";
    out = {
      outPath =
        "/nix/store/zajz4gpq506g68w47pnl11k8mhz06jz0-nixos-2003-20.03.3324.929768261a3";
    };
Potentially I can get it from the store path above like /nix/store/zajz4gpq506g68w47pnl11k8mhz06jz0-nixos-2003-20.03.3324.929768261a3 - but I'm not sure (and not sure what that "path" is called either). Seems like an answer for this is documented here: https://discourse.nixos.org/t/how-to-see-what-commit-is-my-channel-on/4818/6?u=chrissound though that is not a programmatic way (which is what I'm looking for).
Chris Stryczynski (6603 rep)
Mar 22, 2021, 04:28 PM • Last activity: Aug 10, 2024, 03:47 PM
0 votes
1 answers
79 views
Conflicting settings value for Nixos service when defined within Nixos declarative containers
Within my nixos config I have a container defined: ``` containers.finderdbreplica = { config = { config, pkgs, ... }: { services.postgresql = { ... ``` ``` services.postgresql = { enable = true; port = 5548; package = pkgs.postgresql_11; authentication = pkgs.lib.mkOverride 10 '' local all all trust...
Within my nixos config I have a container defined:
containers.finderdbreplica = {
    config = { config, pkgs, ... }:
    {
      services.postgresql = {
    ...
services.postgresql = {
        enable = true;
        port = 5548;
        package = pkgs.postgresql_11;
        authentication = pkgs.lib.mkOverride 10 ''
          local all all trust
          host all all ::1/128 trust
          host    all     all             127.0.0.1/32            trust
        '';

        settings = {
          log_statement = "all";
        };

        enableTCPIP = true;

        initialScript = pkgs.writeText "backend-initScript" ''
          ALTER USER postgres WITH PASSWORD 'mysecretpassword';
        '';
      };
When trying to set a log prefix with:
settings = {
          log_statement = "all";
          log_line_prefix = "[%p] %a %u";
        };
I'm getting an error of error: The option `containers.finderdbreplica.services.postgresql.settings.log_line_prefix' has conflicting definition values: - In `/nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/virtualisation/nixos-containers.nix': "[%p] %a %u" - In `/nix/store/w1iy7m8zla5b8mlwkabs1cxf542s5f5y-nixos-22.05/nixos/nixos/modules/services/databases/postgresql.nix': "[%p] " (use '--show-trace' to show detailed location information) I can instead set services.postgresql.settings.log_line_prefix = "[%p] %a %u"; outside of the container, however this does not seem to apply to the services within the containers. Is this a limitation? Is there some other way to set the settings for a container service?
Chris Stryczynski (6603 rep)
Jul 9, 2024, 05:41 PM • Last activity: Jul 9, 2024, 06:07 PM
2 votes
1 answers
299 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` of my Nix expression, but it's not picking up the `.so` libs as expected. I've tried setting the...
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 of my Nix expression, but it's not picking up the .so libs as expected. I've tried setting the search path explicitly, relatively, etc. What would the correct usage be?
installPhase = ''
    mkdir -p $out
    addAutoPatchelfSearchPath $(pwd)
    cp -r $src $out
''
aionos242 (21 rep)
Sep 18, 2020, 03:31 PM • Last activity: Jul 2, 2024, 07:48 AM
2 votes
1 answers
1223 views
How to install Nix "silently" without having to answer to prompts? (e.g., to install it from a shell script)
I have a script that needs to be run on brand new virtual machines, but it depends on Nix being present, and I don't want to manually install it every time.
I have a script that needs to be run on brand new virtual machines, but it depends on Nix being present, and I don't want to manually install it every time.
toraritte (1202 rep)
Feb 20, 2023, 06:31 PM • Last activity: Jun 11, 2024, 02:04 PM
4 votes
2 answers
1829 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][1], `man nixos-generate-config`, and `man configuration.nix` shows only examples with an even simpler `{ config,...
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-config, and man configuration.nix shows only examples with an even simpler { config, pkgs, ... }:. Removing the , ... and running nixos-rebuild switch doesn't help; it prints the following three times: > error: anonymous function at /etc/nixos/configuration.nix:1:1 called with unexpected argument 'specialArgs', at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:372:8 How do I figure out its arguments?
l0b0 (53368 rep)
Feb 1, 2022, 08:13 AM • Last activity: Jun 6, 2024, 01:17 PM
Showing page 1 of 20 total questions