diff options
author | Zhongheng Liu <z.liu@outlook.com.gr> | 2024-08-01 18:05:58 +0800 |
---|---|---|
committer | Zhongheng Liu <z.liu@outlook.com.gr> | 2024-08-01 18:05:58 +0800 |
commit | 4fe4ebefc87d0fb0be6f16d66f13d0334a55988d (patch) | |
tree | e2fd7eba8192b6d2c9776d755e41d21d6b1f0bb8 | |
parent | 0770a70d0bb4899cc2496662482ec20b0b6588c5 (diff) | |
download | nixos-configuration-4fe4ebefc87d0fb0be6f16d66f13d0334a55988d.tar.gz nixos-configuration-4fe4ebefc87d0fb0be6f16d66f13d0334a55988d.tar.bz2 nixos-configuration-4fe4ebefc87d0fb0be6f16d66f13d0334a55988d.zip |
feat: decent shell configuration with starship and zsh
direnv and devenv integrated support
experimental nginx test configuration
sway and foot configuration updated
created initial sddm configuration for login manager
-rw-r--r-- | home-manager/stvnliu/home.nix | 10 | ||||
-rw-r--r-- | home-manager/stvnliu/shells/aliases/default.nix | 10 | ||||
-rw-r--r-- | home-manager/stvnliu/shells/default.nix | 28 | ||||
-rw-r--r-- | home-manager/stvnliu/shells/direnv.nix | 8 | ||||
-rw-r--r-- | home-manager/stvnliu/shells/starship/default.nix | 24 | ||||
-rw-r--r-- | home-manager/stvnliu/shells/starship/presets/default.toml | 172 | ||||
-rw-r--r-- | home-manager/stvnliu/shells/starship/presets/without-direnv.toml | 167 | ||||
-rw-r--r-- | home-manager/stvnliu/shells/zsh.nix | 36 | ||||
-rw-r--r-- | home-manager/stvnliu/swaywm.nix | 10 | ||||
-rw-r--r-- | nixos/configuration.nix | 19 | ||||
-rw-r--r-- | nixos/fonts.nix | 29 | ||||
-rw-r--r-- | nixos/greetd-sway.nix | 10 | ||||
-rw-r--r-- | nixos/nvidia.nix | 4 | ||||
-rw-r--r-- | nixos/services/nginx.service.nix | 6 |
14 files changed, 529 insertions, 4 deletions
diff --git a/home-manager/stvnliu/home.nix b/home-manager/stvnliu/home.nix index 6146457..90ee63c 100644 --- a/home-manager/stvnliu/home.nix +++ b/home-manager/stvnliu/home.nix @@ -1,4 +1,4 @@ -# This is your home-manager configuration file +#his is your home-manager configuration file # Use this to configure your home environment (it replaces ~/.config/nixpkgs/home.nix) { inputs, @@ -18,7 +18,8 @@ in # inputs.nix-colors.homeManagerModule # You can also split up your configuration and import pieces of it here: -# ./nvim.nix + ./swaywm.nix + ./shells ]; nixpkgs = { @@ -48,7 +49,10 @@ in homeDirectory = "/home/${myUserName}"; }; programs.neovim.enable = true; - home.packages = with pkgs; [ protonvpn-gui ]; + home.packages = with pkgs; [ + protonvpn-gui + devenv + ]; programs.home-manager.enable = true; programs.git.enable = true; programs.firefox.enable = true; diff --git a/home-manager/stvnliu/shells/aliases/default.nix b/home-manager/stvnliu/shells/aliases/default.nix new file mode 100644 index 0000000..b974333 --- /dev/null +++ b/home-manager/stvnliu/shells/aliases/default.nix @@ -0,0 +1,10 @@ +{pkgs}: { + cd = "z"; + cdi = "zi"; + ls = "${pkgs.eza}/bin/exa"; + cat = "${pkgs.bat}/bin/bat"; + ll = "ls -l"; + osupdate = "${pkgs.nh}/bin/nh os switch"; + homeupdate = "${pkgs.nh}/bin/nh home switch"; + batmon = "watch -n0 upower -i /org/freedesktop/UPower/devices/battery_BAT1"; +} diff --git a/home-manager/stvnliu/shells/default.nix b/home-manager/stvnliu/shells/default.nix new file mode 100644 index 0000000..a5f14f9 --- /dev/null +++ b/home-manager/stvnliu/shells/default.nix @@ -0,0 +1,28 @@ +{ + pkgs, + lib, + config, + ... +}: let + cfg = config.myShells; +in + with lib; { + imports = [ + ./zsh.nix + ./direnv.nix + ./starship + ]; + options.myShells = { + enable = mkEnableOption "Enables the shell customisation module."; + useZsh = mkOption { + type = types.bool; + default = true; + }; + }; + config = mkIf cfg.enable { + myShells = { + zsh.enable = cfg.useZsh; + prompts.starship.enable = true; + }; + }; + } diff --git a/home-manager/stvnliu/shells/direnv.nix b/home-manager/stvnliu/shells/direnv.nix new file mode 100644 index 0000000..dd5b52f --- /dev/null +++ b/home-manager/stvnliu/shells/direnv.nix @@ -0,0 +1,8 @@ +{...}: { + programs = { + direnv = { + enable = true; + nix-direnv.enable = true; + }; + }; +} diff --git a/home-manager/stvnliu/shells/starship/default.nix b/home-manager/stvnliu/shells/starship/default.nix new file mode 100644 index 0000000..f53766a --- /dev/null +++ b/home-manager/stvnliu/shells/starship/default.nix @@ -0,0 +1,24 @@ +{ + lib, + pkgs, + config, + ... +}: let + cfg = config.myShells.prompts.starship; +in + with lib; { + options = { + myShells.prompts.starship.enable = mkEnableOption "Enables starship prompts."; + myShells.prompts.starship.confPath = mkOption { + type = types.path; + default = ./presets/default.toml; + }; + }; + config = { + programs.starship = { + enable = true; + enableZshIntegration = true; + settings = builtins.fromTOML (builtins.readFile cfg.confPath); + }; + }; + } diff --git a/home-manager/stvnliu/shells/starship/presets/default.toml b/home-manager/stvnliu/shells/starship/presets/default.toml new file mode 100644 index 0000000..658f60e --- /dev/null +++ b/home-manager/stvnliu/shells/starship/presets/default.toml @@ -0,0 +1,172 @@ +"$schema" = 'https://starship.rs/config-schema.json' + +format = """ +$direnv[](color_orange)\ +$os\ +$username\ +[](bg:color_yellow fg:color_orange)\ +$directory\ +[](fg:color_yellow bg:color_aqua)\ +$git_branch\ +$git_status\ +[](fg:color_aqua bg:color_blue)\ +$c\ +$rust\ +$golang\ +$nodejs\ +$php\ +$java\ +$kotlin\ +$haskell\ +$python\ +[](fg:color_blue bg:color_bg3)\ +$docker_context\ +$conda\ +[](fg:color_bg3 bg:color_bg1)\ +$time\ +[ ](fg:color_bg1)\ +$line_break$character""" + +palette = 'gruvbox_dark' + +[palettes.gruvbox_dark] +color_fg0 = '#fbf1c7' +color_bg1 = '#3c3836' +color_bg3 = '#665c54' +color_blue = '#458588' +color_aqua = '#689d6a' +color_green = '#98971a' +color_orange = '#d65d0e' +color_purple = '#b16286' +color_red = '#cc241d' +color_yellow = '#d79921' + +[os] +disabled = false +style = "bg:color_orange fg:color_fg0" + +[os.symbols] +Windows = "" +Ubuntu = "" +SUSE = "" +Raspbian = "" +Mint = "" +Macos = "" +Manjaro = "" +Linux = "" +Gentoo = "" +Fedora = "" +Alpine = "" +Amazon = "" +Android = "" +Arch = "" +Artix = "" +CentOS = "" +Debian = "" +Redhat = "" +RedHatEnterprise = "" + +[direnv] +disabled = false +#command = '[[ $(direnv status) =~ "Found RC allowed false" ]] && echo "=========> missing: direnv allow <============"' # shows output of command +detect_files = ['.envrc'] # can specify filters but wildcards are not supported + +[username] +show_always = true +style_user = "bg:color_orange fg:color_fg0" +style_root = "bg:color_orange fg:color_fg0" +format = '[ $user ]($style)' + +[directory] +style = "fg:color_fg0 bg:color_yellow" +format = "[ $path ]($style)" +truncation_length = 3 +truncation_symbol = "…/" + +[directory.substitutions] +"Documents" = " " +"Downloads" = " " +"Music" = " " +"Pictures" = " " +"Developer" = " " + +[git_branch] +symbol = "" +style = "bg:color_aqua" +format = '[[ $symbol $branch ](fg:color_fg0 bg:color_aqua)]($style)' + +[git_status] +style = "bg:color_aqua" +format = '[[($all_status$ahead_behind )](fg:color_fg0 bg:color_aqua)]($style)' + +[nodejs] +symbol = "" +style = "bg:color_blue" +format = '[[ $symbol( $version) ](fg:color_fg0 bg:color_blue)]($style)' + +[c] +symbol = " " +style = "bg:color_blue" +format = '[[ $symbol( $version) ](fg:color_fg0 bg:color_blue)]($style)' + +[rust] +symbol = "" +style = "bg:color_blue" +format = '[[ $symbol( $version) ](fg:color_fg0 bg:color_blue)]($style)' + +[golang] +symbol = "" +style = "bg:color_blue" +format = '[[ $symbol( $version) ](fg:color_fg0 bg:color_blue)]($style)' + +[php] +symbol = "" +style = "bg:color_blue" +format = '[[ $symbol( $version) ](fg:color_fg0 bg:color_blue)]($style)' + +[java] +symbol = " " +style = "bg:color_blue" +format = '[[ $symbol( $version) ](fg:color_fg0 bg:color_blue)]($style)' + +[kotlin] +symbol = "" +style = "bg:color_blue" +format = '[[ $symbol( $version) ](fg:color_fg0 bg:color_blue)]($style)' + +[haskell] +symbol = "" +style = "bg:color_blue" +format = '[[ $symbol( $version) ](fg:color_fg0 bg:color_blue)]($style)' + +[python] +symbol = "" +style = "bg:color_blue" +format = '[[ $symbol( $version) ](fg:color_fg0 bg:color_blue)]($style)' + +[docker_context] +symbol = "" +style = "bg:color_bg3" +format = '[[ $symbol( $context) ](fg:#83a598 bg:color_bg3)]($style)' + +[conda] +style = "bg:color_bg3" +format = '[[ $symbol( $environment) ](fg:#83a598 bg:color_bg3)]($style)' + +[time] +disabled = false +time_format = "%R" +style = "bg:color_bg1" +format = '[[ $time ](fg:color_fg0 bg:color_bg1)]($style)' + +[line_break] +disabled = false + +[character] +disabled = false +success_symbol = '[](bold fg:color_green)' +error_symbol = '[](bold fg:color_red)' +vimcmd_symbol = '[](bold fg:color_green)' +vimcmd_replace_one_symbol = '[](bold fg:color_purple)' +vimcmd_replace_symbol = '[](bold fg:color_purple)' +vimcmd_visual_symbol = '[](bold fg:color_yellow)' diff --git a/home-manager/stvnliu/shells/starship/presets/without-direnv.toml b/home-manager/stvnliu/shells/starship/presets/without-direnv.toml new file mode 100644 index 0000000..aee6704 --- /dev/null +++ b/home-manager/stvnliu/shells/starship/presets/without-direnv.toml @@ -0,0 +1,167 @@ +"$schema" = 'https://starship.rs/config-schema.json' + +format = """ +[](color_orange)\ +$os\ +$username\ +[](bg:color_yellow fg:color_orange)\ +$directory\ +[](fg:color_yellow bg:color_aqua)\ +$git_branch\ +$git_status\ +[](fg:color_aqua bg:color_blue)\ +$c\ +$rust\ +$golang\ +$nodejs\ +$php\ +$java\ +$kotlin\ +$haskell\ +$python\ +[](fg:color_blue bg:color_bg3)\ +$docker_context\ +$conda\ +[](fg:color_bg3 bg:color_bg1)\ +$time\ +[ ](fg:color_bg1)\ +$line_break$character""" + +palette = 'gruvbox_dark' + +[palettes.gruvbox_dark] +color_fg0 = '#fbf1c7' +color_bg1 = '#3c3836' +color_bg3 = '#665c54' +color_blue = '#458588' +color_aqua = '#689d6a' +color_green = '#98971a' +color_orange = '#d65d0e' +color_purple = '#b16286' +color_red = '#cc241d' +color_yellow = '#d79921' + +[os] +disabled = false +style = "bg:color_orange fg:color_fg0" + +[os.symbols] +Windows = "" +Ubuntu = "" +SUSE = "" +Raspbian = "" +Mint = "" +Macos = "" +Manjaro = "" +Linux = "" +Gentoo = "" +Fedora = "" +Alpine = "" +Amazon = "" +Android = "" +Arch = "" +Artix = "" +CentOS = "" +Debian = "" +Redhat = "" +RedHatEnterprise = "" + +[username] +show_always = true +style_user = "bg:color_orange fg:color_fg0" +style_root = "bg:color_orange fg:color_fg0" +format = '[ $user ]($style)' + +[directory] +style = "fg:color_fg0 bg:color_yellow" +format = "[ $path ]($style)" +truncation_length = 3 +truncation_symbol = "…/" + +[directory.substitutions] +"Documents" = " " +"Downloads" = " " +"Music" = " " +"Pictures" = " " +"Developer" = " " + +[git_branch] +symbol = "" +style = "bg:color_aqua" +format = '[[ $symbol $branch ](fg:color_fg0 bg:color_aqua)]($style)' + +[git_status] +style = "bg:color_aqua" +format = '[[($all_status$ahead_behind )](fg:color_fg0 bg:color_aqua)]($style)' + +[nodejs] +symbol = "" +style = "bg:color_blue" +format = '[[ $symbol( $version) ](fg:color_fg0 bg:color_blue)]($style)' + +[c] +symbol = " " +style = "bg:color_blue" +format = '[[ $symbol( $version) ](fg:color_fg0 bg:color_blue)]($style)' + +[rust] +symbol = "" +style = "bg:color_blue" +format = '[[ $symbol( $version) ](fg:color_fg0 bg:color_blue)]($style)' + +[golang] +symbol = "" +style = "bg:color_blue" +format = '[[ $symbol( $version) ](fg:color_fg0 bg:color_blue)]($style)' + +[php] +symbol = "" +style = "bg:color_blue" +format = '[[ $symbol( $version) ](fg:color_fg0 bg:color_blue)]($style)' + +[java] +symbol = " " +style = "bg:color_blue" +format = '[[ $symbol( $version) ](fg:color_fg0 bg:color_blue)]($style)' + +[kotlin] +symbol = "" +style = "bg:color_blue" +format = '[[ $symbol( $version) ](fg:color_fg0 bg:color_blue)]($style)' + +[haskell] +symbol = "" +style = "bg:color_blue" +format = '[[ $symbol( $version) ](fg:color_fg0 bg:color_blue)]($style)' + +[python] +symbol = "" +style = "bg:color_blue" +format = '[[ $symbol( $version) ](fg:color_fg0 bg:color_blue)]($style)' + +[docker_context] +symbol = "" +style = "bg:color_bg3" +format = '[[ $symbol( $context) ](fg:#83a598 bg:color_bg3)]($style)' + +[conda] +style = "bg:color_bg3" +format = '[[ $symbol( $environment) ](fg:#83a598 bg:color_bg3)]($style)' + +[time] +disabled = false +time_format = "%R" +style = "bg:color_bg1" +format = '[[ $time ](fg:color_fg0 bg:color_bg1)]($style)' + +[line_break] +disabled = false + +[character] +disabled = false +success_symbol = '[](bold fg:color_green)' +error_symbol = '[](bold fg:color_red)' +vimcmd_symbol = '[](bold fg:color_green)' +vimcmd_replace_one_symbol = '[](bold fg:color_purple)' +vimcmd_replace_symbol = '[](bold fg:color_purple)' +vimcmd_visual_symbol = '[](bold fg:color_yellow)' diff --git a/home-manager/stvnliu/shells/zsh.nix b/home-manager/stvnliu/shells/zsh.nix new file mode 100644 index 0000000..c329684 --- /dev/null +++ b/home-manager/stvnliu/shells/zsh.nix @@ -0,0 +1,36 @@ +{ + pkgs, + lib, + config, + ... +}: let + cfg = config.shell.zsh; +in + with lib; { + options.myShells.zsh = { + enable = mkEnableOption "Enables zsh and components."; + }; + config = { + programs.zsh = { + enable = true; + syntaxHighlighting.enable = true; + shellAliases = import ./aliases {inherit pkgs;}; + dirHashes = { + docs = "$HOME/Documents"; + dl = "$HOME/Downloads"; + dev = "$HOME/devel"; + screen = "$HOME/Pictures/Screenshots"; + }; + oh-my-zsh = { + enable = true; + plugins = [ + "git" + "rsync" + "zoxide" + ]; + theme = "agnoster"; + }; + }; + home.packages = with pkgs; [zoxide]; + }; + } diff --git a/home-manager/stvnliu/swaywm.nix b/home-manager/stvnliu/swaywm.nix new file mode 100644 index 0000000..d7f36e0 --- /dev/null +++ b/home-manager/stvnliu/swaywm.nix @@ -0,0 +1,10 @@ +{pkgs, lib, ...}: +{ + wayland.windowManager.sway = { + enable = true; + config = rec { + modifier = "Mod4"; + terminal = "${pkgs.foot}/bin/foot -f 'BlexMono Nerd Font:size=24' zsh"; + }; + }; +} diff --git a/nixos/configuration.nix b/nixos/configuration.nix index dde33e1..bfed15f 100644 --- a/nixos/configuration.nix +++ b/nixos/configuration.nix @@ -10,7 +10,10 @@ { imports = [ ./variables.nix - ./nvidia.nix + #./greetd-sway.nix + #./nvidia.nix + ./fonts.nix + ./services/nginx.service.nix ./hardware-configuration.nix ]; boot.loader = { @@ -31,6 +34,18 @@ ''; }; }; + services.displayManager.sddm = { + enable = true; + wayland.enable = true; + }; + systemd.user.services.kanshi = { + description = "kanshi daemon"; + serviceConfig = { + Type = "simple"; + ExecStart = ''${pkgs.kanshi}/bin/kanshi -c kanshi_config_file''; + }; + }; + security.polkit.enable = true; services.gnome.gnome-keyring.enable = true; programs.sway = { @@ -53,6 +68,7 @@ flake-registry = ""; nix-path = config.nix.nixPath; }; + channel.enable = false; registry = lib.mapAttrs (_: flake: {inherit flake;}) flakeInputs; nixPath = lib.mapAttrsToList (n: _: "${n}=flake:${n}") flakeInputs; }; @@ -79,6 +95,7 @@ PasswordAuthentication = false; }; }; + services.automatic-timezoned.enable = true; # https://nixos.wiki/wiki/FAQ/When_do_I_update_stateVersion system.stateVersion = "24.05"; } diff --git a/nixos/fonts.nix b/nixos/fonts.nix new file mode 100644 index 0000000..968b101 --- /dev/null +++ b/nixos/fonts.nix @@ -0,0 +1,29 @@ +{pkgs, ...}: { + fonts.packages = with pkgs; [ + #helvetica-neue-lt-std + aileron + #corefonts + #vistafonts + #vistafonts-chs + noto-fonts + #noto-fonts-cjk + noto-fonts-emoji + #liberation_ttf + #mplus-outline-fonts.githubRelease + #dina-font + #proggyfonts + #glasstty-ttf + ( + nerdfonts.override { + fonts = [ + "FiraCode" + "IBMPlexMono" + #"IntelOneMono" + #"CascadiaMono" + #"CommitMono" + #"JetBrainsMono" + ]; + } + ) + ]; +} diff --git a/nixos/greetd-sway.nix b/nixos/greetd-sway.nix new file mode 100644 index 0000000..2177c38 --- /dev/null +++ b/nixos/greetd-sway.nix @@ -0,0 +1,10 @@ +{pkgs, config, lib, ...}: { + services.greetd = { + enable = true; + settings = { + default_session = { + command = "${pkgs.sway}/bin/sway"; + }; + }; + }; +} diff --git a/nixos/nvidia.nix b/nixos/nvidia.nix index e75a77a..6615468 100644 --- a/nixos/nvidia.nix +++ b/nixos/nvidia.nix @@ -14,6 +14,10 @@ }; }; }; + hardware.opengl = { + enable = true; + }; + services.xserver.videoDrivers = [ "nvidia" ]; hardware.nvidia = { prime = { offload.enable = false; diff --git a/nixos/services/nginx.service.nix b/nixos/services/nginx.service.nix new file mode 100644 index 0000000..ae374c7 --- /dev/null +++ b/nixos/services/nginx.service.nix @@ -0,0 +1,6 @@ +{...}: +{ + services.nginx = { + enable = true; + }; +} |