~ruther/nixos-config

ref: e3c820b6e5ae7ed8d518520b49c8141247c3499b nixos-config/hosts/default.nix -rw-r--r-- 4.6 KiB
e3c820b6 — Frantisek Bohacek feat: add new laptop phobos 1 year, 4 months ago
                                                                                
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
#
#  These are the different profiles that can be used when building NixOS.
#
#  flake.nix 
#   └─ ./hosts  
#       ├─ default.nix *
#       ├─ configuration.nix
#       ├─ home.nix
#       └─ ./desktop OR ./laptop OR ./work OR ./vm
#            ├─ ./default.nix
#            └─ ./home.nix 
#

{ lib, inputs, nixpkgs, nixpkgs-stable, nix-index-database, home-manager, nur, user, location, ... }:

let
  system = "x86_64-linux";                                  # System architecture

  pkgs = import nixpkgs {
    inherit system;
    config.allowUnfree = true;                              # Allow proprietary software
  };

  stable = import nixpkgs-stable {
    inherit system;
    config.allowUnfree = true;                              # Allow proprietary software
  };

  lib = nixpkgs.lib;
in
{

  laptop-iapetus = lib.nixosSystem {                                # Laptop profile
    # Ideapad S540
    inherit system;
    specialArgs = {
      inherit inputs stable user location;
    };
    modules = [
      inputs.nixos-hardware.nixosModules.common-cpu-intel
      inputs.nixos-hardware.nixosModules.common-gpu-intel
      inputs.nixos-hardware.nixosModules.common-pc-laptop
      inputs.nixos-hardware.nixosModules.common-pc-laptop-acpi_call
      inputs.nixos-hardware.nixosModules.common-pc-laptop-ssd
      nur.nixosModules.nur
      { nixpkgs.overlays = [ nur.overlay ]; }
      ./laptop-iapetus
      ./configuration.nix

      home-manager.nixosModules.home-manager {
        home-manager.useUserPackages = true;
        home-manager.extraSpecialArgs = {
          inherit inputs stable user location;
        };
        home-manager.users.${user} = {
          imports = [
            nur.hmModules.nur
            nix-index-database.hmModules.nix-index
            { nixpkgs.overlays = [ nur.overlay ]; }
            (import ./home.nix)
            (import ./laptop-iapetus/home.nix)
          ];
        };
      }
    ];
  };

  laptop-phobos = lib.nixosSystem {                                # Laptop profile
    # Thinkpad T14s
    inherit system;
    specialArgs = {
      inherit inputs stable user location;
    };
    modules = [
      inputs.nixos-hardware.nixosModules.lenovo-thinkpad-t14s-amd-gen1
      nur.nixosModules.nur
      { nixpkgs.overlays = [ nur.overlay ]; }
      ./laptop-phobos
      ./configuration.nix

      home-manager.nixosModules.home-manager {
        home-manager.useUserPackages = true;
        home-manager.extraSpecialArgs = {
          inherit inputs stable user location;
        };
        home-manager.users.${user} = {
          imports = [
            nur.hmModules.nur
            nix-index-database.hmModules.nix-index
            { nixpkgs.overlays = [ nur.overlay ]; }
            (import ./home.nix)
            (import ./laptop-phobos/home.nix)
          ];
        };
      }
    ];
  };

  desktop-clotho = lib.nixosSystem {                               # Desktop profile
    inherit system;
    specialArgs = {
      inherit inputs stable system user location;
    };                                                      # Pass flake variable
    modules = [                                             # Modules that are used.
      nur.nixosModules.nur
      { nixpkgs.overlays = [ nur.overlay ]; }
      ./desktop-clotho
      ./configuration.nix

      home-manager.nixosModules.home-manager {              # Home-Manager module that is used.
        home-manager.useUserPackages = true;
        home-manager.extraSpecialArgs = {
          inherit inputs stable user location;
        };                                                  # Pass flake variable
        home-manager.users.${user} = {
          imports = [
            nur.hmModules.nur
            nix-index-database.hmModules.nix-index
            { nixpkgs.overlays = [ nur.overlay ]; }
            ./home.nix
            ./desktop-clotho/home.nix
          ];
        };
      }
    ];
  };

  vm = lib.nixosSystem {                                    # VM profile
    inherit system;
    specialArgs = {
      inherit inputs stable user location;
    };
    modules = [
      nur.nixosModules.nur
      { nixpkgs.overlays = [ nur.overlay ]; }
      ./vm
      ./configuration.nix

      home-manager.nixosModules.home-manager {
        home-manager.useUserPackages = true;
        home-manager.extraSpecialArgs = {
          inherit inputs stable user location;
        };
        home-manager.users.${user} = {
          imports = [
            nur.hmModules.nur
            nix-index-database.hmModules.nix-index
            { nixpkgs.overlays = [ nur.overlay ]; }
            (import ./home.nix)
            (import ./vm/home.nix)
          ];
        };
      }
    ];
  };
}
Do not follow this link