nix_config/flake.nix

162 lines
3.1 KiB
Nix
Raw Normal View History

2024-09-05 20:28:09 +02:00
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05";
unstable.url = "github:nixos/nixpkgs/nixos-unstable";
home-manager = {
url = "github:nix-community/home-manager/release-24.05";
inputs.nixpkgs.follows = "nixpkgs";
};
nur.url = "github:nix-community/NUR";
impermanence.url = "github:nix-community/impermanence";
hm-isolation.url = "github:3442/hm-isolation";
nixGL.url = "github:guibou/nixGL";
flake-utils.url = "github:numtide/flake-utils";
2024-09-08 22:17:00 +02:00
vpsadminos.url = "github:vpsfreecz/vpsadminos";
homepage.url = "git+https://git.posixlycorrect.com/fabian/homepage.git?ref=master";
conduwuit = {
url = "github:girlbossceo/conduwuit?ref=v0.4.5";
#FIXME: Podrá volver a "nixpkgs" una vez que rocksdb.enableLiburing llegue a stable
inputs.nixpkgs.follows = "unstable";
};
authentik-nix = {
url = "github:nix-community/authentik-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
mediawikiSkinCitizen = {
url = "github:StarCitizenTools/mediawiki-skins-Citizen/v2.27.0";
flake = false;
};
2024-09-05 20:28:09 +02:00
};
2024-09-08 22:17:00 +02:00
outputs = flakes @ {
2024-09-05 20:28:09 +02:00
self,
nixpkgs,
unstable,
home-manager,
nur,
2024-09-08 22:17:00 +02:00
impermanence,
2024-09-05 20:28:09 +02:00
hm-isolation,
nixGL,
2024-09-08 22:17:00 +02:00
flake-utils,
vpsadminos,
homepage,
conduwuit,
mediawikiSkinCitizen,
authentik-nix,
2024-09-05 20:28:09 +02:00
}: let
system = "x86_64-linux";
2024-09-08 22:17:00 +02:00
importPkgs = flake: import flake {
2024-09-05 20:28:09 +02:00
inherit system;
2024-09-08 22:17:00 +02:00
config = import ./pkgs/config nixpkgs.lib;
overlays = [ nur.overlay self.overlays.default ];
2024-09-05 20:28:09 +02:00
};
2024-09-08 22:17:00 +02:00
pkgs = importPkgs nixpkgs;
2024-09-05 20:28:09 +02:00
2024-09-08 22:17:00 +02:00
inherit (pkgs.local.lib) importAll;
2024-09-05 20:28:09 +02:00
2024-09-08 22:17:00 +02:00
local = import ./pkgs;
2024-09-05 20:28:09 +02:00
2024-09-08 22:17:00 +02:00
in
with pkgs.lib; {
formatter.${system} = pkgs.alejandra;
packages.${system} = pkgs.local;
overlays.default = final: prev:
let
locals = local final prev;
in
locals.override // {
local = locals;
unstable = importPkgs unstable;
};
2024-09-05 20:28:09 +02:00
2024-09-08 22:17:00 +02:00
nixosConfigurations =
let
nixosSystem = { modules }: makeOverridable nixpkgs.lib.nixosSystem {
inherit modules pkgs system;
2024-09-05 20:28:09 +02:00
2024-09-08 22:17:00 +02:00
specialArgs = {
inherit flakes;
};
};
2024-09-05 20:28:09 +02:00
2024-09-08 22:17:00 +02:00
hostConfig = host: nixosSystem {
modules = [
./sys
host
2024-09-05 20:28:09 +02:00
];
};
2024-09-08 22:17:00 +02:00
in
mapAttrs (_: hostConfig) (importAll { root = ./sys/platforms; });
homeConfigurations =
let
registry = { ... }: {
config.nix.registry = mapAttrs (
_: value {
flake = value;
}
) flakes;
};
2024-09-05 20:28:09 +02:00
2024-09-08 22:17:00 +02:00
home = platform: home-manager.lib.homeManagerConfiguration {
inherit pkgs;
2024-09-05 20:28:09 +02:00
2024-09-08 22:17:00 +02:00
modules = [
./home
platforms
registry
hm-isolation.homeManagerModule
];
};
2024-09-05 20:28:09 +02:00
2024-09-08 22:17:00 +02:00
platformHome = platform:
let
value = home platform;
in
{
inherit value;
name = "${value.config.home.username}@${value.config.local.hostname}";
2024-09-05 20:28:09 +02:00
};
2024-09-08 22:17:00 +02:00
in
mapAttrs' (_: platformHome) (importAll { root = ./home/platforms; });
2024-09-05 20:28:09 +02:00
};
2024-09-08 22:17:00 +02:00
2024-09-05 20:28:09 +02:00
}