1

I'm trying to do this tutorial.

I've added these lines in /etc/nixos/configuration.nix

services.nginx.enable = true;
services.nginx.virtualHosts."test.local.cetacean.club" = {
     root = "/srv/http/test.local.cetacean.club";
};

I've made these commands

sudo mkdir -p /srv/http/test.local.cetacean.club
sudo chown nixos:nginx /srv/http/test.local.cetacean.club

I've defined these file /etc/nixos/flake.nix like this

{
  inputs = {
    nixpkgs.url = "nixpkgs/nixos-unstable";
  };
  
  outputs = { self, nixpkgs, ... }: {
    nixosConfigurations.nixos = nixpkgs.lib.nixosSystem {
      system = "x86_64-linux";
      modules = [
        ./configuration.nix
        
        # add things here
      ];
    }; 
  };
}

the following command works. It means that my file is ok sudo nix flake check /etc/nixos

but this command doesn't work

sudo nixos-rebuild switch

I don't understand the problem . This command worked before the definition of /etc/nixos/flake.nix. I don't understand why this prevent to rebuild /etc/nixos/configuration.nix.

Now the error message

>× systemd-sysctl.service - Apply Kernel Variables
     Loaded: loaded (/etc/systemd/system/systemd-sysctl.service; enabled; preset: enabled)
    Drop-In: /nix/store/9mnkvlaxvwlp3iw50mf2p91rm3simizr-system-units/systemd-sysctl.service.d
             └─overrides.conf
     Active: failed (Result: exit-code) since Sun 2022-12-25 08:26:30 UTC; 64ms ago
   Duration: 29min 7.255s
       Docs: man:systemd-sysctl.service(8)
             man:sysctl.d(5)
    Process: 10842 ExecStart=/nix/store/9rjdvhq7hnzwwhib8na2gmllsrh671xg-systemd-252.1/lib/systemd/systemd-sysctl (code=exited, status=243/CREDENTIALS)
   Main PID: 10842 (code=exited, status=243/CREDENTIALS)
         IP: 0B in, 0B out



>Dec 25 08:26:30 nixos systemd[1]: Starting Apply Kernel Variables...
Dec 25 08:26:30 nixos systemd[10842]: systemd-sysctl.service: Failed to set up credentials: Protocol error
Dec 25 08:26:30 nixos systemd[10842]: systemd-sysctl.service: Failed at step CREDENTIALS spawning /nix/store/9rjdvhq7hnzwwhib8na2gmllsrh671xg-systemd-252.1/lib/systemd/systemd-sysctl: Protocol error
Dec 25 08:26:30 nixos systemd[1]: systemd-sysctl.service: Main process exited, code=exited, status=243/CREDENTIALS
Dec 25 08:26:30 nixos systemd[1]: systemd-sysctl.service: Failed with result 'exit-code'.
Dec 25 08:26:30 nixos systemd[1]: Failed to start Apply Kernel Variables.

× systemd-tmpfiles-setup-dev.service - Create Static Device Nodes in /dev
     Loaded: loaded (/etc/systemd/system/systemd-tmpfiles-setup-dev.service; enabled; preset: enabled)
     Active: failed (Result: exit-code) since Sun 2022-12-25 08:26:30 UTC; 68ms ago
   Duration: 29min 7.256s
       Docs: man:tmpfiles.d(5)
             man:systemd-tmpfiles(8)
    Process: 10844 ExecStart=systemd-tmpfiles --prefix=/dev --create --boot (code=exited, status=243/CREDENTIALS)
   Main PID: 10844 (code=exited, status=243/CREDENTIALS)
         IP: 0B in, 0B out

>Dec 25 08:26:30 nixos systemd[1]: Starting Create Static Device Nodes in /dev...
Dec 25 08:26:30 nixos systemd[10844]: systemd-tmpfiles-setup-dev.service: Failed to set up credentials: Protocol error
Dec 25 08:26:30 nixos systemd[10844]: systemd-tmpfiles-setup-dev.service: Failed at step CREDENTIALS spawning systemd-tmpfiles: Protocol error
Dec 25 08:26:30 nixos systemd[1]: systemd-tmpfiles-setup-dev.service: Main process exited, code=exited, status=243/CREDENTIALS
Dec 25 08:26:30 nixos systemd[1]: systemd-tmpfiles-setup-dev.service: Failed with result 'exit-code'.
Dec 25 08:26:30 nixos systemd[1]: Failed to start Create Static Device Nodes in /dev.
warning: error(s) occurred while switching to the new configuration
Charles Duffy
  • 280,126
  • 43
  • 390
  • 441
  • Looks to me like a systemd problem rather than a flake-specific problem -- the new state was successfully built, you just weren't able to switch into it in-place. Wouldn't be surprising if it was specific to the version difference between the old systemd and the new one -- you may be able to boot into the new one directly without issue. – Charles Duffy May 15 '23 at 01:57

0 Answers0