5 Jan 2022 |
necrophcodr | NixOS config is
{ config, lib, pkgs, modulesPath, home-manager, ... }:
{
deployment = {
targetHost = "192.168.x.y";
targetUser = "nixos";
tags = [ "rpi" "lab" ];
};
imports = [
(home-manager + "/nixos")
];
}
| 15:55:50 |
necrophcodr | Any ideas on how I could debug that? | 15:57:46 |
| andi- joined the room. | 16:12:32 |
Zhaofeng Li | What does your hive.nix look like? | 17:09:20 |
necrophcodr | In reply to @zhaofeng:zhaofeng.li What does your hive.nix look like? Sorry for not replying earlier, but I don't have a hive.nix, just a flake.nix as follows:
{
description = "Flake for RPI 4 Lab Infrastructure";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-21.05";
devshell.url = "github:numtide/devshell";
flake-utils.url = "github:numtide/flake-utils";
colmena.url = "github:zhaofengli/colmena/v0.2.0";
colmena.inputs.utils.follows = "flake-utils";
home-manager.url = "github:nix-community/home-manager/release-21.05";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { self, nixpkgs, devshell, flake-utils, colmena, home-manager }:
let
nativePkgs = import nixpkgs {
system = ( if builtins ? currentSystem then builtins.currentSystem else "x86_64-linux" );
};
in
{
colmena = {
meta.nixpkgs = nativePkgs;
pi = import ./pi4.nix;
specialArgs = {
inherit home-manager;
};
};
} // flake-utils.lib.eachDefaultSystem
(system:
let
pkgs = import nixpkgs { inherit system; overlays = [ devshell.overlay ]; };
in
{
devShell = pkgs.devshell.mkShell {
packages = with pkgs; [
colmena.defaultPackage.${system}
];
};
}
);
}
| 21:35:33 |
Zhaofeng Li | That confirms my suspicions in https://matrix.to/#/!KqkRjyTEzAGRiZFBYT:nixos.org/$YU9o4IlsSyfFcrRGby4AGBIvMLhMH0OPdWvEG4-5Qnk?via=nixos.org&via=matrix.org&via=tchncs.de | 21:36:44 |
Zhaofeng Li | Change specialArgs to meta.specialArgs | 21:36:53 |
necrophcodr | Oh I didn't even see your reply there, so sorry! | 21:37:24 |
necrophcodr | Well, that does it! Thank you so much! Is this a recent change, that specialArgs are required? | 21:37:59 |
Zhaofeng Li | No, you need to pass it in otherwise there is no argument named home-manager | 21:38:54 |
necrophcodr | The odd thing is I've got a different system with roughly the same flake.nix setup, but for a bunch of TV settop systems. They also use home-manager in exactly the same manner, but there's no specialArgs defined there, and it still works | 21:39:05 |
Zhaofeng Li | Is home-manager there as part of the NixOS module arguments? That shouldn't have worked. | 21:40:17 |
Zhaofeng Li | But if you put the configuration in the same file as flake.nix, then home-manager is usable from the context | 21:40:47 |
necrophcodr | The difference between the other system and this one is that this one is running NixOS, and the other is just Ubuntu with Nix slapped on top | 21:40:52 |
Zhaofeng Li | * But if you put the configuration in the same file as flake.nix, then home-manager is usable from the context in outputs | 21:40:55 |
necrophcodr | In reply to @zhaofeng:zhaofeng.li Is home-manager there as part of the NixOS module arguments? That shouldn't have worked. Yea, it is | 21:41:15 |
necrophcodr | In reply to @necrophcodr:matrix.org Yea, it is Well technically no, it isn't. It is, but in a different file that's imported using imports = [ ... ]; | 21:41:53 |
necrophcodr | It IS running an older colmena version too | 21:42:24 |
necrophcodr | It's in fact an older version of colmena as well, where I've got
meta = { inherit nixpkgs; };
| 21:42:28 |
necrophcodr | (The one where it magically works) | 21:42:40 |
Zhaofeng Li | Can you show the full config (or just the relevant parts)? | 21:43:28 |
necrophcodr | I'll show the relevant parts since the other system where it works is for business stuff | 21:44:05 |
necrophcodr | So the flake.nix is simple:
{
description = "NixOS Flake for NixOps deployment of dashboards";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-21.05";
flake-utils.url = "github:numtide/flake-utils";
devshell.url = "github:numtide/devshell";
colmena.url = "github:zhaofengli/colmena";
home-manager.url = "github:nix-community/home-manager/release-21.05";
};
outputs = { self, nixpkgs, flake-utils, devshell, colmena, home-manager }:
{
colmena = {
meta = {
inherit nixpkgs;
}; # ... Nodes ...
};
} // flake-utils.lib.eachDefaultSystem
(system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ devshell.overlay ];
};
in
...
}
| 21:45:12 |
necrophcodr | importing of nodes using the stanndard node = import node.nix method | 21:45:32 |
Zhaofeng Li | Ok, what about the part where home-manager is referenced? | 21:45:58 |
necrophcodr | Yeah we're getting there | 21:46:17 |
necrophcodr | # Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
{ config, lib, pkgs, modulesPath, ... }:
{
deployment = {
targetHost = "x.x.x.x";
};
networking.hostName = "HOST";
home-manager.users.su = { pkgs, ... }: {
home.file."dash.sh".source = dashFile;
};
imports =
[
../lib/dashboard.nix
../lib/wifi.nix
];
...
}
So that's the node.nix file
| 21:46:28 |
necrophcodr | And then we've got the ../lib/dashboard.nix file that contains
{ config, lib, pkgs, modulesPath, home-manager, ... }:
{
deployment.targetUser = "su";
imports = [
(modulesPath + "/installer/scan/not-detected.nix")
(home-manager + "/nixos" )
];
...
}
| 21:47:11 |
necrophcodr | And it just works | 21:47:16 |
necrophcodr | * # Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
{ config, lib, pkgs, modulesPath, ... }:
let
dashFile = "some_file.txt";
in
{
deployment = {
targetHost = "x.x.x.x";
};
networking.hostName = "HOST";
home-manager.users.su = { pkgs, ... }: {
home.file."dash.sh".source = dashFile; # dashFile is a variable declared above
};
imports =
[
../lib/dashboard.nix
../lib/wifi.nix
];
...
}
So that's the node.nix file
| 21:49:56 |