-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
113 lines (108 loc) · 3.47 KB
/
flake.nix
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
{
description = "NixOS system configuration";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.11";
home-manager = {
url = "github:nix-community/home-manager/release-24.11";
inputs.nixpkgs.follows = "nixpkgs";
};
sops-nix.url = "github:Mic92/sops-nix";
};
outputs = { self, nixpkgs, home-manager, sops-nix }:
let
supportedSystems = [ "x86_64-linux" "aarch64-linux" ];
forAllSystems = f:
nixpkgs.lib.genAttrs supportedSystems (system: f system);
in {
devShells = forAllSystems (system:
let pkgs = import nixpkgs { inherit system; };
in {
default = pkgs.mkShell {
packages = with pkgs; [
cmake
gcc13
meson
ninja
nixpkgs-fmt
python311
gdb
];
shellHook = ''
printf "Welcome to devshell\n"
'';
};
});
nixosConfigurations = let
x86_64Base = {
system = "x86_64-linux";
modules = with self.nixosModules; [
({ config = { nix.registry.nixpkgs.flake = nixpkgs; }; })
home-manager.nixosModules.home-manager
sops-nix.nixosModules.sops
traits.base
];
};
aarch64Base = {
system = "aarch64-linux";
modules = with self.nixosModules; [
({ config = { nix.registry.nixpkgs.flake = nixpkgs; }; })
home-manager.nixosModules.home-manager
sops-nix.nixosModules.sops
traits.base
];
};
in with self.nixosModules; {
# Lenovo Legion Y540
legion = nixpkgs.lib.nixosSystem {
inherit (x86_64Base) system;
modules = x86_64Base.modules ++ [
platforms.legion
traits.workstation
traits.gnome
traits.gamestation
users.nishal
];
};
# Cloud Arm VPS
gisela = nixpkgs.lib.nixosSystem {
inherit (aarch64Base) system;
modules = aarch64Base.modules
++ [ platforms.gisela traits.vps traits.immich users.nishal ];
};
# Raspberry Pi Image
rPiImage = nixpkgs.lib.nixosSystem {
inherit (aarch64Base) system;
modules = aarch64Base.modules ++ [
platforms.rpi
users.nishal
{
config = {
nixpkgs.config.allowUnsupportedSystem = true;
nixpkgs.hostPlatform.system = "aarch64-linux";
nixpkgs.buildPlatform.system = "aarch64-linux";
# Access temporary wireless network for headless install
# Not safe
networking.wireless.networks = {
nixTmpWifi = { };
};
};
}
];
};
};
nixosModules = {
platforms.gisela = ./platforms/gisela.nix;
platforms.legion = ./platforms/legion.nix;
platforms.rpi =
"${nixpkgs}/nixos/modules/installer/sd-card/sd-image-raspberrypi.nix";
traits.base = ./traits/base.nix;
traits.gamestation = ./traits/gamestation.nix;
traits.gnome = ./traits/gnome.nix;
traits.immich = ./traits/immich.nix;
traits.nextcloud = ./traits/nextcloud.nix;
traits.vps = ./traits/vps.nix;
traits.workstation = ./traits/workstation.nix;
users.nishal = ./users/nishal;
};
};
}