feat(darwin): Big messy darwin bootstrap

I thought about splitting this into smaller commits but fuck it
This commit is contained in:
punkfairie 2024-11-21 20:28:46 -08:00
parent ea190b1a63
commit cc51153ece
Signed by: punkfairie
GPG key ID: 8CEDBFDF5C0D613D
15 changed files with 352 additions and 27 deletions

View file

@ -1,22 +1,33 @@
default:
@just --list
defhost := `hostname`
defuser := env_var('USER')
alias dh := deployhome
[group('home')]
deployhome user=env_var('USER'):
nh home switch -c marley@nyx -b bak
deployhome user=defuser host=defhost:
nh home switch -c {{user}}@{{host}} -b bak .
[group('home')]
refreshhome:
home-manager switch --refresh -b bak --flake .
alias dd := deploydarwin
[group('darwin')]
deploydarwin host=defhost:
darwin-rebuild switch --flake .#{{host}}
alias up := update
[group('update')]
update:
nix flake update
[group('update')]
updatejust this:
nix flake update {{this}}
alias gc := collectgarbage
[group('maintainence')]
collectgarbage:
nh clean all

View file

@ -28,6 +28,26 @@
"type": "github"
}
},
"darwin": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1732016537,
"narHash": "sha256-XwXUK+meYnlhdQz2TVE4Wv+tsx1CkdGbDPt1tRzCNH4=",
"owner": "LnL7",
"repo": "nix-darwin",
"rev": "61cee20168a3ebb71a9efd70a55adebaadfbe4d4",
"type": "github"
},
"original": {
"owner": "LnL7",
"repo": "nix-darwin",
"type": "github"
}
},
"devenv": {
"inputs": {
"cachix": "cachix",
@ -37,11 +57,11 @@
"nixpkgs": "nixpkgs_3"
},
"locked": {
"lastModified": 1731501663,
"narHash": "sha256-+yXfV7WLU9PAMRcggwWGxar97MZw1pcg9EDQ0YARDPA=",
"lastModified": 1732121232,
"narHash": "sha256-CmJt7aeSCJnJYGtYpyslRI+pC28RPVD43PD/7kkIVuM=",
"owner": "cachix",
"repo": "devenv",
"rev": "b48b0d8018e0dc8c14d9dca47cd6e55add94a603",
"rev": "6ff1e5f92c0d74bbb12f7454a239ca2f02e05ea1",
"type": "github"
},
"original": {
@ -109,11 +129,11 @@
"systems": "systems"
},
"locked": {
"lastModified": 1694529238,
"narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",
"lastModified": 1726560853,
"narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "ff7b65b44d01cf9ba6a71320833626af21126384",
"rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a",
"type": "github"
},
"original": {
@ -124,7 +144,7 @@
},
"flake-utils-plus": {
"inputs": {
"flake-utils": "flake-utils"
"flake-utils": "flake-utils_2"
},
"locked": {
"lastModified": 1715533576,
@ -141,6 +161,39 @@
"type": "github"
}
},
"flake-utils_2": {
"inputs": {
"systems": "systems_2"
},
"locked": {
"lastModified": 1694529238,
"narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "ff7b65b44d01cf9ba6a71320833626af21126384",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flakey-profile": {
"locked": {
"lastModified": 1712898590,
"narHash": "sha256-FhGIEU93VHAChKEXx905TSiPZKga69bWl1VB37FK//I=",
"owner": "lf-",
"repo": "flakey-profile",
"rev": "243c903fd8eadc0f63d205665a92d4df91d42d9d",
"type": "github"
},
"original": {
"owner": "lf-",
"repo": "flakey-profile",
"type": "github"
}
},
"git-hooks": {
"inputs": {
"flake-compat": [
@ -198,11 +251,11 @@
]
},
"locked": {
"lastModified": 1730837930,
"narHash": "sha256-0kZL4m+bKBJUBQse0HanewWO0g8hDdCvBhudzxgehqc=",
"lastModified": 1732025103,
"narHash": "sha256-qjEI64RKvDxRyEarY0jTzrZMa8ebezh2DEZmJJrpVdo=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "2f607e07f3ac7e53541120536708e824acccfaa8",
"rev": "a46e702093a5c46e192243edbd977d5749e7f294",
"type": "github"
},
"original": {
@ -227,6 +280,41 @@
"type": "github"
}
},
"lix": {
"inputs": {
"flake-utils": "flake-utils",
"flakey-profile": "flakey-profile",
"lix": "lix_2",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1729360442,
"narHash": "sha256-6U0CyPycIBc04hbYy2hBINnVso58n/ZyywY2BD3hu+s=",
"rev": "9098ac95768f7006d7e070b88bae76939f6034e6",
"type": "tarball",
"url": "https://git.lix.systems/api/v1/repos/lix-project/nixos-module/archive/9098ac95768f7006d7e070b88bae76939f6034e6.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://git.lix.systems/lix-project/nixos-module/archive/2.91.1-1.tar.gz"
}
},
"lix_2": {
"flake": false,
"locked": {
"lastModified": 1729298361,
"narHash": "sha256-hiGtfzxFkDc9TSYsb96Whg0vnqBVV7CUxyscZNhed0U=",
"rev": "ad9d06f7838a25beec425ff406fe68721fef73be",
"type": "tarball",
"url": "https://git.lix.systems/api/v1/repos/lix-project/lix/archive/ad9d06f7838a25beec425ff406fe68721fef73be.tar.gz?rev=ad9d06f7838a25beec425ff406fe68721fef73be"
},
"original": {
"type": "tarball",
"url": "https://git.lix.systems/lix-project/lix/archive/2.91.1.tar.gz"
}
},
"nix": {
"inputs": {
"flake-compat": [
@ -310,11 +398,11 @@
},
"nixpkgs_4": {
"locked": {
"lastModified": 1730785428,
"narHash": "sha256-Zwl8YgTVJTEum+L+0zVAWvXAGbWAuXHax3KzuejaDyo=",
"lastModified": 1732014248,
"narHash": "sha256-y/MEyuJ5oBWrWAic/14LaIr/u5E0wRVzyYsouYY3W6w=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "4aa36568d413aca0ea84a1684d2d46f55dbabad7",
"rev": "23e89b7da85c3640bbc2173fe04f4bd114342367",
"type": "github"
},
"original": {
@ -342,8 +430,10 @@
},
"root": {
"inputs": {
"darwin": "darwin",
"devenv": "devenv",
"home-manager": "home-manager",
"lix": "lix",
"nixpkgs": "nixpkgs_4",
"rofi-themes": "rofi-themes",
"rose-pine": "rose-pine",
@ -435,6 +525,21 @@
"repo": "default",
"type": "github"
}
},
"systems_2": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
}
},
"root": "root",

View file

@ -12,6 +12,18 @@
title = "marleyOS";
};
channels-config = {
allowUnfree = true;
};
overlays = with inputs; [
lix.overlays.default
];
systems.modules.darwin = with inputs; [
lix.nixosModules.default
];
homes.modules = with inputs; [
rose-pine.homeManagerModules.rose-pine
];
@ -28,11 +40,21 @@
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
lix = {
url = "https://git.lix.systems/lix-project/nixos-module/archive/2.91.1-1.tar.gz";
inputs.nixpkgs.follows = "nixpkgs";
};
snowfall-lib = {
url = "github:snowfallorg/lib";
inputs.nixpkgs.follows = "nixpkgs";
};
darwin = {
url = "github:LnL7/nix-darwin";
inputs.nixpkgs.follows = "nixpkgs";
};
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";

View file

@ -0,0 +1,45 @@
{
lib,
...
}:
let
inherit (lib.marleyos) enabled;
in
{
marleyos = {
isDesktop = true;
programs = {
amfora = enabled;
bat = enabled;
btop = enabled;
cheat = enabled;
curl = enabled;
eza = enabled;
figlet = enabled;
fish = enabled;
fzf = enabled;
gh = enabled;
git = enabled;
glow = enabled;
gpg = enabled;
hyfetch = enabled;
just = enabled;
lazygit = enabled;
less = enabled;
man = enabled;
neo = enabled;
nh = enabled;
rbw = enabled;
ripgrep = enabled;
ssh = enabled;
starship = enabled;
tmux = enabled;
wezterm = enabled;
wget = enabled;
zoxide = enabled;
};
};
home.stateVersion = "24.05";
}

View file

@ -0,0 +1,20 @@
{
lib,
config,
pkgs,
...
}:
let
inherit (lib) mkEnableOption mkIf;
cfg = config.marleyos.appearance.base;
in
{
options.marleyos.appearance.base.enable = mkEnableOption "base";
config = mkIf cfg.enable {
fonts.packages = with pkgs; [
maple-mono-NF
];
};
}

View file

@ -0,0 +1,18 @@
{
lib,
config,
...
}:
{
config = {
homebrew = {
enable = true;
onActivation = {
autoUpdate = true;
cleanup = "zap";
upgrade = true;
};
};
};
}

View file

@ -0,0 +1,9 @@
{
pkgs,
...
}:
{
config.nix = {
package = pkgs.lix;
};
}

View file

@ -0,0 +1,24 @@
{
lib,
config,
pkgs,
...
}:
let
inherit (lib) mkIf mkEnableOption;
cfg = config.marleyos.programs.fish;
in
{
options.marleyos.programs.fish.enable = mkEnableOption "fish";
config = mkIf cfg.enable {
programs.fish = {
enable = true;
useBabelfish = true;
};
environment.shells = [ pkgs.fish ];
};
}

View file

@ -0,0 +1,17 @@
{
lib,
config,
...
}:
let
inherit (lib) mkEnableOption mkIf;
cfg = config.marleyos.programs.wezterm;
in
{
options.marleyos.programs.wezterm.enable = mkEnableOption "wezterm";
config = mkIf cfg.enable {
homebrew.casks = [ "wezterm" ];
};
}

View file

@ -1,10 +1,16 @@
{
lib,
config,
pkgs,
system,
...
}:
let
inherit (lib) mkIf;
inherit (lib.snowfall.system) is-linux;
inherit (lib.marleyos) enabled;
isGenericLinux = config.targets.genericLinux.enable;
in
{
# Anything in this folder should not include an enable/disable option. This is
@ -17,14 +23,11 @@ in
email = "marley@punkfairie.net";
};
# Tell nix what version it is.
nix.package = pkgs.nix;
home.language.base = "en_US.UTF-8";
programs.home-manager = enabled;
# Autostart wanted systemd services.
systemd.user.startServices = true;
systemd.user.startServices = mkIf (is-linux system) true;
};
}

View file

@ -1,11 +1,14 @@
{
config,
lib,
system,
pkgs,
...
}:
let
inherit (lib) mkMerge mkIf;
inherit (lib.snowfall.system) is-linux;
inherit (config.marleyos) isDesktop;
in
{
@ -25,7 +28,8 @@ in
dataHome = "${homeDir}/.local/share";
stateHome = "${homeDir}/.local/state";
}
(mkIf isDesktop {
(mkIf (isDesktop && (is-linux system)) {
userDirs = {
enable = true;
createDirectories = true;

View file

@ -2,6 +2,7 @@
lib,
config,
pkgs,
system,
...
}:
let
@ -13,6 +14,8 @@ let
mkIf
mkDefault
;
inherit (lib.snowfall.system) is-linux;
cfg = config.marleyos.theme;
colorThemes = lib.types.enum [
@ -152,7 +155,7 @@ in
})
# pinentry
{
(mkIf (is-linux system) {
home.packages = [
cfg.pinentry
];
@ -164,6 +167,6 @@ in
services.gpg-agent = mkIf config.services.gpg-agent.enable (mkDefault {
pinentryPackage = cfg.pinentry;
});
}
})
];
}

View file

@ -2,10 +2,12 @@
lib,
config,
pkgs,
system,
...
}:
let
inherit (lib) mkEnableOption mkIf;
inherit (lib) mkEnableOption mkIf optionals;
inherit (lib.snowfall.system) is-linux is-darwin;
inherit (lib.marleyos) enabled;
cfg = config.marleyos.programs.fish;
@ -30,8 +32,10 @@ in
gzip
unzip
pax
unrar-free
];
]
# unrar-free is broken on darwin :(
++ (optionals (is-linux system) [ unrar-free ])
++ (optionals (is-darwin system) [ unrar ]);
programs.fish = {
enable = true;

View file

@ -1,16 +1,19 @@
{
lib,
config,
system,
pkgs,
...
}:
let
inherit (lib) mkEnableOption mkIf;
inherit (lib.snowfall.system) is-darwin;
cfg = config.marleyos.programs.wezterm;
inherit (config.marleyos.theme) colors;
isGenericLinux = config.targets.genericLinux.enable;
isNotNixOS = isGenericLinux || (is-darwin system);
in
{
options.marleyos.programs.wezterm.enable = mkEnableOption "wezterm";
@ -21,7 +24,7 @@ in
# Non-NixOS Linux systems don't have proper GPU integration, so we
# unfortunately need to use the native package manager version.
package = mkIf isGenericLinux pkgs.emptyDirectory;
package = mkIf isNotNixOS pkgs.emptyDirectory;
# TODO: create `local config` & return it seperately, so other modules can
# insert config in the middle
@ -76,7 +79,7 @@ in
})
-- TODO: on mairley this should be set to 14.0
config.font_size = 11.0
config.font_size = ${if (is-darwin system) then "14.0" else "11.0"}
return config
'';

View file

@ -0,0 +1,37 @@
{
lib,
pkgs,
...
}:
let
inherit (lib.marleyos) enabled;
in
{
networking = {
computerName = "mairley";
hostName = "mairley";
localHostName = "mairley";
};
marleyos = {
appearance = {
base = enabled;
};
programs = {
fish = enabled;
wezterm = enabled;
};
};
users = {
knownUsers = [ "marley" ];
users."marley" = {
# This is required for some reason.
uid = 501;
shell = pkgs.fish;
};
};
system.stateVersion = 5;
}