~ruther/nixos-config

ref: aa83d31c3e79f914f1b8a53dd4d95fefad04dec1 nixos-config/hosts/default.nix -rw-r--r-- 3.8 KiB
aa83d31c — Rutherther fix: use nixosModules output from nixos-hardware 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
#
#  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)
          ];
        };
      }
    ];
  };

  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