2023-09-09 16:31:01 +02:00
|
|
|
{
|
|
|
|
description = "Lgm's NixOS Flake";
|
|
|
|
|
|
|
|
inputs = {
|
|
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
2024-01-09 08:10:37 +01:00
|
|
|
nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-23.11";
|
2024-05-16 15:43:14 +02:00
|
|
|
|
|
|
|
flake-parts.url = "github:hercules-ci/flake-parts";
|
2024-05-16 00:01:08 +02:00
|
|
|
flake-compat.url = "github:edolstra/flake-compat";
|
|
|
|
systems.url = "github:nix-systems/default";
|
|
|
|
flake-utils = {
|
|
|
|
url = "github:numtide/flake-utils";
|
|
|
|
inputs.systems.follows = "systems";
|
|
|
|
};
|
|
|
|
|
2023-09-09 16:31:01 +02:00
|
|
|
home-manager = {
|
2023-10-30 17:20:54 +01:00
|
|
|
url = "github:nix-community/home-manager/master";
|
2023-09-09 16:31:01 +02:00
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
2024-01-21 19:53:13 +01:00
|
|
|
sops-nix = {
|
|
|
|
url = "github:Mic92/sops-nix";
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
inputs.nixpkgs-stable.follows = "nixpkgs-stable";
|
|
|
|
};
|
2024-05-16 00:01:08 +02:00
|
|
|
mailserver = {
|
|
|
|
url = "gitlab:simple-nixos-mailserver/nixos-mailserver/master";
|
|
|
|
inputs.flake-compat.follows = "flake-compat";
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
};
|
2024-05-16 15:43:14 +02:00
|
|
|
authentik-nix = {
|
|
|
|
url = "github:nix-community/authentik-nix";
|
|
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
|
|
inputs.flake-parts.follows = "flake-parts";
|
|
|
|
};
|
2024-05-19 00:01:42 +02:00
|
|
|
|
|
|
|
nix-cfg-extra.url = "git+https://git.lgmrszd.xyz/lgmrszd/nix-cfg-extra-public.git";
|
2023-09-09 16:31:01 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
outputs = inputs@{
|
|
|
|
nixpkgs,
|
|
|
|
nixpkgs-stable,
|
|
|
|
home-manager,
|
2024-01-21 19:53:13 +01:00
|
|
|
sops-nix,
|
2024-05-16 00:01:08 +02:00
|
|
|
mailserver,
|
2024-05-16 15:43:14 +02:00
|
|
|
authentik-nix,
|
2023-09-09 16:31:01 +02:00
|
|
|
...
|
2023-11-24 13:22:22 +01:00
|
|
|
}:
|
|
|
|
let
|
|
|
|
system = "x86_64-linux";
|
2024-05-30 19:33:20 +02:00
|
|
|
# overlay-stable = final: prev: {
|
|
|
|
# stable = import nixpkgs-stable {
|
2024-05-20 23:23:04 +02:00
|
|
|
# inherit system;
|
|
|
|
# config.allowUnfree = true;
|
|
|
|
# };
|
|
|
|
# };
|
2023-12-11 17:47:25 +01:00
|
|
|
overlay-vaapiIntel = final: prev: {
|
|
|
|
vaapiIntel = prev.vaapiIntel.override { enableHybridCodec = true; };
|
|
|
|
};
|
2023-11-24 13:22:22 +01:00
|
|
|
my-overlays = [
|
2024-05-20 23:23:04 +02:00
|
|
|
# overlay-stable
|
2023-12-11 17:47:25 +01:00
|
|
|
overlay-vaapiIntel
|
2023-11-24 13:22:22 +01:00
|
|
|
];
|
2024-05-19 00:01:42 +02:00
|
|
|
inherit (inputs.nix-cfg-extra.lib) extra-data;
|
2024-05-31 15:06:16 +02:00
|
|
|
inherit (inputs.nix-cfg-extra.lib) extra-host-modules;
|
|
|
|
inherit (inputs.nix-cfg-extra.lib) extra-host-home-modules;
|
2024-05-30 19:33:20 +02:00
|
|
|
|
2024-05-31 15:06:16 +02:00
|
|
|
mkHostConfig = ({ host, extraModules ? [], useHome ? false }:
|
2024-05-30 19:33:20 +02:00
|
|
|
let
|
2024-05-31 15:06:16 +02:00
|
|
|
# TODO: rename some of those
|
|
|
|
data = import ./hosts/${host}/data // (if extra-data ? ${host} then extra-data.${host} else {});
|
|
|
|
extra-modules = (if extra-host-modules ? ${host} then extra-host-modules.${host} else []);
|
|
|
|
extra-home-modules = (if extra-host-home-modules ? ${host} then extra-host-home-modules.${host} else []);
|
2024-05-30 19:33:20 +02:00
|
|
|
in
|
|
|
|
nixpkgs.lib.nixosSystem {
|
2023-11-24 13:22:22 +01:00
|
|
|
inherit system;
|
2024-05-30 19:33:20 +02:00
|
|
|
specialArgs = { inherit data; };
|
2023-09-09 16:31:01 +02:00
|
|
|
modules = [
|
2024-05-30 19:33:20 +02:00
|
|
|
{ nixpkgs.overlays = my-overlays; }
|
|
|
|
./hosts/${host}/configuration.nix
|
|
|
|
./hosts/${host}/hardware-configuration.nix
|
2024-01-21 19:53:13 +01:00
|
|
|
sops-nix.nixosModules.sops
|
2024-05-31 15:06:16 +02:00
|
|
|
]
|
|
|
|
++ extra-modules
|
|
|
|
++ extraModules
|
|
|
|
++ (if !useHome then [] else [
|
2023-09-09 16:31:01 +02:00
|
|
|
home-manager.nixosModules.home-manager
|
|
|
|
{
|
|
|
|
home-manager.useGlobalPkgs = true;
|
|
|
|
home-manager.useUserPackages = true;
|
2024-05-31 15:06:16 +02:00
|
|
|
home-manager.users.lgm = {
|
|
|
|
imports = [
|
2024-05-31 15:08:30 +02:00
|
|
|
./hosts/${host}/home
|
2024-05-31 15:06:16 +02:00
|
|
|
] ++ extra-home-modules;
|
|
|
|
};
|
2023-09-09 16:31:01 +02:00
|
|
|
}
|
2024-05-31 15:06:16 +02:00
|
|
|
])
|
|
|
|
;
|
|
|
|
});
|
|
|
|
in
|
|
|
|
{
|
|
|
|
nixosConfigurations.lgm-nixos = mkHostConfig {
|
|
|
|
host = "laptop";
|
|
|
|
useHome = true;
|
2023-09-09 16:31:01 +02:00
|
|
|
};
|
2024-05-30 19:33:20 +02:00
|
|
|
nixosConfigurations.lgm-vps1 = mkHostConfig {
|
|
|
|
host = "vps1";
|
|
|
|
extraModules = [
|
2024-05-16 00:01:08 +02:00
|
|
|
mailserver.nixosModule
|
2024-05-16 15:43:14 +02:00
|
|
|
authentik-nix.nixosModules.default
|
2024-01-12 21:09:13 +01:00
|
|
|
];
|
|
|
|
};
|
2023-09-09 16:31:01 +02:00
|
|
|
};
|
|
|
|
}
|