I’ve got a flake that looks like this:
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
home-manager = {
url = "github:nix-community/home-manager/release-24.11";
inputs.nixpkgs.follows = "nixpkgs";
};
nix-darwin = {
url = "github:LnL7/nix-darwin/nix-darwin-24.11";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, home-manager, nix-darwin }@inputs: {
darwinConfigurations = {
matrixbook = nix-darwin.lib.darwinSystem {
system = "aarch64-darwin";
modules = [
./matrixbook/configuration.nix
home-manager.darwinModules.home-manager
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
extraSpecialArgs = { inherit inputs; };
users."user" = import ./home-manager/common.nix;
sharedModules = [
./home-manager/darwin-home.nix
./home-manager/wezterm-config.nix
./home-manager/zellij-config.nix
./home-manager/nixpkgs.nix
./home-manager/nushell.nix
];
};
}
];
specialArgs = { inherit inputs; inherit self; };
};
};
darwinPackages = self.darwinConfigurations."matrixbook".pkgs;
};
}
If I run this command, my changes are applied, hurray!
sudo nix run nix-darwin -- switch --flake .
But at my new job I have to jump through some hoops to run sudo commands. Certainly some changes require sudo, but I’d expect that certain other changes do not. For the latter sort, I’d like to be able to apply my changes without invoking sudo.
Naively, I’d hope for this to work:
nix run home-manager -- switch --flake .
But apparently I am missing something, because I get errors like this:
❯ nix run home-manager -- switch --flake .
error: flake 'git+file:///Users/user/src/configs' does not provide attribute 'packages.aarch64-darwin.homeConfigurations', 'legacyPackages.aarch64-darwin.homeConfigurations' or 'homeConfigurations'
error: flake 'git+file:///Users/user/src/configs' does not provide attribute 'packages.aarch64-darwin.homeConfigurations', 'legacyPackages.aarch64-darwin.homeConfigurations' or 'homeConfigurations'
error: flake 'git+file:///Users/user/src/configs' does not provide attribute 'packages.aarch64-darwin.homeConfigurations', 'legacyPackages.aarch64-darwin.homeConfigurations' or 'homeConfigurations'
error: flake 'git+file:///Users/user/src/configs' does not provide attribute 'packages.aarch64-darwin.homeConfigurations."user".activationPackage', 'legacyPackages.aarch64-darwin.homeConfigurations."user".activationPackage' or 'homeConfigurations."user".activationPackage'
Is there a different command I can use, or an alteration to my flake structure, which will let me make some changes without requiring sudo?