initial public commit

This commit is contained in:
Fabian Montero 2024-08-23 13:32:44 -06:00
commit 93d38992e1
Signed by untrusted user: fabian
GPG key ID: 1FFAC35E1798174F
33 changed files with 1761 additions and 0 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
result

105
base/default.nix Normal file
View file

@ -0,0 +1,105 @@
# Edet this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running nixos-help).
{ config, pkgs, lib, ... }:
{
imports =
[
# Include the results of the hardware scan.
./hardware-configuration-custom.nix
];
# Use the systemd-boot EFI boot loader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
boot.tmp.useTmpfs = true;
boot.kernelPackages = pkgs.linuxPackages_latest;
networking.hostName = "posixlycorrect"; # Define your hostname. !!mover esto a platform
networking.networkmanager.enable = true;
# Set your time zone.
time.timeZone = "America/Costa_Rica";
# The global useDHCP flag is deprecated, therefore explicitly set to false here.
# Per-interface useDHCP will be mandatory in the future, so this generated config
# replicates the default behaviour.
networking.useDHCP = false;
networking.interfaces.enp7s0.useDHCP = true;
networking.interfaces.wlp6s0.useDHCP = true;
# Select internationalisation properties.
i18n.defaultLocale = "en_US.UTF-8";
console = {
font = "Lat2-Terminus16";
keyMap = "us";
};
# Enable the X11 windowing system.
services.xserver = {
enable = true;
xkb.layout = "us";
displayManager.startx.enable = true;
};
services.libinput.enable = true;
hardware.opengl.enable = true;
# Enable sound.
sound.enable = true;
hardware.pulseaudio.enable = true;
programs.zsh.enable = true;
environment.pathsToLink = [ "/share/zsh" ];
users = {
users.fabian = {
isNormalUser = true;
uid = 1002; # nunca cambiar mi ID de usuario
group = "fabian";
shell = pkgs.zsh;
extraGroups = [ "users" "wheel" "networkmanager" "dialout" "libvirtd" ];
};
groups.fabian.gid = 1002;
};
services.udev.packages = [
pkgs.android-udev-rules
];
users.users.temp = {
isNormalUser = true;
extraGroups = [ "wheel" ];
};
nixpkgs.config.allowUnfree = true;
virtualisation.libvirtd.qemu.package = pkgs.qemu_kvm;
virtualisation.libvirtd.qemu.ovmf.enable = true;
virtualisation.libvirtd.qemu.ovmf.packages = [ pkgs.OVMFFull.fd ];
virtualisation.libvirtd.enable = true;
programs.dconf.enable = true;
# boot.kernelModules = [ "vfio" "vfio_iommu_type1" "vfio_pci" "vfio_virqfd" ];
# boot.kernelParams = [ "amd_iommu=on" "iommu=pt" "vfio-pci.ids=1002:699f,1002:aae0" "video=efifb:off" ];
virtualisation.libvirtd.onBoot = "start";
nix = {
package = pkgs.nixFlakes;
extraOptions = ''
experimental-features = nix-command flakes repl-flake
'';
};
hardware.opengl.driSupport32Bit = true;
services.openssh.enable = true;
services.earlyoom = {
enable = true;
enableNotifications = true;
};
system.stateVersion = "21.11"; # No tocar esto
}

View file

