nix-cfg/flake.nix
2024-05-19 01:16:39 +03:00

112 lines
3.2 KiB
Nix

{
description = "Lgm's NixOS Flake";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
# separate inputs to lock some packages
# fresh - mostly desktop apps
nixpkgs-fresh.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-fresh,
nixpkgs-stable,
home-manager,
sops-nix,
mailserver,
authentik-nix,
...
}:
let
system = "x86_64-linux";
overlay-fresh = final: prev: {
fresh = import nixpkgs-fresh {
inherit system;
config.allowUnfree = true;
};
};
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-fresh
overlay-stable
overlay-vaapiIntel
];
inherit (inputs.nix-cfg-extra.lib) extra-data;
in
{
nixosConfigurations.lgm-nixos = nixpkgs.lib.nixosSystem rec {
inherit system;
modules = [
({ config, pkgs, ... }: { nixpkgs.overlays = my-overlays; })
./hosts/laptop/configuration.nix
./hosts/laptop/hardware-configuration.nix
./hosts/laptop/mounts.nix
# nix-index-database.nixosModules.nix-index
sops-nix.nixosModules.sops
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.lgm = import ./hosts/laptop/home.nix;
}
];
};
nixosConfigurations.lgm-vps1 = let
data = import ./hosts/vps1/data // (if extra-data ? vps1 then extra-data.vps1 else {});
in
nixpkgs.lib.nixosSystem rec {
inherit system;
specialArgs = { inherit data; };
modules = [
({ config, pkgs, ... }: { nixpkgs.overlays = my-overlays; })
mailserver.nixosModule
authentik-nix.nixosModules.default
./hosts/vps1/configuration.nix
./hosts/vps1/hardware-configuration.nix
sops-nix.nixosModules.sops
];
};
};
}