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"; 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:
nixosConfigurations = {
foureighty = nixpkgs-stable.lib.nixosSystem { let
system = "x86_64-linux"; mkServer = pkgs: system: hostname:
pkgs.lib.nixosSystem {
system = system;
modules = [ 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) (import ./nixos/email-accounts.nix)
home-manager.nixosModules.home-manager home-manager.nixosModules.home-manager
@ -18,37 +29,14 @@
]; ];
specialArgs = { inherit inputs; }; specialArgs = { inherit inputs; };
}; };
skinnyv = nixpkgs-stable.lib.nixosSystem { in
system = "x86_64-linux";
modules = [
(import ./nixos/boxes/skinnyv)
home-manager.nixosModules.home-manager
{ {
home-manager.useGlobalPkgs = true; nixosConfigurations = {
home-manager.useUserPackages = true; foureighty = mkWorkstation nixpkgs-stable "x86_64-linux" "foureighty";
home-manager.users.cyryl = import ./nixos/home-manager; skinnyv = mkWorkstation nixpkgs-stable "x86_64-linux" "skinnyv";
} brix = mkServer nixpkgs-stable "x86_64-linux" "brix";
vultr1 = mkServer nixpkgs-stable "x86_64-linux" "vultr1";
];
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 = {