This commit is contained in:
HackerNCoder 2024-06-16 12:10:36 +02:00
commit 3f74dc719b
12 changed files with 2318 additions and 0 deletions

198
configuration.nix Normal file
View file

@ -0,0 +1,198 @@
# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page, on
# https://search.nixos.org/options and in the NixOS manual (`nixos-help`).
{ config, lib, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
];
# Use the systemd-boot EFI boot loader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
networking.hostName = "nixos"; # Define your hostname.
# Pick only one of the below networking options.
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
networking.networkmanager.enable = true; # Easiest to use and most distros use this by default.
# Set your time zone.
time.timeZone = "Europe/Copenhagen";
# Configure network proxy if necessary
# networking.proxy.default = "http://user:password@proxy:port/";
# networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
# Select internationalisation properties.
i18n.defaultLocale = "en_GB.UTF-8";
console = {
# font = "Lat2-Terminus16";
keyMap = "dk-latin1";
# useXkbConfig = true; # use xkb.options in tty.
};
services.xserver.xkb = {
layout = "dk";
};
services.xserver.enable = true;
services.displayManager.sddm = {
enable = true;
wayland.enable = true;
};
services.desktopManager.plasma6.enable = true;
programs.kdeconnect.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
# If you want to use JACK applications, uncomment this
#jack.enable = true;
};
hardware.bluetooth.enable = true;
programs.dconf.enable = true;
fonts = {
enableDefaultPackages = true;
packages = with pkgs; [
noto-fonts
noto-fonts-emoji
noto-fonts-cjk
liberation_ttf
nerdfonts
];
};
services.greetd = {
enable = false;
settings = {
default_session = {
command = "${pkgs.greetd.tuigreet}/bin/tuigreet --time --cmd sway";
user = "greeter";
};
};
};
hardware.opengl = {
enable = true;
extraPackages = with pkgs; [
intel-media-driver # For Broadwell (2015) or newer processors. LIBVA_DRIVER_NAME=iHD
];
};
hardware.sane = {
enable = true;
extraBackends = [ pkgs.sane-airscan ];
disabledDefaultBackends = [ "escl" ];
};
services.avahi = {
enable = true;
nssmdns4 = true;
};
services.usbmuxd = {
enable = true;
package = pkgs.usbmuxd2;
};
security.polkit.enable = true;
security.pam.services.swaylock = {};
security.rtkit.enable = true;
# Enable CUPS to print documents.
# services.printing.enable = true;
# Enable sound.
# sound.enable = true;
# hardware.pulseaudio.enable = true;
users.groups = {
nix = { };
};
# Define a user account. Don't forget to set a password with passwd.
users.users.ed = {
isNormalUser = true;
extraGroups = [ "lp" "networkmanager" "nix" "scanner" "wheel" ]; # Enable sudo for the user.
shell = pkgs.zsh;
# packages = with pkgs; [
# firefox
# tree
# ];
};
nix.settings.allowed-users = [ "@nix" ];
programs.zsh.enable = true;
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
neovim # Do not forget to add an editor to edit configuration.nix! The Nano editor is also installed by default.
git
ripgrep
fd
clang
coreutils
libimobiledevice
ifuse
kdePackages.kdeconnect-kde
# wget
];
environment.pathsToLink = [ "/share/zsh" ]; # for zsh completion
# Some programs need SUID wrappers, can be configured further or are
# started in user sessions.
# programs.mtr.enable = true;
# programs.gnupg.agent = {
# enable = true;
# enableSSHSupport = true;
# };
# List services that you want to enable:
# Enable the OpenSSH daemon.
# services.openssh.enable = true;
# Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ];
# networking.firewall.allowedUDPPorts = [ ... ];
# Or disable the firewall altogether.
# networking.firewall.enable = false;
# Copy the NixOS configuration file and link it from the resulting system
# (/run/current-system/configuration.nix). This is useful in case you
# accidentally delete configuration.nix.
# system.copySystemConfiguration = true;
system.autoUpgrade.enable = true;
# This option defines the first version of NixOS you have installed on this particular machine,
# and is used to maintain compatibility with application data (e.g. databases) created on older NixOS versions.
#
# Most users should NEVER change this value after the initial install, for any reason,
# even if you've upgraded your system to a new NixOS release.
#
# This value does NOT affect the Nixpkgs version your packages and OS are pulled from,
# so changing it will NOT upgrade your system.
#
# This value being lower than the current NixOS release does NOT mean your system is
# out of date, out of support, or vulnerable.
#
# Do NOT change this value unless you have manually inspected all the changes it would make to your configuration,
# and migrated your data accordingly.
#
# For more information, see `man configuration.nix` or https://nixos.org/manual/nixos/stable/options#opt-system.stateVersion .
system.stateVersion = "23.11"; # Did you read the comment?
}

