-
Notifications
You must be signed in to change notification settings - Fork 1
/
flake.nix
79 lines (72 loc) · 2.56 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
{
inputs = {
nixpkgs = {
url = "github:nixos/nixpkgs/nixos-24.05";
};
nixpkgs-unstable = {
url = "github:nixos/nixpkgs/nixos-unstable";
};
nixos-hardware.url = "github:nixos/nixos-hardware";
nixos-hardware-patched.url = "github:humaidq/nixos-hardware";
home-manager = {
url = "github:nix-community/home-manager/release-24.05";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, nixpkgs-unstable, nixos-hardware, home-manager, nixos-hardware-patched, ... }@inputs:
let
supportedSystems = [
"x86_64-linux"
"aarch64-linux"
"riscv64-linux"
"x86_64-darwin"
"aarch64-darwin"
];
forAllSupportedSystems = nixpkgs.lib.genAttrs supportedSystems;
in rec {
nixosModules.star64 = ./configuration.nix;
nixosModules."8gb-patch" = {
hardware.deviceTree.overlays = [{
name = "8GB-patch";
dtsFile = "${nixos-hardware}/pine64/star64/star64-8GB.dts";
}];
};
# Copies ./configuration.nix to /etc/nixos
nixosModules.copyConfiguration = {
sdImage.populateRootCommands = ''
mkdir -p ./files/etc/nixos
cp ${./configuration.nix} ./files/etc/nixos/configuration.nix
'';
};
nixosConfigurations.star64 = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs; };
modules = [ nixosModules.star64 nixosModules.copyConfiguration ];
};
nixosConfigurations.star64-8gb = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs; };
modules = [ nixosModules.star64 nixosModules.copyConfiguration nixosModules."8gb-patch" ];
};
packages = forAllSupportedSystems (system: rec {
default = sd-image;
sd-image = nixosConfigurations.star64.config.system.build.sdImage;
sd-image-8gb = nixosConfigurations.star64-8gb.config.system.build.sdImage;
sd-image-cross = (nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs; };
modules = [
nixosModules.star64
nixosModules.copyConfiguration
{ nixpkgs.buildPlatform = system; }
];
}).config.system.build.sdImage;
sd-image-cross-8gb = (nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs; };
modules = [
nixosModules.star64
nixosModules.copyConfiguration
{ nixpkgs.buildPlatform = system; }
nixosModules."8gb-patch"
];
}).config.system.build.sdImage;
});
};
}