Skip to content

Commit a51442d

Browse files
committed
switch to nixfmt
1 parent e29e584 commit a51442d

39 files changed

+714
-431
lines changed

config/vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
"svg.preview.mode": "svg",
8181
"nix.enableLanguageServer": true,
8282
"settingsSync.ignoredSettings": ["-rust-analyzer.server.path"],
83-
"nixfmt.path": "nixpkgs-fmt",
83+
"nixfmt.path": "nixfmt",
8484
"terminal.integrated.tabs.hideCondition": "singleGroup",
8585
"[properties]": {
8686
"editor.defaultFormatter": "foxundermoon.shell-format"

flake.nix

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,16 @@
66
flake-utils.url = "github:numtide/flake-utils";
77
};
88

9-
outputs = { flake-utils, nixpkgs, ... }:
10-
flake-utils.lib.eachDefaultSystem (system:
9+
outputs =
10+
{ flake-utils, nixpkgs, ... }:
11+
flake-utils.lib.eachDefaultSystem (
12+
system:
1113
let
1214
pkgs = import nixpkgs { inherit system; };
1315
in
1416
{
17+
formatter = pkgs.nixfmt-rfc-style;
1518
devShells.default = import ./nix/shells/nix.nix { inherit pkgs; };
16-
});
19+
}
20+
);
1721
}

nix/darwin/default.nix

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
1-
{ config, lib, pkgs, ... }:
1+
{
2+
config,
3+
lib,
4+
pkgs,
5+
...
6+
}:
27

