Current derivation

This commit is contained in:
Filippo Berto 2021-05-21 22:30:33 +02:00
parent 0aae761f89
commit f7226d5fa6
20 changed files with 342 additions and 79 deletions

View file

@ -1 +1,4 @@
{ allowUnfree = true; }
{
allowUnfree = true;
allowUnsupportedSystem = true;
}

98
extralib.nix Normal file
View file

@ -0,0 +1,98 @@
{ lib ? (import <nixpkgs> {}).lib, ... }:
with lib;
with builtins;
{
lib = {
floats = rec {
_floatComponents = f: lib.strings.splitString "." (toString f);
ceil = f:
let
comp = _floatComponents f;
int = strings.toInt (head comp);
inc = if match "[1-9][[:digit:]]*" (head (tail comp)) != null then 1 else 0;
in
assert(isFloat f);
int + inc;
floor = f:
let
int = strings.toInt (head (_floatComponents f));
in
assert(isFloat f);
int;
toInt = f:
let
comp = _floatComponents f;
int = strings.toInt (head comp);
inc = if match "[5-9][[:digit:]]*" (head (tail comp)) != null then 1 else 0;
in
assert(isFloat f);
int + inc;
};
hex = rec {
parseDigit = c:
let
v = strings.toUpper c;
in
assert(match "[0-9A-F]" c != null);
{
"0" = 0;
"1" = 1;
"2" = 2;
"3" = 3;
"4" = 4;
"5" = 5;
"6" = 6;
"7" = 7;
"8" = 8;
"9" = 9;
"A" = 10;
"B" = 11;
"C" = 12;
"D" = 13;
"E" = 14;
"F" = 15;
}."${v}";
toDec = s:
let characters = stringToCharacters s;
values = map parseDigit characters;
value = foldl (acc: n: acc * 16 + n) 0 values;
in value;
fromDec = trivial.toHexString;
};
# colors = rec {
# colorFromHex = s:
# let rgba = match "#([[:xdigit:]]{2})([[:xdigit:]]{2})([[:xdigit:]]{2})([[:xdigit:]]{2})" s;
# rgb = match "#([[:xdigit:]]{2})([[:xdigit:]]{2})([[:xdigit:]]{2})" s;
# values = map hexToDec (if isNull rgb then rgba else rgb ++ [ "FF" ]);
# in {
# r = (head values) / 255.0;
# g = (head (tail values)) / 255.0;
# b = (head (drop 2 values)) / 255.0;
# a = (last values) / 255.0;
# };
# red = { r = 255.0; g = 0.0; b = 0.0; };
# green = { r = 0.0; g = 255.0; b = 0.0; };
# blue = { r = 0.0; g = 0.0; b = 255.0; };
# toRGBHex = { r, g, b, ... }:
# ''#${concatMapStrings (v: fixedWidthString 2 "0" (toHexString (v * 255))) [ r g b ]}'';
# toRGBAHex = { r, g, b, a }:
# ''#${concatMapStrings (v: fixedWidthString 2 "0" (toHexString v)) [ r g b a ]}'';
# toRgbHex = c: strings.toLower (toRGBHex c);
# toRgbaHex = c: strings.toLower (toRGBAHex c);
# };
};
}

View file

@ -13,34 +13,50 @@ in {
keyboard.layout = "it";
keyboard.options = ["terminate:ctrl_alt_bksp" "compose:rctrl"];
packages = (with pkgs; [
htop
neofetch
discord
evolutionWithPlugins
evolution
firefox
gallery-dl
gnome3.evince
gnome3.file-roller
gnome3.nautilus
gnome3.gnome-screenshot
gnome3.gnome-tweaks
htop
jetbrains.datagrip
lutris
megasync
mpv
libreoffice-fresh
neofetch
nerdfonts
obsidian
openvpn
pavucontrol
pcmanfm
polybarFull
procps-ng
shotwell
skypeforlinux
slack
spotify
teams
steam
wireguard
]) ++ (with nixpkgs; [
authy
keepassxc
tdesktop
teams
]);
};
imports = [
# ./extralib.nix
./modules/configurations.nix
./modules/alacritty.nix
./modules/bash.nix
./modules/bat.nix
./modules/broot.nix
./modules/bottom.nix
@ -50,13 +66,23 @@ in {
./modules/git.nix
./modules/go.nix
./modules/gpg.nix
./modules/info.nix
./modules/jq.nix
./modules/kakoune.nix
./modules/keychain.nix
./modules/man.nix
# ./modules/nix-index.nix
./modules/noti.nix
./modules/obs-studio.nix
./modules/pazi.nix
./modules/picom.nix
./modules/qogir_theme.nix
./modules/rofi.nix
./modules/ssh.nix
./modules/screen_locker.nix
./modules/sxhkd.nix
./modules/terminator.nix
./modules/tmux.nix
];
programs = {

View file

@ -48,7 +48,7 @@ in {
};
};
normal = {
black = nord.n1;
black = nord.n0;
red = nord.n11;
green = nord.n14;
yellow = nord.n13;
@ -75,7 +75,7 @@ in {
blue = "#68809a";
magenta = "#8c738c";
cyan = "#6d96a5";
white = "#aeb3bb";
white = nord.n4;
};
};
};

11
modules/bash.nix Normal file
View file

@ -0,0 +1,11 @@
{
programs.bash = {
enable = true;
enableVteIntegration = true;
shellAliases = {
"ll" = "ls -l";
"la" = "ls -la";
".." = "cd ..";
};
};
}

View file

@ -7,6 +7,7 @@ in {
xdg.configFile."bottom/bottom.toml".source = tomlGenerate {
"flags" = {
"left_legend" = true;
"color" = "nord";
};
};
}

View file

@ -0,0 +1,6 @@
{
home.file.".editorconfig" = {
source = ../configs/editorconfig;
target = ".editorconfig";
};
}

5
modules/info.nix Normal file
View file

@ -0,0 +1,5 @@
{
programs.info = {
enable = true;
};
}

5
modules/jq.nix Normal file
View file

@ -0,0 +1,5 @@
{
programs.jq = {
enable = true;
};
}

10
modules/keychain.nix Normal file
View file

@ -0,0 +1,10 @@
{
programs.keychain = {
enable = true;
keys = [ "id_ed25519" "bitbucket" "github" "gitlab" "heroku" "local" ];
agents = [ "gpg" "ssh" ];
enableBashIntegration = true;
enableZshIntegration = true;
enableXsessionIntegration = true;
};
}

5
modules/man.nix Normal file
View file

@ -0,0 +1,5 @@
{
programs.man = {
enable = true;
};
}

7
modules/nix-index.nix Normal file
View file

@ -0,0 +1,7 @@
{
programs.nix-index = {
enable = true;
enableBashIntegration = true;
enableZshIntegration = true;
};
}

5
modules/noti.nix Normal file
View file

@ -0,0 +1,5 @@
{
programs.noti = {
enable = true;
};
}

12
modules/obs-studio.nix Normal file
View file

@ -0,0 +1,12 @@
{ pkgs, ... }:
{
programs.obs-studio = {
enable = true;
plugins = with pkgs; [
# obs-linuxbrowser
obs-v4l2sink
obs-gstreamer
obs-move-transition
];
};
}

7
modules/pazi.nix Normal file
View file

@ -0,0 +1,7 @@
{
programs.pazi = {
enable = true;
enableBashIntegration = true;
enableZshIntegration = true;
};
}

View file

@ -1,14 +1,14 @@
{
programs.rofi = {
enable = true;
# extraConfig = {
# modi = "drun,run,ssh,window";
# theme = "nord";
# };
extraConfig = "
modi = drun,run,ssh,window
theme = nord
";
# # extraConfig = {
# # modi = "drun,run,ssh,window";
# # theme = "nord";
# # };
# extraConfig = "
# modi = drun,run,ssh,window
# theme = nord
# ";
};
xdg.configFile."rofi/nord.rasi".source = ../configs/rofi/nord.rasi;

View file

@ -1,9 +1,9 @@
{ pkgs, ... }:
{
# home.packages = [ pkgs.betterlockscreen ];
home.packages = [ pkgs.betterlockscreen ];
services.screen-locker = {
enable = true;
lockCmd = "/usr/bin/betterlockscreen -l";
inactiveInterval = 5; # miutes
lockCmd = "${pkgs.betterlockscreen}/bin/betterlockscreen -l";
inactiveInterval = 10; # miutes
};
}

46
modules/ssh.nix Normal file
View file

@ -0,0 +1,46 @@
{
programs.ssh = {
enable = true;
compression = true;
matchBlocks = {
"gitlab.com" = {
hostname = "gitlab.com";
identityFile = "~/.ssh/gitlab";
identitiesOnly = true;
};
"github.com" = {
hostname = "github.com";
identityFile = "~/.ssh/github";
identitiesOnly = true;
};
"bitbucket.com" = {
hostname = "bitbucket.com";
identityFile = "~/.ssh/bitbucket";
identitiesOnly = true;
};
"aur.archlinux.org" = {
hostname = "aur.archlinux.org";
identityFile = "~/.ssh/aur";
identitiesOnly = true;
};
"heroku.com" = {
hostname = "heroku.com";
identityFile = "~/.ssh/heroku";
identitiesOnly = true;
};
"*ngrok.io" = {
hostname = "*ngrok.io";
identityFile = "~/.ssh/local";
identitiesOnly = true;
};
"172.27.108.*" = {
hostname = "172.27.108.*";
identityFile = "~/.ssh/local";
identitiesOnly = true;
};
"*" = {
identityFile = "~/.ssh/id_ed25519";
};
};
};
}

View file

@ -1,65 +1,61 @@
{ config, pkgs, lib, ... }:
{
home.packages = with pkgs; [
bspwm
findutils
gnome3.nautilus
pulseaudio-ctl
playerctl
alacritty
terminator
rofi
bash
betterlockscreen
bspwm
dunst
findutils
gnome3.nautilus
playerctl
pulseaudio-ctl
rofi
sxhkd
terminator
];
services.sxhkd = let
sxhkd = "${pkgs.sxhkd}/bin/sxhkd";
bspc = "${pkgs.bspwm}/bin/bspc";
xarg = "${pkgs.findutils}/bin/xargs";
nautilus = "${pkgs.gnome3.nautilus}/bin/nautilus";
pulseaudioCtl = "${pkgs.pulseaudio-ctl}/bin/pulseaudio-ctl";
playerctl = "${pkgs.playerctl}/bin/playerctl";
alacritty = "${pkgs.alacritty}/bin/alacritty";
terminator= "${pkgs.terminator}/bin/terminator";
rofi = "${pkgs.rofi}/bin/rofi";
bash = "${pkgs.bash}/bin/bash";
betterlockscreen = "betterlockscreen";
rofi = "${pkgs.rofi}/bin/rofi";
terminator = "${pkgs.terminator}/bin/terminator";
in {
enable = true;
keybindings = {
"super + Return" = "${bash} -c ${alacritty} || /usr/bin/alacritty || ${terminator}";
"super + Return" = ''${alacritty} -c "${alacritty} || /usr/bin/alacritty || ${terminator}"'';
"super + @space" = "${rofi} -show drun";
"super + e" = "${nautilus} -w";
"super + alt + {,+ shift} + m" = ''${betterlockscreen} {-l,-s} -t "Welcome back $USER"'';
"super + e" = "nautilus -w";
"super + alt + e" = ''dunstify "Welcome back $USER"'';
"super + alt + {,+ shift} + m" = ''betterlockscreen {-l,-s} -t "Welcome back $USER"'';
"super + Escape" = "pkill -USR1 -x sxhkd";
"super + alt + {q,r}" = "${bspc} {quit,wm -r}";
"super + {_,shift + }w" = "${bspc} node -{c,k}";
"super + m" = "${bspc} desktop -l next";
"super + y" = "${bspc} node newest.marked.local -n newest.!automatic.local";
"super + g" = "${bspc} node -s biggest";
"super + {t,shift + t,s,f}" = "${bspc} node -t {tiled,pseudo_tiled,floating,fullscreen}";
"super + ctrl + {m,x,y,z}" = "${bspc} node -g {marked,locked,sticky,private}";
"super + {_,shift + }{h,j,k,l}" = "${bspc} node -{f,s} {west,south,north,east}";
"super + {p,b,comma,period}" = "${bspc} node -f @{parent,brother,first,second}";
"super + {_,shift + }c" = "${bspc} node -f {next,prev}.local";
"super + bracket{left,right}" = "${bspc} desktop -f {prev,next}.local";
"super + {grave,Tab}" = "${bspc} {node,desktop} -f last";
"super + {o,i}" = "${bspc} wm -h off;${bspc} node {older,newer} -f;${bspc} wm -h on";
"super + {_,shift + }{1-9,0}" = "${bspc} {desktop -f,node -d} 'focused:^{1-9,10}'";
"super + ctrl + {h,j,k,l}" = "${bspc} node -p {west,south,north,east}";
"super + ctrl + {1-9}" = "${bspc} node -o 0.{1-9}";
"super + ctrl + space" = "${bspc} node -p cancel";
"super + ctrl + shift + space" = "${bspc} query -N -d | xargs -I id -n 1 ${bspc} node id -p cancel";
"super + alt + {h,j,k,l}" = "${bspc} node -z {left -20 0,bottom 0 20,top 0 -20,right 20 0}";
"super + alt + shift + {h,j,k,l}" = "${bspc} node -z {right -20 0,top 0 20,bottom 0 -20,left 20 0}";
"super + {Left,Down,Up,Right}" = "${bspc} node -v {-20 0,0 20,0 -20,20 0}";
"XF86AudioRaiseVolume" = "${pulseaudioCtl} up";
"XF86AudioLowerVolume" = "${pulseaudioCtl} down";
"XF86AudioMute" = "${pulseaudioCtl} mute";
"XF86AudioPlay" = "${playerctl} play-pause";
"XF86AudioNext" = "${playerctl} next";
"XF86AudioPrev" = "${playerctl} previous";
"super + alt + {q,r}" = "bspc {quit,wm -r}";
"super + {_,shift + }w" = "bspc node -{c,k}";
"super + m" = "bspc desktop -l next";
"super + y" = "bspc node newest.marked.local -n newest.!automatic.local";
"super + g" = "bspc node -s biggest";
"super + {t,shift + t,s,f}" = "bspc node -t {tiled,pseudo_tiled,floating,fullscreen}";
"super + ctrl + {m,x,y,z}" = "bspc node -g {marked,locked,sticky,private}";
"super + {_,shift + }{h,j,k,l}" = "bspc node -{f,s} {west,south,north,east}";
"super + {p,b,comma,period}" = "bspc node -f @{parent,brother,first,second}";
"super + {_,shift + }c" = "bspc node -f {next,prev}.local";
"super + bracket{left,right}" = "bspc desktop -f {prev,next}.local";
"super + {grave,Tab}" = "bspc {node,desktop} -f last";
"super + {o,i}" = "bspc wm -h off;bspc node {older,newer} -f;bspc wm -h on";
"super + {_,shift + }{1-9,0}" = "bspc {desktop -f,node -d} 'focused:^{1-9,10}'";
"super + ctrl + {h,j,k,l}" = "bspc node -p {west,south,north,east}";
"super + ctrl + {1-9}" = "bspc node -o 0.{1-9}";
"super + ctrl + space" = "bspc node -p cancel";
"super + ctrl + shift + space" = "bspc query -N -d | xargs -I id -n 1 bspc node id -p cancel";
"super + alt + {h,j,k,l}" = "bspc node -z {left -20 0,bottom 0 20,top 0 -20,right 20 0}";
"super + alt + shift + {h,j,k,l}" = "bspc node -z {right -20 0,top 0 20,bottom 0 -20,left 20 0}";
"super + {Left,Down,Up,Right}" = "bspc node -v {-20 0,0 20,0 -20,20 0}";
"XF86AudioRaiseVolume" = "pulseaudio-ctl up";
"XF86AudioLowerVolume" = "pulseaudio-ctl down";
"XF86AudioMute" = "pulseaudio-ctl mute";
"XF86AudioPlay" = "playerctl play-pause";
"XF86AudioNext" = "playerctl next";
"XF86AudioPrev" = "playerctl previous";
};
};
}

20
modules/tmux.nix Normal file
View file

@ -0,0 +1,20 @@
{ pkgs, ... }:
{
programs.tmux = {
enable = true;
clock24 = true;
escapeTime = 25;
plugins = with pkgs; [
tmuxPlugins.continuum
tmuxPlugins.prefix-highlight
tmuxPlugins.nord
];
extraConfig = ''
set -g mouse on
'';
# set -g default-terminal "screen"
# set -ga terminal-overrides ",col:Tc"
};
}