nixos-config/nixos/flake.nix
2022-01-01 09:36:01 +01:00

113 lines
3.5 KiB
Nix

{
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";
polygon-art = {
url = "git+ssh://gitlab@gitlab.ingolf-wagner.de/palo/polygon-art";
#url = "git+https://git.ingolf-wagner.de/palo/polygon-art.git";
#inputs.nixpkgs.follows = "nixpkgs";
};
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";
};
home-manager-utils = {
url = "github:mrvandalo/home-manager-utils";
inputs.home-manager.follows = "home-manager";
};
cluster-module = {
url = "github:mrvandalo/module.cluster";
};
nixpkgs-fmt = {
url = "github:nix-community/nixpkgs-fmt";
inputs.nixpkgs.follows = "nixpkgs";
};
grocy-scanner = {
url = "github:mrVanDalo/grocy-scanner";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{ self
, sops-nix
, nixpkgs
, home-manager
, home-manager-utils
, doom-emacs-nix
, nixpkgs-unstable
, cluster-module
, polygon-art
, nixpkgs-fmt
, grocy-scanner
}:
let
nixosSystem = nixpkgs.lib.nixosSystem;
defaultModules = [
sops-nix.nixosModules.sops
cluster-module.nixosModules.tinc
grocy-scanner.nixosModule
({ pkgs, ... }: {
nix = {
# no channesl needed this way
nixPath = [ "nixpkgs=${pkgs.path}" ];
# make flakes available
package = pkgs.nixUnstable;
extraOptions = ''
experimental-features = nix-command flakes
'';
};
# 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};
polygon-art = polygon-art.packages.${pkgs.system};
})
];
})
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
}
];
desktopModules = [
{
home-manager.users.mainUser = {
imports = [ doom-emacs-nix.hmModule home-manager-utils.hmModule ];
};
environment.systemPackages = [
nixpkgs-fmt.defaultPackage."x86_64-linux"
];
}
];
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/sternchen/configuration.nix;
pepe = serverConfiguration ./configs/pepe/configuration.nix;
workhorse = serverConfiguration ./configs/workhorse/configuration.nix;
sputnik = serverConfiguration ./configs/sputnik/configuration.nix;
robi = serverConfiguration ./configs/robi/configuration.nix;
};
};
}