aboutsummaryrefslogtreecommitdiff
path: root/flake.nix
blob: 914ab995f0cc9dae869a6363e4c2efd07e94c2f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
{
  description = "NixOS configuration for multiple machines with modular home-manager and rice support";

  inputs = {
    # Core
    nixpkgs.url = "github:nixos/nixpkgs/nixos-25.11";
    nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable";

    # Home Manager
    home-manager = {
      url = "github:nix-community/home-manager/release-25.11";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    # NixOwOs theming - disabled until fixed
    nixowos = {
      url = "github:yunfachi/NixOwOS";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    # Theming - centralized color management
    stylix = {
      url = "github:danth/stylix/release-25.11";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    # Rust toolchain
    fenix = {
      url = "github:nix-community/fenix";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    # Rust build system for Nix
    crane.url = "github:ipetkov/crane";
  };

  outputs = {
    self,
    nixpkgs,
    nixpkgs-unstable,
    nixowos,
    home-manager,
    stylix,
    fenix,
    crane,
    ...
  } @ inputs: let
    system = "x86_64-linux";

    # Overlays for the system
    overlays = [
      # Access unstable packages via pkgs.unstable.*
      (final: prev: {
        unstable = import nixpkgs-unstable {
          inherit system;
          config.allowUnfree = true;
        };
      })
      # Fenix Rust overlay
      fenix.overlays.default
    ];

    # Shared home-manager configuration
    homeManagerModule = {
      home-manager = {
        useGlobalPkgs = true;
        useUserPackages = true;
        extraSpecialArgs = {inherit inputs;};
        users.mun = import ./home/mun;
        sharedModules = [
          nixowos.homeModules.default
        ];
      };
    };

    # Helper to create a NixOS system
    mkSystem = hostname:
      nixpkgs.lib.nixosSystem {
        inherit system;
        specialArgs = {inherit inputs;};
        modules = [
          # Apply overlays via nixpkgs module
          {
            nixpkgs = {
              inherit overlays;
              config.allowUnfree = true;
            };
          }
          ./hosts/${hostname}/configuration.nix
          ./system
          home-manager.nixosModules.home-manager
          nixowos.nixosModules.default
          stylix.nixosModules.stylix
          homeManagerModule
        ];
      };
  in {
    nixosConfigurations = {
      kronos = mkSystem "kronos";
      herra = mkSystem "herra";
    };
  };
}