Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for macOS #29

Merged
merged 106 commits into from
Aug 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
106 commits
Select commit Hold shift + click to select a range
3f90ff9
start by adding a host for poseidon with minimum configuration
kalbasit Aug 8, 2021
c459d0a
pin to path
kalbasit Aug 8, 2021
de0cd9e
move to remove repo
kalbasit Aug 8, 2021
8c72932
the output must be given
kalbasit Aug 8, 2021
b558cf6
setup the builder
kalbasit Aug 8, 2021
1381c67
remove system from builder args
kalbasit Aug 8, 2021
823d29d
fix few more issues
kalbasit Aug 9, 2021
bca519c
identend comment
kalbasit Aug 9, 2021
3c68363
fix nixos building still getting systemd not found issue
kalbasit Aug 9, 2021
458c87a
move builder and output to soxin
kalbasit Aug 10, 2021
4488172
unrelated change to pin server profile to indended mode
kalbasit Aug 11, 2021
8c3ea60
update soxin to solve build
kalbasit Aug 11, 2021
c5291d4
enable things we will probably need
kalbasit Aug 11, 2021
f1563b5
configure nix-darwin in the core
kalbasit Aug 11, 2021
827aae0
scripts/host.sh add support for nix-darwin
kalbasit Aug 11, 2021
81eb420
update soxin
kalbasit Aug 11, 2021
916e719
oops, looped myself to death
kalbasit Aug 11, 2021
24c9ca9
import darwin home from configuration
kalbasit Aug 14, 2021
15457a9
fix zsh I broke earlier
kalbasit Aug 14, 2021
5412238
remove services that do not exist on darwin
kalbasit Aug 14, 2021
60a4f0f
remove darwin-incompatible modules
kalbasit Aug 14, 2021
701b356
autorandr does not work on darwin
kalbasit Aug 14, 2021
2b274a0
disable rbrowser
kalbasit Aug 14, 2021
1e22126
chromium does not work on darwin either
kalbasit Aug 14, 2021
51e0536
disable brave
kalbasit Aug 14, 2021
7b22f2d
disable termite
kalbasit Aug 14, 2021
dcbcd34
update soxin
kalbasit Aug 14, 2021
01cd45f
fix typo
kalbasit Aug 18, 2021
f5897bd
update soxin
kalbasit Aug 18, 2021
63e7284
update soxin
kalbasit Aug 18, 2021
6d2ad1e
fmt all files
kalbasit Aug 18, 2021
d29c2bc
Merge remote-tracking branch 'origin/main' into personal/soxin/suppor…
kalbasit Aug 18, 2021
d262e61
restore some externals to main
kalbasit Aug 18, 2021
c70b850
set user yl
kalbasit Aug 18, 2021
066b4b6
update soxin
kalbasit Aug 18, 2021
3c067df
add the environment to path
kalbasit Aug 18, 2021
7a81863
updato
kalbasit Aug 18, 2021
b6e0f85
update soxin
kalbasit Aug 18, 2021
addbf59
Merge remote-tracking branch 'origin/main' into personal/soxin/suppor…
kalbasit Mar 20, 2022
e53c259
wip
kalbasit Mar 29, 2022
2dcea65
Merge remote-tracking branch 'origin/main' into personal/soxin/suppor…
kalbasit Mar 29, 2022
5ee80e2
temporarly disable things
kalbasit Mar 29, 2022
f65775f
getting somewhere but I am now blocked by GitHub removal of git protocol
kalbasit Mar 29, 2022
48e5507
set users.users correctly for nixos/darwin but I still have no good h…
kalbasit Mar 30, 2022
8027374
wip
kalbasit Mar 31, 2022
5a93683
Merge remote-tracking branch 'origin/main' into personal/soxin/suppor…
kalbasit Mar 31, 2022
5e2f554
disable arion for now
kalbasit Mar 31, 2022
47551ff
update the lock file
kalbasit Mar 31, 2022
0c27bd1
override it properly
kalbasit Mar 31, 2022
54e283e
disable gpg sign and update HM
kalbasit Mar 31, 2022
4202e60
put nixos/nix-darwin stuff as common
kalbasit Mar 31, 2022
3826209
refactor more
kalbasit Mar 31, 2022
0204a6f
Merge branch 'main' into personal/soxin/support-mac
kalbasit Mar 31, 2022
2952f56
remove conflict marker
kalbasit Mar 31, 2022
d93d9da
darwins should be on unstable for now
kalbasit Mar 31, 2022
e20d6ac
update soxin
kalbasit Mar 31, 2022
cbd9f69
update the flake
kalbasit Mar 31, 2022
d91327d
update home-manager
kalbasit Apr 2, 2022
76cd9d8
Merge remote-tracking branch 'origin/main' into personal/soxin/suppor…
kalbasit Apr 2, 2022
8d1a0c9
enable starship
kalbasit Apr 2, 2022
b13c84d
wip
kalbasit Apr 5, 2022
377252c
enable onlykey
kalbasit Apr 6, 2022
8d39a97
commit what I found
kalbasit Apr 24, 2022
5c298aa
Merge remote-tracking branch 'origin/main' into personal/soxin/suppor…
kalbasit Apr 24, 2022
05be0a3
install openssh in my home
kalbasit Apr 24, 2022
96a374e
why swm not accepting --ignore-pattern, hmmm :thinking_face:
kalbasit Apr 25, 2022
79cdb68
EMPTY VIM
kalbasit Apr 26, 2022
4357550
Merge remote-tracking branch 'origin/main' into personal/soxin/suppor…
kalbasit May 28, 2022
e52c951
declare nix-darwin
kalbasit May 28, 2022
51a5a07
fix back the flake
kalbasit May 28, 2022
fdebec0
import neovim profile
kalbasit May 28, 2022
7e87470
disable onlykey gpg support on darwin
kalbasit May 28, 2022
0d93bb4
Merge remote-tracking branch 'origin/main' into personal/soxin/suppor…
kalbasit May 28, 2022
a5c063e
Merge branch 'main' into personal/soxin/support-mac
kalbasit Aug 27, 2023
68248a2
put the flake changes back
kalbasit Aug 27, 2023
fa7c8b5
remove old reference to kt
kalbasit Aug 27, 2023
92e28a9
update rest of hosts
kalbasit Aug 29, 2023
9298077
add os-specifc
kalbasit Aug 29, 2023
71ba072
remove two pkgs not available on darwin arm
kalbasit Aug 29, 2023
db89158
ensure /run exists
kalbasit Aug 30, 2023
62be3e1
updaet brews
kalbasit Aug 30, 2023
2feac5c
fix the name of the repo
kalbasit Aug 30, 2023
165da28
fix the build
kalbasit Aug 30, 2023
3881e98
move linux-specific init to its own conditional
kalbasit Aug 30, 2023
858dbef
update flake
kalbasit Aug 30, 2023
b5dc7c3
programs/zsh: do not reset the PATH
kalbasit Aug 30, 2023
3310d68
programs/zsh: use brew --prefix where /usr/local is used
kalbasit Aug 30, 2023
08b9b1f
clean-up the brewfile
kalbasit Aug 30, 2023
f791f59
start ssh-agent using funtoo keychain
kalbasit Aug 30, 2023
db8245a
do not put homebrew automatically in ld/cflags at least for now
kalbasit Aug 30, 2023
c7e9e94
run activate first it sets up /run
kalbasit Aug 30, 2023
580ed99
fix the if cond
kalbasit Aug 30, 2023
6f4ea29
install signal with brew
kalbasit Aug 30, 2023
ce207f6
Merge branch 'main' into personal/soxin/support-mac
kalbasit Aug 30, 2023
a382442
update flake
kalbasit Aug 30, 2023
c8dd897
remove commented code
kalbasit Aug 30, 2023
4ce51a1
add todo
kalbasit Aug 30, 2023
471c6ce
stay with the stable channel
kalbasit Aug 30, 2023
cd18ca1
fmt tree
kalbasit Aug 30, 2023
0b8ff98
remove unnecessary systemPath addition
kalbasit Aug 30, 2023
4898a6a
cleanup
kalbasit Aug 30, 2023
5d33f4e
move the adding of the key in the agent to onlykey moudle
kalbasit Aug 30, 2023
5c912a5
restore jspp
kalbasit Aug 30, 2023
6b0f954
re-enable gnupg on macOS
kalbasit Aug 30, 2023
e8ae8d2
remove dead comments
kalbasit Aug 30, 2023
1a2a5c6
clean up profile
kalbasit Aug 30, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 27 additions & 3 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 10 additions & 1 deletion flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,17 @@
};
};

