Add Nix flake configuration
This commit is contained in:
15
modules/default.nix
Normal file
15
modules/default.nix
Normal file
@ -0,0 +1,15 @@
|
||||
{
|
||||
imports = [
|
||||
./options.nix
|
||||
./desktop/firefox.nix
|
||||
./desktop/gnome.nix
|
||||
./editors/neovim.nix
|
||||
./editors/vscode.nix
|
||||
./security/gpg.nix
|
||||
./security/pass.nix
|
||||
./shell/fzf.nix
|
||||
./shell/git.nix
|
||||
./shell/nnn.nix
|
||||
./shell/zsh.nix
|
||||
];
|
||||
}
|
16
modules/desktop/firefox.nix
Normal file
16
modules/desktop/firefox.nix
Normal file
@ -0,0 +1,16 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
with lib.my;
|
||||
let cfg = config.modules.desktop.firefox;
|
||||
in {
|
||||
options.modules.desktop.firefox = {
|
||||
enable = mkBoolOpt false;
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.programs.firefox = {
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
}
|
37
modules/desktop/gnome.nix
Normal file
37
modules/desktop/gnome.nix
Normal file
@ -0,0 +1,37 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
with lib.my;
|
||||
let cfg = config.modules.desktop.gnome;
|
||||
in {
|
||||
options.modules.desktop.gnome = {
|
||||
enable = mkBoolOpt false;
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
services.xserver = {
|
||||
enable = true;
|
||||
displayManager.gdm.enable = true;
|
||||
desktopManager.gnome.enable = true;
|
||||
};
|
||||
|
||||
fonts.fonts = with pkgs; [
|
||||
noto-fonts
|
||||
ubuntu_font_family
|
||||
];
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
bind
|
||||
bmon
|
||||
fd
|
||||
ffmpeg
|
||||
iotop
|
||||
ripgrep
|
||||
rsync
|
||||
tcpdump
|
||||
tokei
|
||||
tree
|
||||
wl-clipboard
|
||||
];
|
||||
};
|
||||
}
|
18
modules/editors/neovim.nix
Normal file
18
modules/editors/neovim.nix
Normal file
@ -0,0 +1,18 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
with lib.my;
|
||||
let cfg = config.modules.editors.neovim;
|
||||
in {
|
||||
options.modules.editors.neovim = {
|
||||
enable = mkBoolOpt false;
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.programs.neovim = {
|
||||
enable = true;
|
||||
vimAlias = true;
|
||||
vimdiffAlias = true;
|
||||
};
|
||||
};
|
||||
}
|
16
modules/editors/vscode.nix
Normal file
16
modules/editors/vscode.nix
Normal file
@ -0,0 +1,16 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
with lib.my;
|
||||
let cfg = config.modules.editors.vscode;
|
||||
in {
|
||||
options.modules.editors.vscode = {
|
||||
enable = mkBoolOpt false;
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.programs.vscode = {
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
}
|
69
modules/options.nix
Normal file
69
modules/options.nix
Normal file
@ -0,0 +1,69 @@
|
||||
{ config, options, lib, home-manager, ... }:
|
||||
|
||||
with lib;
|
||||
with lib.my;
|
||||
{
|
||||
options = with types; {
|
||||
user = mkOpt attrs { };
|
||||
|
||||
home = {
|
||||
configFile = mkOpt' attrs { } "Files to place in $XDG_CONFIG_HOME";
|
||||
dataFile = mkOpt' attrs { } "Files to place in $XDG_DATA_HOME";
|
||||
file = mkOpt' attrs { } "Files to place directly in $HOME";
|
||||
packages = mkOpt' attrs { } "User-level installed packages";
|
||||
programs = mkOpt' attrs { } "Programs managed directly from home-manager";
|
||||
services = mkOpt' attrs { } "Services managed directly from home-manager";
|
||||
};
|
||||
|
||||
env = mkOption {
|
||||
type = attrsOf (oneOf [ str path (listOf (either str path)) ]);
|
||||
apply = mapAttrs (n: v:
|
||||
if isList v then
|
||||
concatMapStringsSep ":" (x: toString x) v
|
||||
else
|
||||
(toString v));
|
||||
default = { };
|
||||
description = "";
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
user =
|
||||
let user = builtins.getEnv "USER";
|
||||
name = if elem user [ "" "root" ] then "jordan" else user;
|
||||
in {
|
||||
inherit name;
|
||||
isNormalUser = true;
|
||||
extraGroups = [ "networkmanager" "wheel" ];
|
||||
description = "Jordan Holt";
|
||||
useDefaultShell = true;
|
||||
home = "/home/${name}";
|
||||
group = "users";
|
||||
uid = 1000;
|
||||
};
|
||||
|
||||
home-manager = {
|
||||
useGlobalPkgs = true;
|
||||
useUserPackages = true;
|
||||
|
||||
users.${config.user.name} = {
|
||||
home = {
|
||||
file = mkAliasDefinitions options.home.file;
|
||||
stateVersion = config.system.stateVersion;
|
||||
};
|
||||
home.packages = mkAliasDefinitions options.home.packages;
|
||||
programs = mkAliasDefinitions options.home.programs;
|
||||
services = mkAliasDefinitions options.home.services;
|
||||
xdg = {
|
||||
enable = true;
|
||||
configFile = mkAliasDefinitions options.home.configFile;
|
||||
dataFile = mkAliasDefinitions options.home.dataFile;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
users.users.${config.user.name} = mkAliasDefinitions options.user;
|
||||
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
};
|
||||
}
|
21
modules/security/gpg.nix
Normal file
21
modules/security/gpg.nix
Normal file
@ -0,0 +1,21 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
with lib.my;
|
||||
let cfg = config.modules.security.gpg;
|
||||
in {
|
||||
options.modules.security.gpg = {
|
||||
enable = mkBoolOpt false;
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.programs.gpg = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
home.services.gpg-agent = {
|
||||
enable = true;
|
||||
enableSshSupport = true;
|
||||
};
|
||||
};
|
||||
}
|
17
modules/security/pass.nix
Normal file
17
modules/security/pass.nix
Normal file
@ -0,0 +1,17 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
with lib.my;
|
||||
let cfg = config.modules.security.pass;
|
||||
in {
|
||||
options.modules.security.pass = {
|
||||
enable = mkBoolOpt false;
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.programs.password-store = {
|
||||
enable = true;
|
||||
package = pkgs.pass.withExtensions (exts: [ exts.pass-otp ]);
|
||||
};
|
||||
};
|
||||
}
|
21
modules/shell/fzf.nix
Normal file
21
modules/shell/fzf.nix
Normal file
@ -0,0 +1,21 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
with lib.my;
|
||||
let cfg = config.modules.shell.fzf;
|
||||
in {
|
||||
options.modules.shell.fzf = {
|
||||
enable = mkBoolOpt false;
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = with pkgs; [
|
||||
bind
|
||||
];
|
||||
home.programs.fzf = {
|
||||
enable = true;
|
||||
enableZshIntegration = true;
|
||||
defaultCommand = "fd --type f --hidden --follow --exclude .git";
|
||||
};
|
||||
};
|
||||
}
|
34
modules/shell/git.nix
Normal file
34
modules/shell/git.nix
Normal file
@ -0,0 +1,34 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
with lib.my;
|
||||
let cfg = config.modules.shell.git;
|
||||
in {
|
||||
options.modules.shell.git = {
|
||||
enable = mkBoolOpt false;
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.programs.git = {
|
||||
enable = true;
|
||||
aliases = {
|
||||
amend = "commit --amend";
|
||||
lg = "log --color --graph --abbrev-commit --";
|
||||
ls = "ls-files";
|
||||
unadd = "reset HEAD";
|
||||
undo-commit = "reset --soft \"HEAD^\"";
|
||||
};
|
||||
userEmail = "jordan@vimium.com";
|
||||
userName = "Jordan Holt";
|
||||
signing = {
|
||||
key = "B8CFFF61F1CCF520";
|
||||
signByDefault = true;
|
||||
};
|
||||
extraConfig = {
|
||||
rebase.autosquash = true;
|
||||
push.default = "current";
|
||||
pull.rebase = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
16
modules/shell/nnn.nix
Normal file
16
modules/shell/nnn.nix
Normal file
@ -0,0 +1,16 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
with lib.my;
|
||||
let cfg = config.modules.shell.nnn;
|
||||
in {
|
||||
options.modules.shell.nnn = {
|
||||
enable = mkBoolOpt false;
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.programs.nnn = {
|
||||
enable = true;
|
||||
};
|
||||
};
|
||||
}
|
35
modules/shell/zsh.nix
Normal file
35
modules/shell/zsh.nix
Normal file
@ -0,0 +1,35 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
with lib.my;
|
||||
let cfg = config.modules.shell.zsh;
|
||||
in {
|
||||
options.modules.shell.zsh = {
|
||||
enable = mkBoolOpt false;
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
home.packages = with pkgs; [
|
||||
zsh-autosuggestions
|
||||
zsh-fast-syntax-highlighting
|
||||
zsh-history-substring-search
|
||||
];
|
||||
|
||||
home.programs.zsh = {
|
||||
enable = true;
|
||||
enableCompletion = true;
|
||||
shellAliases = {
|
||||
cp = "cp -iv";
|
||||
mv = "mv -iv";
|
||||
rm = "rm -v";
|
||||
mkdir = "mkdir -v";
|
||||
ls = "ls -h --color=auto --group-directories-first";
|
||||
e = "nvim";
|
||||
f = "nnn";
|
||||
g = "git";
|
||||
n = "nnn";
|
||||
v = "nvim";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user