it builds it runs it seems ok!!!!!!

This commit is contained in:
krizej 2024-08-01 21:22:47 +02:00
parent dd7b391753
commit 4662de75f9
28 changed files with 1495 additions and 17 deletions

View file

@ -1,5 +1,6 @@
{
description = ":-)";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
@ -11,17 +12,7 @@
nur.url = "github:nix-community/NUR";
};
outputs = { nixpkgs, home-manager, nur, ... }: {
nixosConfigurations = {
"krizej-pc" = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
{ nixpkgs.overlays = [ nur.overlay ]; }
nur.nixosModules.nur
home-manager.nixosModules.home-manager
./configuration.nix
];
};
};
outputs = { ... } @ inputs: {
nixosConfigurations = import ./hosts { inherit inputs; };
};
}

18
hosts/default.nix Normal file
View file

@ -0,0 +1,18 @@
{ inputs, ... }:
{
"desktop" = inputs.nixpkgs.lib.nixosSystem {
modules = [
./desktop
../modules
inputs.home-manager.nixosModules.home-manager
];
};
# "laptop" = inputs.nixpkgs.lib.nixosSystem {
# modules = [
# ./laptop
# ../modules
# # { nixpkgs.overlays = [ nur.overlay ]; }
# # nur.nixosModules.nur
# ];
# };
}

130
hosts/desktop/default.nix Normal file
View file

@ -0,0 +1,130 @@
{ config, pkgs, ... }:
{
imports = [
./hardware-configuration.nix
];
config = let
monitors = {
primary = "DisplayPort-2";
secondary = "HDMI-A-0";
};
user = config.chuj.system.user;
in {
hardware.amdgpu.amdvlk.enable = true;
boot = {
loader = {
timeout = 2;
grub = {
enable = true;
device = "/dev/disk/by-id/ata-Samsung_SSD_860_EVO_500GB_S4CNNE0M700172J";
gfxmodeBios = "auto"; # 1920x1080 did not work, this doesn't either
splashImage = null;
font = null;
};
};
# this doesn't even work
kernelParams = [
"video=${monitors.primary}:1920x1080@240"
"video=${monitors.secondary}:1920x1080@75"
];
initrd.kernelModules = [ "amdgpu" ];
};
environment.systemPackages = [ pkgs.ntfs3g ]; # for hdd disk
home-manager.users.${user}.home.packages = with pkgs; [
pamixer
kicad
sqlitebrowser
obs-studio
yt-dlp
aseprite
cloc
viu
];
chuj = {
system = {
user = "krizej";
host = "desktop";
platform = "x86_64-linux";
groups = [ "dialout" ];
};
home-manager.enable = true;
stuff = {
xserver.enable = true;
sddm.enable = true;
alacritty.enable = true;
vim.enable = true;
firefox.enable = true;
thunar.enable = true;
flameshot.enable = true;
git.enable = true;
other-desktop-programs.enable = true;
other-dev-programs.enable = true;
gaming.enable = true;
documentation.enable = true;
theme.enable = true;
autorandr = {
enable = true;
fingerprint = {
"Left" = "00ffffffffffff0026cd5961830600001d1f0104b5361e783b4c70a5574ea4260b5054a56b80710081408180a940b3009500950fd1c0023a801871382d40582c4500202f2100001e000000ff0031313737393132393031363637000000fd0030f0ffff3c010a202020202020000000fc00504c3235393048530a20202020019202033bf1529005040302011112131f203f140607151640e200d52309070783010000e305c301e60605016666006d1a0000020130f00000000000005a8780a070384d4030203500202f2100001ad09480a070381e4008203500202f2100001a23e88078703887401c40980c202f2100001a000000000000000000000000000063";
"Right" = "00ffffffffffff0026cd326162190000291c010380361e782a9055a75553a028135054a56b80710081408180a940b3009500950fd1c0023a801871382d40582c4500202f2100001e000000ff0031313534333834313036343938000000fd00374c1e5312000a202020202020000000fc00504c32353330480a2020202020016202032bf14f90050403020111121314060715161f230907078301000065030c001000681a00000101284be6023a801871382d40582c4500202f2100001f011d8018711c1620582c2500202f2100009e011d007251d01e206e285500202f2100001e2a4480a07038274030203500202f2100001a000000000000000000000000ab";
};
config = {
"Left" = {
enable = true;
mode = "1920x1080";
rate = "239.76";
position = "0x0";
primary = true;
};
"Right" = {
enable = true;
mode = "1920x1080";
rate = "74.97";
position = "1920x0";
};
};
};
fish = {
enable = true;
extraAliases = {
"rebuild" = "sudo nixos-rebuild switch --flake ~/nix#desktop -v";
};
};
i3 = {
enable = true;
workspaceOutput = {
"1" = monitors.primary;
"2" = monitors.secondary;
};
};
ssh = {
enable = true;
keys = {
"git@github.com".file = "github";
"forgejo@git.jacekpoz.pl".file = "jacekgit";
"krizej@192.168.1.12".file = "rpi";
"discord@zasadzka.pl" = {
file = "zasadzka";
env."TERM" = "xterm-256color";
};
};
};
dunst = {
enable = true;
output = monitors.secondary;
side = "left";
};
};
};
};
}

View file

@ -1,9 +1,6 @@
{ ... }:
{ pkgs, ... }:
{
imports = [
./hardware-configuration.nix
./programs
./services
./misc
];
}
}

25
modules/default.nix Normal file
View file

@ -0,0 +1,25 @@
{ ... }:
{
imports = [
./system.nix
./home-manager.nix
./stuff/ssh.nix
./stuff/alacritty.nix
./stuff/dunst.nix
./stuff/firefox.nix
./stuff/fish.nix
./stuff/flameshot.nix
./stuff/git.nix
./stuff/i3.nix
./stuff/autorandr.nix
./stuff/sddm.nix
./stuff/thunar.nix
./stuff/vim.nix
./stuff/xserver.nix
./stuff/documentation.nix
./stuff/theme.nix
./stuff/gaming.nix
./stuff/other-desktop-programs.nix
./stuff/other-dev-programs.nix
];
}

