home

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

commit f916a4ff966cdf2904942f1a8fa90d68ba5567b4
parent c1bbd045c95bdc76ad5af55e57cfbb55d2fe8abf
Author: Vincent Demeester <vincent@sbr.pm>
Date:   Sat,  6 Jun 2020 16:39:42 +0200

modules: clean nix files…

- remove nix files that are now in `users/vincent` (or `users/…`)
- rename `*.nixos.nix` files to `*.nix`
- remove unused modules

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

Diffstat:
Dmodules/machines.nix | 15---------------
Dmodules/module-list.nix | 38--------------------------------------
Dmodules/module-list.nixos.nix | 41-----------------------------------------
Dmodules/profiles/aliases.shell.nix | 14--------------
Dmodules/profiles/assets/fish/fish_prompt.fish | 258-------------------------------------------------------------------------------
Dmodules/profiles/assets/fish/fish_right_prompt.fish | 30------------------------------
Dmodules/profiles/assets/fish/go.fish | 1-
Dmodules/profiles/assets/fish/sudope.fish | 2--
Dmodules/profiles/assets/fish/sudope.function.fish | 54------------------------------------------------------
Dmodules/profiles/assets/git | 2--
Dmodules/profiles/assets/lib.mr | 2--
Dmodules/profiles/assets/src.github.mr | 2--
Dmodules/profiles/assets/src.github.openshift.mr | 2--
Dmodules/profiles/assets/src.knative.dev.mr | 2--
Dmodules/profiles/assets/src.mr | 2--
Dmodules/profiles/assets/src.pkgs.devel.redhat.mr | 2--
Dmodules/profiles/assets/tmux | 2--
Dmodules/profiles/assets/xorg | 2--
Dmodules/profiles/assets/zsh | 2--
Dmodules/profiles/audio.nix | 56--------------------------------------------------------
Rmodules/profiles/avahi.nixos.nix -> modules/profiles/avahi.nix | 0
Rmodules/profiles/base.nixos.nix -> modules/profiles/base.nix | 0
Dmodules/profiles/bash.nix | 23-----------------------
Rmodules/profiles/buildkit.nixos.nix -> modules/profiles/buildkit.nix | 0
Rmodules/profiles/containerd.nixos.nix -> modules/profiles/containerd.nix | 0
Dmodules/profiles/containers.nix | 40----------------------------------------
Mmodules/profiles/default.nix | 54+++++++++++++++++++++++++++---------------------------
Mmodules/profiles/desktop.nix | 280++++++++++++++++++++++++++++++++++++++++++++++++++++---------------------------
Dmodules/profiles/desktop.nixos.nix | 209-------------------------------------------------------------------------------
Dmodules/profiles/dev.go.nix | 61-------------------------------------------------------------
Dmodules/profiles/dev.haskell.nix | 21---------------------
Dmodules/profiles/dev.java.nix | 33---------------------------------
Dmodules/profiles/dev.js.nix | 31-------------------------------
Dmodules/profiles/dev.lisp.nix | 19-------------------
Mmodules/profiles/dev.nix | 57+++++++++++++++------------------------------------------
Dmodules/profiles/dev.nixos.nix | 27---------------------------
Dmodules/profiles/dev.python.nix | 23-----------------------
Dmodules/profiles/dev.rust.nix | 29-----------------------------
Dmodules/profiles/direnv.nix | 49-------------------------------------------------
Mmodules/profiles/docker.nix | 50+++++++++++++++++++++++++++++++-------------------
Dmodules/profiles/docker.nixos.nix | 43-------------------------------------------
Dmodules/profiles/emacs.nix | 189-------------------------------------------------------------------------------
Dmodules/profiles/finances.nix | 16----------------
Mmodules/profiles/fish.nix | 41++++++-----------------------------------
Dmodules/profiles/fish.nixos.nix | 28----------------------------
Mmodules/profiles/gaming.nix | 21++++++++++++++++-----
Dmodules/profiles/gaming.nixos.nix | 30------------------------------
Dmodules/profiles/gcloud.nix | 16----------------
Mmodules/profiles/git.nix | 265++++++++++++++++++-------------------------------------------------------------
Dmodules/profiles/git.nixos.nix | 74--------------------------------------------------------------------------
Dmodules/profiles/gpg.nix | 35-----------------------------------
Rmodules/profiles/home.nixos.nix -> modules/profiles/home.nix | 0
Rmodules/profiles/i18n.nixos.nix -> modules/profiles/i18n.nix | 0
Dmodules/profiles/i3.nix | 363-------------------------------------------------------------------------------
Rmodules/profiles/ipfs.nixos.nix -> modules/profiles/ipfs.nix | 0
Dmodules/profiles/kubernetes.nix | 86-------------------------------------------------------------------------------
Mmodules/profiles/laptop.nix | 23++++++++++++++++++-----
Dmodules/profiles/laptop.nixos.nix | 32--------------------------------
Rmodules/profiles/mail.nixos.nix -> modules/profiles/mail.nix | 0
Dmodules/profiles/mails.nix | 215-------------------------------------------------------------------------------
Dmodules/profiles/media.nix | 23-----------------------
Rmodules/profiles/nix-auto-update.nixos.nix -> modules/profiles/nix-auto-update.nix | 0
Rmodules/profiles/nix-config.nixos.nix -> modules/profiles/nix-config.nix | 0
Dmodules/profiles/openshift.nix | 53-----------------------------------------------------
Rmodules/profiles/printing.nixos.nix -> modules/profiles/printing.nix | 0
Rmodules/profiles/pulseaudio.nixos.nix -> modules/profiles/pulseaudio.nix | 0
Rmodules/profiles/qemu.nixos.nix -> modules/profiles/qemu.nix | 0
Rmodules/profiles/scanning.nixos.nix -> modules/profiles/scanning.nix | 0
Mmodules/profiles/ssh.nix | 63++++++++++++++++-----------------------------------------------
Dmodules/profiles/ssh.nixos.nix | 35-----------------------------------
Rmodules/profiles/syncthing.nixos.nix -> modules/profiles/syncthing.nix | 0
Dmodules/profiles/tmux.nix | 28----------------------------
Rmodules/profiles/users.nixos.nix -> modules/profiles/users.nix | 0
Rmodules/profiles/virtualization.nixos.nix -> modules/profiles/virtualization.nix | 0
Rmodules/profiles/wireguard.server.nixos.nix -> modules/profiles/wireguard.server.nix | 0
Rmodules/profiles/yubikey.nixos.nix -> modules/profiles/yubikey.nix | 0
Mmodules/profiles/zsh.nix | 164+++----------------------------------------------------------------------------
Dmodules/profiles/zsh.nixos.nix | 22----------------------
Mmodules/programs/default.nix | 2+-
Mmodules/programs/podman.nix | 77++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---------
Dmodules/programs/podman.nixos.nix | 107-------------------------------------------------------------------------------
Rmodules/services/athens.nixos.nix -> modules/services/athens.nix | 0
Mmodules/services/default.nix | 6+++---
Dmodules/services/emacs-server.nix | 55-------------------------------------------------------
Rmodules/services/govanityurl.nixos.nix -> modules/services/govanityurl.nix | 0
Rmodules/services/nix-binary-cache.nixos.nix -> modules/services/nix-binary-cache.nix | 0
Dmodules/services/shairport-sync.nix | 68--------------------------------------------------------------------
Rmodules/services/wireguard.client.nixos.nix -> modules/services/wireguard.client.nix | 0
Rmodules/virtualisation/buildkit.nixos.nix -> modules/virtualisation/buildkit.nix | 0
Rmodules/virtualisation/containerd.nixos.nix -> modules/virtualisation/containerd.nix | 0
Mmodules/virtualisation/default.nix | 4++--
Rmodules/profiles/vscode.nix -> users/modules/profiles/vscode.nix | 0
Ausers/vincent/dev/js.nix | 6++++++
Ausers/vincent/dev/lisp.nix | 7+++++++
94 files changed, 465 insertions(+), 3267 deletions(-)

