Skip to content

Commit

Permalink
feat(darwin): nix flake config
Browse files Browse the repository at this point in the history
Signed-off-by: Carlos Alexandro Becker <[email protected]>
  • Loading branch information
caarlos0 committed Nov 24, 2023
1 parent b6bb961 commit 36c77e4
Show file tree
Hide file tree
Showing 8 changed files with 58 additions and 112 deletions.
11 changes: 7 additions & 4 deletions Taskfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,21 @@ tasks:
update:
cmds:
- nix flake update
apply:
cmds:
- home-manager switch --flake '.#carlos@{{.HOSTNAME}}'
tmux:
cmds:
- tmux source ~/.config/tmux/tmux.conf
apply:
cmds:
- task: nixos
- task: darwin
nixos:
status:
- "test $(uname -s) != Linux"
cmds:
- sudo nixos-rebuild switch --flake .#
darwin:
status:
- "test $(uname -s) -ne Darwin"
- "test $(uname -s) != Darwin"
cmds:
- nix build './#darwinConfigurations.{{ .HOSTNAME }}.system'
- ./result/sw/bin/darwin-rebuild switch --flake .
Expand Down
33 changes: 6 additions & 27 deletions flake.lock

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

72 changes: 34 additions & 38 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@
inputs.nixpkgs.follows = "nixpkgs";
};

mkAlias = {
url = "github:cdmistman/mkAlias";
inputs.nixpkgs.follows = "nixpkgs";
};

nix-index-database = {
url = "github:Mic92/nix-index-database";
inputs.nixpkgs.follows = "nixpkgs";
Expand Down Expand Up @@ -72,6 +67,7 @@
home-manager.users.carlos = {
imports = [
./modules/home.nix
./modules/nixos.nix
./modules/shell.nix
];
};
Expand All @@ -90,6 +86,7 @@
home-manager.users.carlos = {
imports = [
./modules/home.nix
./modules/nixos.nix
./modules/pkgs.nix
./modules/editorconfig.nix
./modules/yamllint.nix
Expand All @@ -115,41 +112,40 @@
darwinConfigurations = {
supernova = darwin.lib.darwinSystem {
system = "aarch64-darwin";
modules = [ ./machines/supernova.nix ];
};
};
homeConfigurations = {
"carlos@supernova" = home-manager.lib.homeManagerConfiguration {
pkgs = inputs.nixpkgs.legacyPackages.aarch64-darwin;
extraSpecialArgs = { inherit inputs; };
modules = [
({ config, ... }: {
config = {
nixpkgs.overlays = overlays;
{ nixpkgs.overlays = overlays; }
./machines/supernova.nix
home-manager.darwinModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.users.carlos = {
imports = [
./modules/home.nix
./modules/darwin
./modules/pkgs.nix
./modules/editorconfig.nix
./modules/yamllint.nix
./modules/go.nix
./modules/fzf.nix
./modules/ghostty
./modules/tmux
./modules/neovim
./modules/gpg.nix
./modules/git.nix
./modules/gh
./modules/top.nix
./modules/shell.nix
./modules/ssh
./modules/bins
./modules/charm.nix
./modules/hammerspoon
inputs.caarlos0-nur.homeManagerModules.default
# ./modules/yubikey.nix
nix-index-database.hmModules.nix-index
];
};
})
./modules/home.nix
./modules/pkgs.nix
./modules/editorconfig.nix
./modules/yamllint.nix
./modules/go.nix
./modules/fzf.nix
./modules/ghostty
./modules/tmux
./modules/neovim
./modules/gpg.nix
./modules/git.nix
./modules/gh
./modules/top.nix
./modules/shell.nix
./modules/ssh
./modules/bins
./modules/charm.nix
./modules/hammerspoon
inputs.caarlos0-nur.homeManagerModules.default
# ./modules/yubikey.nix
nix-index-database.hmModules.nix-index
./modules/darwin
}
];
};
};
Expand Down
3 changes: 3 additions & 0 deletions machines/supernova.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{ pkgs, ... }: {
nixpkgs.config = {
allowUnfree = true;
};
services = { nix-daemon = { enable = true; }; };
nix.package = pkgs.nix;
nix.settings.trusted-users = [ "root" "carlos" ];
Expand Down
36 changes: 0 additions & 36 deletions modules/darwin/app-activation.nix

This file was deleted.

6 changes: 2 additions & 4 deletions modules/darwin/default.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{ ... }: {
imports = [
./app-activation.nix
];
{ lib, ... }: {
home.homeDirectory = lib.mkDefault "/Users/carlos";

targets.darwin.defaults = {
"com.apple.Safari.SandboxBroker".ShowDevelop = true;
Expand Down
6 changes: 3 additions & 3 deletions modules/home.nix
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{ pkgs, ... }: {
{ ... }: {
home.username = "carlos";
home.homeDirectory = (if pkgs.stdenv.isDarwin then "/Users/" else "/home/")
+ "carlos";
home.stateVersion = "23.11";

home.enableNixpkgsReleaseCheck = false; # FIXME: remove this

# Let Home Manager install and manage itself.
programs.home-manager.enable = true;

Expand Down
3 changes: 3 additions & 0 deletions modules/nixos.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{ ... }: {
home.homeDirectory = "/home/carlos";
}

0 comments on commit 36c77e4

Please sign in to comment.