small refactoring to avoid duplication in system definition

This commit is contained in:
Cyryl Płotnicki 2021-06-19 23:36:44 +01:00
parent 640ad5c15d
commit 1458eeeb87

View file

@ -1,54 +1,42 @@
{ {
description = "NixOS configuration with flakes"; description = "NixOS configuration with flakes";
outputs = { self, flake-utils, home-manager, nixpkgs-nixos-unstable, nixpkgs-stable, nixos-hardware, nur, bisq, agenix, neuron } @ inputs: { outputs = { self, flake-utils, home-manager, nixpkgs-nixos-unstable, nixpkgs-stable, nixos-hardware, nur, bisq, agenix, neuron } @ inputs:
let
mkServer = pkgs: system: hostname:
pkgs.lib.nixosSystem {
system = system;
modules = [
(./. + "/nixos/boxes/${hostname}")
agenix.nixosModules.age
];
specialArgs = { inherit inputs; };
};
mkWorkstation = pkgs: system: hostname:
pkgs.lib.nixosSystem {
system = system;
modules = [
(./. + "/nixos/boxes/${hostname}")
(import ./nixos/email-accounts.nix)
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.cyryl = import ./nixos/home-manager;
}
];
specialArgs = { inherit inputs; };
};
in
{
nixosConfigurations = { nixosConfigurations = {
foureighty = nixpkgs-stable.lib.nixosSystem { foureighty = mkWorkstation nixpkgs-stable "x86_64-linux" "foureighty";
system = "x86_64-linux"; skinnyv = mkWorkstation nixpkgs-stable "x86_64-linux" "skinnyv";
modules = [ brix = mkServer nixpkgs-stable "x86_64-linux" "brix";
(import ./nixos/boxes/foureighty) vultr1 = mkServer nixpkgs-stable "x86_64-linux" "vultr1";
(import ./nixos/email-accounts.nix)
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.cyryl = import ./nixos/home-manager;
}
];
specialArgs = { inherit inputs; };
};
skinnyv = nixpkgs-stable.lib.nixosSystem {
system = "x86_64-linux";
modules = [
(import ./nixos/boxes/skinnyv)
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.cyryl = import ./nixos/home-manager;
}
];
specialArgs = { inherit inputs; };
};
brix = nixpkgs-stable.lib.nixosSystem {
system = "x86_64-linux";
modules = [
(import ./nixos/boxes/brix)
agenix.nixosModules.age
];
specialArgs = { inherit inputs; };
};
vultr1 = nixpkgs-stable.lib.nixosSystem {
system = "x86_64-linux";
modules = [
(import ./nixos/boxes/vultr1)
agenix.nixosModules.age
];
specialArgs = { inherit inputs; };
};
}; };
}; };
inputs = { inputs = {