diff --git a/modules/machines.nix b/modules/machines.nix @@ -1,15 +0,0 @@ -{ config, lib, ... }: - -with lib; { - options = { - machine = { - home-manager = mkEnableOption "It is a home-manager configuration"; - nixos = mkEnableOption "It is a nixos configuration"; - base = { - fedora = mkEnableOption "The base OS is Fedora"; - debian = mkEnableOption "The base OS is Debian"; - ubuntu = mkEnableOption "The base OS is Ubuntu"; - }; - }; - }; -} diff --git a/modules/module-list.nix b/modules/module-list.nix @@ -1,38 +0,0 @@ -{ - imports = [ - ./machines.nix - ./profiles/audio.nix - ./profiles/bash.nix - ./profiles/containers.nix - ./profiles/desktop.nix - ./profiles/dev.nix - ./profiles/dev.go.nix - ./profiles/dev.haskell.nix - ./profiles/dev.java.nix - ./profiles/dev.js.nix - ./profiles/dev.python.nix - ./profiles/dev.rust.nix - ./profiles/direnv.nix - ./profiles/docker.nix - ./profiles/emacs.nix - ./profiles/finances.nix - ./profiles/fish.nix - ./profiles/gaming.nix - ./profiles/gcloud.nix - ./profiles/git.nix - ./profiles/gpg.nix - ./profiles/i3.nix - ./profiles/kubernetes.nix - ./profiles/laptop.nix - ./profiles/mails.nix - ./profiles/media.nix - ./profiles/openshift.nix - ./profiles/ssh.nix - ./profiles/tmux.nix - ./profiles/vscode.nix - ./profiles/zsh.nix - ./programs/podman.nix - ./services/shairport-sync.nix - ./services/emacs-server.nix - ]; -} diff --git a/modules/module-list.nixos.nix b/modules/module-list.nixos.nix @@ -1,41 +0,0 @@ -{ - imports = [ - ./machines.nix - ./hardware/sane-extra-config.nixos.nix - ./profiles/avahi.nixos.nix - ./profiles/base.nixos.nix - ./profiles/buildkit.nixos.nix - ./profiles/containerd.nixos.nix - ./profiles/desktop.nixos.nix - ./profiles/dev.nixos.nix - ./profiles/docker.nixos.nix - ./profiles/fish.nixos.nix - ./profiles/gaming.nixos.nix - ./profiles/git.nixos.nix - ./profiles/home.nixos.nix - ./profiles/i18n.nixos.nix - ./profiles/ipfs.nixos.nix - ./profiles/laptop.nixos.nix - ./profiles/mail.nixos.nix - ./profiles/nix-config.nixos.nix - ./profiles/nix-auto-update.nixos.nix - ./profiles/printing.nixos.nix - ./profiles/pulseaudio.nixos.nix - ./profiles/qemu.nixos.nix - ./profiles/scanning.nixos.nix - ./profiles/ssh.nixos.nix - ./profiles/syncthing.nixos.nix - ./profiles/users.nixos.nix - ./profiles/virtualization.nixos.nix - ./profiles/wireguard.server.nixos.nix - ./profiles/yubikey.nixos.nix - ./profiles/zsh.nixos.nix - ./programs/podman.nixos.nix - ./services/athens.nixos.nix - ./services/govanityurl.nixos.nix - ./services/nix-binary-cache.nixos.nix - ./services/wireguard.client.nixos.nix - ./virtualisation/buildkit.nixos.nix - ./virtualisation/containerd.nixos.nix - ]; -} diff --git a/modules/profiles/aliases.shell.nix b/modules/profiles/aliases.shell.nix @@ -1,14 +0,0 @@ -{ - mkdir = ''mkdir --parents --verbose''; - rm = ''rm --interactive''; - cp = ''cp --interactive''; - mv = ''mv --interactive''; - gcd = ''cd (git root)''; - ls = ''exa''; - ll = ''exa --long''; - la = ''exa --all''; - l = ''exa --long --all --header''; - t = ''exa --tree --level=2''; - wget = ''wget -c''; - map = ''xargs -n1''; -} diff --git a/modules/profiles/assets/fish/fish_prompt.fish b/modules/profiles/assets/fish/fish_prompt.fish @@ -1,258 +0,0 @@ -# name: lambda -function __fish_basename -d 'basically basename, but faster' - string replace -r '^.*/' '' -- $argv -end - -function __fish_dirname -d 'basically dirname, but faster' - string replace -r '/[^/]+/?$' '' -- $argv -end - - -function __fish_prompt_status -S -a last_status -d 'Display flags for non-zero-exit status, root user, and background jobs' - set -l nonzero - set -l superuser - set -l bg_jobs - - # Last exit was nonzero - [ $last_status -ne 0 ] - and set nonzero 1 - - # If superuser (uid == 0) - # - # Note that iff the current user is root and '/' is not writeable by root this - # will be wrong. But I can't think of a single reason that would happen, and - # it is literally 99.5% faster to check it this way, so that's a tradeoff I'm - # willing to make. - [ -w / ] - and [ (id -u) -eq 0 ] - and set superuser 1 - - # Jobs display - jobs -p >/dev/null - and set bg_jobs 1 - - if [ "$nonzero" ] - set_color red - echo -n '! ' - set_color normal - end - - if [ "$superuser" ] - set_color red - echo -n '$ ' - set_color normal - end - - if [ "$bg_jobs" ] - set_color gray - echo -n '% ' - set_color normal - end -end - -function __fish_prompt_user -S -d 'Display current user and hostname' - [ -n "$SSH_CLIENT" ] - and set -l display_user_hostname - - if set -q display_user_hostname - set -l IFS . - hostname | read -l hostname __ - echo -ns (whoami) '@' $hostname - end -end - -function __fish_git_project_dir - set -l git_dir (command git rev-parse --git-dir ^/dev/null) - or return - - pushd $git_dir - set git_dir $PWD - popd - - switch $PWD/ - case $git_dir/\* - # Nothing works quite right if we're inside the git dir - # TODO: fix the underlying issues then re-enable the stuff below - - # # if we're inside the git dir, sweet. just return that. - # set -l toplevel (command git rev-parse --show-toplevel ^/dev/null) - # if [ "$toplevel" ] - # switch $git_dir/ - # case $toplevel/\* - # echo $git_dir - # end - # end - return - end - - set -l project_dir (__fish_dirname $git_dir) - - switch $PWD/ - case $project_dir/\* - echo $project_dir - return - end - - set project_dir (command git rev-parse --show-toplevel ^/dev/null) - switch $PWD/ - case $project_dir/\* - echo $project_dir - end -end - -function __fish_git_ahead -S -d 'Print the ahead/behind state for the current branch' - set -l ahead 0 - set -l behind 0 - for line in (command git rev-list --left-right '@{upstream}...HEAD' ^/dev/null) - switch "$line" - case '>*' - if [ $behind -eq 1 ] - echo '±' - return - end - set ahead 1 - case '<*' - if [ $ahead -eq 1 ] - echo "±" - return - end - set behind 1 - end - end - - if [ $ahead -eq 1 ] - echo "+" - else if [ $behind -eq 1 ] - echo "-" - end -end - -function __fish_git_branch -S -d 'Get the current git branch (or commitish)' - set -l ref (command git symbolic-ref HEAD ^/dev/null) - and begin - string replace 'refs/heads/' "" $ref - and return - end - - set -l tag (command git describe --tags --exact-match ^/dev/null) - and echo "tag:$tag" - and return - - set -l branch (command git show-ref --head -s --abbrev | head -n1 ^/dev/null) - echo "detached:$branch" -end - -function __fish_prompt_git -S -a current_dir -d 'Display the actula git state' - set -l dirty '' - set -l show_dirty (command git config --bool bash.showDirtyState ^/dev/null) - if [ "$show_dirty" != 'false' ] - set dirty (command git diff --no-ext-diff --quiet --exit-code ^/dev/null; or echo -n "*") - end - - set -l staged (command git diff --cached --no-ext-diff --quiet --exit-code ^/dev/null; or echo -n "~") - set -l stashed (command git rev-parse --verify --quiet refs/stash >/dev/null; and echo -n '$') - set -l ahead (__fish_git_ahead) - - set -l new '' - set -l show_untracked (command git config --bool bash.showUntrackedFiles ^/dev/null) - if [ "$show_untracked" != 'false' ] - set new (command git ls-files --other --exclude-standard --directory --no-empty-directory ^/dev/null) - if [ "$new" ] - set new "…" - end - end - - set -l flags "$dirty$staged$stashed$ahead$new" - [ "$flags" ] - and set flags ":$flags" - - __fish_path_segment $current_dir - - set_color green - echo -n '{' - echo -ns (__fish_git_branch) $flags '' - echo -n '}' - set_color normal - - set -l project_pwd (command git rev-parse --show-prefix ^/dev/null | string trim --right --chars=/) - - if [ "$project_pwd" ] - set_color brblack - echo -n "/$project_pwd" - set_color normal - end -end - -function __fish_prompt_dir -S -d 'Display a shortened form of the current directory' - __fish_path_segment "$PWD" -end - -function __fish_path_segment -S -a current_dir -d 'Display a shortened form of a directory' - set -l directory - set -l parent - - switch "$current_dir" - case / - set directory '/' - case "$HOME" - set directory '~' - case '*' - set parent (__fish_pretty_parent "$current_dir") - set directory (__fish_basename "$current_dir") - end - - set_color white - echo -n $parent - set_color --bold - echo -ns $directory '' - set_color normal -end - -function __fish_pretty_parent -S -a current_dir -d 'Print a parent directory, shortened to fit the prompt' - set -q fish_prompt_pwd_dir_length - or set -l fish_prompt_pwd_dir_length 1 - - # Replace $HOME with ~ - set -l real_home ~ - set -l parent_dir (string replace -r '^'"$real_home"'($|/)' '~$1' (__fish_dirname $current_dir)) - - # Must check whether `$parent_dir = /` if using native dirname - if [ -z "$parent_dir" ] - echo -n / - return - end - - if [ $fish_prompt_pwd_dir_length -eq 0 ] - echo -n "$parent_dir/" - return - end - - string replace -ar '(\.?[^/]{'"$fish_prompt_pwd_dir_length"'})[^/]*/' '$1/' "$parent_dir/" -end - -# TODO: handle envs (nix-shell, virtualenv, ...) - -function fish_prompt -d 'vde-lambda, a fish theme optimized for me :D' - if test $TERM = "dumb" - echo "\$ " - return 0 - end - # Save the last status for later - set -l last_status $status - - __fish_prompt_status $last_status - __fish_prompt_user - - # vcs - set -l git_root (__fish_git_project_dir) - - if [ "$git_root" ] - __fish_prompt_git $git_root - else - __fish_prompt_dir - end - - set_color --bold brblack - echo -n " λ " - set_color normal -end diff --git a/modules/profiles/assets/fish/fish_right_prompt.fish b/modules/profiles/assets/fish/fish_right_prompt.fish @@ -1,30 +0,0 @@ -function __fish_prompt_nix_shell - [ -z "$IN_NIX_SHELL" ] - and return - set_color yellow - echo -n -s '🄪 ' - set_color normal -end - -# ⏍ ⧆ ⌗ ⧉ -function __fish_prompt_direnv - [ -z "$DIRENV_DIR" ] - and return - set_color yellow - echo -n -s '⧉ ' - set_color normal -end - -function __fish_prompt_virtualenv - [ -z "$VIRTUAL_ENV" ] - and return - set_color green - echo -ns 'venv:' (basename "$VIRTUAL_ENV") ' ' - set_color normal -end - -function fish_right_prompt - __fish_prompt_direnv - __fish_prompt_nix_shell - __fish_prompt_virtualenv -end diff --git a/modules/profiles/assets/fish/go.fish b/modules/profiles/assets/fish/go.fish @@ -1 +0,0 @@ -set -gx GOPATH $HOME diff --git a/modules/profiles/assets/fish/sudope.fish b/modules/profiles/assets/fish/sudope.fish @@ -1,2 +0,0 @@ -# default key sequence: Ctrl+s -bind \cs sudope diff --git a/modules/profiles/assets/fish/sudope.function.fish b/modules/profiles/assets/fish/sudope.function.fish @@ -1,54 +0,0 @@ -function sudope -d "Quickly toggle sudo prefix" - - # Save the current command line and cursor position. - set -l command_buffer (commandline) - set -l cursor_position (commandline -C) - - # If the command line is empty, pull the last command from history. - if test -z "$command_buffer" - set command_buffer $history[1] - end - - # Parse the command line (first line only). - set -l command_parts (string match -ir '^(\s*)(sudo(\s+|$))?(.*)' $command_buffer[1]) - - # Handle multiline commands with extra care. - set -l command_lines_count (count $command_buffer) - test $command_lines_count -gt 1 - and set -l command_rest $command_buffer[2..$command_lines_count] - - switch (count $command_parts) - case 3 - # No "sudo". - - # Add "sudo" to the beginning of the command, after any leading whitespace (if present). - commandline -r (string join \n (string join '' $command_parts[2] 'sudo ' $command_parts[3]) $command_rest) - - # Push the cursor position ahead if necessary (+5 for 'sudo '). - test $cursor_position -ge (string length -- "$command_parts[2]") - and set cursor_position (math $cursor_position+5) - - # Place the cursor where it was (or where it should be). - commandline -C $cursor_position - - case 5 - # "sudo" is present in the beginning of the command. - - # Remove "sudo", leave any leading whitespace (if present). - commandline -r (string join \n (string join '' $command_parts[2 5]) $command_rest) - - # Push the cursor position back if appropriate ('sudo' and whitespace). - set -l lead_length (string length -- "$command_parts[2]") - set -l sudo_length (string length -- "$command_parts[3]") - if test $cursor_position -ge (math $lead_length+$sudo_length) - # The cursor was after "sudo". - set cursor_position (math $cursor_position-$sudo_length) - else if test $cursor_position -ge $lead_length - # The cursor was somewhere on "sudo". - set cursor_position $lead_length - end - - # Place the cursor where it was (or where it should be). - commandline -C -- $cursor_position - end -end diff --git a/modules/profiles/assets/git b/modules/profiles/assets/git @@ -1 +0,0 @@ -../../../users/vincent/core/git- \ No newline at end of file diff --git a/modules/profiles/assets/lib.mr b/modules/profiles/assets/lib.mr @@ -1 +0,0 @@ -/home/vincent/src/home/users/vincent/dev/mr/lib.mr- \ No newline at end of file diff --git a/modules/profiles/assets/src.github.mr b/modules/profiles/assets/src.github.mr @@ -1 +0,0 @@ -/home/vincent/src/home/users/vincent/dev/mr/src.github.mr- \ No newline at end of file diff --git a/modules/profiles/assets/src.github.openshift.mr b/modules/profiles/assets/src.github.openshift.mr @@ -1 +0,0 @@ -/home/vincent/src/home/users/vincent/dev/mr/src.github.openshift.mr- \ No newline at end of file diff --git a/modules/profiles/assets/src.knative.dev.mr b/modules/profiles/assets/src.knative.dev.mr @@ -1 +0,0 @@ -/home/vincent/src/home/users/vincent/dev/mr/src.knative.dev.mr- \ No newline at end of file diff --git a/modules/profiles/assets/src.mr b/modules/profiles/assets/src.mr @@ -1 +0,0 @@ -/home/vincent/src/home/users/vincent/dev/mr/src.mr- \ No newline at end of file diff --git a/modules/profiles/assets/src.pkgs.devel.redhat.mr b/modules/profiles/assets/src.pkgs.devel.redhat.mr @@ -1 +0,0 @@ -/home/vincent/src/home/users/vincent/dev/mr/src.pkgs.devel.redhat.mr- \ No newline at end of file diff --git a/modules/profiles/assets/tmux b/modules/profiles/assets/tmux @@ -1 +0,0 @@ -../../../users/vincent/core/tmux- \ No newline at end of file diff --git a/modules/profiles/assets/xorg b/modules/profiles/assets/xorg @@ -1 +0,0 @@ -../../../users/vincent/core/xorg- \ No newline at end of file diff --git a/modules/profiles/assets/zsh b/modules/profiles/assets/zsh @@ -1 +0,0 @@ -../../../users/vincent/core/zsh- \ No newline at end of file diff --git a/modules/profiles/audio.nix b/modules/profiles/audio.nix @@ -1,56 +0,0 @@ -{ config, lib, pkgs, ... }: - -with lib; -let - cfg = config.profiles.audio; -in -{ - options = { - profiles.audio = { - enable = mkEnableOption "Enable audio profile"; - shairport-sync = mkEnableOption "Enable shairport-sync"; - mpd = { - enable = mkEnableOption "Enable mpd"; - musicDir = mkOption { - description = "Data where to find the music for mpd"; - type = types.str; - }; - }; - }; - }; - config = mkIf cfg.enable (mkMerge [ - { - services.shairport-sync.enable = cfg.shairport-sync; - } - ( - mkIf cfg.mpd.enable { - services.mpd = { - enable = true; - musicDirectory = cfg.mpd.musicDir; - network.listenAddress = "any"; - extraConfig = '' - audio_output { - type "pulse" - name "Local MPD" - } - ''; - }; - services.mpdris2 = { - enable = true; - mpd.host = "127.0.0.1"; - }; - home.packages = with pkgs; [ - mpc_cli - ncmpcpp - ]; - } - ) - ( - mkIf (cfg.mpd.enable && config.profiles.desktop.enable) { - home.packages = with pkgs; [ - ario - ]; - } - ) - ]); -} diff --git a/modules/profiles/avahi.nixos.nix b/modules/profiles/avahi.nix diff --git a/modules/profiles/base.nixos.nix b/modules/profiles/base.nix diff --git a/modules/profiles/bash.nix b/modules/profiles/bash.nix @@ -1,23 +0,0 @@ -{ config, lib, ... }: - -with lib; -let - cfg = config.profiles.bash; -in -{ - options = { - profiles.bash = { - enable = mkOption { - default = true; - description = "Enable bash profile and configuration"; - type = types.bool; - }; - }; - }; - config = mkIf cfg.enable { - programs.bash = { - enable = true; - shellAliases = import ./aliases.shell.nix; - }; - }; -} diff --git a/modules/profiles/buildkit.nixos.nix b/modules/profiles/buildkit.nix diff --git a/modules/profiles/containerd.nixos.nix b/modules/profiles/containerd.nix diff --git a/modules/profiles/containers.nix b/modules/profiles/containers.nix @@ -1,40 +0,0 @@ -{ config, lib, pkgs, ... }: - -with lib; -let - cfg = config.profiles.containers; -in -{ - options = { - profiles.containers = { - enable = mkEnableOption "Enable containers profile"; - podman = mkOption { - default = true; - description = "Enable podman tools"; - type = types.bool; - }; - docker = mkEnableOption "Enable docker tools"; - }; - }; - config = mkIf cfg.enable { - profiles.docker.enable = cfg.docker; - programs.podman.enable = cfg.podman; - home.packages = with pkgs; [ - nur.repos.mic92.cntr - my.ko - my.yak - skopeo - ]; - home.file."bin/kontain.me" = { - text = '' - #!${pkgs.stdenv.shell} - command -v docker >/dev/null && { - docker run -ti --rm kontain.me/ko/$@ - } || { - podman run -ti --rm kontain.me/ko/$@ - } - ''; - executable = true; - }; - }; -} diff --git a/modules/profiles/default.nix b/modules/profiles/default.nix @@ -1,32 +1,32 @@ { imports = [ # Remove "nixos" from here - ./avahi.nixos.nix - ./base.nixos.nix - ./buildkit.nixos.nix - ./containerd.nixos.nix - ./desktop.nixos.nix - ./dev.nixos.nix - ./docker.nixos.nix - ./fish.nixos.nix - ./gaming.nixos.nix - ./git.nixos.nix - ./home.nixos.nix - ./i18n.nixos.nix - ./ipfs.nixos.nix - ./laptop.nixos.nix - ./mail.nixos.nix - ./nix-auto-update.nixos.nix - ./printing.nixos.nix - ./pulseaudio.nixos.nix - ./qemu.nixos.nix - ./scanning.nixos.nix - ./ssh.nixos.nix - ./syncthing.nixos.nix - ./users.nixos.nix - ./virtualization.nixos.nix - ./wireguard.server.nixos.nix - ./yubikey.nixos.nix - ./zsh.nixos.nix + ./avahi.nix + ./base.nix + ./buildkit.nix + ./containerd.nix + ./desktop.nix + ./dev.nix + ./docker.nix + ./fish.nix + ./gaming.nix + ./git.nix + ./home.nix + ./i18n.nix + ./ipfs.nix + ./laptop.nix + ./mail.nix + ./nix-auto-update.nix + ./printing.nix + ./pulseaudio.nix + ./qemu.nix + ./scanning.nix + ./ssh.nix + ./syncthing.nix + ./users.nix + ./virtualization.nix + ./wireguard.server.nix + ./yubikey.nix + ./zsh.nix ]; } diff --git a/modules/profiles/desktop.nix b/modules/profiles/desktop.nix @@ -3,119 +3,207 @@ with lib; let cfg = config.profiles.desktop; - dim-screen = pkgs.writeScript "dim-sreen.sh" '' - #!${pkgs.stdenv.shell} - export PATH=${lib.getBin pkgs.xlibs.xbacklight}/bin:$PATH - trap "exit 0" INT TERM - trap "kill \$(jobs -p); xbacklight -steps 1 -set $(xbacklight -get);" EXIT - xbacklight -time 5000 -steps 400 -set 0 & - sleep 2147483647 & - wait - ''; in { options = { profiles.desktop = { - enable = mkEnableOption "Enable desktop profile"; - lockCmd = mkOption { - default = "-n ${dim-screen} -- ${pkgs.i3lock-color}/bin/i3lock-color -c 666666"; - description = "Lock command to use"; - type = types.str; + enable = mkOption { + default = false; + description = "Enable desktop profile"; + type = types.bool; }; - xsession = { - enable = mkOption { - default = true; - description = "Enable xsession managed"; - type = types.bool; - }; - i3 = mkOption { - default = true; - description = "Enable i3 managed window manager"; - type = types.bool; - }; + avahi = mkOption { + default = true; + description = "Enable avahi with the desktop profile"; + type = types.bool; + }; + pulseaudio = mkOption { + default = true; + description = "Enable pulseaudio with the desktop profile"; + type = types.bool; + }; + flatpak = mkOption { + default = true; + description = "Enable flatpak with the desktop profile"; + type = types.bool; + }; + syncthing = mkOption { + default = true; + description = "Enable syncthing with the desktop profile"; + type = types.bool; + }; + scanning = mkOption { + default = true; + description = "Enable scanning with the desktop profile"; + type = types.bool; + }; + printing = mkOption { + default = true; + description = "Enable printing with the desktop profile"; + type = types.bool; + }; + networkmanager = mkOption { + default = true; + description = "Enable networkmanager with the desktop profile"; + type = types.bool; + }; + autoLogin = mkOption { + default = false; + description = "Enable auto login"; + type = types.bool; }; }; }; config = mkIf cfg.enable { - home.sessionVariables = { WEBKIT_DISABLE_COMPOSITING_MODE = 1; }; - profiles.gpg.enable = true; - profiles.emacs.capture = true; - xsession = mkIf cfg.xsession.enable { - enable = true; - initExtra = '' - ${pkgs.xlibs.xmodmap}/bin/xmodmap ${config.home.homeDirectory}.Xmodmap & - ''; - pointerCursor = { - package = pkgs.vanilla-dmz; - name = "Vanilla-DMZ"; - }; - }; - home.keyboard = mkIf cfg.xsession.enable { - layout = "fr(bepo),fr"; - variant = "oss"; - options = [ "grp:menu_toggle" "grp_led:caps" "compose:caps" ]; + profiles.avahi.enable = cfg.avahi; + profiles.printing.enable = cfg.printing; + profiles.pulseaudio.enable = cfg.pulseaudio; + profiles.scanning.enable = cfg.scanning; + profiles.syncthing.enable = cfg.syncthing; + + boot = { + tmpOnTmpfs = true; + plymouth.enable = true; }; - gtk = { - enable = true; - iconTheme = { - name = "Arc"; - package = pkgs.arc-icon-theme; - }; - theme = { - name = "Arc"; - package = pkgs.arc-theme; - }; + + hardware.bluetooth.enable = true; + + networking.networkmanager = { + enable = cfg.networkmanager; + unmanaged = [ + "interface-name:ve-*" + "interface-name:veth*" + "interface-name:wg0" + "interface-name:docker0" + "interface-name:virbr*" + ]; + packages = with pkgs; [ networkmanager-openvpn ]; }; + + programs.dconf.enable = true; + xdg.portal.enable = cfg.flatpak; + services = { - redshift = { + flatpak.enable = cfg.flatpak; + dbus.packages = [ pkgs.gnome3.dconf ]; + xserver = { enable = true; - brightness = { day = "1"; night = "0.9"; }; - latitude = "48.3"; - longitude = "7.5"; - tray = true; + enableTCP = false; + windowManager.twm.enable = true; + libinput.enable = true; + synaptics.enable = false; + layout = "fr(bepo),fr"; + xkbVariant = "oss"; + xkbOptions = "grp:menu_toggle,grp_led:caps,compose:caps"; + inputClassSections = [ + '' + Identifier "TypeMatrix" + MatchIsKeyboard "on" + MatchVendor "TypeMatrix.com" + MatchProduct "USB Keyboard" + Driver "evdev" + Option "XbkModel" "tm2030USB" + Option "XkbLayout" "fr" + Option "XkbVariant" "bepo" + '' + '' + Identifier "ErgoDox" + #MatchVendor "ErgoDox_EZ" + #MatchProduct "ErgoDox_EZ" + MatchIsKeyboard "on" + MatchUSBID "feed:1307" + Driver "evdev" + Option "XkbLayout" "fr" + Option "XkbVariant" "bepo" + '' + ]; + displayManager = { + # defaultSession = "none+i3"; + lightdm = { + enable = true; + autoLogin = { + enable = true; + user = "vincent"; + }; + }; + }; }; }; - home.file.".XCompose".source = ./assets/xorg/XCompose; - home.file.".Xmodmap".source = ./assets/xorg/Xmodmap; - xdg.configFile."xorg/emoji.compose".source = ./assets/xorg/emoji.compose; - xdg.configFile."xorg/parens.compose".source = ./assets/xorg/parens.compose; - xdg.configFile."xorg/modletters.compose".source = ./assets/xorg/modletters.compose; - xdg.configFile."user-dirs.dirs".source = ./assets/xorg/user-dirs.dirs; - xdg.configFile."nr/desktop" = { - text = builtins.toJSON [ - { cmd = "surf"; } - { cmd = "next"; } - { cmd = "xclip"; } - { cmd = "dmenu"; } - { cmd = "sxiv"; } - { cmd = "screenkey"; } - { cmd = "gimp"; } - { cmd = "virt-manager"; pkg = "virtmanager"; } - { cmd = "update-desktop-database"; pkg = "desktop-file-utils"; chan = "unstable"; } - { cmd = "lgogdownloader"; chan = "unstable"; } - { cmd = "xev"; pkg = "xorg.xev"; } + fonts = { + enableFontDir = true; + enableGhostscriptFonts = true; + fonts = with pkgs; [ + 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 ]; - onChange = "${pkgs.my.nr}/bin/nr desktop"; - }; - programs = { - firefox.enable = true; }; - profiles.i3.enable = cfg.xsession.i3; - home.packages = with pkgs; [ - aspell - aspellDicts.en - aspellDicts.fr - #etBook - gnome3.defaultIconTheme - gnome3.gnome_themes_standard - keybase - mpv - pass - peco - profile-sync-daemon - xdg-user-dirs - xdg_utils - xsel + + # Polkit. + security.polkit.extraConfig = '' + polkit.addRule(function(action, subject) { + if ((action.id == "org.freedesktop.udisks2.filesystem-mount-system" || + action.id == "org.freedesktop.udisks2.encrypted-unlock-system" + ) && + subject.local && subject.active && subject.isInGroup("users")) { + return polkit.Result.YES; + } + var YES = polkit.Result.YES; + var permission = { + // required for udisks1: + "org.freedesktop.udisks.filesystem-mount": YES, + "org.freedesktop.udisks.luks-unlock": YES, + "org.freedesktop.udisks.drive-eject": YES, + "org.freedesktop.udisks.drive-detach": YES, + // required for udisks2: + "org.freedesktop.udisks2.filesystem-mount": YES, + "org.freedesktop.udisks2.encrypted-unlock": YES, + "org.freedesktop.udisks2.eject-media": YES, + "org.freedesktop.udisks2.power-off-drive": YES, + // required for udisks2 if using udiskie from another seat (e.g. systemd): + "org.freedesktop.udisks2.filesystem-mount-other-seat": YES, + "org.freedesktop.udisks2.filesystem-unmount-others": YES, + "org.freedesktop.udisks2.encrypted-unlock-other-seat": YES, + "org.freedesktop.udisks2.eject-media-other-seat": YES, + "org.freedesktop.udisks2.power-off-drive-other-seat": YES + }; + if (subject.isInGroup("wheel")) { + return permission[action.id]; + } + }); + ''; + + environment.systemPackages = with pkgs; [ + cryptsetup + xlibs.xmodmap + xorg.xbacklight + xorg.xdpyinfo + xorg.xhost + xorg.xinit + xss-lock + xorg.xmessage + unzip + gnupg + pinentry + inxi ]; }; } diff --git a/modules/profiles/desktop.nixos.nix b/modules/profiles/desktop.nixos.nix @@ -1,209 +0,0 @@ -{ config, lib, pkgs, ... }: - -with lib; -let - cfg = config.profiles.desktop; -in -{ - options = { - profiles.desktop = { - enable = mkOption { - default = false; - description = "Enable desktop profile"; - type = types.bool; - }; - avahi = mkOption { - default = true; - description = "Enable avahi with the desktop profile"; - type = types.bool; - }; - pulseaudio = mkOption { - default = true; - description = "Enable pulseaudio with the desktop profile"; - type = types.bool; - }; - flatpak = mkOption { - default = true; - description = "Enable flatpak with the desktop profile"; - type = types.bool; - }; - syncthing = mkOption { - default = true; - description = "Enable syncthing with the desktop profile"; - type = types.bool; - }; - scanning = mkOption { - default = true; - description = "Enable scanning with the desktop profile"; - type = types.bool; - }; - printing = mkOption { - default = true; - description = "Enable printing with the desktop profile"; - type = types.bool; - }; - networkmanager = mkOption { - default = true; - description = "Enable networkmanager with the desktop profile"; - type = types.bool; - }; - autoLogin = mkOption { - default = false; - description = "Enable auto login"; - type = types.bool; - }; - }; - }; - config = mkIf cfg.enable { - profiles.avahi.enable = cfg.avahi; - profiles.printing.enable = cfg.printing; - profiles.pulseaudio.enable = cfg.pulseaudio; - profiles.scanning.enable = cfg.scanning; - profiles.syncthing.enable = cfg.syncthing; - - boot = { - tmpOnTmpfs = true; - plymouth.enable = true; - }; - - hardware.bluetooth.enable = true; - - networking.networkmanager = { - enable = cfg.networkmanager; - unmanaged = [ - "interface-name:ve-*" - "interface-name:veth*" - "interface-name:wg0" - "interface-name:docker0" - "interface-name:virbr*" - ]; - packages = with pkgs; [ networkmanager-openvpn ]; - }; - - programs.dconf.enable = true; - xdg.portal.enable = cfg.flatpak; - - services = { - flatpak.enable = cfg.flatpak; - dbus.packages = [ pkgs.gnome3.dconf ]; - xserver = { - enable = true; - enableTCP = false; - windowManager.twm.enable = true; - libinput.enable = true; - synaptics.enable = false; - layout = "fr(bepo),fr"; - xkbVariant = "oss"; - xkbOptions = "grp:menu_toggle,grp_led:caps,compose:caps"; - inputClassSections = [ - '' - Identifier "TypeMatrix" - MatchIsKeyboard "on" - MatchVendor "TypeMatrix.com" - MatchProduct "USB Keyboard" - Driver "evdev" - Option "XbkModel" "tm2030USB" - Option "XkbLayout" "fr" - Option "XkbVariant" "bepo" - '' - '' - Identifier "ErgoDox" - #MatchVendor "ErgoDox_EZ" - #MatchProduct "ErgoDox_EZ" - MatchIsKeyboard "on" - MatchUSBID "feed:1307" - Driver "evdev" - Option "XkbLayout" "fr" - Option "XkbVariant" "bepo" - '' - ]; - displayManager = { - # defaultSession = "none+i3"; - lightdm = { - enable = true; - autoLogin = { - enable = true; - user = "vincent"; - }; - }; - }; - }; - }; - fonts = { - enableFontDir = true; - enableGhostscriptFonts = true; - fonts = with pkgs; [ - 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 - ]; - }; - - # Polkit. - security.polkit.extraConfig = '' - polkit.addRule(function(action, subject) { - if ((action.id == "org.freedesktop.udisks2.filesystem-mount-system" || - action.id == "org.freedesktop.udisks2.encrypted-unlock-system" - ) && - subject.local && subject.active && subject.isInGroup("users")) { - return polkit.Result.YES; - } - var YES = polkit.Result.YES; - var permission = { - // required for udisks1: - "org.freedesktop.udisks.filesystem-mount": YES, - "org.freedesktop.udisks.luks-unlock": YES, - "org.freedesktop.udisks.drive-eject": YES, - "org.freedesktop.udisks.drive-detach": YES, - // required for udisks2: - "org.freedesktop.udisks2.filesystem-mount": YES, - "org.freedesktop.udisks2.encrypted-unlock": YES, - "org.freedesktop.udisks2.eject-media": YES, - "org.freedesktop.udisks2.power-off-drive": YES, - // required for udisks2 if using udiskie from another seat (e.g. systemd): - "org.freedesktop.udisks2.filesystem-mount-other-seat": YES, - "org.freedesktop.udisks2.filesystem-unmount-others": YES, - "org.freedesktop.udisks2.encrypted-unlock-other-seat": YES, - "org.freedesktop.udisks2.eject-media-other-seat": YES, - "org.freedesktop.udisks2.power-off-drive-other-seat": YES - }; - if (subject.isInGroup("wheel")) { - return permission[action.id]; - } - }); - ''; - - environment.systemPackages = with pkgs; [ - cryptsetup - xlibs.xmodmap - xorg.xbacklight - xorg.xdpyinfo - xorg.xhost - xorg.xinit - xss-lock - xorg.xmessage - unzip - gnupg - pinentry - inxi - ]; - }; -} diff --git a/modules/profiles/dev.go.nix b/modules/profiles/dev.go.nix @@ -1,61 +0,0 @@ -{ config, lib, pkgs, ... }: - -with lib; -let - cfg = config.profiles.dev.go; -in -{ - options = { - profiles.dev.go = { - enable = mkEnableOption "Enable go development profile"; - }; - }; - config = mkIf cfg.enable (mkMerge [ - { - home.sessionVariables = { - GOPATH = "${config.home.homeDirectory}"; - }; - profiles.dev.enable = true; - home.packages = with pkgs; [ - gcc - go - godef - golangci-lint - golint - gopkgs - go-outline - go-symbols - delve - goimports - # vendoring tools - dep - # misc - protobuf - my.protobuild - my.ram - my.sec - my.esc - my.yaspell - ]; - xdg.configFile."nr/go" = { - text = builtins.toJSON [ - { cmd = "pprof"; chan = "unstable"; } - { cmd = "vndr"; chan = "unstable"; } - { cmd = "go2nix"; } - { cmd = "dep2nix"; } - ]; - onChange = "${pkgs.my.nr}/bin/nr go"; - }; - } - ( - mkIf config.profiles.fish.enable { - xdg.configFile."fish/conf.d/go.fish".source = ./assets/fish/go.fish; - programs.fish.shellAbbrs = { - got = "go test -v"; - gob = "go build -v"; - gol = "golangci-lint run"; - }; - } - ) - ]); -} diff --git a/modules/profiles/dev.haskell.nix b/modules/profiles/dev.haskell.nix @@ -1,21 +0,0 @@ -{ config, lib, pkgs, ... }: - -with lib; -let - cfg = config.profiles.dev.haskell; -in -{ - options = { - profiles.dev.haskell = { - enable = mkEnableOption "Enable haskell development profile"; - }; - }; - config = mkIf cfg.enable { - profiles.dev.enable = true; - home.packages = with pkgs; [ - ghc - stack - hlint - ]; - }; -} diff --git a/modules/profiles/dev.java.nix b/modules/profiles/dev.java.nix @@ -1,33 +0,0 @@ -{ config, lib, pkgs, ... }: - -with lib; -let - cfg = config.profiles.dev.java; -in -{ - options = { - profiles.dev.java = { - enable = mkEnableOption "Enable java development profile"; - javaPackage = mkOption { - default = pkgs.jdk; - description = "Java package to use"; - type = types.package; - }; - idea = mkEnableOption "Install intellij idea"; - }; - }; - config = mkIf cfg.enable (mkMerge [ - { - profiles.dev.enable = true; - home.packages = with pkgs; [ - cfg.javaPackage - gradle - ]; - } - ( - mkIf cfg.idea { - home.packages = with pkgs; [ jetbrains.idea-ultimate ]; - } - ) - ]); -} diff --git a/modules/profiles/dev.js.nix b/modules/profiles/dev.js.nix @@ -1,31 +0,0 @@ -{ config, lib, pkgs, ... }: - -with lib; -let - cfg = config.profiles.dev.js; -in -{ - options = { - profiles.dev.js = { - enable = mkEnableOption "Enable js development profile"; - }; - }; - config = mkIf cfg.enable (mkMerge [ - { - home.file.".npmrc".text = '' - prefix = ${config.home.homeDirectory}/.local/npm - ''; - home.packages = with pkgs; [ - nodejs-10_x - yarn - ]; - } - ( - mkIf config.profiles.fish.enable { - xdg.configFile."fish/conf.d/js.fish".text = '' - set -gx PATH ${config.home.homeDirectory}/.local/npm/bin $PATH - ''; - } - ) - ]); -} diff --git a/modules/profiles/dev.lisp.nix b/modules/profiles/dev.lisp.nix @@ -1,19 +0,0 @@ -{ config, lib, pkgs, ... }: - -with lib; -let - cfg = config.profiles.dev.lisp; -in -{ - options = { - profiles.dev.lisp = { - enable = mkEnableOption "Enable lisp development profile"; - }; - }; - config = mkIf cfg.enable { - home-packages = with pkgs; [ - sbcl - asdf - ]; - }; -} diff --git a/modules/profiles/dev.nix b/modules/profiles/dev.nix @@ -7,48 +7,21 @@ in { options = { profiles.dev = { - enable = mkEnableOption "Enable development profile"; + enable = mkOption { + default = false; + description = "Enable dev profile"; + type = types.bool; + }; }; }; - config = mkIf cfg.enable (mkMerge [ - { - profiles.git.enable = true; - profiles.emacs.enable = true; - home.file.".ignore".text = '' - *.swp - *~ - **/VENDOR-LICENSE - ''; - xdg.configFile."mr".source = ./assets/lib.mr; - home.file."src/.mrconfig".source = ./assets/src.mr; - home.file."src/knative.dev/.mrconfig".source = ./assets/src.knative.dev.mr; - home.file."src/github.com/.mrconfig".source = ./assets/src.github.mr; - home.file."src/github.com/openshift/.mrconfig".source = ./assets/src.github.openshift.mr; - home.file."src/pkgs.devel.redhat.com/.mrconfig".source = ./assets/src.pkgs.devel.redhat.mr; - home.packages = with pkgs; - [ - binutils - cmake - fswatch - gnumake - jq - mercurial - shfmt - ]; - xdg.configFile."nr/dev" = { - text = builtins.toJSON [ - { cmd = "yq"; } - { cmd = "lnav"; } - { cmd = "miniserve"; } - { cmd = "licensor"; } - { cmd = "nix-review"; } - { cmd = "yamllint"; pkg = "python37Packages.yamllint"; } - { cmd = "nix-prefetch-git"; pkg = "nix-prefetch-scripts"; } - { cmd = "nix-prefetch-hg"; pkg = "nix-prefetch-scripts"; } - { cmd = "http"; pkg = "httpie"; } - ]; - onChange = "${pkgs.my.nr}/bin/nr dev"; - }; - } - ]); + config = mkIf cfg.enable { + profiles.git.enable = true; + environment.systemPackages = with pkgs; [ + git + tig + grc + ripgrep + gnumake + ]; + }; } diff --git a/modules/profiles/dev.nixos.nix b/modules/profiles/dev.nixos.nix @@ -1,27 +0,0 @@ -{ config, lib, pkgs, ... }: - -with lib; -let - cfg = config.profiles.dev; -in -{ - options = { - profiles.dev = { - enable = mkOption { - default = false; - description = "Enable dev profile"; - type = types.bool; - }; - }; - }; - config = mkIf cfg.enable { - profiles.git.enable = true; - environment.systemPackages = with pkgs; [ - git - tig - grc - ripgrep - gnumake - ]; - }; -} diff --git a/modules/profiles/dev.python.nix b/modules/profiles/dev.python.nix @@ -1,23 +0,0 @@ -{ config, lib, pkgs, ... }: - -with lib; -let - cfg = config.profiles.dev.python; -in -{ - options = { - profiles.dev.python = { - enable = mkEnableOption "Enable python development profile"; - }; - }; - config = mkIf cfg.enable { - profiles.dev.enable = true; - home.packages = with pkgs; [ - python3 - python36Packages.virtualenv - python36Packages.pip-tools - python36Packages.tox - pipenv - ]; - }; -} diff --git a/modules/profiles/dev.rust.nix b/modules/profiles/dev.rust.nix @@ -1,29 +0,0 @@ -{ config, lib, pkgs, ... }: - -with lib; -let - cfg = config.profiles.dev.rust; -in -{ - options = { - profiles.dev.rust = { - enable = mkEnableOption "Enable rust development profile"; - }; - }; - config = mkIf cfg.enable (mkMerge [ - { - profiles.dev.enable = true; - home.packages = with pkgs; [ - gcc - rustup - ]; - } - ( - mkIf config.profiles.emacs.enable { - home.packages = with pkgs; [ - rustracer - ]; - } - ) - ]); -} diff --git a/modules/profiles/direnv.nix b/modules/profiles/direnv.nix @@ -1,49 +0,0 @@ -{ config, lib, ... }: - -with lib; -let - cfg = config.profiles.direnv; -in -{ - options = { - profiles.direnv = { - enable = mkOption { - default = true; - description = "Enable direnv profile and configuration"; - type = types.bool; - }; - }; - }; - config = mkIf cfg.enable (mkMerge [ - { - programs.direnv = { - enable = true; - config = { - whitelist = { - prefix = [ - "${config.home.homeDirectory}/src/github.com/knative" - "${config.home.homeDirectory}/src/github.com/openshift" - "${config.home.homeDirectory}/src/github.com/tektoncd" - "${config.home.homeDirectory}/src/github.com/vdemeester" - ]; - }; - }; - }; - } - ( - mkIf config.profiles.fish.enable { - programs.direnv.enableFishIntegration = true; - } - ) - ( - mkIf config.profiles.zsh.enable { - programs.direnv.enableZshIntegration = true; - } - ) - ( - mkIf config.profiles.bash.enable { - programs.direnv.enableBashIntegration = true; - } - ) - ]); -} diff --git a/modules/profiles/docker.nix b/modules/profiles/docker.nix @@ -7,25 +7,37 @@ in { options = { profiles.docker = { - enable = mkEnableOption "Enable docker profile"; + enable = mkOption { + default = false; + description = "Enable docker profile"; + type = types.bool; + }; + package = mkOption { + default = pkgs.docker-edge; + description = "docker package to be used"; + type = types.package; + }; + runcPackage = mkOption { + default = pkgs.runc; + description = "runc package to be used"; + type = types.package; + }; }; }; - config = mkIf cfg.enable (mkMerge [ - { - home.packages = with pkgs; [ - docker - docker-machine - docker-machine-kvm - docker-machine-kvm2 - docker-compose - ]; - } - ( - mkIf config.profiles.fish.enable { - xdg.configFile."fish/conf.d/docker.fish".text = '' - # set -gx DOCKER_BUILDKIT 1 - ''; - } - ) - ]); + config = mkIf cfg.enable { + profiles.containerd.enable = true; + virtualisation = { + docker = { + enable = true; + package = cfg.package; + liveRestore = false; + storageDriver = "overlay2"; + extraOptions = "--experimental --add-runtime docker-runc=${cfg.runcPackage}/bin/runc --default-runtime=docker-runc --containerd=/run/containerd/containerd.sock"; + }; + }; + environment.etc."docker/daemon.json".text = '' + {"features":{"buildkit": true}, "insecure-registries": ["172.30.0.0/16", "192.168.12.0/16", "massimo.home:5000", "r.svc.home:5000", "r.svc.home" ]} + ''; + networking.firewall.trustedInterfaces = [ "docker0" ]; + }; } diff --git a/modules/profiles/docker.nixos.nix b/modules/profiles/docker.nixos.nix @@ -1,43 +0,0 @@ -{ config, lib, pkgs, ... }: - -with lib; -let - cfg = config.profiles.docker; -in -{ - options = { - profiles.docker = { - enable = mkOption { - default = false; - description = "Enable docker profile"; - type = types.bool; - }; - package = mkOption { - default = pkgs.docker-edge; - description = "docker package to be used"; - type = types.package; - }; - runcPackage = mkOption { - default = pkgs.runc; - description = "runc package to be used"; - type = types.package; - }; - }; - }; - config = mkIf cfg.enable { - profiles.containerd.enable = true; - virtualisation = { - docker = { - enable = true; - package = cfg.package; - liveRestore = false; - storageDriver = "overlay2"; - extraOptions = "--experimental --add-runtime docker-runc=${cfg.runcPackage}/bin/runc --default-runtime=docker-runc --containerd=/run/containerd/containerd.sock"; - }; - }; - environment.etc."docker/daemon.json".text = '' - {"features":{"buildkit": true}, "insecure-registries": ["172.30.0.0/16", "192.168.12.0/16", "massimo.home:5000", "r.svc.home:5000", "r.svc.home" ]} - ''; - networking.firewall.trustedInterfaces = [ "docker0" ]; - }; -} diff --git a/modules/profiles/emacs.nix b/modules/profiles/emacs.nix @@ -1,189 +0,0 @@ -{ config, lib, pkgs, ... }: - -with lib; -let - cfg = config.profiles.emacs; - capture = pkgs.writeScriptBin "capture" '' - #!${pkgs.stdenv.shell} - emacsclient -s /run/user/1000/emacs/org -n -F '((name . "capture") (width . 150) (height . 90))' -e '(org-capture)' - ''; - myEmacs = pkgs.emacs27.override { inherit (pkgs) imagemagick; withXwidgets = cfg.withXwidgets; }; -in -{ - options = { - profiles.emacs = { - enable = mkEnableOption "Enable emacs profile"; - capture = mkEnableOption "Enable capture script(s)"; - daemonService = mkOption { - default = true; - description = "Enable emacs daemon service"; - type = types.bool; - }; - withXwidgets = mkEnableOption "Enable Xwidgets in emacs build"; - texlive = mkOption { - default = true; - description = "Enable Texlive"; - type = types.bool; - }; - }; - }; - config = mkIf cfg.enable (mkMerge [ - { - home.file.".local/share/applications/org-protocol.desktop".source = ./assets/xorg/org-protocol.desktop; - home.file.".local/share/applications/ec.desktop".source = ./assets/xorg/ec.desktop; - home.file.".local/share/applications/capture.desktop".source = ./assets/xorg/capture.desktop; - home.packages = with pkgs; [ - ditaa - graphviz - pandoc - zip - hunspell - hunspellDicts.en_US-large - hunspellDicts.en_GB-ize - hunspellDicts.fr-any - nixpkgs-fmt - ]; - home.sessionVariables = { - EDITOR = "et"; - ALTERNATE_EDITOR = "et"; - }; - programs.emacs = { - enable = true; - package = myEmacs; - extraPackages = epkgs: with epkgs; [ - ace-window - aggressive-indent - async - avy - bbdb - beginend - pkgs.bookmark-plus - company - company-emoji - company-go - dash - delight - dired-collapse - dired-git-info - dired-quick-sort - dired-narrow - dired-rsync - pkgs.dired-plus - direnv - dockerfile-mode - easy-kill - esup - expand-region - flycheck - flycheck-golangci-lint - git-annex - git-commit - gitattributes-mode - gitconfig-mode - gitignore-mode - github-review - goto-last-change - hardhat - helpful - highlight - highlight-indentation - highlight-numbers - ibuffer-vc - icomplete-vertical - iedit - json-mode - markdown-mode - mpdel - multiple-cursors - nixpkgs-fmt - no-littering - ob-async - ob-go - ob-http - orderless - orgit - org-plus-contrib - org-capture-pop-frame - org-gcal - org-ql - org-ref - org-super-agenda - org-web-tools - ox-pandoc - pandoc-mode - projectile - projectile-ripgrep - pdf-tools - python-mode - rainbow-delimiters - rainbow-mode - region-bindings-mode - ripgrep - rg - try - visual-fill-column - visual-regexp - web-mode - wgrep - with-editor - xterm-color - yaml-mode - darkroom - eshell-prompt-extras - esh-autosuggest - flimenu - forge - go-mode - magit - magit-annex - magit-popup - magit-todos - minions - moody - mwim - nix-buffer - nix-mode - org-super-agenda - org-tree-slide - shr-tag-pre-highlight - ssh-config-mode - smartparens - symbol-overlay - undo-tree - use-package - # Highly experimental - vterm - gotest - ]; - }; - } - ( - mkIf config.profiles.emacs.capture { - home.packages = with pkgs; [ wmctrl capture ]; - } - ) - ( - mkIf config.services.gpg-agent.enable { - #services.gpg-agent.extraConfig = '' - # allow-emacs-pinentry - #''; - } - ) - ( - mkIf cfg.texlive { - home.packages = with pkgs; [ texlive.combined.scheme-full ]; - } - ) - ( - mkIf cfg.daemonService { - services.emacs-server = { - enable = true; - package = myEmacs; - name = "org"; - shell = pkgs.zsh + "/bin/zsh -i -c"; - extraOptions = "--dump-file=${config.home.homeDirectory}/.config/emacs/emacs.pdmp"; - }; - } - ) - ]); -} diff --git a/modules/profiles/finances.nix b/modules/profiles/finances.nix @@ -1,16 +0,0 @@ -{ config, lib, pkgs, ... }: - -with lib; -let - cfg = config.profiles.finances; -in -{ - options = { - profiles.finances = { - enable = mkEnableOption "Enable fincances profile"; - }; - }; - config = mkIf cfg.enable { - home.packages = with pkgs; [ ledger ]; - }; -} diff --git a/modules/profiles/fish.nix b/modules/profiles/fish.nix @@ -9,7 +9,7 @@ in profiles.fish = { enable = mkOption { default = false; - description = "Enable fish program and configurations"; + description = "Enable fish profile"; type = types.bool; }; }; @@ -17,41 +17,12 @@ in config = mkIf cfg.enable { programs.fish = { enable = true; - shellAliases = import ./aliases.shell.nix; - shellInit = '' - # emacs ansi-term support - if test -n "$EMACS" - set -x TERM eterm-color - - # this function may be required - function fish_title - true - end - end + promptInit = '' + source /etc/fish/functions/fish_prompt.fish + source /etc/fish/functions/fish_right_prompt.fish ''; }; - xdg.configFile."fish/conf.d/sudope.fish".source = ./assets/fish/sudope.fish; - xdg.configFile."fish/functions/sudope.fish".source = ./assets/fish/sudope.function.fish; - xdg.configFile."fish/functions/fish_prompt.fish".source = ./assets/fish/fish_prompt.fish; - xdg.configFile."fish/functions/fish_right_prompt.fish".source = ./assets/fish/fish_right_prompt.fish; - xdg.configFile."nr/default" = { - text = builtins.toJSON [ - { cmd = "ncdu"; } - { cmd = "sshfs"; } - { cmd = "gotop"; } - { cmd = "pandoc"; } - { cmd = "nix-review"; } - { cmd = "lspci"; pkg = "pciutils"; } - { cmd = "lsusb"; pkg = "usbutils"; } - { cmd = "9"; pkg = "plan9port"; } - { cmd = "wakeonlan"; pkg = "python36Packages.wakeonlan"; } - { cmd = "beet"; pkg = "beets"; } - { cmd = "http"; pkg = "httpie"; } - { cmd = "nix-prefetch-git"; pkg = "nix-prefetch-scripts"; } - { cmd = "nix-prefetch-hg"; pkg = "nix-prefetch-scripts"; } - { cmd = "op"; pkg = "_1password"; chan = "unstable"; } - ]; - onChange = "${pkgs.my.nr}/bin/nr default"; - }; + environment.etc."fish/functions/fish_prompt.fish".source = ./assets/fish/fish_prompt.fish; + environment.etc."fish/functions/fish_right_prompt.fish".source = ./assets/fish/fish_right_prompt.fish; }; } diff --git a/modules/profiles/fish.nixos.nix b/modules/profiles/fish.nixos.nix @@ -1,28 +0,0 @@ -{ config, lib, pkgs, ... }: - -with lib; -let - cfg = config.profiles.fish; -in -{ - options = { - profiles.fish = { - enable = mkOption { - default = false; - description = "Enable fish profile"; - type = types.bool; - }; - }; - }; - config = mkIf cfg.enable { - programs.fish = { - enable = true; - promptInit = '' - source /etc/fish/functions/fish_prompt.fish - source /etc/fish/functions/fish_right_prompt.fish - ''; - }; - environment.etc."fish/functions/fish_prompt.fish".source = ./assets/fish/fish_prompt.fish; - environment.etc."fish/functions/fish_right_prompt.fish".source = ./assets/fish/fish_right_prompt.fish; - }; -} diff --git a/modules/profiles/gaming.nix b/modules/profiles/gaming.nix @@ -7,13 +7,24 @@ in { options = { profiles.gaming = { - enable = mkEnableOption "Enable gaming profile"; + enable = mkOption { + default = false; + description = "Enable gaming profile"; + type = types.bool; + }; }; }; config = mkIf cfg.enable { - home.packages = with pkgs; [ - steam - discord - ]; + hardware = { + opengl = { + driSupport32Bit = true; + }; + }; + services.udev.extraRules = '' + # Steam controller + SUBSYSTEM=="usb", ATTRS{idVendor}=="28de", MODE="0666" + KERNEL=="uinput", MODE="0660", GROUP="users", OPTIONS+="static_node=uinput" + ''; + environment.systemPackages = with pkgs; [ steam ]; }; } diff --git a/modules/profiles/gaming.nixos.nix b/modules/profiles/gaming.nixos.nix @@ -1,30 +0,0 @@ -{ config, lib, pkgs, ... }: - -with lib; -let - cfg = config.profiles.gaming; -in -{ - options = { - profiles.gaming = { - enable = mkOption { - default = false; - description = "Enable gaming profile"; - type = types.bool; - }; - }; - }; - config = mkIf cfg.enable { - hardware = { - opengl = { - driSupport32Bit = true; - }; - }; - services.udev.extraRules = '' - # Steam controller - SUBSYSTEM=="usb", ATTRS{idVendor}=="28de", MODE="0666" - KERNEL=="uinput", MODE="0660", GROUP="users", OPTIONS+="static_node=uinput" - ''; - environment.systemPackages = with pkgs; [ steam ]; - }; -} diff --git a/modules/profiles/gcloud.nix b/modules/profiles/gcloud.nix @@ -1,16 +0,0 @@ -{ config, lib, pkgs, ... }: - -with lib; -let - cfg = config.profiles.cloud.google; -in -{ - options = { - profiles.cloud.google = { - enable = mkEnableOption "Enable google cloud profile"; - }; - }; - config = mkIf cfg.enable { - home.packages = with pkgs; [ google-cloud-sdk gcsfuse ]; #google-compute-engine - }; -} diff --git a/modules/profiles/git.nix b/modules/profiles/git.nix @@ -3,219 +3,72 @@ with lib; let cfg = config.profiles.git; - ca-bundle_crt = "/etc/ssl/certs/ca-bundle.crt"; in { options = { profiles.git = { - enable = mkEnableOption "Enable git profile"; + enable = mkOption { + default = false; + description = "Enable git profile"; + type = types.bool; + }; }; }; - config = mkIf cfg.enable (mkMerge [ - { - home.packages = with pkgs; [ - gist - git-lfs - gitAndTools.git-annex - gitAndTools.hub - gitAndTools.gh - mr - my.prm - my.ape - ]; - programs.git = { - enable = true; - package = pkgs.gitAndTools.gitFull; - - userName = "Vincent Demeester"; - userEmail = "vincent@sbr.pm"; + config = mkIf cfg.enable { + environment.systemPackages = with pkgs; [ + gitAndTools.gitFull + gitAndTools.git-annex + gitAndTools.git-extras + ]; + environment.etc."gitconfig" = rec { + text = '' + [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 = ~/.gitignore.global + [push] + default = matching + [merge] + tool = vimdiff - signing = { - key = "6EB699A3"; - signByDefault = false; - }; + [user] + name = Vincent Demeester + email = vincent@sbr.pm - aliases = { - b = "branch --color -v"; - br = "branch"; - ci = "commit --signoff"; - co = "checkout"; - conflicts = "!git ls-files --unmerged | cut -c51- | sort -u | xargs $EDITOR"; - ca = "commit --amend"; - wdiff = "diff --color-words"; - 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"; - ls-ignored = "ls-files --exclude-standard --ignored --others"; - resolve = "!git ls-files --unmerged | cut -c51- | sort -u | xargs git add"; - su = "submodule update --init --recursive"; - st = "status"; - w = "status -sb"; - }; - attributes = [ - "*.org diff=org" - ]; - extraConfig = { - core = { - editor = "${pkgs.emacs}/bin/emacsclient -t"; - }; - color = { - status = "auto"; - diff = "auto"; - branch = "auto"; - interactive = "auto"; - ui = "auto"; - sh = "auto"; - }; - "color.branch" = { - current = "cyan reverse"; - local = "cyan"; - remote = "green"; - }; - "color.diff" = { - current = "white reverse"; - frag = "magenta reverse"; - old = "red"; - new = "green"; - }; - "color.status" = { - added = "green"; - changed = "yellow"; - untracked = "red"; - }; - "diff.org" = { - xfuncname = "\"^\\\\*+.*\""; - }; - forge = { - remote = "upstream"; - }; - hub = { - protocol = true; - }; - pull = { - rebase = true; - }; - push = { - default = "upstream"; - recurseSubmodules = "check"; - }; - rebase = { - autosquash = true; - }; - advice = { - statusHints = false; - pushNonFastForward = false; - }; - http = { - sslCAinfo = "${ca-bundle_crt}"; - sslverify = true; - }; - github.user = "vdemeester"; - "filter \"lfs\"" = { - clean = "${pkgs.git-lfs}/bin/git-lfs clean -- %f"; - smudge = "${pkgs.git-lfs}/bin/git-lfs smudge --skip -- %f"; - required = true; - }; - "url \"git@github.com:\"".insteadOf = "git://github.com/"; - }; + [http] + cookiefile = /home/vincent/.gitcookies - includes = [ - { - path = "${config.xdg.configHome}/git/config.d/redhat.gitconfig"; - condition = "gitdir:${config.home.homeDirectory}/src/github.com/kubernetes/"; - } - { - path = "${config.xdg.configHome}/git/config.d/redhat.gitconfig"; - condition = "gitdir:${config.home.homeDirectory}/src/k8s.io/"; - } - { - path = "${config.xdg.configHome}/git/config.d/redhat.gitconfig"; - condition = "gitdir:${config.home.homeDirectory}/src/github.com/knative/"; - } - { - path = "${config.xdg.configHome}/git/config.d/redhat.gitconfig"; - condition = "gitdir:${config.home.homeDirectory}/src/github.com/tektoncd/"; - } - { - path = "${config.xdg.configHome}/git/config.d/redhat.gitconfig"; - condition = "gitdir/i:${config.home.homeDirectory}/src/github.com/google**"; - } - { - path = "${config.xdg.configHome}/git/config.d/redhat.gitconfig"; - condition = "gitdir:${config.home.homeDirectory}/src/k8s.io/"; - } - { - path = "${config.xdg.configHome}/git/config.d/redhat.gitconfig"; - condition = "gitdir:${config.home.homeDirectory}/src/github.com/minishift/"; - } - { - path = "${config.xdg.configHome}/git/config.d/redhat.gitconfig"; - condition = "gitdir:${config.home.homeDirectory}/src/github.com/operator-framework/"; - } - { - path = "${config.xdg.configHome}/git/config.d/redhat.gitconfig"; - condition = "gitdir:${config.home.homeDirectory}/src/github.com/openshift**"; - } - { - path = "${config.xdg.configHome}/git/config.d/redhat.gitconfig"; - condition = "gitdir:${config.home.homeDirectory}/src/github.com/redhat**"; - } - { - path = "${config.xdg.configHome}/git/config.d/redhat.gitconfig"; - condition = "gitdir:${config.home.homeDirectory}/src/github.com/containers/"; - } - { - path = "${config.xdg.configHome}/git/config.d/redhat.gitconfig"; - condition = "gitdir:${config.home.homeDirectory}/src/gitlab.cee.redhat.com/"; - } - { - path = "${config.xdg.configHome}/git/config.d/redhat.gitconfig"; - condition = "gitdir:${config.home.homeDirectory}/src/gitlab.corp.redhat.com/"; - } - { - path = "${config.xdg.configHome}/git/config.d/redhat.gitconfig"; - condition = "gitdir:${config.home.homeDirectory}/src/pkg.devel.redhat.com/"; - } - ]; - ignores = [ - "*.elc" - "*.vo" - "*.aux" - "*.v.d" - "*.o" - "*.a" - "*.la" - "*.so" - "*.dylib" - "*.pyc" - "*.pyo" - ".idea" - "*.iml" - "*~" - "#*#" - ".makefile" - ".clean" - ]; - }; - xdg.configFile."git/config.d/redhat.gitconfig".source = ./assets/git/redhat.gitconfig; - xdg.configFile."nr/git" = { - text = builtins.toJSON [ - { cmd = "tig"; } - { cmd = "grv"; pkg = "gitAndTools.grv"; } - { cmd = "git-appraise"; pkg = "gitAndTools.git-appraise"; chan = "unstable"; } - ]; - onChange = "${pkgs.my.nr}/bin/nr git"; - }; - } - ( - mkIf config.profiles.fish.enable { - programs.fish.shellAbbrs = { - gs = "git status"; - gb = "git b"; - gfr = "git fetch -p --all;and git rebase -S --autostash"; - }; - } - ) - ]); + [url "git@github.com:"] + pushInsteadOf = git://github.com/ + ''; + }; + }; } diff --git a/modules/profiles/git.nixos.nix b/modules/profiles/git.nixos.nix @@ -1,74 +0,0 @@ -{ config, lib, pkgs, ... }: - -with lib; -let - cfg = config.profiles.git; -in -{ - options = { - profiles.git = { - enable = mkOption { - default = false; - description = "Enable git profile"; - type = types.bool; - }; - }; - }; - config = mkIf cfg.enable { - environment.systemPackages = with pkgs; [ - gitAndTools.gitFull - gitAndTools.git-annex - gitAndTools.git-extras - ]; - environment.etc."gitconfig" = rec { - text = '' - [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 = ~/.gitignore.global - [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/modules/profiles/gpg.nix b/modules/profiles/gpg.nix @@ -1,35 +0,0 @@ -{ config, lib, pkgs, ... }: - -with lib; -let - cfg = config.profiles.gpg; -in -{ - options = { - profiles.gpg = { - enable = mkOption { - default = true; - description = "Enable gpg profile and configuration"; - type = types.bool; - }; - pinentry = mkOption { - default = "${pkgs.pinentry}/bin/pinentry"; - description = "Path to pinentry"; - type = types.str; - }; - }; - }; - config = mkIf cfg.enable { - home.packages = with pkgs; [ gnupg ]; - services = { - gpg-agent = { - enable = true; - enableSshSupport = true; - defaultCacheTtlSsh = 7200; - extraConfig = '' - pinentry-program ${cfg.pinentry} - ''; - }; - }; - }; -} diff --git a/modules/profiles/home.nixos.nix b/modules/profiles/home.nix diff --git a/modules/profiles/i18n.nixos.nix b/modules/profiles/i18n.nix diff --git a/modules/profiles/i3.nix b/modules/profiles/i3.nix @@ -1,363 +0,0 @@ -{ config, lib, pkgs, ... }: - -with lib; -let - cfg = config.profiles.i3; - powermenu = pkgs.writeScript "powermenu.sh" '' - #!${pkgs.stdenv.shell} - MENU="$(${pkgs.rofi}/bin/rofi -sep "|" -dmenu -i -p 'System' -location 3 -xoffset -10 -yoffset 32 -width 20 -hide-scrollbar -line-padding 4 -padding 20 -lines 5 <<< "Suspend|Hibernate|Reboot|Shutdown")" - case "$MENU" in - *Suspend) systemctl suspend;; - *Hibernate) systemctl hibernate;; - *Reboot) systemctl reboot ;; - *Shutdown) systemctl -i poweroff - esac - ''; -in -{ - options = { - profiles.i3 = { - enable = mkEnableOption "Enable i3 profile"; - lockCmd = mkOption { - default = "${pkgs.i3lock-color}/bin/i3lock-color -c 666666"; - description = "Lock command to use"; - type = types.str; - }; - }; - }; - config = mkIf cfg.enable { - home.packages = with pkgs; [ - alacritty - arandr - i3lock-color - libnotify - maim - slop - ]; - programs.rofi.enable = true; - services = { - dunst = { - enable = true; - settings = { - global = { - geometry = "500x5-10+10"; - follow = "keyboard"; - frame_color = "#cccccc"; - font = "Fira Code 10"; - indicate_hidden = "yes"; - separator_height = 1; - padding = 8; - horizontal_padding = 8; - frame_width = 2; - sort = "yes"; - markup = "full"; - format = "<b>%s</b>\n%b"; - ignore_newline = "no"; - stack_duplicates = true; - show_indicators = "yes"; - }; - }; - }; - udiskie.enable = true; - network-manager-applet.enable = true; - screen-locker = { - enable = true; - lockCmd = cfg.lockCmd; - inactiveInterval = 60; - }; - random-background = { - enable = true; - imageDirectory = "${config.home.homeDirectory}/desktop/pictures/walls"; - interval = "5h"; - }; - }; - xdg.configFile."alacritty/alacritty.yml".source = ./assets/xorg/alacritty.yml; - xsession.windowManager.i3 = { - package = pkgs.i3-gaps; - enable = true; - config = { - fonts = [ "Fira Code 10" ]; - focus = { - followMouse = false; - }; - window = { - titlebar = false; - border = 1; - hideEdgeBorders = "both"; - }; - keybindings = { - "Mod4+Return" = "exec alacritty"; - }; - gaps = { - inner = 0; - outer = 0; - }; - keycodebindings = { - "Mod4+Shift+24" = "kill"; - "Mod4+33" = "exec \"${pkgs.rofi}/bin/rofi -show run -modi 'run,window' -kb-row-select 'Tab' -kb-row-tab '' -location 2 -hide-scrollbar -separator-style solid -font 'Ubuntu Mono 14'"; - # focus window - "Mod4+44" = "focus left"; - "Mod4+45" = "focus down"; - "Mod4+46" = "focus up"; - "Mod4+47" = "focus right"; - "Mod4+38" = "focus parent"; - # move focused window - "Mod4+Shift+44" = "move left"; - "Mod4+Shift+45" = "move down"; - "Mod4+Shift+46" = "move up"; - "Mod4+Shift+47" = "move right"; - # resize - "Mod4+Control+44" = "resize shrink width 5px or 5ppt"; - "Mod4+Control+45" = "resize grow width 5px or 5ppt"; - "Mod4+Control+46" = "resize shrink height 5px or 5ppt"; - "Mod4+Control+47" = "resize grow height 5px or 5ppt"; - # gaps - "Mod4+Mod1+44" = "gaps inner current plus 5"; - "Mod4+Mod1+45" = "gaps inner current minus 5"; - "Mod4+Mod1+46" = "gaps outer current plus 5"; - "Mod4+Mod1+47" = "gaps outer current minus 5"; - # Split - "Mod4+43" = "split h"; - "Mod4+55" = "split v"; - # Fullscreen - "Mod4+41" = "fullscreen toggle"; - # Change container layout - "Mod4+39" = "layout stacking"; - "Mod4+25" = "layout tabbed"; - "Mod4+26" = "layout toggle split"; - # Manage floating - "Mod4+Shift+61" = "floating toggle"; - "Mod4+61" = "focus mode_toggle"; - # manage workspace - "Mod4+113" = "workspace prev_on_output"; - "Mod4+114" = "workspace next_on_output"; - # manage output - "Mod4+Shift+113" = "focus output left"; - "Mod4+Shift+116" = "focus output down"; - "Mod4+Shift+111" = "focus output up"; - "Mod4+Shift+114" = "focus output right"; - # Custom keybinding - "Mod4+Shift+32" = "exec ${cfg.lockCmd}"; - "Mod4+Shift+39" = "exec ~/.screenlayout/home-work.sh && systemctl --user start random-background.service"; - "Mod4+24" = "border toggle"; - }; - modes = { }; - bars = [ - { - mode = "hide"; - position = "bottom"; - trayOutput = "primary"; - statusCommand = "${pkgs.i3status}/bin/i3status"; - fonts = [ "Fira Code 12" ]; - } - ]; - }; - extraConfig = '' - set $mod Mod4 - - # Use Mouse+$mod to drag floating windows to their wanted position - floating_modifier $mod - - set $WS0 0 - set $WS1 1 - set $WS2 2 - set $WS3 3 - set $WS4 4 - set $WS5 5 - set $WS6 6 - set $WS7 7 - set $WS8 8 - set $WS9 9 - - # switch to workspace - bindcode $mod+10 workspace $WS1 - bindcode $mod+11 workspace $WS2 - bindcode $mod+12 workspace $WS3 - bindcode $mod+13 workspace $WS4 - bindcode $mod+14 workspace $WS5 - bindcode $mod+15 workspace $WS6 - bindcode $mod+16 workspace $WS7 - bindcode $mod+17 workspace $WS8 - bindcode $mod+18 workspace $WS9 - bindcode $mod+19 workspace $WS0 - - # move focused container to workspace - bindcode $mod+Shift+10 move container to workspace $WS1 - bindcode $mod+Shift+11 move container to workspace $WS2 - bindcode $mod+Shift+12 move container to workspace $WS3 - bindcode $mod+Shift+13 move container to workspace $WS4 - bindcode $mod+Shift+14 move container to workspace $WS5 - bindcode $mod+Shift+15 move container to workspace $WS6 - bindcode $mod+Shift+16 move container to workspace $WS7 - bindcode $mod+Shift+17 move container to workspace $WS8 - bindcode $mod+Shift+18 move container to workspace $WS9 - bindcode $mod+Shift+19 move container to workspace $WS0 - - assign [class="Firefox" window_role="browser"] → $WS1 - assign [class="Google-chrome" window_role="browser"] → $WS1 - - ## quick terminal (tmux) - exec --no-startup-id alacritty --title metask --class metask --command tmux - for_window [instance="metask"] floating enable; - for_window [instance="metask"] move scratchpad; [instance="metask"] scratchpad show; move position center; move scratchpad - bindcode $mod+49 [instance="metask"] scratchpad show - - for_window [title="capture"] floating enable; - - bindsym XF86MonBrightnessUp exec "xbacklight -inc 10" - bindsym XF86MonBrightnessDown exec "xbacklight -dec 10" - bindsym shift+XF86MonBrightnessUp exec "xbacklight -inc 1" - bindsym shift+XF86MonBrightnessDown exec "xbacklight -dec 1" - bindsym XF86AudioLowerVolume exec "pactl set-sink-mute @DEFAULT_SINK@ false ; pactl set-sink-volume @DEFAULT_SINK@ -5%" - bindsym XF86AudioRaiseVolume exec "pactl set-sink-mute @DEFAULT_SINK@ false ; pactl set-sink-volume @DEFAULT_SINK@ +5%" - bindsym XF86AudioMute exec "pactl set-sink-mute @DEFAULT_SINK@ toggle" - bindsym XF86AudioMicMute exec "pactl set-source-mute @DEFAULT_SOURCE@ toggle" - bindsym XF86AudioPlay exec "playerctl play-pause" - bindsym XF86AudioNext exec "playerctl next" - bindsym XF86AudioPrev exec "playerctl previous" - - # reload the configuration file - bindsym $mod+Shift+x reload - # restart i3 inplace (preserves your layout/session, can be used to upgrade i3) - bindsym $mod+Shift+o restart - # exit i3 (logs you out of your X session) - bindsym $mod+Shift+p exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3?' -b 'Yes, exit i3' 'i3-msg exit'" - # powermenu - bindsym $mod+F12 exec ${powermenu} - - # screen management - bindsym $mod+F11 exec "autorandr -c on-the-move" - bindsym $mod+Shift+F11 exec "arandr" - bindsym $mod+Control+F11 exec "autorandr -c home1" - - # move workspace to output - set $workspace_move Move workspace to output : [l]eft [r]ight [d]own [u]p - - mode "$workspace_move" { - bindsym left move workspace to output left - bindsym l move workspace to output left - - bindsym right move workspace to output right - bindsym r move workspace to output right - - bindsym down move workspace to output down - bindsym d move workspace to output down - - bindsym up move workspace to output up - bindsym u move workspace to output up - - bindsym Escape mode "default" - bindsym Return mode "default" - } - - bindsym $mod+m mode "$workspace_move" - - # resize window (you can also use the mouse for that) - mode "resize" { - # These bindings trigger as soon as you enter the resize mode - - # Pressing left will shrink the window’s width. - # Pressing right will grow the window’s width. - # Pressing up will shrink the window’s height. - # Pressing down will grow the window’s height. - bindsym t resize shrink width 10 px or 10 ppt - bindsym s resize grow height 10 px or 10 ppt - bindsym r resize shrink height 10 px or 10 ppt - bindsym n resize grow width 10 px or 10 ppt - - # same bindings, but for the arrow keys - bindsym Left resize shrink width 10 px or 10 ppt - bindsym Down resize grow height 10 px or 10 ppt - bindsym Up resize shrink height 10 px or 10 ppt - bindsym Right resize grow width 10 px or 10 ppt - - # back to normal: Enter or Escape - bindsym Return mode "default" - bindsym Escape mode "default" - } - - bindsym $mod+o mode "resize" - ''; - }; - xdg.configFile."i3status/config".text = '' - # i3status configuration file. - # see "man i3status" for documentation. - - # It is important that this file is edited as UTF-8. - # The following line should contain a sharp s: - # ß - # If the above line is not correctly displayed, fix your editor first! - - general { - colors = true - interval = 2 - } - - #order += "disk /" - #order += "run_watch 🐳" - order += "path_exists 🔑" - #order += "wireless _first_" - #order += "ethernet _first_" - #order += "volume master" - order += "battery 0" - order += "cpu_temperature 0" - order += "load" - order += "tztime local" - - wireless _first_ { - format_up = "W: (%quality at %essid) %ip" - format_down = "W: down" - } - - ethernet _first_ { - # if you use %speed, i3status requires root privileges - format_up = "E: %ip (%speed)" - format_down = "E: down" - } - - battery 0 { - format = "%status %percentage %remaining" - format_down = "No battery" - status_chr = "⚇" - status_bat = "⚡" - status_full = "☻" - status_unk = "?" - path = "/sys/class/power_supply/BAT%d/uevent" - low_threshold = 10 - } - - run_watch 🐳 { - pidfile = "/run/docker.pid" - } - - path_exists 🔑 { - path = "/proc/sys/net/ipv4/conf/wg0" - } - - tztime local { - format = "%Y-%m-%d %H:%M:%S" - } - - load { - format = "%1min" - } - - cpu_temperature 0 { - format = "T: %degrees °C" - path = "/sys/class/hwmon/hwmon0/temp1_input" - } - - disk "/" { - format = "%avail" - } - - volume master { - format = "♪: %volume" - format_muted = "♪: muted (%volume)" - device = "default" - mixer = "Master" - mixer_idx = 0 - } - ''; - }; -} diff --git a/modules/profiles/ipfs.nixos.nix b/modules/profiles/ipfs.nix diff --git a/modules/profiles/kubernetes.nix b/modules/profiles/kubernetes.nix @@ -1,86 +0,0 @@ -{ config, lib, pkgs, ... }: - -with lib; -let - cfg = config.profiles.containers.kubernetes; -in -{ - options = { - profiles.containers.kubernetes = { - enable = mkEnableOption "Enable kubernetes profile"; - containers = mkOption { - default = true; - description = "Enable containers profile alongside"; - type = types.bool; - }; - nr = mkEnableOption "Enable nr aliasing"; - krew = mkEnableOption "Enable krew"; - kind = mkEnableOption "Enable kind"; - minikube = { - enable = mkEnableOption "Enable minikube"; - package = mkOption { - default = pkgs.minikube; - description = "Minikube package"; - type = types.package; - }; - }; - }; - }; - config = mkIf cfg.enable (mkMerge [ - { - home.file.".local/share/applications/chos4.desktop".source = ../../users/vincent/containers/chos4.desktop; - profiles.containers.enable = cfg.containers; - home.packages = with pkgs; [ - #cri-tools - kubectl - kail - kustomize - kube-prompt - kubectx - my.ko - my.kss - my.kubernix - ]; - } - ( - mkIf cfg.nr { - xdg.configFile."nr/kubernetes" = { - text = builtins.toJSON [ - { cmd = "kubectl"; } - ]; - onChange = "${pkgs.my.nr}/bin/nr -force kubernetes"; - }; - } - ) - ( - mkIf cfg.krew { - home.packages = with pkgs; [ my.krew ]; - } - ) - ( - mkIf config.profiles.zsh.enable { - home.file."${config.programs.zsh.dotDir}/functions/_kubectl".source = ./assets/zsh/_kubectl; - } - ) - ( - mkIf cfg.minikube.enable { - home.packages = with pkgs; [ - cfg.minikube.package - docker-machine-kvm2 - ]; - } - ) - ( - mkIf cfg.kind { - home.packages = with pkgs; [ - kind - ]; - } - ) - ( - mkIf (!config.profiles.containers.openshift.enable) { - home.packages = with pkgs; [ kubectl ]; - } - ) - ]); -} diff --git a/modules/profiles/laptop.nix b/modules/profiles/laptop.nix @@ -1,4 +1,4 @@ -{ config, lib, ... }: +{ config, lib, pkgs, ... }: with lib; let @@ -7,13 +7,26 @@ in { options = { profiles.laptop = { - enable = mkEnableOption "Enable laptop profile"; + enable = mkOption { + default = false; + description = "Enable laptop profile"; + type = types.bool; + }; }; }; config = mkIf cfg.enable { - profiles.desktop.enable = true; - programs.autorandr = { - enable = true; + boot.kernel.sysctl = { + "vm.swappiness" = 10; + "vm.dirty_ratio" = 25; + "vm.dirty_background_ratio" = 10; + "vm.dirty_writeback_centisecs" = 5000; + "vm.dirty_expire_centisecs" = 5000; }; + profiles.desktop.enable = true; + environment.systemPackages = with pkgs; [ + lm_sensors + powertop + acpi + ]; }; } diff --git a/modules/profiles/laptop.nixos.nix b/modules/profiles/laptop.nixos.nix @@ -1,32 +0,0 @@ -{ config, lib, pkgs, ... }: - -with lib; -let - cfg = config.profiles.laptop; -in -{ - options = { - profiles.laptop = { - enable = mkOption { - default = false; - description = "Enable laptop profile"; - type = types.bool; - }; - }; - }; - config = mkIf cfg.enable { - boot.kernel.sysctl = { - "vm.swappiness" = 10; - "vm.dirty_ratio" = 25; - "vm.dirty_background_ratio" = 10; - "vm.dirty_writeback_centisecs" = 5000; - "vm.dirty_expire_centisecs" = 5000; - }; - profiles.desktop.enable = true; - environment.systemPackages = with pkgs; [ - lm_sensors - powertop - acpi - ]; - }; -} diff --git a/modules/profiles/mail.nixos.nix b/modules/profiles/mail.nix diff --git a/modules/profiles/mails.nix b/modules/profiles/mails.nix @@ -1,215 +0,0 @@ -# Generated from an org file 💃 -# See : https://sbr.pm/technical/configurations/mails.html -{ config, lib, pkgs, ... }: - -with lib; -let - cfg = config.profiles.mails; -in -{ - - options = { - profiles.mails = { - enable = mkEnableOption "Enable mails configuration"; - sync = mkEnableOption "Enable sync mail service"; - frequency = mkOption { - default = "*:0/30"; - description = "Frequency at which the mail should be checked"; - type = types.str; - }; - }; - }; - - config = - mkIf - cfg.enable - ( - mkMerge [ - { - - accounts.email = { - maildirBasePath = "desktop/mails"; - accounts = { - "redhat" = { - address = "vdemeest@redhat.com"; - userName = "vdemeest@redhat.com"; - realName = "Vincent Demeester"; - passwordCommand = "${pkgs.gnupg}/bin/gpg -q --for-your-eyes-only --no-tty --exit-on-status-write-error --batch --passphrase-file ${config.home.homeDirectory}/sync/rh.pass -d ${config.home.homeDirectory}/desktop/documents/rh.pass.gpg"; - imap.host = "imap.gmail.com"; - smtp.host = "smtp.gmail.com"; - mbsync = { - enable = true; - create = "both"; - expunge = "both"; - patterns = [ "*" "![Gmail]*" "[Gmail]/Sent Mail" "[Gmail]/Starred" "[Gmail]/All Mail" ]; - extraConfig = { - channel = { - Sync = "All"; - }; - account = { - Timeout = 120; - PipelineDepth = 1; - }; - }; - }; - notmuch.enable = cfg.sync; - astroid.enable = cfg.sync; - msmtp.enable = true; - }; - "perso" = { - address = "vinc.demeester@gmail.com"; - userName = "vinc.demeester@gmail.com"; - realName = "Vincent Demeester"; - passwordCommand = "${pkgs.gnupg}/bin/gpg -q --for-your-eyes-only --no-tty --exit-on-status-write-error --batch --passphrase-file ${config.home.homeDirectory}/sync/perso.pass -d ${config.home.homeDirectory}/desktop/documents/perso.pass.gpg"; - imap.host = "imap.gmail.com"; - smtp.host = "smtp.gmail.com"; - mbsync = { - enable = true; - create = "both"; - expunge = "both"; - patterns = [ "*" "![Gmail]*" "[Gmail]/Sent Mail" "[Gmail]/Starred" "[Gmail]/All Mail" ]; - extraConfig = { - channel = { - Sync = "All"; - }; - account = { - Timeout = 120; - PipelineDepth = 1; - }; - }; - }; - notmuch.enable = cfg.sync; - astroid.enable = cfg.sync; - msmtp.enable = true; - }; - "prv" = { - primary = true; - address = "vincent@demeester.fr"; - userName = "vincent@demeester.fr"; - realName = "Vincent Demeester"; - passwordCommand = "${pkgs.gnupg}/bin/gpg -q --for-your-eyes-only --no-tty --exit-on-status-write-error --batch --passphrase-file ${config.home.homeDirectory}/sync/prv.pass -d ${config.home.homeDirectory}/desktop/documents/prv.pass.gpg"; - imap.host = "mail.gandi.net"; - smtp.host = "mail.gandi.net"; - mbsync = { - enable = true; - create = "both"; - expunge = "both"; - patterns = [ "*" ]; - extraConfig = { - channel = { - Sync = "All"; - }; - account = { - Timeout = 120; - PipelineDepth = 1; - }; - }; - }; - notmuch.enable = cfg.sync; - astroid.enable = cfg.sync; - msmtp.enable = true; - }; - }; - }; - - home.file."bin/msmtp" = { - text = '' - #!${pkgs.stdenv.shell} - ${pkgs.libnotify}/bin/notify-send "Sending mail ✉️" - ${pkgs.msmtp}/bin/msmtp --read-envelope-from $@ - ''; - executable = true; - }; - - programs.msmtp.enable = true; - - } - - ( - mkIf cfg.sync { - - services.mbsync = { - enable = true; - preExec = "${config.xdg.configHome}/mbsync/preExec"; - postExec = "${config.xdg.configHome}/mbsync/postExec"; - frequency = cfg.frequency; - }; - - xdg.configFile."mbsync/preExec" = { - text = '' - #!${pkgs.stdenv.shell} - - export NOTMUCH_CONFIG=${config.xdg.configHome}/notmuch/notmuchrc - export NMBGIT=${config.xdg.dataHome}/notmuch/nmbug - - ${pkgs.coreutils}/bin/mkdir -p ${config.home.homeDirectory}/desktop/mails/redhat ${config.home.homeDirectory}/desktop/mails/perso - ${pkgs.afew}/bin/afew -C ${config.xdg.configHome}/notmuch/notmuchrc -m -v - ''; - executable = true; - }; - - xdg.configFile."mbsync/postExec" = { - text = '' - #!${pkgs.stdenv.shell} - - export NOTMUCH_CONFIG=${config.xdg.configHome}/notmuch/notmuchrc - export NMBGIT=${config.xdg.dataHome}/notmuch/nmbug - - ${pkgs.notmuch}/bin/notmuch new - ${pkgs.afew}/bin/afew -C ${config.xdg.configHome}/notmuch/notmuchrc --tag --new -v - # Remove inbox (lower-case) - ${pkgs.notmuch}/bin/notmuch tag -inbox -- tag:inbox - # Remove Inbox tagged message that are not in an Inbox - ${pkgs.notmuch}/bin/notmuch tag -Inbox -- not folder:redhat/Inbox and not folder:perso/Inbox and tag:Inbox - ${pkgs.libnotify}/bin/notify-send "Mails synced 📬" - ''; - executable = true; - }; - - home.file."bin/msync" = { - text = '' - #!${pkgs.stdenv.shell} - ${pkgs.libnotify}/bin/notify-send "Syncing mails 📫️" - systemctl --user start mbsync - ''; - executable = true; - }; - - programs.mbsync.enable = true; - programs.notmuch.enable = true; - - programs.afew = { - enable = true; - extraConfig = '' - [SpamFilter] - [KillThreadsFilter] - [ListMailsFilter] - [ArchiveSentMailsFilter] - [FolderNameFilter] - maildir_separator = / - - [MailMover] - folders = perso/Inbox redhat/Inbox - rename = true - - perso/Inbox = 'NOT tag:Inbox':"perso/[Gmail]/All Mail" - redhat/Inbox = 'NOT tag:Inbox':"redhat/[Gmail]/All Mail" - ''; - }; - - programs.astroid = { - enable = true; - externalEditor = "emacsclient -c"; - extraConfig = { - startup.queries.inbox = "tag:Inbox"; - startup.queries.inbox_perso = "folder:perso/Inbox"; - startup.queries.inbox_redhat = "folder:redhat/Inbox"; - }; - }; - - } - ) - - ] - ); -} diff --git a/modules/profiles/media.nix b/modules/profiles/media.nix @@ -1,23 +0,0 @@ -{ config, lib, pkgs, ... }: - -with lib; -let - cfg = config.profiles.media; -in -{ - options = { - profiles.media = { - enable = mkEnableOption "Enable media configuration"; - }; - }; - config = mkIf cfg.enable (mkMerge [ - { - home.packages = with pkgs; [ youtube-dl ]; - } - ( - mkIf config.profiles.desktop.enable { - home.packages = with pkgs; [ spotify ]; - } - ) - ]); -} diff --git a/modules/profiles/nix-auto-update.nixos.nix b/modules/profiles/nix-auto-update.nix diff --git a/modules/profiles/nix-config.nixos.nix b/modules/profiles/nix-config.nix diff --git a/modules/profiles/openshift.nix b/modules/profiles/openshift.nix @@ -1,53 +0,0 @@ -{ config, lib, pkgs, ... }: - -with lib; -let - cfg = config.profiles.containers.openshift; -in -{ - options = { - profiles.containers.openshift = { - enable = mkEnableOption "Enable openshift profile"; - package = mkOption { - default = pkgs.my.oc; - description = "Openshift package"; - type = types.package; - }; - minishift = { - enable = mkEnableOption "Enable minishift"; - package = mkOption { - default = pkgs.minishift; - description = "Minishift package"; - type = types.package; - }; - }; - crc = mkEnableOption "Enable crc"; - }; - }; - config = mkIf cfg.enable (mkMerge [ - { - profiles.containers.kubernetes.enable = true; - home.packages = with pkgs; [ - cfg.package - #my.openshift-install - my.operator-sdk - ]; - } - ( - mkIf cfg.minishift.enable { - home.packages = with pkgs; [ - cfg.minishift.package - docker-machine-kvm - docker-machine-kvm2 - ]; - } - ) - ( - mkIf cfg.crc { - home.packages = with pkgs; [ - my.crc - ]; - } - ) - ]); -} diff --git a/modules/profiles/printing.nixos.nix b/modules/profiles/printing.nix diff --git a/modules/profiles/pulseaudio.nixos.nix b/modules/profiles/pulseaudio.nix diff --git a/modules/profiles/qemu.nixos.nix b/modules/profiles/qemu.nix diff --git a/modules/profiles/scanning.nixos.nix b/modules/profiles/scanning.nix diff --git a/modules/profiles/ssh.nix b/modules/profiles/ssh.nix @@ -3,64 +3,33 @@ with lib; let cfg = config.profiles.ssh; - patchedOpenSSH = pkgs.openssh.override { withKerberos = true; withGssapiPatches = true; }; in { options = { profiles.ssh = { enable = mkOption { - default = true; - description = "Enable ssh profile and configuration"; + default = false; + description = "Enable ssh profile"; type = types.bool; }; - machines = mkOption { - default = { }; - type = types.attrs; + forwardX11 = mkOption { + type = types.bool; + default = false; + description = '' + Whether to allow X11 connections to be forwarded. + ''; }; }; }; config = mkIf cfg.enable { - home.packages = [ - patchedOpenSSH - ]; - home.file.".ssh/sockets/.placeholder".text = ''''; - xdg.configFile.".ssh/.placeholder".text = ''''; - programs.ssh = { - enable = true; - - serverAliveInterval = 60; - hashKnownHosts = true; - userKnownHostsFile = "${config.xdg.configHome}/ssh/known_hosts"; - controlPath = "${config.home.homeDirectory}/.ssh/sockets/%u-%l-%r@%h:%p"; - matchBlocks = { - "github.com" = { - hostname = "github.com"; - user = "git"; - extraOptions = { - controlMaster = "auto"; - controlPersist = "360"; - }; - }; - "gitlab.com" = { - hostname = "gitlab.com"; - user = "git"; - extraOptions = { - controlMaster = "auto"; - controlPersist = "360"; - }; - }; - "*.redhat.com" = { - user = "vdemeest"; - }; - "192.168.1.*" = { - forwardAgent = true; - }; - } // cfg.machines; - extraConfig = '' - PreferredAuthentications gssapi-with-mic,publickey,password - GSSAPIAuthentication yes - GSSAPIDelegateCredentials yes - ''; + services = { + openssh = { + enable = true; + startWhenNeeded = false; + forwardX11 = cfg.forwardX11; + }; + sshguard.enable = true; }; + programs.mosh.enable = true; }; } diff --git a/modules/profiles/ssh.nixos.nix b/modules/profiles/ssh.nixos.nix @@ -1,35 +0,0 @@ -{ config, lib, pkgs, ... }: - -with lib; -let - cfg = config.profiles.ssh; -in -{ - options = { - profiles.ssh = { - enable = mkOption { - default = false; - description = "Enable ssh profile"; - type = types.bool; - }; - forwardX11 = mkOption { - type = types.bool; - default = false; - description = '' - Whether to allow X11 connections to be forwarded. - ''; - }; - }; - }; - config = mkIf cfg.enable { - services = { - openssh = { - enable = true; - startWhenNeeded = false; - forwardX11 = cfg.forwardX11; - }; - sshguard.enable = true; - }; - programs.mosh.enable = true; - }; -} diff --git a/modules/profiles/syncthing.nixos.nix b/modules/profiles/syncthing.nix diff --git a/modules/profiles/tmux.nix b/modules/profiles/tmux.nix @@ -1,28 +0,0 @@ -{ config, lib, pkgs, ... }: - -with lib; -let - cfg = config.profiles.tmux; -in -{ - options = { - profiles.tmux = { - enable = mkOption { - default = true; - description = "Enable tmux profile and configuration"; - type = types.bool; - }; - }; - }; - config = mkIf cfg.enable { - programs.tmux = { - enable = true; - extraConfig = '' - source-file ${config.xdg.configHome}/tmux/commons/keybindings - source-file ${config.xdg.configHome}/tmux/tmux.conf - ''; - }; - xdg.configFile."tmux/tmux.conf".source = ./assets/tmux/tmux.conf; - xdg.configFile."tmux/commons/keybindings".source = ./assets/tmux/keybindings; - }; -} diff --git a/modules/profiles/users.nixos.nix b/modules/profiles/users.nix diff --git a/modules/profiles/virtualization.nixos.nix b/modules/profiles/virtualization.nix diff --git a/modules/profiles/wireguard.server.nixos.nix b/modules/profiles/wireguard.server.nix diff --git a/modules/profiles/yubikey.nixos.nix b/modules/profiles/yubikey.nix diff --git a/modules/profiles/zsh.nix b/modules/profiles/zsh.nix @@ -9,166 +9,14 @@ in profiles.zsh = { enable = mkOption { default = true; - description = "Enable zsh profile and configuration"; + description = "Enable zsh profile"; type = types.bool; }; }; }; - config = mkIf cfg.enable (mkMerge [ - { - home.packages = with pkgs; [ - zsh-syntax-highlighting - nix-zsh-completions - ]; - home.file."${config.programs.zsh.dotDir}/completion.zsh".source = ./assets/zsh/completion.zsh; - home.file."${config.programs.zsh.dotDir}/prompt.zsh".source = ./assets/zsh/prompt.zsh; - home.file."${config.programs.zsh.dotDir}/functions/j".source = ./assets/zsh/j; - programs.zsh = { - enable = true; - dotDir = ".config/zsh"; - autocd = true; - defaultKeymap = "emacs"; - enableAutosuggestions = true; - history = { - size = 100000; - expireDuplicatesFirst = true; - ignoreDups = true; - }; - localVariables = { - EMOJI_CLI_KEYBIND = "^n"; - EMOJI_CLI_USE_EMOJI = "yes"; - ZSH_HIGHLIGHT_HIGHLIGHTERS = [ "main" "brackets" "pattern" ]; - }; - shellAliases = import ./aliases.shell.nix; - plugins = [ - { - name = "emoji-cli"; - src = pkgs.fetchFromGitHub { - owner = "b4b4r07"; - repo = "emoji-cli"; - rev = "26e2d67d566bfcc741891c8e063a00e0674abc92"; - sha256 = "0n88w4k5vaz1iyikpmlzdrrkxmfn91x5s4q405k1fxargr1w6bmx"; - }; - } - { - name = "zsh-z"; - src = pkgs.fetchFromGitHub { - owner = "agkozak"; - repo = "zsh-z"; - rev = "5b903f8f5489783ee2a4af668a941b7d9a02efc9"; - sha256 = "07h6ksiqgqyf5m84hv5xf4jcqrl8q1cj8wd4z52cjmy82kk10fkn"; - }; - } - { - name = "async"; - src = pkgs.fetchFromGitHub { - owner = "mafredri"; - repo = "zsh-async"; - rev = "v1.7.0"; - sha256 = "1jbbypgn0r4pilhv2s2p11vbkkvlnf75wrhxfcvr7bfjpzyp9wbc"; - }; - } - { - name = "zsh-completions"; - src = pkgs.fetchFromGitHub { - owner = "zsh-users"; - repo = "zsh-completions"; - rev = "922eee0706acb111e9678ac62ee77801941d6df2"; - sha256 = "04skzxv8j06f1snsx62qnca5f2183w0wfs5kz78rs8hkcyd6g89w"; - }; - } - { - name = "powerlevel10k"; - src = pkgs.fetchFromGitHub { - owner = "romkatv"; - repo = "powerlevel10k"; - rev = "700910cd0421a7d25d2800cefa76eb6d80dc62a8"; - sha256 = "011ja4r3a8vbcs42js9nri4p8pi8z4ccqxl2qyf52pn3pfnidigj"; - }; - } - { - name = "zsh-nix-shell"; - src = pkgs.fetchFromGitHub { - owner = "chisui"; - repo = "zsh-nix-shell"; - rev = "v0.1.0"; - sha256 = "0snhch9hfy83d4amkyxx33izvkhbwmindy0zjjk28hih1a9l2jmx"; - }; - } - ]; - envExtra = '' - export GOPATH=${config.home.homeDirectory} - export WEBKIT_DISABLE_COMPOSITING_MODE=1; - export PATH=$HOME/bin:$PATH - if [ -d $HOME/.krew/bin ]; then - export PATH=$HOME/.krew/bin:$PATH - fi - ''; - loginExtra = '' - export GOPATH=${config.home.homeDirectory} - ''; - initExtra = '' - path+="$HOME/${config.programs.zsh.dotDir}/functions" - fpath+="$HOME/.nix-profile/share/zsh/site-functions" - fpath+="$HOME/${config.programs.zsh.dotDir}/functions" - for func ($HOME/${config.programs.zsh.dotDir}/functions) autoload -U $func/*(x:t) - autoload -Uz select-word-style; select-word-style bash - if [ -e /home/vincent/.nix-profile/etc/profile.d/nix.sh ]; then . /home/vincent/.nix-profile/etc/profile.d/nix.sh; fi - #if [ -n "$INSIDE_EMACS" ]; then - # chpwd() { print -P "\033AnSiTc %d" } - # print -P "\033AnSiTu %n" - # print -P "\033AnSiTc %d" - #fi - if [[ "$TERM" == "dumb" || "$TERM" == "emacs" ]] - then - TERM=eterm-color - unsetopt zle - unsetopt prompt_cr - unsetopt prompt_subst - unfunction precmd - unfunction preexec - PS1='$ ' - return - fi - # make sure navigation using emacs keybindings works on all non-alphanumerics - # syntax highlighting - source $HOME/${config.programs.zsh.dotDir}/plugins/zsh-nix-shell/nix-shell.plugin.zsh - source ${pkgs.zsh-syntax-highlighting}/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh - ZSH_HIGHLIGHT_PATTERNS+=('rm -rf *' 'fg=white,bold,bg=red') - ZSH_HIGHLIGHT_PATTERNS+=('rm -fR *' 'fg=white,bold,bg=red') - ZSH_HIGHLIGHT_PATTERNS+=('rm -fr *' 'fg=white,bold,bg=red') - source $HOME/${config.programs.zsh.dotDir}/completion.zsh - source $HOME/${config.programs.zsh.dotDir}/plugins/powerlevel10k/powerlevel10k.zsh-theme - source $HOME/${config.programs.zsh.dotDir}/prompt.zsh - setopt hist_ignore_space - alias -g L="|less" - alias -g EEL=' 2>&1 | less' - alias -g GB='`git rev-parse --abbrev-ref HEAD`' - alias -g GR='`git rev-parse --show-toplevel`' - (( $+commands[jq] )) && alias -g MJ="| jq -C '.'" || alias -g MJ="| ${pkgs.python3}/bin/python -mjson.tool" - ''; - profileExtra = '' - if [ -e /home/vincent/.nix-profile/etc/profile.d/nix.sh ]; then . /home/vincent/.nix-profile/etc/profile.d/nix.sh; fi - export NIX_PATH=$HOME/.nix-defexpr/channels:$NIX_PATH - ''; - }; - programs.fzf = { - enable = true; - enableZshIntegration = true; - defaultOptions = [ "--bind=ctrl-j:accept" ]; - }; - } - ( - mkIf config.profiles.emacs.enable { - /*programs.zsh.initExtra = '' - export EDITOR=et - '';*/ - } - ) - ( - mkIf config.machine.home-manager { - home.packages = with pkgs; [ hello ]; - } - ) - ]); + config = mkIf cfg.enable { + programs.zsh = { + enable = true; + }; + }; } diff --git a/modules/profiles/zsh.nixos.nix b/modules/profiles/zsh.nixos.nix @@ -1,22 +0,0 @@ -{ config, lib, pkgs, ... }: - -with lib; -let - cfg = config.profiles.zsh; -in -{ - options = { - profiles.zsh = { - enable = mkOption { - default = true; - description = "Enable zsh profile"; - type = types.bool; - }; - }; - }; - config = mkIf cfg.enable { - programs.zsh = { - enable = true; - }; - }; -} diff --git a/modules/programs/default.nix b/modules/programs/default.nix @@ -2,6 +2,6 @@ imports = [ ./crc.nix # Remove "nixos" from here - ./podman.nixos.nix + ./podman.nix ]; } diff --git a/modules/programs/podman.nix b/modules/programs/podman.nix @@ -9,19 +9,46 @@ in programs.podman = { enable = mkOption { default = false; - description = "Enable podman profile"; + description = '' + Whether to configure podman + ''; type = types.bool; }; + package = mkOption { + default = pkgs.podman; + description = "podman package to be used"; + type = types.package; + }; + runcPackage = mkOption { + default = pkgs.runc; + description = "runc package to be used"; + type = types.package; + }; + conmonPackage = mkOption { + default = pkgs.conmon; + description = "conmon package to be used"; + type = types.package; + }; + cniPackage = mkOption { + default = pkgs.cni; + description = "cni package to be used"; + type = types.package; + }; + cniPluginsPackage = mkOption { + default = pkgs.cni-plugins; + description = "cni-plugins package to be used"; + type = types.package; + }; }; }; + config = mkIf cfg.enable { - # FIXME(vdemeester) package podman and conmon in nixpkgs - home.packages = with pkgs; [ slirp4netns podman buildah ]; - xdg.configFile."containers/libpod.conf".text = '' + + environment.etc."containers/libpod.conf".text = '' image_default_transport = "docker://" - runtime_path = ["/run/current-system/sw/bin/runc"] - conmon_path = ["/run/current-system/sw/bin/conmon"] - cni_plugin_dir = ["${pkgs.cni-plugins}/bin/"] + runtime_path = ["${cfg.runcPackage}/bin/runc"] + conmon_path = ["${cfg.conmonPackage}/bin/conmon"] + cni_plugin_dir = ["${cfg.cniPluginsPackage}/bin/"] cgroup_manager = "systemd" cni_config_dir = "/etc/cni/net.d/" cni_default_network = "podman" @@ -30,19 +57,51 @@ in pause_command = "/pause" ''; - xdg.configFile."containers/registries.conf".text = '' + environment.etc."containers/registries.conf".text = '' [registries.search] registries = ['docker.io', 'registry.fedoraproject.org', 'quay.io', 'registry.access.redhat.com', 'registry.centos.org'] + [registries.insecure] registries = ['massimo.local:5000', '192.168.12.0/16'] ''; - xdg.configFile."containers/policy.json".text = '' + environment.etc."containers/policy.json".text = '' { "default": [ { "type": "insecureAcceptAnything" } ] } ''; + + environment.etc."cni/net.d/87-podman-bridge.conflist".text = '' + { + "cniVersion": "0.3.0", + "name": "podman", + "plugins": [ + { + "type": "bridge", + "bridge": "cni0", + "isGateway": true, + "ipMasq": true, + "ipam": { + "type": "host-local", + "subnet": "10.88.0.0/16", + "routes": [ + { "dst": "0.0.0.0/0" } + ] + } + }, + { + "type": "portmap", + "capabilities": { + "portMappings": true + } + } + ] + } + ''; + + environment.systemPackages = with pkgs; [ cfg.package cfg.conmonPackage cfg.runcPackage iptables ]; + }; } diff --git a/modules/programs/podman.nixos.nix b/modules/programs/podman.nixos.nix @@ -1,107 +0,0 @@ -{ config, lib, pkgs, ... }: - -with lib; -let - cfg = config.programs.podman; -in -{ - options = { - programs.podman = { - enable = mkOption { - default = false; - description = '' - Whether to configure podman - ''; - type = types.bool; - }; - package = mkOption { - default = pkgs.podman; - description = "podman package to be used"; - type = types.package; - }; - runcPackage = mkOption { - default = pkgs.runc; - description = "runc package to be used"; - type = types.package; - }; - conmonPackage = mkOption { - default = pkgs.conmon; - description = "conmon package to be used"; - type = types.package; - }; - cniPackage = mkOption { - default = pkgs.cni; - description = "cni package to be used"; - type = types.package; - }; - cniPluginsPackage = mkOption { - default = pkgs.cni-plugins; - description = "cni-plugins package to be used"; - type = types.package; - }; - }; - }; - - config = mkIf cfg.enable { - - environment.etc."containers/libpod.conf".text = '' - image_default_transport = "docker://" - runtime_path = ["${cfg.runcPackage}/bin/runc"] - conmon_path = ["${cfg.conmonPackage}/bin/conmon"] - cni_plugin_dir = ["${cfg.cniPluginsPackage}/bin/"] - cgroup_manager = "systemd" - cni_config_dir = "/etc/cni/net.d/" - cni_default_network = "podman" - # pause - pause_image = "k8s.gcr.io/pause:3.1" - pause_command = "/pause" - ''; - - environment.etc."containers/registries.conf".text = '' - [registries.search] - registries = ['docker.io', 'registry.fedoraproject.org', 'quay.io', 'registry.access.redhat.com', 'registry.centos.org'] - - [registries.insecure] - registries = ['massimo.local:5000', '192.168.12.0/16'] - ''; - - environment.etc."containers/policy.json".text = '' - { - "default": [ - { "type": "insecureAcceptAnything" } - ] - } - ''; - - environment.etc."cni/net.d/87-podman-bridge.conflist".text = '' - { - "cniVersion": "0.3.0", - "name": "podman", - "plugins": [ - { - "type": "bridge", - "bridge": "cni0", - "isGateway": true, - "ipMasq": true, - "ipam": { - "type": "host-local", - "subnet": "10.88.0.0/16", - "routes": [ - { "dst": "0.0.0.0/0" } - ] - } - }, - { - "type": "portmap", - "capabilities": { - "portMappings": true - } - } - ] - } - ''; - - environment.systemPackages = with pkgs; [ cfg.package cfg.conmonPackage cfg.runcPackage iptables ]; - - }; -} diff --git a/modules/services/athens.nixos.nix b/modules/services/athens.nix diff --git a/modules/services/default.nix b/modules/services/default.nix @@ -1,7 +1,7 @@ { imports = [ - ./govanityurl.nixos.nix - ./nix-binary-cache.nixos.nix - ./wireguard.client.nixos.nix + ./govanityurl.nix + ./nix-binary-cache.nix + ./wireguard.client.nix ]; } diff --git a/modules/services/emacs-server.nix b/modules/services/emacs-server.nix @@ -1,55 +0,0 @@ -{ config, lib, pkgs, ... }: -with lib; -let - cfg = config.services.emacs-server; -in -{ - options.services.emacs-server = { - enable = mkEnableOption "the Emacs daemon"; - name = mkOption { - type = types.str; - description = "Name of the emacs server"; - default = "default"; - }; - package = mkOption { - type = types.package; - description = "The Emacs package to use for running the daemon."; - }; - shell = mkOption { - type = types.str; - description = "The shell used for starting Emacs."; - }; - extraOptions = mkOption { - type = types.separatedString " "; - default = ""; - description = - '' - The extra command-line options to pass to - <command>emacs</command> daemon. - ''; - }; - }; - - config = mkIf cfg.enable { - systemd.user.services.emacs = { - Unit = { - Description = "Emacs: the extensible, self-documenting text editor"; - Documentation = - "info:emacs man:emacs(1) https://gnu.org/software/emacs/"; - - # Avoid killing the Emacs session, which may be full of - # unsaved buffers. - X-RestartIfChanged = false; - }; - - Service = { - ExecStart = - "${cfg.shell} 'exec ${cfg.package}/bin/emacs --fg-daemon=${cfg.name} ${cfg.extraOptions}'"; - ExecStop = "${cfg.package}/bin/emacsclient --eval '(kill-emacs)'"; - Restart = "on-failure"; - }; - - Install = { WantedBy = [ "default.target" ]; }; - }; - }; -} diff --git a/modules/services/govanityurl.nixos.nix b/modules/services/govanityurl.nix diff --git a/modules/services/nix-binary-cache.nixos.nix b/modules/services/nix-binary-cache.nix diff --git a/modules/services/shairport-sync.nix b/modules/services/shairport-sync.nix @@ -1,68 +0,0 @@ -{ config, lib, pkgs, ... }: - -with lib; -let - cfg = config.services.shairport-sync; -in -{ - - ###### interface - - options = { - - services.shairport-sync = { - - enable = mkOption { - default = false; - description = '' - Enable the shairport-sync daemon. - - Running with a local system-wide or remote pulseaudio server - is recommended. - ''; - }; - - arguments = mkOption { - default = "-v -o pa"; - description = '' - Arguments to pass to the daemon. Defaults to a local pulseaudio - server. - ''; - }; - - }; - - }; - - - ###### implementation - - config = mkIf cfg.enable { - - /* - Requires the following in NixOS (or elsewhere). - - services.avahi.enable = true; - services.avahi.publish.enable = true; - services.avahi.publish.userServices = true; - networking.firewall.allowedUDPPortRanges = [ { from = 6001; to = 6101; } ]; - networking.firewall.allowedTCPPorts = [ 5000 ]; - */ - - systemd.user.services.shairport-sync = { - Unit = { - After = [ "network.target" "sound.target" ]; - Description = "Airplay audio player"; - }; - Install = { - WantedBy = [ "default.target" ]; - }; - Service = { - Environment = "PATH=${config.home.profileDirectory}/bin"; - ExecStart = "${pkgs.shairport-sync}/bin/shairport-sync ${cfg.arguments}"; - ExecStop = "${pkgs.procps}/bin/pkill shairport-sync"; - Type = "simple"; - }; - }; - }; -} diff --git a/modules/services/wireguard.client.nixos.nix b/modules/services/wireguard.client.nix diff --git a/modules/virtualisation/buildkit.nixos.nix b/modules/virtualisation/buildkit.nix diff --git a/modules/virtualisation/containerd.nixos.nix b/modules/virtualisation/containerd.nix diff --git a/modules/virtualisation/default.nix b/modules/virtualisation/default.nix @@ -1,7 +1,7 @@ { imports = [ # Remove "nixos" from here - ./buildkit.nixos.nix - ./containerd.nixos.nix + ./buildkit.nix + ./containerd.nix ]; } diff --git a/modules/profiles/vscode.nix b/users/modules/profiles/vscode.nix diff --git a/users/vincent/dev/js.nix b/users/vincent/dev/js.nix @@ -0,0 +1,6 @@ +{ config, pkgs, ... }: +{ + home.file.".npmrc".text = '' + prefix = ${config.home.homeDirectory}/.local/npm + ''; +} diff --git a/users/vincent/dev/lisp.nix b/users/vincent/dev/lisp.nix @@ -0,0 +1,7 @@ +{ pkgs, ... }: +{ + home.packages = with pkgs; [ + sbcl + asdf + ]; +}