-
Notifications
You must be signed in to change notification settings - Fork 1
/
flake.nix
136 lines (127 loc) · 5.16 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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
{
description = "AJ's Flake";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05";
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
};
outputs = inputs@{ self, nixpkgs, nixpkgs-unstable, nixos-hardware }:
let
supportedSystems = [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" ];
forAllSystems = f: nixpkgs.lib.genAttrs supportedSystems (system: f system);
in
{
overlays.default = final: prev: {
unstable = import inputs.nixpkgs-unstable {
config.allowUnfree = true;
system = final.system;
};
vscodeConfigured = final.callPackage ./packages/vscode.nix { };
fishConfigured = final.callPackage ./packages/fish/config.nix { };
nrfdfuConfigured = final.callPackage ./packages/nrfdfu.nix { };
};
packages = forAllSystems
(system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ self.overlays.default ];
config.allowUnfree = true;
};
in
{
inherit (pkgs) fishConfigured vscodeConfigured nrfdfuConfigured;
});
devShells = forAllSystems
(system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ self.overlays.default ];
};
in
{
default = pkgs.mkShell
{
inputsFrom = with pkgs; [ ];
buildInputs = with pkgs; [
nixpkgs-fmt
];
};
});
nixosConfigurations =
let
wolfhowlBase = {
system = "x86_64-linux";
modules = with self.nixosModules; [
trait.overlay
trait.base
trait.hardened
trait.machine
trait.tools
user.aj
];
};
ironyBase = {
system = "x86_64-linux";
modules = with self.nixosModules; [
trait.overlay
trait.base
trait.hardened
trait.machine
trait.tools
user.aj
];
};
in
with self.nixosModules; {
wolfhowl = nixpkgs.lib.nixosSystem {
inherit (wolfhowlBase) system;
modules = wolfhowlBase.modules ++ [
platform.wolfhowl
trait.workstation
trait.jetbrains
];
};
irony = nixpkgs.lib.nixosSystem {
inherit (ironyBase) system;
modules = ironyBase.modules ++ [
platform.irony
trait.workstation
trait.jetbrains
nixos-hardware.nixosModules.lenovo-thinkpad-t14-amd-gen2
];
};
};
nixosModules = {
platform.wolfhowl = ./platform/wolfhowl.nix;
platform.irony = ./platform/irony.nix;
trait.overlay = { nixpkgs.overlays = [ self.overlays.default ]; };
trait.base = ./trait/base.nix;
trait.machine = ./trait/machine.nix;
trait.tools = ./trait/tools.nix;
trait.jetbrains = ./trait/jetbrains.nix;
trait.hardened = ./trait/hardened.nix;
trait.sourceBuild = ./trait/source-build.nix;
# This trait is unfriendly to being bundled with platform-iso
trait.workstation = ./trait/workstation.nix;
user.aj = ./user/aj.nix;
};
checks = forAllSystems (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ self.overlays.default ];
};
in
{
format = pkgs.runCommand "check-format"
{
buildInputs = with pkgs; [ rustfmt cargo ];
} ''
${pkgs.nixpkgs-fmt}/bin/nixpkgs-fmt --check ${./.}
touch $out # it worked!
'';
});
};
}