withSystem configuration
evaluate packages only once per each channel
This commit is contained in:
parent
1deb75a769
commit
127fc7f418
2 changed files with 523 additions and 518 deletions
182
flake.nix
182
flake.nix
|
|
@ -61,7 +61,7 @@
|
|||
# ==============================================================================
|
||||
# OUTPUTS - MAIN FLAKE DEFINITION
|
||||
# ==============================================================================
|
||||
outputs = { self, ... }@inputs:
|
||||
outputs = inputs:
|
||||
# Common Nix configuration for all systems
|
||||
let
|
||||
nix-config = {
|
||||
|
|
@ -74,12 +74,15 @@
|
|||
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
|
||||
# Support all systems defined in inputs.systems
|
||||
systems = import inputs.systems;
|
||||
imports = [ inputs.git-hooks.flakeModule ];
|
||||
imports = [
|
||||
inputs.git-hooks.flakeModule
|
||||
({ self, withSystem, inputs, ... }: {
|
||||
|
||||
# Per-system configuration (applies to each system independently)
|
||||
perSystem = { config, pkgs, system, ... }: {
|
||||
_module.args = {
|
||||
# Import nixpkgs with custom configuration
|
||||
_module.args.pkgs = import inputs.nixpkgs {
|
||||
pkgs = import inputs.nixpkgs {
|
||||
inherit system;
|
||||
config = nix-config;
|
||||
overlays = [
|
||||
|
|
@ -88,6 +91,16 @@
|
|||
];
|
||||
};
|
||||
|
||||
unstable = import inputs.nixpkgs-u {
|
||||
inherit system;
|
||||
config = nix-config;
|
||||
overlays = [
|
||||
inputs.self.overlays.packages
|
||||
inputs.self.overlays.overrides
|
||||
];
|
||||
};
|
||||
};
|
||||
|
||||
# Pre-commit hooks configuration
|
||||
pre-commit.settings.hooks = {
|
||||
deadnix.enable = true; # Remove dead code from Nix expressions
|
||||
|
|
@ -165,6 +178,7 @@
|
|||
};
|
||||
};
|
||||
|
||||
|
||||
# ========================================================================
|
||||
# FLAKE OUTPUTS - SHARED RESOURCES
|
||||
# ========================================================================
|
||||
|
|
@ -271,14 +285,10 @@
|
|||
};
|
||||
|
||||
# Home Manager configuration module
|
||||
homeManagerModules = { config, ... }: {
|
||||
homeManagerModules = {
|
||||
home-manager = {
|
||||
useGlobalPkgs = true; # Use system packages globally
|
||||
useUserPackages = true; # Install packages to user profile
|
||||
extraSpecialArgs = {
|
||||
stable = import inputs.nixpkgs-s { inherit (config.nixpkgs) system; }; # Pass stable channel to home-manager
|
||||
unstable = import inputs.nixpkgs-u { inherit (config.nixpkgs) system; }; # Pass unstable channel to home-manager
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -334,58 +344,13 @@
|
|||
# NIXOS CONFIGURATIONS - SYSTEM DEFINITIONS
|
||||
# ====================================================================
|
||||
nixosConfigurations = {
|
||||
# ==================================================================
|
||||
# THOR - AMD Desktop System
|
||||
# ==================================================================
|
||||
thor = inputs.nixpkgs-s.lib.nixosSystem rec {
|
||||
system = "x86_64-linux";
|
||||
specialArgs = {
|
||||
stable = inputs.nixpkgs-s.legacyPackages.${system}; # Pass stable channel
|
||||
unstable = inputs.nixpkgs-u.legacyPackages.${system}; # Pass unstable channel
|
||||
};
|
||||
modules = [
|
||||
# Hardware-specific configurations
|
||||
inputs.nixos-hardware.nixosModules.common-cpu-amd
|
||||
inputs.nixos-hardware.nixosModules.common-pc-ssd
|
||||
|
||||
# Home manager
|
||||
inputs.home-manager-s.nixosModules.default
|
||||
self.nixosModules.homeManagerModules
|
||||
|
||||
# Base and main modules
|
||||
self.nixosModules.commonModules
|
||||
self.nixosModules.mainModules
|
||||
|
||||
# Hardware and system-specific configuration
|
||||
./instances/thor/hardware-configuration.nix
|
||||
./instances/thor/configuration.nix
|
||||
|
||||
# Additional services
|
||||
./nixos/virtualization.nix
|
||||
./nixos/steam.nix # Steam gaming platform
|
||||
./nixos/ollama.nix # AI/LLM service
|
||||
# ./nixos/ollama-ui.nix # Web UI for Ollama
|
||||
./nixos/garage.nix # Object storage service
|
||||
|
||||
# User-specific home manager configuration
|
||||
{
|
||||
home-manager.users.bertof.imports = [
|
||||
inputs.nix-index-database.homeModules.nix-index
|
||||
./instances/thor/hm.nix
|
||||
];
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
# ==================================================================
|
||||
# SIF - Intel Desktop System
|
||||
# ==================================================================
|
||||
sif = inputs.nixpkgs-s.lib.nixosSystem rec {
|
||||
system = "x86_64-linux";
|
||||
specialArgs = {
|
||||
stable = inputs.nixpkgs-s.legacyPackages.${system}; # Pass stable channel
|
||||
unstable = inputs.nixpkgs-u.legacyPackages.${system}; # Pass unstable channel
|
||||
};
|
||||
sif = withSystem "x86_64-linux" ({ unstable, system, ... }: inputs.nixpkgs-s.lib.nixosSystem {
|
||||
inherit system;
|
||||
specialArgs = { inherit unstable; };
|
||||
modules = [
|
||||
# Intel-specific hardware configurations
|
||||
inputs.nixos-hardware.nixosModules.common-cpu-intel-cpu-only
|
||||
|
|
@ -413,23 +378,68 @@
|
|||
|
||||
# User-specific home manager configuration
|
||||
{
|
||||
home-manager.users.bertof.imports = [
|
||||
home-manager = {
|
||||
extraSpecialArgs = { inherit unstable; };
|
||||
users.bertof.imports = [
|
||||
inputs.nix-index-database.homeModules.nix-index
|
||||
./instances/sif/hm.nix
|
||||
];
|
||||
};
|
||||
}
|
||||
];
|
||||
}
|
||||
);
|
||||
|
||||
# ==================================================================
|
||||
# THOR - AMD Desktop System
|
||||
# ==================================================================
|
||||
thor = withSystem "x86_64-linux" ({ unstable, system, ... }: inputs.nixpkgs-s.lib.nixosSystem {
|
||||
inherit system;
|
||||
specialArgs = { inherit unstable; };
|
||||
modules = [
|
||||
# Hardware-specific configurations
|
||||
inputs.nixos-hardware.nixosModules.common-cpu-amd
|
||||
inputs.nixos-hardware.nixosModules.common-pc-ssd
|
||||
|
||||
# Home manager
|
||||
inputs.home-manager-s.nixosModules.default
|
||||
self.nixosModules.homeManagerModules
|
||||
|
||||
# Base and main modules
|
||||
self.nixosModules.commonModules
|
||||
self.nixosModules.mainModules
|
||||
|
||||
# Hardware and system-specific configuration
|
||||
./instances/thor/hardware-configuration.nix
|
||||
./instances/thor/configuration.nix
|
||||
|
||||
# Additional services
|
||||
./nixos/virtualization.nix
|
||||
./nixos/steam.nix # Steam gaming platform
|
||||
./nixos/ollama.nix # AI/LLM service
|
||||
# ./nixos/ollama-ui.nix # Web UI for Ollama
|
||||
./nixos/garage.nix # Object storage service
|
||||
|
||||
# User-specific home manager configuration
|
||||
{
|
||||
home-manager = {
|
||||
extraSpecialArgs = { inherit unstable; };
|
||||
users.bertof.imports = [
|
||||
inputs.nix-index-database.homeModules.nix-index
|
||||
./instances/thor/hm.nix
|
||||
];
|
||||
};
|
||||
}
|
||||
];
|
||||
});
|
||||
|
||||
|
||||
# ==================================================================
|
||||
# ODIN - Intel Laptop/Server Hybrid
|
||||
# ==================================================================
|
||||
odin = inputs.nixpkgs-s.lib.nixosSystem rec {
|
||||
system = "x86_64-linux";
|
||||
specialArgs = {
|
||||
stable = inputs.nixpkgs-s.legacyPackages.${system}; # Pass stable channel
|
||||
unstable = inputs.nixpkgs-u.legacyPackages.${system}; # Pass unstable channel
|
||||
};
|
||||
odin = withSystem "x86_64-linux" ({ unstable, system, ... }: inputs.nixpkgs-s.lib.nixosSystem {
|
||||
inherit system;
|
||||
specialArgs = { inherit unstable; };
|
||||
modules = [
|
||||
# Intel laptop hardware configurations
|
||||
inputs.nixos-hardware.nixosModules.common-cpu-intel
|
||||
|
|
@ -457,21 +467,21 @@
|
|||
self.nixosModules.bertof-rclone
|
||||
self.nixosModules.tiziano-rclone
|
||||
{
|
||||
home-manager.users.bertof = import ./instances/odin/hm.nix;
|
||||
home-manager.users.tiziano = import ./instances/odin/hm_tiziano.nix;
|
||||
home-manager = {
|
||||
extraSpecialArgs = { inherit unstable; };
|
||||
users.bertof = import ./instances/odin/hm.nix;
|
||||
users.tiziano = import ./instances/odin/hm_tiziano.nix;
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
});
|
||||
|
||||
# ==================================================================
|
||||
# HEIMDALL - AMD Server
|
||||
# ==================================================================
|
||||
heimdall = inputs.nixpkgs-s.lib.nixosSystem rec {
|
||||
system = "x86_64-linux";
|
||||
specialArgs = {
|
||||
stable = inputs.nixpkgs-s.legacyPackages.${system}; # Pass stable channel
|
||||
unstable = inputs.nixpkgs-u.legacyPackages.${system}; # Pass unstable channel
|
||||
};
|
||||
heimdall = withSystem "x86_64-linux" ({ unstable, system, ... }: inputs.nixpkgs-s.lib.nixosSystem {
|
||||
inherit system;
|
||||
specialArgs = { inherit unstable; };
|
||||
modules = [
|
||||
# AMD server hardware configurations
|
||||
inputs.nixos-hardware.nixosModules.common-cpu-amd
|
||||
|
|
@ -503,7 +513,10 @@
|
|||
self.nixosModules.bertof-rclone
|
||||
self.nixosModules.tiziano
|
||||
{
|
||||
home-manager.users.bertof = import ./instances/heimdall/hm.nix;
|
||||
home-manager = {
|
||||
extraSpecialArgs = { inherit unstable; };
|
||||
users.bertof = import ./instances/heimdall/hm.nix;
|
||||
};
|
||||
# GitLab Runner secrets for CI/CD
|
||||
age.secrets = {
|
||||
heimdall-gitlab-runner-nix.file = ./secrets/heimdall-gitlab-runner-nix.age;
|
||||
|
|
@ -512,7 +525,7 @@
|
|||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
});
|
||||
|
||||
# ==================================================================
|
||||
# FREYA - ARM64 System (Commented out)
|
||||
|
|
@ -539,12 +552,9 @@
|
|||
# ==================================================================
|
||||
# BALDUR - Intel Server
|
||||
# ==================================================================
|
||||
baldur = inputs.nixpkgs-s.lib.nixosSystem rec {
|
||||
system = "x86_64-linux";
|
||||
specialArgs = {
|
||||
stable = inputs.nixpkgs-s.legacyPackages.${system}; # Pass stable channel
|
||||
unstable = inputs.nixpkgs-u.legacyPackages.${system}; # Pass unstable channel
|
||||
};
|
||||
baldur = withSystem "x86_64-linux" ({ unstable, system, ... }: inputs.nixpkgs-s.lib.nixosSystem {
|
||||
inherit system;
|
||||
specialArgs = { inherit unstable; };
|
||||
modules = [
|
||||
# Intel server hardware configurations
|
||||
inputs.nixos-hardware.nixosModules.common-cpu-intel
|
||||
|
|
@ -572,11 +582,14 @@
|
|||
self.nixosModules.bertof
|
||||
self.nixosModules.tiziano
|
||||
{
|
||||
home-manager.users.bertof = import ./instances/baldur/hm.nix;
|
||||
home-manager.users.tiziano = import ./instances/baldur/hm_tiziano.nix;
|
||||
home-manager = {
|
||||
extraSpecialArgs = { inherit unstable; };
|
||||
users.bertof = import ./instances/baldur/hm.nix;
|
||||
users.tiziano = import ./instances/baldur/hm_tiziano.nix;
|
||||
};
|
||||
}
|
||||
];
|
||||
};
|
||||
});
|
||||
|
||||
# ==================================================================
|
||||
# LOKI - Intel System (Commented out)
|
||||
|
|
@ -600,7 +613,8 @@
|
|||
# ];
|
||||
# };
|
||||
};
|
||||
|
||||
};
|
||||
})
|
||||
];
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,4 @@
|
|||
{ pkgs, ... }:
|
||||
{ pkgs, unstable, ... }:
|
||||
{
|
||||
home.packages = builtins.attrValues {
|
||||
inherit (pkgs)
|
||||
# mendeley # Reference manager
|
||||
# logseq
|
||||
# drawio
|
||||
obsidian
|
||||
# zettlr
|
||||
zotero
|
||||
;
|
||||
};
|
||||
home.packages = [ pkgs.zotero unstable.obsidian ];
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue