added secrets

This commit is contained in:
2021-05-09 00:00:36 +05:30
parent 0f51622ac9
commit 422ab9c1eb
38 changed files with 517 additions and 82 deletions

10
home/stuff/gtk.nix Normal file
View File

@@ -0,0 +1,10 @@
{config, pkgs,...}:
{
gtk = {
enable = true;
iconTheme.name = "Gruvbox-Material-Dark";
iconTheme.package = pkgs.gruvbox-icons;
theme.name = "Equilux";
theme.package = pkgs.equilux-theme;
};
}

37
home/stuff/programs.nix Normal file
View File

@@ -0,0 +1,37 @@
{ pkgs, config, ...}:
{
imports = [
./programs/nvim.nix
];
programs = {
firefox = {
enable = true;
package = pkgs.firefox-bin;
profiles.natto = {
name = "natto";
userChrome = builtins.readFile ../config/firefox/userChrome.css;
userContent = builtins.readFile ../config/firefox/userContent.css;
};
};
zathura = {
enable = true;
extraConfig = builtins.readFile ../config/zathura/zathurarc;
options = {
recolor = true;
recolor-lightcolor = "rgba(0,0,0,0)";
default-bg = "rgba(0,0,0,0.7)";
};
};
ncmpcpp = {
enable = true;
};
mpv = {
enable = true;
config = {
force-window = "yes";
keep-open = "yes";
save-position-on-quit = "yes";
};
};
};
}

View File

@@ -0,0 +1,88 @@
{config, pkgs, ...}:
let
plugs = {
floaterm = {
config = ''
let g:floaterm_keymap_toggle = '<F1>'
let g:floaterm_keymap_next = '<F2>'
let g:floaterm_keymap_prev = '<F3>'
let g:floaterm_keymap_new = '<F4>'
let g:floaterm_gitcommit='floaterm'
let g:floaterm_autoinsert=1
let g:floaterm_width=0.8
let g:floaterm_height=0.8
let g:floaterm_wintitle=0
let g:floaterm_shell="/usr/bin/env fish"
'';
plugin = pkgs.vimPlugins.vim-floaterm;
};
nvim-colorizer = {
plugin = pkgs.vimPlugins.nvim-colorizer-lua;
config = ''
packadd! nvim-colorizer.lua
lua require'colorizer'.setup()
'';
};
auto-pairs = {
plugin = pkgs.vimPlugins.auto-pairs;
};
vim-closetag = {
config = ''
let g:closetag_filenames = "*.html,*.xhtml,*.phtml,*.js,*.erb,*.jsx"
let g:closetag_xhtml_filenames = '*.xhtml,*.jsx,*.js,*.erb'
let g:closetag_emptyTags_caseSensitive = 1
let g:closetag_shortcut = '>'
let g:closetag_close_shortcut = '<leader>>'
'';
plugin = pkgs.vimPlugins.vim-closetag;
};
nerdcommenter = {
config = ''
map <C-c> <plug>NERDCommenterToggle
map <C-d> <plug>NERDCommenterSexy
'';
plugin = pkgs.vimPlugins.nerdcommenter;
};
vim-rooter = {
plugin = pkgs.vimPlugins.vim-rooter;
};
vim-polyglot = {
plugin = pkgs.vimPlugins.vim-polyglot;
};
themes = {
gruvbox = {
plugin = pkgs.vimPlugins.gruvbox;
};
};
};
in
{
programs.neovim = {
enable = true;
vimAlias = true;
viAlias = false;
withNodeJs = true;
withPython = true;
extraConfig = ''
let g:gruvbox_italic=1
let g:gruvbox_contrast_dark="hard"
let g:gruvbox_contrast_light="hard"
set background=dark
colorscheme gruvbox
'' +
builtins.readFile ../../config/nvim/init.vim +
builtins.readFile ../../config/nvim/utils.vim;
plugins = with plugs; [
auto-pairs
#nvim-colorizer
floaterm
vim-rooter
nerdcommenter
vim-polyglot
vim-closetag
themes.gruvbox
];
};
}

93
home/stuff/secret.nix Normal file
View File

@@ -0,0 +1,93 @@
/* Module by @ryantm in github:ryantm/agenix
Modified by @natto1784 for 'personal' home-manager config */
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.age;
ageBin = "${pkgs.rage}/bin/rage";
users = config.users.users;
home_ = config.home.homeDirectory;
username_ = config.home.username;
identities = builtins.concatStringsSep " " (map (path: "-i ${path}") cfg.sshKeyPaths);
installSecret = secretType: ''
echo "decrypting ${secretType.file} to ${secretType.path}..."
TMP_FILE="${secretType.path}.tmp"
mkdir -p $(dirname ${secretType.path})
(umask 0400; ${ageBin} --decrypt ${identities} -o "$TMP_FILE" "${secretType.file}")
chmod ${secretType.mode} "$TMP_FILE"
chown ${secretType.owner} "$TMP_FILE"
mv -f "$TMP_FILE" '${secretType.path}'
'';
secretType = types.submodule ({ config, ... }: {
options = {
name = mkOption {
type = types.str;
default = config._module.args.name;
description = ''
Name of the file used in /run/secrets
'';
};
file = mkOption {
type = types.path;
description = ''
Age file the secret is loaded from.
'';
};
path = mkOption {
type = types.str;
default = "${home_}/.secrets/${config.name}";
description = ''
Path where the decrypted secret is installed.
'';
};
mode = mkOption {
type = types.str;
default = "0400";
description = ''
Permissions mode of the in octal.
'';
};
owner = mkOption {
type = types.str;
default = "${username_}";
description = ''
User of the file.
'';
};
};
});
in {
options.age = {
secrets = mkOption {
type = types.attrsOf secretType;
default = {};
description = ''
Attrset of secrets.
'';
};
sshKeyPaths = mkOption {
type = types.listOf types.path;
default = [ ];
description = ''
Path to SSH keys to be used as identities in age decryption.
'';
};
};
config = mkIf (cfg.secrets != {}) {
assertions = [{
assertion = cfg.sshKeyPaths != [];
message = "age.sshKeyPaths must be set.";
}];
home.activation = {
decryptSecrets = lib.hm.dag.entryBefore [ "writeBoundary" ] (concatStrings (map installSecret (builtins.attrValues cfg.secrets)));
};
};
}

48
home/stuff/services.nix Normal file
View File

@@ -0,0 +1,48 @@
{config, pkgs, ...}:
let
home = config.home.homeDirectory;
in
{
services = {
picom = {
enable = true;
extraOptions =
''
shadow = true;
shadow-radius = 7;
shadow-offset-x = -7;
shadow-offset-y = -7;
blurExclude = [ "class_g = 'dwm'" ];
inactive-opacity = 0.92;
active-opacity = 0.97;
inactive-opacity-override = true;
blur-background = true;
blur-method = "dual_kawase";
blur-strength = 3;
blur-kern = "3x3box";
fading = true;
fade-in-step = 0.05;
fade-out-step = 0.05;
backend = "glx";
detect-rounded-corners = true;
detect-client-opacity = true;
experimental-backends = true;
vsync = false;
wintypes:
{
tooltip = { fade = true; shadow = true; opacity = 0.75; focus = true; };
popup_menu={opacity=0.8;};
dropdown_menu={opacity=0.8;};
};
shadow-exclude = ["x = 0 && y = 0 && override_redirect = true"]
'';
};
sxhkd = {
enable = false;
extraConfig = builtins.readFile ./config/sxhkd/sxhkdrc;
};
};
}

9
home/stuff/xsession.nix Normal file
View File

@@ -0,0 +1,9 @@
{pkgs, config, ...}:
{
xsession = {
windowManager.bspwm = {
enable = false;
extraConfig = builtins.readFile ./config/bspwm/bspwmrc;
};
};
}