summaryrefslogtreecommitdiff
path: root/flake.nix
blob: 3662ed97bdf7733838171356c351615391ce3b39 (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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
{
  description = "NixOS config (clean direct flake)";

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-25.11"; # nixpkgs stable; used as the default source for all packages.
    nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; # unstable for when stable is too behind (called by prefixing the pkg with 'unstable.')

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

    stylix = {
      # Colorscheme and general style handling
      url = "github:danth/stylix/release-25.11";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    fenix = {
      # Rust tool-chain handler
      url = "github:nix-community/fenix";
      inputs.nixpkgs.follows = "nixpkgs-unstable";
    };

    nixcord.url = "github:FlameFlag/nixcord"; # NixOS discord flake

    nixos-hardware.url = "github:NixOS/nixos-hardware"; # NixOS hardware flake for simpler system specific optimisation
    agenix = {
      url = "github:ryantm/agenix";
      nixpkgs.follows = "nixpkgs";
      # choose not to download darwin deps (saves some resources on Linux)
      darwin.follows = "";
    };
  };

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

    overlays = [
      (final: prev: {
        unstable = import nixpkgs-unstable {
          # handle the unstable prefix
          inherit system;
          config.allowUnfree = true;
        };
      })

      fenix.overlays.default
    ];
  in {
    nixosConfigurations = {
      ##################################### MYSTRA X220 MAIN LAPTOP (HARDENED) #####################################
      mystra = nixpkgs.lib.nixosSystem {
        inherit system;

        specialArgs = {inherit inputs;};

        modules = [
          {
            nixpkgs = {
              inherit overlays;
              config.allowUnfree = true;
            };
          }

          nixos-hardware.nixosModules.lenovo-thinkpad-x220
          agenix.nixosModules.default
          agenix.homeManagerModules.default # Install the agenix hM module aswell

          ./hosts/mystra/configuration.nix
          ./system

          stylix.nixosModules.stylix
          home-manager.nixosModules.home-manager

          {
            home-manager.users.mun.imports = [
              ./home/mun
              ./home/rices/schrottkatze/home.nix
            ];
          }
        ];
      };
      ##################################### HERRA HOME WORKSTATION #####################################
      herra = nixpkgs.lib.nixosSystem {
        inherit system;

        specialArgs = {inherit inputs;};

        modules = [
          {
            nixpkgs = {
              inherit overlays;
              config.allowUnfree = true;
            };
          }

          # TODO: Add amd gpu and intel cpu nixosnixos-hardware configs
          agenix.nixosModules.default
          agenix.homeManagerModules.default # Install the agenix hM module aswell

          ./hosts/herra/configuration.nix
          ./system

          stylix.nixosModules.stylix
          home-manager.nixosModules.home-manager

          {
            home-manager.users.mun.imports = [
              ./home/mun
              ./home/rices/cinnamon/home.nix
            ];
          }
        ];
      };
      ##################################### KRONOS HP ELITEBOOK CURRENT MAIN (BACKUP, HARDENED) LAPTOP #####################################
      kronos = nixpkgs.lib.nixosSystem {
        inherit system;

        specialArgs = {inherit inputs;};

        modules = [
          {
            nixpkgs = {
              inherit overlays;
              config.allowUnfree = true;
            };
          }
          nixos-hardware.nixosModules.hp-elitebook-830g6
          agenix.nixosModules.default
          agenix.homeManagerModules.default # Install the agenix hM module aswell

          ./hosts/kronos/configuration.nix
          ./system

          stylix.nixosModules.stylix
          home-manager.nixosModules.home-manager

          {
            home-manager.users.mun.imports = [
              ./home/mun
              ./home/rices/nord-blue/home.nix
            ];
          }
        ];
      };
    };
  };
}