35
modules/home-manager.nix Normal file
View file

@ -0,0 +1,35 @@
{ lib, pkgs, config, inputs, self, ...}: let
inherit (lib) mkIf mkEnableOption mkOption;
cfg = config.chuj.home-manager;
user = config.chuj.system.user;
in {
options.chuj.home-manager = {
enable = mkEnableOption "home-manager";
};
# https://git.jacekpoz.pl/jacekpoz/niksos/src/branch/main/modules/other/home-manager.nix
# imports = [ inputs.home-manager.nixosModules.home-manager ];
config = mkIf cfg.enable {
home-manager = {
useUserPackages = true;
useGlobalPkgs = true;
extraSpecialArgs = { inherit inputs self; };
users.${user} = {
programs = {
home-manager.enable = true;
direnv = {
enable = true;
nix-direnv.enable = true;
};
};
home = {
username = user;
homeDirectory = "/home/${user}";
stateVersion = lib.mkDefault "23.11";
};
};
};
};
}

View file

@ -0,0 +1,53 @@
{ lib, pkgs, config, ... }: let
inherit (lib) mkIf mkEnableOption;
cfg = config.chuj.stuff.alacritty;
in {
options.chuj.stuff.alacritty = {
enable = mkEnableOption "alacritty";
};
config = mkIf cfg.enable {
home-manager.users.krizej.programs.alacritty = {
package = pkgs.alacritty-sixel;
enable = true;
settings = {
font.size = 10;
window.padding = { x = 2; y = 2; };
cursor = {
style = {
shape = "Beam";
blinking = "On";
};
blink_timeout = 0;
unfocused_hollow = false;
};
colors = {
primary = {
foreground = "#e4e4ef";
background = "#181818";
};
normal = {
black = "#202020";
red = "#f43841";
green = "#73c936";
yellow = "#ffdd33";
blue = "#5a81ce";
magenta = "#ae65b7";
cyan = "#71afcf";
white = "#dddddd";
};
bright = {
black = "#282828";
red = "#ff4f58";
green = "#91d956";
yellow = "#ffee55";
blue = "#71afe8";
magenta = "#ce85e7";
cyan = "#91dfef";
white = "#f4f4ff";
};
};
};
};
};
}

View file

@ -0,0 +1,40 @@
{ lib, pkgs, config, ...}: let
inherit (lib) mkIf mkEnableOption mkOption types;
cfg = config.chuj.stuff.autorandr;
user = config.chuj.system.user;
in {
options.chuj.stuff.autorandr = {
enable = mkEnableOption "autorandr";
fingerprint = mkOption {
type = types.attrs;
default = null;
};
config = mkOption {
type = types.attrs;
default = null;
};
};
config = mkIf cfg.enable {
home-manager.users.${user} = {
programs.autorandr = {
enable = true;
profiles."main" = { inherit (cfg) fingerprint config; };
};
# the autorandr service from home-manager sucks, can't customize flags
services.autorandr.enable = false;
systemd.user.services.autorandr = {
Unit = {
Description = "autorandr";
After = [ "graphical-session-pre.target" ];
PartOf = [ "graphical-session.target" ];
};
Service = {
Type = "oneshot";
ExecStart = "${pkgs.autorandr}/bin/autorandr --match-edid -l main";
};
Install.WantedBy = [ "graphical-session.target" ];
};
};
};
}

View file

@ -0,0 +1,23 @@
{ lib, pkgs, config, ...}: let
inherit (lib) mkIf mkEnableOption mkOption;
cfg = config.chuj.stuff.other-desktop-programs;
user = config.chuj.system.user;
in {
options.chuj.stuff.other-desktop-programs = {
enable = mkEnableOption "other-desktop-programs";
};
config = mkIf cfg.enable {
home-manager.users.${user}.home.packages = with pkgs; [
pavucontrol
element-desktop
discord
libreoffice-qt
gimp
vlc
qimgv
];
};
}

View file

@ -0,0 +1,29 @@
{ lib, pkgs, config, ...}: let
inherit (lib) mkIf mkEnableOption mkOption;
cfg = config.chuj.stuff.other-dev-programs;
user = config.chuj.system.user;
in {
options.chuj.stuff.other-dev-programs = {
enable = mkEnableOption "other-dev-programs";
};
config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [
cmake
pkg-config
nixd
gdb
clang-tools
valgrind
linuxKernel.packages.linux_6_6.perf
ccache
];
home-manager.users.${user}.home.packages = with pkgs; [
# TODO: plugins
jetbrains.pycharm-community
jetbrains.clion
];
};
}

View file

@ -0,0 +1,37 @@
{ lib, pkgs, config, ...}: let
inherit (lib) mkIf mkEnableOption mkOption types;
cfg = config.chuj.stuff.documentation;
user = config.chuj.system.user;
in {
options.chuj.stuff.documentation = {
enable = mkEnableOption "documentation";
cDeveloper = mkOption {
type = types.bool;
default = true;
};
};
config = mkIf cfg.enable {
documentation = {
enable = true;
dev.enable = true;
doc.enable = false;
info.enable = false;
man = {
enable = true;
generateCaches = false;
man-db.enable = false;
mandoc.enable = true;
};
};
home-manager.users.${user}.home.sessionVariables = mkIf cfg.cDeveloper {
# c docs first
"MANSECT" = "2:3:3p:3type:1:1p:n:l:8:0:0p:5:4:9:6:7";
};
environment.systemPackages = with pkgs; [
man
man-pages
man-pages-posix
];
};
}

34
modules/stuff/dunst.nix Normal file
View file

