{ description = "Lgm's NixOS Flake"; inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; nixpkgs-stable.url = "github:NixOS/nixpkgs/nixos-23.11"; flake-parts.url = "github:hercules-ci/flake-parts"; flake-compat.url = "github:edolstra/flake-compat"; systems.url = "github:nix-systems/default"; flake-utils = { url = "github:numtide/flake-utils"; inputs.systems.follows = "systems"; }; home-manager = { url = "github:nix-community/home-manager/master"; inputs.nixpkgs.follows = "nixpkgs"; }; sops-nix = { url = "github:Mic92/sops-nix"; inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs-stable.follows = "nixpkgs-stable"; }; mailserver = { url = "gitlab:simple-nixos-mailserver/nixos-mailserver/master"; inputs.flake-compat.follows = "flake-compat"; inputs.utils.follows = "flake-utils"; inputs.nixpkgs.follows = "nixpkgs"; }; authentik-nix = { url = "github:nix-community/authentik-nix"; inputs.nixpkgs.follows = "nixpkgs"; inputs.flake-parts.follows = "flake-parts"; }; nix-cfg-extra.url = "git+https://git.lgmrszd.xyz/lgmrszd/nix-cfg-extra-public.git"; }; outputs = inputs@{ nixpkgs, nixpkgs-stable, home-manager, sops-nix, mailserver, authentik-nix, ... }: let system = "x86_64-linux"; # overlay-stable = final: prev: { # stable = import nixpkgs-stable { # inherit system; # config.allowUnfree = true; # }; # }; overlay-vaapiIntel = final: prev: { vaapiIntel = prev.vaapiIntel.override { enableHybridCodec = true; }; }; my-overlays = [ # overlay-stable overlay-vaapiIntel ]; inherit (inputs.nix-cfg-extra.lib) extra-data; inherit (inputs.nix-cfg-extra.lib) extra-host-modules; inherit (inputs.nix-cfg-extra.lib) extra-host-home-modules; mkHostConfig = ({ host, extraModules ? [], useHome ? false }: let # 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 []); in nixpkgs.lib.nixosSystem { inherit system; specialArgs = { inherit data; }; modules = [ { nixpkgs.overlays = my-overlays; } ./hosts/${host}/configuration.nix ./hosts/${host}/hardware-configuration.nix sops-nix.nixosModules.sops ] ++ extra-modules ++ extraModules ++ (if !useHome then [] else [ home-manager.nixosModules.home-manager { home-manager.useGlobalPkgs = true; home-manager.useUserPackages = true; home-manager.users.lgm = { imports = [ ./hosts/${host}/home ] ++ extra-home-modules; }; } ]) ; }); in { nixosConfigurations.lgm-nixos = mkHostConfig { host = "laptop"; useHome = true; }; nixosConfigurations.lgm-vps1 = mkHostConfig { host = "vps1"; extraModules = [ mailserver.nixosModule authentik-nix.nixosModules.default ]; }; }; }