88
home.nix Normal file
View file

@ -0,0 +1,88 @@
{ config, pkgs, lib, ... }:
{
imports = [
./programs
#./sway.nix
];
# Home Manager needs a bit of information about you and the paths it should
# manage.
home.username = "ed";
home.homeDirectory = "/home/ed";
# This value determines the Home Manager release that your configuration is
# compatible with. This helps avoid breakage when a new Home Manager release
# introduces backwards incompatible changes.
#
# You should not change this value, even if you update Home Manager. If you do
# want to update the value, then make sure to first check the Home Manager
# release notes.
home.stateVersion = "23.11"; # Please read the comment before changing.
# The home.packages option allows you to install Nix packages into your
# environment.
home.packages = with pkgs; [
kitty
calibre
htop
libsForQt5.skanpage
keepassxc
gimp
libreoffice-qt6-fresh
digikam
exiftool # for digikam
# # Adds the 'hello' command to your environment. It prints a friendly
# # "Hello, world!" when run.
# pkgs.hello
# # It is sometimes useful to fine-tune packages, for example, by applying
# # overrides. You can do that directly here, just don't forget the
# # parentheses. Maybe you want to install Nerd Fonts with a limited number of
# # fonts?
# (pkgs.nerdfonts.override { fonts = [ "FantasqueSansMono" ]; })
# # You can also create simple shell scripts directly inside your
# # configuration. For example, this adds a command 'my-hello' to your
# # environment:
# (pkgs.writeShellScriptBin "my-hello" ''
# echo "Hello, ${config.home.username}!"
# '')
];
# Home Manager is pretty good at managing dotfiles. The primary way to manage
# plain files is through 'home.file'.
home.file = {
# # Building this configuration will create a copy of 'dotfiles/screenrc' in
# # the Nix store. Activating the configuration will then make '~/.screenrc' a
# # symlink to the Nix store copy.
# ".screenrc".source = dotfiles/screenrc;
# # You can also set the file content immediately.
# ".gradle/gradle.properties".text = ''
# org.gradle.console=verbose
# org.gradle.daemon.idletimeout=3600000
# '';
};
programs.bashmount.enable = true;
programs.nheko.enable = true;
# Home Manager can also manage your environment variables through
# 'home.sessionVariables'. If you don't want to manage your shell through Home
# Manager then you have to manually source 'hm-session-vars.sh' located at
# either
#
# ~/.nix-profile/etc/profile.d/hm-session-vars.sh
#
# or
#
# /etc/profiles/per-user/ed/etc/profile.d/hm-session-vars.sh
#
home.sessionVariables = {
EDITOR = "emacsclient --create-frame";
};
# Let Home Manager install and manage itself.
programs.home-manager.enable = true;
}

13
programs/default.nix Normal file
View file

@ -0,0 +1,13 @@
{ config, lib, pkgs, ... }:
{
imports = [
./firefox.nix
./emacs.nix
./zsh.nix
./git.nix
./email.nix
./gpg.nix
./mpv.nix
];
}

23
programs/emacs.nix Normal file
View file

@ -0,0 +1,23 @@
{ config, lib, pkgs, ... }:
{
home.packages = with pkgs; [
(aspellWithDicts (ds: with ds; [ en en-computers da ]))
zip
unzip
texlive.combined.scheme-medium
];
services.emacs = {
enable = true;
client = {
enable = true;
arguments = [" --create-frame"];
};
startWithUserSession = true;
};
programs.emacs = {
enable = true;
package = pkgs.emacs29-pgtk;
extraPackages = epkgs: [ epkgs.vterm ];
};
}

