Major refactorings

main
Sam Hatfield 9 months ago
parent bce333650a
commit 954ef7d36b

@ -3,7 +3,7 @@
inputs = {
nixpkgs.url = "nixpkgs/nixos-22.11";
home-manager.url = "github:nix-community/home-manager/release-22.11";
nur.url = "github:nix-community/NUR";
@ -15,78 +15,294 @@
username = "sehqlr";
in {
nixosModules = {
common = { config, lib, pkgs, ... }: {
environment = {
systemPackages = with pkgs; [
commonsCompress
];
pathsToLink = [ "/share/zsh" ];
};
i18n.defaultLocale = "en_US.UTF-8";
nix = {
autoOptimiseStore = true;
binaryCaches = [
"https://cache.iog.io"
];
binaryCachePublicKeys = [
"hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ="
];
gc.automatic = true;
package = pkgs.nixUnstable;
trustedUsers = [ "root" "${username}" ];
};
nixpkgs = {
overlays = [ nur.overlay ];
config = import ./nixpkgs-config.nix;
};
users.users.${username} = {
description = "${username}";
extraGroups = [ "wheel" ];
isNormalUser = true;
shell = pkgs.zsh;
};
};
sehqlr = { config, lib, pkgs, ... }:
let cfg = config.sehqlr;
in {
desktop = { config, lib, pkgs, ... }: {
imports = [
self.nixosModules.common
home-manager.nixosModules.home-manager
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
users.${username} = import ./homes/sehqlr/desktop.nix;
};
}
./nixos/desktop.nix
];
};
imports = [ home-manager.nixosModules.home-manager ];
wsl = { config, lib, pkgs, ...}: {
imports = [
self.nixosModules.common
home-manager.nixosModules.home-manager
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
users.${username} = import ./homes/sehqlr/terminal.nix;
};
}
];
};
options.sehqlr = {
enable = mkEnableOption "sehqlr's configuration";
graphical = mkEnableOption "graphical services";
stateVersion = mkOption {
type = types.str;
description = lib.mdDoc "What stateVersion to use";
};
config = lib.mkMerge [
(lib.mkIf cfg.enable {
environment = {
systemPackages = with pkgs; [ commonsCompress ];
pathsToLink = [ "/share/zsh" ];
};
i18n.defaultLocale = "en_US.UTF-8";
nix = {
autoOptimiseStore = true;
binaryCaches = [ "https://cache.iog.io" ];
binaryCachePublicKeys = [
"hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ="
];
gc.automatic = true;
package = pkgs.nixUnstable;
trustedUsers = [ "root" "${username}" ];
};
nixpkgs = {
overlays = [ nur.overlay ];
config = import ./nixpkgs-config.nix;
};
users.users.${username} = {
description = "${username}";
extraGroups = [ "wheel" ];
isNormalUser = true;
shell = pkgs.zsh;
};
home-manager.users.${username} = {
home = {
file = { ".cabal/config".source = ./cabal-config; };
packages = with pkgs; [
age
aspell
aspellDicts.en
aspellDicts.en-computers
cachix
httpie
nixfmt
pandoc
python3Packages.editorconfig
ripgrep
sops
vale
];
sessionVariables = { EDITOR = "kak"; };
stateVersion = cfg.stateVersion;
};
manual.manpages.enable = false;
programs.bat.enable = true;
programs.direnv = {
enable = true;
enableZshIntegration = true;
config = {
global = {
strict_env = true;
load_dotenv = false;
};
};
};
programs.fzf = {
enable = true;
enableZshIntegration = true;
};
programs.gh.enable = true;
programs.git = {
enable = true;
aliases = {
graph = "log --graph --oneline --decorate";
staged = "diff --cached";
wip =
"for-each-ref --sort='authordate:iso8601' --format='%(color:green)%(authordate:relative)%09%(color:white)%(refname:short)' refs/heads";
};
extraConfig = { init.defaultBranch = "main"; };
ignores = [ "result" ];
lfs.enable = true;
userEmail = "hey@samhatfield.me";
userName = "sehqlr";
};
programs.go.enable = true;
programs.home-manager.enable = true;
programs.htop.enable = true;
programs.jq.enable = true;
programs.kakoune = {
enable = true;
config = {
colorScheme = "solarized-dark";
hooks = [
{
name = "WinCreate";
option = "^[^*]+$";
commands = ''
editorconfig-load
'';
}
{
name = "WinSetOption";
option = "filetype=markdown";
commands = ''
set-option buffer lintcmd 'vale'
set-option buffer formatcmd 'pandoc -f markdown -t markdown-smart -s'
'';
}
{
name = "BufCreate";
option = "^.*lhs$";
commands = "set-option buffer filetype markdown";
}
{
name = "InsertChar";
option = "j";
commands = ''
try %{
exec -draft hH <a-k>jj<ret> d
exec <esc>
}
'';
}
{
name = "BufCreate";
option = "^.*nix$";
commands = ''
set-option buffer formatcmd 'nixfmt'
set-option buffer lintcmd 'nix-linter'
'';
}
];
numberLines.enable = true;
showWhitespace.enable = true;
ui.enableMouse = true;
wrapLines = {
enable = true;
marker = "";
word = true;
};
};
};
programs.ssh = {
enable = true;
matchBlocks = {
"bytes.zone" = {
host = "git.bytes.zone";
port = 2222;
user = "git";
identityFile = "~/.ssh/id_rsa";
extraOptions = {
HostKeyAlgorithms = "+ssh-rsa";
PubkeyAcceptedKeyTypes = "+ssh-rsa";
};
};
"github" = {
host = "github.com";
user = "git";
identityFile = "~/.ssh/id_rsa";
};
"gitlab" = {
host = "gitlab.com";
user = "git";
identityFile = "~/.ssh/id_rsa";
};
"sr.ht".host = "*sr.ht";
"samhatfield.me" = {
host = "samhatfield.me";
user = "root";
identityFile = "~/.ssh/id_rsa";
};
};
};
programs.starship = {
enable = true;
enableZshIntegration = true;
settings = {
add_newline = false;
character = {
success_symbol = "[λ](bold·green)";
error_symbol = "[λ](bold·red)";
};
};
};
programs.tmux = {
enable = true;
clock24 = true;
extraConfig = ''
set -g mouse on
'';
plugins = with pkgs; [{
plugin = tmuxPlugins.tmux-colors-solarized;
extraConfig = ''
set -g @colors-solarized 'dark'
set -g status-right ""
'';
}];
terminal = "tmux-256color";
shortcut = "a";
};
programs.zoxide = {
enable = true;
enableZshIntegration = true;
};
programs.zsh = {
enable = true;
enableCompletion = true;
oh-my-zsh = {
enable = true;
plugins =
[ "git" "httpie" "ripgrep" "sudo" "systemd" "tmux" ];
theme = "af-magic";
};
shellAliases = {
cat = "bat";
nixos = "nixos-rebuild";
};
};
};
xdg.configFile = {
"nix/nix.conf".source = ./nix.conf;
"nixpkgs/config.nix".source = ./nixpkgs-config.nix;
};
})
(lib.mkIf cfg.graphical {
fonts = {
enableDefaultFonts = true;
fonts = with pkgs;
[ (nerdfonts.override { fonts = [ "FiraCode" ]; }) ];
fontconfig.enable = true;
};
services.flatpak.enable = true;
services.printing.enable = true;
services.xserver = {
enable = true;
desktopManager.pantheon.enable = true;
displayManager.lightdm = {
enable = true;
greeters.pantheon.enable = false;
};
};
users.users.${username}.extraGroups = [ "audio" "video" ];
home-manager.users.${username} = {
programs.alacritty.enable = true;
};
})
];
};
"samhatfield.me" = { config, lib, pkgs, ... }: {
imports = [
self.nixosModules.common
home-manager.nixosModules.home-manager
{
home-manager = {
useGlobalPkgs = true;
useUserPackages = true;
users.${username} = import ./homes/sehqlr/terminal.nix;
};
}
./nixos/lychee.nix
./nixos/minecraft.nix
./nixos/paperless.nix

@ -1,205 +0,0 @@
{ config, lib, pkgs, ... }: {
home = {
file = {
".cabal/config".source = ./cabal-config;
};
packages = with pkgs; [
age
aspell
aspellDicts.en
aspellDicts.en-computers
cachix
httpie
nixfmt
pandoc
python3Packages.editorconfig
ripgrep
sops
vale
];
sessionVariables = { EDITOR = "kak"; };
};
manual.manpages.enable = false;
programs.bat.enable = true;
programs.direnv = {
enable = true;
enableZshIntegration = true;
config = {
global = {
strict_env = true;
load_dotenv = false;
};
};
};
programs.fzf = {
enable = true;
enableZshIntegration = true;
};
programs.gh.enable = true;
programs.git = {
enable = true;
aliases = {
graph = "log --graph --oneline --decorate";
staged = "diff --cached";
wip =
"for-each-ref --sort='authordate:iso8601' --format='%(color:green)%(authordate:relative)%09%(color:white)%(refname:short)' refs/heads";
};
extraConfig = { init.defaultBranch = "main"; };
ignores = [ "result" ];
lfs.enable = true;
userEmail = "hey@samhatfield.me";
userName = "sehqlr";
};
programs.go.enable = true;
programs.home-manager.enable = true;
programs.jq.enable = true;
programs.kakoune = {
enable = true;
config = {
colorScheme = "solarized-dark";
hooks = [
{
name = "WinCreate";
option = "^[^*]+$";
commands = ''
editorconfig-load
'';
}
{
name = "WinSetOption";
option = "filetype=markdown";
commands = ''
set-option buffer lintcmd 'vale'
set-option buffer formatcmd 'pandoc -f markdown -t markdown-smart -s'
'';
}
{
name = "BufCreate";
option = "^.*lhs$";
commands = "set-option buffer filetype markdown";
}
{
name = "InsertChar";
option = "j";
commands = ''
try %{
exec -draft hH <a-k>jj<ret> d
exec <esc>
}
'';
}
{
name = "BufCreate";
option = "^.*nix$";
commands = ''
set-option buffer formatcmd 'nixfmt'
set-option buffer lintcmd 'nix-linter'
'';
}
];
numberLines.enable = true;
showWhitespace.enable = true;
ui.enableMouse = true;
wrapLines = {
enable = true;
marker = "";
word = true;
};
};
};
programs.ssh = {
enable = true;
matchBlocks = {
"bytes.zone" = {
host = "git.bytes.zone";
port = 2222;
user = "git";
identityFile = "~/.ssh/id_rsa";
extraOptions = {
HostKeyAlgorithms = "+ssh-rsa";
PubkeyAcceptedKeyTypes = "+ssh-rsa";
};
};
"github" = {
host = "github.com";
user = "git";
identityFile = "~/.ssh/id_rsa";
};
"gitlab" = {
host = "gitlab.com";
user = "git";
identityFile = "~/.ssh/id_rsa";
};
"sr.ht".host = "*sr.ht";
"samhatfield.me" = {
host = "samhatfield.me";
user = "root";
identityFile = "~/.ssh/id_rsa";
};
};
};
programs.starship = {
enable = true;
enableZshIntegration = true;
settings = {
add_newline = false;
character = {
success_symbol = "[λ](bold·green)";
error_symbol = "[λ](bold·red)";
};
};
};
programs.tmux = {
enable = true;
clock24 = true;
extraConfig = ''
set -g mouse on
'';
plugins = with pkgs; [{
plugin = tmuxPlugins.tmux-colors-solarized;
extraConfig = ''
set -g @colors-solarized 'dark'
set -g status-right ""
'';
}];
terminal = "tmux-256color";
shortcut = "a";
};
programs.zoxide = {
enable = true;
enableZshIntegration = true;
};
programs.zsh = {
enable = true;
enableCompletion = true;
oh-my-zsh = {
enable = true;
plugins = [ "git" "httpie" "ripgrep" "sudo" "systemd" "tmux" ];
theme = "af-magic";
};
shellAliases = {
cat = "bat";
nixos = "nixos-rebuild";
};
};
xdg.configFile = {
"nix/nix.conf".source = ./nix.conf;
"nixpkgs/config.nix".source = ../../nixpkgs-config.nix;
};
}

@ -1,5 +0,0 @@
{ config, lib, pkgs, ... }: {
imports = [ ./common.nix ];
programs.alacritty.enable = true;
}

@ -1,4 +0,0 @@
{ config, lib, pkgs, ... }: {
imports = [ ./common.nix ];
programs.htop.enable = true;
}
Loading…
Cancel
Save