home

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 519c3b6ce7c696ede30078e89b1c0e19a10fe0c9
parent 59efa731cf1d62404831a136680f2067e5b8a268
Author: Vincent Demeester <vincent@sbr.pm>
Date:   Wed, 30 Dec 2020 09:49:26 +0100

flake: slowly organize modules

Signed-off-by: Vincent Demeester <vincent@sbr.pm>

Diffstat:
Mflake.nix | 3+--
Msystems/hosts/foo.flake.nix | 33++++++++++++++++++++++++++++++---
Msystems/modules/default.flake.nix | 6++++++
Asystems/modules/desktop/base.nix | 114+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asystems/modules/desktop/default.nix | 6++++++
Asystems/modules/desktop/i3.nix | 35+++++++++++++++++++++++++++++++++++
Asystems/modules/editors/default.nix | 20++++++++++++++++++++
Asystems/modules/editors/emacs.nix | 19+++++++++++++++++++
Asystems/modules/editors/vim.nix | 18++++++++++++++++++
Asystems/modules/hardware/audio.nix | 31+++++++++++++++++++++++++++++++
Asystems/modules/hardware/bluetooth.nix | 29+++++++++++++++++++++++++++++
Msystems/modules/hardware/default.nix | 3+++
Asystems/modules/hardware/yubikey.nix | 45+++++++++++++++++++++++++++++++++++++++++++++
Msystems/modules/profiles/base.flake.nix | 14++------------
Msystems/modules/profiles/default.flake.nix | 8++++----
Dsystems/modules/profiles/desktop.flake.nix | 114-------------------------------------------------------------------------------
Dsystems/modules/profiles/development.flake.nix | 1-
Msystems/modules/profiles/home.flake.nix | 4++--
Dsystems/modules/profiles/i3.nix | 36------------------------------------
Msystems/modules/profiles/laptop.flake.nix | 2+-
Dsystems/modules/profiles/yubikey.nix | 46----------------------------------------------
Asystems/modules/shell/default.nix | 13+++++++++++++
Asystems/modules/shell/direnv.nix | 19+++++++++++++++++++
Asystems/modules/shell/git.nix | 25+++++++++++++++++++++++++
Asystems/modules/shell/git/config | 43+++++++++++++++++++++++++++++++++++++++++++
Asystems/modules/shell/git/ignore | 61+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asystems/modules/shell/gnupg.nix | 16++++++++++++++++
Asystems/modules/shell/tmux.nix | 18++++++++++++++++++
Asystems/modules/shell/zsh.nix | 16++++++++++++++++
Musers/vincent/default.flake.nix | 3++-
Musers/vincent/home.nix | 33+++++++++++++++++++++++++++++++++
31 files changed, 612 insertions(+), 222 deletions(-)

