Refactor flake.nix

And add backup extension.
This commit is contained in:
Alexander Wainwright
2025-12-23 10:19:21 +10:00
parent d5ef5bb775
commit f9238bb576

View File

@@ -15,116 +15,65 @@
locutus.url = "git+https://git.figtree.dev/alex/locutus";
};
outputs = { self, nixpkgs, home-manager, ... }@inputs: {
outputs = { self, nixpkgs, home-manager, ... }@inputs:
let
# Shared Home Manager configuration function
mkHomeManagerConfig = { isDesktop }: {
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.backupFileExtension = "backup";
home-manager.users.alex = import ./alex/home.nix;
home-manager.extraSpecialArgs = { inherit inputs isDesktop; };
};
in {
nixosConfigurations = {
case = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = { inherit inputs; };
modules = [
./hosts/case/configuration.nix
# enable home manager
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.alex = import ./alex/home.nix;
# Optionally, use home-manager.extraSpecialArgs to pass arguments to
# home.nix
home-manager.extraSpecialArgs = { inherit inputs; isDesktop=true; };
}
(mkHomeManagerConfig { isDesktop = true; })
];
};
count = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = { inherit inputs; };
modules = [
./hosts/count/configuration.nix
# enable home manager
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.alex = import ./alex/home.nix;
# Optionally, use home-manager.extraSpecialArgs to pass arguments to
# home.nix
home-manager.extraSpecialArgs = { inherit inputs; isDesktop=true; };
}
(mkHomeManagerConfig { isDesktop = true; })
];
};
armitage = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = { inherit inputs; };
modules = [
./hosts/armitage/configuration.nix
# enable home manager
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.alex = import ./alex/home.nix;
# Optionally, use home-manager.extraSpecialArgs to pass arguments to
# home.nix
home-manager.extraSpecialArgs = { inherit inputs; isDesktop=true; };
}
(mkHomeManagerConfig { isDesktop = true; })
];
};
alt = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = { inherit inputs; };
modules = [
./hosts/alt/configuration.nix
# enable home manager
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.alex = import ./alex/home.nix;
# Optionally, use home-manager.extraSpecialArgs to pass arguments to
# home.nix
home-manager.extraSpecialArgs = { inherit inputs; isDesktop=false; };
}
(mkHomeManagerConfig { isDesktop = false; })
];
};
nightcity = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = { inherit inputs; };
modules = [
./hosts/nightcity/configuration.nix
# enable home manager
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.alex = import ./alex/home.nix;
# Optionally, use home-manager.extraSpecialArgs to pass arguments to
# home.nix
home-manager.extraSpecialArgs = { inherit inputs; isDesktop=false; };
}
(mkHomeManagerConfig { isDesktop = false; })
];
};
# other hosts...