Splits into separate modules

nix-darwin
Abhinav Sarkar 2022-09-27 13:08:52 +05:30
parent a2d5598b76
commit 71b55fbeaf
7 changed files with 194 additions and 178 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
.DS_Store
.cloudflare_dns_updater_api_token
result

180
home.nix
View File

@ -1,6 +1,8 @@
{ config, pkgs, ... }:
{
imports = [ ./programs ./launchd.nix ./nix.nix ];
home.username = "abhinav";
home.homeDirectory = "/Users/abhinav";
home.stateVersion = "22.05";
@ -16,182 +18,4 @@
home.sessionVariables = { EDITOR = "micro"; };
nixpkgs.config.allowUnfree = true;
nix.package = pkgs.nixUnstable;
nix.settings = {
experimental-features = "nix-command flakes";
max-jobs = 6;
cores = 2;
auto-optimise-store = true;
};
programs.home-manager.enable = true;
programs.htop = {
enable = true;
settings = {
hide_kernel_threads = true;
hide_threads = true;
hide_userland_threads = true;
highlight_base_name = true;
show_program_path = false;
tree_view = true;
};
};
programs.exa = {
enable = true;
enableAliases = true;
};
programs.direnv = {
enable = true;
nix-direnv = { enable = true; };
};
programs.nix-index = {
enable = true;
enableFishIntegration = true;
};
programs.just = {
enable = true;
enableFishIntegration = true;
};
programs.fish = {
enable = true;
plugins = [
{
name = "foreign-env";
src = pkgs.fetchFromGitHub {
owner = "oh-my-fish";
repo = "plugin-foreign-env";
rev = "b3dd471bcc885b597c3922e4de836e06415e52dd";
sha256 = "00xqlyl3lffc5l0viin1nyp819wf81fncqyz87jx8ljjdhilmgbs";
};
}
{
name = "agnoster";
src = pkgs.fetchFromGitHub {
owner = "oh-my-fish";
repo = "theme-agnoster";
rev = "43860ce1536930bca689470e26083b0a5b7bd6ae";
sha256 = "16k94hz3s6wayass6g1lhlcjmbpf2w8mzx90qrrqp120h80xwp25";
};
}
{
name = "fzf";
src = pkgs.fetchFromGitHub {
owner = "PatrickF1";
repo = "fzf.fish";
rev = "2bb6f712b0b99fc5cc40ca78b6b3ba8b2529b0f7";
hash = "sha256-XmRGe39O3xXmTvfawwT2mCwLIyXOlQm7f40mH5tzz+s=";
};
}
];
interactiveShellInit = ''
fzf_configure_bindings --git_status=\cs --history=\cr --variables=\cv --directory=\cf --git_log=\cg
'';
shellInit = ''
# nix
if test -e /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
fenv source /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
end
# home-manager
if test -e $HOME/.nix-profile/etc/profile.d/hm-session-vars.sh
fenv source $HOME/.nix-profile/etc/profile.d/hm-session-vars.sh
end
'';
};
programs.bat = {
enable = true;
config = {
italic-text = "always";
paging = "always";
tabs = "2";
theme = "DarkNeon";
};
};
programs.fzf = {
enable = true;
enableFishIntegration = true;
fileWidgetCommand = "fd --type f --no-ignore";
historyWidgetOptions = [ "--reverse" "--sort" "--exact" ];
};
programs.micro = {
enable = true;
settings = {
autoindent = true;
colorcolumn = 100;
colorscheme = "gotham";
diffgutter = true;
hlsearch = true;
mkparents = true;
savecursor = true;
softwrap = true;
tabsize = 2;
tabstospaces = true;
# plugins
manipulator = true;
};
};
# Packages to install
home.packages = with pkgs; [
broot
cloc
cloudflare-dyndns
config.nix.package
coreutils
delta
dua
entr
fd
gitui
graphviz-nox
haskellPackages.cabal-plan
haskellPackages.graphmod
httpie
mosh
micro
niv
nixfmt
statix
tree
# fonts
fira-mono
inconsolata
jetbrains-mono
nanum-gothic-coding
roboto-mono
source-code-pro
(import ./dm-mono.nix { inherit lib fetchzip; })
];
launchd.agents.dyndns-updater = {
enable = true;
config = {
Program = "${pkgs.cloudflare-dyndns}/bin/cloudflare-dyndns";
ProgramArguments = [
"${pkgs.cloudflare-dyndns}/bin/cloudflare-dyndns"
"--api-token"
(builtins.readFile ./.cloudflare_dns_updater_api_token)
"--debug"
"home.abhinavsarkar.net"
];
StandardErrorPath = "/tmp/cloudflare-dyndns.log";
StandardOutPath = "/tmp/cloudflare-dyndns.log";
StartInterval = 600;
ProcessType = "Background";
};
};
}