@ -0,0 +1,34 @@
{ lib, pkgs, config, ... }: let
inherit (lib) mkIf mkEnableOption mkOption types;
cfg = config.chuj.stuff.dunst;
user = config.chuj.system.user;
in {
options.chuj.stuff.dunst = {
enable = mkEnableOption "dunst";
output = mkOption {
type = types.str;
default = null;
};
side = mkOption {
type = types.str;
default = "right";
};
};
config = mkIf cfg.enable {
home-manager.users.${user}.services.dunst = {
enable = true;
settings = {
global = {
monitor = if cfg.output != null then cfg.output else 0;
origin = "bottom-${cfg.side}";
frame_width = 1;
background = "#333333";
foreground = "#feeeee";
font = "JetBrains Mono NL 10";
frame_color = "#4c7899";
};
};
};
};
}

177
modules/stuff/firefox.nix Normal file
View file

@ -0,0 +1,177 @@
{ lib, pkgs, config, ... }: let
cfg = config.chuj.stuff.firefox;
inherit (lib) mkIf mkEnableOption mkOption types;
in {
options.chuj.stuff.firefox = {
enable = mkEnableOption "firefox";
};
config = mkIf cfg.enable {
home-manager.users.krizej.programs.firefox = {
enable = true;
policies = {
DisableTelemetry = true;
DisableFirefoxStudies = true;
EnableTrackingProtection = {
Value = true;
Locked = true;
Cryptomining = true;
Fingerprinting = true;
};
DisablePocket = true;
DisableFirefoxAccounts = true;
DisableAccounts = true;
DisableFirefoxScreenshots = true;
OverridePostUpdatePage = "";
DontCheckDefaultBrowser = true;
DisplayBookmarksToolbar = "always";
DisplayMenuBar = "default-off";
SearchBar = "unified";
DefaultDownloadDirectory = "$HOME/downloads";
ExtensionSettings = {
# ublock origin
"uBlock0@raymondhill.net" = {
install_url = "https://addons.mozilla.org/firefox/downloads/latest/ublock-origin/latest.xpi";
installation_mode = "force_installed";
};
# youtube redux
"{2d4c0962-e9ff-4cad-8039-9a8b80d9b8b6}" = {
install_url = "https://addons.mozilla.org/firefox/downloads/file/4224361/latest.xpi";
installation_mode = "force_installed";
};
# sponsorblock
"sponsorBlocker@ajay.app" = {
install_url = "https://addons.mozilla.org/firefox/downloads/file/4251917/latest.xpi";
installation_mode = "force_installed";
};
# legacy wikipedia layout
"{484f3bc9-b13b-4498-8ea6-124c199c5ca8}" = {
install_url = "https://addons.mozilla.org/firefox/downloads/file/4100662/latest.xpi";
installation_mode = "force_installed";
};
};
};
profiles.krizej = {
id = 0;
isDefault = true;
search = {
default = "envs.net - SearXNG";
force = true;
engines = {
"envs.net - SearXNG" = {
urls = [ { template = "https://searx.envs.net/searxng/search?q={searchTerms}"; } ];
icon = "https://envs.net/favicon.ico";
iconUpdateURL = "https://envs.net/favicon.ico";
updateInterval = 24 * 60 * 60 * 1000;
definedAliases = [ "@sx" ];
};
# searx sometimes sucks
"Google".metaData.alias = "@g";
"Wikipedia (en)".metaData.alias = "@w";
"Nix Packages" = {
urls = [ { template = "https://search.nixos.org/packages?channel=unstable&query={searchTerms}"; } ];
icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
definedAliases = [ "@np" ];
};
"Nix Options" = {
urls = [ { template = "https://search.nixos.org/options?channel=unstable&query={searchTerms}"; } ];
icon = "${pkgs.nixos-icons}/share/icons/hicolor/scalable/apps/nix-snowflake.svg";
definedAliases = [ "@no" ];
};
"Home Manger" = {
urls = [ { template = "https://home-manager-options.extranix.com/?release=master&query={searchTerms}"; } ];
icon = "https://home-manager-options.extranix.com/images/favicon.png";
iconUpdateURL = "https://home-manager-options.extranix.com/images/favicon.png";
updateInterval = 24 * 60 * 60 * 1000;
definedAliases = [ "@hm" ];
};
"Arch Wiki" = {
urls = [ { template = "https://wiki.archlinux.org/index.php?search={searchTerms}"; } ];
icon = "https://wiki.archlinux.org/favicon.ico";
iconUpdateURL = "https://wiki.archlinux.org/favicon.ico";
updateInterval = 24 * 60 * 60 * 1000;
definedAliases = [ "@aw" ];
};
"NixOS Wiki" = {
# todo the other nix wiki
urls = [ { template = "https://nixos.wiki/index.php?search={searchTerms}&go=Go"; } ];
icon = "https://nixos.wiki/favicon.png";
iconUpdateURL = "https://nixos.wiki/favicon.png";
updateInterval = 24 * 60 * 60 * 1000;
definedAliases = [ "@nw" ];
};
# todo: add polish wikipedia and wolfram alpha and noogle.dev
# the rest can fuck off
"Bing".metaData.hidden = true;
"DuckDuckGo".metaData.hidden = true;
"eBay".metaData.hidden = true; # ??? who up ebaying they firegfox
};
};
settings = {
"extensions.activeThemeID" = "firefox-compact-dark@mozilla.org";
"services.sync.prefs.sync.extensions.activeThemeID" = "false";
# https://git.jacekpoz.pl/jacekpoz/niksos/src/branch/master/modules/gui/firefox.nix#L405
# but modified (a bit)
"browser.aboutConfig.showWarning" = false;
"browser.startup.page" = 0;
"browser.startup.homepage" = "about:home";
"browser.newtabpage.enabled" = true;
"browser.newtabpage.activity-stream.showSponsored" = false;
"browser.newtabpage.activity-stream.showSponsoredTopSites" = false;
"browser.newtabpage.activity-stream.default.sites" = "";
"extensions.getAddons.showPane" = false;
"extensions.htmlaboutaddons.recommendations.enabled" = false;
"browser.discovery.enabled" = false;
"extensions.unifiedExtensions.enabled" = false;
"datareporting.policy.dataSubmissionEnabled" = false;
"datareporting.healthreport.uploadEnabled" = false;
"toolkit.telemetry.unified" = false;
"toolkit.telemetry.enabled" = false;
"toolkit.telemetry.server" = "data:,";
"toolkit.telemetry.archive.enabled" = false;
"toolkit.telemetry.newProfilePing.enabled" = false;
"toolkit.telemetry.shutdownPingSender.enabled" = false;
"toolkit.telemetry.updatePing.enabled" = false;
"toolkit.telemetry.bhrPing.enabled" = false;
"toolkit.telemetry.firstShutdownPing.enabled" = false;
"toolkit.telemetry.coverage.opt-out" = true;
"toolkit.coverage.endpoint.base" = "";
"browser.ping-centre.telemetry" = false;
"browser.newtabpage.activity-stream.feeds.telemetry" = false;
"browser.newtabpage.activity-stream.telemetry" = false;
"app.shield.optoutstudies.enabled" = false;
"app.normandy.enabled" = false;
"app.normandy.api_url" = "";
"breakpad.reportURL" = "";
"browser.tabs.crashReporting.sendReport" = false;
"browser.crashReports.unsubmittedCheck.enabled" = false;
"browser.crashReports.unsubmittedCheck.autoSubmit2" = false;
"captivedetect.canonicalURL" = "";
"network.captive-portal-service.enabled" = false;
"network.connectivity-service.enabled" = false;
"browser.safebrowsing.malware.enabled" = false;
"browser.safebrowsing.phishing.enabled" = false;
"browser.safebrowsing.downloads.enabled" = false;
"browser.safebrowsing.downloads.remote.enabled" = false;
"browser.safebrowsing.downloads.remote.url" = "";
"browser.safebrowsing.downloads.remote.block_potentially_unwanted" = false;
"browser.safebrowsing.downloads.remote.block_uncommon" = false;
"browser.safebrowsing.allowOverride" = false;
"privacy.resistFingerprinting.block_mozAddonManager" = true;
"gfx.webrender.all" = true;
# "media.ffmpeg.vaapi.enabled" = true;
# "identity.sync.tokenserver.uri" = "https://ffsync.jacekpoz.pl/1.0/sync/1.5";
"dom.private-attribution.submission.enabled" = false;
};
};
};
};
}

