Skip to content
This repository was archived by the owner on Dec 28, 2023. It is now read-only.

Commit a83ff17

Browse files
committed
Add darwin profile and darwin-update, add homebrew, install nerdfonts on darwin
1 parent 11344f8 commit a83ff17

File tree

11 files changed

+176
-59
lines changed

11 files changed

+176
-59
lines changed

darwin/rekkbook/default.nix

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
{
44
imports = with inputs; [
5-
self.roles.base
5+
self.roles.darwin
66
self.profiles.users.rekk
7+
./homebrew.nix
78
];
89
}

darwin/rekkbook/homebrew.nix

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{ ... }:
2+
3+
{
4+
homebrew = {
5+
enable = true;
6+
onActivation = { autoUpdate = false; };
7+
brews = [
8+
{
9+
name = "yabai";
10+
start_service = true;
11+
restart_service = "changed";
12+
}
13+
{
14+
name = "skhd";
15+
start_service = true;
16+
restart_service = "changed";
17+
}
18+
];
19+
casks = [
20+
"iterm2"
21+
"firefox"
22+
];
23+
taps = [
24+
"koekeishiya/formulae"
25+
];
26+
};
27+
}

flake.nix

+2-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@
3131
outputs = inputs:
3232
let
3333
lib = import ./profiles/lib { inherit inputs; };
34-
overlaySrcs = builtins.attrValues (lib.findModules ./overlays);
34+
overlayModules = lib.findModules ./overlays;
35+
overlaySrcs = [ overlayModules.pkgs ] ++ (with builtins; attrValues (removeAttrs overlayModules [ "pkgs" ]));
3536
mkOverlay = o: import o {
3637
inherit lib inputs;
3738
overlays = overlaySrcs;

overlays/nix-monitored.nix

+12
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,18 @@ self: super: {
77
nix = self.nix-monitored;
88
};
99

10+
darwin-rebuild = super.darwin-rebuild.override {
11+
nix = self.nix-monitored;
12+
};
13+
14+
nixos-update = super.nixos-update.override {
15+
nix = self.nix-monitored;
16+
};
17+
18+
darwin-update = super.darwin-update.override {
19+
nix = self.nix-monitored;
20+
};
21+
1022
nix-direnv = super.nix-direnv.override {
1123
nix = self.nix-monitored;
1224
};

overlays/pkgs/darwin-rebuild.nix

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{ inputs
2+
, lib
3+
, substituteAll
4+
, runtimeShell
5+
, nix
6+
}:
7+
8+
let
9+
writeProgram = name: env: src:
10+
substituteAll ({
11+
inherit name src;
12+
dir = "bin";
13+
isExecutable = true;
14+
} // env);
15+
in
16+
substituteAll {
17+
name = "darwin-rebuild";
18+
src = "${inputs.nix-darwin}/pkgs/nix-tools/darwin-rebuild.sh";
19+
dir = "bin";
20+
isExecutable = true;
21+
shell = runtimeShell;
22+
profile = "";
23+
path = lib.makeBinPath [ nix ];
24+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
set -e
2+
ensure_tmux nixos-update "$@"
3+
peval cd ~/Projects/NixOS
4+
peval nix flake update
5+
peval darwin-rebuild build --flake .
6+
peval nvd diff /run/current-system result
7+
if ask "Perform switch? (sudo)" y; then
8+
peval result/sw/bin/darwin-rebuild switch --flake .
9+
fi
+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{ inputs
2+
, writeShellApplication
3+
, shell-utils
4+
, nix
5+
, darwin-rebuild
6+
, nvd
7+
, tmux
8+
, systemd
9+
, ...
10+
}:
11+
12+
writeShellApplication {
13+
name = "darwin-update";
14+
text =
15+
inputs.lib.concatFiles [
16+
shell-utils
17+
./darwin-update.sh
18+
];
19+
runtimeInputs = [
20+
nix
21+
darwin-rebuild
22+
nvd
23+
tmux
24+
];
25+
}

overlays/pkgs/nixos-update/default.nix

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{ inputs
22
, writeShellApplication
33
, shell-utils
4-
, nix-output-monitor
4+
, nix
5+
, nixos-rebuild
56
, nvd
67
, tmux
78
, systemd
@@ -16,7 +17,8 @@ writeShellApplication {
1617
./nixos-update.sh
1718
];
1819
runtimeInputs = [
19-
nix-output-monitor
20+
nix
21+
nixos-rebuild
2022
nvd
2123
tmux
2224
systemd

overlays/pkgs/shell-utils/utils.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function ask()
1717
then echo -n " [Y/n] "
1818
else echo -n " [y/N] "
1919
fi
20-
tput dim
20+
tput dim || true
2121
read -r answer
2222
is_interactive || echo "$answer"
2323
tput sgr 0
@@ -45,7 +45,7 @@ function warn()
4545

4646
function info()
4747
{
48-
tput dim
48+
tput dim || true
4949
echo "${@}"
5050
tput sgr 0
5151
}

profiles/fonts.nix

+56-53
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,68 @@
1-
{ pkgs, ... }:
1+
{ pkgs, lib, ... }:
22

33
{
44
fonts = {
5-
fontconfig.enable = true;
65
fontDir.enable = true;
7-
enableGhostscriptFonts = true;
86
fonts = with pkgs; [
97
(nerdfonts.override {
108
fonts = [ "Cousine" "FiraCode" "RobotoMono" "SourceCodePro" ];
119
})
12-
carlito
13-
dejavu_fonts
14-
fira
15-
fira-code
16-
fira-mono
17-
inconsolata
18-
inter
19-
inter-ui
20-
libertine
21-
noto-fonts
22-
noto-fonts-emoji
23-
noto-fonts-extra
24-
roboto
25-
roboto-mono
26-
source-code-pro
27-
source-sans-pro
28-
source-serif-pro
29-
twitter-color-emoji
30-
unstable.corefonts
3110
];
11+
};
12+
} // lib.optionalAttrs pkgs.stdenv.isLinux {
13+
fonts.fontconfig.enable = true;
14+
fonts.enableGhostscriptFonts = true;
15+
fonts.fonts = with pkgs; [
16+
carlito
17+
dejavu_fonts
18+
fira
19+
fira-code
20+
fira-mono
21+
inconsolata
22+
inter
23+
inter-ui
24+
libertine
25+
noto-fonts
26+
noto-fonts-emoji
27+
noto-fonts-extra
28+
roboto
29+
roboto-mono
30+
source-code-pro
31+
source-sans-pro
32+
source-serif-pro
33+
twitter-color-emoji
34+
unstable.corefonts
35+
];
3236

33-
fontconfig.defaultFonts = {
34-
sansSerif = [ "Source Sans Pro" ];
35-
serif = [ "Source Serif Pro" ];
36-
monospace = [ "Fira Code Nerd Font" ];
37-
emoji = [ "Noto Color Emoji" ];
38-
};
39-
40-
fontconfig.localConf = ''
41-
<?xml version="1.0"?>
42-
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
43-
<fontconfig>
44-
<alias binding="weak">
45-
<family>monospace</family>
46-
<prefer>
47-
<family>emoji</family>
48-
</prefer>
49-
</alias>
50-
<alias binding="weak">
51-
<family>sans-serif</family>
52-
<prefer>
53-
<family>emoji</family>
54-
</prefer>
55-
</alias>
56-
<alias binding="weak">
57-
<family>serif</family>
58-
<prefer>
59-
<family>emoji</family>
60-
</prefer>
61-
</alias>
62-
</fontconfig>
63-
'';
37+
fontconfig.defaultFonts = {
38+
sansSerif = [ "Source Sans Pro" ];
39+
serif = [ "Source Serif Pro" ];
40+
monospace = [ "Fira Code Nerd Font" ];
41+
emoji = [ "Noto Color Emoji" ];
6442
};
43+
44+
fontconfig.localConf = ''
45+
<?xml version="1.0"?>
46+
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
47+
<fontconfig>
48+
<alias binding="weak">
49+
<family>monospace</family>
50+
<prefer>
51+
<family>emoji</family>
52+
</prefer>
53+
</alias>
54+
<alias binding="weak">
55+
<family>sans-serif</family>
56+
<prefer>
57+
<family>emoji</family>
58+
</prefer>
59+
</alias>
60+
<alias binding="weak">
61+
<family>serif</family>
62+
<prefer>
63+
<family>emoji</family>
64+
</prefer>
65+
</alias>
66+
</fontconfig>
67+
'';
6568
}

roles/darwin.nix

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{ inputs, pkgs, ... }:
2+
3+
{
4+
imports = with inputs; [
5+
self.roles.base
6+
self.profiles.fonts
7+
];
8+
9+
environment.systemPackages = with pkgs; [
10+
darwin-update
11+
iterm2
12+
];
13+
}

0 commit comments

Comments
 (0)