Reorganize files

This commit is contained in:
Wroclaw 2024-01-20 17:43:57 +01:00
parent f449490474
commit 58ce7ac394
14 changed files with 2 additions and 2 deletions

35
nix-os/account.nix Normal file
View file

@ -0,0 +1,35 @@
{ config, pkgs, ... }:
let
unstable = import <nixos-unstable> { config = config.nixpkgs.config; };
in
{
users.users.wroclaw = {
isNormalUser = true;
description = "Rafał";
group = "wroclaw";
extraGroups = [
"users"
"wheel"
(if config.programs.adb.enable then "adbusers" else null)
];
linger = true;
# Initial password for the account
password = "nixos";
packages = with pkgs; [
firefox
vivaldi
discord-canary
unstable.vscode
];
};
users.groups.wroclaw.gid = 1000;
services.syncthing = {
enable = true;
user = "wroclaw";
group = "wroclaw";
dataDir = "/home/wroclaw";
configDir = "/home/wroclaw/.config/syncthing";
};
}

10
nix-os/adb.nix Normal file
View file

@ -0,0 +1,10 @@
{ lib, config, pkgs, ... }:
{
config = {
programs.adb.enable = true;
environment.systemPackages = with pkgs; [
scrcpy
];
};
}

152
nix-os/core.nix Normal file
View file

@ -0,0 +1,152 @@
# Edit 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, ... }:
{
imports =
[
# Include the results of the hardware scan.
(if builtins.pathExists /etc/nixos/hardware-configuration.nix then /etc/nixos/hardware-configuration.nix else null)
# Include device-specific overrides
(if builtins.pathExists /etc/nixos/device-configuration.nix then /etc/nixos/device-configuration.nix else null)
./nvidia.nix
./docker.nix
./razer.nix
./desktop/gnome.nix
#./desktop/kde-plasma.nix
./shell.nix
./virtualization.nix
./polkit/disable-shutdown.nix
./locale.nix
./adb.nix
./account.nix
];
# Bootloader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
# kernel
boot.kernelPackages = pkgs.linuxPackages_latest;
# networking.wireless.enable = true; # Enables wireless support via wpa_supplicant.
# Enable networking
networking.networkmanager.enable = true;
# X11 and desktop/display manager is enabled using imported files
# Enable CUPS to print documents.
services.printing.enable = true;
# Enable flatpak, some software is newer here unfortunately
services.flatpak.enable = true;
# Enable sound with pipewire.
sound.enable = true;
hardware.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
# Enable audio interfaces renaming
wireplumber.enable = true;
};
# Allow unfree packages
nixpkgs.config.allowUnfree = true;
# List packages installed in system profile. To search, run:
# $ nix search wget
environment.systemPackages = with pkgs; [
wget
git
ffmpeg
yt-dlp
mpv
htop
btop
neofetch
ranger
gimp
inkscape
krita
smartmontools
ddrescue
];
# terminal text editor
programs.neovim = {
enable = true;
viAlias = true;
defaultEditor = true;
configure = {
customRC = ''
set number
set hlsearch
set incsearch
set tabstop=4
set softtabstop=4
set shiftwidth=4
set expandtab
set autoindent
syntax on
set encoding=utf-8
set wildmode=longest,list,full
set listchars=space:·,tab:»
set indentkeys-=0#
'';
packages.myVimPackage = with pkgs.vimPlugins; {
start = [
guess-indent-nvim
];
};
};
};
programs.steam = {
enable = true;
remotePlay.openFirewall = true;
};
# Enable fail2ban because of the OpenSSH server
services.fail2ban = {
enable = true;
maxretry = 10;
bantime = "7d";
};
# Enable the OpenSSH daemon.
services.openssh = {
enable = true;
ports = [
22
8022
];
extraConfig = ''
X11Forwarding yes
'';
};
networking.firewall = {
enable = true;
# "Disable" firewall because of docker
allowedTCPPortRanges = [{ from = 0; to = 65535;}];
allowedUDPPortRanges = [{ from = 0; to = 65535;}];
};
# This value determines the NixOS release from which the default
# settings for stateful data, like file locations and database versions
# on your system were taken. It's perfectly fine and recommended to leave
# this value at the release version of the first install of this system.
# Before changing this value read the documentation for this option
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
system.stateVersion = "23.05"; # Did you read the comment?
# I am lazy
}

175
nix-os/desktop/gnome.nix Normal file
View file