113
modules/stuff/fish.nix Normal file
View file

@ -0,0 +1,113 @@
{ lib, pkgs, config, ... }: let
inherit (lib) mkIf mkEnableOption mkOption types mergeAttrs;
cfg = config.chuj.stuff.fish;
user = config.chuj.system.user;
in {
options.chuj.stuff.fish = {
enable = mkEnableOption "fish";
extraAliases = mkOption {
type = types.attrs;
default = {};
};
};
config = let
XDG_DATA_HOME = config.home-manager.users.${user}.xdg.dataHome;
in mkIf cfg.enable {
environment.systemPackages = [ pkgs.fish ];
programs.fish.enable = true;
users.users.${user}.shell = pkgs.fish;
programs.fish.promptInit = ''
${pkgs.any-nix-shell}/bin/any-nix-shell fish --info-right | source
'';
home-manager.users.${user}.programs.fish = {
enable = true;
shellAliases = mergeAttrs {
"ls" = "${pkgs.eza}/bin/eza -lhs type";
"cp" = "cp -v";
"mv" = "mv -v";
"ytmp3" = "yt-dlp -o '%(title)s.%(ext)s' -x --audio-format mp3";
"myip" = "curl ifconfig.me";
"0x0" = ''curl -F"file=@$argv" https://0x0.st'';
"wget" = "${pkgs.wget}/bin/wget --hsts-file='${XDG_DATA_HOME}/wget-hsts'";
} cfg.extraAliases;
shellAbbrs = { # mkif xclip in pkgs
"2clip" = "xclip -selection clipboard";
};
functions = {
"fish_greeting" = "${(pkgs.fortune.override { withOffensive = true; })}/bin/fortune";
"fish_prompt" = ''
# name: Informative Vcs
# author: Mariusz Smykula <mariuszs at gmail.com>
# function fish_prompt --description 'Write out the prompt'
set -l last_pipestatus $pipestatus
set -lx __fish_last_status $status # Export for __fish_print_pipestatus.
if not set -q __fish_git_prompt_show_informative_status
set -g __fish_git_prompt_show_informative_status 1
end
if not set -q __fish_git_prompt_hide_untrackedfiles
set -g __fish_git_prompt_hide_untrackedfiles 1
end
if not set -q __fish_git_prompt_color_branch
set -g __fish_git_prompt_color_branch magenta --bold
end
if not set -q __fish_git_prompt_showupstream
set -g __fish_git_prompt_showupstream informative
end
if not set -q __fish_git_prompt_color_dirtystate
set -g __fish_git_prompt_color_dirtystate blue
end
if not set -q __fish_git_prompt_color_stagedstate
set -g __fish_git_prompt_color_stagedstate yellow
end
if not set -q __fish_git_prompt_color_invalidstate
set -g __fish_git_prompt_color_invalidstate red
end
if not set -q __fish_git_prompt_color_untrackedfiles
set -g __fish_git_prompt_color_untrackedfiles $fish_color_normal
end
if not set -q __fish_git_prompt_color_cleanstate
set -g __fish_git_prompt_color_cleanstate green --bold
end
set -l color_cwd
set -l suffix
if functions -q fish_is_root_user; and fish_is_root_user
if set -q fish_color_cwd_root
set color_cwd $fish_color_cwd_root
else
set color_cwd $fish_color_cwd
end
set suffix '#'
else
set color_cwd $fish_color_cwd
set suffix '$'
end
# PWD
set_color $color_cwd
echo -n (prompt_pwd)
set_color normal
printf '%s ' (fish_vcs_prompt)
set -l status_color (set_color $fish_color_status)
set -l statusb_color (set_color --bold $fish_color_status)
set -l prompt_status (__fish_print_pipestatus "[" "]" "|" "$status_color" "$statusb_color" $last_pipestatus)
echo -n $prompt_status
set_color normal
echo -n "$suffix "
# end
'';
};
};
};
}

