This commit is contained in:
CherryKitten 2024-03-24 19:02:26 +01:00
parent dbef8a31b2
commit 07a07ab45e
Signed by: sammy
GPG key ID: 98D8F75FB0658276
8 changed files with 171 additions and 160 deletions

View file

@ -56,36 +56,3 @@ function fish_prompt
echo -n -s $prompt_host $cwd $pwd $normal $prompt_status $delim echo -n -s $prompt_host $cwd $pwd $normal $prompt_status $delim
end 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

View file

@ -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

View file

@ -8,29 +8,28 @@
}; };
}; };
outputs = inputs @ { outputs =
self, inputs @ { self
nixpkgs, , nixpkgs
nixpkgs-unstable, , nixpkgs-unstable
home-manager, , home-manager
... , ...
}: let }:
system = "x86_64-linux"; {
in {
formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.alejandra; formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.alejandra;
colmena = { colmena = {
meta = { meta = {
nixpkgs = import nixpkgs { nixpkgs = import nixpkgs {
system = "x86_64-linux"; system = "x86_64-linux";
overlays = []; overlays = [ ];
}; };
}; };
bengal = { bengal =
name, { name
nodes, , nodes
pkgs, , pkgs
... , ...
}: { }: {
imports = [ imports = [
./hosts/${name}/configuration.nix ./hosts/${name}/configuration.nix
@ -44,11 +43,11 @@
}; };
}; };
maine-coon = { maine-coon =
name, { name
nodes, , nodes
pkgs, , pkgs
... , ...
}: { }: {
imports = [ imports = [
./hosts/${name}/configuration.nix ./hosts/${name}/configuration.nix
@ -62,7 +61,6 @@
}; };
}; };
nixosConfigurations.test = nixpkgs.lib.nixosSystem { nixosConfigurations.test = nixpkgs.lib.nixosSystem {
inherit system;
modules = [ modules = [
./hosts/test-vm/configuration.nix ./hosts/test-vm/configuration.nix
(import "${home-manager}/nixos") (import "${home-manager}/nixos")

10
misc/module-template.nix Normal file
View file

@ -0,0 +1,10 @@
{ pkgs, config, lib, ... }:
let
cfg = config.cherrykitten;
in
{
options.cherrykitten = { };
config = { };
}

View file

@ -7,7 +7,7 @@
cfg = config.cherrykitten.common; cfg = config.cherrykitten.common;
in { in {
imports = [ imports = [
../users ./users.nix
./security.nix ./security.nix
./yubikey.nix ./yubikey.nix
../graphical ../graphical

75
modules/common/users.nix Normal file
View file

@ -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";
};
};
};
}

View file

@ -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 ];
};
}

View file

@ -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";
};
}