Unified home and system modules!
This commit is contained in:
@@ -1,21 +1,18 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
let
|
||||
cfg = config.samfelag.modules.app.alacritty;
|
||||
in
|
||||
{
|
||||
options.samfelag.modules.app.alacritty = {
|
||||
enable = mkEnableOption "alacritty";
|
||||
enable = lib.mkEnableOption "alacritty";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
config = lib.mkIf cfg.enable {
|
||||
fonts.fontconfig.enable = true;
|
||||
home.packages = with pkgs; [
|
||||
hm.home.packages = with pkgs; [
|
||||
alacritty
|
||||
(nerdfonts.override { fonts = [ "Iosevka" ]; })
|
||||
];
|
||||
|
||||
home.configFile."alacritty".source = ../../config/.config/alacritty;
|
||||
hm.xdg.configFile."alacritty".source = ../../config/.config/alacritty;
|
||||
};
|
||||
}
|
||||
|
||||
17
modules/app/discord.nix
Normal file
17
modules/app/discord.nix
Normal file
@@ -0,0 +1,17 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
let
|
||||
cfg = config.samfelag.modules.app.discord;
|
||||
in
|
||||
{
|
||||
options.samfelag.modules.app.discord = {
|
||||
enable = mkEnableOption "discord";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
hm.home.packages = with pkgs; [
|
||||
discord
|
||||
];
|
||||
};
|
||||
}
|
||||
15
modules/app/spotify.nix
Normal file
15
modules/app/spotify.nix
Normal file
@@ -0,0 +1,15 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
cfg = config.samfelag.modules.app.spotify;
|
||||
in
|
||||
{
|
||||
options.samfelag.modules.app.spotify = {
|
||||
enable = lib.mkEnableOption "spotify";
|
||||
};
|
||||
config = lib.mkIf cfg.enable {
|
||||
hm.home.packages = with pkgs; [
|
||||
spotify
|
||||
];
|
||||
};
|
||||
}
|
||||
62
modules/common.nix
Normal file
62
modules/common.nix
Normal file
@@ -0,0 +1,62 @@
|
||||
# Common module
|
||||
# -------------
|
||||
# All configuration common to ANY host is located here.
|
||||
# General configuration and "bare minimum" tools
|
||||
|
||||
{ config, pkgs, lib, ... }:
|
||||
|
||||
{
|
||||
# - Nix ----------------------------------------
|
||||
|
||||
system.stateVersion = "22.05";
|
||||
|
||||
nix = {
|
||||
package = pkgs.nixFlakes;
|
||||
|
||||
extraOptions = lib.optionalString (config.nix.package == pkgs.nixFlakes)
|
||||
"experimental-features = nix-command flakes";
|
||||
|
||||
gc = {
|
||||
automatic = true;
|
||||
dates = "weekly";
|
||||
options = "--delete-older-than 14d";
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
# - Locale -------------------------------------
|
||||
|
||||
time.timeZone = "Europe/Madrid";
|
||||
i18n.defaultLocale = "ca_ES.utf8";
|
||||
console.keyMap = "es";
|
||||
services.xserver = {
|
||||
layout = "es";
|
||||
xkbVariant = "cat";
|
||||
};
|
||||
|
||||
# - Packages -----------------------------------
|
||||
|
||||
environment.pathsToLink = [ "/libexec" ];
|
||||
environment.systemPackages = with pkgs; [
|
||||
curl
|
||||
git
|
||||
htop
|
||||
pciutils
|
||||
psmisc
|
||||
vim
|
||||
];
|
||||
|
||||
# - Modules ------------------------------------
|
||||
|
||||
networking.networkmanager.enable = true;
|
||||
|
||||
samfelag.modules = {
|
||||
shell.utils.enable = true;
|
||||
shell.zsh.enable = true;
|
||||
dev.git.enable = true;
|
||||
|
||||
# May go away from common if not all hosts use it
|
||||
system.tailscale.enable = true;
|
||||
};
|
||||
|
||||
}
|
||||
68
modules/desktop/desktop.nix
Normal file
68
modules/desktop/desktop.nix
Normal file
@@ -0,0 +1,68 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
let
|
||||
cfg = config.samfelag.modules.desktop;
|
||||
laptopPkgs = with pkgs; [
|
||||
];
|
||||
in
|
||||
{
|
||||
options.samfelag.modules.desktop = {
|
||||
|
||||
enable = mkEnableOption "desktop environment";
|
||||
|
||||
laptop = mkOption {
|
||||
description = "Enable features for a laptop (trackpad, battery, etc...)";
|
||||
type = types.bool;
|
||||
default = false;
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
||||
# - Packages ---------------------------------
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
pamixer
|
||||
i3lock-blur
|
||||
brightnessctl
|
||||
playerctl
|
||||
feh
|
||||
rofi
|
||||
firefox
|
||||
] ++ optionals cfg.laptop laptopPkgs;
|
||||
|
||||
# - Audio ------------------------------------
|
||||
|
||||
sound.enable = true;
|
||||
|
||||
hardware = {
|
||||
pulseaudio = {
|
||||
enable = true;
|
||||
support32Bit = true;
|
||||
package = pkgs.pulseaudioFull;
|
||||
};
|
||||
};
|
||||
|
||||
# - Compositor -------------------------------
|
||||
|
||||
services.picom.enable = true;
|
||||
|
||||
# - Modules ----------------------------------
|
||||
|
||||
samfelag.modules = {
|
||||
app.alacritty.enable = true;
|
||||
desktop.polybar.enable = true;
|
||||
desktop.i3 = {
|
||||
enable = true;
|
||||
laptop = cfg.laptop;
|
||||
launcher.command = "${pkgs.rofi}/bin/rofi rofi -show run";
|
||||
terminal.command = "${pkgs.alacritty}/bin/alacritty";
|
||||
browser.command = "${pkgs.firefox}/bin/firefox";
|
||||
locker.command = "${pkgs.i3lock-blur}/bin/i3lock-color -c 808F85 && sleep 1";
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
};
|
||||
}
|
||||
257
modules/desktop/i3.nix
Normal file
257
modules/desktop/i3.nix
Normal file
@@ -0,0 +1,257 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
cfg = config.samfelag.modules.desktop.i3;
|
||||
mod = "Mod4";
|
||||
|
||||
cmdModule = lib.types.submodule ({ ... }: {
|
||||
options = {
|
||||
enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
};
|
||||
command = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
example = "${pkgs.rofi}/bin/rofi rofi -show run";
|
||||
};
|
||||
};
|
||||
});
|
||||
|
||||
system_mode = "System (l) lock, (e) logout, (s) suspend, (h) hibernate, (r) reboot, (Shift+s) shutdown";
|
||||
|
||||
bg_colour = "#808F85";
|
||||
|
||||
paths = {
|
||||
wallpapers = ../../data/wallpapers;
|
||||
};
|
||||
|
||||
in {
|
||||
|
||||
options.samfelag.modules.desktop.i3 = {
|
||||
enable = lib.mkEnableOption "i3 window manager";
|
||||
|
||||
laptop = lib.mkOption {
|
||||
description = "Enable features for a laptop (trackpad, battery, etc...)";
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
};
|
||||
|
||||
launcher = lib.mkOption {
|
||||
type = cmdModule;
|
||||
};
|
||||
terminal = lib.mkOption {
|
||||
type = cmdModule;
|
||||
};
|
||||
browser = lib.mkOption {
|
||||
type = cmdModule;
|
||||
};
|
||||
locker = lib.mkOption {
|
||||
type = cmdModule;
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
|
||||
# - Dependencies -----------------------------
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
(nerdfonts.override { fonts = [ "Iosevka" ]; })
|
||||
];
|
||||
|
||||
hm.xdg.dataFile."wallpapers".source = paths.wallpapers;
|
||||
|
||||
services.xserver = {
|
||||
enable = true;
|
||||
|
||||
libinput = lib.mkIf cfg.laptop {
|
||||
enable = true;
|
||||
touchpad.tapping = true;
|
||||
};
|
||||
|
||||
desktopManager = {
|
||||
xterm.enable = false;
|
||||
};
|
||||
|
||||
displayManager = {
|
||||
defaultSession = "none+i3";
|
||||
lightdm = {
|
||||
enable = true;
|
||||
greeters.mini = {
|
||||
enable = true;
|
||||
user = "marc";
|
||||
extraConfig = ''
|
||||
[greeter]
|
||||
show-sys-info = true
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
windowManager.i3.enable = true;
|
||||
};
|
||||
|
||||
# - Configuration ----------------------------
|
||||
|
||||
hm.xsession.windowManager.i3 = {
|
||||
enable = true;
|
||||
|
||||
config = {
|
||||
modifier = mod;
|
||||
|
||||
fonts = {
|
||||
names = ["DejaVu Sans Mono" "Iosevka Nerd Font"];
|
||||
style = "regular";
|
||||
size = 12.0;
|
||||
};
|
||||
|
||||
focus.followMouse = false;
|
||||
|
||||
bars = [ ];
|
||||
|
||||
window = {
|
||||
border = 1;
|
||||
titlebar = false;
|
||||
};
|
||||
|
||||
# gaps = {
|
||||
# inner = 10;
|
||||
# outer = 5;
|
||||
# };
|
||||
|
||||
startup = [
|
||||
{ command = "i3-msg workspace 1"; }
|
||||
{ command = "systemctl --user restart polybar"; always = true; notification = false; }
|
||||
{ command = "feh --bg-center -B \"${bg_colour}\" -z --no-fehbg ${paths.wallpapers}/flors"; always = true; notification = false; }
|
||||
];
|
||||
|
||||
modes = {
|
||||
"resize" = {
|
||||
"h" = "resize shrink width 10 px or 10 ppt";
|
||||
"j" = "resize grow height 10 px or 10 ppt";
|
||||
"k" = "resize shrink height 10 px or 10 ppt";
|
||||
"l" = "resize grow width 10 px or 10 ppt";
|
||||
|
||||
"Left" = "resize shrink width 10 px or 10 ppt";
|
||||
"Down" = "resize grow height 10 px or 10 ppt";
|
||||
"Up" = "resize shrink height 10 px or 10 ppt";
|
||||
"Right" = "resize grow width 10 px or 10 ppt";
|
||||
|
||||
"Return" = "mode \"default\"";
|
||||
"Escape" = "mode \"default\"";
|
||||
};
|
||||
|
||||
"${system_mode}" = {
|
||||
"l" = "exec --no-startup-id ${cfg.locker.command}, mode \"default\"";
|
||||
"e" = "exec --no-startup-id i3-msg exit, mode \"default\"";
|
||||
"s" = "exec --no-startup-id ${cfg.locker.command} && systemctl suspend, mode \"default\"";
|
||||
"h" = "exec --no-startup-id ${cfg.locker.command} && systemctl hibernate, mode \"default\"";
|
||||
"r" = "exec --no-startup-id systemctl reboot, mode \"default\"";
|
||||
"Shift+s" = "exec --no-startup-id systemctl poweroff -i, mode \"default\"";
|
||||
|
||||
"Return" = "mode \"default\"";
|
||||
"Escape" = "mode \"default\"";
|
||||
};
|
||||
};
|
||||
|
||||
keybindings = {
|
||||
"${mod}+q" = "kill";
|
||||
|
||||
# Focus
|
||||
"${mod}+h" = "focus left";
|
||||
"${mod}+j" = "focus down";
|
||||
"${mod}+k" = "focus up";
|
||||
"${mod}+l" = "focus right";
|
||||
"${mod}+Left" = "focus left";
|
||||
"${mod}+Down" = "focus down";
|
||||
"${mod}+Up" = "focus up";
|
||||
"${mod}+Right" = "focus right";
|
||||
|
||||
# Move
|
||||
"${mod}+Shift+h" = "move left";
|
||||
"${mod}+Shift+j" = "move down";
|
||||
"${mod}+Shift+k" = "move up";
|
||||
"${mod}+Shift+l" = "move right";
|
||||
"${mod}+Shift+Left" = "move left";
|
||||
"${mod}+Shift+Down" = "move down";
|
||||
"${mod}+Shift+Up" = "move up";
|
||||
"${mod}+Shift+Right" = "move right";
|
||||
|
||||
# split orientation
|
||||
"${mod}+z" = "split h;exec notify-send 'tile horizontally'";
|
||||
"${mod}+v" = "split v;exec notify-send 'tile vertically'";
|
||||
|
||||
# enter fullscreen mode for the focused container
|
||||
"${mod}+f" = "fullscreen toggle";
|
||||
|
||||
# change container layout (stacked, tabbed, toggle split)
|
||||
"${mod}+s" = "layout stacking";
|
||||
"${mod}+w" = "layout tabbed";
|
||||
"${mod}+e" = "layout toggle split";
|
||||
|
||||
# toggle tiling / floating
|
||||
"${mod}+Shift+space" = "floating toggle";
|
||||
|
||||
# focus the parent container
|
||||
"${mod}+a" = "focus parent";
|
||||
|
||||
# Reload config + restart i3
|
||||
"${mod}+Shift+c" = "reload";
|
||||
"${mod}+Shift+r" = "restart";
|
||||
|
||||
# - Modes ------------------------------
|
||||
"${mod}+r" = "mode \"resize\"";
|
||||
"${mod}+End" = "mode \"${system_mode}\"";
|
||||
|
||||
# - Media ------------------------------
|
||||
|
||||
# Pulse Audio controls
|
||||
"XF86AudioRaiseVolume" = "exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +5%";
|
||||
"XF86AudioLowerVolume" = "exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -5%";
|
||||
"Shift+XF86AudioRaiseVolume" = "exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +1%";
|
||||
"Shift+XF86AudioLowerVolume" = "exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -1%";
|
||||
"XF86AudioMute" = "exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle";
|
||||
|
||||
# Media player controls
|
||||
"XF86AudioPlay" = "exec playerctl play-pause";
|
||||
"XF86AudioPause" = "exec playerctl play-pause";
|
||||
"XF86AudioNext" = "exec playerctl next";
|
||||
"XF86AudioPrev" = "exec playerctl previous";
|
||||
"XF86AudioStop" = "exec playerctl stop";
|
||||
|
||||
# - Workspaces -------------------------
|
||||
"${mod}+1" = "workspace 1";
|
||||
"${mod}+2" = "workspace 2";
|
||||
"${mod}+3" = "workspace 3";
|
||||
"${mod}+4" = "workspace 4";
|
||||
"${mod}+5" = "workspace 5";
|
||||
"${mod}+6" = "workspace 6";
|
||||
"${mod}+7" = "workspace 7";
|
||||
"${mod}+8" = "workspace 8";
|
||||
"${mod}+9" = "workspace 9";
|
||||
"${mod}+0" = "workspace 10";
|
||||
|
||||
"${mod}+Shift+1" = "move container to workspace 1; workspace 1";
|
||||
"${mod}+Shift+2" = "move container to workspace 2; workspace 2";
|
||||
"${mod}+Shift+3" = "move container to workspace 3; workspace 3";
|
||||
"${mod}+Shift+4" = "move container to workspace 4; workspace 4";
|
||||
"${mod}+Shift+5" = "move container to workspace 5; workspace 5";
|
||||
"${mod}+Shift+6" = "move container to workspace 6; workspace 6";
|
||||
"${mod}+Shift+7" = "move container to workspace 7; workspace 7";
|
||||
"${mod}+Shift+8" = "move container to workspace 8; workspace 8";
|
||||
"${mod}+Shift+9" = "move container to workspace 9; workspace 9";
|
||||
"${mod}+Shift+0" = "move container to workspace 10; workspace 10";
|
||||
|
||||
}
|
||||
// (if cfg.terminal.enable then {
|
||||
"${mod}+Return" = "exec ${cfg.terminal.command}";
|
||||
} else {})
|
||||
// (if cfg.launcher.enable then {
|
||||
"${mod}+space" = "exec ${cfg.launcher.command}";
|
||||
} else {})
|
||||
// (if cfg.browser.enable then {
|
||||
"${mod}+Control+3" = "exec ${cfg.browser.command}";
|
||||
} else {});
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
56
modules/desktop/polybar.nix
Normal file
56
modules/desktop/polybar.nix
Normal file
@@ -0,0 +1,56 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
cfg = config.samfelag.modules.desktop.polybar;
|
||||
polybar_pkg = pkgs.polybar.override {
|
||||
i3Support = true;
|
||||
pulseSupport = true;
|
||||
};
|
||||
script = ''
|
||||
polybar top &
|
||||
polybar bottom &
|
||||
'';
|
||||
# Paths
|
||||
paths = {
|
||||
config = ../../config/.config/polybar/config.ini;
|
||||
bars = ../../config/.config/polybar/bars;
|
||||
scripts = ../../config/.config/polybar/scripts;
|
||||
};
|
||||
in {
|
||||
|
||||
options.samfelag.modules.desktop.polybar = {
|
||||
enable = lib.mkEnableOption "polybar";
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
|
||||
# - Configuration ----------------------------
|
||||
|
||||
environment.systemPackages = [
|
||||
polybar_pkg
|
||||
];
|
||||
|
||||
hm.xdg.configFile."polybar/config.ini".source = paths.config;
|
||||
hm.xdg.configFile."polybar/bars".source = paths.bars;
|
||||
hm.xdg.configFile."polybar/scripts".source = paths.scripts;
|
||||
|
||||
hm.systemd.user.services.polybar = {
|
||||
Unit = {
|
||||
Description = "Polybar status bar";
|
||||
PartOf = [ "tray.target" ];
|
||||
X-Restart-Triggers = [ "${paths.config}" ];
|
||||
};
|
||||
|
||||
Service = {
|
||||
Type = "forking";
|
||||
PassEnvironment = "PATH";
|
||||
ExecStart =
|
||||
let scriptPkg = pkgs.writeShellScriptBin "polybar-start" script;
|
||||
in "${scriptPkg}/bin/polybar-start";
|
||||
Restart = "on-failure";
|
||||
};
|
||||
|
||||
Install = { WantedBy = [ "tray.target" ]; };
|
||||
};
|
||||
};
|
||||
}
|
||||
27
modules/dev/git.nix
Normal file
27
modules/dev/git.nix
Normal file
@@ -0,0 +1,27 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
cfg = config.samfelag.modules.dev.git;
|
||||
in
|
||||
{
|
||||
options.samfelag.modules.dev.git = with lib.types; {
|
||||
enable = lib.mkEnableOption "git";
|
||||
userName = lib.my.mkOpt str config.user.name;
|
||||
userEmail = lib.my.mkOpt (nullOr str) null;
|
||||
};
|
||||
config = lib.mkIf cfg.enable {
|
||||
environment.systemPackages = with pkgs; [
|
||||
git
|
||||
];
|
||||
hm.programs.git = {
|
||||
enable = true;
|
||||
|
||||
userName = cfg.userName;
|
||||
userEmail = cfg.userEmail;
|
||||
|
||||
extraConfig = {
|
||||
init.defaultBranch = "main";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
111
modules/editors/emacs.nix
Normal file
111
modules/editors/emacs.nix
Normal file
@@ -0,0 +1,111 @@
|
||||
{ config, inputs, lib, options, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
let
|
||||
cfg = config.samfelag.modules.editors.emacs;
|
||||
in {
|
||||
options.samfelag.modules.editors.emacs = {
|
||||
enable = mkEnableOption "emacs";
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
nixpkgs.overlays = [ inputs.emacs-overlay.overlay ];
|
||||
|
||||
# home.file.doom-emacs = {
|
||||
# source = ./doom-emacs;
|
||||
# target = ".config/doom";
|
||||
# recursive = true;
|
||||
# # onChange = "doom upgrade";
|
||||
# };
|
||||
|
||||
# home.programs.emacs = {
|
||||
# enable = true;
|
||||
# # package = pkgs.emacsPgtkGcc;
|
||||
# extraPackages = epkgs: [ epkgs.vterm ];
|
||||
# };
|
||||
|
||||
# home.services.emacs = {
|
||||
# enable = true;
|
||||
# client.enable = true;
|
||||
# socketActivation.enable = true;
|
||||
# };
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
## Emacs itself
|
||||
binutils
|
||||
((emacsPackagesFor emacsNativeComp).emacsWithPackages
|
||||
(epkgs: [ epkgs.vterm ]))
|
||||
# emacsPgtkGcc
|
||||
|
||||
## Doom dependencies
|
||||
git
|
||||
(ripgrep.override { withPCRE2 = true; })
|
||||
gnutls
|
||||
|
||||
## Opt deps
|
||||
fd
|
||||
imagemagick
|
||||
pinentry_emacs
|
||||
zstd
|
||||
|
||||
## Modules deps
|
||||
# :tools vterm
|
||||
gcc
|
||||
gnumake
|
||||
libtool
|
||||
cmake
|
||||
|
||||
# # :lang cc
|
||||
# ccls
|
||||
# cmake
|
||||
# gcc
|
||||
# glslang
|
||||
# # :lang haskell
|
||||
# stack
|
||||
# haskellPackages.ghcide
|
||||
# haskellPackages.hoogle
|
||||
# # :lang latex && :lang org (latex preview)
|
||||
# (texlive.combine { inherit (texlive) scheme-full; })
|
||||
# # biber
|
||||
# # :lang nix
|
||||
# nixfmt
|
||||
# # :lang python
|
||||
# black
|
||||
# python3
|
||||
# python3Packages.isort
|
||||
# # python3Packages.python-language-server
|
||||
# python3Packages.pytest
|
||||
# python3Packages.setuptools
|
||||
# nodePackages.pyright
|
||||
# # :tools lookup & :lang org +roam
|
||||
# sqlite
|
||||
# # :tools direnv
|
||||
# direnv
|
||||
|
||||
# Fonts
|
||||
emacs-all-the-icons-fonts
|
||||
# fira-code
|
||||
# fira-code-symbols
|
||||
|
||||
graphviz
|
||||
];
|
||||
|
||||
fonts.fonts = [ pkgs.emacs-all-the-icons-fonts ];
|
||||
|
||||
env.PATH = [ "$XDG_CONFIG_HOME/emacs/bin" ];
|
||||
|
||||
home-manager.users.marc.xdg.configFile."doom".source = ../../config/doom;
|
||||
|
||||
system.userActivationScripts = {
|
||||
installDoomEmacs = ''
|
||||
EMACS_FOLDER="$HOME/.config/emacs"
|
||||
echo $XDG_CONFIG_HOME
|
||||
echo $EMACS_FOLDER
|
||||
if [ ! -d "$EMACS_FOLDER" ]; then
|
||||
${pkgs.git}/bin/git clone --depth=1 --single-branch "https://github.com/doomemacs/doomemacs" "$EMACS_FOLDER"
|
||||
fi
|
||||
'';
|
||||
};
|
||||
|
||||
};
|
||||
}
|
||||
15
modules/gaming/lutris.nix
Normal file
15
modules/gaming/lutris.nix
Normal file
@@ -0,0 +1,15 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
cfg = config.samfelag.modules.gaming.lutris;
|
||||
in
|
||||
{
|
||||
options.samfelag.modules.gaming.lutris = {
|
||||
enable = lib.mkEnableOption "lutris";
|
||||
};
|
||||
config = lib.mkIf cfg.enable {
|
||||
hm.home.packages = with pkgs; [
|
||||
lutris
|
||||
];
|
||||
};
|
||||
}
|
||||
17
modules/gaming/steam.nix
Normal file
17
modules/gaming/steam.nix
Normal file
@@ -0,0 +1,17 @@
|
||||
{ config, pkgs, lib, ... }:
|
||||
|
||||
let
|
||||
cfg = config.samfelag.modules.gaming.steam;
|
||||
in
|
||||
{
|
||||
options.samfelag.modules.gaming.steam = {
|
||||
enable = lib.mkEnableOption "steam";
|
||||
};
|
||||
config = lib.mkIf cfg.enable {
|
||||
programs.steam = {
|
||||
enable = true;
|
||||
remotePlay.openFirewall = true; # Open ports in the firewall for Steam Remote Play
|
||||
dedicatedServer.openFirewall = true; # Open ports in the firewall for Source Dedicated Server
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -6,12 +6,7 @@ with lib.my;
|
||||
options = with types; {
|
||||
user = mkOpt attrs {};
|
||||
|
||||
home = {
|
||||
packages = mkOpt' (listOf package) [] "Packages to be installed at user level";
|
||||
file = mkOpt' attrs {} "Files to place directly in $HOME" ;
|
||||
configFile = mkOpt' attrs {} "Files to place in $XDG_CONFIG_HOME";
|
||||
dataFile = mkOpt' attrs {} "Files to place in $XDG_DATA_HOME";
|
||||
};
|
||||
hm = mkOpt attrs {};
|
||||
|
||||
env = mkOption {
|
||||
# env = { PATH = ["$PATH" ./test]; TEST = "test"; }
|
||||
@@ -36,26 +31,6 @@ with lib.my;
|
||||
uid = 1000;
|
||||
};
|
||||
|
||||
home-manager = {
|
||||
# extraSpecialArgs = { inherit inputs; };
|
||||
useGlobalPkgs = true;
|
||||
useUserPackages = true;
|
||||
|
||||
users.${config.user.name} = {
|
||||
home = {
|
||||
file = mkAliasDefinitions options.home.file;
|
||||
packages = mkAliasDefinitions options.home.packages;
|
||||
# Necessary for home-manager to work with flakes, otherwise it will
|
||||
# look for a nixpkgs channel.
|
||||
stateVersion = config.system.stateVersion;
|
||||
};
|
||||
xdg = {
|
||||
configFile = mkAliasDefinitions options.home.configFile;
|
||||
dataFile = mkAliasDefinitions options.home.dataFile;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
users.users.${config.user.name} = mkAliasDefinitions options.user;
|
||||
|
||||
nix.settings = let users = [ "root" config.user.name ]; in {
|
||||
@@ -63,6 +38,16 @@ with lib.my;
|
||||
allowed-users = users;
|
||||
};
|
||||
|
||||
hm.home.stateVersion = config.system.stateVersion;
|
||||
|
||||
home-manager = {
|
||||
# extraSpecialArgs = { inherit inputs; };
|
||||
useGlobalPkgs = true;
|
||||
useUserPackages = true;
|
||||
|
||||
users.${config.user.name} = mkAliasDefinitions options.hm;
|
||||
};
|
||||
|
||||
env.PATH = [ "$PATH" ];
|
||||
|
||||
environment.extraInit =
|
||||
|
||||
22
modules/shell/utils.nix
Normal file
22
modules/shell/utils.nix
Normal file
@@ -0,0 +1,22 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
cfg = config.samfelag.modules.shell.utils;
|
||||
in
|
||||
{
|
||||
options.samfelag.modules.shell.utils = {
|
||||
enable = lib.mkEnableOption "Basic shell utils";
|
||||
};
|
||||
config = lib.mkIf cfg.enable {
|
||||
environment.systemPackages = with pkgs; [
|
||||
bat
|
||||
exa
|
||||
fd
|
||||
fzf
|
||||
jq
|
||||
ripgrep
|
||||
tldr
|
||||
];
|
||||
hm.xdg.configFile."shell".source = ../../config/.config/shell;
|
||||
};
|
||||
}
|
||||
68
modules/shell/zsh.nix
Normal file
68
modules/shell/zsh.nix
Normal file
@@ -0,0 +1,68 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
cfg = config.samfelag.modules.shell.zsh;
|
||||
in
|
||||
{
|
||||
options.samfelag.modules.shell.zsh = {
|
||||
enable = lib.mkEnableOption "zsh";
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
environment.systemPackages = with pkgs; [
|
||||
zsh
|
||||
zsh-powerlevel10k
|
||||
(nerdfonts.override { fonts = [ "Iosevka" ]; })
|
||||
];
|
||||
|
||||
hm.programs.zsh = {
|
||||
enable = true;
|
||||
dotDir = ".config/zsh";
|
||||
|
||||
enableAutosuggestions = true;
|
||||
enableCompletion = true;
|
||||
enableSyntaxHighlighting = true;
|
||||
|
||||
initExtra = ''
|
||||
# Source generic (bash) configuration
|
||||
if [ -d $HOME/.config/shell/sh ]; then
|
||||
for rc in $HOME/.config/shell/sh/*.sh; do
|
||||
emulate bash -c ". $rc"
|
||||
done
|
||||
fi
|
||||
|
||||
# Source zsh specific configuration
|
||||
if [[ -d $HOME/.config/shell/zsh ]]; then
|
||||
for rc in $HOME/.config/shell/zsh/*.zsh; do
|
||||
source $rc
|
||||
done
|
||||
fi
|
||||
'';
|
||||
|
||||
initExtraBeforeCompInit = ''
|
||||
# p10k instant prompt
|
||||
P10K_INSTANT_PROMPT="$XDG_CACHE_HOME/p10k-instant-prompt-''${(%):-%n}.zsh"
|
||||
[[ ! -r "$P10K_INSTANT_PROMPT" ]] || source "$P10K_INSTANT_PROMPT"
|
||||
'';
|
||||
|
||||
oh-my-zsh = {
|
||||
enable = true;
|
||||
plugins = [
|
||||
"git"
|
||||
# "zsh-vi-mode"
|
||||
];
|
||||
};
|
||||
|
||||
plugins = [
|
||||
{
|
||||
file = "powerlevel10k.zsh-theme";
|
||||
name = "powerlevel10k";
|
||||
src = "${pkgs.zsh-powerlevel10k}/share/zsh-powerlevel10k";
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
hm.xdg.configFile."zsh/.p10k.zsh".source = ../../config/.config/zsh/.p10k.zsh;
|
||||
|
||||
};
|
||||
}
|
||||
14
modules/system/bluetooth.nix
Normal file
14
modules/system/bluetooth.nix
Normal file
@@ -0,0 +1,14 @@
|
||||
{ config, lib, pkgs, self, ... }:
|
||||
|
||||
let
|
||||
cfg = config.samfelag.modules.system.bluetooth;
|
||||
in
|
||||
{
|
||||
options.samfelag.modules.system.bluetooth = {
|
||||
enable = lib.mkEnableOption "bluetooth";
|
||||
};
|
||||
config = lib.mkIf cfg.enable {
|
||||
hardware.bluetooth.enable = true;
|
||||
services.blueman.enable = true;
|
||||
};
|
||||
}
|
||||
15
modules/system/tailscale.nix
Normal file
15
modules/system/tailscale.nix
Normal file
@@ -0,0 +1,15 @@
|
||||
{ config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
cfg = config.samfelag.modules.system.tailscale;
|
||||
in
|
||||
{
|
||||
options.samfelag.modules.system.tailscale = {
|
||||
enable = lib.mkEnableOption "tailscale";
|
||||
};
|
||||
config = lib.mkIf cfg.enable {
|
||||
# See https://github.com/tailscale/tailscale/issues/4432
|
||||
networking.firewall.checkReversePath = "loose";
|
||||
services.tailscale.enable = true;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user