View file

@ -0,0 +1,19 @@
{ lib, pkgs, config, ...}: let
inherit (lib) mkIf mkEnableOption mkOption;
cfg = config.chuj.stuff.flameshot;
in {
options.chuj.stuff.flameshot = {
enable = mkEnableOption "flameshot";
};
config = mkIf cfg.enable {
home-manager.users.krizej.services.flameshot = {
enable = true;
settings = {
General = {
disabledTrayIcon = true;
showStartupLaunchMessage = false;
};
};
};
};
}

39
modules/stuff/gaming.nix Normal file
View file

@ -0,0 +1,39 @@
{ lib, pkgs, config, ...}: let
inherit (lib) mkIf mkEnableOption mkOption types optionals;
cfg = config.chuj.stuff.gaming;
user = config.chuj.system.user;
in {
options.chuj.stuff.gaming = let
gameOption = mkOption { type = types.bool; default = true; };
in {
enable = mkEnableOption "gaming";
quake = gameOption;
homm3 = gameOption;
dosbox = gameOption;
ror2 = gameOption;
};
config = mkIf cfg.enable {
programs.steam.enable = true;
home-manager.users.${user}.home.packages = with pkgs; ([
wineWowPackages.stable
winetricks
]
++ optionals cfg.dosbox [ dosbox-staging ]
++ optionals cfg.ror2 [ r2modman ]
++ optionals cfg.quake [ vkquake ericw-tools-latest trenchbroom fteqcc gmqcc ]
++ optionals cfg.homm3 [
# todo download it from rpi maybe or something
(pkgs.writeShellScriptBin "homm3" ''
cd ~/games/homm3
wine HD_Launcher.exe
'')
]);
# Trenchbroom
nixpkgs.config.permittedInsecurePackages = optionals cfg.quake [
"freeimage-unstable-2021-11-01"
];
};
}

18
modules/stuff/git.nix Normal file
View file

@ -0,0 +1,18 @@
{ lib, pkgs, config, ...}: let
inherit (lib) mkIf mkEnableOption mkOption;
cfg = config.chuj.stuff.git;
user = config.chuj.system.user;
in {
options.chuj.stuff.git = {
enable = mkEnableOption "git";
};
config = {
environment.systemPackages = [ pkgs.git ];
home-manager.users.${user}.programs.git = {
enable = true;
userName = "krizej";
userEmail = "krizej@protonmail.com";
extraConfig.init.defaultBranch = "master";
};
};
}

279
modules/stuff/i3.nix Normal file
View file