21
launchd.nix Normal file
View File

@ -0,0 +1,21 @@
{ config, pkgs, ... }:
{
launchd.agents.dyndns-updater = {
enable = true;
config = {
Program = "${pkgs.cloudflare-dyndns}/bin/cloudflare-dyndns";
ProgramArguments = [
"${pkgs.cloudflare-dyndns}/bin/cloudflare-dyndns"
"--api-token"
(builtins.readFile ./.cloudflare_dns_updater_api_token)
"--debug"
"home.abhinavsarkar.net"
];
StandardErrorPath = "/tmp/cloudflare-dyndns.log";
StandardOutPath = "/tmp/cloudflare-dyndns.log";
StartInterval = 600;
ProcessType = "Background";
};
};
}

12
nix.nix Normal file
View File

@ -0,0 +1,12 @@
{ config, pkgs, ... }:
{
nixpkgs.config.allowUnfree = true;
nix.package = pkgs.nixUnstable;
nix.settings = {
experimental-features = "nix-command flakes";
max-jobs = 6;
cores = 2;
auto-optimise-store = true;
};
}

106
programs/default.nix Normal file
View File

@ -0,0 +1,106 @@
{ config, pkgs, ... }:
{
imports = [ ./fish.nix ];
home.packages = with pkgs; [
broot
cloc
cloudflare-dyndns
config.nix.package
coreutils
delta
dua
entr
fd
gitui
graphviz-nox
haskellPackages.cabal-plan
haskellPackages.graphmod
httpie
mosh
micro
niv
nixfmt
statix
tree
# fonts
fira-mono
inconsolata
jetbrains-mono
nanum-gothic-coding
roboto-mono
source-code-pro
(import ../packages/dm-mono.nix { inherit lib fetchzip; })
];
programs.home-manager.enable = true;
programs.htop = {
enable = true;
settings = {
hide_kernel_threads = true;
hide_threads = true;
hide_userland_threads = true;
highlight_base_name = true;
show_program_path = false;
tree_view = true;
};
};
programs.exa = {
enable = true;
enableAliases = true;
};
programs.direnv = {
enable = true;
nix-direnv = { enable = true; };
};
programs.nix-index = {
enable = true;
enableFishIntegration = true;
};
programs.just = {
enable = true;
enableFishIntegration = true;
};
programs.bat = {
enable = true;
config = {
italic-text = "always";
paging = "always";
tabs = "2";
theme = "DarkNeon";
};
};
programs.fzf = {
enable = true;
enableFishIntegration = true;
fileWidgetCommand = "fd --type f --no-ignore";
historyWidgetOptions = [ "--reverse" "--sort" "--exact" ];
};
programs.micro = {
enable = true;
settings = {
autoindent = true;
colorcolumn = 100;
colorscheme = "gotham";
diffgutter = true;
hlsearch = true;
mkparents = true;
savecursor = true;
softwrap = true;
tabsize = 2;
tabstospaces = true;
# plugins
manipulator = true;
};
};
}

52
programs/fish.nix Normal file
View File

@ -0,0 +1,52 @@
{ config, pkgs, ... }:
{
programs.fish = {
enable = true;
plugins = [
{
name = "foreign-env";
src = pkgs.fetchFromGitHub {
owner = "oh-my-fish";
repo = "plugin-foreign-env";
rev = "b3dd471bcc885b597c3922e4de836e06415e52dd";
sha256 = "00xqlyl3lffc5l0viin1nyp819wf81fncqyz87jx8ljjdhilmgbs";
};
}
{
name = "agnoster";
src = pkgs.fetchFromGitHub {
owner = "oh-my-fish";
repo = "theme-agnoster";
rev = "43860ce1536930bca689470e26083b0a5b7bd6ae";
sha256 = "16k94hz3s6wayass6g1lhlcjmbpf2w8mzx90qrrqp120h80xwp25";
};
}
{
name = "fzf";
src = pkgs.fetchFromGitHub {
owner = "PatrickF1";
repo = "fzf.fish";
rev = "2bb6f712b0b99fc5cc40ca78b6b3ba8b2529b0f7";
hash = "sha256-XmRGe39O3xXmTvfawwT2mCwLIyXOlQm7f40mH5tzz+s=";
};
}
];
interactiveShellInit = ''
fzf_configure_bindings --git_status=\cs --history=\cr --variables=\cv --directory=\cf --git_log=\cg
'';
shellInit = ''
# nix
if test -e /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
fenv source /nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh
end
# home-manager
if test -e $HOME/.nix-profile/etc/profile.d/hm-session-vars.sh
fenv source $HOME/.nix-profile/etc/profile.d/hm-session-vars.sh
end
'';
};
}