nixos-config/nixos/flake.nix

107 lines
3.2 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";
2021-09-29 05:05:26 +02:00
polygon-art = {
url = "git+https://git.ingolf-wagner.de/palo/polygon-art.git";
#inputs.nixpkgs.follows = "nixpkgs";
};
2021-09-25 20:28:25 +02:00
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";
};
2021-09-29 22:42:48 +02:00
home-manager-utils = {
url = "github:mrvandalo/home-manager-utils";
inputs.home-manager.follows = "home-manager";
};
2021-09-25 20:28:25 +02:00
cluster-module = {
2021-11-01 19:29:39 +01:00
url = "github:mrvandalo/module.cluster";
2021-09-25 20:28:25 +02:00
};
2021-11-01 09:20:42 +01:00
nixpkgs-fmt = {
url = "github:nix-community/nixpkgs-fmt";
inputs.nixpkgs.follows = "nixpkgs";
};
2021-09-25 20:28:25 +02:00
};
2021-11-01 09:20:42 +01:00
outputs =
{ self
, sops-nix
, nixpkgs
, home-manager
, home-manager-utils
, doom-emacs-nix
, nixpkgs-unstable
, cluster-module
, polygon-art
, nixpkgs-fmt
, ...
}:
2021-09-25 20:28:25 +02:00
let
nixosSystem = nixpkgs.lib.nixosSystem;
defaultModules = [
sops-nix.nixosModules.sops
2021-11-01 19:29:39 +01:00
cluster-module.nixosModules.tinc
2021-09-25 20:28:25 +02:00
({ pkgs, ... }: {
2021-09-27 18:53:45 +02:00
nix = {
# no channesl needed this way
nixPath = [ "nixpkgs=${pkgs.path}" ];
# make flakes available
package = pkgs.nixUnstable;
extraOptions = ''
experimental-features = nix-command flakes
'';
};
2021-09-25 20:28:25 +02:00
# 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};
2021-09-29 05:05:26 +02:00
polygon-art = polygon-art.packages.${pkgs.system};
2021-09-25 20:28:25 +02:00
})
];
})
2021-10-31 17:49:44 +01:00
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
}
2021-09-25 20:28:25 +02:00
];
desktopModules = [
{
home-manager.users.mainUser = {
2021-10-26 07:54:50 +02:00
imports = [ doom-emacs-nix.hmModule home-manager-utils.hmModule ];
2021-09-25 20:28:25 +02:00
};
2021-11-01 09:20:42 +01:00
environment.systemPackages = [
nixpkgs-fmt.defaultPackage."x86_64-linux"
];
2021-09-25 20:28:25 +02:00
}
];
desktopConfiguration = initPath:
nixosSystem {
system = "x86_64-linux";
modules = defaultModules ++ desktopModules ++ [ initPath ];
};
serverConfiguration = initPath:
nixosSystem {
system = "x86_64-linux";
modules = defaultModules ++ [ initPath ];
};
2021-11-01 09:20:42 +01:00
in
{
2021-09-25 20:28:25 +02:00
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;
};
};
}