Simplify flake with variables

This commit is contained in:
Jimbo 2024-10-12 21:14:55 -04:00
parent c380052b0c
commit c3193845a4

View file

@ -2,7 +2,6 @@
description = "Jimbo's systems as a flake"; description = "Jimbo's systems as a flake";
inputs = { inputs = {
# Nixpkgs
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05"; nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05";
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
nur.url = "github:nix-community/NUR"; nur.url = "github:nix-community/NUR";
@ -37,15 +36,16 @@
... ...
} @inputs: let } @inputs: let
inherit (self) outputs; inherit (self) outputs;
forAllSystems = nixpkgs.lib.genAttrs [ mkNixos = modules: nixpkgs.lib.nixosSystem {
"aarch64-linux" inherit modules;
"x86_64-linux" specialArgs = { inherit inputs outputs; };
]; };
in rec {
# Your custom packages
# Accessible through 'nix build', 'nix shell', etc
packages = forAllSystems (system: import ./extras/pkgs nixpkgs.legacyPackages.${system});
mkHome = modules: pkgs: home-manager.lib.homeManagerConfiguration {
inherit modules pkgs;
extraSpecialArgs = { inherit inputs outputs; };
};
in rec {
# Your custom packages and modifications, exported as overlays # Your custom packages and modifications, exported as overlays
overlays = import ./extras/overlays.nix { inherit inputs; }; overlays = import ./extras/overlays.nix { inherit inputs; };
@ -59,76 +59,40 @@
# NixOS config entrypoint, use 'nixos-rebuild --flake .#your-hostname' # NixOS config entrypoint, use 'nixos-rebuild --flake .#your-hostname'
nixosConfigurations = { nixosConfigurations = {
JimDesktop = nixpkgs.lib.nixosSystem { JimDesktop = mkNixos [
specialArgs = {inherit inputs outputs;};
modules = [
./system/hosts/JimDesktop/configuration.nix ./system/hosts/JimDesktop/configuration.nix
lanzaboote.nixosModules.lanzaboote lanzaboote.nixosModules.lanzaboote
]; ];
}; JimServer = mkNixos [
JimServer = nixpkgs.lib.nixosSystem {
specialArgs = {inherit inputs outputs;};
modules = [
./system/hosts/JimServer/configuration.nix ./system/hosts/JimServer/configuration.nix
mailserver.nixosModule mailserver.nixosModule
]; ];
}; JimPine = mkNixos [
JimPine = nixpkgs.lib.nixosSystem {
specialArgs = {inherit inputs outputs;};
modules = [
./system/hosts/JimPine/configuration.nix ./system/hosts/JimPine/configuration.nix
hardware.nixosModules.pine64-pinebook-pro hardware.nixosModules.pine64-pinebook-pro
]; ];
}; };
JimLenovo = nixpkgs.lib.nixosSystem {
specialArgs = {inherit inputs outputs;};
modules = [
./system/hosts/JimLenovo/configuration.nix
];
};
};
# Home-manager configuration, use 'home-manager --flake .#your-username@your-hostname' # Home-manager configuration, use 'home-manager --flake .#your-username@your-hostname'
homeConfigurations = { homeConfigurations = {
"jimbo@JimDesktop" = home-manager.lib.homeManagerConfiguration { "jimbo@JimDesktop" = mkHome [
pkgs = nixpkgs.legacyPackages.x86_64-linux;
extraSpecialArgs = {inherit inputs outputs;};
modules = [
./home/hosts/JimDesktop/home.nix ./home/hosts/JimDesktop/home.nix
nur.nixosModules.nur nur.nixosModules.nur
]; ] nixpkgs.legacyPackages."x86_64-linux";
};
"jimbo@JimServer" = home-manager.lib.homeManagerConfiguration { "jimbo@JimServer" = mkHome [
pkgs = nixpkgs.legacyPackages.x86_64-linux;
extraSpecialArgs = {inherit inputs outputs;};
modules = [
./home/hosts/JimServer/home.nix ./home/hosts/JimServer/home.nix
]; ] nixpkgs.legacyPackages.x86_64-linux;
};
"jimbo@JimPine" = home-manager.lib.homeManagerConfiguration { "jimbo@JimPine" = mkHome [
pkgs = nixpkgs.legacyPackages.aarch64-linux;
extraSpecialArgs = {inherit inputs outputs;};
modules = [
./home/hosts/JimPine/home.nix ./home/hosts/JimPine/home.nix
nur.nixosModules.nur nur.nixosModules.nur
]; ] nixpkgs.legacyPackages.aarch64-linux;
};
"jimbo@JimLenovo" = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.x86_64-linux;
extraSpecialArgs = {inherit inputs outputs;};
modules = [
./home/hosts/JimLenovo/home.nix
nur.nixosModules.nur
];
};
# Derivation for ssh envrionments on other people's servers # Derivation for ssh envrionments on other people's servers
"jimbo@JimTerminal" = home-manager.lib.homeManagerConfiguration { "jimbo@JimTerminal" = mkHome [
pkgs = nixpkgs.legacyPackages.x86_64-linux;
extraSpecialArgs = {inherit inputs outputs;};
modules = [
./home/hosts/JimTerminal/home.nix ./home/hosts/JimTerminal/home.nix
]; ] nixpkgs.legacyPackages.x86_64-linux;
};
}; };
}; };
} }