@ -0,0 +1,175 @@
{lib, config, pkgs, ...}:
let
unstable = import <nixos-unstable> {};
in
{
config = rec {
services.xserver.enable = true;
services.xserver.desktopManager.gnome.enable = true;
services.xserver.displayManager.gdm = {
enable = true;
wayland = false;
autoSuspend = false;
};
# environment.sessionVariables.NIXOS_OZONE_WL = "1";
programs.dconf.profiles.user.databases = [{
settings = with lib.gvariant; {
"org/gnome/desktop/interface" = {
clock-show-date=true;
clock-show-seconds=true;
clock-show-weekday=true;
color-scheme="prefer-dark";
};
"org/gnome/desktop/media-handling" = {
automount=false;
};
"org/gnome/desktop/peripherals/mouse" = {
accel-profile="flat";
};
"org/gnome/desktop/sound" = {
allow-volume-above-100-percent=true;
};
"org/gnome/mutter" = {
dynamic-workspaces=true;
workspaces-only-on-primary=true;
};
"org/gnome/SessionManager" = {
logout-prompt=false;
};
"org/gnome/settings-daemon/plugins/power" = {
power-button-action="notning";
sleep-inactive-ac-type="nothing";
};
"org/gnome/shell" = {
enabled-extensions=[
"drive-menu@gnome-shell-extensions.gcampax.github.com"
"pop-shell@system76.com"
"workspace-indicator@gnome-shell-extensions.gcampax.github.com"
"Vitals@CoreCoding.com"
"trayIconsReloaded@selfmade.pl"
"places-menu@gnome-shell-extensions.gcampax.github.com"
"apps-menu@gnome-shell-extensions.gcampax.github.com"
"top-bar-organizer@julian.gse.jsts.xyz"
"color-picker@tuberry"
];
};
"org/gnome/shell/app-switcher" = {
current-workspace-only=false;
};
"org/gnome/shell/extensions/color-picker" = {
color-picker-shortcut=["<Super><Alt>c"];
enable-shortcut=true;
enable-systray=false;
menu-key="";
notify-style=mkUint32 1;
preview-style=mkUint32 0;
};
"org/gnome/shell/extensions/pop-shell" = {
active-hint=true;
active-hint-border-radius=mkUint32 1;
gap-inner=mkUint32 2;
gap-outer=mkUint32 1;
show-skip-taskbar=true;
show-title=true;
smart-gaps=false;
snap-to-grid=false;
tile-by-default=true;
};
"org/gnome/shell/extensions/top-bar-organizer" = {
center-box-order=["dateMenu"];
left-box-order=["activities" "apps-menu" "places-menu" "vitalsMenu"];
right-box-order=["TrayIconsReloaded" "workspace-indicator" "pop-shell" "color-picker@tuberry" "drive-menu" "screenRecording" "screenSharing" "dwellClick" "a11y" "keyboard" "quickSettings"];
};
"org/gnome/shell/extensions/trayIconsReloaded" = {
icon-brightness=mkInt32 0;
icon-contrast=mkInt32 0;
icon-margin-horizontal=mkInt32 0;
icon-margin-vertical=mkInt32 0;
icon-padding-horizontal=mkInt32 4;
icon-padding-vertical=mkInt32 0;
icon-saturation=mkInt32 0;
icon-size=mkInt32 16;
icons-limit=mkInt32 5;
invoke-to-workspace=true;
position-weight=mkInt32 0;
tray-margin-left=mkInt32 0;
tray-margin-right=mkInt32 0;
};
"org/gnome/shell/extensions/vitals" = {
hide-icons=false;
hot-sensors=["_processor_usage_" "_memory_allocated_"];
memory-measurement=mkInt32 1;
update-time=mkInt32 2;
use-higher-precision=true;
};
"org/gnome/shell/keybindings" = {
show-screenshot-ui=["Print" "<Super><Shift>S"];
};
"org/gnome/desktop/default-applications/terminal" =
if builtins.elem pkgs.kitty config.environment.systemPackages then {
exec = "kitty";
exec-arg = "";
} else null;
"org/gnome/settings-daemon/plugins/media-keys" = {
custom-keybindings = [
(
if builtins.elem pkgs.kitty config.environment.systemPackages then
"org/gnome/settings-daemon/plugins/media-keys/custom-keybinding/custom0"
else null
)
];
help = mkEmptyArray "s";
screensaver = ["<Control><Super>l"];
};
"org/gnome/settings-daemon/plugins/media-keys/custom-keybinding/custom0" =
if builtins.elem pkgs.kitty config.environment.systemPackages then {
binding="<Control><Alt>t";
command="kitty";
name="Terminal";
} else null;
};
}];
programs.dconf.profiles.gdm.databases = with builtins.elemAt programs.dconf.profiles.user.databases 0; [{
settings = {
"org/gnome/desktop/interface" = settings."org/gnome/desktop/interface";
"org/gnome/desktop/peripherals/mouse" = settings."org/gnome/desktop/peripherals/mouse";
"org/gnome/desktop/sound" = settings."org/gnome/desktop/sound";
"org/gnome/settings-daemon/plugins/power" = settings."org/gnome/settings-daemon/plugins/power";
"org/gnome/shell/keybindings" = settings."org/gnome/shell/keybindings";
};
}];
environment.systemPackages = with pkgs; [
gnomeExtensions.pop-shell
gnomeExtensions.vitals
gnomeExtensions.tray-icons-reloaded
gnomeExtensions.color-picker
gnomeExtensions.top-bar-organizer
# unstable.gnomeExtensions.translate-indicator
# translate-shell
pavucontrol
];
};
}

