!UKDpaKNNsBpOPfLWfX:zhaofeng.li

Colmena

299 Members
A simple, stateless NixOS deployment tool - https://github.com/zhaofengli/colmena101 Servers

Load older messages


SenderMessageTime
25 Nov 2023
@10leej:matrix.org@10leej:matrix.org joined the room.15:56:32
30 Nov 2023
@v:meowy.tech@v:meowy.tech left the room.22:47:06
1 Dec 2023
@mihtig:matrix.orgmihtig joined the room.09:40:53
@mihtig:matrix.orgmihtigHi all. Anyone here used nixos-infect on a host and colmena to deploy their nix config?09:41:34
@mihtig:matrix.orgmihtigcurrently I get a "nix-daemon: command not found" error which seems to stem from the ssh command failing to find nix-daemon, but it's hard to track it down and I've verified that nix profile (nix.sh in ~/.nix-profile) is specified in the various .profile/.bashrc combinations09:42:29
@mihtig:matrix.orgmihtig in fact when I ssh <host> "nix-daemon --help" I get the same error - presumably this isn't colmena's fault... 09:45:06
@zhaofeng:zhaofeng.liZhaofeng LiYeah, on non-NixOS hosts the Nix binaries aren't in the PATH set up by sshd/pam. It's a long-standing issue: https://github.com/NixOS/nix/issues/107817:42:10
@cw:kernelpanic.cafeChinchilla Wetreat

I'm getting Failed to upload keys: I/O Error: No such file or directory (os error 2) when I try to upload keys. The key block is:

          deployment = {
            keys."myservice.secret" = {
              keyFile = /full/path/to/secrets/myservice.secret;
              uploadAt = "pre-activation";
            };
          };

Am I doing something obviously stupid? File is in the ./secrets dir by the flake, and owned by the same user

22:21:06
@cw:kernelpanic.cafeChinchilla WetreatRedacted or Malformed Event22:21:20
@cw:kernelpanic.cafeChinchilla WetreatRedacted or Malformed Event22:21:41
@cw:kernelpanic.cafeChinchilla Wetreat okay so remote system has that file uploaded to /run/keys/myservice.secret but with no contents in the file 22:22:39
@cw:kernelpanic.cafeChinchilla Wetreatodd22:22:53
@mihtig:matrix.orgmihtig
In reply to @zhaofeng:zhaofeng.li
Yeah, on non-NixOS hosts the Nix binaries aren't in the PATH set up by sshd/pam. It's a long-standing issue: https://github.com/NixOS/nix/issues/1078
Thank you I wasn’t aware.
22:53:37
2 Dec 2023
@cw:kernelpanic.cafeChinchilla Wetreatand... it works now for some reason. Didn't change anything. Great.00:31:18
@srid:matrix.org@srid:matrix.org joined the room.16:03:02
@mjolnir:nixos.orgNixOS Moderation Bot banned @srid:matrix.org@srid:matrix.org (<no reason supplied>).16:03:03
@sivertism:matrix.org@sivertism:matrix.org joined the room.16:54:22
@sivertism:matrix.org@sivertism:matrix.org

Hi! I'm new to NixOS, but want to try out Colmena as a means to set up some computers in my home. One of them is a Microsoft Surface Pro 3, which needs <nixos-hardware/microsoft/surface-pro/3> to function properly. However, I'm struggling to use that with Colmena.

What I have now is something like this:

flake.nix
machines

  • surface-configuration.nix
  • surface-hardware-configuration.nix

In flake.nix:

inputs = { nixpkg.s.url = ... };
17:27:44
@sivertism:matrix.org@sivertism:matrix.org
In reply to @sivertism:matrix.org

Hi! I'm new to NixOS, but want to try out Colmena as a means to set up some computers in my home. One of them is a Microsoft Surface Pro 3, which needs <nixos-hardware/microsoft/surface-pro/3> to function properly. However, I'm struggling to use that with Colmena.

What I have now is something like this:

flake.nix
machines

  • surface-configuration.nix
  • surface-hardware-configuration.nix

In flake.nix:

