nixos-config/nixos/flake.nix

78 lines
2.6 KiB
Nix
Raw Normal View History

2021-09-25 20:28:25 +02:00
{
description = "system flake.nix";
inputs = {
sops-nix.url = "github:Mic92/sops-nix";
nixpkgs.url = "github:nixos/nixpkgs/nixos-21.05";
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
doom-emacs-nix = {
url = "github:vlaci/nix-doom-emacs";
inputs.nixpkgs.follows = "nixpkgs";
};
home-manager = {
url = "github:nix-community/home-manager/release-21.05";
inputs.nixpkgs.follows = "nixpkgs";
};
backup-module = {
url = "git+https://git.ingolf-wagner.de/nix-modules/backup.git";
flake = false;
};
krops-lib = {
url = "git+https://git.ingolf-wagner.de/nix-modules/krops.git";
flake = false;
};
cluster-module = {
url =
"git+https://git.ingolf-wagner.de/nix-modules/cluster.git?rev=ef621797a30f8a57de16bf33672abdd411cbcece";
flake = false;
};
};
outputs = { self, sops-nix, nixpkgs, home-manager, doom-emacs-nix
, backup-module, nixpkgs-unstable, krops-lib, cluster-module, ... }:
let
nixosSystem = nixpkgs.lib.nixosSystem;
defaultModules = [
sops-nix.nixosModules.sops
{ imports = [ "${krops-lib}" "${cluster-module}" "${backup-module}" ]; }
({ pkgs, ... }: {
# defined overlays injected by the nixflake
nixpkgs.overlays = [
(_self: _super: {
# we assign the overlay created before to the overlays of nixpkgs.
unstable = nixpkgs-unstable.legacyPackages.${pkgs.system};
})
];
})
];
desktopModules = [
home-manager.nixosModules.home-manager
{
home-manager.users.mainUser = {
imports = [ doom-emacs-nix.hmModule ];
};
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
}
];
desktopConfiguration = initPath:
nixosSystem {
system = "x86_64-linux";
modules = defaultModules ++ desktopModules ++ [ initPath ];
};
serverConfiguration = initPath:
nixosSystem {
system = "x86_64-linux";
modules = defaultModules ++ [ initPath ];
};
in {
nixosConfigurations = {
sterni = desktopConfiguration ./configs/sterni/configuration.nix;
sternchen = desktopConfiguration ./configs/sternchien/configuration.nix;
pepe = serverConfiguration ./configs/pepe/configuration.nix;
workhorse = serverConfiguration ./configs/workhorse/configuration.nix;
sputnik = serverConfiguration ./configs/sputnik/configuration.nix;
};
};
}