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"; 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 = { nixosConfigurations = {
case = nixpkgs.lib.nixosSystem { case = nixpkgs.lib.nixosSystem {
system = "x86_64-linux"; system = "x86_64-linux";
specialArgs = { inherit inputs; }; specialArgs = { inherit inputs; };
modules = [ modules = [
./hosts/case/configuration.nix ./hosts/case/configuration.nix
# enable home manager
home-manager.nixosModules.home-manager home-manager.nixosModules.home-manager
{ (mkHomeManagerConfig { isDesktop = true; })
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; };
}
]; ];
}; };
count = nixpkgs.lib.nixosSystem { count = nixpkgs.lib.nixosSystem {
system = "x86_64-linux"; system = "x86_64-linux";
specialArgs = { inherit inputs; }; specialArgs = { inherit inputs; };
modules = [ modules = [
./hosts/count/configuration.nix ./hosts/count/configuration.nix
# enable home manager
home-manager.nixosModules.home-manager home-manager.nixosModules.home-manager
{ (mkHomeManagerConfig { isDesktop = true; })
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; };
}
]; ];
}; };
armitage = nixpkgs.lib.nixosSystem { armitage = nixpkgs.lib.nixosSystem {
system = "x86_64-linux"; system = "x86_64-linux";
specialArgs = { inherit inputs; }; specialArgs = { inherit inputs; };
modules = [ modules = [
./hosts/armitage/configuration.nix ./hosts/armitage/configuration.nix
# enable home manager
home-manager.nixosModules.home-manager home-manager.nixosModules.home-manager
{ (mkHomeManagerConfig { isDesktop = true; })
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; };
}
]; ];
}; };
alt = nixpkgs.lib.nixosSystem { alt = nixpkgs.lib.nixosSystem {
system = "x86_64-linux"; system = "x86_64-linux";
specialArgs = { inherit inputs; }; specialArgs = { inherit inputs; };
modules = [ modules = [
./hosts/alt/configuration.nix ./hosts/alt/configuration.nix
# enable home manager
home-manager.nixosModules.home-manager home-manager.nixosModules.home-manager
{ (mkHomeManagerConfig { isDesktop = false; })
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; };
}
]; ];
}; };
nightcity = nixpkgs.lib.nixosSystem { nightcity = nixpkgs.lib.nixosSystem {
system = "x86_64-linux"; system = "x86_64-linux";
specialArgs = { inherit inputs; }; specialArgs = { inherit inputs; };
modules = [ modules = [
./hosts/nightcity/configuration.nix ./hosts/nightcity/configuration.nix
# enable home manager
home-manager.nixosModules.home-manager home-manager.nixosModules.home-manager
{ (mkHomeManagerConfig { isDesktop = false; })
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; };
}
]; ];
}; };
# other hosts... # other hosts...