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,11 +1,22 @@
{
description = "NixOS configuration with flakes";
outputs = { self, flake-utils, home-manager, nixpkgs-nixos-unstable, nixpkgs-stable, nixos-hardware, nur, bisq, agenix, neuron } @ inputs: {
nixosConfigurations = {
foureighty = nixpkgs-stable.lib.nixosSystem {
system = "x86_64-linux";
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 = [
(import ./nixos/boxes/foureighty)
(./. + "/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
@ -18,37 +29,14 @@
];
specialArgs = { inherit inputs; };
};
skinnyv = nixpkgs-stable.lib.nixosSystem {
system = "x86_64-linux";
modules = [
(import ./nixos/boxes/skinnyv)
in
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; };
};
nixosConfigurations = {
foureighty = mkWorkstation nixpkgs-stable "x86_64-linux" "foureighty";
skinnyv = mkWorkstation nixpkgs-stable "x86_64-linux" "skinnyv";
brix = mkServer nixpkgs-stable "x86_64-linux" "brix";
vultr1 = mkServer nixpkgs-stable "x86_64-linux" "vultr1";
};
};
inputs = {