67
programs/email.nix Normal file
View file

@ -0,0 +1,67 @@
{ config, lib, pkgs, ... }:
let
name = "HackerNCoder";
email = "hackerncoder@encryptionin.space";
host = "mail.encryptionin.space";
maildir = "/home/ed/.mail";
in
{
accounts.email = {
maildirBasePath = "${maildir}";
accounts = {
hackerncoder = {
primary = true;
address = "${email}";
userName = "${email}";
realName = "${name}";
flavor = "plain";
passwordCommand = "${pkgs.pass}/bin/pass Email/hackerncoder";
imap = {
host = "${host}";
port = 993;
tls.enable = true;
};
smtp = {
host = "${host}";
port = 465;
tls.enable = true;
};
mbsync = {
enable = true;
create = "both";
expunge = "both";
};
msmtp.enable = true;
mu.enable = true;
imapnotify = {
enable = true;
boxes = [ "Inbox" ];
onNotify = "${pkgs.libnotify}/bin/notify-send -u normal -i mail-unread -a 'imap-notify' 'New email' ; ${pkgs.isync}/bin/mbsync --pull --new hackerncoder:INBOX";
onNotifyPost = "${pkgs.mu}/bin/mu index";
};
};
};
};
programs = {
msmtp.enable = true;
mbsync.enable = true;
mu.enable = true;
};
services.mbsync = {
enable = true;
frequency = "0/3:00:00";
preExec = "${pkgs.libnotify}/bin/notify-send -u normal -i view-refresh -a 'mbsync timer' 'Syncing with mbsync'";
postExec = "${pkgs.mu}/bin/mu index";
};
services.imapnotify.enable = true;
home.packages = with pkgs; [
pass
mu.mu4e
libnotify
];
}

15
programs/firefox.nix Normal file
View file

@ -0,0 +1,15 @@
{ config, lib, pkgs, ... }:
{
programs.firefox = {
enable = true;
nativeMessagingHosts = [ pkgs.kdePackages.plasma-browser-integration ];
# profiles = {
# default = {
# settings = {
# "widget.use-xdg-desktop-portal.file-picker" = 1;
# };
# };
# };
};
}

37
programs/git.nix Normal file
View file

@ -0,0 +1,37 @@
{ config, lib, pkgs, ... }:
{
programs.git = {
enable = true;
package = pkgs.gitFull;
userEmail = "hackerncoder@encryptionin.space";
userName = "HackerNCoder";
diff-so-fancy.enable = true;
extraConfig = {
color = {
ui = true;
"diff" = {
meta = 11;
frag = "magenta bold";
func = "146 bold";
commit = "yellow bold";
old = "red bold";
new = "green bold";
whitespace = "red reverse";
};
"diff-highlight" = {
oldNormal = "red bold";
oldHighlight = "red bold 52";
newNormal = "green bold";
newHighlight = "green bold 52";
};
};
sendmail = {
smtpserver = "mail.encryptionin.space";
smtpuser = "hackerncoder@encryptionin.space";
smtpencryption = "ssl";
smtpserverport = 465;
};
};
};
}

23
programs/gpg.nix Normal file
View file

@ -0,0 +1,23 @@
{ config, lib, pkgs, ... }:
{
programs.gpg.enable = true;
services.gpg-agent = {
enable = true;
enableZshIntegration = true;
defaultCacheTtl = 1800;
pinentryPackage = pkgs.pinentry-qt;
};
# configFile."gnupg/gpg-agent.conf" = {
# text = ''
# default-cache-ttl 3600
# pinentry-program ${pkgs.pinentry}/bin/pinentry
# '';
# };
home.packages = with pkgs; [
pinentry
];
}

10
programs/mpv.nix Normal file
View file

@ -0,0 +1,10 @@
{ config, lib, pkgs, ... }:
{
home.packages = with pkgs; [
haruna
];
programs.mpv = {
enable = true;
};
}

File diff suppressed because it is too large Load diff

33
programs/zsh.nix Normal file
View file