View file

@ -0,0 +1,17 @@
{lib, config, pkgs, ...}:
{
config = {
services.xserver.enable = true;
services.xserver.desktopManager.plasma5.enable = true;
services.xserver.displayManager.sddm.enable = true;
# environment.sessionVariables.NIXOS_OZONE_WL = "1";
environment.systemPackages = with pkgs; [
libsForQt5.plasma-browser-integration
translate-shell
pavucontrol
];
};
}

30
nix-os/docker.nix Normal file
View file

@ -0,0 +1,30 @@
{ lib, config, pkgs, ... }:
{
config.virtualisation.docker = {
enable = true;
# enableNvidia = true;
enableOnBoot = true;
storageDriver = if config.fileSystems."/".fsType == "btrfs" then "btrfs" else null;
rootless.enable = true;
rootless.setSocketVariable = true;
daemon.settings = {
default-address-pools = [
{base = "10.64.0.0/10"; size = 24;}
];
bip = "10.127.0.1/16";
};
};
config.users.users.indocker = {
isSystemUser = true;
hashedPassword = "!";
uid = 900;
group = "indocker";
};
config.users.groups.indocker = {
gid = 900;
};
config.environment.systemPackages = with pkgs; [
docker-compose
];
}

32
nix-os/locale.nix Normal file
View file

@ -0,0 +1,32 @@
{ ... }:
{
config = {
# Set your time zone.
time.timeZone = "Europe/Warsaw";
# Select internationalisation properties.
i18n.defaultLocale = "en_US.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "pl_PL.UTF-8";
LC_IDENTIFICATION = "pl_PL.UTF-8";
LC_MEASUREMENT = "pl_PL.UTF-8";
LC_MONETARY = "pl_PL.UTF-8";
LC_NAME = "pl_PL.UTF-8";
LC_NUMERIC = "pl_PL.UTF-8";
LC_PAPER = "pl_PL.UTF-8";
LC_TELEPHONE = "pl_PL.UTF-8";
LC_TIME = "pl_PL.UTF-8";
};
# Configure keymap in X11
services.xserver.xkb = {
layout = "pl";
variant = "";
};
# Configure console keymap
console.keyMap = "pl2";
};
}

17
nix-os/nvidia.nix Normal file
View file

@ -0,0 +1,17 @@
{ config, lib, pkgs, ...}:
{
hardware.opengl = {
enable = true;
driSupport = true;
driSupport32Bit = true;
};
services.xserver.videoDrivers = ["nvidia"];
hardware.nvidia = {
modesetting.enable = true;
powerManagement.enable = true;
open = false;
nvidiaSettings = true;
package = config.boot.kernelPackages.nvidiaPackages.stable;
};
}

View file

