[darwin] 在 nix darwin 上跑通了

This commit is contained in:
2026-01-18 16:11:59 +08:00
parent 4a1f41f034
commit bb40ace94d
10 changed files with 203 additions and 59 deletions
Generated
+83 -22
View File
@@ -1,9 +1,30 @@
{ {
"nodes": { "nodes": {
"darwin": {
"inputs": {
"nixpkgs": [
"nixpkgs-darwin"
]
},
"locked": {
"lastModified": 1768561867,
"narHash": "sha256-prGOZ+w3pZfGTRxworKcJliCNsewF0L4HUPjgU/6eaw=",
"owner": "nix-darwin",
"repo": "nix-darwin",
"rev": "8b720b9662d4dd19048664b7e4216ce530591adc",
"type": "github"
},
"original": {
"owner": "nix-darwin",
"ref": "master",
"repo": "nix-darwin",
"type": "github"
}
},
"home-manager": { "home-manager": {
"inputs": { "inputs": {
"nixpkgs": [ "nixpkgs": [
"nixpkgs" "nixpkgs-linux"
] ]
}, },
"locked": { "locked": {
@@ -21,13 +42,66 @@
"type": "github" "type": "github"
} }
}, },
"home-manager-darwin": {
"inputs": {
"nixpkgs": [
"nixpkgs-darwin"
]
},
"locked": {
"lastModified": 1768707181,
"narHash": "sha256-GdwFfnwdUgABFpc4sAmX7GYx8eQs6cEjOPo6nBJ0YaI=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "83bcb17377f0242376a327e742e9404e9a528647",
"type": "github"
},
"original": {
"owner": "nix-community",
"ref": "master",
"repo": "home-manager",
"type": "github"
}
},
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1718895438, "lastModified": 1718276985,
"narHash": "sha256-k3JqJrkdoYwE3fHE6xGDY676AYmyh4U2Zw+0Bwe5DLU=", "narHash": "sha256-u1fA0DYQYdeG+5kDm1bOoGcHtX0rtC7qs2YA2N1X++I=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "d603719ec6e294f034936c0d0dc06f689d91b6c3", "rev": "3f84a279f1a6290ce154c5531378acc827836fbb",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-darwin": {
"locked": {
"lastModified": 1768569498,
"narHash": "sha256-bB6Nt99Cj8Nu5nIUq0GLmpiErIT5KFshMQJGMZwgqUo=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "be5afa0fcb31f0a96bf9ecba05a516c66fcd8114",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-linux": {
"locked": {
"lastModified": 1768564909,
"narHash": "sha256-Kell/SpJYVkHWMvnhqJz/8DqQg2b6PguxVWOuadbHCc=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "e4bae1bd10c9c57b2cf517953ab70060a828ee6f",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -53,32 +127,19 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs_2": {
"locked": {
"lastModified": 1718276985,
"narHash": "sha256-u1fA0DYQYdeG+5kDm1bOoGcHtX0rtC7qs2YA2N1X++I=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "3f84a279f1a6290ce154c5531378acc827836fbb",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": { "root": {
"inputs": { "inputs": {
"darwin": "darwin",
"home-manager": "home-manager", "home-manager": "home-manager",
"nixpkgs": "nixpkgs", "home-manager-darwin": "home-manager-darwin",
"nixpkgs-darwin": "nixpkgs-darwin",
"nixpkgs-linux": "nixpkgs-linux",
"sops-nix": "sops-nix" "sops-nix": "sops-nix"
} }
}, },
"sops-nix": { "sops-nix": {
"inputs": { "inputs": {
"nixpkgs": "nixpkgs_2", "nixpkgs": "nixpkgs",
"nixpkgs-stable": "nixpkgs-stable" "nixpkgs-stable": "nixpkgs-stable"
}, },
"locked": { "locked": {
+42 -8
View File
@@ -2,17 +2,26 @@
description = "Origami404's NixOS Flake"; description = "Origami404's NixOS Flake";
inputs = { inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; nixpkgs-linux.url = "github:NixOS/nixpkgs/nixos-unstable";
nixpkgs-darwin.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
darwin = {
url = "github:nix-darwin/nix-darwin/master";
inputs.nixpkgs.follows = "nixpkgs-darwin";
};
home-manager = { home-manager = {
url = "github:nix-community/home-manager/master"; url = "github:nix-community/home-manager/master";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs-linux";
};
home-manager-darwin = {
url = "github:nix-community/home-manager/master";
inputs.nixpkgs.follows = "nixpkgs-darwin";
}; };
sops-nix.url = "github:Mic92/sops-nix"; sops-nix.url = "github:Mic92/sops-nix";
}; };
outputs = { nixpkgs, home-manager, ... }@inputs: { outputs = { nixpkgs-linux, nixpkgs-darwin, home-manager, home-manager-darwin, ... }@inputs: {
nixosConfigurations = { nixosConfigurations = {
"eris" = nixpkgs.lib.nixosSystem { "eris" = nixpkgs-linux.lib.nixosSystem {
system = "x86_64-linux"; system = "x86_64-linux";
specialArgs = { inherit inputs; }; specialArgs = { inherit inputs; };
modules = [ modules = [
@@ -21,16 +30,41 @@
}; };
}; };
darwinConfigurations = {
"hypnos" = inputs.darwin.lib.darwinSystem {
system = "aarch64-darwin";
specialArgs = { inherit inputs; };
modules = [
./hosts/hypnos/configuration.nix
];
};
};
homeConfigurations = { homeConfigurations = {
"origami@eris" = home-manager.lib.homeManagerConfiguration { "origami@eris" = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.x86_64-linux; pkgs = nixpkgs-linux.legacyPackages.x86_64-linux;
modules = [ ./home/hosts/eris.nix ]; modules = [
{ nixpkgs.config.allowUnfreePredicate = _: true; }
./home/hosts/eris.nix
];
extraSpecialArgs = { inherit inputs; }; extraSpecialArgs = { inherit inputs; };
}; };
"origami@metis" = home-manager.lib.homeManagerConfiguration { "origami@metis" = home-manager.lib.homeManagerConfiguration {
pkgs = nixpkgs.legacyPackages.x86_64-linux; pkgs = nixpkgs-linux.legacyPackages.x86_64-linux;
modules = [ ./home/hosts/metis.nix ]; modules = [
{ nixpkgs.config.allowUnfreePredicate = _: true; }
./home/hosts/metis.nix
];
extraSpecialArgs = { inherit inputs; };
};
"origami@hypnos" = home-manager-darwin.lib.homeManagerConfiguration {
pkgs = nixpkgs-darwin.legacyPackages.aarch64-darwin;
modules = [
{ nixpkgs.config.allowUnfreePredicate = _: true; }
./home/hosts/hypnos.nix
];
extraSpecialArgs = { inherit inputs; }; extraSpecialArgs = { inherit inputs; };
}; };
}; };
+9 -11
View File
@@ -1,27 +1,25 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
{ {
home.username = "origami";
home.homeDirectory = "/home/origami"; home.homeDirectory = "/home/origami";
programs.home-manager.enable = true;
imports = [ imports = [
./modules/shell.nix ../modules/common.nix
./modules/desktop.nix ../modules/shell.nix
./modules/shell-develop.nix ../modules/desktop.nix
./modules/vscode.nix ../modules/shell-develop.nix
./modules/gnome-dconf.nix ../modules/vscode.nix
../modules/gnome-dconf.nix
]; ];
nixpkgs.config.allowUnfreePredicate = _: true;
home.packages = with pkgs;[ home.packages = with pkgs;[
# system call monitoring # system call monitoring
strace # system call monitoring strace # system call monitoring
ltrace # library call monitoring ltrace # library call monitoring
lsof # list open files lsof # list open files
]; ];
programs.nix-index.enable = true;
home.stateVersion = "23.11"; programs.fish.shellAliases = {
"flake-update" = "nixos-rebuild switch --use-remote-sudo --flake ${config.home.homeDirectory}/flakes#eris";
};
} }
+16
View File
@@ -0,0 +1,16 @@
{ config, lib, pkgs, ... }:
{
home.homeDirectory = "/Users/origami";
imports = [
../modules/common.nix
../modules/shell.nix
../modules/shell-develop.nix
../modules/vscode.nix
];
programs.fish.shellAliases = {
"flake-update" = "home-manager switch --flake ${config.home.homeDirectory}/flakes#origami@hypnos";
};
}
+3 -8
View File
@@ -1,16 +1,11 @@
{ config, lib, pkgs, ... }: { config, lib, pkgs, ... }:
{ {
home.username = "origami";
home.homeDirectory = "/home/origami"; home.homeDirectory = "/home/origami";
programs.home-manager.enable = true;
imports = [ imports = [
./modules/shell.nix ../modules/common.nix
./modules/shell-develop.nix ../modules/shell.nix
../modules/shell-develop.nix
]; ];
nixpkgs.config.allowUnfreePredicate = _: true;
home.stateVersion = "23.11";
} }
+10
View File
@@ -0,0 +1,10 @@
{ config, lib, pkgs, ... }:
{
home.username = "origami";
programs.home-manager.enable = true;
programs.nix-index.enable = true;
home.stateVersion = "23.11";
}
+9 -7
View File
@@ -18,17 +18,19 @@
programs.git = { programs.git = {
enable = true; enable = true;
lfs.enable = true; lfs.enable = true;
userName = "Origami404"; settings = {
userEmail = "Origami404@foxmail.com"; user = {
extraConfig = { name = "Origami404";
user.signingKey = "5C7FCAFBC961E2E312B47FEC76447D4671CB3CC0"; email = "Origami404@foxmail.com";
signingKey = "5C7FCAFBC961E2E312B47FEC76447D4671CB3CC0";
};
core.autocrlf = "input"; core.autocrlf = "input";
push.autoSetupRemote = true; push.autoSetupRemote = true;
pull.rebase = true; pull.rebase = true;
init.defaultBranch = "main"; init.defaultBranch = "main";
}; aliases = {
aliases = { "l" = "log --date-order --graph --pretty=\"format:%C(yellow)%h%Cblue%d%Creset %s %C(white) %an, %ar%Creset\"";
"l" = "log --date-order --graph --pretty=\"format:%C(yellow)%h%Cblue%d%Creset %s %C(white) %an, %ar%Creset\""; };
}; };
}; };
} }
+1 -2
View File
@@ -7,7 +7,7 @@
bat # better cat on everything bat # better cat on everything
eza # better ls eza # better ls
fzf # A command-line fuzzy finder fzf # A command-line fuzzy finder
du-dust # better du dust # better du
duf # better df duf # better df
fd # better find fd # better find
btop # better top btop # better top
@@ -60,7 +60,6 @@
"cloc" = "scc"; "cloc" = "scc";
"cat" = "bat"; "cat" = "bat";
"x" = "atool -x"; "x" = "atool -x";
"flake-update" = "nixos-rebuild switch --use-remote-sudo --flake ${config.home.homeDirectory}/flakes#eris";
"cl" = "clear"; "cl" = "clear";
}; };
}; };
+1 -1
View File
@@ -2,6 +2,6 @@
{ {
programs.vscode = { programs.vscode = {
enable = true; enable = true;
package = pkgs.vscode.fhs; package = if pkgs.stdenv.isLinux then pkgs.vscode.fhs else pkgs.vscode;
}; };
} }
+29
View File
@@ -0,0 +1,29 @@
{ config, lib, pkgs, inputs, ... }:
{
imports = [
inputs.home-manager-darwin.darwinModules.home-manager
];
nix.settings.experimental-features = [ "nix-command" "flakes" ];
networking.hostName = "hypnos";
time.timeZone = "Asia/Shanghai";
programs.fish.enable = true;
users.users.origami = {
home = "/Users/origami";
};
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
backupFileExtension = "bak";
users.origami = import ../../home/hosts/hypnos.nix;
};
nixpkgs.config.allowUnfreePredicate = _: true;
system.stateVersion = 5;
}