38
let
49
homeBase = import ../home { systemConfig = config; };
510
mode = config.igm.mode;
611
in
7-
with lib; {
12+
with lib;
13+
{
814
environment.systemPackages = with pkgs; [
915
vim
1016
# Tor install is currently broken 2023-11-28
@@ -36,7 +42,10 @@ with lib; {
3642
configureBuildUsers = true;
3743
settings = {
3844
sandbox = false;
39-
trusted-users = [ "root" "igm" ];
45+
trusted-users = [
46+
"root"
47+
"igm"
48+
];
4049
};
4150
extraOptions = ''
4251
experimental-features = nix-command flakes

nix/darwin/homebrew.nix

Lines changed: 54 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ let
1111
mode = config.igm.mode;
1212
isM1 = config.igm.isM1;
1313
in
14-
with lib; rec {
14+
with lib;
15+
rec {
1516

1617
enable = true;
1718

@@ -33,47 +34,57 @@ with lib; rec {
3334
"source-foundry/taproom"
3435
];
3536

36-
brews = (lib.optionals (!isM1) [ "openssl" "[email protected]" ]) ++ [
37-
"yabai"
38-
"skhd"
39-
"sui"
40-
];
37+
brews =
38+
(lib.optionals (!isM1) [
39+
"openssl"
40+
41+
])
42+
++ [
43+
"yabai"
44+
"skhd"
45+
"sui"
46+
];
4147

42-
casks = [
43-
"android-studio"
44-
"anki"
45-
"arc"
46-
"brave-browser"
47-
# "dashlane"
48-
"discord"
49-
"docker"
50-
"figma"
51-
"google-chrome"
52-
"keybase"
53-
"linear-linear"
54-
"ngrok"
55-
"notion"
56-
"numi"
57-
"postman"
58-
"private-internet-access"
59-
"raycast"
60-
"slack"
61-
"sourcefoundry-slice"
62-
"spaceid"
63-
"spotify"
64-
"tableplus"
65-
"the-unarchiver"
66-
"zoom"
67-
] ++ (lib.optionals (mode == "personal") ([
68-
"google-drive"
69-
"ledger-live"
70-
"obsidian"
71-
"signal"
72-
"telegram"
73-
"tor-browser"
74-
"transmission"
75-
"vlc"
76-
"wechat"
77-
"whatsapp@beta"
78-
] ++ games));
48+
casks =
49+
[
50+
"android-studio"
51+
"anki"
52+
"arc"
53+
"brave-browser"
54+
# "dashlane"
55+
"discord"
56+
"docker"
57+
"figma"
58+
"google-chrome"
59+
"keybase"
60+
"linear-linear"
61+
"ngrok"
62+
"notion"
63+
"numi"
64+
"postman"
65+
"private-internet-access"
66+
"raycast"
67+
"slack"
68+
"sourcefoundry-slice"
69+
"spaceid"
70+
"spotify"
71+
"tableplus"
72+
"the-unarchiver"
73+
"zoom"
74+
]
75+
++ (lib.optionals (mode == "personal") (
76+
[
77+
"google-drive"
78+
"ledger-live"
79+
"obsidian"
80+
"signal"
81+
"telegram"
82+
"tor-browser"
83+
"transmission"
84+
"vlc"
85+
"wechat"
86+
"whatsapp@beta"
87+
]
88+
++ games
89+
));
7990
}

nix/flake.nix

Lines changed: 99 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -21,84 +21,116 @@
2121
};
2222

2323
outputs =
24-
{ nixpkgs
25-
, home-manager
26-
, darwin
27-
, vscode-server
28-
, saber-overlay
29-
, flake-utils
30-
, rnix-lsp
31-
, ...
24+
{
25+
nixpkgs,
26+
home-manager,
27+
darwin,
28+
vscode-server,
29+
saber-overlay,
30+
flake-utils,
31+
rnix-lsp,
32+
...
3233
}:
3334
let
3435
mkPrivate = import ./private;
3536

36-
mkNixosSystem = { modules, additionalOverlays ? [ ], igm ? { } }:
37+
mkNixosSystem =
38+
{
39+
modules,
40+
additionalOverlays ? [ ],
41+
igm ? { },
42+
}:
3743
let
3844
system = "x86_64-linux";
3945
in
4046
nixpkgs.lib.nixosSystem {
4147
inherit system;
4248
modules = [
43-
({ ... }: {
44-
inherit igm;
45-
})
46-
({ ... }: {
47-
imports = [ "${vscode-server}/default.nix" ];
48-
})
49+
(
50+
{ ... }:
51+
{
52+
inherit igm;
53+
}
54+
)
55+
(
56+
{ ... }:
57+
{
58+
imports = [ "${vscode-server}/default.nix" ];
59+
}
60+
)
4961
(import ./system.nix {
5062
isLinux = true;
5163
})
5264
home-manager.nixosModules.home-manager
5365
({
5466
nixpkgs = import ./nixpkgs/config.nix {
55-
additionalOverlays = [ saber-overlay.overlays.default ] ++ additionalOverlays ++ [
56-
(self: super: {
57-
rnix-lsp = rnix-lsp.defaultPackage.${system};
58-
})
59-
];
67+
additionalOverlays =
68+
[ saber-overlay.overlays.default ]
69+
++ additionalOverlays
70+
++ [
71+
(self: super: {
72+
rnix-lsp = rnix-lsp.defaultPackage.${system};
73+
})
74+
];
6075
};
6176
})
6277
] ++ modules;
6378
};
6479

65-
mkDarwinSystem = { isM1 ? false, additionalOverlays ? [ ], modules ? [ ], computerName, hostName }:
80+
mkDarwinSystem =
81+
{
82+
isM1 ? false,
83+
additionalOverlays ? [ ],
84+
modules ? [ ],
85+
computerName,
86+
hostName,
87+
}:
6688
let
6789
system = if isM1 then "aarch64-darwin" else "x86_64-darwin";
6890
in
6991
darwin.lib.darwinSystem {
7092
inherit system;
71-
modules = [
72-
({ ... }:
93+
modules =
94+
[
95+
(
96+
{ ... }:
97+
{
98+
igm = {
99+
inherit isM1;
100+
mode = "personal";
101+
};
102+
nixpkgs = import ./nixpkgs/config.nix {
103+
isDarwin = true;
104+
additionalOverlays =
105+
[ saber-overlay.overlays.default ]
106+
++ additionalOverlays
107+
++ [
108+
(self: super: {
109+
rnix-lsp = rnix-lsp.defaultPackage.${system};
110+
})
111+
];
112+
};
113+
}
114+
)
115+
(import ./system.nix { isDarwin = true; })
116+
home-manager.darwinModules.home-manager
117+
]
118+
++ modules
119+
++ [
73120
{
74-
igm = {
75-
inherit isM1;
76-
mode = "personal";
121+
networking = {
122+
inherit computerName hostName;
123+
localHostName = hostName;
77124
};
78-
nixpkgs = import ./nixpkgs/config.nix {
79-
isDarwin = true;
80-
additionalOverlays = [ saber-overlay.overlays.default ] ++ additionalOverlays ++ [
81-
(self: super: {
82-
rnix-lsp = rnix-lsp.defaultPackage.${system};
83-
})
84-
];
85-
};
86-
})
87-
(import ./system.nix { isDarwin = true; })
88-
home-manager.darwinModules.home-manager
89-
] ++ modules ++ [
90-
{
91-
networking = {
92-
inherit computerName hostName;
93-
localHostName = hostName;
94-
};
95-
services.nix-daemon.enable = true;
96-
}
97-
];
125+
services.nix-daemon.enable = true;
126+
}
127+
];
98128
};
99129
in
100130
{
101-
lib = { inherit mkNixosSystem mkDarwinSystem mkPrivate; };
131+
lib = {
132+
inherit mkNixosSystem mkDarwinSystem mkPrivate;
133+
};
102134
nixosConfigurations.ci-home = mkNixosSystem {
103135
igm = {
104136
pure = true;
@@ -136,7 +168,8 @@
136168
computerName = "igm-darwin-ci-m1";
137169
hostName = "igm-darwin-ci-m1";
138170
};
139-
} // (
171+
}
172+
// (
140173
let
141174
supportedSystems = [
142175
"aarch64-linux"
@@ -147,24 +180,29 @@
147180
"x86_64-linux"
148181
];
149182
in
150-
(flake-utils.lib.eachSystem supportedSystems
151-
(system:
183+
(flake-utils.lib.eachSystem supportedSystems (
184+
system:
152185
let
153-
nixpkgs-config-public = (import ./nixpkgs/config.nix rec {
154-
isDarwin = nixpkgs.legacyPackages.${system}.lib.hasSuffix "-darwin" system;
186+
nixpkgs-config-public = (
187+
import ./nixpkgs/config.nix rec {
188+
isDarwin = nixpkgs.legacyPackages.${system}.lib.hasSuffix "-darwin" system;
155189

156-
# There are lots of wrongfully broken packages on Darwin
157-
# https://github.com/NixOS/nixpkgs/pull/173671
158-
allowBroken = isDarwin;
159-
});
160-
pkgs = import nixpkgs
161-
{
190+
# There are lots of wrongfully broken packages on Darwin
191+
# https://github.com/NixOS/nixpkgs/pull/173671
192+
allowBroken = isDarwin;
193+
}
194+
);
195+
pkgs =
196+
import nixpkgs {
162197
inherit system;
163198
inherit (nixpkgs-config-public) config overlays;
164-
} // saber-overlay.packages.${system};
199+
}
200+
// saber-overlay.packages.${system};
165201
in
166-
rec {
202+
{
203+
formatter = pkgs.nixfmt-rfc-style;
167204
packages = import ./shells { inherit pkgs; };
168-
}))
205+
}
206+
))
169207
);
170208
}

0 commit comments

Comments
 (0)