Adds nix-darwin
This commit is contained in:
parent
6d7d721bbc
commit
c25c30e461
46
configuration.nix
Normal file
46
configuration.nix
Normal file
@ -0,0 +1,46 @@
|
||||
{ pkgs, inputs, ... }:
|
||||
{
|
||||
imports = [./nix.nix];
|
||||
security.pam.enableSudoTouchIdAuth = true;
|
||||
system = {
|
||||
defaults = {
|
||||
dock = {
|
||||
appswitcher-all-displays = false;
|
||||
autohide = true;
|
||||
magnification = true;
|
||||
mru-spaces = false;
|
||||
orientation = "bottom";
|
||||
wvous-bl-corner = 13;
|
||||
wvous-br-corner = 14;
|
||||
wvous-tl-corner = 2;
|
||||
wvous-tr-corner = 3;
|
||||
};
|
||||
finder = {
|
||||
AppleShowAllExtensions = true;
|
||||
FXPreferredViewStyle = "Nlsv";
|
||||
};
|
||||
NSGlobalDomain = {
|
||||
AppleEnableMouseSwipeNavigateWithScrolls = true;
|
||||
AppleEnableSwipeNavigateWithScrolls = true;
|
||||
AppleICUForce24HourTime = true;
|
||||
AppleInterfaceStyle = "Dark";
|
||||
AppleInterfaceStyleSwitchesAutomatically = false;
|
||||
NSAutomaticCapitalizationEnabled = false;
|
||||
NSAutomaticDashSubstitutionEnabled = true;
|
||||
NSAutomaticSpellingCorrectionEnabled = false;
|
||||
NSAutomaticPeriodSubstitutionEnabled = false;
|
||||
NSAutomaticQuoteSubstitutionEnabled = true;
|
||||
_HIHideMenuBar = true;
|
||||
};
|
||||
trackpad = {
|
||||
Clicking = true;
|
||||
TrackpadRightClick = true;
|
||||
};
|
||||
};
|
||||
keyboard = {
|
||||
enableKeyMapping = true;
|
||||
remapCapsLockToControl = true;
|
||||
};
|
||||
stateVersion = 4;
|
||||
};
|
||||
}
|
21
flake.lock
generated
21
flake.lock
generated
@ -101,6 +101,26 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nix-darwin": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1700795494,
|
||||
"narHash": "sha256-gzGLZSiOhf155FW7262kdHo2YDeugp3VuIFb4/GGng0=",
|
||||
"owner": "LnL7",
|
||||
"repo": "nix-darwin",
|
||||
"rev": "4b9b83d5a92e8c1fbfd8eb27eda375908c11ec4d",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "LnL7",
|
||||
"repo": "nix-darwin",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1705883077,
|
||||
@ -125,6 +145,7 @@
|
||||
"flake-compat": "flake-compat",
|
||||
"home-manager": "home-manager",
|
||||
"monaspace-font": "monaspace-font",
|
||||
"nix-darwin": "nix-darwin",
|
||||
"nixpkgs": "nixpkgs"
|
||||
}
|
||||
}
|
||||
|
30
flake.nix
30
flake.nix
@ -3,6 +3,10 @@
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs?rev=5f5210aa20e343b7e35f40c033000db0ef80d7b9";
|
||||
nix-darwin = {
|
||||
url = "github:LnL7/nix-darwin";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
};
|
||||
home-manager = {
|
||||
url = "github:nix-community/home-manager";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
@ -29,25 +33,33 @@
|
||||
};
|
||||
};
|
||||
|
||||
outputs = inputs@{ nixpkgs, home-manager, ... }:
|
||||
outputs = inputs@{ self, nixpkgs, nix-darwin, home-manager, ... }:
|
||||
let
|
||||
system = "x86_64-darwin";
|
||||
pkgs = import nixpkgs {
|
||||
inherit system;
|
||||
config = { allowUnfree = true; };
|
||||
};
|
||||
in {
|
||||
homeConfigurations.abhinav = home-manager.lib.homeManagerConfiguration {
|
||||
inherit pkgs;
|
||||
modules = [ ./home.nix ];
|
||||
extraSpecialArgs = { inherit inputs; };
|
||||
in
|
||||
{
|
||||
darwinConfigurations."Abhinavs-MacBook-Pro" = nix-darwin.lib.darwinSystem {
|
||||
inherit system;
|
||||
specialArgs = { inherit inputs; };
|
||||
modules = [
|
||||
./configuration.nix
|
||||
home-manager.darwinModules.home-manager
|
||||
{
|
||||
home-manager.useGlobalPkgs = true;
|
||||
home-manager.useUserPackages = true;
|
||||
home-manager.users.abhinav = import ./home.nix;
|
||||
home-manager.extraSpecialArgs = { inherit inputs; };
|
||||
}
|
||||
];
|
||||
};
|
||||
devShells.${system}.default = pkgs.mkShell {
|
||||
buildInputs = with pkgs; [ (import home-manager { inherit pkgs; }).home-manager just ];
|
||||
shellHook = ''
|
||||
export NIX_PATH=$HOME/.hm-nixchannels;
|
||||
mkdir -p $NIX_PATH;
|
||||
ln -f -s ${pkgs.path} -T $NIX_PATH/nixpkgs;
|
||||
export NIXPKGS_PATH=${pkgs.path};
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
11
home.nix
11
home.nix
@ -1,11 +1,12 @@
|
||||
{ config, pkgs, ... }:
|
||||
{ config, pkgs, lib, ... }:
|
||||
|
||||
{
|
||||
imports = [ ./programs ./scripts ./launchd.nix ./nix.nix ];
|
||||
let username = config.home.username;
|
||||
in {
|
||||
imports = [ ./programs ./scripts ./launchd.nix ];
|
||||
|
||||
home = {
|
||||
username = "abhinav";
|
||||
homeDirectory = "/Users/abhinav";
|
||||
homeDirectory = lib.mkForce "/Users/${username}";
|
||||
stateVersion = "22.05";
|
||||
enableNixpkgsReleaseCheck = true;
|
||||
|
||||
@ -23,7 +24,7 @@
|
||||
|
||||
sessionVariables = {
|
||||
EDITOR = "micro";
|
||||
NIX_PATH = "$HOME/.hm-nixchannels";
|
||||
NIX_PATH = "/nix/var/nix/profiles/per-user/${username}/channels";
|
||||
};
|
||||
|
||||
file."Applications/Home Manager Apps".source = let
|
||||
|
16
justfile
16
justfile
@ -1,5 +1,6 @@
|
||||
in_nix_shell := env_var_or_default("IN_NIX_SHELL", "false")
|
||||
root_dir := justfile_directory()
|
||||
hostname := `scutil --get LocalHostName`
|
||||
|
||||
# choose a just command to run
|
||||
default:
|
||||
@ -18,24 +19,21 @@ _run cmd:
|
||||
fi
|
||||
|
||||
_build:
|
||||
home-manager -v build --flake "{{ root_dir }}#abhinav"
|
||||
nix build {{ root_dir }}#darwinConfigurations.{{ hostname }}.system
|
||||
|
||||
# build latest home-manager generation
|
||||
build: (_run "_build")
|
||||
|
||||
_switch:
|
||||
home-manager -v switch --flake "{{ root_dir }}#abhinav"
|
||||
report-hm-changes
|
||||
_switch: _build
|
||||
./result/sw/bin/darwin-rebuild -v switch --flake "{{ root_dir }}"
|
||||
|
||||
# switch to latest home-manager generation
|
||||
switch: (_run "_switch")
|
||||
|
||||
_update-vscode-extensions:
|
||||
$NIX_PATH/nixpkgs/pkgs/applications/editors/vscode/extensions/update_installed_exts.sh > \
|
||||
{{ root_dir }}/programs/vscode/extensions.nix
|
||||
|
||||
_update: _update-vscode-extensions && _switch
|
||||
_update: && _switch
|
||||
nix flake update --commit-lock-file "{{ root_dir }}"
|
||||
$NIXPKGS_PATH/pkgs/applications/editors/vscode/extensions/update_installed_exts.sh > \
|
||||
{{ root_dir }}/programs/vscode/extensions.nix
|
||||
|
||||
# update packages and switch
|
||||
update: (_run "_update")
|
||||
|
49
nix.nix
49
nix.nix
@ -1,19 +1,36 @@
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
{ config, pkgs, inputs, ... }:
|
||||
{
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
nix.package = pkgs.nixStable;
|
||||
nix.settings = {
|
||||
experimental-features = [ "nix-command" "flakes" "repl-flake" ];
|
||||
max-jobs = 6;
|
||||
cores = 2;
|
||||
auto-optimise-store = true;
|
||||
connect-timeout = 5;
|
||||
log-lines = 25;
|
||||
min-free = 128000000;
|
||||
max-free = 1000000000;
|
||||
fallback = true;
|
||||
warn-dirty = false;
|
||||
keep-outputs = true;
|
||||
services.nix-daemon.enable = true;
|
||||
nix = {
|
||||
package = pkgs.nixFlakes;
|
||||
registry.nixpkgs.flake = inputs.nixpkgs;
|
||||
nixPath = [{ nixpkgs = inputs.nixpkgs.outPath; }];
|
||||
extraOptions = ''
|
||||
keep-outputs = true
|
||||
keep-derivations = true
|
||||
'';
|
||||
gc = {
|
||||
automatic = true;
|
||||
interval.Day = 1;
|
||||
options = "--delete-older-than 7d";
|
||||
};
|
||||
settings = {
|
||||
auto-optimise-store = true;
|
||||
connect-timeout = 5;
|
||||
cores = 2;
|
||||
experimental-features = [ "nix-command" "flakes" "repl-flake" ];
|
||||
fallback = true;
|
||||
keep-outputs = true;
|
||||
log-lines = 25;
|
||||
max-free = 1000000000;
|
||||
max-jobs = 6;
|
||||
min-free = 128000000;
|
||||
warn-dirty = false;
|
||||
trusted-users = ["@admin"];
|
||||
};
|
||||
};
|
||||
nixpkgs = {
|
||||
hostPlatform = "x86_64-darwin";
|
||||
config.allowUnfree = true;
|
||||
};
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
{ inputs, config, pkgs, ... }:
|
||||
|
||||
{
|
||||
let username = config.home.username;
|
||||
in {
|
||||
programs.fish = {
|
||||
enable = true;
|
||||
|
||||
@ -29,7 +30,8 @@
|
||||
shellInit = ''
|
||||
# nix
|
||||
fenv source /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
|
||||
fish_add_path -m ~/.local/bin ~/.cabal/bin
|
||||
fenv source /etc/profiles/per-user/${username}/etc/profile.d/hm-session-vars.sh
|
||||
fish_add_path -m ~/.local/bin ~/.cabal/bin /etc/profiles/per-user/${username}/bin
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user