@ -0,0 +1,279 @@
{ lib, pkgs, config, ...}: let
inherit (lib) mkIf mkEnableOption mkOption types;
cfg = config.chuj.stuff.i3;
user = config.chuj.system.user;
in {
options.chuj.stuff.i3 = {
enable = mkEnableOption "i3";
workspaceOutput = mkOption {
type = types.attrsOf types.str;
default = {};
};
communicators = mkOption {
type = types.submodule {
options = {
autostart = mkOption {
type = types.bool;
default = true;
};
workspace = mkOption {
type = types.str;
default = "2";
};
};
};
default = {};
};
};
config = let
HOME = config.home-manager.users.${user}.home.homeDirectory;
in mkIf cfg.enable {
services.xserver.windowManager.i3.enable = true;
home-manager.users.${user} = {
xsession.windowManager.i3 = {
enable = true;
config = rec {
assigns = mkIf (cfg.communicators.workspace != null) {
${cfg.communicators.workspace} = [
{ class = "discord"; }
{ class = "SchildiChat"; }
{ class = "element"; }
];
};
window = {
border = 1;
titlebar = true;
};
floating = {
border = 1;
titlebar = true;
criteria = [
{ class = "zenity"; }
{ class = "fceux"; }
{ title = "Friends List"; }
];
};
gaps = {
inner = 0;
outer = 0;
};
fonts = {
names = [ "JetBrains Mono NL" ];
size = 10.0;
};
bars = [
{
inherit fonts;
trayOutput = "primary";
statusCommand = "${pkgs.i3status}/bin/i3status";
}
];
defaultWorkspace = "workspace number 1";
workspaceOutputAssign = lib.mapAttrsToList
(workspace: output: { inherit workspace output; })
cfg.workspaceOutput;
focus = {
followMouse = true;
mouseWarping = true;
newWindow = "urgent";
};
startup = [
{ command = "autotiling &"; notification = false; }
# { command = "mpd &"; notification = false; }
]
++ optionals config.chuj.stuff.dunst.enable { command = "dunst &"; notification = false; }
++ optionals config.chuj.stuff.flameshot.enable { command = "flameshot &"; notification = false; }
++ optionals cfg.communicators.autostart [
{ command = "i3-msg \"workspace ${cfg.communicators.workspace}; append_layout ${../../files/i3_communicators_layout.json}\""; notification = false; }
{ command = "discord &"; notification = false; }
{ command = "element-desktop &"; notification = false; }
];
modes = let
cmd_and_center = cmd: "exec --no-startup-id i3-msg '${cmd}' && i3-center-mouse-on-focus";
in {
resize = {
"Left" = cmd_and_center "resize shrink width 10 px or 10 ppt";
"Right" = cmd_and_center "resize grow width 10 px or 10 ppt";
"Up" = cmd_and_center "resize shrink height 10 px or 10 ppt";
"Down" = cmd_and_center "resize grow height 10 px or 10 ppt";
"Escape" = "mode default";
};
};
modifier = "Mod4";
floating.modifier = "Mod4";
keybindings = let
mod = modifier;
execns = "exec --no-startup-id";
cmd_and_center = cmd: "${execns} i3-msg '${cmd}' && i3custom-center-mouse-on-focus";
in {
# Program keybinds
"${mod}+Return" = ''${execns} ${if config.chuj.stuff.alacritty.enable then "alacritty" else "i3-sensible-terminal"}'';
"${mod}+Shift+s" = mkIf config.chuj.stuff.flameshot.enable "${execns} flameshot gui";
"${mod}+b" = mkIf config.chuj.stuff.firefox.enable "${execns} firefox";
"${mod}+d" = "${execns} dmenu_run";
"--release ${mod}+k" = "${execns} xkill";
# Volume control
"Ctrl+F9" = "${execns} pamixer --toggle-mute";
"Ctrl+F10" = "${execns} pamixer --decrease 5";
"Ctrl+F11" = "${execns} pamixer --increase 5";
# MPD controls
# "Ctrl+F5" = "exec ~/music/select_music.sh";
# "Ctrl+F6" = "exec mpc prev";
# "Ctrl+F7" = "exec mpc toggle";
# "Ctrl+F8" = "exec mpc next";
# "Ctrl+Shift+F6" = "exec mpc seek -3";
# "Ctrl+Shift+F7" = "exec mpc clear";
# "Ctrl+Shift+F8" = "exec mpc seek +3";
# "Ctrl+Shift+F10" = ''exec mpc volume -5 && dunstify "mpc $(mpc volume)" -r 420'';
# "Ctrl+Shift+F11" = ''exec mpc volume +5 && dunstify "mpc $(mpc volume)" -r 420'';
# General i3 keybindings
"${mod}+f" = cmd_and_center "fullscreen toggle";
"${mod}+r" = "mode resize";
"${mod}+Shift+q" = cmd_and_center "kill";
"${mod}+Shift+r" = "restart";
"${mod}+Shift+e" = "${execns} i3-nagbar -t warning -m 'exit?' -b 'yes' 'i3-msg exit'";
# Mouse bindings
"--border button3" = "${execns} i3custom-window-actions";
"${mod}+Left" = cmd_and_center "focus left";
"${mod}+Right" = cmd_and_center "focus right";
"${mod}+Up" = cmd_and_center "focus up";
"${mod}+Down" = cmd_and_center "focus down";
"${mod}+Shift+Left" = cmd_and_center "move left";
"${mod}+Shift+Right" = cmd_and_center "move right";
"${mod}+Shift+Up" = cmd_and_center "move up";
"${mod}+Shift+Down" = cmd_and_center "move down";
"${mod}+q" = cmd_and_center "layout stacking";
"${mod}+w" = cmd_and_center "layout tabbed";
"${mod}+e" = cmd_and_center "layout toggle split";
"${mod}+Shift+space" = "floating toggle; ${execns} i3custom-center-mouse-on-focus";
"${mod}+space" = cmd_and_center "focus mode_toggle";
"${mod}+1" = cmd_and_center "workspace number 1";
"${mod}+2" = cmd_and_center "workspace number 2";
"${mod}+3" = cmd_and_center "workspace number 3";
"${mod}+4" = cmd_and_center "workspace number 4";
"${mod}+5" = cmd_and_center "workspace number 5";
"${mod}+6" = cmd_and_center "workspace number 6";
"${mod}+7" = cmd_and_center "workspace number 7";
"${mod}+8" = cmd_and_center "workspace number 8";
"${mod}+9" = cmd_and_center "workspace number 9";
"${mod}+0" = cmd_and_center "workspace number 10";
"${mod}+Shift+1" = cmd_and_center "move container to workspace number 1";
"${mod}+Shift+2" = cmd_and_center "move container to workspace number 2";
"${mod}+Shift+3" = cmd_and_center "move container to workspace number 3";
"${mod}+Shift+4" = cmd_and_center "move container to workspace number 4";
"${mod}+Shift+5" = cmd_and_center "move container to workspace number 5";
"${mod}+Shift+6" = cmd_and_center "move container to workspace number 6";
"${mod}+Shift+7" = cmd_and_center "move container to workspace number 7";
"${mod}+Shift+8" = cmd_and_center "move container to workspace number 8";
"${mod}+Shift+9" = cmd_and_center "move container to workspace number 9";
"${mod}+Shift+0" = cmd_and_center "move container to workspace number 10";
};
};
};
programs.i3status = {
enable = true;
enableDefault = false;
general = {
interval = 1;
colors = true;
color_good = "#91d956";
color_bad = "#f43841";
color_degraded = "#ffdd33";
output_format = "i3bar";
};
modules = {
# todo MPD module (using read_file most likely, or switch to i3blocks)
"cpu_usage" = {
position = 0;
settings = {
format = "cpu: %usage";
};
};
"memory" = {
position = 1;
settings = {
format = "mem: %used";
threshold_degraded = "1G";
format_degraded = "MEMORY < %available";
};
};
"volume master" = {
position = 2;
settings = {
color_degraded = "#333333";
format = "vol: %volume";
format_muted = "vol: ---";
};
};
"tztime local" = {
position = 3;
settings = {
format = "%Y-%m-%d %H:%M:%S (%A)";
};
};
};
};
home.packages = with pkgs; [
autotiling
(pkgs.writeShellScriptBin "i3custom-center-mouse-on-focus" ''
eval $(xdotool getwindowfocus getwindowgeometry --shell)
MX=$(($X + $WIDTH / 2))
MY=$(($Y + $HEIGHT / 2))
xdotool mousemove $MX $MY
'')
(pkgs.writeShellScriptBin "i3custom-window-actions" ''
${pkgs.yad}/bin/yad --splash --mouse \
--title="i3 window actions" \
--gtkrc="${HOME}/.config/i3/i3gtk.css" \
--text="i3 window actions" \
--button float:0 --button kill:1
case $? in
0) i3-msg "floating toggle";;
1) i3-msg "kill";;
-1) ;;
esac
'')
(pkgs.writeShellScriptBin "i3custom-floating-toggle" ''
i3-msg "mark --add _; [con_mark=f] floating disable, border pixel 1, mark --add --toggle _; [con_mark=_] floating enable, border normal; mark --add --toggle f;"
'')
];
home.file = {
".config/i3/i3gtk.css".source = ../../files/i3gtk.css;
};
};
};
}