inputs = { nixpkg.s.url = ... };
hit enter too soon... hold on
17:28:12
@sivertism:matrix.org@sivertism:matrix.org *

Hi! I'm new to NixOS, but want to try out Colmena as a means to set up some computers in my home. One of them is a Microsoft Surface Pro 3, which needs <nixos-hardware/microsoft/surface-pro/3> to function properly. However, I'm struggling to use that with Colmena.

What I have now is something like this:

flake.nix
machines

  • surface-configuration.nix
  • surface-hardware-configuration.nix

In flake.nix:

inputs = { nixpkg.s.url = ... };
outputs = {nixpkgs, ...} : {
  colmena = {
    meta = // default from examples
    
  surface = {name, nodes, pkgs, ... } : {
    deployment = { targetHost = name; targetUser="nixos"; };
    networking.hostName = name;
    imports = [
      <nixos-hardware/microsoft/surface-pro/3>
      ./machines/surface-configuration.nix
    ]
  };
};

And machines/surface-configuration.nix is the /etc/nixos/configuration.nix file copied from the surface after a fresh install. It, in turn, imports machines/surface-hardware-configuration.nix, which I've also left as default.

17:34:05
@sivertism:matrix.org@sivertism:matrix.org *

Hi! I'm new to NixOS, but want to try out Colmena as a means to set up some computers in my home. One of them is a Microsoft Surface Pro 3, which needs <nixos-hardware/microsoft/surface-pro/3> to function properly. However, I'm struggling to use that with Colmena.

What I have now is something like this:

flake.nix
machines

  • surface-configuration.nix
  • surface-hardware-configuration.nix

In flake.nix:

inputs = { nixpkg.s.url = ... };
outputs = {nixpkgs, ...} : {
  colmena = {
    meta = // default from examples
    
  surface = {name, nodes, pkgs, ... } : {
    deployment = { targetHost = name; targetUser="nixos"; };
    networking.hostName = name;
    imports = [
      <nixos-hardware/microsoft/surface-pro/3>
      ./machines/surface-configuration.nix
    ]
  };
};

And machines/surface-configuration.nix is the /etc/nixos/configuration.nix file copied from the surface after a fresh install. It, in turn, imports machines/surface-hardware-configuration.nix, which I've also left as default.

From this, I first get an error error: cannot look up '<nixos-hardware/microsoft/surface-pro/3>' in pure evaluation mode (use '--impure' to override), so I use --impure, but then get error: file 'nixos-hardware/microsoft/surface-pro/3' was not found in the Nix search path (add it using $NIX_PATH or -I. I should probably add it the proper way with a url to nixos-hardware as shown in the nixos-hardware section on flakes, but I'm not sure where to stick in those modules ref: (nixos-hardware#flakes)[https://github.com/NixOS/nixos-hardware#using-nix-flakes-support].

Does anyone know how I should proceed?

17:39:11
@sivertism:matrix.org@sivertism:matrix.org
In reply to @sivertism:matrix.org

Hi! I'm new to NixOS, but want to try out Colmena as a means to set up some computers in my home. One of them is a Microsoft Surface Pro 3, which needs <nixos-hardware/microsoft/surface-pro/3> to function properly. However, I'm struggling to use that with Colmena.

What I have now is something like this:

flake.nix
machines

  • surface-configuration.nix
  • surface-hardware-configuration.nix

In flake.nix:

inputs = { nixpkg.s.url = ... };
* hit enter too soon... hold on
17:39:23
@sivertism:matrix.org@sivertism:matrix.org *

hit enter too soon... hold on

Done :)

17:39:58
@sivertism:matrix.org@sivertism:matrix.org *

Hi! I'm new to NixOS, but want to try out Colmena as a means to set up some computers in my home. One of them is a Microsoft Surface Pro 3, which needs <nixos-hardware/microsoft/surface-pro/3> to function properly. However, I'm struggling to use that with Colmena.

What I have now is something like this:

flake.nix
machines
    /surface-configuration.nix
    /surface-hardware-configuration.nix

In flake.nix:

inputs = { nixpkg.s.url = ... };
outputs = {nixpkgs, ...} : {
  colmena = {
    meta = // default from examples
    
  surface = {name, nodes, pkgs, ... } : {
    deployment = { targetHost = name; targetUser="nixos"; };
    networking.hostName = name;
    imports = [
      <nixos-hardware/microsoft/surface-pro/3>
      ./machines/surface-configuration.nix
    ]
  };
};

And machines/surface-configuration.nix is the /etc/nixos/configuration.nix file copied from the surface after a fresh install. It, in turn, imports machines/surface-hardware-configuration.nix, which I've also left as default.

From this, I first get an error error: cannot look up '<nixos-hardware/microsoft/surface-pro/3>' in pure evaluation mode (use '--impure' to override), so I use --impure, but then get error: file 'nixos-hardware/microsoft/surface-pro/3' was not found in the Nix search path (add it using $NIX_PATH or -I. I should probably add it the proper way with a url to nixos-hardware as shown in the nixos-hardware section on flakes, but I'm not sure where to stick in those modules ref: (nixos-hardware#flakes)[https://github.com/NixOS/nixos-hardware#using-nix-flakes-support].

Does anyone know how I should proceed?

17:41:05
@ibizaman:matrix.orgibizaman
In reply to @sivertism:matrix.org

Hi! I'm new to NixOS, but want to try out Colmena as a means to set up some computers in my home. One of them is a Microsoft Surface Pro 3, which needs <nixos-hardware/microsoft/surface-pro/3> to function properly. However, I'm struggling to use that with Colmena.

What I have now is something like this:

flake.nix
machines
    /surface-configuration.nix
    /surface-hardware-configuration.nix

In flake.nix:

inputs = { nixpkg.s.url = ... };
outputs = {nixpkgs, ...} : {
  colmena = {
    meta = // default from examples
    
  surface = {name, nodes, pkgs, ... } : {
    deployment = { targetHost = name; targetUser="nixos"; };
    networking.hostName = name;
    imports = [
      <nixos-hardware/microsoft/surface-pro/3>
      ./machines/surface-configuration.nix
    ]
  };
};

And machines/surface-configuration.nix is the /etc/nixos/configuration.nix file copied from the surface after a fresh install. It, in turn, imports machines/surface-hardware-configuration.nix, which I've also left as default.

From this, I first get an error error: cannot look up '<nixos-hardware/microsoft/surface-pro/3>' in pure evaluation mode (use '--impure' to override), so I use --impure, but then get error: file 'nixos-hardware/microsoft/surface-pro/3' was not found in the Nix search path (add it using $NIX_PATH or -I. I should probably add it the proper way with a url to nixos-hardware as shown in the nixos-hardware section on flakes, but I'm not sure where to stick in those modules ref: (nixos-hardware#flakes)[https://github.com/NixOS/nixos-hardware#using-nix-flakes-support].

Does anyone know how I should proceed?

I wouldn’t use the impure mode here. The syntax with brackets is not what you want with flakes. You will need to add nixos-hardware as a flake input instead.   
19:12:49
@ibizaman:matrix.orgibizaman
In reply to @sivertism:matrix.org

Hi! I'm new to NixOS, but want to try out Colmena as a means to set up some computers in my home. One of them is a Microsoft Surface Pro 3, which needs <nixos-hardware/microsoft/surface-pro/3> to function properly. However, I'm struggling to use that with Colmena.

What I have now is something like this:

flake.nix
machines
    /surface-configuration.nix
    /surface-hardware-configuration.nix

In flake.nix:

inputs = { nixpkg.s.url = ... };
outputs = {nixpkgs, ...} : {
  colmena = {
    meta = // default from examples
    
  surface = {name, nodes, pkgs, ... } : {
    deployment = { targetHost = name; targetUser="nixos"; };
    networking.hostName = name;
    imports = [
      <nixos-hardware/microsoft/surface-pro/3>
      ./machines/surface-configuration.nix
    ]
  };
};

And machines/surface-configuration.nix is the /etc/nixos/configuration.nix file copied from the surface after a fresh install. It, in turn, imports machines/surface-hardware-configuration.nix, which I've also left as default.

From this, I first get an error error: cannot look up '<nixos-hardware/microsoft/surface-pro/3>' in pure evaluation mode (use '--impure' to override), so I use --impure, but then get error: file 'nixos-hardware/microsoft/surface-pro/3' was not found in the Nix search path (add it using $NIX_PATH or -I. I should probably add it the proper way with a url to nixos-hardware as shown in the nixos-hardware section on flakes, but I'm not sure where to stick in those modules ref: (nixos-hardware#flakes)[https://github.com/NixOS/nixos-hardware#using-nix-flakes-support].

Does anyone know how I should proceed?

*

I wouldn’t use the impure mode here. The syntax with brackets is not what you want with flakes. You will need to add nixos-hardware as a flake input instead.

If that doesn’t make sense I can give a more complete example when I’m back at my computer. 

19:15:31
3 Dec 2023
@sivertism:matrix.org@sivertism:matrix.org

I was eventually able to create a flake wrapper around my existing config, which seems to work. At least nix build .#nixosConfigurations.surface.config.system.build.toplevel succeeds.

So I think it's now just about importing that into the Colmena flake? I've tried a few variations of the below colmena flake, but to no avail.

{
  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
    surface.url = "/home/sivert/work/nixos-surface";
  };
 
  outputs = {nixpkgs, surface, ...}: {
    colmena = {
      meta = {
          nixpkgs = import nixpkgs {
            system = "x86_64-linux";
          };
      };
 
      surface = { name, ...}: {
 
        deployment = {
          targetHost = "surface";
          targetUser = "nixos";
        };
        
        networking.hostName = "surface";
 
        imports = [
          surface #.nixosConfigurations.surface.config.system.build.toplevel
          ];
      };
    };
  };
}
10:19:37
@sivertism:matrix.org@sivertism:matrix.orgimage.png
Download image.png
11:25:29
@sivertism:matrix.org@sivertism:matrix.org

Turn's out the answer was (yet again) in ibizaman 's blog! https://blog.tiserbox.com/posts/2023-11-08-switch-to-colmena-for-local-deploys.html

Just had to remove the flake wrapper and set up the colmena flake like this:

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

  outputs = inputs@{nixpkgs, nixos-hardware, ...}: {
    colmena = {
      meta = {
          nixpkgs = import inputs.nixpkgs {
            system = "x86_64-linux";
          };
          specialArgs=inputs;
      };

      surface = { name, ...}: {

        deployment = {
          targetHost = "surface";
          targetUser = "nixos";
        };

        networking.hostName = "surface";

        imports = [
          inputs.nixos-hardware.nixosModules.microsoft-surface-pro-3
          ./machines/surface/configuration.nix
          ];
      };
    };
  };
}

Now I'm running into some security error though (see the above screenshot)

11:25:50
@sivertism:matrix.org@sivertism:matrix.org *

Turn's out the answer was (yet again) in ibizaman 's blog! https://blog.tiserbox.com/posts/2023-11-08-switch-to-colmena-for-local-deploys.html

Just had to remove the flake wrapper and set up the colmena flake like this:

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

  outputs = inputs@{nixpkgs, nixos-hardware, ...}: {
    colmena = {
      meta = {
          nixpkgs = import inputs.nixpkgs {
            system = "x86_64-linux";
          };
          specialArgs=inputs;
      };

      surface = { name, ...}: {

        deployment = {
          targetHost = "surface";
          targetUser = "nixos";
        };

        networking.hostName = "surface";

        imports = [
          inputs.nixos-hardware.nixosModules.microsoft-surface-pro-3
          ./machines/surface/configuration.nix
          ];
      };
    };
  };
}

Now I'm running into some security error though (see the above screenshot)
[ERROR] stderr) error: cannot add path '/nix/store/00yiiplzcqzmqaw10cghbxlb4l4xibc0-i3lock-color.pam' because it lacks a signature by a trusted key

13:08:29

Show newer messages


Back to Room ListRoom Version: 6