Skip to content

Commit

Permalink
chore(modules/home): brain damage, pt 1
Browse files Browse the repository at this point in the history
  • Loading branch information
bddvlpr committed Jun 17, 2024
1 parent 09a3459 commit 06fe248
Show file tree
Hide file tree
Showing 6 changed files with 167 additions and 59 deletions.
17 changes: 16 additions & 1 deletion modules/home/comma/default.nix
Original file line number Diff line number Diff line change
@@ -1,11 +1,26 @@
{
inputs,
lib,
config,
pkgs,
...
}: let
inherit (inputs.nix-index-database.hmModules) nix-index;
inherit (lib) mkIf mkOption types;

cfg = config.sysc.comma;
in {
imports = [nix-index];

home.packages = with pkgs; [comma];
options.sysc.comma = {
enable = mkOption {
type = types.bool;
default = true;
description = "Whether to enable Comma.";
};
};

config = mkIf cfg.enable {
home.packages = with pkgs; [comma];
};
}
23 changes: 21 additions & 2 deletions modules/home/dev/default.nix
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
{pkgs, ...}: {
home.packages = with pkgs; [nodejs] ++ (with nodePackages; [yarn pnpm]);
{
pkgs,
lib,
config,
...
}: let
inherit (lib) mkIf mkOption types;

cfg = config.sysc.dev;
in {
options.sysc.dev = {
enable = mkOption {
type = types.bool;
default = true;
description = "Whether to set-up dev tools.";
};
};

config = mkIf cfg.enable {
home.packages = with pkgs; [nodejs] ++ (with nodePackages; [yarn pnpm]);
};
}
32 changes: 28 additions & 4 deletions modules/home/direnv/default.nix
Original file line number Diff line number Diff line change
@@ -1,8 +1,32 @@
{
programs.direnv = {
enable = true;
nix-direnv.enable = true;
lib,
config,
...
}: let
inherit (lib) mkIf mkOption types;

cfg = config.sysc.direnv;
in {
options.sysc.direnv = {
enable = mkOption {
type = types.bool;
default = true;
description = "Whether to enable direnv.";
};

enableNixDirenv = mkOption {
type = types.bool;
default = true;
description = "Whether to enable nix-direnv integration.";
};
};

home.persistence."/persist/home/bddvlpr".directories = [".local/share/direnv"];
config = mkIf cfg.enable {
programs.direnv = {
enable = true;
nix-direnv.enable = cfg.enableNixDirenv;
};

home.persistence."/persist/home/bddvlpr".directories = [".local/share/direnv"];
};
}
32 changes: 25 additions & 7 deletions modules/home/firefox/default.nix
Original file line number Diff line number Diff line change
@@ -1,12 +1,30 @@
{
programs.firefox.enable = true;
lib,
config,
...
}: let
inherit (lib) mkIf mkOption types;

home = {
sessionVariables.BROWSER = "firefox";
persistence."/persist/home/bddvlpr" = {
directories = [
".mozilla/firefox"
];
cfg = config.sysc.firefox;
in {
options.sysc.firefox = {
enable = mkOption {
type = types.bool;
default = true;
description = "Whether to enable firefox.";
};
};

config = mkIf cfg.enable {
programs.firefox.enable = true;

home = {
sessionVariables.BROWSER = "firefox";
persistence."/persist/home/bddvlpr" = {
directories = [
".mozilla/firefox"
];
};
};
};
}
75 changes: 44 additions & 31 deletions modules/home/fish/default.nix
Original file line number Diff line number Diff line change
@@ -1,46 +1,59 @@
{
lib,
pkgs,
config,
...
}: let
inherit (lib) mkIf mkOption types;
inherit (lib.strings) hasSuffix;

cfg = config.sysc.fish;
isDarwin = hasSuffix "-darwin" pkgs.system;
in {
programs.fish = {
enable = true;
options.sysc.fish = {
enable = mkOption {
type = types.bool;
default = true;
description = "Whether to enable fish.";
};
};

shellAbbrs = let
build-command =
if isDarwin
then "darwin-rebuild --flake ."
else "sudo nixos-rebuild --flake /etc/nixos";
in {
n = "nix";
nb = "nix build";
nbn = "nix build nixpkgs#";
nf = "nix flake";
nfu = "nix flake update";
nfmt = "nix fmt";
nr = "nix run";
nrn = "nix run nixpkgs#";
ns = "nix shell";
nsn = "nix shell nixpkgs#";
config = mkIf cfg.enable {
programs.fish = {
enable = true;

snr = "${build-command} --flake /etc/nixos";
snrs = "${build-command} switch";
};
shellAbbrs = let
build-command =
if isDarwin
then "darwin-rebuild --flake ."
else "sudo nixos-rebuild --flake /etc/nixos";
in {
n = "nix";
nb = "nix build";
nbn = "nix build nixpkgs#";
nf = "nix flake";
nfu = "nix flake update";
nfmt = "nix fmt";
nr = "nix run";
nrn = "nix run nixpkgs#";
ns = "nix shell";
nsn = "nix shell nixpkgs#";

shellAliases = let
inherit (lib) getExe;
in {
ls = "${getExe pkgs.eza} --icons -F -H --group-directories-first --git";
cat = "${getExe pkgs.bat} -pp --theme=base16";
};
snr = "${build-command} --flake /etc/nixos";
snrs = "${build-command} switch";
};

shellAliases = let
inherit (lib) getExe;
in {
ls = "${getExe pkgs.eza} --icons -F -H --group-directories-first --git";
cat = "${getExe pkgs.bat} -pp --theme=base16";
};

shellInit = ''
set fish_greeting
export TERM=xterm-256color
'';
shellInit = ''
set fish_greeting
export TERM=xterm-256color
'';
};
};
}
47 changes: 33 additions & 14 deletions modules/home/git/default.nix
Original file line number Diff line number Diff line change
@@ -1,20 +1,39 @@
{pkgs, ...}: {
programs.git = {
enable = true;
package = pkgs.gitFull;
{
lib,
config,
pkgs,
...
}: let
inherit (lib) mkIf mkOption types;

userName = "Luna Simons";
userEmail = "[email protected]";

signing = {
key = "42EDAE8164B99C3A4B835711AB69B6F3380869A8";
signByDefault = true;
cfg = config.sysc.git;
in {
options.sysc.git = {
enable = mkOption {
type = types.bool;
default = true;
description = "Whether to enable git.";
};
};

config = mkIf cfg.enable {
programs.git = {
enable = true;
package = pkgs.gitFull;

userName = "Luna Simons";
userEmail = "[email protected]";

signing = {
key = "42EDAE8164B99C3A4B835711AB69B6F3380869A8";
signByDefault = true;
};

extraConfig = {
init.defaultBranch = "main";
push.autoSetupRemote = true;
credential.helper = "libsecret";
extraConfig = {
init.defaultBranch = "main";
push.autoSetupRemote = true;
credential.helper = "libsecret";
};
};
};
}

0 comments on commit 06fe248

Please sign in to comment.