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 - MAIN FLAKE DEFINITION
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
outputs = { self, ... }@inputs:
|
outputs = inputs:
|
||||||
# Common Nix configuration for all systems
|
# Common Nix configuration for all systems
|
||||||
let
|
let
|
||||||
nix-config = {
|
nix-config = {
|
||||||
|
|
@ -74,12 +74,15 @@
|
||||||
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
|
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
|
||||||
# Support all systems defined in inputs.systems
|
# Support all systems defined in inputs.systems
|
||||||
systems = import 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)
|
# Per-system configuration (applies to each system independently)
|
||||||
perSystem = { config, pkgs, system, ... }: {
|
perSystem = { config, pkgs, system, ... }: {
|
||||||
|
_module.args = {
|
||||||
# Import nixpkgs with custom configuration
|
# Import nixpkgs with custom configuration
|
||||||
_module.args.pkgs = import inputs.nixpkgs {
|
pkgs = import inputs.nixpkgs {
|
||||||
inherit system;
|
inherit system;
|
||||||
config = nix-config;
|
config = nix-config;
|
||||||
overlays = [
|
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 hooks configuration
|
||||||
pre-commit.settings.hooks = {
|
pre-commit.settings.hooks = {
|
||||||
deadnix.enable = true; # Remove dead code from Nix expressions
|
deadnix.enable = true; # Remove dead code from Nix expressions
|
||||||
|
|
@ -165,6 +178,7 @@
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
# ========================================================================
|
# ========================================================================
|
||||||
# FLAKE OUTPUTS - SHARED RESOURCES
|
# FLAKE OUTPUTS - SHARED RESOURCES
|
||||||
# ========================================================================
|
# ========================================================================
|
||||||
|
|
@ -271,14 +285,10 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
# Home Manager configuration module
|
# Home Manager configuration module
|
||||||
homeManagerModules = { config, ... }: {
|
homeManagerModules = {
|
||||||
home-manager = {
|
home-manager = {
|
||||||
useGlobalPkgs = true; # Use system packages globally
|
useGlobalPkgs = true; # Use system packages globally
|
||||||
useUserPackages = true; # Install packages to user profile
|
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
|
# NIXOS CONFIGURATIONS - SYSTEM DEFINITIONS
|
||||||
# ====================================================================
|
# ====================================================================
|
||||||
nixosConfigurations = {
|
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 - Intel Desktop System
|
||||||
# ==================================================================
|
# ==================================================================
|
||||||
sif = inputs.nixpkgs-s.lib.nixosSystem rec {
|
sif = withSystem "x86_64-linux" ({ unstable, system, ... }: inputs.nixpkgs-s.lib.nixosSystem {
|
||||||
system = "x86_64-linux";
|
inherit system;
|
||||||
specialArgs = {
|
specialArgs = { inherit unstable; };
|
||||||
stable = inputs.nixpkgs-s.legacyPackages.${system}; # Pass stable channel
|
|
||||||
unstable = inputs.nixpkgs-u.legacyPackages.${system}; # Pass unstable channel
|
|
||||||
};
|
|
||||||
modules = [
|
modules = [
|
||||||
# Intel-specific hardware configurations
|
# Intel-specific hardware configurations
|
||||||
inputs.nixos-hardware.nixosModules.common-cpu-intel-cpu-only
|
inputs.nixos-hardware.nixosModules.common-cpu-intel-cpu-only
|
||||||
|
|
@ -413,23 +378,68 @@
|
||||||
|
|
||||||
# User-specific home manager configuration
|
# 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
|
inputs.nix-index-database.homeModules.nix-index
|
||||||
./instances/sif/hm.nix
|
./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 - Intel Laptop/Server Hybrid
|
||||||
# ==================================================================
|
# ==================================================================
|
||||||
odin = inputs.nixpkgs-s.lib.nixosSystem rec {
|
odin = withSystem "x86_64-linux" ({ unstable, system, ... }: inputs.nixpkgs-s.lib.nixosSystem {
|
||||||
system = "x86_64-linux";
|
inherit system;
|
||||||
specialArgs = {
|
specialArgs = { inherit unstable; };
|
||||||
stable = inputs.nixpkgs-s.legacyPackages.${system}; # Pass stable channel
|
|
||||||
unstable = inputs.nixpkgs-u.legacyPackages.${system}; # Pass unstable channel
|
|
||||||
};
|
|
||||||
modules = [
|
modules = [
|
||||||
# Intel laptop hardware configurations
|
# Intel laptop hardware configurations
|
||||||
inputs.nixos-hardware.nixosModules.common-cpu-intel
|
inputs.nixos-hardware.nixosModules.common-cpu-intel
|
||||||
|
|
@ -457,21 +467,21 @@
|
||||||
self.nixosModules.bertof-rclone
|
self.nixosModules.bertof-rclone
|
||||||
self.nixosModules.tiziano-rclone
|
self.nixosModules.tiziano-rclone
|
||||||
{
|
{
|
||||||
home-manager.users.bertof = import ./instances/odin/hm.nix;
|
home-manager = {
|
||||||
home-manager.users.tiziano = import ./instances/odin/hm_tiziano.nix;
|
extraSpecialArgs = { inherit unstable; };
|
||||||
|
users.bertof = import ./instances/odin/hm.nix;
|
||||||
|
users.tiziano = import ./instances/odin/hm_tiziano.nix;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
};
|
});
|
||||||
|
|
||||||
# ==================================================================
|
# ==================================================================
|
||||||
# HEIMDALL - AMD Server
|
# HEIMDALL - AMD Server
|
||||||
# ==================================================================
|
# ==================================================================
|
||||||
heimdall = inputs.nixpkgs-s.lib.nixosSystem rec {
|
heimdall = withSystem "x86_64-linux" ({ unstable, system, ... }: inputs.nixpkgs-s.lib.nixosSystem {
|
||||||
system = "x86_64-linux";
|
inherit system;
|
||||||
specialArgs = {
|
specialArgs = { inherit unstable; };
|
||||||
stable = inputs.nixpkgs-s.legacyPackages.${system}; # Pass stable channel
|
|
||||||
unstable = inputs.nixpkgs-u.legacyPackages.${system}; # Pass unstable channel
|
|
||||||
};
|
|
||||||
modules = [
|
modules = [
|
||||||
# AMD server hardware configurations
|
# AMD server hardware configurations
|
||||||
inputs.nixos-hardware.nixosModules.common-cpu-amd
|
inputs.nixos-hardware.nixosModules.common-cpu-amd
|
||||||
|
|
@ -503,7 +513,10 @@
|
||||||
self.nixosModules.bertof-rclone
|
self.nixosModules.bertof-rclone
|
||||||
self.nixosModules.tiziano
|
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
|
# GitLab Runner secrets for CI/CD
|
||||||
age.secrets = {
|
age.secrets = {
|
||||||
heimdall-gitlab-runner-nix.file = ./secrets/heimdall-gitlab-runner-nix.age;
|
heimdall-gitlab-runner-nix.file = ./secrets/heimdall-gitlab-runner-nix.age;
|
||||||
|
|
@ -512,7 +525,7 @@
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
};
|
});
|
||||||
|
|
||||||
# ==================================================================
|
# ==================================================================
|
||||||
# FREYA - ARM64 System (Commented out)
|
# FREYA - ARM64 System (Commented out)
|
||||||
|
|
@ -539,12 +552,9 @@
|
||||||
# ==================================================================
|
# ==================================================================
|
||||||
# BALDUR - Intel Server
|
# BALDUR - Intel Server
|
||||||
# ==================================================================
|
# ==================================================================
|
||||||
baldur = inputs.nixpkgs-s.lib.nixosSystem rec {
|
baldur = withSystem "x86_64-linux" ({ unstable, system, ... }: inputs.nixpkgs-s.lib.nixosSystem {
|
||||||
system = "x86_64-linux";
|
inherit system;
|
||||||
specialArgs = {
|
specialArgs = { inherit unstable; };
|
||||||
stable = inputs.nixpkgs-s.legacyPackages.${system}; # Pass stable channel
|
|
||||||
unstable = inputs.nixpkgs-u.legacyPackages.${system}; # Pass unstable channel
|
|
||||||
};
|
|
||||||
modules = [
|
modules = [
|
||||||
# Intel server hardware configurations
|
# Intel server hardware configurations
|
||||||
inputs.nixos-hardware.nixosModules.common-cpu-intel
|
inputs.nixos-hardware.nixosModules.common-cpu-intel
|
||||||
|
|
@ -572,11 +582,14 @@
|
||||||
self.nixosModules.bertof
|
self.nixosModules.bertof
|
||||||
self.nixosModules.tiziano
|
self.nixosModules.tiziano
|
||||||
{
|
{
|
||||||
home-manager.users.bertof = import ./instances/baldur/hm.nix;
|
home-manager = {
|
||||||
home-manager.users.tiziano = import ./instances/baldur/hm_tiziano.nix;
|
extraSpecialArgs = { inherit unstable; };
|
||||||
|
users.bertof = import ./instances/baldur/hm.nix;
|
||||||
|
users.tiziano = import ./instances/baldur/hm_tiziano.nix;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
};
|
});
|
||||||
|
|
||||||
# ==================================================================
|
# ==================================================================
|
||||||
# LOKI - Intel System (Commented out)
|
# LOKI - Intel System (Commented out)
|
||||||
|
|
@ -600,7 +613,8 @@
|
||||||
# ];
|
# ];
|
||||||
# };
|
# };
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
})
|
||||||
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,4 @@
|
||||||
{ pkgs, ... }:
|
{ pkgs, unstable, ... }:
|
||||||
{
|
{
|
||||||
home.packages = builtins.attrValues {
|
home.packages = [ pkgs.zotero unstable.obsidian ];
|
||||||
inherit (pkgs)
|
|
||||||
# mendeley # Reference manager
|
|
||||||
# logseq
|
|
||||||
# drawio
|
|
||||||
obsidian
|
|
||||||
# zettlr
|
|
||||||
zotero
|
|
||||||
;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue