nixos/flake.nix
2025-08-21 23:08:07 +02:00

136 lines
3.4 KiB
Nix

{
description = "Main Flake";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
nixpkgs-stable.url = "github:NixOS/nixpkgs/release-24.05";
flake-private.url = "git+ssh://git@git.firelilith.org/lilith/flake-private.git?ref=main";
flake-utils.url = "github:numtide/flake-utils";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
sops-nix = {
url = "github:Mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
impermanence.url = "github:nix-community/impermanence";
stylix = {
url = "github:danth/stylix";
inputs = {
nixpkgs.follows = "nixpkgs";
};
};
hyprland = {
url = "git+https://github.com/hyprwm/Hyprland";
inputs.nixpkgs.follows = "nixpkgs";
};
hyprgrass = {
url = "github:horriblename/hyprgrass";
inputs.hyprland.follows = "hyprland";
};
rose-pine-hyprcursor = {
url = "github:ndom91/rose-pine-hyprcursor";
inputs.nixpkgs.follows = "nixpkgs";
inputs.utils.follows = "flake-utils";
inputs.hyprlang.follows = "hyprland/hyprlang";
};
zen-browser = {
url = "github:firelilith/zen-browser-nix/native-messaging-collision";
inputs.nixpkgs.follows = "nixpkgs";
};
nur = {
url = "github:nix-community/NUR";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{
self,
nixpkgs,
home-manager,
nur,
zen-browser,
...
}@inputs:
let
inherit (nixpkgs) lib;
systemFromHardwareConf =
hostname:
let
hardware = import ./hosts/${hostname}/hardware-configuration.nix;
args = builtins.functionArgs hardware // {
lib.mkDefault = lib.id;
};
in
(hardware args).nixpkgs.hostPlatform;
importNixpkgs =
system: nixpkgs:
let
config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) (import ./unfree.nix).allowed;
config.rocmSupport = true;
in
import nixpkgs {
inherit system config;
overlays = [
nur.overlays.default
zen-browser.overlay
(final: prev: {
jellyseerr = prev.jellyseerr.overrideAttrs (old: {
src = prev.fetchFromGitHub {
owner = "0-Pierre";
repo = "jellyseer";
rev = "0cc1391b7016ded828670d4525417b59029db351";
hash = "";
};
});
})
];
};
makeHost =
host: system:
lib.nixosSystem {
system = system;
pkgs = importNixpkgs system nixpkgs;
specialArgs = inputs // {
inherit system;
};
modules = [
./hosts/${host}/default.nix
./hosts/${host}/hardware-configuration.nix
./system
{ networking.hostName = host; }
./home
];
};
in
{
nixosConfigurations = lib.pipe ./hosts [
builtins.readDir
(lib.filterAttrs (_: type: type == "directory"))
(lib.filterAttrs (
name: _:
builtins.pathExists ./hosts/${name}/default.nix
&& builtins.pathExists ./hosts/${name}/hardware-configuration.nix
))
(builtins.mapAttrs (name: _: makeHost name (systemFromHardwareConf name)))
];
};
}