@ -0,0 +1,33 @@
{ config, lib, pkgs, ... }:
{
programs.zsh = {
enable = true;
enableCompletion = true;
autosuggestion.enable = true;
enableVteIntegration = true;
syntaxHighlighting.enable = true;
initExtra = ''
# [Ctrl-RightArrow] - move forward one word
bindkey '^[[1;5C' forward-word
# [Ctrl-LeftArrow] - move backward one word
bindkey '^[[1;5D' backward-word
'';
envExtra = ''
export PATH="${config.xdg.configHome}/emacs/bin:$PATH"
'';
history.path = "${config.xdg.dataHome}/zsh/history";
plugins = [
{
name = "powerlevel10k";
src = pkgs.zsh-powerlevel10k;
file = "share/zsh-powerlevel10k/powerlevel10k.zsh-theme";
}
{
name = "powerlevel10k-config";
src = lib.cleanSource ./p10k-config;
file = "p10k.zsh";
}
];
};
}

128
sway.nix Normal file
View file

@ -0,0 +1,128 @@
{ config, pkgs, lib, ... }:
{
home.packages = with pkgs; [
brightnessctl
wl-clipboard
];
wayland.windowManager.sway = {
enable = true;
config = rec {
modifier = "Mod4";
input = {
"*" = {
xkb_layout = "dk";
};
};
terminal = "kitty";
keybindings = lib.mkOptionDefault {
"${modifier}+Shift+e" = "exec emacsclient --create-frame";
"${modifier}+Ctrl+e" = "exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'swaymsg exit'";
"${modifier}+Ctrl+q" = "exec swaynag -t warning -m 'You pressed the quit shortcut. Do you really want to shutdown? This will end your session.' -b 'Yes, shutdown' 'shutdown now'";
"${modifier}+Ctrl+l" = "exec swaylock -fF";
"${modifier}+Ctrl+s" = "exec swaylock -fF && systemctl suspend";
"XF86MonBrightnessDown" = "exec brightnessctl set 5%-";
"XF86MonBrightnessUp" = "exec brightnessctl set 5%+";
};
bars = [
{
fonts = {
names = [ "pango:Hack Nerd" ];
size = 9.0;
};
statusCommand = "${pkgs.i3status-rust}/bin/i3status-rs /home/ed/.config/i3status-rust/config-default.toml";
}
];
};
};
services.dunst = {
enable = true;
iconTheme = {
name = "Adwaita";
package = pkgs.gnome.adwaita-icon-theme;
size = "16x16";
};
};
programs.i3status-rust = {
enable = true;
bars = {
default = {
theme = "solarized-dark";
icons = "material-nf";
blocks = [
{
block = "maildir";
inboxes = [ "~/.mail/hackerncoder/Inbox" ];
interval = 120;
}
{
block = "backlight";
}
{
block = "net";
format = " $icon {$signal_strength $ssid $frequency|Wired connection} via $device ";
}
{
block = "disk_space";
path = "/";
info_type = "available";
interval = 60;
alert = 10.0;
warning = 20.0;
format = " $icon $available.eng(w:2) ";
}
{
block = "time";
format = " $icon $timestamp.datetime(f:'%a %d/%m')";
interval = 3600;
}
{
block = "time";
format = "$timestamp.datetime(f:'%H %Z')";
timezone = "Etc/UTC";
interval = 600;
}
{
block = "time";
format = "$timestamp.datetime(f:'%R') ";
interval = 60;
}
];
};
};
};
programs.swaylock = {
enable = true;
settings = {
color = "000000";
#font-size = 24;
indicator-idle-visible = false;
#indicator-radius = 100;
#line-color = "ffffff";
#show-failed-attempts = true;
};
};
services.swayidle = {
enable = true;
timeouts = [
{ timeout = 240; command = "${pkgs.swaylock}/bin/swaylock -fF"; }
{ timeout = 480; command = "${pkgs.systemd}/bin/systemctl suspend"; }
];
};
# gtk = {
# enable = true;
# theme.name = "breeze";
# };
# qt = {
# enable = true;
# platformTheme.name = "kde";
# style.name = "breeze";
# };
}