[feat] Add darwin

This commit is contained in:
Uttarayan
2024-02-15 03:21:07 +05:30
parent 58084329f5
commit 504af4026f
3 changed files with 136 additions and 46 deletions

View File

@@ -1,5 +1,11 @@
.PHONY: run build
.PHONY: run build genzai
default: build
switch:
nix run home-manager/master -- switch --flake ~/.local/share/dotfiles/config/nix
init:
nix run home-manager/master -- init --switch ~/.local/share/dotfiles/config/nix
build:
nix run home-manager/master -- build --flake ~/.local/share/dotfiles/config/nix
genzai:
nix build .#homeConfigurations.genzai

36
config/nix/flake.lock generated
View File

@@ -82,6 +82,24 @@
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1705309234,
"narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_2": {
"inputs": {
"systems": "systems_2"
},
"locked": {
"lastModified": 1701680307,
"narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=",
@@ -140,7 +158,7 @@
},
"neovim-flake": {
"inputs": {
"flake-utils": "flake-utils",
"flake-utils": "flake-utils_2",
"nixpkgs": [
"neovim-nightly-overlay",
"nixpkgs"
@@ -219,6 +237,7 @@
"root": {
"inputs": {
"darwin": "darwin",
"flake-utils": "flake-utils",
"home-manager": "home-manager",
"neovim-nightly-overlay": "neovim-nightly-overlay",
"nixpkgs": "nixpkgs_2"
@@ -238,6 +257,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

@@ -13,41 +13,49 @@
inputs.nixpkgs.follows = "nixpkgs";
};
neovim-nightly-overlay.url = "github:nix-community/neovim-nightly-overlay";
flake-utils.url = "github:numtide/flake-utils";
};
outputs = {
nixpkgs,
home-manager,
darwin,
flake-utils,
...
} @ inputs: let
devices = [
{
device = "mirai";
name = "mirai";
system = "x86_64-linux";
user = "fs0c131y";
}
{
device = "genzai";
name = "genzai";
system = "x86_64-linux";
user = "fs0c131y";
}
{
device = "Uttarayans-MacBook-Pro";
name = "Uttarayans-MacBook-Pro";
system = "aarch64-darwin";
user = "fs0c131y";
}
{
device = "deck";
name = "SteamDeck";
system = "x86_64-linux";
user = "deck";
}
];
linux = builtins.filter (x: x.system == "x86_64-linux") devices;
darwin = builtins.filter (x: x.system == "aarch64-darwin") devices;
in {
homeConfigurations = let
system = "x86_64-linux";
homeConfigurations = builtins.listToAttrs (builtins.map (device: {
name = device.user;
value = let
pkgs = nixpkgs.legacyPackages.${device.system};
overlays = [inputs.neovim-nightly-overlay.overlay];
pkgs = nixpkgs.legacyPackages.${system};
in {
"fs0c131y" = home-manager.lib.homeManagerConfiguration {
in
home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules = [
./home.nix
{
@@ -55,8 +63,51 @@
}
];
};
};
})
linux);
darwinConfigurations = builtins.listToAttrs (builtins.map (device: {
name = device.name;
value = let
pkgs = nixpkgs.legacyPackages.${device.system};
in {
"Uttarayans-MacBook-Pro" = darwin.lib.darwinSystem {
modules = [
home-manager.darwinModules.home-manager
./darwin.nix
({config, ...}: {
home-manager = {
users = {
fs0c131y = {
home = "/Users/${device.user}";
stateVersion = "21.05";
configuration = home-manager.configurations.fs0c131y;
};
};
};
})
];
};
};
})
darwin);
};
}
# "fs0c131y" = let
# system = "x86_64-linux";
# overlays = [inputs.neovim-nightly-overlay.overlay];
# pkgs = nixpkgs.legacyPackages.${system};
# in
# home-manager.lib.homeManagerConfiguration
# {
# inherit pkgs;
# modules = [
# ./home.nix
# {
# nixpkgs.overlays = overlays;
# }
# ];
# };
# darwinConfigurations = let
# system = "aarch64-darwin";
# pkgs = nixpkgs.legacyPackages.${system};
@@ -79,5 +130,4 @@
# ];
# };
# };
};
}