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