darwin = {
url = "github:LnL7/nix-darwin";
inputs = {
nixpkgs.follows = "nixpkgs";
};
};

soxin = {
url = "github:SoxinOS/soxin";
inputs = {
darwin.follows = "darwin";
deploy-rs.follows = "deploy-rs";
flake-utils-plus.follows = "flake-utils-plus";
home-manager.follows = "home-manager";
Expand Down Expand Up @@ -93,9 +101,10 @@

# Supported systems, used for packages, apps, devShell and multiple other definitions. Defaults to `flake-utils.lib.defaultSystems`
supportedSystems = [
"aarch64-darwin"
"aarch64-linux"
"x86_64-linux"
"x86_64-darwin"
"x86_64-linux"
];

devShellBuilder = channels: with channels.nixpkgs; mkShell {
Expand Down
59 changes: 57 additions & 2 deletions hosts/darwins/default.nix
Original file line number Diff line number Diff line change
@@ -1,2 +1,57 @@
inputs@{ ... }:
{ }
inputs@{ self, darwin, deploy-rs, lib ? nixpkgs.lib, nixpkgs, ... }:

let
inherit (lib)
mapAttrs
recursiveUpdate
;

# the default channel to follow.
channelName = "nixpkgs";

# the operating mode of Soxin
mode = "nix-darwin";
in
mapAttrs
(n: v: recursiveUpdate
{
inherit
mode
;
}
v)
{
###
# x86_64-darwin
###

poseidon =
let
system = "x86_64-darwin";
in
{
inherit
channelName
system
;

modules = [ ./poseidon/configuration.nix ];
};

###
# aarch64-darwin
###

saturn =
let
system = "aarch64-darwin";
in
{
inherit
channelName
system
;

modules = [ ./saturn/configuration.nix ];
};
}
23 changes: 23 additions & 0 deletions hosts/darwins/poseidon/configuration.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{ config, lib, pkgs, inputs, soxincfg, ... }:

let
inherit (lib)
singleton
;
in
{
imports = [
soxincfg.nixosModules.profiles.myself
soxincfg.nixosModules.profiles.workstation.darwin.local
];

# load YL's home-manager configuration
home-manager.users.yl = import ./home.nix { inherit soxincfg; };

# TODO: Make gpg work, and re-enable this.
soxincfg.programs.git.enableGpgSigningKey = false;

nix = {
useDaemon = true;
};
}
14 changes: 14 additions & 0 deletions hosts/darwins/poseidon/home.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# home-manager configuration for user `yl`
{ soxincfg }:
{ config, pkgs, home-manager, lib, ... }:

with lib;

{
imports = [
soxincfg.nixosModules.profiles.myself
soxincfg.nixosModules.profiles.workstation.darwin.local
];

home.stateVersion = "23.05";
}
23 changes: 23 additions & 0 deletions hosts/darwins/saturn/configuration.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{ config, lib, pkgs, inputs, soxincfg, ... }:

let
inherit (lib)
singleton
;
in
{
imports = [
soxincfg.nixosModules.profiles.myself
soxincfg.nixosModules.profiles.workstation.darwin.local
];

# load YL's home-manager configuration
home-manager.users.yl = import ./home.nix { inherit soxincfg; };

# TODO: Make gpg work, and re-enable this.
soxincfg.programs.git.enableGpgSigningKey = false;

nix = {
useDaemon = true;
};
}
14 changes: 14 additions & 0 deletions hosts/darwins/saturn/home.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# home-manager configuration for user `yl`
{ soxincfg }:
{ config, pkgs, home-manager, lib, ... }:

with lib;

{
imports = [
soxincfg.nixosModules.profiles.myself
soxincfg.nixosModules.profiles.workstation.darwin.local
];

home.stateVersion = "23.05";
}
4 changes: 2 additions & 2 deletions hosts/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
inputs@{ ... }:

(import ./nixoses inputs) //
(import ./darwins inputs)
(import ./nixoses inputs)
// (import ./darwins inputs)
18 changes: 17 additions & 1 deletion hosts/nixoses/default.nix
Original file line number Diff line number Diff line change
@@ -1,9 +1,25 @@
inputs@{ self, deploy-rs, ... }:
inputs@{ self, deploy-rs, lib ? nixpkgs.lib, nixpkgs, ... }:

let
inherit (lib)
mapAttrs
recursiveUpdate
;

# the default channel to follow.
channelName = "nixpkgs";

# the operating mode of Soxin
mode = "NixOS";
in
mapAttrs
(n: v: recursiveUpdate
{
inherit
mode
;
}
v)
{
###
# x86_64-linux
Expand Down
21 changes: 20 additions & 1 deletion modules/hardware/onlykey/home.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ let
mkDefault
mkIf
mkMerge
optionals
singleton
;

Expand All @@ -15,20 +16,30 @@ let
writeShellScript
;

inherit (pkgs.hostPlatform)
isLinux
;

cfg = config.soxincfg.hardware.onlykey;

gpg-agent-program = writeShellScript "run-onlykey-agent.sh" ''
set -euo pipefail

exec ${onlykey-agent}/bin/onlykey-gpg-agent \
--homedir ~/.gnupg \
--skey-slot=${toString cfg.gnupg-support.signing-key-slot} \
--dkey-slot=${toString cfg.gnupg-support.decryption-key-slot} \
$*
'';
in
{
config = mkIf cfg.enable (mkMerge [
{ home.packages = [ onlykey onlykey-agent onlykey-cli ]; }
{
home.packages =
[
onlykey-cli
] ++ optionals (isLinux) [ onlykey ];
}

(mkIf cfg.ssh-support.enable {
soxincfg.programs.ssh = {
Expand All @@ -41,12 +52,20 @@ in
'';
})

(mkIf (cfg.ssh-support.enable && pkgs.stdenv.hostPlatform.isDarwin) {
programs.zsh.initExtra = ''
eval "$(${pkgs.keychain}/bin/keychain --eval --agents ssh id_ed25519_sk_rk -q)"
'';
})

(mkIf cfg.gnupg-support.enable {
home.file.".gnupg/run-agent.sh" = {
source = gpg-agent-program;
executable = true;
};

home.packages = singleton onlykey-agent;

programs.gpg = {
enable = true;

Expand Down
10 changes: 8 additions & 2 deletions modules/programs/ssh/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ in
};

config = mkIf cfg.enable (mkMerge [
{
(optionalAttrs (mode == "NixOS" || mode == "home-manager") {
programs.ssh = {
extraConfig = ''
PubkeyAuthentication yes
Expand All @@ -156,7 +156,7 @@ in
("Ciphers " + (concatStringsSep "," cfg.ciphers))}
'';
};
}
})

(optionalAttrs (mode == "NixOS") {
programs.ssh = {
Expand All @@ -170,6 +170,12 @@ in
};
})

(optionalAttrs (mode == "home-manager") (mkIf (cfg.enableSSHAgent && pkgs.stdenv.hostPlatform.isDarwin) {
programs.zsh.initExtra = ''
eval "$(${pkgs.keychain}/bin/keychain --eval -q)"
'';
}))

(optionalAttrs (mode == "home-manager") {
programs.ssh = {
enable = true;
Expand Down
Loading