initial darwin
This commit is contained in:
parent
485cdb4b31
commit
8d2806d5bc
9 changed files with 155 additions and 25 deletions
21
flake.lock
21
flake.lock
|
@ -143,6 +143,26 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"nix-darwin": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1709348262,
|
||||||
|
"narHash": "sha256-eYTA1uZtYGFKrDOKiAz1wlE6aIC9WSdBNF8bSS818zM=",
|
||||||
|
"owner": "LnL7",
|
||||||
|
"repo": "nix-darwin",
|
||||||
|
"rev": "8a15cb36fffa0b5fbe31ef16ede0a479bef4b365",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "LnL7",
|
||||||
|
"repo": "nix-darwin",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1704194953,
|
"lastModified": 1704194953,
|
||||||
|
@ -179,6 +199,7 @@
|
||||||
"bootspec-secureboot": "bootspec-secureboot",
|
"bootspec-secureboot": "bootspec-secureboot",
|
||||||
"home-manager": "home-manager_2",
|
"home-manager": "home-manager_2",
|
||||||
"nil": "nil",
|
"nil": "nil",
|
||||||
|
"nix-darwin": "nix-darwin",
|
||||||
"nixpkgs": "nixpkgs",
|
"nixpkgs": "nixpkgs",
|
||||||
"vscode-server": "vscode-server"
|
"vscode-server": "vscode-server"
|
||||||
}
|
}
|
||||||
|
|
30
flake.nix
30
flake.nix
|
@ -36,6 +36,9 @@
|
||||||
url = "github:nix-community/home-manager/master";
|
url = "github:nix-community/home-manager/master";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
nix-darwin.url = "github:LnL7/nix-darwin";
|
||||||
|
nix-darwin.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs =
|
outputs =
|
||||||
|
@ -45,26 +48,39 @@
|
||||||
, agenix
|
, agenix
|
||||||
, bootspec-secureboot
|
, bootspec-secureboot
|
||||||
, home-manager
|
, home-manager
|
||||||
|
, nix-darwin
|
||||||
, ...
|
, ...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
makeNixosSystem = obj: nixpkgs.lib.nixosSystem (obj // {
|
specialArgs = {
|
||||||
specialArgs = (obj.specialArgs or { }) // {
|
inherit inputs;
|
||||||
inherit inputs;
|
abs = path: ./. + ("/" + path);
|
||||||
abs = path: ./. + ("/" + path);
|
};
|
||||||
};
|
|
||||||
});
|
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
nixosConfigurations = {
|
nixosConfigurations = {
|
||||||
koi = makeNixosSystem {
|
koi = nixpkgs.lib.nixosSystem {
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
modules = [
|
modules = [
|
||||||
agenix.nixosModules.default
|
agenix.nixosModules.default
|
||||||
bootspec-secureboot.nixosModules.bootspec-secureboot
|
bootspec-secureboot.nixosModules.bootspec-secureboot
|
||||||
home-manager.nixosModules.home-manager
|
home-manager.nixosModules.home-manager
|
||||||
|
{ home-manager.extraSpecialArgs = specialArgs; }
|
||||||
./hosts/koi/configuration.nix
|
./hosts/koi/configuration.nix
|
||||||
];
|
];
|
||||||
|
inherit specialArgs;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
darwinConfigurations = {
|
||||||
|
teidesu-osx = nix-darwin.lib.darwinSystem {
|
||||||
|
modules = [
|
||||||
|
agenix.darwinModules.default
|
||||||
|
home-manager.darwinModules.home-manager
|
||||||
|
{ home-manager.extraSpecialArgs = specialArgs; }
|
||||||
|
./hosts/teidesu-osx/configuration.nix
|
||||||
|
];
|
||||||
|
inherit specialArgs;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
(abs "hosts/nixos-common.nix")
|
(abs "hosts/nixos-common.nix")
|
||||||
(abs "users/teidesu/default.nix")
|
(abs "users/teidesu/server.nix")
|
||||||
./hardware-configuration.nix
|
./hardware-configuration.nix
|
||||||
|
|
||||||
./partials/fde.nix
|
./partials/fde.nix
|
||||||
|
|
42
hosts/teidesu-osx/configuration.nix
Normal file
42
hosts/teidesu-osx/configuration.nix
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
{ pkgs
|
||||||
|
, abs
|
||||||
|
, inputs
|
||||||
|
, ...
|
||||||
|
}:
|
||||||
|
|
||||||
|
{
|
||||||
|
nix = {
|
||||||
|
settings.experimental-features = [ "nix-command" "flakes" ];
|
||||||
|
settings.trusted-users = [ "@admin" ];
|
||||||
|
|
||||||
|
useDaemon = true;
|
||||||
|
};
|
||||||
|
nixpkgs.hostPlatform = "aarch64-darwin";
|
||||||
|
services.nix-daemon.enable = true;
|
||||||
|
|
||||||
|
age.identityPaths = [
|
||||||
|
"/Users/teidesu/.ssh/agenix_key"
|
||||||
|
];
|
||||||
|
|
||||||
|
security.pam.enableSudoTouchIdAuth = true;
|
||||||
|
|
||||||
|
home-manager.useGlobalPkgs = true;
|
||||||
|
home-manager.useUserPackages = true;
|
||||||
|
|
||||||
|
programs.zsh.enable = true;
|
||||||
|
|
||||||
|
users.users.teidesu = {
|
||||||
|
home = "/Users/teidesu";
|
||||||
|
};
|
||||||
|
|
||||||
|
home-manager.users.teidesu = { pkgs, ... }: {
|
||||||
|
imports = [
|
||||||
|
(abs "users/teidesu/darwin.nix")
|
||||||
|
|
||||||
|
./arc-setup.nix
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
system.stateVersion = 4;
|
||||||
|
}
|
||||||
|
|
10
switch
10
switch
|
@ -23,4 +23,12 @@ if [ "$1" == "boot" ]; then
|
||||||
shift
|
shift
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sudo nixos-rebuild $cmd --flake . $args $@
|
if [ "$(uname)" == "Darwin" ]; then
|
||||||
|
if command -v darwin-rebuild &> /dev/null; then
|
||||||
|
darwin-rebuild switch --flake . $args $@
|
||||||
|
else
|
||||||
|
nix --extra-experimental-features nix-command --extra-experimental-features flakes run nix-darwin -- switch --flake . $args $@
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
sudo nixos-rebuild $cmd --flake . $args $@
|
||||||
|
fi
|
17
users/teidesu/common.nix
Normal file
17
users/teidesu/common.nix
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
{ pkgs, inputs, ... }: {
|
||||||
|
imports = [
|
||||||
|
./zsh.nix
|
||||||
|
];
|
||||||
|
|
||||||
|
home.stateVersion = "23.11";
|
||||||
|
|
||||||
|
home.packages = with pkgs; [
|
||||||
|
tree
|
||||||
|
nixpkgs-fmt
|
||||||
|
htop
|
||||||
|
jq
|
||||||
|
micro
|
||||||
|
inputs.nil.packages.${system}.default
|
||||||
|
inputs.agenix.packages.${system}.default
|
||||||
|
];
|
||||||
|
}
|
19
users/teidesu/darwin.nix
Normal file
19
users/teidesu/darwin.nix
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
{ abs, pkgs, lib, inputs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
./common.nix
|
||||||
|
];
|
||||||
|
|
||||||
|
home.packages = with pkgs; [
|
||||||
|
scc
|
||||||
|
ripgrep
|
||||||
|
fnm
|
||||||
|
aria2
|
||||||
|
ffmpeg
|
||||||
|
hyfetch
|
||||||
|
wget
|
||||||
|
watch
|
||||||
|
curl
|
||||||
|
];
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
{ abs, pkgs, inputs, ... }:
|
{ abs, pkgs, lib, inputs, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
users.users.teidesu = {
|
users.users.teidesu = {
|
||||||
|
@ -13,20 +13,10 @@
|
||||||
|
|
||||||
home-manager.users.teidesu = { pkgs, ... }: {
|
home-manager.users.teidesu = { pkgs, ... }: {
|
||||||
imports = [
|
imports = [
|
||||||
|
./common.nix
|
||||||
inputs.vscode-server.homeModules.default
|
inputs.vscode-server.homeModules.default
|
||||||
./zsh.nix
|
|
||||||
];
|
];
|
||||||
|
|
||||||
services.vscode-server.enable = true;
|
services.vscode-server.enable = true;
|
||||||
home.stateVersion = "23.11";
|
|
||||||
|
|
||||||
home.packages = with pkgs; [
|
|
||||||
tree
|
|
||||||
nixpkgs-fmt
|
|
||||||
htop
|
|
||||||
jq
|
|
||||||
inputs.nil.packages.${system}.default
|
|
||||||
inputs.agenix.packages.${system}.default
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
}
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
{ pkgs, ... }:
|
{ pkgs, lib, ... }:
|
||||||
|
|
||||||
{
|
{
|
||||||
programs.zsh = {
|
programs.zsh = {
|
||||||
|
@ -17,13 +17,30 @@
|
||||||
|
|
||||||
shellAliases = {
|
shellAliases = {
|
||||||
"rm" = "rm -f";
|
"rm" = "rm -f";
|
||||||
"systemctl" = "sudo systemctl";
|
|
||||||
"entervenv" = "source venv/bin/activate";
|
"entervenv" = "source venv/bin/activate";
|
||||||
|
} // lib.optionalAttrs (pkgs.stdenv.isLinux) {
|
||||||
|
"systemctl" = "sudo systemctl";
|
||||||
};
|
};
|
||||||
|
|
||||||
initExtra = ''
|
initExtra = ''
|
||||||
unsetopt correct_all
|
unsetopt correct_all
|
||||||
export CURRENT_BG="$(( `hostname | cksum | cut -f 1 -d ' '` % 255 ))"
|
|
||||||
|
CURRENT_BG="$(( `hostname | cksum | cut -f 1 -d ' '` % 255 ))"
|
||||||
|
CASE_SENSITIVE="false"
|
||||||
|
HYPHEN_INSENSITIVE="true"
|
||||||
|
ENABLE_CORRECTION="true"
|
||||||
|
COMPLETION_WAITING_DOTS="true"
|
||||||
|
ZSH_AUTOSUGGEST_HIGHLIGHT_STYLE="fg=5"
|
||||||
|
|
||||||
|
if command -v micro &> /dev/null; then
|
||||||
|
export EDITOR="micro"
|
||||||
|
elif command -v nano &> /dev/null; then
|
||||||
|
export EDITOR="nano"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if command -v fnm &> /dev/null; then
|
||||||
|
eval "$(fnm env)"
|
||||||
|
fi
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue