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"
|
||||
}
|
||||
},
|
||||
"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": {
|
||||
"locked": {
|
||||
"lastModified": 1704194953,
|
||||
|
@ -179,6 +199,7 @@
|
|||
"bootspec-secureboot": "bootspec-secureboot",
|
||||
"home-manager": "home-manager_2",
|
||||
"nil": "nil",
|
||||
"nix-darwin": "nix-darwin",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"vscode-server": "vscode-server"
|
||||
}
|
||||
|
|
24
flake.nix
24
flake.nix
|
@ -36,6 +36,9 @@
|
|||
url = "github:nix-community/home-manager/master";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
nix-darwin.url = "github:LnL7/nix-darwin";
|
||||
nix-darwin.inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
|
||||
outputs =
|
||||
|
@ -45,26 +48,39 @@
|
|||
, agenix
|
||||
, bootspec-secureboot
|
||||
, home-manager
|
||||
, nix-darwin
|
||||
, ...
|
||||
}:
|
||||
let
|
||||
makeNixosSystem = obj: nixpkgs.lib.nixosSystem (obj // {
|
||||
specialArgs = (obj.specialArgs or { }) // {
|
||||
specialArgs = {
|
||||
inherit inputs;
|
||||
abs = path: ./. + ("/" + path);
|
||||
};
|
||||
});
|
||||
in
|
||||
{
|
||||
nixosConfigurations = {
|
||||
koi = makeNixosSystem {
|
||||
koi = nixpkgs.lib.nixosSystem {
|
||||
system = "x86_64-linux";
|
||||
modules = [
|
||||
agenix.nixosModules.default
|
||||
bootspec-secureboot.nixosModules.bootspec-secureboot
|
||||
home-manager.nixosModules.home-manager
|
||||
{ home-manager.extraSpecialArgs = specialArgs; }
|
||||
./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 = [
|
||||
(abs "hosts/nixos-common.nix")
|
||||
(abs "users/teidesu/default.nix")
|
||||
(abs "users/teidesu/server.nix")
|
||||
./hardware-configuration.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;
|
||||
}
|
||||
|
8
switch
8
switch
|
@ -23,4 +23,12 @@ if [ "$1" == "boot" ]; then
|
|||
shift
|
||||
fi
|
||||
|
||||
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 = {
|
||||
|
@ -13,20 +13,10 @@
|
|||
|
||||
home-manager.users.teidesu = { pkgs, ... }: {
|
||||
imports = [
|
||||
./common.nix
|
||||
inputs.vscode-server.homeModules.default
|
||||
./zsh.nix
|
||||
];
|
||||
|
||||
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 = {
|
||||
|
@ -17,13 +17,30 @@
|
|||
|
||||
shellAliases = {
|
||||
"rm" = "rm -f";
|
||||
"systemctl" = "sudo systemctl";
|
||||
"entervenv" = "source venv/bin/activate";
|
||||
} // lib.optionalAttrs (pkgs.stdenv.isLinux) {
|
||||
"systemctl" = "sudo systemctl";
|
||||
};
|
||||
|
||||
initExtra = ''
|
||||
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