@ -0,0 +1,46 @@
{ ... }:
{
security.polkit.extraConfig = ''
polkit.addRule(function(action, subject) {
polkit.log("action=" + action);
polkit.log("subject=" + subject);
if (
action.id == "org.freedesktop.login1.halt" ||
action.id == "org.freedesktop.login1.halt-ignore-inhibit" ||
action.id == "org.freedesktop.login1.halt-multiple-sessions" ||
action.id == "org.freedesktop.login1.hibernate" ||
action.id == "org.freedesktop.login1.hibernate-ignore-inhibit" ||
action.id == "org.freedesktop.login1.hibernate-multiple-sessions" ||
action.id == "org.freedesktop.login1.inhibit-block-idle" ||
action.id == "org.freedesktop.login1.inhibit-block-shutdown" ||
action.id == "org.freedesktop.login1.inhibit-block-sleep" ||
action.id == "org.freedesktop.login1.inhibit-delay-shutdown" ||
action.id == "org.freedesktop.login1.inhibit-delay-sleep" ||
action.id == "org.freedesktop.login1.inhibit-handle-hibernate-key" ||
action.id == "org.freedesktop.login1.inhibit-handle-lid-switch" ||
action.id == "org.freedesktop.login1.inhibit-handle-power-key" ||
action.id == "org.freedesktop.login1.inhibit-handle-reboot-key" ||
action.id == "org.freedesktop.login1.inhibit-handle-suspend-key" ||
action.id == "org.freedesktop.login1.power-off" ||
action.id == "org.freedesktop.login1.power-off-ignore-inhibit" ||
action.id == "org.freedesktop.login1.power-off-multiple-sessions" ||
action.id == "org.freedesktop.login1.reboot" ||
action.id == "org.freedesktop.login1.reboot-ignore-inhibit" ||
action.id == "org.freedesktop.login1.reboot-multiple-sessions" ||
action.id == "org.freedesktop.login1.set-reboot-parameter" ||
action.id == "org.freedesktop.login1.set-reboot-to-boot-loader-entry" ||
action.id == "org.freedesktop.login1.set-reboot-to-boot-loader-menu" ||
action.id == "org.freedesktop.login1.set-reboot-to-firmware-setup" ||
action.id == "org.freedesktop.login1.set-self-linger" ||
action.id == "org.freedesktop.login1.set-user-linger" ||
action.id == "org.freedesktop.login1.set-wall-message" ||
action.id == "org.freedesktop.login1.suspend" ||
action.id == "org.freedesktop.login1.suspend-ignore-inhibit" ||
action.id == "org.freedesktop.login1.suspend-multiple-sessions"
) {
return subject.active ? polkit.Result.AUTH_ADMIN : polkit.Result.NO;
};
});
'';
}

16
nix-os/razer.nix Normal file
View file

@ -0,0 +1,16 @@
{ lib, config, pkgs, ... }:
{
hardware.openrazer = {
enable = true;
users = [
"wroclaw"
];
};
# users.groups.openrazer.members = [
# "wroclaw"
# ];
environment.systemPackages = with pkgs; [
openrazer-daemon
polychromatic
];
}

66
nix-os/shell.nix Normal file
View file

@ -0,0 +1,66 @@
{ config, pkgs, ... }:
let
unstable = import <nixos-unstable> {};
in
{
environment.systemPackages = with pkgs; [
ranger
kitty
];
programs.bash.interactiveShellInit = ''
if test -n "$KITTY_INSTALLATION_DIR"; then
export KITTY_SHELL_INTEGRATION="enabled,no-sudo"
source "$KITTY_INSTALLATION_DIR/shell-integration/bash/kitty.bash"
fi
'';
environment.etc."xdg/kitty/kitty.conf".text = ''
font_size 10.0
scrollback_lines 10000
window_border_width 0.5
window_padding_width 3
${if config.services.xserver.desktopManager.gnome.enable then "hide_window_decorations yes" else null}
background_opacity 0.8
dynamic_background_opacity yes
'';
environment.etc."ranger/rc.conf".text = ''
eval import os; fm.set_option_from_string("preview_images", "true") if "KITTY_INSTALLATION_DIR" in os.environ else None;
eval import os; fm.set_option_from_string("preview_images_method", "kitty") if "KITTY_INSTALLATION_DIR" in os.environ else None;
set vcs_aware true
set show_hidden true
alias drag shell ${unstable.ripdrag}/bin/ripdrag -Axd %p &
map <C-d> drag
'';
programs.direnv.enable = true;
programs.starship = {
enable = true;
settings = {
format = "$all$line_break\${custom.ranger}$jobs$battery$time$status$os$container$shell$character";
directory = {
truncation_length = 5;
truncation_symbol = "/";
};
username = {
show_always = true;
};
status.disabled = false;
custom.ranger = {
when = "test $RANGER_LEVEL";
command = "echo \"\"";
style = "bold 208";
};
# custom.PS1 = {
# when = true;
# command = "echo -e \"\\x1b\\x5d133;A\\x1b\\x5c\"";
# format = "$output";
# use_stdin = false;
# };
};
};
}

10
nix-os/virtualization.nix Normal file
View file

@ -0,0 +1,10 @@
{ lib, config, pkgs, ... }:
{
#virtualisation.waydroid.enable = true;
programs.virt-manager.enable = true;
virtualisation.libvirtd = {
enable = true;
};
}