-
Hello everyone. Thank yall so much for your contributions to the home manager project. I realized all my dotfiles were living in one folder in
I want to add this derivation as a flake package output in my flake for all my hosts. Because i want to implement some conditional stuff and i want to be able to generate files themselves for other machines and see how they look. Like this:
LLMs suggested this outputs =
{
self,
nixpkgs,
...
}@inputs:
let
inherit (self) outputs;
supportedSystems = [
"x86_64-linux"
"aarch64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
forAllSystems = f: nixpkgs.lib.genAttrs supportedSystems (system: f system);
makePkgs = system: import nixpkgs { inherit system; };
makeNixosConfig = configName: nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs outputs; };
modules = [ ./hosts/${configName}/configuration.nix ];
};
configNames = builtins.attrNames (builtins.readDir ./hosts);
in
{
nixosConfigurations = nixpkgs.lib.genAttrs configNames (name: makeNixosConfig name);
packages = forAllSystems (system:
let
pkgs = makePkgs system;
in
{
# export home-manager dotfiles
# /nix/store/61b1rzwps27pa4gb3ql8kdddyz22nhnn-home-manager-files/.bashrc
# /nix/store/61b1rzwps27pa4gb3ql8kdddyz22nhnn-home-manager-files/.config/git/config
# etc.
ymir-dotfiles = self.nixosConfigurations.ymir.config.system.build.homeManagerFiles;
}
);
};
} But obviously there is no |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I found it!!!! its actually: ymir-dotfiles = self.nixosConfigurations.ymir.config.home-manager.users.osbm.home-files; Here, i also overwrite each systems architecture so it is able to generate dotfiles on all architectures. packages = forAllSystems (system:
let
makeNixosConfigWithSystemOverride = configName: nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs outputs; };
modules = [
./hosts/${configName}/configuration.nix
{ nixpkgs.hostPlatform = nixpkgs.lib.mkForce system; }
];
};
dotfilesMachineNames = [ "ymir" "pochita" "tartarus" "wallfacer" ];
in
builtins.listToAttrs (map (name: {
name = "${name}-dotfiles";
value = (makeNixosConfigWithSystemOverride name).config.home-manager.users.osbm.home-files;
}) dotfilesMachineNames)
); |
Beta Was this translation helpful? Give feedback.
I found it!!!!
its actually:
Here, i also overwrite each systems architecture so it is able to generate dotfiles on all architectures.