flake.nix: cleanup, generalize hosts

This commit is contained in:
Lgmrszd 2024-05-30 20:33:20 +03:00
parent d8b7ee6918
commit ee29846e7a
No known key found for this signature in database
GPG key ID: 9396B8BA6FBB14DE

View file

@ -3,9 +3,6 @@
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";
@ -42,7 +39,6 @@
outputs = inputs@{
nixpkgs,
# nixpkgs-fresh,
nixpkgs-stable,
home-manager,
sops-nix,
@ -52,39 +48,41 @@
}:
let
system = "x86_64-linux";
# overlay-fresh = final: prev: {
# fresh = import nixpkgs-fresh {
# overlay-stable = final: prev: {
# stable = import nixpkgs-stable {
# 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;
mkHostConfig = ({ host, extraModules ? [] }:
let
data = import ./hosts/${host}/data // (if extra-data ? host then extra-data.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
] ++ extraModules;
});
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
nixosConfigurations.lgm-nixos = mkHostConfig {
host = "laptop";
extraModules = [
./hosts/laptop/mounts.nix
# nix-index-database.nixosModules.nix-index
sops-nix.nixosModules.sops
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
@ -93,19 +91,11 @@
}
];
};
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; })
nixosConfigurations.lgm-vps1 = mkHostConfig {
host = "vps1";
extraModules = [
mailserver.nixosModule
authentik-nix.nixosModules.default
./hosts/vps1/configuration.nix
./hosts/vps1/hardware-configuration.nix
sops-nix.nixosModules.sops
];
};
};