29
modules/stuff/sddm.nix Normal file
View file

@ -0,0 +1,29 @@
{ lib, pkgs, config, ...}: let
inherit (lib) mkIf mkEnableOption mkOption;
cfg = config.chuj.stuff.sddm;
in {
options.chuj.stuff.sddm = {
enable = mkEnableOption "sddm";
};
config = mkIf cfg.enable {
services.displayManager = {
# ah fuck this
defaultSession = "none+i3";
sddm = {
enable = true;
theme = "sddm-i3-theme";
settings = {
General = {
InputMethod = "";
};
};
};
};
environment.systemPackages = [
pkgs.sddm-i3-theme
pkgs.libsForQt5.sddm
];
};
}

32
modules/stuff/ssh.nix Normal file
View file

@ -0,0 +1,32 @@
{ lib, pkgs, config, ...}: let
inherit (lib) elemAt splitString mapAttrs' hasAttr mkIf mkEnableOption mkOption;
cfg = config.chuj.stuff.ssh;
user = config.chuj.system.user;
in {
options.chuj.stuff.ssh = {
enable = mkEnableOption "ssh";
keys = mkOption {
type = lib.types.attrs;
default = {};
};
};
config = mkIf cfg.enable {
services.openssh.enable = true;
home-manager.users.${user}.programs.ssh = {
enable = true;
matchBlocks = mapAttrs'
(host: hostcfg: {
name = elemAt (splitString "@" host) 1;
value = {
user = elemAt (splitString "@" host) 0;
identityFile = "~/.ssh/keys/${hostcfg.file}";
setEnv = if hasAttr "env" hostcfg
then hostcfg.env
else {};
};
}) cfg.keys;
};
};
}

61
modules/stuff/theme.nix Normal file
View file

@ -0,0 +1,61 @@
{ lib, pkgs, config, ...}: let
inherit (lib) mkIf mkEnableOption mkOption;
cfg = config.chuj.stuff.theme;
user = config.chuj.system.user;
in {
options.chuj.stuff.theme = {
enable = mkEnableOption "theme";
};
config = mkIf cfg.enable {
fonts = {
enableDefaultPackages = true;
packages = with pkgs; [
jetbrains-mono
];
fontconfig.defaultFonts = {
serif = [ "JetBrains Mono NL" ];
sansSerif = [ "JetBrains Mono NL" ];
monospace = [ "JetBrains Mono NL" ];
};
};
home-manager.users.${user} = {
home.pointerCursor = {
gtk.enable = true;
x11.enable = true;
name = "aero-drop";
package = pkgs.win7-cursors;
};
gtk = {
enable = true;
theme = {
name = "Adwaita-dark";
package = pkgs.gnome-themes-extra;
};
iconTheme = {
name = "Vimix-Black";
package = pkgs.vimix-icon-theme;
};
gtk2.configLocation = "${config.home-manager.users.${user}.xdg.configHome}/gtk-2.0/gtkrc";
};
qt = {
enable = true;
platformTheme.name = "adwaita";
style = {
name = "adwaita-dark";
package = pkgs.adwaita-qt;
};
};
dconf.settings."org/gnome/desktop/interface".color-scheme = "prefer-dark";
home.sessionVariables = {
GTK_USE_PORTAL = "1";
};
};
};
}

31
modules/stuff/thunar.nix Normal file
View file

@ -0,0 +1,31 @@
{ lib, pkgs, config, ...}: let
inherit (lib) mkIf mkEnableOption mkOption;
cfg = config.chuj.stuff.thunar;
user = config.chuj.system.user;
in {
options.chuj.stuff.thunar = {
enable = mkEnableOption "thunar";
};
config = mkIf cfg.enable {
programs = {
dconf.enable = true;
xfconf.enable = true;
thunar = {
enable = true;
plugins = with pkgs.xfce; [
thunar-volman
thunar-archive-plugin
thunar-media-tags-plugin
];
};
};
services.gvfs.enable = true;
services.tumbler.enable = true;
home-manager.users.${user}.home.packages = with pkgs; [
ffmpegthumbnailer
gsettings-desktop-schemas
xarchiver # not really thunar but can be here ig
];
};
}

67
modules/stuff/vim.nix Normal file
View file

@ -0,0 +1,67 @@
{ lib, pkgs, config, ...}: let
inherit (lib) mkIf mkEnableOption mkOption;
cfg = config.chuj.stuff.vim;
user = config.chuj.system.user;
in {
options.chuj.stuff.vim = {
enable = mkEnableOption "vim";
};
config = mkIf cfg.enable {
environment.systemPackages = [ pkgs.vim ];
home-manager.users.${user} = {
home.sessionVariables = { "EDITOR" = "vim"; };
# fixme: not .vim
home.file = { ".vim/colors/darcula.vim".source = ../../files/darcula.vim; };
programs.vim = {
enable = true;
defaultEditor = true;
plugins = [
pkgs.vimPlugins.indentLine
pkgs.vimPlugins.vim-gitgutter
];
settings = let
vimCache = "${config.home-manager.users.${user}.xdg.cacheHome}/vim";
in {
background = "dark";
backupdir = [ "${vimCache}/backup/" ];
copyindent = false;
directory = [ "${vimCache}/swap/" ];
expandtab = true;
hidden = false;
history = 420;
ignorecase = false;
modeline = true;
mouse = "a";
mousefocus = false;
mousehide = false;
mousemodel = "popup_setpos";
number = true;
relativenumber = true;
shiftwidth = 4;
smartcase = false;
tabstop = 4;
undodir = [ "${vimCache}/undo/" ];
undofile = false;
};
extraConfig = ''
set updatetime=100
set signcolumn=yes
set termguicolors
set cursorline
colorscheme darcula
let g:indentLine_char = ''
let g:c_no_ansi = 1
let g:c_functions = 1
let g:c_no_c99 = 1
let g:c_no_bsd = 1
let g:c_no_c11 = 1
let g:c_gnu = 1
'';
};
};
programs.nano.enable = false;
};
}