diff --git a/flake.nix b/flake.nix @@ -143,7 +143,6 @@ }; }; }) - # FIXME remove flake suffix once migrated (import ./systems/modules/default.flake.nix) (import config) ] @@ -237,7 +236,7 @@ overlays = forEachSystem (system: [ (self.overlay."${system}") (_: _: import inputs.gitignore-nix { lib = inputs.nixpkgs.lib; }) - inputs.nyxt.overlay + #inputs.nyxt.overlay inputs.emacs.overlay (import ./nix/overlays/infra.nix) (import ./nix/overlays/mkSecret.nix) diff --git a/systems/hosts/foo.flake.nix b/systems/hosts/foo.flake.nix @@ -12,9 +12,36 @@ let endpointPublicKey = strings.optionalString secretCondition (import secretPath).wireguard.kerkouane.publicKey; in { - profiles.laptop.enable = true; - profiles.desktop.i3.enable = true; - profiles.home.enable = true; + modules = { + desktop = { + i3.enable = true; + }; + editors = { + default = "vim"; + vim.enable = true; + }; + hardware = { + bluetooth.enable = true; + audio.enable = true; + yubikey.enable = true; + }; + shell = { + direnv.enable = true; + git.enable = true; + gnupg.enable = true; + tmux.enable = true; + zsh.enable = true; + }; + virtualisation = { + enable = true; + nested = true; + }; + }; + profiles = { + home.enable = true; + redhat.enable = true; + laptop.enable = true; + }; environment.systemPackages = with pkgs; [ tkn nyxt ]; /* diff --git a/systems/modules/default.flake.nix b/systems/modules/default.flake.nix @@ -2,7 +2,13 @@ { imports = [ + ./desktop + ./editors + ./hardware ./profiles/default.flake.nix + ./programs + ./services + ./shell ./virtualisation ]; } diff --git a/systems/modules/desktop/base.nix b/systems/modules/desktop/base.nix @@ -0,0 +1,114 @@ +{ config, lib, pkgs, ... }: +let + inherit (lib) mkIf mkEnableOption mkDefault; + cfg = config.modules.desktop; +in +{ + options = { + modules.desktop = { + enable = mkEnableOption "desktop configuration"; + }; + }; + config = mkIf cfg.enable { + boot = { + # /tmp to be tmpfs + tmpOnTmpfs = true; + # Enable Plymouth on desktops + plymouth.enable = true; + }; + + # Extra packages to add to the system + environment.systemPackages = with pkgs; [ + xorg.xmessage + ]; + + # Configure some fonts + fonts = { + # enableFontDir = true; + fontDir.enable = true; + enableGhostscriptFonts = true; + fonts = with pkgs; [ + liberation_ttf + corefonts + dejavu_fonts + emojione + feh + fira + fira-code + fira-code-symbols + fira-mono + hasklig + inconsolata + iosevka + noto-fonts + noto-fonts-cjk + noto-fonts-emoji + noto-fonts-extra + overpass + symbola + source-code-pro + twemoji-color-font + ubuntu_font_family + unifont + ]; + }; + + # Enable NetkworManager by default + networking.networkmanager = { + enable = mkDefault true; + unmanaged = [ + "interface-name:br-*" + "interface-name:ve-*" # FIXME are those docker's or libvirt's + "interface-name:veth-*" # FIXME are those docker's or libvirt's + ] + # Do not manager wireguard + ++ lib.optionals config.networking.wireguard.enable [ "interface-name:wg0" ] + # Do not manage docker interfaces + ++ lib.optionals config.virtualisation.docker.enable [ "interface-name:docker0" ] + # Do not manager libvirt interfaces + ++ lib.optionals config.virtualisation.libvirtd.enable [ "interface-name:virbr*" ]; + }; + + nix = { + # Enable SSH-serving nix packages + sshServe.enable = mkDefault true; + }; + + services = { + # Enable avahi with a lot of options + avahi = { + enable = true; + ipv4 = true; + ipv6 = true; + nssmdns = true; + publish = { + enable = true; + userServices = true; + }; + }; + + # Make `/run/user/X` larger. + logind.extraConfig = '' + RuntimeDirectorySize=20% + ''; + + # Enable printing by default too + printing = { + enable = true; + drivers = [ pkgs.gutenprint ]; + }; + + # Enable xserver on desktop + xserver = { + enable = true; + enableTCP = false; + libinput.enable = true; + synaptics.enable = false; + layout = "fr"; + xkbVariant = "bepo"; + xkbOptions = "grp:menu_toggle,grp_led:caps,compose:caps"; + }; + + }; + }; +} diff --git a/systems/modules/desktop/default.nix b/systems/modules/desktop/default.nix @@ -0,0 +1,6 @@ +{ + imports = [ + ./base.nix + ./i3.nix + ]; +} diff --git a/systems/modules/desktop/i3.nix b/systems/modules/desktop/i3.nix @@ -0,0 +1,35 @@ +{ config, lib, pkgs, ... }: + +with lib; +let + cfg = config.modules.desktop.i3; +in +{ + options = { + modules.desktop.i3 = { + enable = mkEnableOption "Enable i3 desktop profile"; + }; + }; + + config = mkIf cfg.enable { + # Enable desktop modules if not already + modules.desktop.enable = true; + services = { + blueman.enable = true; + autorandr.enable = true; + xserver = { + displayManager = { + defaultSession = "none+i3"; + lightdm.enable = true; + lightdm.greeters.pantheon.enable = true; + }; + windowManager.i3.enable = true; + }; + dbus = { + enable = true; + # socketActivated = true; + packages = [ pkgs.gnome3.dconf ]; + }; + }; + }; +} diff --git a/systems/modules/editors/default.nix b/systems/modules/editors/default.nix @@ -0,0 +1,20 @@ +{ config, lib, ... }: +let + inherit (lib) mkIf mkOption mkOverride types; + cfg = config.modules.editors; +in +{ + imports = [ ./vim.nix ./emacs.nix ]; + options.modules.editors = { + default = mkOption { + description = "default editor"; + type = types.str; + default = "vim"; + }; + }; + config = mkIf (cfg.default != null) { + environment.variables = { + EDITOR = mkOverride 0 cfg.default; + }; + }; +} diff --git a/systems/modules/editors/emacs.nix b/systems/modules/editors/emacs.nix @@ -0,0 +1,19 @@ +{ config, lib, pkgs, ... }: +let + inherit (lib) mkEnableOption mkIf; + cfg = config.modules.editors.emacs; +in +{ + options.modules.editors.emacs = { + enable = mkEnableOption "enable emacs editor"; + }; + config = mkIf cfg.enable { + # FIXME add a default configuration + environment = { + systemPackages = [ pkgs.emacs ]; + shellAliases = { + e = "emacs"; + }; + }; + }; +} diff --git a/systems/modules/editors/vim.nix b/systems/modules/editors/vim.nix @@ -0,0 +1,18 @@ +{ config, lib, pkgs, ... }: +let + inherit (lib) mkEnableOption mkIf; + cfg = config.modules.editors.vim; +in +{ + options.modules.editors.vim = { + enable = mkEnableOption "enable vim editor"; + }; + config = mkIf cfg.enable { + environment = { + systemPackages = [ pkgs.vim ]; + shellAliases = { + v = "vim"; + }; + }; + }; +} diff --git a/systems/modules/hardware/audio.nix b/systems/modules/hardware/audio.nix @@ -0,0 +1,31 @@ +{ config, lib, pkgs, ... }: +let + inherit (lib) mkEnableOption mkIf; + cfg = config.modules.hardware.audio; +in +{ + options.modules.hardware.audio = { + enable = mkEnableOption "enable audio"; + }; + config = mkIf cfg.enable { + # Add extra packages + environment.systemPackages = with pkgs; [ + apulse # allow alsa application to use pulse + pavucontrol # pulseaudio volume control + pasystray # systray application + ]; + # Enable sound (alsa) + sound.enable = true; + # Enable and configure pulseaudio + hardware.pulseaudio = { + enable = true; + support32Bit = true; + }; + # FIXME is it needed + security.pam.loginLimits = [ + { domain = "@audio"; item = "memlock"; type = "-"; value = "unlimited"; } + { domain = "@audio"; item = "rtprio"; type = "-"; value = "99"; } + { domain = "@audio"; item = "nofile"; type = "-"; value = "99999"; } + ]; + }; +} diff --git a/systems/modules/hardware/bluetooth.nix b/systems/modules/hardware/bluetooth.nix @@ -0,0 +1,29 @@ +{ config, lib, pkgs, ... }: +let + inherit (lib) mkEnableOption mkIf mkMerge; + cfg = config.modules.hardware.bluetooth; +in +{ + options.modules.hardware.bluetooth = { + enable = mkEnableOption "Enable bluetooth"; + }; + + config = mkIf cfg.enable (mkMerge [ + { hardware.bluetooth.enable = true; } + (mkIf config.modules.hardware.audio.enable { + hardware.pulseaudio = { + # NixOS allows either a lightweight build (default) or full build of + # PulseAudio to be installed. Only the full build has Bluetooth + # support, so it must be selected here. + package = pkgs.pulseaudioFull; + # Enable additional codecs + extraModules = [ pkgs.pulseaudio-modules-bt ]; + }; + + hardware.bluetooth.extraConfig = '' + [General] + Enable=Source,Sink,Media,Socket + ''; + }) + ]); +} diff --git a/systems/modules/hardware/default.nix b/systems/modules/hardware/default.nix @@ -1,5 +1,8 @@ { imports = [ + ./audio.nix + ./bluetooth.nix + ./yubikey.nix # remove "nixos" ./sane-extra-config.nixos.nix ]; diff --git a/systems/modules/hardware/yubikey.nix b/systems/modules/hardware/yubikey.nix @@ -0,0 +1,45 @@ +{ config, lib, pkgs, ... }: +let + inherit (lib) mkEnableOption mkIf mkMerge mkOption types; + cfg = config.modules.hardware.yubikey; +in +{ + options = { + modules.hardware.yubikey = { + enable = mkEnableOption "Enable yubikey profile"; + u2f = mkOption { + default = true; + description = "wether to enable auth with yubkeys throguh pam using u2f"; + type = types.bool; + }; + }; + }; + config = mkIf cfg.enable (mkMerge [ + { + environment = { + systemPackages = with pkgs; [ + yubico-piv-tool + yubikey-personalization + yubioath-desktop + yubikey-manager + ]; + }; + services = { + pcscd.enable = true; + udev = { + packages = with pkgs; [ yubikey-personalization ]; + extraRules = '' + # Yubico YubiKey + KERNEL=="hidraw*", SUBSYSTEM=="hidraw", ATTRS{idVendor}=="1050", ATTRS{idProduct}=="0113|0114|0115|0116|0120|0402|0403|0406|0407|0410", TAG+="uaccess", MODE="0660", GROUP="wheel" + # ACTION=="remove", ENV{ID_VENDOR_ID}=="1050", ENV{ID_MODEL_ID}=="0113|0114|0115|0116|0120|0402|0403|0406|0407|0410", RUN+="${pkgs.systemd}/bin/loginctl lock-sessions" + ''; + }; + }; + } + (mkIf cfg.u2f { + security.pam.u2f = { + enable = true; + }; + }) + ]); +} diff --git a/systems/modules/profiles/base.flake.nix b/systems/modules/profiles/base.flake.nix @@ -1,12 +1,12 @@ { config, inputs, lib, pkgs, ... }: let inherit (lib) mkEnableOption mkIf mkDefault mkOverride; - cfg = config.profiles.base; + cfg = config.modules.base; in { imports = [ inputs.home-manager.nixosModules.home-manager ]; options = { - profiles.base = { + modules.base = { enable = mkEnableOption "base configuration"; }; }; @@ -35,10 +35,6 @@ in }; environment = { - # Path to link from packages to /run/current-system/sw - pathsToLink = [ - "/share/nix-direnv" - ]; # System packages to install, those are the absolute minimum packages required systemPackages = with pkgs; [ file @@ -48,14 +44,8 @@ in netcat psmisc pv - vim wget ]; - # Default editor for the system is vim - # (for the users, that might change :D) - variables = { - EDITOR = mkOverride 0 "vim"; - }; }; # Home manager default configuration diff --git a/systems/modules/profiles/default.flake.nix b/systems/modules/profiles/default.flake.nix @@ -1,15 +1,15 @@ +# Profiles are grouping modules so that we don't have to +# specify them for all machines all the time. { lib, ... }: { imports = [ ./base.flake.nix - ./desktop.flake.nix - ./development.flake.nix ./home.flake.nix - ./i3.nix ./laptop.flake.nix + # ./desktop.flake.nix # FIXME: vpn, server, builder, … ]; - profiles.base.enable = lib.mkDefault true; + modules.base.enable = lib.mkDefault true; } diff --git a/systems/modules/profiles/desktop.flake.nix b/systems/modules/profiles/desktop.flake.nix @@ -1,114 +0,0 @@ -{ config, lib, pkgs, ... }: -let - inherit (lib) mkIf mkEnableOption mkDefault; - cfg = config.profiles.desktop; -in -{ - options = { - profiles.desktop = { - enable = mkEnableOption "desktop configuration"; - }; - }; - config = mkIf cfg.enable { - boot = { - # /tmp to be tmpfs - tmpOnTmpfs = true; - # Enable Plymouth on desktops - plymouth.enable = true; - }; - - # Extra packages to add to the system - environment.systemPackages = with pkgs; [ - xorg.xmessage - ]; - - # Configure some fonts - fonts = { - # enableFontDir = true; - fontDir.enable = true; - enableGhostscriptFonts = true; - fonts = with pkgs; [ - liberation_ttf - corefonts - dejavu_fonts - emojione - feh - fira - fira-code - fira-code-symbols - fira-mono - hasklig - inconsolata - iosevka - noto-fonts - noto-fonts-cjk - noto-fonts-emoji - noto-fonts-extra - overpass - symbola - source-code-pro - twemoji-color-font - ubuntu_font_family - unifont - ]; - }; - - # Enable NetkworManager by default - networking.networkmanager = { - enable = mkDefault true; - unmanaged = [ - "interface-name:br-*" - "interface-name:ve-*" # FIXME are those docker's or libvirt's - "interface-name:veth-*" # FIXME are those docker's or libvirt's - ] - # Do not manager wireguard - ++ lib.optionals config.networking.wireguard.enable [ "interface-name:wg0" ] - # Do not manage docker interfaces - ++ lib.optionals config.virtualisation.docker.enable [ "interface-name:docker0" ] - # Do not manager libvirt interfaces - ++ lib.optionals config.virtualisation.libvirtd.enable [ "interface-name:virbr*" ]; - }; - - nix = { - # Enable SSH-serving nix packages - sshServe.enable = mkDefault true; - }; - - services = { - # Enable avahi with a lot of options - avahi = { - enable = true; - ipv4 = true; - ipv6 = true; - nssmdns = true; - publish = { - enable = true; - userServices = true; - }; - }; - - # Make `/run/user/X` larger. - logind.extraConfig = '' - RuntimeDirectorySize=20% - ''; - - # Enable printing by default too - printing = { - enable = true; - drivers = [ pkgs.gutenprint ]; - }; - - # Enable xserver on desktop - xserver = { - enable = true; - enableTCP = false; - libinput.enable = true; - synaptics.enable = false; - layout = "fr"; - xkbVariant = "bepo"; - xkbOptions = "grp:menu_toggle,grp_led:caps,compose:caps"; - }; - - }; - }; -} diff --git a/systems/modules/profiles/development.flake.nix b/systems/modules/profiles/development.flake.nix @@ -1 +0,0 @@ -{ } diff --git a/systems/modules/profiles/home.flake.nix b/systems/modules/profiles/home.flake.nix @@ -1,7 +1,7 @@ { config, lib, pkgs, ... }: let inherit (lib) mkIf mkEnableOption; - cfg = config.profiles.home; + cfg = config.modules.home; secretPath = ../../secrets/machines.nix; secretCondition = (builtins.pathExists secretPath); @@ -9,7 +9,7 @@ let in { options = { - profiles.home = { + modules.home = { enable = mkEnableOption "home configuration"; }; }; diff --git a/systems/modules/profiles/i3.nix b/systems/modules/profiles/i3.nix @@ -1,36 +0,0 @@ -{ config, lib, pkgs, ... }: - -with lib; -let - cfg = config.profiles.desktop.i3; -in -{ - options = { - profiles.desktop.i3 = { - enable = mkEnableOption "Enable i3 desktop profile"; - }; - }; - - config = mkIf cfg.enable { - profiles = { - desktop.enable = true; - }; - services = { - blueman.enable = true; - autorandr.enable = true; - xserver = { - displayManager = { - defaultSession = "none+i3"; - lightdm.enable = true; - lightdm.greeters.pantheon.enable = true; - }; - windowManager.i3.enable = true; - }; - dbus = { - enable = true; - # socketActivated = true; - packages = [ pkgs.gnome3.dconf ]; - }; - }; - }; -} diff --git a/systems/modules/profiles/laptop.flake.nix b/systems/modules/profiles/laptop.flake.nix @@ -10,7 +10,7 @@ in }; }; config = mkIf cfg.enable { - profiles.desktop.enable = true; + modules.desktop.enable = true; nix = { sshServe.enable = mkForce false; }; diff --git a/systems/modules/profiles/yubikey.nix b/systems/modules/profiles/yubikey.nix @@ -1,46 +0,0 @@ -{ config, lib, pkgs, ... }: - -with lib; -let - cfg = config.profiles.yubikey; -in -{ - options = { - profiles.yubikey = { - enable = mkEnableOption "Enable yubikey profile"; - u2f = mkOption { - default = true; - description = "wether to enable auth with yubkeys throguh pam using u2f"; - type = types.bool; - }; - }; - }; - config = mkIf cfg.enable (mkMerge [ - { - environment = { - systemPackages = with pkgs; [ - yubico-piv-tool - yubikey-personalization - yubioath-desktop - yubikey-manager - ]; - }; - services = { - pcscd.enable = true; - udev = { - packages = with pkgs; [ yubikey-personalization ]; - extraRules = '' - # Yubico YubiKey - KERNEL=="hidraw*", SUBSYSTEM=="hidraw", ATTRS{idVendor}=="1050", ATTRS{idProduct}=="0113|0114|0115|0116|0120|0402|0403|0406|0407|0410", TAG+="uaccess", MODE="0660", GROUP="wheel" - # ACTION=="remove", ENV{ID_VENDOR_ID}=="1050", ENV{ID_MODEL_ID}=="0113|0114|0115|0116|0120|0402|0403|0406|0407|0410", RUN+="${pkgs.systemd}/bin/loginctl lock-sessions" - ''; - }; - }; - } - (mkIf cfg.u2f { - security.pam.u2f = { - enable = true; - }; - }) - ]); -} diff --git a/systems/modules/shell/default.nix b/systems/modules/shell/default.nix @@ -0,0 +1,13 @@ +{ lib, ... }: +let + inherit (lib) mkEnableOption; +in +{ + imports = [ + ./direnv.nix + ./git.nix + ./gnupg.nix + ./tmux.nix + ./zsh.nix + ]; +} diff --git a/systems/modules/shell/direnv.nix b/systems/modules/shell/direnv.nix @@ -0,0 +1,19 @@ +{ config, lib, pkgs, ... }: +let + inherit (lib) mkEnableOption mkIf; + cfg = config.modules.shell.direnv; +in +{ + options.modules.shell.direnv = { + enable = mkEnableOption "enable direnv"; + }; + config = mkIf cfg.enable { + environment = { + # Path to link from packages to /run/current-system/sw + pathsToLink = [ + "/share/nix-direnv" + ]; + systemPackages = [ pkgs.direnv ]; + }; + }; +} diff --git a/systems/modules/shell/git.nix b/systems/modules/shell/git.nix @@ -0,0 +1,25 @@ +{ config, lib, pkgs, ... }: +let + inherit (lib) mkEnableOption mkIf; + cfg = config.modules.shell.git; +in +{ + options.modules.shell.git = { + enable = mkEnableOption "enable git"; + }; + config = mkIf cfg.enable { + environment = { + # Install some packages + systemPackages = with pkgs; [ + gitAndTools.gitFull + gitAndTools.git-annex + gitAndTools.git-extras + (mkIf config.modules.shell.gnupg.enable + gitAndTools.git-crypt) + ]; + # Default gitconfig + etc."gitconfig".source = ./git/config; + etc."gitignore".source = ./git/ignore; + }; + }; +} diff --git a/systems/modules/shell/git/config b/systems/modules/shell/git/config @@ -0,0 +1,43 @@ +[alias] + co = checkout + st = status + ci = commit --signoff + ca = commit --amend + b = branc --color -v + br = branch + unstage = reset HEAD + lg = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative + lga = log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative --branches --remotes + lol = log --pretty=oneline --abbrev-commit --graph --decorate + conflicts = !git ls-files --unmerged | cut -c51- | sort -u | xargs $EDITOR + resolve = !git ls-files --unmerged | cut -c51- | sort -u | xargs git add +[color] + branch = auto + diff = auto + status = auto +[color "branch"] + current = cyan reverse + local = cyan + remote = green +[color "diff"] + meta = white reverse + frag = magenta reverse + old = red + new = green +[color "status"] + added = green + changed = yellow + untracked = red +[core] + excludesfile = /etc/gitignore +[push] + default = matching +[merge] + tool = vimdiff +[user] + name = Vincent Demeester + email = vincent@sbr.pm +[http] + cookiefile = /home/vincent/.gitcookies +[url "git@github.com:"] + pushInsteadOf = git://github.com/ diff --git a/systems/modules/shell/git/ignore b/systems/modules/shell/git/ignore @@ -0,0 +1,61 @@ +# For emacs: +*~ +*.*~ +\#* +.\#* + +# For vim: +*.swp +.*.sw[a-z] +*.un~ +Session.vim +.netrwhist + +# Ignore tags (from etags and ctags) +TAGS +!TAGS/ +tags +!tags/ + +# Logs and databases # +###################### +*.log +*.cache + +# OS generated files # +###################### +.DS_Store? +.DS_Store +.CFUserTextEncoding +.Trash +.Xauthority +thumbs.db +Icon? +Thumbs.db +.cache +.pid +.sock + +# Code stuffs # +############### +.svn +.git +.swp +.idea +.*.swp +*~ +.tags +tags +.sass-cache +tmp +.codekit-cache +config.codekit + +# Compiled thangs # +################### +*.class +*.exe +*.o +*.so +*.dll +*.pyc diff --git a/systems/modules/shell/gnupg.nix b/systems/modules/shell/gnupg.nix @@ -0,0 +1,16 @@ +{ config, lib, pkgs, ... }: +let + inherit (lib) mkEnableOption mkIf; + cfg = config.modules.shell.gnupg; +in +{ + options.modules.shell.gnupg = { + enable = mkEnableOption "enable gnupg"; + }; + config = mkIf cfg.enable { + environment = { + variables.GNUPGHOME = "$XDG_CONFIG_HOME/gnupg"; + systemPackages = [ pkgs.gnupg ]; + }; + }; +} diff --git a/systems/modules/shell/tmux.nix b/systems/modules/shell/tmux.nix @@ -0,0 +1,18 @@ +{ config, lib, pkgs, ... }: +let + inherit (lib) mkEnableOption mkIf; + cfg = config.modules.shell.tmux; +in +{ + options.modules.shell.tmux = { + enable = mkEnableOption "enable tmux"; + }; + config = mkIf cfg.enable { + programs.tmux = { + enable = true; + clock24 = true; + escapeTime = 0; + terminal = "tmux-256color"; + }; + }; +} diff --git a/systems/modules/shell/zsh.nix b/systems/modules/shell/zsh.nix @@ -0,0 +1,16 @@ +{ config, lib, pkgs, ... }: +let + inherit (lib) mkEnableOption mkIf; + cfg = config.modules.shell.zsh; +in +{ + options.modules.shell.zsh = { + enable = mkEnableOption "enable zsh"; + }; + config = mkIf cfg.enable { + programs.zsh = { + enable = true; + enableCompletion = true; + }; + }; +} diff --git a/users/vincent/default.flake.nix b/users/vincent/default.flake.nix @@ -20,7 +20,8 @@ in uid = 1000; description = "Vincent Demeester"; extraGroups = [ "wheel" "input" ] - ++ optionals config.profiles.desktop.enable [ "audio" "video" "networkmanager" ] + ++ optionals config.modules.desktop.enable [ "video" ] + ++ optionals config.modules.hardware.audio.enable [ "audio" ] #++ optionals config.profiles.scanning.enable [ "lp" "scanner" ] ++ optionals config.networking.networkmanager.enable [ "networkmanager" ] ++ optionals config.virtualisation.docker.enable [ "docker" ] diff --git a/users/vincent/home.nix b/users/vincent/home.nix @@ -3,6 +3,39 @@ let inherit (lib) mkIf; in { + profiles = { + desktop = { + i3.enable = true; + browsers = { + default = "firefox"; + firefox.enable = true; + }; + term = { + default = "alacritty"; + alacritty.enable = true; + }; + }; + editors = { + default = "emacs"; + emacs.enable = true; + vim.enable = true; + # vscode.enable = false; + }; + dev = { + go.enable = true; + python.enable = true; + }; + hardware = { + ergodox.enable = true; + }; + shell = { + git.enable = true; + gnupg.enable = true; + direnv.enable = true; + tmux.enable = true; + zsh.enable = true; + }; + }; home.packages = with pkgs; [ htop ]; xsession.windowManager.i3 = mkIf nixosConfig.profiles.desktop.enable { package = pkgs.i3-gaps;