diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fe40c22 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +hmModules/apps/hypr/icons/ diff --git a/flake.lock b/flake.lock index 7cc9e57..08ba60c 100644 --- a/flake.lock +++ b/flake.lock @@ -19,6 +19,25 @@ "type": "github" } }, + "ags": { + "inputs": { + "nixpkgs": "nixpkgs_2", + "systems": "systems" + }, + "locked": { + "lastModified": 1728326430, + "narHash": "sha256-tV1ABHuA1HItMdCTuNdA8fMB+qw7LpjvI945VwMSABI=", + "owner": "Aylur", + "repo": "ags", + "rev": "60180a184cfb32b61a1d871c058b31a3b9b0743d", + "type": "github" + }, + "original": { + "owner": "Aylur", + "repo": "ags", + "type": "github" + } + }, "aquamarine": { "inputs": { "hyprutils": [ @@ -106,6 +125,24 @@ "type": "github" } }, + "home-manager": { + "inputs": { + "nixpkgs": "nixpkgs_3" + }, + "locked": { + "lastModified": 1731235328, + "narHash": "sha256-NjavpgE9/bMe/ABvZpyHIUeYF1mqR5lhaep3wB79ucs=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "60bb110917844d354f3c18e05450606a435d2d10", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, "hyprcursor": { "inputs": { "hyprlang": [ @@ -143,27 +180,43 @@ "hyprlang": "hyprlang", "hyprutils": "hyprutils", "hyprwayland-scanner": "hyprwayland-scanner", - "nixpkgs": "nixpkgs_2", + "nixpkgs": "nixpkgs_4", "pre-commit-hooks": "pre-commit-hooks", - "systems": "systems", + "systems": "systems_2", "xdph": "xdph" }, "locked": { - "lastModified": 1730969692, - "narHash": "sha256-yHY98IWTLDz57TrseUxdh5QnpngcNCjNXTJ2XCeNhtk=", + "lastModified": 1731372835, + "narHash": "sha256-rkNYRi7enNGo9t5ptzsOXWCl963ACPVp2ETtFCrzfWQ=", "ref": "refs/heads/main", - "rev": "e58e97b0a38b8ccc87a4304c9e4e2b37c9966875", - "revCount": 5425, - "submodules": true, + "rev": "a29cfa78431a054a093f3c843228bac6783a6d33", + "revCount": 5449, "type": "git", "url": "https://github.com/hyprwm/Hyprland" }, "original": { - "submodules": true, "type": "git", "url": "https://github.com/hyprwm/Hyprland" } }, + "hyprland-contrib": { + "inputs": { + "nixpkgs": "nixpkgs_5" + }, + "locked": { + "lastModified": 1730743354, + "narHash": "sha256-gU4NySYyXeAzVaF5bI6BKmj2CdgiwGFnuPjXUId3Dx0=", + "owner": "hyprwm", + "repo": "contrib", + "rev": "792f6b83dc719214e0e2a0b380c34f147b28ece2", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "contrib", + "type": "github" + } + }, "hyprland-protocols": { "inputs": { "nixpkgs": [ @@ -230,11 +283,11 @@ ] }, "locked": { - "lastModified": 1730968903, - "narHash": "sha256-zFvzLXcSm0Ia4XI1SE4FQ9KE63hlGrRWhLtwMolWuR8=", + "lastModified": 1731163338, + "narHash": "sha256-Qflei0JBeqQ0c8jxA8e982xAxJvfMwfx4Aci2eJi84s=", "owner": "hyprwm", "repo": "hyprutils", - "rev": "3ce0cde8709cdacbfba471f8e828433b58a561e9", + "rev": "60d3dece30f98e8ad85131829c8529950630d6bc", "type": "github" }, "original": { @@ -318,11 +371,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1730785428, - "narHash": "sha256-Zwl8YgTVJTEum+L+0zVAWvXAGbWAuXHax3KzuejaDyo=", + "lastModified": 1725634671, + "narHash": "sha256-v3rIhsJBOMLR8e/RNWxr828tB+WywYIoajrZKFM+0Gg=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "4aa36568d413aca0ea84a1684d2d46f55dbabad7", + "rev": "574d1eac1c200690e27b8eb4e24887f8df7ac27c", "type": "github" }, "original": { @@ -333,6 +386,22 @@ } }, "nixpkgs_3": { + "locked": { + "lastModified": 1730200266, + "narHash": "sha256-l253w0XMT8nWHGXuXqyiIC/bMvh1VRszGXgdpQlfhvU=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "807e9154dcb16384b1b765ebe9cd2bba2ac287fd", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_4": { "locked": { "lastModified": 1730785428, "narHash": "sha256-Zwl8YgTVJTEum+L+0zVAWvXAGbWAuXHax3KzuejaDyo=", @@ -341,13 +410,45 @@ "rev": "4aa36568d413aca0ea84a1684d2d46f55dbabad7", "type": "github" }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_5": { + "locked": { + "lastModified": 1712163089, + "narHash": "sha256-Um+8kTIrC19vD4/lUCN9/cU9kcOsD1O1m+axJqQPyMM=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "fd281bd6b7d3e32ddfa399853946f782553163b5", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_6": { + "locked": { + "lastModified": 1731139594, + "narHash": "sha256-IigrKK3vYRpUu+HEjPL/phrfh7Ox881er1UEsZvw9Q4=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "76612b17c0ce71689921ca12d9ffdc9c23ce40b2", + "type": "github" + }, "original": { "id": "nixpkgs", "ref": "nixos-unstable", "type": "indirect" } }, - "nixpkgs_4": { + "nixpkgs_7": { "locked": { "lastModified": 1730272153, "narHash": "sha256-B5WRZYsRlJgwVHIV6DvidFN7VX7Fg9uuwkRW9Ha8z+w=", @@ -390,22 +491,25 @@ "root": { "inputs": { "aagl": "aagl", + "ags": "ags", + "home-manager": "home-manager", "hyprland": "hyprland", - "nixpkgs": "nixpkgs_3", + "hyprland-contrib": "hyprland-contrib", + "nixpkgs": "nixpkgs_6", "sops-nix": "sops-nix" } }, "sops-nix": { "inputs": { - "nixpkgs": "nixpkgs_4", + "nixpkgs": "nixpkgs_7", "nixpkgs-stable": "nixpkgs-stable_2" }, "locked": { - "lastModified": 1731008979, - "narHash": "sha256-yN1NxvmqV8UltLkqYBWTeZNgpD/eyh/7LM58caHiEfE=", + "lastModified": 1731364708, + "narHash": "sha256-HC0anOL+KmUQ2hdRl0AtunbAckasxrkn4VLmxbW/WaA=", "owner": "Mic92", "repo": "sops-nix", - "rev": "fe63071416471abdab06caa234122932a7c4b980", + "rev": "4c91d52db103e757fc25b58998b0576ae702d659", "type": "github" }, "original": { @@ -429,6 +533,21 @@ "type": "github" } }, + "systems_2": { + "locked": { + "lastModified": 1689347949, + "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", + "owner": "nix-systems", + "repo": "default-linux", + "rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default-linux", + "type": "github" + } + }, "xdph": { "inputs": { "hyprland-protocols": [ diff --git a/flake.nix b/flake.nix index 351047f..85c6a1a 100644 --- a/flake.nix +++ b/flake.nix @@ -2,23 +2,41 @@ inputs = { nixpkgs.url = "nixpkgs/nixos-unstable"; - hyprland.url = "git+https://github.com/hyprwm/Hyprland?submodules=1"; + home-manager.url = "github:nix-community/home-manager"; + + hyprland.url = "git+https://github.com/hyprwm/Hyprland"; + hyprland-contrib.url = "github:hyprwm/contrib"; + sops-nix.url = "github:Mic92/sops-nix"; + ags.url = "github:Aylur/ags"; aagl.url = "github:ezKEa/aagl-gtk-on-nix"; }; - outputs = { self, nixpkgs, ... }@inputs: - let - defaultConfig = extraModules: nixpkgs.lib.nixosSystem { + outputs = { self, home-manager, nixpkgs, ... }@inputs: let + system = "x86_64-linux"; + pkgs = nixpkgs.legacyPackages.${system}; + + hostConfig = extraModules: nixpkgs.lib.nixosSystem { specialArgs = { inherit inputs; }; - system = "x86_64-linux"; + system = system; modules = [ ./nixosModules ] ++ extraModules; }; + + userConfig = extraModules: home-manager.lib.homeManagerConfiguration { + inherit pkgs; + extraSpecialArgs = { inherit inputs; }; + modules = [ + ./hmModules + ] ++ extraModules; + }; in { - nixosConfigurations.onizuka = defaultConfig [ ./systems/onizuka ]; - nixosConfigurations.jibril = defaultConfig [ ./systems/jibril ]; + nixosConfigurations.onizuka = hostConfig [ ./hosts/onizuka ]; + homeConfigurations."pan@onizuka" = userConfig [ ./hosts/onizuka/users/pan ]; + + nixosConfigurations.jibril = hostConfig [ ./hosts/jibril ]; + homeConfigurations."pan@jibril" = userConfig [ ./hosts/jibril/users/pan ]; }; } diff --git a/hmModules/apps/chat/beeper/default.nix b/hmModules/apps/chat/beeper/default.nix new file mode 100644 index 0000000..9f43a70 --- /dev/null +++ b/hmModules/apps/chat/beeper/default.nix @@ -0,0 +1,13 @@ +{ config, pkgs, lib, ... }: + +{ + options.beeper = { + enable = lib.mkEnableOption "Enables beeper"; + }; + + config = lib.mkIf config.beeper.enable { + home.packages = with pkgs; [ + beeper + ]; + }; +} diff --git a/hmModules/apps/chat/default.nix b/hmModules/apps/chat/default.nix new file mode 100644 index 0000000..84ad4e5 --- /dev/null +++ b/hmModules/apps/chat/default.nix @@ -0,0 +1,8 @@ +{ config, pkgs, ... }: + +{ + imports = [ + ./discord + ./beeper + ]; +} diff --git a/hmModules/apps/chat/discord/default.nix b/hmModules/apps/chat/discord/default.nix new file mode 100644 index 0000000..474b6ac --- /dev/null +++ b/hmModules/apps/chat/discord/default.nix @@ -0,0 +1,12 @@ +{ config, pkgs, lib, ... }: +{ + options.discord = { + enable = lib.mkEnableOption "Enables discord"; + }; + + config = lib.mkIf config.discord.enable { + home.packages = with pkgs; [ + vesktop # Base app + ]; + }; +} diff --git a/hmModules/apps/default.nix b/hmModules/apps/default.nix new file mode 100644 index 0000000..ef1c1b2 --- /dev/null +++ b/hmModules/apps/default.nix @@ -0,0 +1,20 @@ +{ config, pkgs, ... }: + +{ + imports = [ + ./chat + ./file-browsers + ./gimp + ./git + ./hypr + ./librewolf + ./lutris + ./media-viewers + ./neovim + ./obs + ./rofi + ./shells + ./terminal-emulators + ./zoxide + ]; +} diff --git a/hmModules/apps/file-browsers/default.nix b/hmModules/apps/file-browsers/default.nix new file mode 100644 index 0000000..118e357 --- /dev/null +++ b/hmModules/apps/file-browsers/default.nix @@ -0,0 +1,8 @@ +{ config, pkgs, lib, ... }: + +{ + imports = [ + ./lf + ./nnn + ]; +} diff --git a/hmModules/apps/file-browsers/lf/default.nix b/hmModules/apps/file-browsers/lf/default.nix new file mode 100644 index 0000000..f4ff3da --- /dev/null +++ b/hmModules/apps/file-browsers/lf/default.nix @@ -0,0 +1,105 @@ +{ config, pkgs, lib, ... }: + +{ + options.lf = { + enable = lib.mkEnableOption "Enables lf"; + hiddenfiles = lib.mkOption { default = [ ".*" ]; }; + leader = lib.mkOption { default = ""; }; + }; + + config = lib.mkIf config.lf.enable { + xdg.configFile."lf/icons".source = ./icons; + + fish.extraFunctions = lib.mkIf config.fish.enable { + lf = { + body = ''cd "$(command ${pkgs.lf}/bin/lf -print-last-dir "$argv")"''; + wraps = "${pkgs.lf}/bin/lf"; + }; + }; + + programs.lf = { + enable = true; + settings = { + # Hide specific files rather than "hidden" files + hiddenfiles = config.lf.hiddenfiles; + ratios = [ + 2 + 3 + ]; + preview = true; + ignorecase = true; + icons = true; + number = true; + relativenumber = true; + }; + commands = { + dragon-out = ''%${pkgs.xdragon}/bin/xdragon -a -x "$fx"''; + trash = lib.mkIf config.trash.enable '' + %${pkgs.trash-cli}/bin/trash "$fx" + ''; + zoxide-cd = lib.mkIf config.zoxide.enable '' + ''${{ + result="$(${pkgs.zoxide}/bin/zoxide query -i | sed 's/\\/\\\\/g;s/"/\\"/g')" + ${pkgs.lf}/bin/lf -remote "send $id cd \"$result\"" + }} + ''; + mkdir = '' + ''${{ + printf "Directory Name: " + read DIR + mkdir $DIR + }} + ''; + mkfile = '' + ''${{ + printf "File Name: " + read FILE + touch $FILE + }} + ''; + on-cd = lib.mkIf config.zoxide.enable '' + &{{ + ${pkgs.zoxide}/bin/zoxide add "$PWD" + }} + ''; + }; + keybindings = let + leader = config.lf.leader; + in { + "${leader}" = ""; + "v" = ":toggle; down"; + "." = "set hidden!"; + "x" = lib.mkIf config.trash.enable "trash"; + "${leader}d" = "mkdir"; + "${leader}f" = "mkfile"; + "${leader}m" = "dragon-out"; + "${leader}z" = lib.mkIf config.zoxide.enable "zoxide-cd"; + }; + extraConfig = + let + previewer = + pkgs.writeShellScriptBin "pv.sh" '' + file=$1 + w=$2 + h=$3 + x=$4 + y=$5 + + if [[ "$( ${pkgs.file}/bin/file -Lb --mime-type "$file")" =~ ^image ]]; then + ${pkgs.kitty}/bin/kitty +kitten icat --silent --stdin no --transfer-mode file --place "''${w}x''${h}@''${x}x''${y}" "$file" < /dev/null > /dev/tty + exit 1 + fi + + ${pkgs.pistol}/bin/pistol "$file" + ''; + cleaner = pkgs.writeShellScriptBin "clean.sh" '' + ${pkgs.kitty}/bin/kitty +kitten icat --clear --stdin no --silent --transfer-mode file < /dev/null > /dev/tty + ''; + in + '' + set cleaner ${cleaner}/bin/clean.sh + set previewer ${previewer}/bin/pv.sh + ''; + }; + }; +} diff --git a/hmModules/apps/file-browsers/lf/icons b/hmModules/apps/file-browsers/lf/icons new file mode 100644 index 0000000..43dbe5d --- /dev/null +++ b/hmModules/apps/file-browsers/lf/icons @@ -0,0 +1,361 @@ +# vim:ft=conf + +# These examples require Nerd Fonts or a compatible font to be used. +# See https://www.nerdfonts.com for more information. + +# default values from lf (with matching order) +# ln l # LINK +# or l # ORPHAN +# tw t # STICKY_OTHER_WRITABLE +# ow d # OTHER_WRITABLE +# st t # STICKY +# di d # DIR +# pi p # FIFO +# so s # SOCK +# bd b # BLK +# cd c # CHR +# su u # SETUID +# sg g # SETGID +# ex x # EXEC +# fi - # FILE + +# file types (with matching order) +ln  # LINK +or  # ORPHAN +tw t # STICKY_OTHER_WRITABLE +ow  # OTHER_WRITABLE +st t # STICKY +di  # DIR +pi p # FIFO +so s # SOCK +bd b # BLK +cd c # CHR +su u # SETUID +sg g # SETGID +ex  # EXEC +fi  # FILE + +# file extensions (vim-devicons) +*.styl  +*.sass  +*.scss  +*.htm  +*.html  +*.slim  +*.haml  +*.ejs  +*.css  +*.less  +*.md  +*.mdx  +*.markdown  +*.rmd  +*.json  +*.webmanifest  +*.js  +*.mjs  +*.jsx  +*.rb  +*.gemspec  +*.rake  +*.php  +*.py  +*.pyc  +*.pyo  +*.pyd  +*.coffee  +*.mustache  +*.hbs  +*.conf  +*.ini  +*.yml  +*.yaml  +*.toml  +*.bat  +*.mk  +*.jpg  +*.jpeg  +*.bmp  +*.png  +*.webp  +*.gif  +*.ico  +*.twig  +*.cpp  +*.c++  +*.cxx  +*.cc  +*.cp  +*.c  +*.cs 󰌛 +*.h  +*.hh  +*.hpp  +*.hxx  +*.hs  +*.lhs  +*.nix  +*.lua  +*.java  +*.sh  +*.fish  +*.bash  +*.zsh  +*.ksh  +*.csh  +*.awk  +*.ps1  +*.ml λ +*.mli λ +*.diff  +*.db  +*.sql  +*.dump  +*.clj  +*.cljc  +*.cljs  +*.edn  +*.scala  +*.go  +*.dart  +*.xul  +*.sln  +*.suo  +*.pl  +*.pm  +*.t  +*.rss  +'*.f#'  +*.fsscript  +*.fsx  +*.fs  +*.fsi  +*.rs  +*.rlib  +*.d  +*.erl  +*.hrl  +*.ex  +*.exs  +*.eex  +*.leex  +*.heex  +*.vim  +*.ai  +*.psd  +*.psb  +*.ts  +*.tsx  +*.jl  +*.pp  +*.vue  +*.elm  +*.swift  +*.xcplayground  +*.tex 󰙩 +*.r 󰟔 +*.rproj 󰗆 +*.sol 󰡪 +*.pem  + +# file names (vim-devicons) (case-insensitive not supported in lf) +*gruntfile.coffee  +*gruntfile.js  +*gruntfile.ls  +*gulpfile.coffee  +*gulpfile.js  +*gulpfile.ls  +*mix.lock  +*dropbox  +*.ds_store  +*.gitconfig  +*.gitignore  +*.gitattributes  +*.gitlab-ci.yml  +*.bashrc  +*.zshrc  +*.zshenv  +*.zprofile  +*.vimrc  +*.gvimrc  +*_vimrc  +*_gvimrc  +*.bashprofile  +*favicon.ico  +*license  +*node_modules  +*react.jsx  +*procfile  +*dockerfile  +*docker-compose.yml  +*docker-compose.yaml  +*compose.yml  +*compose.yaml  +*rakefile  +*config.ru  +*gemfile  +*makefile  +*cmakelists.txt  +*robots.txt 󰚩 + +# file names (case-sensitive adaptations) +*Gruntfile.coffee  +*Gruntfile.js  +*Gruntfile.ls  +*Gulpfile.coffee  +*Gulpfile.js  +*Gulpfile.ls  +*Dropbox  +*.DS_Store  +*LICENSE  +*React.jsx  +*Procfile  +*Dockerfile  +*Docker-compose.yml  +*Docker-compose.yaml  +*Rakefile  +*Gemfile  +*Makefile  +*CMakeLists.txt  + +# file patterns (vim-devicons) (patterns not supported in lf) +# .*jquery.*\.js$  +# .*angular.*\.js$  +# .*backbone.*\.js$  +# .*require.*\.js$  +# .*materialize.*\.js$  +# .*materialize.*\.css$  +# .*mootools.*\.js$  +# .*vimrc.*  +# Vagrantfile$  + +# file patterns (file name adaptations) +*jquery.min.js  +*angular.min.js  +*backbone.min.js  +*require.min.js  +*materialize.min.js  +*materialize.min.css  +*mootools.min.js  +*vimrc  +Vagrantfile  + +# archives or compressed (extensions from dircolors defaults) +*.tar  +*.tgz  +*.arc  +*.arj  +*.taz  +*.lha  +*.lz4  +*.lzh  +*.lzma  +*.tlz  +*.txz  +*.tzo  +*.t7z  +*.zip  +*.z  +*.dz  +*.gz  +*.lrz  +*.lz  +*.lzo  +*.xz  +*.zst  +*.tzst  +*.bz2  +*.bz  +*.tbz  +*.tbz2  +*.tz  +*.deb  +*.rpm  +*.jar  +*.war  +*.ear  +*.sar  +*.rar  +*.alz  +*.ace  +*.zoo  +*.cpio  +*.7z  +*.rz  +*.cab  +*.wim  +*.swm  +*.dwm  +*.esd  + +# image formats (extensions from dircolors defaults) +*.jpg  +*.jpeg  +*.mjpg  +*.mjpeg  +*.gif  +*.bmp  +*.pbm  +*.pgm  +*.ppm  +*.tga  +*.xbm  +*.xpm  +*.tif  +*.tiff  +*.png  +*.svg  +*.svgz  +*.mng  +*.pcx  +*.mov  +*.mpg  +*.mpeg  +*.m2v  +*.mkv  +*.webm  +*.ogm  +*.mp4  +*.m4v  +*.mp4v  +*.vob  +*.qt  +*.nuv  +*.wmv  +*.asf  +*.rm  +*.rmvb  +*.flc  +*.avi  +*.fli  +*.flv  +*.gl  +*.dl  +*.xcf  +*.xwd  +*.yuv  +*.cgm  +*.emf  +*.ogv  +*.ogx  + +# audio formats (extensions from dircolors defaults) +*.aac  +*.au  +*.flac  +*.m4a  +*.mid  +*.midi  +*.mka  +*.mp3  +*.mpc  +*.ogg  +*.ra  +*.wav  +*.oga  +*.opus  +*.spx  +*.xspf  + +# other formats +*.pdf  diff --git a/hmModules/apps/file-browsers/nnn/default.nix b/hmModules/apps/file-browsers/nnn/default.nix new file mode 100644 index 0000000..8900ee7 --- /dev/null +++ b/hmModules/apps/file-browsers/nnn/default.nix @@ -0,0 +1,20 @@ +{ config, pkgs, lib, ... }: + +{ + options.nnn = { + enable = lib.mkEnableOption "Enables nnn"; + }; + + config = lib.mkIf config.nnn.enable { + programs.nnn.enable = true; + home.sessionVariables = { + NNN_FCOLORS = "0000E6310000000000000000"; + NNN_OPTS = "eH"; + NNN_FIFO = "/tmp/nnn.fifo"; + NNN_TRASH = lib.mkIf config.trash.enable "1"; + }; + fish.extraFunctions = lib.mkIf config.fish.enable { + n = ''${builtins.readFile ./nnn_fish_function.fish}''; + }; + }; +} diff --git a/hmModules/apps/file-browsers/nnn/nnn_fish_function.fish b/hmModules/apps/file-browsers/nnn/nnn_fish_function.fish new file mode 100644 index 0000000..86eb7c3 --- /dev/null +++ b/hmModules/apps/file-browsers/nnn/nnn_fish_function.fish @@ -0,0 +1,30 @@ +# Block nesting of nnn in subshells +if test -n "$NNNLVL" + if [ (expr $NNNLVL + 0) -ge 1 ] + exit + return + end +end + +# The default behaviour is to cd on quit (nnn checks if NNN_TMPFILE is set) +# To cd on quit only on ^G, remove the "-x" as in: +# set NNN_TMPFILE "$XDG_CONFIG_HOME/nnn/.lastd" +# NOTE: NNN_TMPFILE is fixed, should not be modified +if test -n "$XDG_CONFIG_HOME" + set -x NNN_TMPFILE "$XDG_CONFIG_HOME/nnn/.lastd" +else + set -x NNN_TMPFILE "$HOME/.config/nnn/.lastd" +end + +# Unmask ^Q (, ^V etc.) (if required, see `stty -a`) to Quit nnn +# stty start undef +# stty stop undef +# stty lwrap undef +# stty lnext undef + +nnn -T v $argv + +if test -e $NNN_TMPFILE + source $NNN_TMPFILE + rm $NNN_TMPFILE +end diff --git a/hmModules/apps/gimp/default.nix b/hmModules/apps/gimp/default.nix new file mode 100644 index 0000000..0998e28 --- /dev/null +++ b/hmModules/apps/gimp/default.nix @@ -0,0 +1,13 @@ +{ config, pkgs, lib, ... }: + +{ + options.gimp = { + enable = lib.mkEnableOption "Enables gimp"; + }; + + config = lib.mkIf config.gimp.enable { + home.packages = with pkgs; [ + gimp + ]; + }; +} diff --git a/hmModules/apps/git/default.nix b/hmModules/apps/git/default.nix new file mode 100644 index 0000000..e164daa --- /dev/null +++ b/hmModules/apps/git/default.nix @@ -0,0 +1,25 @@ +{ config, pkgs, lib, ... }: + +{ + options.git = { + enable = lib.mkEnableOption "Enables git"; + username = lib.mkOption { default = config.home.username; }; + email = lib.mkOption { + default = "git@" + config.home.username + ".com"; + }; + }; + + config = lib.mkIf config.git.enable { + programs.git = { + enable = true; + userName = config.git.username; + userEmail = config.git.email; + extraConfig = { + user.signingkey = "${config.home.homeDirectory}/.ssh/id_ed25519.pub"; + gpg.format = "ssh"; + commit.gpgSign = "true"; + tag.gpgSign = "true"; + }; + }; + }; +} diff --git a/hmModules/apps/hypr/default.nix b/hmModules/apps/hypr/default.nix new file mode 100644 index 0000000..58a441a --- /dev/null +++ b/hmModules/apps/hypr/default.nix @@ -0,0 +1,254 @@ +{ config, inputs, pkgs, lib, ... }: +let rootPath = ./.; in +{ + options.hypr = { + enable = lib.mkEnableOption "Enables hyprland"; + mod_key = lib.mkOption { default = "SUPER"; }; + monitor = { + details = lib.mkOption { default = []; }; + }; + workspace = { + workspaces = lib.mkOption { default = {}; }; + scratchpad.enable = lib.mkEnableOption "Enables a scratchpad"; + defaults = lib.mkOption { default = {}; }; + # primary-secondary = { + # enable = lib.mkEnableOption "Enables the primary-secondary navigation style"; + # primary = lib.mkOption { default = "DP-1"; }; + # secondary = lib.mkOption { default = "DP-2"; }; + # secondaries = lib.mkOption { default = []; }; + # }; + }; + windows.opaque = lib.mkOption { default = []; }; + background = { + enable = lib.mkEnableOption "Enables a wallpaper"; + path = lib.mkOption { default = ""; }; + }; + cursor = { + enable = lib.mkEnableOption "Enables custom cursor"; + theme = lib.mkOption { default = ""; }; + size = lib.mkOption { default = "64"; }; + }; + xwayland.videobridge.enable = lib.mkEnableOption "Enable xwaylandvideobridge"; + mouse.sensitivity = lib.mkOption { default = 0; }; + master.mfact = lib.mkOption { default = 0.55; }; + polkit.enable = lib.mkEnableOption "Enables polkit agent"; + screenshot.enable = lib.mkEnableOption "Enables Screenshotting"; + }; + + imports = [ inputs.hyprland.homeManagerModules.default ]; + + config = let + lopts = lib.lists.optionals; + in { + nix.settings = { + substituters = ["https://hyprland.cachix.org"]; + trusted-public-keys = ["hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="]; + }; + } // lib.mkIf config.hypr.enable { + wayland.windowManager.hyprland = let + mod = config.hypr.mod_key; + # p-s = let + # chw = config.hypr.workspace; + # findDefaultWs = id: if (builtins.hasAttr id chw.workspaces) + # then (builtins.head (builtins.getAttr id chw.workspaces)) + # else ""; + # in with config.hypr.workspace; lib.mkIf primary-secondary.enable { + # primaryWs = findDefaultWs primary-secondary.primary; + # secondaryWs = findDefaultWs primary-secondary.secondary; + # }; + in { + enable = true; + settings = { + monitor = config.hypr.monitor.details; + workspace = let + wsMonitor = monitor: wrksps: map (ws: + if ws == (builtins.head wrksps) + then "name:"+ws+", monitor:"+monitor+", persistent:true, default:true" + else "name:"+ws+", monitor:"+monitor+", persistent:true" + ) wrksps; + makeRules = wsAttr: builtins.concatLists (builtins.attrValues ( + builtins.mapAttrs wsMonitor wsAttr + )); + in makeRules config.hypr.workspace.workspaces + ++ [ + "w[t1], gapsout:0, gapsin:0" + "w[tg1], gapsout:0, gapsin:0" + "f[1], gapsout:0, gapsin:0" + ] + ++ lopts config.hypr.workspace.scratchpad.enable [ + "special:scratch, on-created-empty: [float; size 50% 50%; center] ${config.defaultApps.terminal}" + ]; + input = { + accel_profile = "flat"; + sensitivity = config.hypr.mouse.sensitivity; + }; + general = { + gaps_in = 3; + gaps_out = 3; + border_size = 2; + "col.active_border" = "rgb(F5C2E7)"; + "col.inactive_border" = "rgb(1E1D2F)"; + layout = "master"; + }; + decoration = { + rounding = 2; + blur = { + enabled = true; + size = 12; + passes = 2; + special = true; + }; + }; + animation = [ + "windows, 1, 4, default, popin 50%" + "windowsOut, 1, 4, default, popin 50%" + "windowsMove, 1, 3, default" + "border, 1, 3, default" + "fade, 1, 3, default" + "workspaces, 1, 3, default" + ]; + master = { + mfact = config.hypr.master.mfact; + }; + misc = { + focus_on_activate = true; + }; + + exec-once = lopts config.hypr.polkit.enable [ + "${pkgs.polkit-kde-agent}/bin/libexec/polkit-kde-authentication-agent-1" + ] ++ lopts config.hypr.background.enable [ + "${pkgs.swww}/bin/swww-daemon" + "${pkgs.swww}/bin/swww img ${config.hypr.background.path}" + ] ++ lopts config.ags.enable [ + "ags" + ] ++ lopts config.beeper.enable [ + "[workspace name:chat silent] Beeper" + ]; + + env = with config.hypr; [ + # "HYPR_MON_PRIMARY, ${workspace.primary-secondary.primary}" + # "HYPR_MON_SECONDARY, ${workspace.primary-secondary.secondary}" + "HYPR_WORK_DB, ${config.xdg.cacheHome}/hypr/workspace.db" + ] ++ lopts cursor.enable [ + "HYPRCURSOR_THEME,${cursor.theme}" + "HYPRCURSOR_SIZE,${cursor.size}" + ] ++ lopts config.nvidia.enable [ + "LIBVA_DRIVER_NAME,nvidia" + "XDG_SESSION_TYPE,wayland" + "GBM_BACKEND,nvidia-drm" + "__GLX_VENDOR_LIBRARY_NAME,nvidia" + "WLR_RENDERER_ALLOW_SOFTWARE,1" + "WLR_DRM_DEVICES,/dev/dri/card1" + ]; + + windowrulev2 = let + workspaceDefaults = wsname: applist: map ( + app: "workspace " + wsname + ", " + app + ) applist; + allDefault = wsAttr: builtins.concatLists (builtins.attrValues ( + builtins.mapAttrs workspaceDefaults wsAttr + )); + in allDefault config.hypr.workspace.defaults + ++ [ + "bordersize 0, floating:0, onworkspace:w[t1]" + "rounding 0, floating:0, onworkspace:w[t1]" + "bordersize 0, floating:0, onworkspace:w[tg1]" + "rounding 0, floating:0, onworkspace:w[tg1]" + "bordersize 0, floating:0, onworkspace:f[1]" + "rounding 0, floating:0, onworkspace:f[1]" + ] + ++ lopts config.hypr.xwayland.videobridge.enable [ + "opacity 0.0 override 0.0 override,class:^(xwaylandvideobridge)$" + "noanim,class:^(xwaylandvideobridge)$" + "noinitialfocus,class:^(xwaylandvideobridge)$" + "maxsize 1 1,class:^(xwaylandvideobridge)$" + "noblur,class:^(xwaylandvideobridge)$" + ] ++ map (id: "opacity 1 override, " + id) config.hypr.windows.opaque + ++ [ + "opacity 0.94 fullscreen:0" + "opacity 0.79 override, class:^(${config.defaultApps.terminal})$" + ]; + + # 1, exec, $XDG_CONFIG_HOME/hypr/scripts/changeprimary.xsh home + # 2, exec, $XDG_CONFIG_HOME/hypr/scripts/changeprimary.xsh web + # 3, exec, $XDG_CONFIG_HOME/hypr/scripts/changeprimary.xsh med + # 4, exec, $XDG_CONFIG_HOME/hypr/scripts/changeprimary.xsh game + # 5, exec, $XDG_CONFIG_HOME/hypr/scripts/changeprimary.xsh etc + # _, exec, $XDG_CONFIG_HOME/hypr/scripts/changeprimary.xsh hell + # TAB, exec, $XDG_CONFIG_HOME/hypr/scripts/changesecondary.xsh + # + # SHIFT, 1, movetoworkspacesilent, name:home + # SHIFT, 2, movetoworkspacesilent, name:web + # SHIFT, 3, movetoworkspacesilent, name:med + # SHIFT, 4, movetoworkspacesilent, name:game + # SHIFT, TAB, movetoworkspacesilent, r-1 + + bind = let + modPrefix = kb: if (lib.strings.hasPrefix "&" kb) + then ("${mod}" + kb) + else ("${mod}, " + kb); + in map modPrefix ([ + "Return, exec, ${config.defaultApps.terminal}" + "&SHIFT, Q, exit" + "h, focusmonitor, l" + "l, focusmonitor, r" + "j, cyclenext," + "k, cyclenext, prev" + "&SHIFT, h, movecurrentworkspacetomonitor, -1" + "&SHIFT, l, movecurrentworkspacetomonitor, +1" + "&SHIFT, j, swapnext," + "&SHIFT, k, swapnext, prev" + "c, killactive" + "f, togglefloating" + "&SHIFT, f, fullscreen" + ] ++ (let + workspaces = builtins.concatLists ( + builtins.attrValues config.hypr.workspace.workspaces); + wsBinds = with builtins; wrksps: depth: if depth > (length wrksps) + then [] + else let ws = builtins.elemAt wrksps (depth -1); in [ + "${toString depth}, workspace, name:${ws}" + "&SHIFT, ${toString depth}, movetoworkspacesilent, name:${ws}" + ] ++ wsBinds wrksps (depth + 1); + in wsBinds workspaces 1) ++ lopts config.rofi.enable [ + "&SHIFT, return, exec, ${pkgs.rofi}/bin/rofi -show run" + ] ++ lopts config.hypr.screenshot.enable [ + "P, exec, ${pkgs.grimblast}/bin/grimblast --freeze copy area" + "&SHIFT, P, exec, ${pkgs.grimblast}/bin/grimblast --freeze copysave area" + ] ++ lopts config.hypr.workspace.scratchpad.enable [ + "i, togglespecialworkspace, scratch" + ]); + + bindm = map (kb: "${mod}, " + kb) [ + "mouse:272, movewindow" + "mouse:273, movewindow" + ]; + }; + }; + + home.packages = with pkgs; [ + wlr-randr # Xrandr for wayland + wl-clipboard # Clipboard manager for wayland + xdg-desktop-portal-hyprland # XDP for hyprland + ] ++ lopts config.hypr.xwayland.videobridge.enable [ + xwaylandvideobridge + ] ++ lopts config.hypr.cursor.enable [ + hyprcursor + ] ++ lopts config.hypr.screenshot.enable [ + hyprpicker # Colorpicker, needed for screenshot tool + inputs.hyprland-contrib.packages.${pkgs.system}.grimblast + ]; + + xdg.configFile."hypr-scripts" = { + source = rootPath + "/scripts"; + target = "hypr/scripts"; + executable = true; + }; + + xdg.dataFile."hypr-icons" = lib.mkIf config.hypr.cursor.enable { + source = rootPath + "/icons"; + target = "icons/"; + recursive = true; + }; + }; +} diff --git a/hmModules/apps/hypr/scripts/changeprimary.py b/hmModules/apps/hypr/scripts/changeprimary.py new file mode 100755 index 0000000..9b88129 --- /dev/null +++ b/hmModules/apps/hypr/scripts/changeprimary.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python3 +import shelve +import os +import sys +import subprocess + +# Usage: +# ./changeprimary.xsh workspace +# changes to that workspace +# if workspace is "etc" then changes to etcN where N is a number + +def changeprimary(workspace, pmonitor, smonitor, dbpath): + current_primary = "" + current_secondary = "" + + with shelve.open(dbpath) as db: + current_primary = db.get("primary") + current_secondary = db.get("secondary") + + old_primary = current_primary + current_primary = workspace + + if current_primary == current_secondary: + workspaces = db.get("secondaries").copy() + if old_primary in workspaces: + current_secondary = old_primary + else: + current_secondary = workspaces[ + (workspaces.index(current_secondary)+1) % len(workspaces) + ] + + db["primary"] = current_primary + db["secondary"] = current_secondary + + subprocess.run([ + "hyprctl", "dispatch", "moveworkspacetomonitor", + "name:" + current_secondary, smonitor + ]) + subprocess.run([ + "hyprctl", "dispatch", "workspace", + "name:" + current_secondary + ]) + subprocess.run([ + "hyprctl", "dispatch", "moveworkspacetomonitor", + "name:" + current_primary, pmonitor + ]) + subprocess.run([ + "hyprctl", "dispatch", "workspace", + "name:" + current_primary + ]) + +if __name__ == "__main__": + try: + workspace=sys.argv[1] + primary_monitor=os.environ["HYPR_MON_PRIMARY"] + secondary_monitor=os.environ["HYPR_MON_SECONDARY"] + db=os.environ["HYPR_WORK_DB"] + changeprimary(workspace, primary_monitor, secondary_monitor, db) + except KeyError: + print("Please set HYPR_MON_PRIMARY and HYPR_WORK_DB") + sys.exit(1) diff --git a/hmModules/apps/hypr/scripts/changesecondary.py b/hmModules/apps/hypr/scripts/changesecondary.py new file mode 100755 index 0000000..2eb2b46 --- /dev/null +++ b/hmModules/apps/hypr/scripts/changesecondary.py @@ -0,0 +1,36 @@ +#!/usr/bin/env python3 +import shelve +import copy + +# Usage: +# ./changesecondary.xsh +# cycles through the secondary workspaces + +def cyclesecondary(monitor, dbpath): + current_secondary = "" + + with shelve.open(dbpath) as db: + workspaces = db.get("secondaries").copy() + current_primary = db.get("primary") + current_secondary = db.get("secondary") + + if current_primary in workspaces: + workspaces.remove(current_primary) + + current_secondary = workspaces[ + (workspaces.index(current_secondary)+1) % len(workspaces) + ] + db["secondary"] = current_secondary + + # Change primary to bind + hyprctl dispatch moveworkspacetomonitor name:@(current_secondary) $HYPR_MON_SECONDARY + hyprctl dispatch workspace name:@(current_secondary) + +if __name__ == "__main__": + try: + monitor=os.environ["HYPR_MON_SECONDARY"] + db=os.environ["HYPR_WORK_DB"] + cyclesecondary(monitor, db) + except KeyError: + print("Please set HYPR_MON_PRIMARY and HYPR_WORK_DB") + sys.exit(1) diff --git a/hmModules/apps/librewolf/default.nix b/hmModules/apps/librewolf/default.nix new file mode 100644 index 0000000..f298127 --- /dev/null +++ b/hmModules/apps/librewolf/default.nix @@ -0,0 +1,18 @@ +{ config, pkgs, lib, ... }: + +{ + options.librewolf = { + enable = lib.mkEnableOption "Enables librewolf"; + make_default = lib.mkEnableOption "Makes librewolf the default browser"; + }; + + config = lib.mkIf config.librewolf.enable { + home.packages = with pkgs; [ + librewolf + ]; + home.sessionVariables = { + BROWSER = "librewolf"; + }; + defaultApps.browser = lib.mkIf config.librewolf.make_default "librewolf"; + }; +} diff --git a/hmModules/apps/lutris/default.nix b/hmModules/apps/lutris/default.nix new file mode 100644 index 0000000..aa78d39 --- /dev/null +++ b/hmModules/apps/lutris/default.nix @@ -0,0 +1,22 @@ +{ config, pkgs, lib, ... }: + +{ + options.lutris = { + enable = lib.mkEnableOption "Enables lutris"; + }; + + config = lib.mkIf config.lutris.enable { + home.packages = with pkgs; [ + lutris + wineWowPackages.stable + # (lutris.override { + # extraLibraries = pkgs: [ + # # List library dependencies here + # ]; + # extraPkgs = pkgs: [ + # # List package dependencies here + # ]; + # }) + ]; + }; +} diff --git a/hmModules/apps/media-viewers/default.nix b/hmModules/apps/media-viewers/default.nix new file mode 100644 index 0000000..5b26119 --- /dev/null +++ b/hmModules/apps/media-viewers/default.nix @@ -0,0 +1,9 @@ +{ config, pkgs, ... }: + +{ + imports = [ + ./feh + ./mpv + ./zathura + ]; +} diff --git a/hmModules/apps/media-viewers/feh/default.nix b/hmModules/apps/media-viewers/feh/default.nix new file mode 100644 index 0000000..c1c4462 --- /dev/null +++ b/hmModules/apps/media-viewers/feh/default.nix @@ -0,0 +1,13 @@ +{ config, pkgs, lib, ... }: + +{ + options.feh = { + enable = lib.mkEnableOption "Enables feh"; + }; + + config = lib.mkIf config.feh.enable { + programs.feh = { + enable = true; + }; + }; +} diff --git a/hmModules/apps/media-viewers/mpv/default.nix b/hmModules/apps/media-viewers/mpv/default.nix new file mode 100644 index 0000000..e64e5ce --- /dev/null +++ b/hmModules/apps/media-viewers/mpv/default.nix @@ -0,0 +1,22 @@ +{ config, pkgs, lib, ... }: + +{ + options.mpv = { + enable = lib.mkEnableOption "Enables mpv"; + }; + + config = lib.mkIf config.mpv.enable { + home.packages = with pkgs; [ + yt-dlp + ]; + programs.mpv = { + enable = true; + config = { + volume-max = 150; + force-window = "yes"; + script-opts = "ytdl_hook-ytdl_path=yt-dlp"; + ytdl-format = "bestvideo[height<=?1080][vcodec!=vp9]+bestaudio/best"; + }; + }; + }; +} diff --git a/hmModules/apps/media-viewers/zathura/default.nix b/hmModules/apps/media-viewers/zathura/default.nix new file mode 100644 index 0000000..005c2b6 --- /dev/null +++ b/hmModules/apps/media-viewers/zathura/default.nix @@ -0,0 +1,13 @@ +{ config, pkgs, lib, ... }: + +{ + options.zathura = { + enable = lib.mkEnableOption "Enables zathura"; + }; + + config = lib.mkIf config.zathura.enable { + programs.zathura = { + enable = true; + }; + }; +} diff --git a/hmModules/apps/neovim/default.nix b/hmModules/apps/neovim/default.nix new file mode 100644 index 0000000..3557f90 --- /dev/null +++ b/hmModules/apps/neovim/default.nix @@ -0,0 +1,120 @@ +{ config, pkgs, lib, ... }: + +{ + options.neovim = { + enable = lib.mkEnableOption "Enables neovim"; + languages = { + c.enable = lib.mkEnableOption "Enables c support"; + nix.enable = lib.mkEnableOption "Enables nix support"; + rust.enable = lib.mkEnableOption "Enables rust support"; + }; + plugins = { + comments.enable = lib.mkEnableOption "Enables nvim-comment"; + fugitive.enable = lib.mkEnableOption "Enables git-fugitive"; + lualine.enable = lib.mkEnableOption "Enables lualine"; + luasnip.enable = lib.mkEnableOption "Enables luasnip snippets"; + nvimcmp.enable = lib.mkEnableOption "Enables nvim completion"; + telescope = { + enable = lib.mkEnableOption "Enables telescope"; + fzf.enable = lib.mkEnableOption "Enables telescope-fzf"; + }; + treesitter.enable = lib.mkEnableOption "Enables treesitter"; + wiki.enable = lib.mkEnableOption "Enables a wiki"; + }; + }; + + imports = [ + ./plugin/lsp.nix + ./plugin/nvimcmp.nix + ./plugin/telescope.nix + ./plugin/treesitter.nix + ]; + + config = lib.mkIf config.neovim.enable { + home.sessionVariables = { + EDITOR = "nvim"; + VISUAL = "nvim"; + }; + + programs.neovim = { + enable = true; + viAlias = true; + vimAlias = true; + vimdiffAlias = true; + + extraLuaConfig = '' + ${builtins.readFile ./options.lua} + ''; + + extraPackages = with pkgs; [ + (lib.mkIf config.neovim.languages.c.enable libclang) + (lib.mkIf config.neovim.languages.nix.enable nil) + (lib.mkIf config.neovim.languages.rust.enable rust-analyzer) + ]; + + # Additional packages are added through imports + plugins = let + lopts = lib.lists.optionals; + cfgp = config.neovim.plugins; + cfgl = config.neovim.languages; + + comments = lopts cfgp.comments.enable (with pkgs.vimPlugins; [ + { + plugin = comment-nvim; + type = "lua"; + config = "require(\"Comment\").setup()"; + } + ]); + + fugitive = lopts cfgp.fugitive.enable (with pkgs.vimPlugins; [ + vim-fugitive + ]); + + luasnip-pkg = lopts cfgp.luasnip.enable (with pkgs.vimPlugins; [ + luasnip + friendly-snippets + (lib.mkIf cfgp.nvimcmp.enable cmp_luasnip) + ]); + + lualine = lopts cfgp.lualine.enable (with pkgs.vimPlugins; [ + { + plugin = lualine-nvim; + type = "lua"; + config = '' + require("lualine").setup({ + icons_enabled = true, + }) + ''; + } + nvim-web-devicons + ]); + + nix-pkg = lopts cfgl.nix.enable (with pkgs.vimPlugins; [ + vim-nix + ]); + + rust-pkg = lopts cfgl.rust.enable (with pkgs.vimPlugins; [ + rustaceanvim + ]); + + wiki = lopts cfgp.wiki.enable (with pkgs.vimPlugins; [ + { + plugin = vimwiki; + type = "lua"; + config = '' + vim.g.vimwiki_list = { + { + path = '${config.xdg.userDirs.documents}/wiki', + links_space_char = '_', + ext = '.md', + syntax = 'markdown', + } + } + ''; + } + ]); + in comments ++ fugitive ++ luasnip-pkg ++ lualine ++ + nix-pkg ++ rust-pkg ++ wiki; + }; + }; +} diff --git a/hmModules/apps/neovim/options.lua b/hmModules/apps/neovim/options.lua new file mode 100644 index 0000000..dfa4906 --- /dev/null +++ b/hmModules/apps/neovim/options.lua @@ -0,0 +1,57 @@ +-- Globals +vim.g.mapleader = ' ' +vim.g.maplocalleader = ' ' +vim.opt.list = true +vim.bo.filetype = "on" +vim.opt.updatetime = 300 + +-- Indentations +vim.opt.tabstop = 2 +vim.opt.softtabstop = 0 +vim.opt.shiftwidth = 2 +vim.opt.smarttab = true +vim.opt.expandtab = true + +-- Style +vim.opt.colorcolumn = "80" +vim.opt.showmatch = true +vim.opt.number = true +vim.opt.relativenumber = true + +-- Easy Split Navigation +-- nnoremap +-- nnoremap +-- nnoremap +-- nnoremap + +-- Searching +vim.opt.smartcase = true + +-- Backups +vim.opt.swapfile = false +vim.opt.backup = false +vim.opt.undofile = true +vim.opt.undodir = '/home/pan/.config/nvim/undodir' + +-- Easy copy and pasting to external programs +-- map "+yy +-- map "+P + +-- autocmd BufRead,BufNewFile *.md call WritingMode() +-- autocmd BufRead,BufNewFile *.tex call WritingMode() +-- autocmd BufRead,BufNewFile *.svx call WritingMode() + +-- autocmd BufRead,BufNewFile *.py call PythonMode() + +-- function! WritingMode() + -- setlocal textwidth=80 + -- setlocal wrap linebreak nolist + -- setlocal whichwrap+=<,>,h,l + -- nnoremap j gj + -- nnoremap k gk + -- setlocal spell spelllang=en_us +-- endfunction +-- function! PythonMode() + -- setlocal foldmethod=indent + -- setlocal foldlevel=99 +-- endfunction diff --git a/hmModules/apps/neovim/plugin/lsp.nix b/hmModules/apps/neovim/plugin/lsp.nix new file mode 100644 index 0000000..bd06204 --- /dev/null +++ b/hmModules/apps/neovim/plugin/lsp.nix @@ -0,0 +1,53 @@ +{ config, pkgs, lib, ... }: + +{ + config = lib.mkIf config.neovim.enable { + programs.neovim.plugins = let + cfgp = config.neovim.plugins; + cfgl = config.neovim.languages; + + configText = '' + local on_attach = function(_, bufnr) + + local bufmap = function(keys, func) + vim.keymap.set('n', keys, func, { buffer = bufnr }) + end + + bufmap('r', vim.lsp.buf.rename) + bufmap('a', vim.lsp.buf.code_action) + + bufmap('gd', vim.lsp.buf.definition) + bufmap('gD', vim.lsp.buf.declaration) + bufmap('gI', vim.lsp.buf.implementation) + bufmap('D', vim.lsp.buf.type_definition) + + '' + lib.strings.optionalString cfgp.telescope.enable '' + bufmap('gr', require('telescope.builtin').lsp_references) + bufmap('s', require('telescope.builtin').lsp_document_symbols) + bufmap('S', require('telescope.builtin').lsp_dynamic_workspace_symbols) + '' + '' + + bufmap('K', vim.lsp.buf.hover) + + vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_) + vim.lsp.buf.format() + end, {}) + end + + local capabilities = vim.lsp.protocol.make_client_capabilities() + '' + lib.strings.optionalString cfgl.nix.enable '' + require('lspconfig').nil_ls.setup {} + '' + lib.strings.optionalString cfgl.c.enable '' + require('lspconfig').clangd.setup {} + '' + lib.strings.optionalString cfgl.rust.enable '' + require('lspconfig').rustaceanvim.setup {} + ''; + in with pkgs.vimPlugins; [ + { + plugin = nvim-lspconfig; + type = "lua"; + config = configText; + } + ]; + }; +} diff --git a/hmModules/apps/neovim/plugin/nvimcmp.nix b/hmModules/apps/neovim/plugin/nvimcmp.nix new file mode 100644 index 0000000..82098ef --- /dev/null +++ b/hmModules/apps/neovim/plugin/nvimcmp.nix @@ -0,0 +1,72 @@ +{ config, pkgs, lib, ... }: + +let + cfgp = config.neovim.plugins; +in { + config = lib.mkIf (config.neovim.enable && cfgp.nvimcmp.enable) { + programs.neovim.plugins = let + + configText = '' + local cmp = require('cmp') + '' + lib.strings.optionalString cfgp.luasnip.enable '' + local luasnip = require('luasnip') + + require('luasnip.loaders.from_vscode').lazy_load() + luasnip.config.setup {} + '' + '' + + cmp.setup { + mapping = cmp.mapping.preset.insert { + [''] = cmp.mapping.select_next_item(), + [''] = cmp.mapping.select_prev_item(), + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.complete {}, + [''] = cmp.mapping.confirm { + behavior = cmp.ConfirmBehavior.Replace, + select = true, + }, + [''] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + '' + lib.strings.optionalString cfgp.luasnip.enable '' + elseif luasnip.expand_or_locally_jumpable() then + luasnip.expand_or_jump() + '' + '' + else + fallback() + end + end, { 'i', 's' }), + [''] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + '' + lib.strings.optionalString cfgp.luasnip.enable '' + elseif luasnip.locally_jumpable(-1) then + luasnip.jump(-1) + '' + '' + else + fallback() + end + end, { 'i', 's' }), + }, + '' + lib.strings.optionalString cfgp.luasnip.enable '' + snippet = { + expand = function(args) + luasnip.lsp_expand(args.body) + end, + }, + sources = { + { name = 'luasnip' }, + }, + '' + '' + } + ''; + in with pkgs.vimPlugins; [ + { + plugin = nvim-cmp; + type = "lua"; + config = configText; + } + ]; + }; +} diff --git a/hmModules/apps/neovim/plugin/telescope.nix b/hmModules/apps/neovim/plugin/telescope.nix new file mode 100644 index 0000000..48a96e9 --- /dev/null +++ b/hmModules/apps/neovim/plugin/telescope.nix @@ -0,0 +1,43 @@ +{ config, pkgs, lib, ... }: + +let + cfgp = config.neovim.plugins; +in { + config = lib.mkIf (config.neovim.enable && cfgp.telescope.enable) { + programs.neovim.plugins = let + configText = '' + require('telescope').setup({ + extensions = { + '' + lib.strings.optionalString cfgp.telescope.fzf.enable '' + fzf = { + fuzzy = true, -- false will only do exact matching + override_generic_sorter = true, -- override the generic sorter + override_file_sorter = true, -- override the file sorter + case_mode = "smart_case", -- or "ignore_case" or "respect_case" + -- the default case_mode is "smart_case" + } + '' + '' + } + }) + local builtin = require('telescope.builtin') + vim.keymap.set('n', 'ff', builtin.find_files, {}) + vim.keymap.set('n', 'fg', builtin.git_files, {}) + + '' + lib.strings.optionalString cfgp.telescope.fzf.enable '' + require('telescope').load_extension('fzf') + ''; + in with pkgs.vimPlugins; [ + { + plugin = telescope-nvim; + type = "lua"; + config = configText; + } + (lib.mkIf cfgp.nvimcmp.enable telescope-fzf-native-nvim) + ]; + + home.packages = with pkgs; [ + (lib.mkIf cfgp.telescope.fzf.enable fzf) + ]; + + }; +} diff --git a/hmModules/apps/neovim/plugin/treesitter.nix b/hmModules/apps/neovim/plugin/treesitter.nix new file mode 100644 index 0000000..43b2d28 --- /dev/null +++ b/hmModules/apps/neovim/plugin/treesitter.nix @@ -0,0 +1,36 @@ +{ config, pkgs, lib, ... }: + +let + cfgp = config.neovim.plugins; + cfgl = config.neovim.languages; +in { + config = lib.mkIf (config.neovim.enable && cfgp.treesitter.enable) { + programs.neovim.plugins = let + configText = '' + require('nvim-treesitter.configs').setup { + ensure_installed = {}, + + auto_install = false, + + highlight = { enable = true }, + + indent = { enable = true }, + } + ''; + + # I've tried many things, and can't get treesitter plugins changing + # dynamically. For not just have them always loaded regardless of config + treeplugs = p: [ + p.tree-sitter-c + p.tree-sitter-nix + p.tree-sitter-rust + ]; + in with pkgs.vimPlugins; [ + { + plugin = (nvim-treesitter.withPlugins treeplugs); + type = "lua"; + config = configText; + } + ]; + }; +} diff --git a/hmModules/apps/obs/default.nix b/hmModules/apps/obs/default.nix new file mode 100644 index 0000000..a42a495 --- /dev/null +++ b/hmModules/apps/obs/default.nix @@ -0,0 +1,17 @@ +{ config, pkgs, lib, ... }: +{ + options.obs = { + enable = lib.mkEnableOption "Enables obs"; + }; + + config = lib.mkIf config.obs.enable { + programs.obs-studio = { + enable = true; + plugins = with pkgs.obs-studio-plugins; [ + wlrobs + obs-backgroundremoval + obs-pipewire-audio-capture + ]; + }; + }; +} diff --git a/hmModules/apps/rofi/default.nix b/hmModules/apps/rofi/default.nix new file mode 100644 index 0000000..c98e81f --- /dev/null +++ b/hmModules/apps/rofi/default.nix @@ -0,0 +1,14 @@ +{ config, pkgs, lib, ... }: + +{ + options.rofi = { + enable = lib.mkEnableOption "Enables rofi"; + }; + + config = lib.mkIf config.rofi.enable { + programs.rofi = { + enable = true; + package = pkgs.rofi-wayland; + }; + }; +} diff --git a/hmModules/apps/shells/default.nix b/hmModules/apps/shells/default.nix new file mode 100644 index 0000000..03ae484 --- /dev/null +++ b/hmModules/apps/shells/default.nix @@ -0,0 +1,9 @@ +{ config, pkgs, lib, ... }: + +{ + imports = [ + ./fish + ./xonsh + ./zsh + ]; +} diff --git a/hmModules/apps/shells/fish/default.nix b/hmModules/apps/shells/fish/default.nix new file mode 100644 index 0000000..0fc1e53 --- /dev/null +++ b/hmModules/apps/shells/fish/default.nix @@ -0,0 +1,43 @@ +{ config, pkgs, lib, ... }: +let + functionModule = with lib.types; submodule { + options = { + body = lib.mkOption { type = lines; }; + wraps = lib.mkOption { + type = nullOr str; + default = null; + }; + }; + }; +in { + options.fish = { + enable = lib.mkEnableOption "Enables fish"; + extraFunctions = lib.mkOption { + type = with lib.types; attrsOf (either lines functionModule); + default = {}; + }; + }; + + config = lib.mkIf config.fish.enable { + programs.fish = { + enable = true; + functions = { + fish_greeting = ""; + fish_prompt = '' + if test $status -eq 0 + echo -n -s (set_color blue -o) τ " " (set_color normal) + else + echo -n -s (set_color red -o) τ " " (set_color normal) + end + ''; + fish_right_prompt = '' + git_prompt + echo -n -s (set_color blue) (prompt_pwd) " " + echo -n -s (set_color yellow) $CMD_DURATION ms + echo -n -s (set_color normal) + ''; + git_prompt = ''${builtins.readFile ./functions/git_prompt.fish}''; + } // config.fish.extraFunctions; + }; + }; +} diff --git a/hmModules/apps/shells/fish/functions/git_prompt.fish b/hmModules/apps/shells/fish/functions/git_prompt.fish new file mode 100644 index 0000000..a0bb65b --- /dev/null +++ b/hmModules/apps/shells/fish/functions/git_prompt.fish @@ -0,0 +1,69 @@ +function git_is_repo + test -d .git + or begin + set -l info (command git rev-parse --git-dir --is-bare-repository 2>/dev/null) + and test $info[2] = false + end +end + +function git_is_worktree + git_is_repo + and test (command git rev-parse --is-inside-git-dir) = false +end + +function git_is_dirty + git_is_worktree; and not command git diff --no-ext-diff --quiet --exit-code +end + +function git_is_staged + git_is_repo; and begin + not command git diff --cached --no-ext-diff --quiet --exit-code + end +end + +function git_branch_name + git_is_repo; and begin + command git symbolic-ref --short HEAD 2> /dev/null; + or command git show-ref --head -s --abbrev | head -n1 2> /dev/null + end +end + +function git_is_touched + git_is_worktree; and begin + # The first checks for staged changes, the second for unstaged ones. + # We put them in this order because checking staged changes is *fast*. + not command git diff-index --cached --quiet HEAD -- >/dev/null 2>&1 + or not command git diff --no-ext-diff --quiet --exit-code >/dev/null 2>&1 + end +end + +if git_is_repo + echo -n -s (set_color yellow) (git_branch_name) (set_color normal) + set -l git_meta "" + if test (command git ls-files --others --exclude-standard | wc -w 2> /dev/null) -gt 0 + set git_meta "$git_meta?" + end + if test (command git rev-list --walk-reflogs --count refs/stash 2> /dev/null) + set git_meta "$git_meta\$" + end + if git_is_touched + git_is_dirty && set git_meta "$git_meta⨯" + git_is_staged && set git_meta "$git_meta●" + end + set -l commit_count (command git rev-list --count --left-right (git remote)/(git_branch_name)"...HEAD" 2> /dev/null) + if test $commit_count + set -l behind (echo $commit_count | cut -f 1) + set -l ahead (echo $commit_count | cut -f 2) + if test $behind -gt 0 + set git_meta "$git_meta🠋" + end + if test $ahead -gt 0 + set git_meta "$git_meta🠉" + end + end + if test $git_meta + echo -n -s (set_color red) " " $git_meta " " (set_color normal) + else + echo -n -s " " + end +end diff --git a/hmModules/apps/shells/fish/functions/ssh.fish b/hmModules/apps/shells/fish/functions/ssh.fish new file mode 100644 index 0000000..ec2b82e --- /dev/null +++ b/hmModules/apps/shells/fish/functions/ssh.fish @@ -0,0 +1 @@ +command ssh -o IPQoS=0 $argv; diff --git a/hmModules/apps/shells/xonsh/default.nix b/hmModules/apps/shells/xonsh/default.nix new file mode 100644 index 0000000..34a7a70 --- /dev/null +++ b/hmModules/apps/shells/xonsh/default.nix @@ -0,0 +1,22 @@ +{ config, pkgs, lib, ... }: +let rootPath = ./.; in +{ + options.xonsh = { + enable = lib.mkEnableOption "Enables xonsh"; + }; + + config = lib.mkIf config.xonsh.enable { + home.packages = with pkgs; [ + xonsh + ]; + home.sessionVariables = { + PROMPT = "τ "; + RIGHT_PROMPT = "{YELLOW}{gitstatus: {} }{BLUE}{short_cwd}{DEFAULT}"; + VI_MODE = 1; + }; + xdg.configFile."xonshrc" = { + source = rootPath + "/rc.xsh"; + target = "xonsh/rc.xsh"; + }; + }; +} diff --git a/hmModules/apps/shells/xonsh/rc.xsh b/hmModules/apps/shells/xonsh/rc.xsh new file mode 100644 index 0000000..681ad03 --- /dev/null +++ b/hmModules/apps/shells/xonsh/rc.xsh @@ -0,0 +1,7 @@ +#!/usr/bin/env xonsh + +if $XONSH_INTERACTIVE: + if '__HM_SESS_VARS_SOURCED' in ${...}: + del $__HM_SESS_VARS_SOURCED + source-bash "$HOME/.nix-profile/etc/profile.d/hm-session-vars.sh" --suppress-skip-message + cat "$HOME/.cache/wallust/sequences" diff --git a/hmModules/apps/shells/zsh/default.nix b/hmModules/apps/shells/zsh/default.nix new file mode 100644 index 0000000..9e5ee6b --- /dev/null +++ b/hmModules/apps/shells/zsh/default.nix @@ -0,0 +1,47 @@ +{ config, pkgs, lib, ... }: + +{ + options.zsh = { + enable = lib.mkEnableOption "Enable zsh"; + }; + + config = lib.mkIf config.zsh.enable { + programs.zsh = { + enable = true; + enableCompletion = true; + autosuggestion.enable = true; + syntaxHighlighting.enable = true; + dotDir = ".config/zsh"; + + history.save = 10000; + history.size = 10000; + history.path = "${config.xdg.dataHome}/zsh/history"; + initExtra = let + lf = lib.optionalString config.lf.enable '' + # Lf changes directory + lf () { + cd "$(command ${pkgs.lf}/bin/lf -print-last-dir "$@")" + } + bindkey -s '^o' 'lf\n' + ''; + + in lf + '' + # Nix-shell + ${pkgs.nix-your-shell}/bin/nix-your-shell zsh | source /dev/stdin + + # Prompt + autoload -U colors && colors + autoload -Uz vcs_info + precmd_vcs_info() { vcs_info } + precmd_functions+=( precmd_vcs_info ) + setopt prompt_subst + zstyle ':vcs_info:*' check-for-changes true + zstyle ':vcs_info:*' unstagedstr '·*' + zstyle ':vcs_info:*' stagedstr '·+' + zstyle ':vcs_info:git:*' formats '%b%u%c' + export PROMPT="%(0?.%F{white}.%? %F{red})τ%f " + export RPROMPT="%F{yellow}\$vcs_info_msg_0_%f %F{blue}%~%f" + ''; + }; + }; +} diff --git a/hmModules/apps/terminal-emulators/alacritty/default.nix b/hmModules/apps/terminal-emulators/alacritty/default.nix new file mode 100644 index 0000000..c172d63 --- /dev/null +++ b/hmModules/apps/terminal-emulators/alacritty/default.nix @@ -0,0 +1,39 @@ +{ config, pkgs, lib, ... }: + +{ + options.alacritty = { + enable = lib.mkEnableOption "Enables alacritty"; + font = lib.mkOption { default = ""; }; + font_size = lib.mkOption { default = 18; }; + }; + + config = lib.mkIf config.alacritty.enable { + programs.alacritty.enable = true; + + programs.alacritty.settings = { + font = let fam = config.alacritty.font; in { + normal = { + family = fam; + style = "Regular"; + }; + bold = { + family = fam; + style = "Bold"; + }; + italic = { + family = fam; + style = "Italic"; + }; + bold_italic = { + family = fam; + style = "Bold Italic"; + }; + offset = { + x = 0; + y = 0; + }; + size = config.alacritty.font_size; + }; + }; + }; +} diff --git a/hmModules/apps/terminal-emulators/default.nix b/hmModules/apps/terminal-emulators/default.nix new file mode 100644 index 0000000..ceb550b --- /dev/null +++ b/hmModules/apps/terminal-emulators/default.nix @@ -0,0 +1,8 @@ +{ config, pkgs, lib, ... }: + +{ + imports = [ + ./kitty + ./alacritty + ]; +} diff --git a/hmModules/apps/terminal-emulators/kitty/default.nix b/hmModules/apps/terminal-emulators/kitty/default.nix new file mode 100644 index 0000000..23b8161 --- /dev/null +++ b/hmModules/apps/terminal-emulators/kitty/default.nix @@ -0,0 +1,23 @@ +{ config, pkgs, lib, ... }: + +{ + options.kitty = { + enable = lib.mkEnableOption "Enables kitty"; + make_default = lib.mkEnableOption "Makes kitty default terminal emulator"; + font = lib.mkOption { default = ""; }; + font_size = lib.mkOption { default = 18; }; + }; + + config = lib.mkIf config.kitty.enable { + programs.kitty = { + enable = true; + settings = { + font_family = config.kitty.font; + font_size = config.kitty.font_size; + enable_audio_bell = "no"; + confirm_os_window_close = 0; + }; + }; + defaultApps.terminal = lib.mkIf config.kitty.make_default "kitty"; + }; +} diff --git a/hmModules/apps/zoxide/default.nix b/hmModules/apps/zoxide/default.nix new file mode 100644 index 0000000..859c69b --- /dev/null +++ b/hmModules/apps/zoxide/default.nix @@ -0,0 +1,16 @@ +{ config, pkgs, lib, ... }: + +{ + options.zoxide = { + enable = lib.mkEnableOption "Enables Zoxide"; + }; + + config = lib.mkIf config.zoxide.enable { + programs.zoxide = { + enable = true; + options = [ + "--cmd cd" + ]; + }; + }; +} diff --git a/hmModules/default.nix b/hmModules/default.nix new file mode 100644 index 0000000..3401811 --- /dev/null +++ b/hmModules/default.nix @@ -0,0 +1,8 @@ +{ config, pkgs, ... }: + +{ + imports = [ + ./apps + ./services + ]; +} diff --git a/hmModules/services/default.nix b/hmModules/services/default.nix new file mode 100644 index 0000000..75bc088 --- /dev/null +++ b/hmModules/services/default.nix @@ -0,0 +1,14 @@ +{ config, pkgs, ... }: + +{ + imports = [ + ./dunst + ./home + ./manpages + ./ssh + ./timers + ./trash + ./wal + ./widgets + ]; +} diff --git a/hmModules/services/dunst/default.nix b/hmModules/services/dunst/default.nix new file mode 100644 index 0000000..84e4bcb --- /dev/null +++ b/hmModules/services/dunst/default.nix @@ -0,0 +1,49 @@ +{ config, pkgs, lib, ... }: + +{ + options.dunst = { + enable = lib.mkEnableOption "Enables dunst"; + }; + + config = lib.mkIf config.dunst.enable { + home.packages = with pkgs; [ + libnotify + ]; + services.dunst = { + enable = true; + settings = { + global = { + width = 280; + height = 240; + origin = "bottom-right"; + offset = "0x300"; + + notification_limit = 3; + + progress_bar_max_width = 280; + + gap_size = 4; + corner_radius = 20; + }; + + urgency_low = { + background = "#FFFFFFCC"; + foreground = "#000000"; + frame_color = "#0000"; + }; + + urgency_normal = { + background = "#FFFFFFCC"; + foreground = "#000000"; + frame_color = "#0000"; + }; + + urgency_critical = { + background = "#FFFFFFCC"; + foreground = "#000000"; + frame_color = "#0000"; + }; + }; + }; + }; +} diff --git a/hmModules/services/home/default.nix b/hmModules/services/home/default.nix new file mode 100644 index 0000000..7bf691a --- /dev/null +++ b/hmModules/services/home/default.nix @@ -0,0 +1,43 @@ +{ config, pkgs, lib, ... }: + +{ + options = { + extraPkgs = lib.mkOption { default = []; }; + nvidia.enable = lib.mkEnableOption "Enables nvidia requirements"; + defaultApps = { + terminal = lib.mkOption { default = ""; }; + browser = lib.mkOption { default = ""; }; + }; + }; + + config = { + # Let Home Manager install and manage itself. + programs.home-manager.enable = true; + + home.sessionVariables = { + GRADLE_USER_HOME = "${config.xdg.dataHome}/gradle"; + CUDA_CACHE_PATH = "${config.xdg.cacheHome}/nv"; + }; + + xdg = { + enable = true; + mimeApps.enable = true; + userDirs = let + home = config.home.homeDirectory; + in { + enable = true; + documents = "${home}/dox"; + publicShare = "${home}/dox/public"; + templates = "${home}/dox/templates"; + music = "${home}/med/mus"; + pictures = "${home}/med/pix"; + videos = "${home}/med/vid"; + desktop = "${home}/dwn"; + download = "${home}/dwn"; + }; + }; + + home.homeDirectory = "/home/" + config.home.username; + home.packages = config.extraPkgs; + }; +} diff --git a/hmModules/services/manpages/default.nix b/hmModules/services/manpages/default.nix new file mode 100644 index 0000000..678d734 --- /dev/null +++ b/hmModules/services/manpages/default.nix @@ -0,0 +1,15 @@ +{ config, pkgs, lib, ... }: + +{ + options.manpages = { + enable = lib.mkEnableOption "Enables manpager"; + }; + + config = lib.mkIf config.manpages.enable { + programs.man.enable = true; + home.packages = with pkgs; [ + man-pages + man-pages-posix + ]; + }; +} diff --git a/hmModules/services/ssh/default.nix b/hmModules/services/ssh/default.nix new file mode 100644 index 0000000..418ae9c --- /dev/null +++ b/hmModules/services/ssh/default.nix @@ -0,0 +1,14 @@ +{ config, pkgs, lib, ... }: + +{ + options.ssh = { + enable = lib.mkEnableOption "Enables ssh"; + }; + + config = lib.mkIf config.ssh.enable { + programs.ssh.enable = true; + home.packages = with pkgs; [ + sshfs # SSH File system + ]; + }; +} diff --git a/hmModules/services/timers/default.nix b/hmModules/services/timers/default.nix new file mode 100644 index 0000000..548ab30 --- /dev/null +++ b/hmModules/services/timers/default.nix @@ -0,0 +1,60 @@ +{ config, pkgs, lib, ... }: +let rootPath = ./.; in +{ + options.timer = { + enableHourly = lib.mkEnableOption "Enables an hourly notification"; + enableQuarterly = lib.mkEnableOption "Enables a quarterly notification"; + }; + + config = { + systemd.user.timers = { + hourly-time = lib.mkIf config.timer.enableHourly { + Timer = { + OnCalendar = "hourly"; + }; + Install = { + WantedBy = [ + "timers.target" + ]; + }; + }; + quarterly-time = lib.mkIf config.timer.enableQuarterly { + Timer = { + OnCalendar = "*-*-* *:15,30,45:00"; + }; + Install = { + WantedBy = [ + "timers.target" + ]; + }; + }; + }; + + systemd.user.services = { + hourly-time = lib.mkIf config.timer.enableHourly { + Unit = { + Description = "Notify the user every hour of time passing"; + }; + Service = { + Type="simple"; + ExecStart="/home/pan/.config/timer_scripts/notify-time.sh 60000 1"; + }; + }; + quarterly-time = lib.mkIf config.timer.enableQuarterly { + Unit = { + Description = "Notify the user every 15 minutes of time passing, \ + skips hours"; + }; + Service = { + Type="simple"; + ExecStart="/home/pan/.config/timer_scripts/notify-time.sh 10000 0"; + }; + }; + }; + xdg.configFile."timer-scripts" = { + source = rootPath + "/scripts"; + target = "timer_scripts/"; + executable = true; + }; + }; +} diff --git a/hmModules/services/timers/scripts/chimes.ogg b/hmModules/services/timers/scripts/chimes.ogg new file mode 100644 index 0000000..bd716d0 Binary files /dev/null and b/hmModules/services/timers/scripts/chimes.ogg differ diff --git a/hmModules/services/timers/scripts/notify-time.sh b/hmModules/services/timers/scripts/notify-time.sh new file mode 100755 index 0000000..e162149 --- /dev/null +++ b/hmModules/services/timers/scripts/notify-time.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +export DISPLAY=":0" +export DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/1000/bus" +/home/pan/.nix-profile/bin/notify-send "$(/run/current-system/sw/bin/date +%H:%M)" -t $1 +if [ $2 -eq 1 ]; then + /run/current-system/sw/bin/pw-cat --volume 0.08 -p ./chimes.ogg & +fi diff --git a/hmModules/services/trash/default.nix b/hmModules/services/trash/default.nix new file mode 100644 index 0000000..cf54f67 --- /dev/null +++ b/hmModules/services/trash/default.nix @@ -0,0 +1,13 @@ +{ config, pkgs, lib, ... }: + +{ + options.trash = { + enable = lib.mkEnableOption "Enables trash"; + }; + + config = { + home.packages = [ + pkgs.trash-cli + ]; + }; +} diff --git a/hmModules/services/wal/default.nix b/hmModules/services/wal/default.nix new file mode 100644 index 0000000..41930fe --- /dev/null +++ b/hmModules/services/wal/default.nix @@ -0,0 +1,34 @@ +{ config, pkgs, lib, ... }: +let rootPath = ./.; in +{ + options.colors = { + enable = lib.mkEnableOption "Enables setting colors using wallust"; + }; + + config = lib.mkIf config.colors.enable { + home.packages = with pkgs; [ + wallust # A better pywal + pywalfox-native # Update librewolf's colorscheme based on wal + ]; + xdg.configFile."wallust-config" = { + target = "wallust/wallust.toml"; + text = '' + backend = "wal" + color_space = "lab" + threshold = 20 + filter = "dark16" + + # [[entry]] + # # a relative path to a file where wallust.toml is (~/.config/wallust/) + # template = "dunstrc" + # + # # absolute path to the file to write the template (after templating) + # target = "~/.config/dunst/dunstrc" + ''; + }; + #xdg.configFile."wallust-templates" = { + # source = rootPath + "/templates"; + # target = "wallust/"; + #}; + }; +} diff --git a/hmModules/services/widgets/ags/config/config.js b/hmModules/services/widgets/ags/config/config.js new file mode 100644 index 0000000..c9500da --- /dev/null +++ b/hmModules/services/widgets/ags/config/config.js @@ -0,0 +1,9 @@ +// import { Switch } from "./modules/workspace-switch.js"; +import { notificationPopup } from "./modules/notifications/notificationPopup.ts" + +export default { + style: App.configDir + '/modules/notifications/style.css', + windows: [ + notificationPopup() + ] +} diff --git a/hmModules/services/widgets/ags/config/modules/clock.js b/hmModules/services/widgets/ags/config/modules/clock.js new file mode 100644 index 0000000..6f9f462 --- /dev/null +++ b/hmModules/services/widgets/ags/config/modules/clock.js @@ -0,0 +1,22 @@ +export const Clock = (monitor = 0) => { + + return Widget.Window({ + monitor, + name: `switch${monitor}`, + anchor: ['top', 'left', 'right'], + margins: [864, 1030], + css: 'background: transparent;', + child: container, + }); +}; + +const container = Widget.Box({ + css: ` + min-height: 110px; + min-width: 500px; + border: 4px solid #f4d80a; + border-radius: 50px; + margin: 3px; + box-shadow: 0 0 0 3px white; + `, +}); diff --git a/hmModules/services/widgets/ags/config/modules/notifications/notificationPopup.ts b/hmModules/services/widgets/ags/config/modules/notifications/notificationPopup.ts new file mode 100644 index 0000000..56ddf80 --- /dev/null +++ b/hmModules/services/widgets/ags/config/modules/notifications/notificationPopup.ts @@ -0,0 +1,71 @@ +const notifications = await Service.import('notifications'); +const popups = notifications.bind('popups'); + +export const notificationPopup = (monitor = 0) => { + return Widget.Window({ + name: 'notifications', + anchor: ['bottom', 'right'], + child: Widget.Box({ + class_name: 'notifications', + vertical: true, + children: popups.as(popups => popups.map(Notification)), + }), + }); +}; + +/** @param {import('resource:///com/github/Aylur/ags/service/notifications.js').Notification} n */ +const Notification = n => { + const title = Widget.Label({ + class_name: 'title', + xalign: 0, + justification: 'left', + hexpand: true, + max_width_chars: 24, + truncate: 'end', + wrap: true, + label: n.summary, + use_markup: true, + }); + + const body = Widget.Label({ + class_name: 'body', + hexpand: true, + use_markup: true, + xalign: 0, + justification: 'left', + label: n.body, + wrap: true, + }); + + const actions = Widget.Box({ + class_name: 'actions', + children: n.actions.map(({ id, label }) => Widget.Button({ + class_name: 'action-button', + on_clicked: () => n.invoke(id), + hexpand: true, + child: Widget.Label(label), + })), + }); + + return Widget.EventBox({ + on_primary_click: () => n.dismiss(), + child: Widget.Box({ + class_name: `notification ${n.urgency}`, + vertical: true, + children: [ + Widget.Box({ + children: [ + Widget.Box({ + vertical: true, + children: [ + title, + body, + ], + }), + ], + }), + actions, + ], + }), + }); +}; diff --git a/hmModules/services/widgets/ags/config/modules/notifications/style.css b/hmModules/services/widgets/ags/config/modules/notifications/style.css new file mode 100644 index 0000000..1e819fc --- /dev/null +++ b/hmModules/services/widgets/ags/config/modules/notifications/style.css @@ -0,0 +1,61 @@ +window#notifications { + all: unset; +} + +window#notifications box.notifications { + padding: .5em; +} + +.icon { + min-width: 68px; + min-height: 68px; + margin-right: 1em; +} + +.icon image { + font-size: 58px; + /* to center the icon */ + margin: 5px; + color: @theme_fg_color; +} + +.icon box { + min-width: 68px; + min-height: 68px; + border-radius: 7px; +} + +.notification { + min-width: 350px; + border-radius: 11px; + padding: 1em; + margin: .5em; + border: 1px solid @wm_borders_edge; + background-color: @theme_bg_color; +} + +.notification.critical { + border: 1px solid lightcoral; +} + +.title { + color: @theme_fg_color; + font-size: 1.4em; +} + +.body { + color: @theme_unfocused_fg_color; +} + +.actions .action-button { + margin: 0 .4em; + margin-top: .8em; +} + +.actions .action-button:first-child { + margin-left: 0; +} + +.actions .action-button:last-child { + margin-right: 0; +} diff --git a/hmModules/services/widgets/ags/config/modules/workspace-switch.js b/hmModules/services/widgets/ags/config/modules/workspace-switch.js new file mode 100644 index 0000000..6b8d6bd --- /dev/null +++ b/hmModules/services/widgets/ags/config/modules/workspace-switch.js @@ -0,0 +1,22 @@ +export const Switch = (monitor = 0) => { + + return Widget.Window({ + monitor, + name: `switch${monitor}`, + anchor: ['top', 'left', 'right'], + margins: [864, 1030], + css: 'background: transparent;', + child: container, + }); +}; + +const container = Widget.Box({ + css: ` + min-height: 110px; + min-width: 500px; + border: 4px solid #f4d80a; + border-radius: 50px; + margin: 3px; + box-shadow: 0 0 0 3px white; + `, +}); diff --git a/hmModules/services/widgets/ags/default.nix b/hmModules/services/widgets/ags/default.nix new file mode 100644 index 0000000..5d248d1 --- /dev/null +++ b/hmModules/services/widgets/ags/default.nix @@ -0,0 +1,25 @@ +{ config, inputs, pkgs, lib, ... }: +{ + + options.ags = { + enable = lib.mkEnableOption "Enable ags"; + }; + + imports = [ inputs.ags.homeManagerModules.default ]; + + config = lib.mkIf config.ags.enable { + home.packages = with pkgs; [ + libnotify # Notifications through ags + ]; + programs.ags = { + enable = true; + configDir = ./config; + + extraPackages = with pkgs; [ + gtksourceview + webkitgtk + accountsservice + ]; + }; + }; +} diff --git a/hmModules/services/widgets/default.nix b/hmModules/services/widgets/default.nix new file mode 100644 index 0000000..caebead --- /dev/null +++ b/hmModules/services/widgets/default.nix @@ -0,0 +1,8 @@ +{ config, pkgs, lib, ... }: + +{ + imports = [ + ./ags + ./eww + ]; +} diff --git a/hmModules/services/widgets/eww/config/eww.scss b/hmModules/services/widgets/eww/config/eww.scss new file mode 100644 index 0000000..aa4eb77 --- /dev/null +++ b/hmModules/services/widgets/eww/config/eww.scss @@ -0,0 +1,11 @@ +.content-box { + border: 4px solid yellow; + border-radius: 50px; + background-color: rgba(255,255,255,10); + margin: 2px; + box-shadow: 0 0 0 3px white; +} + +.switch { + background: transparent; +} diff --git a/hmModules/services/widgets/eww/config/eww.yuck b/hmModules/services/widgets/eww/config/eww.yuck new file mode 100644 index 0000000..275b37b --- /dev/null +++ b/hmModules/services/widgets/eww/config/eww.yuck @@ -0,0 +1 @@ +(include "modules/switch.yuck") diff --git a/hmModules/services/widgets/eww/config/modules/bar.yuck b/hmModules/services/widgets/eww/config/modules/bar.yuck new file mode 100644 index 0000000..137bb51 --- /dev/null +++ b/hmModules/services/widgets/eww/config/modules/bar.yuck @@ -0,0 +1,40 @@ +(include "./widgets/components/hyprwindow.yuck") +(include "./widgets/components/hyprworkspaces.yuck") +(include "./widgets/components/internet.yuck") +(include "./widgets/components/japanesedate.yuck") +(include "./widgets/components/japaneseaudio.yuck") + +(defwidget bar [] + (centerbox :orientation "horizontal" + :style "padding: 0px 8px" + (box :halign "start" + :spacing 18 + :space-evenly false + (hyprworkspaces) + (hyprwindow) + ) + "" + (box :halign "end" + :spacing 18 + :space-evenly false + (eventbox :onhover "eww open preview" + :onhoverlost "eww close preview" + barplayer + ) + (internet) + (japaneseaudio) + (japanesedate) + (label :style "color: #FAE3B0" + :text bartime + ) + ) + ) +) + +(defpoll bartime :interval "10s" + "date '+%H:%M'" +) + +(deflisten barplayer :initial "" + "playerctl --follow metadata --format '{{ artist }} - {{ title }}' || true" +) diff --git a/hmModules/services/widgets/eww/config/modules/components/hyprwindow.yuck b/hmModules/services/widgets/eww/config/modules/components/hyprwindow.yuck new file mode 100644 index 0000000..2e2d519 --- /dev/null +++ b/hmModules/services/widgets/eww/config/modules/components/hyprwindow.yuck @@ -0,0 +1,5 @@ +(defwidget hyprwindow [] + (label :text "${hyprwindow_listener}") +) + +(deflisten hyprwindow_listener :initial "" "bash $XDG_CONFIG_HOME/eww/scripts/get-window-title") diff --git a/hmModules/services/widgets/eww/config/modules/components/hyprworkspaces.yuck b/hmModules/services/widgets/eww/config/modules/components/hyprworkspaces.yuck new file mode 100644 index 0000000..aa44634 --- /dev/null +++ b/hmModules/services/widgets/eww/config/modules/components/hyprworkspaces.yuck @@ -0,0 +1,17 @@ +(defwidget hyprworkspaces [] + (eventbox :onscroll "bash ~/.config/eww/scripts/change-active-workspace {} ${current_workspace}" :class "workspaces-widget" + (box :space-evenly false + :spacing 5 + (for workspace in workspaces + (eventbox :onclick "hyprctl dispatch workspace ${workspace.id}" + (box :class "workspace-entry ${workspace.id == current_workspace ? "current" : ""} ${workspace.windows > 0 ? "occupied" : "empty"}" + (label :text "${workspace.id}") + ) + ) + ) + ) + ) + ) + +(deflisten workspaces :initial "[]" "bash $XDG_CONFIG_HOME/eww/scripts/get-workspaces") +(deflisten current_workspace :initial "1" "bash $XDG_CONFIG_HOME/eww/scripts/get-active-workspace") diff --git a/hmModules/services/widgets/eww/config/modules/components/internet.yuck b/hmModules/services/widgets/eww/config/modules/components/internet.yuck new file mode 100644 index 0000000..64aec24 --- /dev/null +++ b/hmModules/services/widgets/eww/config/modules/components/internet.yuck @@ -0,0 +1,8 @@ +(defwidget internet [] + (box :spacing 0 :space-evenly false :style "color: #f5c2e7" + network + ) +) + +(defpoll network :interval "30s" + "iwgetid -r") diff --git a/hmModules/services/widgets/eww/config/modules/components/japaneseaudio.yuck b/hmModules/services/widgets/eww/config/modules/components/japaneseaudio.yuck new file mode 100644 index 0000000..74bbc98 --- /dev/null +++ b/hmModules/services/widgets/eww/config/modules/components/japaneseaudio.yuck @@ -0,0 +1,11 @@ +(defwidget japaneseaudio [] + (eventbox :onscroll "bash -c 'if [ '{}' = 'up' ]; then pamixer -i 5; else pamixer -d 5; fi'" + (box :spacing 0 :space-evenly false :style "color: #96CDFB" + volume + "音" + ) + ) +) + +(defpoll volume :interval "1s" + "pamixer --get-volume") diff --git a/hmModules/services/widgets/eww/config/modules/components/japanesebattery.yuck b/hmModules/services/widgets/eww/config/modules/components/japanesebattery.yuck new file mode 100644 index 0000000..40d45cf --- /dev/null +++ b/hmModules/services/widgets/eww/config/modules/components/japanesebattery.yuck @@ -0,0 +1,9 @@ +(defwidget japanesebattery [] + (box :spacing 0 :space-evenly false :style "color: #FAB387" + power + "電" + ) +) + +(defpoll power :interval "1m" + "cat /sys/class/power_supply/BAT1/capacity") diff --git a/hmModules/services/widgets/eww/config/modules/components/japanesedate.yuck b/hmModules/services/widgets/eww/config/modules/components/japanesedate.yuck new file mode 100644 index 0000000..fe43c00 --- /dev/null +++ b/hmModules/services/widgets/eww/config/modules/components/japanesedate.yuck @@ -0,0 +1,9 @@ +(defwidget japanesedate [] + (label :style "color: #DDB6F2" + :text japanesedate_time + ) +) + +(defpoll japanesedate_time :interval "100s" + "bash $XDG_CONFIG_HOME/eww/scripts/japanesedate" +) diff --git a/hmModules/services/widgets/eww/config/modules/powerbar.yuck b/hmModules/services/widgets/eww/config/modules/powerbar.yuck new file mode 100644 index 0000000..ac1ac1f --- /dev/null +++ b/hmModules/services/widgets/eww/config/modules/powerbar.yuck @@ -0,0 +1,15 @@ +(defwidget powerbar [] + (box + :orientation "vertical" + :spacing 8 + :space-evenly false + :style "color: #FAB387" + (progress + :orientation "v" + :value {100 - power}) + "電" + ) +) + +(defpoll power :interval "1m" + "cat /sys/class/power_supply/BAT1/capacity") diff --git a/hmModules/services/widgets/eww/config/modules/switch.yuck b/hmModules/services/widgets/eww/config/modules/switch.yuck new file mode 100644 index 0000000..108583b --- /dev/null +++ b/hmModules/services/widgets/eww/config/modules/switch.yuck @@ -0,0 +1,15 @@ +(defwindow switch + :monitor 1 + :stacking "fg" + :focusable false + :geometry (geometry :y "60%" + :width "500px" + :height "110px" + :anchor "top center") + (border + "Example contenting") +) + +(defwidget border [] + (box :class "content-box" + (children))) diff --git a/hmModules/services/widgets/eww/config/scripts/change-active-workspace b/hmModules/services/widgets/eww/config/scripts/change-active-workspace new file mode 100644 index 0000000..ffaf9fc --- /dev/null +++ b/hmModules/services/widgets/eww/config/scripts/change-active-workspace @@ -0,0 +1,21 @@ +#!/bin/sh +function clamp { + min=$1 + max=$2 + val=$3 + python -c "print(max($min, min($val, $max)))" +} + +direction=$1 +current=$2 +if test "$direction" = "down" +then + target=$(clamp 1 10 $(($current+1))) + echo "jumping to $target" + hyprctl dispatch workspace $target +elif test "$direction" = "up" +then + target=$(clamp 1 10 $(($current-1))) + echo "jumping to $target" + hyprctl dispatch workspace $target +fi diff --git a/hmModules/services/widgets/eww/config/scripts/get-active-workspace b/hmModules/services/widgets/eww/config/scripts/get-active-workspace new file mode 100644 index 0000000..b97efdf --- /dev/null +++ b/hmModules/services/widgets/eww/config/scripts/get-active-workspace @@ -0,0 +1,3 @@ +#!/bin/sh +hyprctl monitors -j | jq --raw-output .[0].activeWorkspace.id +socat -u UNIX-CONNECT:/tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock - | stdbuf -o0 grep '^workspace>>' | stdbuf -o0 awk -F '>>|,' '{print $2}' diff --git a/hmModules/services/widgets/eww/config/scripts/get-window-title b/hmModules/services/widgets/eww/config/scripts/get-window-title new file mode 100644 index 0000000..c1be34a --- /dev/null +++ b/hmModules/services/widgets/eww/config/scripts/get-window-title @@ -0,0 +1,3 @@ +#!/bin/sh +hyprctl activewindow -j | jq --raw-output .title +socat -u UNIX-CONNECT:/tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock - | stdbuf -o0 grep '^activewindow>>' | stdbuf -o0 awk -F '>>|,' '{print $3}' diff --git a/hmModules/services/widgets/eww/config/scripts/get-workspaces b/hmModules/services/widgets/eww/config/scripts/get-workspaces new file mode 100644 index 0000000..68d7108 --- /dev/null +++ b/hmModules/services/widgets/eww/config/scripts/get-workspaces @@ -0,0 +1,11 @@ +#!/bin/sh + +spaces (){ + WORKSPACE_WINDOWS=$(hyprctl workspaces -j | jq 'map({key: .id | tostring, value: .windows}) | from_entries') + seq 1 10 | jq --argjson windows "${WORKSPACE_WINDOWS}" --slurp -Mc 'map(tostring) | map({id: ., windows: ($windows[.]//0)})' +} + +spaces +socat -u UNIX-CONNECT:/tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock - | while read -r line; do + spaces +done diff --git a/hmModules/services/widgets/eww/config/scripts/japanesedate b/hmModules/services/widgets/eww/config/scripts/japanesedate new file mode 100644 index 0000000..7360f73 --- /dev/null +++ b/hmModules/services/widgets/eww/config/scripts/japanesedate @@ -0,0 +1,31 @@ +#!/bin/sh + +readarray -t dateparts <<<"$(date "+%0m月%0d日%n%u")" + +echo -n "${dateparts[0]}[" + +case ${dateparts[1]} in + 1) + echo -n "月" + ;; + 2) + echo -n "火" + ;; + 3) + echo -n "水" + ;; + 4) + echo -n "木" + ;; + 5) + echo -n "金" + ;; + 6) + echo -n "土" + ;; + 7) + echo -n "日" + ;; +esac + +echo "]" diff --git a/hmModules/services/widgets/eww/config/scripts/medpreview b/hmModules/services/widgets/eww/config/scripts/medpreview new file mode 100644 index 0000000..3b35839 --- /dev/null +++ b/hmModules/services/widgets/eww/config/scripts/medpreview @@ -0,0 +1,3 @@ +#!/bin/sh + +playerctl --follow metadata mpris:artUrl | stdbuf -o0 cut -c 8- diff --git a/hmModules/services/widgets/eww/config/variables.yuck b/hmModules/services/widgets/eww/config/variables.yuck new file mode 100644 index 0000000..e69de29 diff --git a/hmModules/services/widgets/eww/default.nix b/hmModules/services/widgets/eww/default.nix new file mode 100644 index 0000000..7417cdf --- /dev/null +++ b/hmModules/services/widgets/eww/default.nix @@ -0,0 +1,13 @@ +{ config, pkgs, lib, ... }: + +{ + options.eww = { + enable = lib.mkEnableOption "Enables eww"; + }; + + config = lib.mkIf config.eww.enable { + programs.eww.enable = true; + programs.eww.package = pkgs.eww-wayland; + programs.eww.configDir = ./config; + }; +} diff --git a/systems/jibril/default.nix b/hosts/jibril/default.nix similarity index 96% rename from systems/jibril/default.nix rename to hosts/jibril/default.nix index f085bf3..840328b 100644 --- a/systems/jibril/default.nix +++ b/hosts/jibril/default.nix @@ -1,4 +1,4 @@ -{ config, pkgs, lib, ... }: +{ config, ... }: { imports = [ diff --git a/systems/jibril/hardware.nix b/hosts/jibril/hardware.nix similarity index 100% rename from systems/jibril/hardware.nix rename to hosts/jibril/hardware.nix diff --git a/systems/jibril/networks.toml b/hosts/jibril/networks.toml similarity index 100% rename from systems/jibril/networks.toml rename to hosts/jibril/networks.toml diff --git a/systems/jibril/secrets.yaml b/hosts/jibril/secrets.yaml similarity index 100% rename from systems/jibril/secrets.yaml rename to hosts/jibril/secrets.yaml diff --git a/hosts/jibril/users/pan/default.nix b/hosts/jibril/users/pan/default.nix new file mode 100644 index 0000000..f27a420 --- /dev/null +++ b/hosts/jibril/users/pan/default.nix @@ -0,0 +1,110 @@ +{ config, ... }: + +{ + home.username = "pan"; + nixpkgs.config.allowUnfree = true; + home.stateVersion = "23.05"; + + hypr.enable = true; + hypr.monitor = { + details = [ + "eDP-2,2256x1504@60,0x0,1" + ]; + }; + hypr.workspace = { + workspaces = { + "eDP-1" = [ + "home" + "web" + "chat" + "med" + ]; + }; + scratchpad.enable = true; + defaults = { + "name:web" = [ "class:(librewolf)" ]; + "name:med" = [ "class:(librewolf),title:Picture-in-Picture" ]; + "name:chat" = [ "class:(Beeper)" ]; + }; + }; + hypr.windows.opaque = [ + "initialTitle:^(Discord Popout)$" + "class:^(firefox)$" + "class:^(Gimp)$" + "class:^(feh)$" + "class:^(mpv)$" + ]; + hypr.background = { + enable = true; + path = "${config.home.homeDirectory}/med/pix/bg.png"; + }; + hypr.cursor = { + enable = true; + theme = "miku"; + }; + hypr = { + screenshot.enable = true; + mouse.sensitivity = -0.52; + polkit.enable = true; + master.mfact = 0.53; + xwayland.videobridge.enable = true; + }; + # ags.enable = true; + rofi.enable = true; + + timer.enableHourly = true; + timer.enableQuarterly = true; + colors.enable = true; + manpages.enable = true; + trash.enable = true; + + fish.enable = true; + kitty.enable = true; + kitty.make_default = true; + kitty.font = "Cascadia Code"; + git.enable = true; + git.username = "Julia Lange"; + git.email = "public@julialange.org"; + ssh.enable = true; + librewolf.enable = true; + librewolf.make_default = true; + + mpv.enable = true; + zathura.enable = true; + feh.enable = true; + + neovim.enable = true; + neovim.languages = { + c.enable = true; + nix.enable = true; + rust.enable = true; + }; + neovim.plugins = { + comments.enable = true; + fugitive.enable = true; + lualine.enable = true; + luasnip.enable = true; + nvimcmp.enable = true; + telescope = { + enable = true; + fzf.enable = true; + }; + treesitter.enable = true; + wiki.enable = true; + }; + + lf.enable = true; + lf.hiddenfiles = [ + "${config.home.homeDirectory}/.librewolf" + "${config.home.homeDirectory}/.nix-defexpr" + "${config.home.homeDirectory}/.nix-profile" + "${config.home.homeDirectory}/.nv" + "${config.home.homeDirectory}/.pki" + ]; + zoxide.enable = true; + + gimp.enable = true; + + beeper.enable = true; + discord.enable = true; +} diff --git a/systems/onizuka/default.nix b/hosts/onizuka/default.nix similarity index 95% rename from systems/onizuka/default.nix rename to hosts/onizuka/default.nix index d844fa1..5d3e23f 100644 --- a/systems/onizuka/default.nix +++ b/hosts/onizuka/default.nix @@ -1,4 +1,4 @@ -{ config, pkgs, lib, ... }: +{ ... }: { imports = [ diff --git a/systems/onizuka/hardware.nix b/hosts/onizuka/hardware.nix similarity index 100% rename from systems/onizuka/hardware.nix rename to hosts/onizuka/hardware.nix diff --git a/hosts/onizuka/users/pan/default.nix b/hosts/onizuka/users/pan/default.nix new file mode 100644 index 0000000..f59b05b --- /dev/null +++ b/hosts/onizuka/users/pan/default.nix @@ -0,0 +1,132 @@ +{ config, pkgs, ... }: + +{ + home.username = "pan"; + nixpkgs.config.allowUnfree = true; + home.stateVersion = "23.05"; + + hypr.enable = true; + hypr.monitor = { + details = [ + "DP-2,2560x1440@144,0x0,1" + "DP-1,2560x1440@144,-2560x0,1" + "HDMI-A-1,disable" + ]; + primary = "DP-2"; + secondary = "DP-1"; + }; + hypr.workspace = { + workspaces = { + "DP-2" = [ + "home" + "web" + "med" + "game" + ]; + "DP-1" = [ + "chat" + ]; + }; + scratchpad.enable = true; + defaults = { + "name:web" = [ "librewolf" ]; + "name:med" = [ "librewolf,title:Picture-in-Picture" ]; + "name:chat" = [ "Beeper" ]; + "name:game" = [ "lutris" "explorer.exe" ]; + }; + }; + windows.opaque = [ + "initialTitle:^(Discord Popout)$" + "class:^(firefox)$" + "class:^(Gimp)$" + "class:^(feh)$" + "class:^(mpv)$" + ]; + hypr.background = { + enable = true; + path = "${config.home.homeDirectory}/med/pix/bg.png"; + }; + hypr.cursor = { + enable = true; + theme = "miku"; + }; + hypr = { + screenshot.enable = true; + mouse.sensitivity = -0.52; + polkit.enable = true; + master.mfact = 0.53; + xwayland.videobridge.enable = true; + }; + ags.enable = true; + rofi.enable = true; + + timer.enableHourly = true; + timer.enableQuarterly = true; + colors.enable = true; + manpages.enable = true; + trash.enable = true; + + fish.enable = true; + kitty.enable = true; + kitty.make_default = true; + kitty.font = "Cascadia Code"; + git.enable = true; + git.username = "Julia Lange"; + git.email = "public@julialange.org"; + ssh.enable = true; + librewolf.enable = true; + librewolf.make_default = true; + + mpv.enable = true; + zathura.enable = true; + feh.enable = true; + + neovim.enable = true; + neovim.languages = { + c.enable = true; + nix.enable = true; + rust.enable = true; + }; + neovim.plugins = { + comments.enable = true; + fugitive.enable = true; + lualine.enable = true; + luasnip.enable = true; + nvimcmp.enable = true; + telescope = { + enable = true; + fzf.enable = true; + }; + treesitter.enable = true; + wiki.enable = true; + }; + + lf.enable = true; + lf.hiddenfiles = [ + "${config.home.homeDirectory}/.librewolf" + "${config.home.homeDirectory}/.nix-defexpr" + "${config.home.homeDirectory}/.nix-profile" + "${config.home.homeDirectory}/.nv" + "${config.home.homeDirectory}/.pki" + "${config.home.homeDirectory}/.steam*" + "${config.home.homeDirectory}/.zshenv" + ]; + zoxide.enable = true; + + gimp.enable = true; + + beeper.enable = true; + discord.enable = true; + + lutris.enable = true; + + extraPkgs = with pkgs; [ + # Applications + ani-cli # Easy anime player + lutgen # LUT generator + prismlauncher # Minecraft launcher + jdk8 # For playing older minecraft + gnucash # Personal Finance Manager + zoom-us # Zoom + ]; +}