About this question/issue
I am trying to use flake-utils.lib.eachSystem
for both my nixosConfigurations
and homeConfigurations
, and I am stuck with attributes missing error as mentioned below.
# please ignore the dirty working directory warnings
[gildedguy@stellapent-cier:/workspaces/ajhalili2006/nixops-config]$ nix run home-manager -- switch --flake .
warning: Git tree '/workspaces/ajhalili2006/nixops-config' is dirty
warning: Git tree '/workspaces/ajhalili2006/nixops-config' is dirty
warning: Git tree '/workspaces/ajhalili2006/nixops-config' is dirty
warning: Git tree '/workspaces/ajhalili2006/nixops-config' is dirty
error: flake 'git+file:///workspaces/ajhalili2006/nixops-config' does not provide attribute 'packages.x86_64-linux.homeConfigurations."gildedguy".activationPackage', 'legacyPackages.x86_64-linux.homeConfigurations."gildedguy".activationPackage' or 'homeConfigurations."gildedguy".activationPackage'
I checked the outputs via nix flake show
and confirmed that something gone wrong.
[gildedguy@stellapent-cier:/workspaces/ajhalili2006/nixops-config]$ nix flake show
warning: Git tree '/workspaces/ajhalili2006/nixops-config' is dirty
git+file:///workspaces/ajhalili2006/nixops-config
├───homeConfigurations: unknown
└───nixosConfigurations
├───aarch64-linux: NixOS configuration
└───x86_64-linux: NixOS configuration
Should I rewrite them under the packages
attribute as subattrs?
The Why
I want to make both my NixOS and home-manager configurations workable across CPU arches without the pain of abusing Git branches for arch-specific configs, just as I do for devShell
s via devenv
. (For Hack Clubbers reading this, I am getting a Raspberry Pi 5 from High Seas general YSWS program, pending warehouse shipment.)
Additional context
Here’s a draft configuration from my git stash
at the moment:
{
description = "Andrei Jiroh's NixOS and home-manager configurations in one place, seperate from the dotfiles repo";
# try to be in-sync with the nix-channels
inputs = {
# nixpkgs itself
nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1.0.tar.gz";
# home-manager
home-manager = {
url = "github:nix-community/home-manager/master";
inputs.nixpkgs.follows = "nixpkgs";
};
# Determinate Nix
determinate = {
url = "https://flakehub.com/f/DeterminateSystems/determinate/0.1";
inputs.nixpkgs.follows = "nixpkgs";
};
# Community Extras
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
vscode-server.url = "github:nix-community/nixos-vscode-server";
vscode-server.inputs.nixpkgs.follows = "nixpkgs";
# flake utils
flake-utils.url = "github:numtide/flake-utils";
# nix-ld
nix-ld = {
url = "github:Mic92/nix-ld";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = {
self,
nixpkgs,
home-manager,
nixos-hardware,
determinate,
vscode-server,
nix-ld,
flake-utils,
systems
}:
flake-utils.lib.eachSystem [
"x86_64-linux"
"aarch64-linux"
] (system:
let
pkgs = import nixpkgs { inherit system; };
in {
nixosConfigurations = {
stellapent-cier = nixpkgs.lib.nixosSystem {
inherit system;
modules = [
./hosts/stellapent-cier/configuration.nix
# load Determinate Nix and the rest
determinate.nixosModules.default
home-manager.nixosModules.home-manager
vscode-server.nixosModules.default
nix-ld.nixosModules.nix-ld
# one-liners?
{ programs.nix-ld.dev.enable = true; }
];
};
};
homeConfigurations = {
gildedguy = home-manager.lib.homeConfigurations {
inherit pkgs;
modules = [
./shared/home-manager/main.nix
{
home.username = "gildedguy";
home.homeDirectory = "/home/gildedguy";
}
];
extraSpecialArgs = {
home = {
useUserPackages = true;
useGlobalPkgs = true;
};
};
};
};
}
);
}
For the current state, see flake.nix · 32895a192eb2a196f6fbc1c08c2ee57782f8bee5 · Andrei Jiroh Lair / Personal NixOS and home-manager configurations · GitLab (github mirror)