Complete Overhaul of flake.nix

This commit is contained in:
2025-09-05 01:03:12 +02:00
parent 74bf1dc059
commit ebb83a7e8b
19 changed files with 757 additions and 670 deletions

235
flake.nix
View File

@@ -5,34 +5,35 @@
nixConfig = {
extra-substituters = [
"https://nix-community.cachix.org"
"https://hyprland.cachix.org"
];
extra-trusted-public-keys = [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
];
};
inputs = {
# Core
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
unstable.url = "github:nixos/nixpkgs/nixos-unstable";
# Desktop ENV
hyprland.url = "github:hyprwm/Hyprland";
spicetify-nix.url = "github:Gerg-L/spicetify-nix";
nixcord.url = "github:kaylorben/nixcord";
/*
nixvim = {
url = "github:nix-community/nixvim/nixos-24.11";
inputs.nixpkgs.follows = "nixpkgs";
};
*/
catppuccin.url = "github:catppuccin/nix";
home-manager.url = "github:nix-community/home-manager/release-24.11";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
hyprland-plugins = {
url = "github:hyprwm/hyprland-plugins";
inputs.hyprland.follows = "hyprland";
};
# Customization
spicetify-nix.url = "github:Gerg-L/spicetify-nix";
nixcord.url = "github:kaylorben/nixcord";
catppuccin.url = "github:catppuccin/nix";
# User Config
home-manager.url = "github:nix-community/home-manager/release-24.11";
home-manager.inputs.nixpkgs.follows = "nixpkgs";
};
outputs =
@@ -43,113 +44,123 @@
catppuccin,
...
}:
{
packages.x86_64-linux.default = self.nixosConfigurations.iso.config.system.build.isoImage;
nixosConfigurations = {
iso = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
(
{ pkgs, modulesPath, ... }:
{
imports = [ (modulesPath + "/installer/cd-dvd/installation-cd-minimal.nix") ];
environment.systemPackages = with pkgs; [
neovim
git
wget
curl
];
nix.settings.experimental-features = [
"nix-command"
"flakes"
];
}
)
];
let
system = "x86_64-linux";
# Common Configuration
commonModules = [
(
{ config, ... }:
{
nix.settings = {
accept-flake-config = true;
experimental-features = [
"nix-command"
"flakes"
];
};
}
)
];
commonHomeManagerConfig =
{
username,
monitorSetup ? "single",
}:
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
backupFileExtension = "backup";
extraSpecialArgs = {
inherit inputs;
inherit username monitorSetup;
};
users.${username} = import ./users/${username}/home.nix;
sharedModules = [
inputs.catppuccin.homeModules.catppuccin
inputs.nixcord.homeModules.nixcord
];
};
};
m920q =
let
username = "phil";
specialArgs = {
inherit inputs username;
};
in
nixpkgs.lib.nixosSystem {
inherit specialArgs;
system = "x86_64-linux";
modules = [
./hosts/m920q
./users/${username}/nixos.nix
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.backupFileExtension = "backup";
home-manager.extraSpecialArgs = inputs // specialArgs;
home-manager.users.${username} = import ./users/${username}/home.nix;
home-manager.sharedModules = [
inputs.nixcord.homeModules.nixcord
];
nix.settings.experimental-features = [
"nix-command"
"flakes"
];
}
];
# System Builder
mkSystem =
{
hostname,
username,
system ? "x86_64-linux",
monitorSetup ? "single",
extraModules ? [ ],
}:
nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = {
inherit inputs;
inherit username monitorSetup;
};
qemu =
let
username = "phil";
specialArgs = { inherit username; };
in
nixpkgs.lib.nixosSystem {
inherit specialArgs;
system = "x86_64-linux";
modules = [
./hosts/qemu
modules =
commonModules
++ [
./hosts/${hostname}
./users/${username}/nixos.nix
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
(commonHomeManagerConfig { inherit username monitorSetup; })
]
++ extraModules;
home-manager.extraSpecialArgs = inputs // specialArgs;
home-manager.users.${username} = import ./users/${username}/home.nix;
}
];
};
};
hp15-n028sg =
let
username = "phil";
specialArgs = { inherit username; };
in
nixpkgs.lib.nixosSystem {
inherit specialArgs;
system = "x86_64-linux";
# ISO configuration
isoConfig = nixpkgs.lib.nixosSystem {
inherit system;
modules = [
(import (nixpkgs + "/nixos/modules/installer/cd-dvd/installation-cd-minimal.nix"))
(
{ pkgs, ... }:
{
environment.systemPackages = with pkgs; [
neovim
git
wget
curl
];
nix.settings.experimental-features = [
"nix-command"
"flakes"
];
}
)
];
};
modules = [
./hosts/hp15-n028sg
./users/${username}/nixos.nix
in
{
packages.${system}.default = self.nixosConfigurations.iso.config.system.build.isoImage;
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
nixosConfigurations = {
iso = isoConfig;
qemu = mkSystem {
hostname = "qemu";
username = "phil";
monitorSetup = "single";
};
m920q = mkSystem {
hostname = "m920q";
username = "phil";
monitorSetup = "dual";
};
hp15-n028sg = mkSystem {
hostname = "hp15-n028sg";
username = "phil";
monitorSetup = "dual";
};
home-manager.extraSpecialArgs = inputs // specialArgs;
home-manager.users.${username} = import ./users/${username}/home.nix;
}
];
};
};
};
}