config/flake.nix
2024-06-02 20:05:48 +02:00

123 lines
3.5 KiB
Nix

{
description = "System and user config";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
nix-super.url = "gitlab:max/nix-super?host=git.privatevoid.net";
home-manager.url = "github:nix-community/home-manager/master";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
nix-crx.url = "git+https://git.privatevoid.net/max/nix-crx.git";
nix-crx.inputs.nixpkgs.follows = "nixpkgs";
deploy-rs.url = "github:serokell/deploy-rs";
deploy-rs.inputs.nixpkgs.follows = "nixpkgs";
agenix.url = "github:ryantm/agenix";
agenix.inputs.nixpkgs.follows = "nixpkgs";
helix.url = "github:helix-editor/helix";
helix.inputs = {
nixpkgs.follows = "nixpkgs";
};
kernel-clr = { url = "github:clearlinux-pkgs/linux"; flake = false; };
dream2nix.url = "github:nix-community/dream2nix";
dream2nix.inputs.nixpkgs.follows = "nixpkgs";
nixpak.url = "github:nixpak/nixpak";
nixpak.inputs.nixpkgs.follows = "nixpkgs";
nil.url = "github:oxalica/nil";
nil.inputs.nixpkgs.follows = "nixpkgs";
hyprspace.url = "github:hyprspace/hyprspace";
hyprspace.inputs.nixpkgs.follows = "nixpkgs";
lanzaboote.url = "github:nix-community/lanzaboote";
lanzaboote.inputs.nixpkgs.follows = "nixpkgs";
nixified-ai.url = "github:nixified-ai/flake/2";
attic.url = "github:zhaofengli/attic";
attic.inputs.nixpkgs.follows = "nixpkgs";
};
outputs = { self, nixpkgs, home-manager, nixos-hardware, ... }@inputs:
let
inherit (nixpkgs) lib;
system = "x86_64-linux";
pkgs = import nixpkgs {
inherit system;
config.allowUnfreePredicate = pkg: lib.elem (lib.getName pkg) (import ./packages/unfree.nix);
};
deploy-rs-lib = inputs.deploy-rs.lib.${system};
agenixModule = inputs.agenix.nixosModules.age;
aspect = import ./modules inputs;
hosts = import ./hosts;
specialArgs = { inherit inputs hosts aspect; };
mkNixOS' = lib: name: lib.nixosSystem {
inherit system;
inherit specialArgs;
modules = [ hosts."${name}".nixos ];
};
mkNixOS = mkNixOS' nixpkgs.lib;
in {
nixosModules = aspect.modules;
nixosConfigurations =
lib.genAttrs [ "TITAN" "jericho" ] mkNixOS;
deploy.nodes = with deploy-rs-lib; {
TITAN = {
hostname = "titan.hyprspace";
profiles.system = {
user = "root";
path = activate.nixos self.nixosConfigurations.TITAN;
};
};
jericho = {
hostname = "jericho.hyprspace";
profiles.system = {
user = "root";
path = activate.nixos self.nixosConfigurations.jericho;
};
};
};
packages.${system} = import ./packages {
inherit inputs pkgs;
};
defaultApp.${system} = {
type = "app";
program = self.packages.${system}.flake-installer.outPath;
};
hydraJobs = {
systems.${system} = lib.mapAttrs (_: x: x.config.system.build.toplevel) self.nixosConfigurations;
packages = self.packages;
};
homeConfigurations = {
max = inputs.home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules = [
{
home.homeDirectory = "/home/max";
home.username = "max";
}
./users/max/home.nix
];
extraSpecialArgs = { inherit inputs; };
};
};
};
}