nixos-config/nixos/flake.nix

121 lines
3.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";
2022-06-14 22:56:58 +02:00
nixpkgs.url = "github:nixos/nixpkgs/nixos-22.05";
2021-09-25 20:28:25 +02:00
nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";
2021-09-29 05:05:26 +02:00
polygon-art = {
2022-01-13 13:50:00 +01:00
url = "git+https://git.ingolf-wagner.de/palo/polygon-art.git";
2022-01-13 13:40:18 +01:00
};
emacs-overlay = {
url = "github:nix-community/emacs-overlay";
flake = false;
2021-09-29 05:05:26 +02:00
};
2021-09-25 20:28:25 +02:00
doom-emacs-nix = {
2022-06-14 22:56:58 +02:00
url = "github:nix-community/nix-doom-emacs";
2021-09-25 20:28:25 +02:00
inputs.nixpkgs.follows = "nixpkgs";
2022-06-14 22:56:58 +02:00
#inputs.emacs-overlay.follows = "emacs-overlay";
2021-09-25 20:28:25 +02:00
};
home-manager = {
2022-01-09 19:22:12 +01:00
url = "github:nix-community/home-manager/release-21.11";
2021-09-25 20:28:25 +02:00
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-11-11 05:19:34 +01:00
grocy-scanner = {
url = "github:mrVanDalo/grocy-scanner";
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
2022-01-13 13:40:18 +01:00
, emacs-overlay
2021-11-01 09:20:42 +01:00
, doom-emacs-nix
, nixpkgs-unstable
, cluster-module
, polygon-art
, nixpkgs-fmt
2021-11-11 05:19:34 +01:00
, grocy-scanner
2021-11-01 09:20:42 +01:00
}:
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-11-11 05:19:34 +01:00
grocy-scanner.nixosModule
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 = {
2022-01-13 13:40:18 +01: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;
2021-11-11 05:19:34 +01:00
sternchen = desktopConfiguration ./configs/sternchen/configuration.nix;
2021-09-25 20:28:25 +02:00
pepe = serverConfiguration ./configs/pepe/configuration.nix;
workhorse = serverConfiguration ./configs/workhorse/configuration.nix;
sputnik = serverConfiguration ./configs/sputnik/configuration.nix;
2021-12-28 16:19:29 +01:00
robi = serverConfiguration ./configs/robi/configuration.nix;
2021-09-25 20:28:25 +02:00
};
};
}