mirror of
https://github.com/ryan4yin/nix-config.git
synced 2026-04-25 02:08:29 +02:00
feat: add support for darwin
This commit is contained in:
33
flake.nix
33
flake.nix
@@ -37,6 +37,13 @@
|
|||||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; # 使用 nixos-unstable 分支 for nix flakes
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; # 使用 nixos-unstable 分支 for nix flakes
|
||||||
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-23.05"; # unstable branch may be broken sometimes, use stable branch when necessary
|
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-23.05"; # unstable branch may be broken sometimes, use stable branch when necessary
|
||||||
|
|
||||||
|
# for macos
|
||||||
|
nixpkgs-darwin.url = "github:nixos/nixpkgs/nixpkgs-23.05-darwin";
|
||||||
|
darwin = {
|
||||||
|
url = "github:lnl7/nix-darwin/master";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs-darwin";
|
||||||
|
}
|
||||||
|
|
||||||
# nix users repository
|
# nix users repository
|
||||||
# used to install some packages not in nixpkgs
|
# used to install some packages not in nixpkgs
|
||||||
# e.g. wechat-uos/qqmusic/dingtalk
|
# e.g. wechat-uos/qqmusic/dingtalk
|
||||||
@@ -74,6 +81,7 @@
|
|||||||
outputs = inputs@{
|
outputs = inputs@{
|
||||||
self,
|
self,
|
||||||
nixpkgs,
|
nixpkgs,
|
||||||
|
darwin,
|
||||||
home-manager,
|
home-manager,
|
||||||
...
|
...
|
||||||
}: {
|
}: {
|
||||||
@@ -94,7 +102,7 @@
|
|||||||
|
|
||||||
# 使用 home-manager.extraSpecialArgs 自定义传递给 ./home 的参数
|
# 使用 home-manager.extraSpecialArgs 自定义传递给 ./home 的参数
|
||||||
home-manager.extraSpecialArgs = inputs;
|
home-manager.extraSpecialArgs = inputs;
|
||||||
home-manager.users.ryan = import ./home;
|
home-manager.users.ryan = import ./home/home-wayland.nix;
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
@@ -115,12 +123,33 @@
|
|||||||
|
|
||||||
# 使用 home-manager.extraSpecialArgs 自定义传递给 ./home 的参数
|
# 使用 home-manager.extraSpecialArgs 自定义传递给 ./home 的参数
|
||||||
home-manager.extraSpecialArgs = inputs;
|
home-manager.extraSpecialArgs = inputs;
|
||||||
home-manager.users.ryan = import ./home;
|
home-manager.users.ryan = import ./home/home-wayland.nix;
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
darwinConfigurations."harmonica" = darwin.lib.darwinSystem {
|
||||||
|
system = "x86_64-darwin";
|
||||||
|
|
||||||
|
specialArgs = inputs;
|
||||||
|
modules = [
|
||||||
|
./hosts/harmonica
|
||||||
|
|
||||||
|
# home-manager 作为 nixos 的一个 module
|
||||||
|
# 这样在 nixos-rebuild switch 时,home-manager 也会被自动部署,不需要额外执行 home-manager switch 命令
|
||||||
|
home-manager.nixosModules.home-manager
|
||||||
|
{
|
||||||
|
home-manager.useGlobalPkgs = true;
|
||||||
|
home-manager.useUserPackages = true;
|
||||||
|
|
||||||
|
# 使用 home-manager.extraSpecialArgs 自定义传递给 ./home 的参数
|
||||||
|
home-manager.extraSpecialArgs = inputs;
|
||||||
|
home-manager.users.ryan = import ./home/home-darwin.nix;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
# generate qcow2 & iso image from nixos configuration
|
# generate qcow2 & iso image from nixos configuration
|
||||||
# https://github.com/nix-community/nixos-generators
|
# https://github.com/nix-community/nixos-generators
|
||||||
# packages.x86_64-linux = {
|
# packages.x86_64-linux = {
|
||||||
|
|||||||
28
home/home-darwin.nix
Normal file
28
home/home-darwin.nix
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
{ config, pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./programs
|
||||||
|
./shell
|
||||||
|
];
|
||||||
|
|
||||||
|
# Home Manager needs a bit of information about you and the
|
||||||
|
# paths it should manage.
|
||||||
|
home = {
|
||||||
|
username = "admin";
|
||||||
|
homeDirectory = "/Users/admin";
|
||||||
|
|
||||||
|
# This value determines the Home Manager release that your
|
||||||
|
# configuration is compatible with. This helps avoid breakage
|
||||||
|
# when a new Home Manager release introduces backwards
|
||||||
|
# incompatible changes.
|
||||||
|
#
|
||||||
|
# You can update Home Manager without changing this value. See
|
||||||
|
# the Home Manager release notes for a list of state version
|
||||||
|
# changes in each release.
|
||||||
|
stateVersion = "22.11";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Let Home Manager install and manage itself.
|
||||||
|
programs.home-manager.enable = true;
|
||||||
|
}
|
||||||
@@ -1,13 +1,10 @@
|
|||||||
{ config, pkgs, ... }:
|
{ config, pkgs, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
imports = [
|
imports = [
|
||||||
./fcitx5
|
./fcitx5
|
||||||
./hyprland
|
./hyprland
|
||||||
# ./i3
|
|
||||||
./programs
|
./programs
|
||||||
./rofi
|
|
||||||
./shell
|
./shell
|
||||||
];
|
];
|
||||||
|
|
||||||
31
home/home-x11.nix
Normal file
31
home/home-x11.nix
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
{ config, pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./fcitx5
|
||||||
|
./i3
|
||||||
|
./programs
|
||||||
|
./rofi
|
||||||
|
./shell
|
||||||
|
];
|
||||||
|
|
||||||
|
# Home Manager needs a bit of information about you and the
|
||||||
|
# paths it should manage.
|
||||||
|
home = {
|
||||||
|
username = "ryan";
|
||||||
|
homeDirectory = "/home/ryan";
|
||||||
|
|
||||||
|
# This value determines the Home Manager release that your
|
||||||
|
# configuration is compatible with. This helps avoid breakage
|
||||||
|
# when a new Home Manager release introduces backwards
|
||||||
|
# incompatible changes.
|
||||||
|
#
|
||||||
|
# You can update Home Manager without changing this value. See
|
||||||
|
# the Home Manager release notes for a list of state version
|
||||||
|
# changes in each release.
|
||||||
|
stateVersion = "22.11";
|
||||||
|
};
|
||||||
|
|
||||||
|
# Let Home Manager install and manage itself.
|
||||||
|
programs.home-manager.enable = true;
|
||||||
|
}
|
||||||
10
hosts/harmonica/default.nix
Normal file
10
hosts/harmonica/default.nix
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
{ config, pkgs, home-manager, ... } @ args:
|
||||||
|
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
../../modules/fhs-fonts.nix
|
||||||
|
../../modules/system.nix
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user