diff --git a/modules/fish/fish_prompt.fish b/files/config/fish/functions/fish_prompt.fish similarity index 66% rename from modules/fish/fish_prompt.fish rename to files/config/fish/functions/fish_prompt.fish index 8da59d8..9371047 100644 --- a/modules/fish/fish_prompt.fish +++ b/files/config/fish/functions/fish_prompt.fish @@ -56,36 +56,3 @@ function fish_prompt echo -n -s $prompt_host $cwd $pwd $normal $prompt_status $delim end - -function fish_right_prompt - set -g __fish_git_prompt_showdirtystate 1 - set -g __fish_git_prompt_showuntrackedfiles 1 - set -g __fish_git_prompt_showupstream informative - set -g __fish_git_prompt_showcolorhints 1 - set -g __fish_git_prompt_use_informative_chars 1 - # Unfortunately this only works if we have a sensible locale - string match -qi "*.utf-8" -- $LANG $LC_CTYPE $LC_ALL - and set -g __fish_git_prompt_char_dirtystate \U1F4a9 - set -g __fish_git_prompt_char_untrackedfiles "?" - - # The git prompt's default format is ' (%s)'. - # We don't want the leading space. - set -l vcs (fish_vcs_prompt '(%s)' 2>/dev/null) - - set -l d (set_color brgrey)(date "+%R")(set_color normal) - - set -l duration "$cmd_duration$CMD_DURATION" - if test $duration -gt 100 - set duration (math $duration / 1000)s - else - set duration - end - - set -q VIRTUAL_ENV_DISABLE_PROMPT - or set -g VIRTUAL_ENV_DISABLE_PROMPT true - set -q VIRTUAL_ENV - and set -l venv (string replace -r '.*/' '' -- "$VIRTUAL_ENV") - - set_color normal - string join " " -- $venv $duration $vcs $d -end diff --git a/files/config/fish/functions/fish_right_prompt.fish b/files/config/fish/functions/fish_right_prompt.fish new file mode 100644 index 0000000..812880a --- /dev/null +++ b/files/config/fish/functions/fish_right_prompt.fish @@ -0,0 +1,32 @@ +function fish_right_prompt + set -g __fish_git_prompt_showdirtystate 1 + set -g __fish_git_prompt_showuntrackedfiles 1 + set -g __fish_git_prompt_showupstream informative + set -g __fish_git_prompt_showcolorhints 1 + set -g __fish_git_prompt_use_informative_chars 1 + # Unfortunately this only works if we have a sensible locale + string match -qi "*.utf-8" -- $LANG $LC_CTYPE $LC_ALL + and set -g __fish_git_prompt_char_dirtystate \U1F4a9 + set -g __fish_git_prompt_char_untrackedfiles "?" + + # The git prompt's default format is ' (%s)'. + # We don't want the leading space. + set -l vcs (fish_vcs_prompt '(%s)' 2>/dev/null) + + set -l d (set_color brgrey)(date "+%R")(set_color normal) + + set -l duration "$cmd_duration$CMD_DURATION" + if test $duration -gt 100 + set duration (math $duration / 1000)s + else + set duration + end + + set -q VIRTUAL_ENV_DISABLE_PROMPT + or set -g VIRTUAL_ENV_DISABLE_PROMPT true + set -q VIRTUAL_ENV + and set -l venv (string replace -r '.*/' '' -- "$VIRTUAL_ENV") + + set_color normal + string join " " -- $venv $duration $vcs $d +end diff --git a/flake.nix b/flake.nix index 46ad1ba..b770ae3 100644 --- a/flake.nix +++ b/flake.nix @@ -8,65 +8,63 @@ }; }; - outputs = inputs @ { - self, - nixpkgs, - nixpkgs-unstable, - home-manager, - ... - }: let - system = "x86_64-linux"; - in { - formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.alejandra; - colmena = { - meta = { - nixpkgs = import nixpkgs { - system = "x86_64-linux"; - overlays = []; + outputs = + inputs @ { self + , nixpkgs + , nixpkgs-unstable + , home-manager + , ... + }: + { + formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.alejandra; + colmena = { + meta = { + nixpkgs = import nixpkgs { + system = "x86_64-linux"; + overlays = [ ]; + }; }; - }; - bengal = { - name, - nodes, - pkgs, - ... - }: { - imports = [ - ./hosts/${name}/configuration.nix - ./modules/common + bengal = + { name + , nodes + , pkgs + , ... + }: { + imports = [ + ./hosts/${name}/configuration.nix + ./modules/common + (import "${home-manager}/nixos") + ]; + + deployment = { + targetUser = "sammy"; + allowLocalDeployment = true; + }; + }; + + maine-coon = + { name + , nodes + , pkgs + , ... + }: { + imports = [ + ./hosts/${name}/configuration.nix + ./modules/common + (import "${home-manager}/nixos") + ]; + deployment = { + targetHost = "maine-coon"; + allowLocalDeployment = true; + }; + }; + }; + nixosConfigurations.test = nixpkgs.lib.nixosSystem { + modules = [ + ./hosts/test-vm/configuration.nix (import "${home-manager}/nixos") ]; - - deployment = { - targetUser = "sammy"; - allowLocalDeployment = true; - }; - }; - - maine-coon = { - name, - nodes, - pkgs, - ... - }: { - imports = [ - ./hosts/${name}/configuration.nix - ./modules/common - (import "${home-manager}/nixos") - ]; - deployment = { - targetHost = "maine-coon"; - allowLocalDeployment = true; - }; }; }; - nixosConfigurations.test = nixpkgs.lib.nixosSystem { - inherit system; - modules = [ - ./hosts/test-vm/configuration.nix - (import "${home-manager}/nixos") - ]; - }; - }; } diff --git a/misc/module-template.nix b/misc/module-template.nix new file mode 100644 index 0000000..614920a --- /dev/null +++ b/misc/module-template.nix @@ -0,0 +1,10 @@ +{ pkgs, config, lib, ... }: +let + cfg = config.cherrykitten; +in +{ + + options.cherrykitten = { }; + + config = { }; +} diff --git a/modules/common/default.nix b/modules/common/default.nix index 67b1f1e..6596825 100644 --- a/modules/common/default.nix +++ b/modules/common/default.nix @@ -7,7 +7,7 @@ cfg = config.cherrykitten.common; in { imports = [ - ../users + ./users.nix ./security.nix ./yubikey.nix ../graphical diff --git a/modules/common/users.nix b/modules/common/users.nix new file mode 100644 index 0000000..483c0f2 --- /dev/null +++ b/modules/common/users.nix @@ -0,0 +1,75 @@ +{ lib +, pkgs +, config +, ... +}: +let + cfg = config.cherrykitten; +in +{ + + options.cherrykitten.users = { }; + + config = { + users.users = { + sammy = { + isNormalUser = true; + extraGroups = [ "networkmanager" "wheel" "docker" ]; + shell = pkgs.fish; + ignoreShellProgramCheck = true; + openssh.authorizedKeys.keys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJZyQSZw+pExsx2RXB+yxbaJGB9mtvudbQ/BP7E1yKvr openpgp:0x6068FEBB" ]; + }; + }; + + home-manager.users.sammy = { + imports = [ ../nvim ]; + home.username = "sammy"; + home.homeDirectory = "/home/sammy"; + home.stateVersion = "23.11"; # Please read the comment before changing. + home.packages = with pkgs; [ + bat + lsd + gnupg + tmux + colmena + ]; + + programs = { + home-manager.enable = true; + + git = { + enable = true; + userName = "CherryKitten"; + userEmail = "git@cherrykitten.dev"; + signing.key = "0xC01A7CBBA617BD5F"; + signing.signByDefault = true; + extraConfig = { + init = { defaultBranch = "main"; }; + core = { editor = "nvim"; }; + pull.rebase = true; + }; + }; + + fish = { + enable = true; + functions = { }; + }; + }; + + home.file = { + fish_prompt = { + source = ../../files/config/fish/functions/fish_prompt.fish; + target = ".config/fish/functions/fish_prompt.fish"; + }; + fish_right_prompt = { + source = ../../files/config/fish/functions/fish_right_prompt.fish; + target = ".config/fish/functions/fish_right_prompt.fish"; + }; + }; + + home.sessionVariables = { + EDITOR = "nvim"; + }; + }; + }; +} diff --git a/modules/users/default.nix b/modules/users/default.nix deleted file mode 100644 index 2607440..0000000 --- a/modules/users/default.nix +++ /dev/null @@ -1,20 +0,0 @@ -{ lib -, config -, pkgs -, ... -}: { - users.users = { - sammy = { - isNormalUser = true; - extraGroups = [ "networkmanager" "wheel" "docker" ]; - shell = pkgs.fish; - ignoreShellProgramCheck = true; - openssh.authorizedKeys.keys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJZyQSZw+pExsx2RXB+yxbaJGB9mtvudbQ/BP7E1yKvr openpgp:0x6068FEBB" ]; - }; - }; - - home-manager.useUserPackages = true; - home-manager.users = { - sammy.imports = [ ./sammy.nix ]; - }; -} diff --git a/modules/users/sammy.nix b/modules/users/sammy.nix deleted file mode 100644 index 92423b7..0000000 --- a/modules/users/sammy.nix +++ /dev/null @@ -1,51 +0,0 @@ -{ - lib, - config, - pkgs, - ... -}: { - imports = [../nvim]; - home.username = "sammy"; - home.homeDirectory = "/home/sammy"; - home.stateVersion = "23.11"; # Please read the comment before changing. - home.packages = with pkgs; [ - bat - lsd - gnupg - tmux - colmena - ]; - - programs = { - home-manager.enable = true; - - git = { - enable = true; - userName = "CherryKitten"; - userEmail = "git@cherrykitten.dev"; - signing.key = "0xC01A7CBBA617BD5F"; - signing.signByDefault = true; - extraConfig = { - init = {defaultBranch = "main";}; - core = {editor = "nvim";}; - pull.rebase = true; - }; - }; - - fish = { - enable = true; - functions = {}; - }; - }; - - home.file = { - fish_prompt = { - source = ../fish/fish_prompt.fish; - target = ".config/fish/functions/fish_prompt.fish"; - }; - }; - - home.sessionVariables = { - EDITOR = "nvim"; - }; -}