89
modules/stuff/xdg.nix Normal file
View file

@ -0,0 +1,89 @@
{ lib, pkgs, config, ...}: let
inherit (lib) mkIf mkEnableOption mkOption;
cfg = config.chuj.xdg;
in {
options.chuj.xdg = {
enable = mkEnableOption "xdg";
};
config = let
hmCfg = config.home-manager.users.${user};
HOME = hmCfg.home.homeDirectory;
in mkIf cfg.enable {
xdg.portal = {
enable = true;
xdgOpenUsePortal = true;
extraPortals = [ pkgs.xdg-desktop-portal-gtk ];
config.common.default = [ "*" ];
};
home-manager.users.${user} = {
xdg = {
dataHome = "${HOME}/.local/share";
configHome = "${HOME}/.config";
stateHome = "${HOME}/.local/state";
cacheHome = "${HOME}/.cache";
userDirs = {
enable = true;
desktop = "${HOME}/desktop";
documents = "${HOME}/documents";
download = "${HOME}/downloads";
music = "${HOME}/music";
pictures = "${HOME}/pictures";
publicShare = "${HOME}/public";
templates = "${HOME}/templates";
videos = "${HOME}/videos";
};
};
home.sessionVariables = {
XDG_DATA_HOME = hmCfg.xdg.dataHome;
XDG_CONFIG_HOME = hmCfg.xdg.configHome;
XDG_STATE_HOME = hmCfg.xdg.stateHome;
XDG_CACHE_HOME = hmCfg.xdg.cacheHome;
ANDROID_USER_HOME = "${XDG_DATA_HOME}/android";
ANDROID_HOME = "${XDG_DATA_HOME}/android/sdk";
GRADLE_USER_HOME = "${XDG_DATA_HOME}/gradle";
PYTHONSTARTUP = "${XDG_CONFIG_HOME}/python/pythonrc";
HISTFILE = "${XDG_CACHE_HOME}/bash/history";
CARGO_HOME = "${XDG_DATA_HOME}/cargo";
_JAVA_OPTIONS = "-Djava.utils.prefs.userRoot=${XDG_CONFIG_HOME}/java";
GNUPGHOME = "${XDG_DATA_HOME}/gnupg";
WINEPREFIX = "${XDG_DATA_HOME}/wine";
RUSTUP_HOME = "${XDG_DATA_HOME}/rustup";
NUGET_PACKAGES = "${XDG_CACHE_HOME}/NuGetPackages";
FCEUX_HOME = "${XDG_CONFIG_HOME}/fceux";
DOTNET_CLI_HOME = "${XDG_CONFIG_HOME}/dotnet";
GTK2_RC_FILES = lib.mkForce "${XDG_CONFIG_HOME}/gtk-2.0/gtkrc";
};
home.packages = with pkgs; [
xdg-user-dirs
xdg-utils
];
xdg.configFile = {
"python/pythonrc".text = ''
import os
import atexit
import readline
history = os.path.join(os.environ['XDG_CACHE_HOME'], 'python_history')
try:
readline.read_history_file(history)
except OSError:
pass
def write_history():
try:
readline.write_history_file(history)
except OSError:
pass
atexit.register(write_history)
'';
};
};
};
}

43
modules/stuff/xserver.nix Normal file
View file

@ -0,0 +1,43 @@
{ lib, pkgs, config, ...}: let
inherit (lib) mkIf mkEnableOption mkOption;
cfg = config.chuj.stuff.xserver;
in {
options.chuj.stuff.xserver = {
enable = mkEnableOption "xserver";
};
config = mkIf cfg.enable {
services = {
xserver = {
enable = true;
xkb.layout = "pl";
# autoRepeatDelay = 180;
# autoRepeatInterval = 50;
# ^ this doesn't work
displayManager.sessionCommands = ''
${pkgs.xorg.xset}/bin/xset r rate 180 50
'';
};
};
environment.systemPackages = with pkgs; [
xclip
xorg.xkill
xorg.xev
xdotool
];
# https://www.reddit.com/r/linux_gaming/comments/1dkbh5t/games_behaving_differently_on_xorg_than_on/
# FUCK YOU LIBINPUT
services.libinput.enable = lib.mkForce false;
# services.libinput = {
# enable = true;
# touchpad = {
# naturalScrolling = false; # it's reversed on my laptop for some reason
# tapping = true;
# tappingButtonMap = "lmr";
# scrollMethod = "edge";
# };
# };
};
}

69
modules/system.nix Normal file
View file

@ -0,0 +1,69 @@
{ lib, pkgs, config, ...} @ args: let
inherit (lib) mkOption types;
cfg = config.chuj.system;
in {
options.chuj.system = {
user = mkOption {
type = types.str;
};
host = mkOption {
type = types.str;
};
platform = mkOption {
type = types.str;
};
groups = mkOption {
type = types.listOf types.str;
default = [];
};
stateVersion = mkOption {
type = types.str;
default = "23.11";
};
};
config = {
networking.hostName = cfg.host;
users.users.${cfg.user} = {
isNormalUser = true;
extraGroups = [ "wheel" ] ++ cfg.groups;
};
nixpkgs.hostPlatform = cfg.platform;
system.stateVersion = cfg.stateVersion;
time.timeZone = "Europe/Warsaw";
hardware.pulseaudio.enable = true;
networking.networkmanager.enable = true;
nix.settings.experimental-features = [ "nix-command" "flakes" ];
nixpkgs.overlays = import ../pkgs args;
nixpkgs.config.allowUnfree = true;
security.sudo = {
package = pkgs.sudo.override { withInsults = true; };
extraConfig = ''
Defaults pwfeedback
'';
};
environment.systemPackages = with pkgs; [
ed # is the standard text editor.
ripgrep
file
tree
btop
wget
zip
unzip
rar
unrar
p7zip
p7zip-rar
gcc
gnumake
python311
];
};
}