@ -0,0 +1,45 @@
{ config, lib, pkgs, modulesPath, ... }:
let
subvol = subvol: {
device = "/dev/disk/by-uuid/645fdba0-5c03-4285-926b-facded1ee259";
fsType = "btrfs";
options = [ "subvol=${subvol}" "compress=zstd" "noatime" "ssd" ];
};
in
{
imports =
[
(modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd = {
availableKernelModules = [ "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ];
luks.devices."toplevel" = {
device = "/dev/disk/by-uuid/58277baa-90d4-4a5e-a658-1b918b89130a";
preLVM = false;
};
};
fileSystems = {
"/" = subvol "root";
"/toplevel" = subvol "/";
"/boot" = {
device = "/dev/disk/by-uuid/B007-B007";
fsType = "vfat";
options = [ "umask=027" ];
};
"/extern" = {
device = "/dev/disk/by-uuid/7d8d3ec9-b456-4e2a-9396-551dcaf7705b";
fsType = "btrfs";
options = [ "noatime" "compress=zstd" ];
};
};
hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

View file

@ -0,0 +1 @@
{ }

148
flake.lock Normal file
View file

@ -0,0 +1,148 @@
{
"nodes": {
"flake-utils": {
"locked": {
"lastModified": 1659877975,
"narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"hm-isolation": {
"locked": {
"lastModified": 1675806557,
"narHash": "sha256-39NPKKwU7JflyDG9Cn36UPPelkcNATsrCaoazuIO5PA=",
"owner": "3442",
"repo": "hm-isolation",
"rev": "0b435299c3735231bf4faf1ea7de32d03f070056",
"type": "github"
},
"original": {
"owner": "3442",
"repo": "hm-isolation",
"type": "github"
}
},
"home-manager": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1720042825,
"narHash": "sha256-A0vrUB6x82/jvf17qPCpxaM+ulJnD8YZwH9Ci0BsAzE=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "e1391fb22e18a36f57e6999c7a9f966dc80ac073",
"type": "github"
},
"original": {
"owner": "nix-community",
"ref": "release-24.05",
"repo": "home-manager",
"type": "github"
}
},
"nixGL": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1713543440,
"narHash": "sha256-lnzZQYG0+EXl/6NkGpyIz+FEOc/DSEG57AP1VsdeNrM=",
"owner": "guibou",
"repo": "nixGL",
"rev": "310f8e49a149e4c9ea52f1adf70cdc768ec53f8a",
"type": "github"
},
"original": {
"owner": "guibou",
"repo": "nixGL",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1660551188,
"narHash": "sha256-a1LARMMYQ8DPx1BgoI/UN4bXe12hhZkCNqdxNi6uS0g=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "441dc5d512153039f19ef198e662e4f3dbb9fd65",
"type": "github"
},
"original": {
"owner": "nixos",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1724242322,
"narHash": "sha256-HMpK7hNjhEk4z5SFg5UtxEio9OWFocHdaQzCfW1pE7w=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "224042e9a3039291f22f4f2ded12af95a616cca0",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-24.05",
"repo": "nixpkgs",
"type": "github"
}
},
"nur": {
"locked": {
"lastModified": 1724391890,
"narHash": "sha256-A5eOWBtLbry/AC91k+53yT12KH85uj3s29KNLmQVG8w=",
"owner": "nix-community",
"repo": "NUR",
"rev": "0f539bb8a1ed9fe2a46f7539a370127dc286a896",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "NUR",
"type": "github"
}
},
"root": {
"inputs": {
"hm-isolation": "hm-isolation",
"home-manager": "home-manager",
"nixGL": "nixGL",
"nixpkgs": "nixpkgs_2",
"nur": "nur",
"unstable": "unstable"
}
},
"unstable": {
"locked": {
"lastModified": 1724224976,
"narHash": "sha256-Z/ELQhrSd7bMzTO8r7NZgi9g5emh+aRKoCdaAv5fiO0=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "c374d94f1536013ca8e92341b540eba4c22f9c62",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

77
flake.nix Normal file
View file

@ -0,0 +1,77 @@
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05"; # actualizar esto para actualizar
unstable.url = "github:nixos/nixpkgs/nixos-unstable";
nur.url = "github:nix-community/NUR";
hm-isolation.url = "github:3442/hm-isolation";
nixGL.url = "github:guibou/nixGL";
home-manager = {
url = "github:nix-community/home-manager/release-24.05"; # actualizar esto para actualizar
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, unstable, home-manager, nur, hm-isolation, nixGL, ... }:
let
system = "x86_64-linux";
pkgs = import nixpkgs {
inherit system;
};
inherit (pkgs) lib;
base = platform: {
name = platform;
value = nixpkgs.lib.nixosSystem {
inherit system;
modules = [ (import ./base) ];
};
};
home = platform: {
name = "fabian@${platform}";
value = home-manager.lib.homeManagerConfiguration {
inherit pkgs;
modules = [
(import ./home {
inherit self nixpkgs unstable hm-isolation nixGL;
})
./home/platforms/${platform}.nix
{
config.local = { inherit platform; };
}
];
};
};
localPkgs = import ./pkgs;
platforms = domain:
map
(lib.removeSuffix ".nix")
(lib.attrNames (builtins.readDir ./${domain}/platforms));
configs = domain: builder:
lib.listToAttrs
(map builder (platforms domain));
in
{
nixosConfigurations = configs "base" base;
homeConfigurations = configs "home" home;
packages.${system} = localPkgs pkgs;
formatter.${system} = pkgs.nixpkgs-fmt;
overlay = self: super: {
unstable = import unstable {
inherit (super) config system;
};
local = localPkgs self;
};
};
}

79
home/accounts.nix Normal file
View file

@ -0,0 +1,79 @@
{ lib, config, ... }:
with lib;
{
config = mkIf (!config.home.isolation.active) {
accounts.email.maildirBasePath = "${config.home.homeDirectory}/mail";
accounts.email.accounts = {
"default" = {
address = "fabian@posixlycorrect.com";
userName = "fabianmontero@fastmail.com";
realName = "fabian";
primary = true;
flavor = "fastmail.com";
smtp = {
host = "smtp.fastmail.com";
port = 465;
};
imap = {
host = "imap.fastmail.com";
port = 993;
tls.enable = true;
};
passwordCommand = "gpg -d ${config.home.homeDirectory}/secrets/fastmail.password.gpg 2> /dev/null";
gpg = {
encryptByDefault = true;
signByDefault = true;
key = "7AA277E604A4173916BBB4E91FFAC35E1798174F";
};
thunderbird = {
enable = true;
settings = id: {
"mail.openpgp.allow_external_gnupg" = true;
};
};
neomutt = {
enable = true;
};
mbsync = {
enable = true;
create = "both";
expunge = "both";
remove = "both";
};
};
};
programs = {
mbsync.enable = true;
thunderbird = {
enable = true;
profiles = {
"default" = {
isDefault = true;
};
};
};
neomutt = {
enable = true;
sort = "date-received";
vimKeys = true;
sidebar = {
enable = true;
};
#settings = {
# maildir_check_cur = "yes";
#};
extraConfig = ''
mailboxes `find ~/mail/ -type d -name cur -printf '%h '`
timeout-hook 'echo `mbsync -a`'
startup-hook 'echo `mbsync -a`'
'';
};
};
};
}

View file

@ -0,0 +1,18 @@
{ pkgs, config, lib, ... }:
with lib;
{
nixpkgs.config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [
"discord"
"pycharm-professional"
"rar"
"spotify"
"spotify-unwrapped"
"steam"
"steam-original"
"steam-run"
"teams"
"vscode-extension-ms-vscode-cpptools"
"vmware-horizon-client"
"zoom"
];
}

14
home/apps/default.nix Normal file
View file

@ -0,0 +1,14 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.local.apps;
in
{
options.local.apps.enable = mkEnableOption "Applications and tools";
imports = [
./library.nix
./steam
./terminal
./virtmanager.nix
];
}

52
home/apps/library.nix Normal file
View file

@ -0,0 +1,52 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.local.apps.defaultApps;
in
{
options.local.apps.defaultApps.enable = mkEnableOption "Default app library";
config = mkIf cfg.enable {
home.packages = with pkgs; [
chromium
darktable
deluge
discord
element-desktop
firefox
gperftools
gwenview
helix
libreoffice-fresh
lutris
mpv
neovim
obs-studio
openrct2
pavucontrol
pdfarranger
prismlauncher
qpdfview
runelite
spotify
tdesktop
vlc
vpsfree-client
vscodium-fhs
zola
zoom-us
];
xdg.mimeApps.defaultApplications = {
"application/x-extension-htm" = [ "firefox.desktop" ];
"application/x-extension-html" = [ "firefox.desktop" ];
"application/x-extension-shtml" = [ "firefox.desktop" ];
"application/x-extension-xht" = [ "firefox.desktop" ];
"application/x-extension-xhtml" = [ "firefox.desktop" ];
"application/xhtml+xml" = [ "firefox.desktop" ];
"text/html" = [ "firefox.desktop" ];
"x-scheme-handler/http" = [ "firefox.desktop" ];
"x-scheme-handler/https" = [ "firefox.desktop" ];
"application/pdf" = [ "qpdfview.desktop" ];
};
};
}

View file

@ -0,0 +1,15 @@
{ pkgs, lib, config, ... }:
with lib; let
cfg = config.local.apps.steam;
in
{
options.local.apps.steam.enable = mkEnableOption "Steam";
config = mkIf cfg.enable {
home.packages = [
(pkgs.callPackage ./package.nix { })
pkgs.protonup
pkgs.winetricks
pkgs.protontricks
];
};
}

View file

@ -0,0 +1,4 @@
{ writeShellScriptBin, steam-run, steam, ... }:
writeShellScriptBin "steam" ''
exec ${steam-run}/bin/steam-run ${steam}/bin/steam -console
''

View file

@ -0,0 +1,32 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.local.apps.terminal;
in
{
options.local.apps.terminal.enable = mkEnableOption "Terminal emulator settings";
config.programs = mkIf cfg.enable {
kitty = {
enable = true;
extraConfig = import ./kitty.conf.nix;
};
tmux = {
enable = true;
aggressiveResize = true;
clock24 = true;
escapeTime = 10;
terminal = "xterm-256color";
keyMode = "emacs";
extraConfig = ''
set -g mouse on
set -ga update-environment " LIFT_PID"
set -g set-titles on
set -g renumber-windows on
set -sa terminal-overrides ',xterm-termite:RGB'
set -g status-right "#{?window_bigger,[#{window_offset_x}#,#{window_offset_y}] ,} %H:%M %d-%b-%y"
'';
};
};
}

View file

@ -0,0 +1,87 @@
''
# Fonts
font_family JetBrains Mono Medium
bold_font JetBrains Mono Bold
italic_font JetBrains Mono Italic
bold_italic_font JetBrains Mono Bold Italic
font_size 15
disable_ligatures cursor
initial_window_width 1200
initial_window_height 600
# Cursor
cursor_shape beam
cursor_beam_thickness 1.9
cursor_stop_blinking_after 0
# Audio
enable_audio_bell no
# Tabs
tab_bar_style separator
tab_separator " | "
tab_title_template "{index}: {title}"
# Color
# special
foreground #ffffff
foreground_bold #ffffff
cursor #ffffff
background #000000
background_opacity 1
# Shortcuts
map ctrl+shift+c copy_to_clipboard
map ctrl+shift+v paste_from_clipboard
map ctrl+shift+s paste_from_selection
map shift+insert paste_from_selection
map ctrl+shift+up scroll_line_up
map ctrl+shift+down scroll_line_down
map ctrl+shift+page_up scroll_page_up
map ctrl+shift+page_down scroll_page_down
map ctrl+shift+home scroll_home
map ctrl+shift+end scroll_end
map ctrl+shift+enter new_window
map ctrl+alt+enter launch --cwd=current
map ctrl+shift+w close_window
map ctrl+shift+] next_window
map ctrl+shift+[ previous_window
map ctrl+shift+1 first_window
map ctrl+shift+2 second_window
map ctrl+shift+3 third_window
map ctrl+shift+4 fourth_window
map ctrl+shift+5 fifth_window
map ctrl+shift+6 sixth_window
map ctrl+shift+7 seventh_window
map ctrl+shift+8 eighth_window
map ctrl+shift+9 ninth_window
map ctrl+shift+0 tenth_window
map ctrl+shift+right next_tab
map ctrl+shift+left previous_tab
map ctrl+shift+t new_tab
map ctrl+shift+q close_tab
map ctrl+shift+. move_tab_forward
map ctrl+shift+, move_tab_backward
map ctrl+shift+alt+t set_tab_title
map ctrl+alt+1 goto_tab 1
map ctrl+alt+2 goto_tab 2
map ctrl+alt+3 goto_tab 3
map ctrl+alt+4 goto_tab 4
map ctrl+alt+5 goto_tab 5
map ctrl+alt+6 goto_tab 6
map ctrl+alt+7 goto_tab 7
map ctrl+alt+8 goto_tab 8
map ctrl+alt+9 goto_tab 9
map ctrl+alt+0 goto_tab 10
map ctrl+shift+equal change_font_size all +1.0
map ctrl+shift+minus change_font_size all -1.0
map ctrl+shift+backspace change_font_size all 0
map ctrl+shift+delete clear_terminal reset active
''

13
home/apps/virtmanager.nix Normal file
View file

@ -0,0 +1,13 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.local.apps.virtmanager;
in
{
options.local.apps.virtmanager.enable = mkEnableOption "Virtmanager";
config = mkIf cfg.enable {
home.packages = with pkgs; [
virt-manager
];
};
}

51
home/cli.nix Normal file
View file

@ -0,0 +1,51 @@
{ config, lib, pkgs, ... }:
with lib;
{
programs = {
## talvez esto debería moverse a base
zsh = {
enable = true;
syntaxHighlighting.enable = true;
initExtra = import ./zshrc.nix pkgs;
};
git = {
enable = true;
userEmail = "fabian@posixlycorrect.com";
userName = "Fabian Montero";
signing = {
key = "7AA277E604A4173916BBB4E91FFAC35E1798174F";
signByDefault = true;
};
};
gpg = {
enable = true;
settings = {
default-key = "7AA277E604A4173916BBB4E91FFAC35E1798174F";
};
};
};
services.gpg-agent = {
enable = true;
enableZshIntegration = true;
pinentryPackage = pkgs.pinentry-emacs;
};
home.packages = with pkgs;
[
calc
file
gcc
htop
killall
man-pages
man-pages-posix
neovim
rar
tree
units
unzip
usbutils
zip
];
}

58
home/default.nix Normal file
View file

@ -0,0 +1,58 @@
{ self, nixpkgs, unstable, hm-isolation, nixGL }:
{ config, pkgs, lib, ... }:
with lib;
{
imports = [
(hm-isolation.homeManagerModule)
./accounts.nix
./apps
./allowUnfreeWhitelist.nix
./gui
./isolation.nix
./options.nix
./cli.nix
./systemd
];
nixpkgs.overlays = [ self.overlay nixGL.overlay ];
services.ssh-agent.enable = true;
home = {
stateVersion = "21.11"; # No tocar esto
username = "fabian";
homeDirectory = "/home/fabian";
sessionVariables = {
"EDITOR" = "nvim";
"TERMINAL" = "kitty";
};
keyboard = {
layout = "us";
variant = "altgr-intl";
};
};
xdg.enable = true;
nix.registry = {
"system".to = {
type = "path";
path = "/home/fabian/nix";
};
"nixpkgs".flake = nixpkgs;
"unstable".flake = unstable;
};
programs.home-manager.enable = true;
local = {
apps.enable = mkDefault (!config.home.isolation.active);
gui = {
enable = mkDefault true;
desktop = mkDefault (!config.home.isolation.active);
};
};
}

14
home/gui/autorandr.nix Normal file
View file

@ -0,0 +1,14 @@
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.local.gui.autorandr;
in
{
options.local.gui.autorandr.enable = mkEnableOption "Autorandr";
config = mkIf cfg.enable {
programs.autorandr = {
enable = true;
profiles."${config.local.platform}" = config.local.display.autorandrProfile;
};
};
}

49
home/gui/default.nix Normal file
View file

@ -0,0 +1,49 @@
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.local.gui;
in
{
options.local.gui = {
enable = mkEnableOption "GUI settings and programs";
desktop = mkEnableOption "i3 desktop envirorment";
};
imports = [
./autorandr.nix
./fonts.nix
./gtk.nix
./i3.nix
./polybar.nix
./startx.nix
];
config = mkIf cfg.enable {
local.gui = {
fonts.enable = mkDefault true;
gtk.enable = mkDefault true;
autorandr.enable = mkDefault cfg.desktop;
i3.enable = mkDefault cfg.desktop;
polybar.enable = mkDefault cfg.desktop;
startx.enable = mkDefault cfg.desktop;
};
services = mkIf cfg.desktop {
picom = {
enable = true;
};
dunst = {
enable = true;
};
betterlockscreen = {
enable = true;
};
};
xdg.mimeApps.enable = true;
};
}

15
home/gui/fonts.nix Normal file
View file

@ -0,0 +1,15 @@
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.local.gui.fonts;
in
{
options.local.gui.fonts.enable = mkEnableOption "Font management";
config = mkIf cfg.enable {
fonts.fontconfig.enable = true;
home.packages = with pkgs; [
jetbrains-mono
];
};
}

14
home/gui/gtk.nix Normal file
View file

@ -0,0 +1,14 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.local.gui.gtk;
in
{
options.local.gui.gtk.enable = mkEnableOption "GTK related programs";
config = mkIf cfg.enable {
home.packages = with pkgs; [
gruvbox-dark-icons-gtk
libsForQt5.breeze-gtk
];
};
}

107
home/gui/i3.nix Normal file
View file

@ -0,0 +1,107 @@
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.local.gui.i3;
in
{
options.local.gui.i3.enable = mkEnableOption "i3 window manager";
config = mkIf cfg.enable {
xsession.windowManager.i3 = {
enable = true;
package = pkgs.i3-gaps;
config =
let
mod = "Mod4";
in
{
modifier = mod;
# revisar luego si config.bars tiene un default danino
fonts = {
names = [ "JetBrains Mono" ];
style = "Regular";
size = 8.0;
};
gaps = {
inner = 10;
outer = -10;
};
window = {
hideEdgeBorders = "both";
};
colors = {
focused = {
background = "#222222";
border = "#4c7899";
childBorder = "#222222";
indicator = "#292d2e";
text = "#888888";
};
};
# mkOptionDefault hace que se ponga la config por default
# y se sobreescriba las cosas que pongo acA
# NO QUITARLO. ver man home-configuration.nix
keybindings = mkOptionDefault {
"${mod}+Return" = "exec ${pkgs.kitty}/bin/kitty ${pkgs.tmux}/bin/tmux";
"${mod}+Tab" = "focus right";
"${mod}+Shift+Tab" = "focus left";
"${mod}+Shift+s" = "exec ${pkgs.maim}/bin/maim -s -u | ${pkgs.xclip}/bin/xclip -selection clipboard -t image/png -i";
"${mod}+Shift+w" = "move workspace to output right";
"${mod}+l" = "exec ${pkgs.betterlockscreen}/bin/betterlockscreen -l";
};
startup = [
{
command = "${pkgs.xss-lock}/bin/xss-lock --transfer-sleep-lock -- ${pkgs.i3lock}/bin/i3lock --nofork";
notification = false;
}
{
command = "${pkgs.networkmanagerapplet}/bin/nm-applet";
notification = false;
}
{
command = "${pkgs.feh}/bin/feh --bg-fill ${config.home.homeDirectory}/Pictures/wallpapers/jupiter.png";
notification = false;
always = true;
}
{
command = "${pkgs.i3-gaps}/bin/i3-msg 'workspace 1; exec ${pkgs.firefox}/bin/firefox'";
}
{
command = "${pkgs.i3-gaps}/bin/i3-msg 'workspace 2; exec ${pkgs.tdesktop}/bin/telegram-desktop'";
}
{
command = "${pkgs.i3-gaps}/bin/i3-msg 'workspace 2; exec ${pkgs.element-desktop}/bin/element-desktop'";
}
{
command = "${pkgs.systemd}/bin/systemctl --user restart polybar.service";
notification = false;
always = true;
}
{
command = "${pkgs.autorandr}/bin/autorandr -c";
notification = false;
always = true;
}
];
workspaceOutputAssign = [
{
output = config.local.display."0";
workspace = "1";
}
] ++ optional (config.local.display."1" != null) {
output = config.local.display."1";
workspace = "10";
};
bars = [ ];
};
};
};
}

461
home/gui/polybar.nix Normal file
View file

@ -0,0 +1,461 @@
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.local.gui.polybar;
in
{
options.local.gui.polybar.enable = mkEnableOption "Polybar";
config = mkIf cfg.enable {
services.polybar = mkIf (!config.home.isolation.active) {
enable = true;
package = pkgs.polybarFull;
script = ''
# Terminate already running bar instances
killall -q polybar
# Wait until the processes have been shut down
while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done
# Launch Polybar, using default config location ~/.config/polybar/config
polybar -r main & polybar -r secondary &
'';
settings = {
"colors" = {
# background = "\${xrdb:color0:#222}";
background = "#AA000000";
background-alt = "#00000000";
# foreground = "\${xrdb:color7:#222}";
foreground = "#ffffff";
foreground-alt = "#ffffff";
primary = "#ffffff";
secondary = "#e60053";
alert = "#bd2c40";
};
"bar/main" = {
monitor = "${config.local.display."0"}";
width = "100%";
height = 30;
offset-x = "0%";
offset-y = "0%";
radius = 0.0;
fixed-center = false;
background = "\${colors.background}";
foreground = "\${colors.foreground}";
line-size = 1;
line-color = "#f0000000";
border-size = 0;
border-color = "#00000000";
padding-left = 0;
padding-right = 0;
module-margin-left = 1;
module-margin-right = 1;
# font-0 = "fixed:pixelsize=10;1";
font-0 = "JetBrains Mono Light:size=10;0";
font-1 = "unifont:fontformat=truetype:size=8:antialias=false;0";
font-2 = "siji:pixelsize=10;1";
# font-2 = "FontAwesome5Free:style=Regular:size=10;4";
modules-left = "i3";
modules-center = "xwindow";
modules-right = "xkeyboard pulseaudio filesystem memory cpu temperature gputemperature nvmetemperature wlan eth date semanatec";
separator = "|";
tray-position = "right";
tray-padding = 2;
# To allow other windows to be placed above the bar, or to avoid having the bar visible when in fullscreen mode,
# you need to use the following two parameters. Note that it will tell the window manager to back off so no
# area will be reserved, etc.
#
# wm-restack = "i3";
# override-redirect = true;
cursor-click = "pointer";
cursor-scroll = "ns-resize";
};
"bar/secondary" = optionalAttrs (config.local.display."1" != null) {
monitor = "${config.local.display."1"}";
"inherit" = "bar/main";
modules-left = "i3";
modules-center = "xwindow";
modules-right = "xkeyboard pulseaudio date";
tray-position = "none";
};
"module/xwindow" = {
type = "internal/xwindow";
label = "%title:0:30:...%";
};
"module/xkeyboard" = {
type = "internal/xkeyboard";
blacklist-0 = "num lock";
format-prefix = "";
format-prefix-foreground = "\${colors.foreground-alt}";
label-layout = "%layout%";
label-indicator-padding = 2;
label-indicator-margin = 1;
label-indicator-background = "\${colors.secondary}";
};
"module/filesystem" = {
type = "internal/fs";
interval = 10;
mount-0 = "/";
label-mounted = "%{F#0a81f5}%mountpoint%%{F-}: %used%/%total%";
label-unmounted = "";
};
"module/i3" = {
type = "internal/i3";
format = "<label-state> <label-mode>";
index-sort = true;
wrapping-scroll = false;
# Only show workspaces on the same output as the bar
# pin-workspaces = true
label-mode-padding = 1;
label-mode-foreground = "#000";
label-mode-background = "\${colors.primary}";
# focused = Active workspace on focused monitor
label-focused = "%index%";
label-focused-background = "\${colors.background}";
label-focused-underline = "\${colors.primary}";
label-focused-padding = 1;
# unfocused = Inactive workspace on any monitor
label-unfocused = "%index%";
label-unfocused-padding = 1;
# visible = Active workspace on unfocused monitor
label-visible = "%index%";
label-visible-background = "\${self.label-focused-background}";
label-visible-underline = "\${self.label-focused-underline}";
label-visible-padding = "\${self.label-focused-padding}";
# urgent = Workspace with urgency hint set
label-urgent = "%index%";
label-urgent-background = "\${colors.alert}";
label-urgent-padding = 1;
};
"module/xbacklight" = {
type = "internal/xbacklight";
format = "<label> <bar>";
label = "BL";
bar-width = 10;
bar-indicator = "|";
bar-indicator-foreground = "#fff";
bar-indicator-font = 2;
bar-fill = "";
bar-fill-font = 2;
bar-fill-foreground = "#9f78e1";
bar-empty = "";
bar-empty-font = 2;
bar-empty-foreground = "\${colors.foreground-alt}";
};
"module/backlight-acpi" = {
"inherit" = "module/xbacklight";
type = "internal/backlight";
card = "intel_backlight";
};
"module/cpu" = {
type = "internal/cpu";
interval = 2;
format-prefix = "cpu ";
format-prefix-foreground = "\${colors.foreground-alt}";
label = "%percentage:2%%";
};
"module/memory" = {
type = "internal/memory";
interval = 2;
format-prefix = "mem ";
format-prefix-foreground = "\${colors.foreground-alt}";
label = "%percentage_used%%";
};
"module/wlan" = {
type = "internal/network";
interface = "wlp7s0";
interval = 3.0;
format-connected = "<ramp-signal> <label-connected>";
label-connected = "%essid%";
format-disconnected = "";
# format-disconnected = "<label-disconnected>";
# format-disconnected-underline = "\${self.format-connected-underline}";
# label-disconnected = "%ifname% disconnected";
# label-disconnected-foreground = "\${colors.foreground-alt}";
ramp-signal-0 = "";
ramp-signal-1 = "";
ramp-signal-2 = "";
ramp-signal-3 = "";
ramp-signal-4 = "";
ramp-signal-foreground = "\${colors.foreground-alt}";
};
"module/eth" = {
type = "internal/network";
interface = "enp8s0";
interval = 3.0;
format-connected-prefix = "";
format-connected-prefix-foreground = "\${colors.foreground-alt}";
label-connected = "%local_ip%";
format-disconnected = "";
# format-disconnected = "<label-disconnected>";
# format-disconnected-underline = "\${self.format-connected-underline}";
# label-disconnected = "%ifname% disconnected";
# label-disconnected-foreground = "\${colors.foreground-alt}";
};
"module/date" = {
type = "internal/date";
interval = 1;
date = " %d/%m/%Y";
date-alt = " %c";
time = "%H:%M";
time-alt = " [%s]";
format-prefix = "";
format-prefix-foreground = "\${colors.foreground-alt}";
label = "%date% %time%";
};
# "module/semanatec" = {
# type = "custom/script"
# exec = "/home/fabian/bin/semanatec/target/release/semanatec"
# interval = 3600
# format-prefix = ""
# };
"module/pulseaudio" = {
type = "internal/pulseaudio";
format-volume = "<label-volume>";
label-volume = "vol %percentage%%";
label-volume-foreground = "\${root.foreground}";
label-muted = "vol 0%";
label-muted-foreground = "\${root.foreground}";
bar-volume-width = 10;
bar-volume-foreground-0 = "#55aa55";
bar-volume-foreground-1 = "#55aa55";
bar-volume-foreground-2 = "#55aa55";
bar-volume-foreground-3 = "#55aa55";
bar-volume-foreground-4 = "#55aa55";
bar-volume-foreground-5 = "#f5a70a";
bar-volume-foreground-6 = "#ff5555";
bar-volume-gradient = false;
bar-volume-indicator = "|";
bar-volume-indicator-font = 2;
bar-volume-fill = "";
bar-volume-fill-font = 2;
bar-volume-empty = "";
bar-volume-empty-font = 2;
bar-volume-empty-foreground = "\${colors.foreground-alt}";
};
"module/alsa" = {
type = "internal/alsa";
format-volume = "<label-volume> <bar-volume>";
label-volume = "VOL";
label-volume-foreground = "\${root.foreground}";
format-muted-prefix = "vol ";
format-muted-foreground = "\${colors.foreground-alt}";
label-muted = "sound muted";
bar-volume-width = 10;
bar-volume-foreground-0 = "#55aa55";
bar-volume-foreground-1 = "#55aa55";
bar-volume-foreground-2 = "#55aa55";
bar-volume-foreground-3 = "#55aa55";
bar-volume-foreground-4 = "#55aa55";
bar-volume-foreground-5 = "#f5a70a";
bar-volume-foreground-6 = "#ff5555";
bar-volume-gradient = false;
bar-volume-indicator = "|";
bar-volume-indicator-font = 2;
bar-volume-fill = "";
bar-volume-fill-font = 2;
bar-volume-empty = "";
bar-volume-empty-font = 2;
bar-volume-empty-foreground = "\${colors.foreground-alt}";
};
"module/battery" = {
type = "internal/battery";
battery = "BAT0";
adapter = "ADP1";
full-at = 98;
format-charging = "<animation-charging> <label-charging>";
format-charging-underline = "#ffb52a";
format-discharging = "<animation-discharging> <label-discharging>";
format-discharging-underline = "\${self.format-charging-underline}";
format-full-prefix = " ";
format-full-prefix-foreground = "\${colors.foreground-alt}";
format-full-underline = "\${self.format-charging-underline}";
ramp-capacity-0 = "";
ramp-capacity-1 = "";
ramp-capacity-2 = "";
ramp-capacity-foreground = "\${colors.foreground-alt}";
animation-charging-0 = "";
animation-charging-1 = "";
animation-charging-2 = "";
animation-charging-foreground = "\${colors.foreground-alt}";
animation-charging-framerate = 750;
animation-discharging-0 = "";
animation-discharging-1 = "";
animation-discharging-2 = "";
animation-discharging-foreground = "\${colors.foreground-alt}";
animation-discharging-framerate = 750;
};
"module/temperature" = {
type = "internal/temperature";
warn-temperature = 60;
hwmon-path = "/sys/devices/pci0000:00/0000:00:18.3/hwmon/hwmon1/temp2_input";
format = "<ramp> <label>";
format-warn = "<ramp> <label-warn>";
label = "cpu %temperature-c%";
label-warn = "cpu %temperature-c%";
label-warn-foreground = "\${colors.secondary}";
ramp-0 = "";
ramp-1 = "";
ramp-2 = "";
ramp-foreground = "\${colors.foreground-alt}";
};
"module/gputemperature" = {
type = "internal/temperature";
warn-temperature = 60;
hwmon-path = "/sys/devices/pci0000:00/0000:00:03.1/0000:09:00.0/hwmon/hwmon3/temp1_input";
format = "<ramp> <label>";
format-warn = "<ramp> <label-warn>";
label = "gpu %temperature-c%";
label-warn = "gpu %temperature-c%";
label-warn-foreground = "\${colors.secondary}";
ramp-0 = "";
ramp-1 = "";
ramp-2 = "";
ramp-foreground = "\${colors.foreground-alt}";
};
"module/nvmetemperature" = {
type = "internal/temperature";
warn-temperature = 60;
hwmon-path = "/sys/devices/pci0000:00/0000:00:01.1/0000:01:00.0/hwmon/hwmon0/temp1_input";
format = "<ramp> <label>";
format-warn = "<ramp> <label-warn>";
label = "M.2 %temperature-c%";
label-warn = "M.2 %temperature-c%";
label-warn-foreground = "\${colors.secondary}";
ramp-0 = "";
ramp-1 = "";
ramp-2 = "";
ramp-foreground = "\${colors.foreground-alt}";
};
"module/powermenu" = {
type = "custom/menu";
expand-right = true;
format-spacing = 1;
label-open = "";
label-open-foreground = "\${colors.secondary}";
label-close = " cancel";
label-close-foreground = "\${colors.secondary}";
label-separator = "|";
label-separator-foreground = "\${colors.foreground-alt}";
menu-0-0 = "reboot";
menu-0-0-exec = "menu-open-1";
menu-0-1 = "power off";
menu-0-1-exec = "menu-open-2";
menu-1-0 = "cancel";
menu-1-0-exec = "menu-open-0";
menu-1-1 = "reboot";
menu-1-1-exec = "sudo reboot";
menu-2-0 = "power off";
menu-2-0-exec = "sudo poweroff";
menu-2-1 = "cancel";
menu-2-1-exec = "menu-open-0";
};
"module/sink_changer" = {
type = "custom/script";
exec = "/home/fabian/bin/polybar_scripts/info.sh";
label = "%output%";
click-left = "/home/fabian/bin/polybar_scripts/sink_changer.sh";
# format-prefix = " ";
interval = "0";
# format-prefix-foreground = "${colors.foreground-alt}";
};
"settings" = {
screenchange-reload = true;
# compositing-background = "xor";
# compositing-background = "screen";
# compositing-foreground = "source";
# compositing-border = "over";
# pseudo-transparency = false;
};
"global/wm" = {
margin-top = 5;
margin-bottom = 5;
};
};
};
};
}

22
home/gui/startx.nix Normal file
View file

@ -0,0 +1,22 @@
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.local.gui.startx;
in
{
options.local.gui.startx.enable = mkEnableOption "startx";
config = mkIf cfg.enable {
xsession.enable = true;
home.file.".xinitrc".source =
let
content =
if config.local.nixos then ''
exec ~/.xsession
'' else ''
exec ${pkgs.nixgl.nixGLIntel}/bin/nixGLIntel ~/.xsession
'';
in
pkgs.writeShellScript "xinitrc" content;
};
}

18
home/isolation.nix Normal file
View file

@ -0,0 +1,18 @@
{ pkgs, config, lib, ... }:
with lib;
{
home.isolation = {
enable = true;
btrfsSupport = true;
defaults = {
static = true;
bindHome = "home/";
persist = {
base = "shenvs";
btrfs = true;
};
};
modulesUnder = ./shenvs;
};
}

28
home/options.nix Normal file
View file

@ -0,0 +1,28 @@
{ config, lib, ... }:
with lib;
{
options.local = with types; {
platform = mkOption {
type = str;
};
display = {
"0" = mkOption {
type = str;
};
"1" = mkOption {
type = nullOr str;
};
autorandrProfile = mkOption {
type = attrs;
};
};
nixos = mkOption {
type = bool;
};
};
}

View file

@ -0,0 +1,42 @@
{
config.local = {
nixos = true;
apps = {
steam.enable = true;
virtmanager.enable = true;
defaultApps.enable = true;
};
display = {
"0" = "DP-1";
"1" = "DP-2";
autorandrProfile = {
fingerprint = {
DP-1 = "00ffffffffffff003669a03bd4040000231e0104a5341d783bd005ac5048a627125054bfcf00814081809500714f81c0b30001010101023a801871382d40582c450009252100001e0882805070384d400820f80c09252100001a000000fd003090b4b422010a202020202020000000fc004d53492047323443340a20202001a2020320f14d010304131f120211900e0f1d1e230907078301000065030c001000866f80a0703840403020350009252100001a0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e9";
DP-2 = "00ffffffffffff0009d1e77845540000061f0104a5351e783a0565a756529c270f5054a56b80d1c0b300a9c08180810081c001010101023a801871382d40582c45000f282100001e000000ff0039324d30303033323031510a20000000fd00324c1e5311010a202020202020000000fc0042656e51204757323438300a20019b02031cf14f901f041303120211011406071516052309070783010000023a801871382d40582c45000f282100001f011d8018711c1620582c25000f282100009f011d007251d01e206e2855000f282100001e8c0ad08a20e02d10103e96000f28210000180000000000000000000000000000000000000000000000000000008d";
};
config = {
DP-1 = {
enable = true;
primary = true;
position = "0x0";
mode = "1920x1080";
rate = "143.85";
rotate = "normal";
};
DP-2 = {
enable = true;
primary = false;
position = "1920x0";
mode = "1920x1080";
rate = "59.94";
rotate = "normal";
};
};
};
};
};
}

View file

@ -0,0 +1,25 @@
{
config.local = {
nixos = false;
display = {
"0" = "eDP-1";
"1" = null;
autorandrProfile = {
fingerprint = {
eDP-1 = "00ffffffffffff000dae0a1400000000291d0104a51f11780328659759548e271e505400000001010101010101010101010101010101363680a0703820403020a60035ad10000018000000fe004e3134304843412d4541450a20000000fe00434d4e0a202020202020202020000000fe004e3134304843412d4541450a200002";
};
config = {
eDP-1 = {
enable = true;
primary = true;
mode = "1920x1080";
rate = "60.0";
rotate = "normal";
};
};
};
};
};
}

14
home/shenvs/c.nix Normal file
View file

@ -0,0 +1,14 @@
{ pkgs, ... }:
{
static = true;
packages = with pkgs; [
binutils
cmake
curl
gdb
gnumake
rustup
valgrind
];
}

11
home/shenvs/python.nix Normal file
View file

@ -0,0 +1,11 @@
{ pkgs, ... }:
{
static = true;
packages = with pkgs; [
pipenv
(python310.withPackages (packages: with packages; [
setuptools
]))
];
}

7
home/systemd/default.nix Normal file
View file

@ -0,0 +1,7 @@
{ lib, pkgs, ... }:
with lib;
{
systemd.user.tmpfiles.rules = [
"d %t/tmp 0700 fabian fabian 24h"
];
}

129
home/zshrc.nix Normal file
View file

@ -0,0 +1,129 @@
{ maim, redshift, xclip, ... }: ''
# The following lines were added by compinstall
zstyle ':completion:*' auto-description 'specify: %d'
zstyle ':completion:*' completer _expand _complete _ignored _correct _approximate
zstyle ':completion:*' expand prefix suffix
zstyle ':completion:*' ignore-parents parent
zstyle ':completion:*' insert-unambiguous true
zstyle ':completion:*' list-colors ""
zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s
zstyle ':completion:*' list-suffixes true
zstyle ':completion:*' matcher-list "" 'm:{[:lower:]}={[:upper:]} m:{[:lower:][:upper:]}={[:upper:][:lower:]}' 'r:|[._-]=** r:|=** l:|=*'
zstyle ':completion:*' menu select=1
zstyle ':completion:*' original true
zstyle ':completion:*' preserve-prefix '//[^/]##/'
zstyle ':completion:*' verbose true
zstyle :compinstall filename '/home/fabian/.zshrc'
autoload -Uz compinit
compinit
# End of lines added by compinstall
# Lines configured by zsh-newuser-install
HISTFILE=~/.histfile
HISTSIZE=1000
SAVEHIST=1000
setopt autocd extendedglob nomatch
unsetopt beep notify
bindkey -v
# End of lines configured by zsh-newuser-install
# Prompt
setopt prompt_subst
autoload -Uz vcs_info
precmd_vcs_info() { vcs_info }
precmd_functions+=( precmd_vcs_info )
zstyle ':vcs_info:*' disable bzr cdv darcs mtn svk tla cvs svn
zstyle ':vcs_info:*' enable git
zstyle ':vcs_info:git+set-message:*' hooks format_msg
function +vi-format_msg {
local branch=$(git branch --show-current)
if [[ -z "$branch" ]] ; then
branch=$(git rev-parse --short HEAD)
fi
local color=""
if [[ -z $(git status --porcelain 2>/dev/null) ]];
then
color="%F{blue}"
fi
if [[ $(git status --porcelain 2>/dev/null | grep "^A \|^M " | wc -l) > 0 ]];
then
color="%F{green}"
fi
if [[ $(git status --porcelain 2>/dev/null | grep "^??\|^AM\|^.D" | wc -l) > 0 ]]
then
color="%F{red}"
fi
ret=1
hook_com[message]="$color($branch)%f "
return 0
}
PROMPT='%B[%~] ''${vcs_info_msg_0_}%b'
# Aliases and binds
alias ls='ls --color -F'
alias l='ls --color -FhAltr'
alias x='killall --ignore-case --user=$(whoami) --interactive'
alias sc='${maim}/bin/maim -s -u | ${xclip}/bin/xclip -selection clipboard -t image/png -i'
alias tree='tree -CF'
alias lock="betterlockscreen -l"
alias nightmode="${redshift}/bin/redshift -P -O 1000"
alias lightmode="${redshift}/bin/redshift -P -O 6500"
alias inbox="echo >> $HOME/gtd/inbox"
alias nixoide="nix repl '<nixpkgs>'"
alias vps="ssh -A vps"
bindkey -e
bindkey ";5D" backward-word
bindkey ";5C" forward-word
bindkey "\e[3~" delete-char
function use() {
local pkg
pkg="$1"
shift
nix shell "nixpkgs#$pkg" "$@"
}
function unuse() {
local pkg
pkg="$1"
shift
nix shell "unstable#$pkg" "$@"
}
function spawn () {
if [ ! -x "$(command -v $1)" ]
then
echo "spawn: no such program: $1" >&2
return 1
fi
$@ > /dev/null 0>&1 2>&1 &
disown
}
autoload -Uz up-line-or-beginning-search
zle -N up-line-or-beginning-search
autoload -Uz down-line-or-beginning-search
zle -N down-line-or-beginning-search
bindkey '\eOA' up-line-or-beginning-search
bindkey '\e[A' up-line-or-beginning-search
bindkey '\eOB' down-line-or-beginning-search
bindkey '\e[B' down-line-or-beginning-search
# Env
export TERM=xterm-256color
export EDITOR=nvim
export VISUAL=nvim
export PATH="$PATH:$HOME/.local/bin:$HOME/.cargo/bin"
export NIXPKGS_ALLOW_UNFREE=1
''

5
pkgs/default.nix Normal file
View file

@ -0,0 +1,5 @@
pkgs:
{
#andesight = pkgs.callPackage ./andesight {};
#netextender = pkgs.callPackage ./netextender {};
}