meta: reorganize nix-os and hosts to single directory nixos
This commit is contained in:
parent
be46e02c61
commit
cb05ce5b44
76 changed files with 54 additions and 52 deletions
57
nixos/hosts/main/cryptocurrency.nix
Normal file
57
nixos/hosts/main/cryptocurrency.nix
Normal file
|
@ -0,0 +1,57 @@
|
|||
{
|
||||
inputs,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
imports = [
|
||||
"${inputs.nix-bitcoin}/modules/modules.nix"
|
||||
];
|
||||
|
||||
config = {
|
||||
|
||||
services.bitcoind = {
|
||||
enable = true;
|
||||
listen = true;
|
||||
txindex = true;
|
||||
disablewallet = true;
|
||||
extraConfig = ''
|
||||
coinstatsindex=1
|
||||
maxmempool=2048
|
||||
persistmempool=1
|
||||
'';
|
||||
tor.proxy = true;
|
||||
rpc.address = "0.0.0.0";
|
||||
rpc.allowip = [
|
||||
"10.0.0.0/8"
|
||||
"172.16.0.0/12"
|
||||
"192.168.0.0/16"
|
||||
];
|
||||
};
|
||||
|
||||
services.electrs = {
|
||||
enable = true;
|
||||
};
|
||||
|
||||
services.monero = {
|
||||
enable = true;
|
||||
extraConfig = ''
|
||||
proxy=127.0.0.1:9050
|
||||
igd=disabled
|
||||
'';
|
||||
};
|
||||
|
||||
services.tor.client.enable = true;
|
||||
|
||||
nix-bitcoin = {
|
||||
onionServices = {
|
||||
bitcoind = {
|
||||
public = true;
|
||||
};
|
||||
};
|
||||
generateSecrets = true;
|
||||
secretsDir = "/var/nix-bitcoin";
|
||||
configVersion = "0.0.121";
|
||||
};
|
||||
};
|
||||
}
|
98
nixos/hosts/main/default.nix
Normal file
98
nixos/hosts/main/default.nix
Normal file
|
@ -0,0 +1,98 @@
|
|||
{
|
||||
inputs,
|
||||
config,
|
||||
pkgs,
|
||||
self,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
imports = [
|
||||
../../modules/core.nix
|
||||
../../modules/core-desktop.nix
|
||||
../../modules/nvidia.nix
|
||||
../../modules/docker.nix
|
||||
../../modules/razer.nix
|
||||
../../modules/desktopManagers/cosmic.nix
|
||||
../../modules/displayManagers/cosmic-greeter.nix
|
||||
../../modules/shell.nix
|
||||
../../modules/virtualization.nix
|
||||
../../modules/polkit/disable-shutdown.nix
|
||||
../../modules/locale.nix
|
||||
../../modules/adb.nix
|
||||
../../modules/account.nix
|
||||
../../modules/services/nix-binary-cache.nix
|
||||
../../modules/udev.nix
|
||||
../../modules/gnupg.nix
|
||||
|
||||
"${inputs.nixos-vscode-server}"
|
||||
|
||||
./cryptocurrency.nix
|
||||
];
|
||||
|
||||
config = {
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
boot.loader.efi.canTouchEfiVariables = true;
|
||||
|
||||
networking.hostName = "wroclaw-main";
|
||||
|
||||
services.printing.drivers = with pkgs; [
|
||||
hplip
|
||||
];
|
||||
|
||||
nixpkgs.overlays = [
|
||||
self.overlays.cosmicPackages
|
||||
];
|
||||
nixpkgs.config = {
|
||||
cudaSupport = true;
|
||||
};
|
||||
|
||||
# nixos-vscode-server module needs this
|
||||
programs.nix-ld.enable = true;
|
||||
services.vscode-server = {
|
||||
enable = true;
|
||||
extraRuntimeDependencies = with pkgs; [
|
||||
docker
|
||||
];
|
||||
};
|
||||
|
||||
services.pipewire.wireplumber.configPackages = [(
|
||||
pkgs.stdenvNoCC.mkDerivation {
|
||||
name = "wireplumber-config";
|
||||
src = ./wireplumber;
|
||||
phases = [ "installPhase" ];
|
||||
installPhase = ''
|
||||
mkdir -p $out/share/wireplumber/wireplumber.conf.d
|
||||
cp -r $src/* $out/share/wireplumber/wireplumber.conf.d
|
||||
'';
|
||||
}
|
||||
)];
|
||||
|
||||
services.printing.startWhenNeeded = false;
|
||||
|
||||
# rgb control for razer, graphics card and motherboard
|
||||
hardware.i2c.enable = true;
|
||||
services.hardware.openrgb.enable = true;
|
||||
|
||||
services.ollama = {
|
||||
enable = true;
|
||||
port = 1434;
|
||||
acceleration = "cuda";
|
||||
package = pkgs.unstable.ollama;
|
||||
host = "0.0.0.0";
|
||||
};
|
||||
|
||||
services.mysql = {
|
||||
enable = true;
|
||||
package = pkgs.mariadb;
|
||||
};
|
||||
|
||||
environment.sessionVariables = {
|
||||
OLLAMA_HOST = "127.0.0.1:${builtins.toString config.services.ollama.port}";
|
||||
};
|
||||
|
||||
nixpkgs.hostPlatform = "x86_64-linux";
|
||||
|
||||
system.stateVersion = "24.11";
|
||||
};
|
||||
}
|
10
nixos/hosts/main/wireplumber/51-digital-output.conf
Normal file
10
nixos/hosts/main/wireplumber/51-digital-output.conf
Normal file
|
@ -0,0 +1,10 @@
|
|||
monitor.alsa.rules = [{
|
||||
matches = [{
|
||||
node.name = "alsa_output.pci-0000_00_1f.3.iec958-stereo"
|
||||
}]
|
||||
actions = {
|
||||
update-props = {
|
||||
node.description = "Digital Output"
|
||||
}
|
||||
}
|
||||
}]
|
10
nixos/hosts/main/wireplumber/51-hdmi-otuput.conf
Normal file
10
nixos/hosts/main/wireplumber/51-hdmi-otuput.conf
Normal file
|
@ -0,0 +1,10 @@
|
|||
monitor.alsa.rules = [{
|
||||
matches = [{
|
||||
node.name = "alsa_output.pci-0000_01_00.1.hdmi-stereo"
|
||||
}]
|
||||
actions = {
|
||||
update-props = {
|
||||
node.description = "Monitor speakers"
|
||||
}
|
||||
}
|
||||
}]
|
11
nixos/hosts/main/wireplumber/51-razerHeadphones-device.conf
Normal file
11
nixos/hosts/main/wireplumber/51-razerHeadphones-device.conf
Normal file
|
@ -0,0 +1,11 @@
|
|||
monitor.alsa.rules = [{
|
||||
matches = [{
|
||||
device.name = "alsa_card.usb-Razer_Razer_USB_Audio_Controller_000000000000000000000000-00"
|
||||
}]
|
||||
actions = {
|
||||
update-props = {
|
||||
device.description = "Headphones"
|
||||
device.profile = "Pro Audio"
|
||||
}
|
||||
}
|
||||
}]
|
10
nixos/hosts/main/wireplumber/51-razerHeadphones-input.conf
Normal file
10
nixos/hosts/main/wireplumber/51-razerHeadphones-input.conf
Normal file
|
@ -0,0 +1,10 @@
|
|||
monitor.alsa.rules = [{
|
||||
matches = [{
|
||||
node.name = "alsa_input.usb-Razer_Razer_USB_Audio_Controller_000000000000000000000000-00.pro-input-0"
|
||||
}]
|
||||
actions = {
|
||||
update-props = {
|
||||
node.description = "Headphones"
|
||||
}
|
||||
}
|
||||
}]
|
22
nixos/hosts/main/wireplumber/51-razerHeadphones-output.conf
Normal file
22
nixos/hosts/main/wireplumber/51-razerHeadphones-output.conf
Normal file
|
@ -0,0 +1,22 @@
|
|||
monitor.alsa.rules = [
|
||||
{
|
||||
matches = [{
|
||||
node.name = "alsa_output.usb-Razer_Razer_USB_Audio_Controller_000000000000000000000000-00.pro-output-0"
|
||||
}]
|
||||
actions = {
|
||||
update-props = {
|
||||
node.description = "Headphones (Chat)"
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
matches = [{
|
||||
node.name = "alsa_output.usb-Razer_Razer_USB_Audio_Controller_000000000000000000000000-00.pro-output-1"
|
||||
}]
|
||||
actions = {
|
||||
update-props = {
|
||||
node.description = "Headphones (Game)"
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
60
nixos/hosts/tablet.nix
Normal file
60
nixos/hosts/tablet.nix
Normal file
|
@ -0,0 +1,60 @@
|
|||
{
|
||||
self,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
imports = [
|
||||
../modules/core.nix
|
||||
../modules/core-desktop.nix
|
||||
../modules/account.nix
|
||||
../modules/adb.nix
|
||||
../modules/locale.nix
|
||||
../modules/shell.nix
|
||||
../modules/gnupg.nix
|
||||
../modules/polkit/network.nix
|
||||
|
||||
../modules/desktopManagers/cosmic.nix
|
||||
../modules/displayManagers/cosmic-greeter.nix
|
||||
../modules/udev.nix
|
||||
];
|
||||
|
||||
config = {
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
boot.loader.efi.canTouchEfiVariables = true;
|
||||
|
||||
networking.hostName = "wroclaw-hp";
|
||||
networking.networkmanager.enable = true;
|
||||
networking.firewall.enable = true;
|
||||
hardware.sensor.iio.enable = true;
|
||||
|
||||
nixpkgs.overlays = [
|
||||
self.overlays.cosmicPackages
|
||||
];
|
||||
|
||||
networking.firewall.allowedTCPPortRanges = [
|
||||
# KDE Connect
|
||||
rec { from = 1714; to = from + 50; }
|
||||
];
|
||||
|
||||
networking.firewall.allowedUDPPortRanges = [
|
||||
# KDE Connect
|
||||
rec { from = 1714; to = from + 50; }
|
||||
];
|
||||
|
||||
services.logind = {
|
||||
powerKey = "suspend";
|
||||
powerKeyLongPress = "poweroff";
|
||||
suspendKey = "suspend-then-hibernate";
|
||||
suspendKeyLongPress = "hibernate";
|
||||
lidSwitch = "lock";
|
||||
lidSwitchDocked = "ignore";
|
||||
lidSwitchExternalPower = "lock";
|
||||
};
|
||||
|
||||
nixpkgs.hostPlatform = "x86_64-linux";
|
||||
|
||||
system.stateVersion = "24.11";
|
||||
};
|
||||
}
|
||||
|
25
nixos/hosts/vm-base.nix
Normal file
25
nixos/hosts/vm-base.nix
Normal file
|
@ -0,0 +1,25 @@
|
|||
{ lib, modulesPath, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
"${modulesPath}/virtualisation/qemu-vm.nix"
|
||||
../modules/account.nix
|
||||
../modules/core.nix
|
||||
../modules/core-desktop.nix
|
||||
../modules/locale.nix
|
||||
../modules/polkit/disable-shutdown.nix
|
||||
../modules/shell.nix
|
||||
../modules/udev.nix
|
||||
];
|
||||
|
||||
config = {
|
||||
services.syncthing.enable = lib.mkForce false;
|
||||
virtualisation = {
|
||||
memorySize = 4096;
|
||||
};
|
||||
virtualisation.forwardPorts = [
|
||||
{ from = "host"; host.port = 2222; guest.port = 22; }
|
||||
];
|
||||
nixpkgs.hostPlatform = "x86_64-linux";
|
||||
};
|
||||
}
|
17
nixos/hosts/vm-cosmic.nix
Normal file
17
nixos/hosts/vm-cosmic.nix
Normal file
|
@ -0,0 +1,17 @@
|
|||
{ inputs, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
./vm-base.nix
|
||||
../modules/desktopManagers/cosmic.nix
|
||||
../modules/displayManagers/cosmic-greeter.nix
|
||||
];
|
||||
|
||||
config = {
|
||||
nixpkgs.overlays = [(import ../pkgs/overlays/cosmic-packages.nix { inherit inputs; })];
|
||||
nix.settings = {
|
||||
substituters = [ "https://cosmic.cachix.org/" ];
|
||||
trusted-public-keys = [ "cosmic.cachix.org-1:Dya9IyXD4xdBehWjrkPv6rtxpmMdRel02smYzA85dPE=" ];
|
||||
};
|
||||
};
|
||||
}
|
9
nixos/hosts/vm-gnome.nix
Normal file
9
nixos/hosts/vm-gnome.nix
Normal file
|
@ -0,0 +1,9 @@
|
|||
{ lib, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
./vm-base.nix
|
||||
../modules/desktopManagers/gnome.nix
|
||||
../modules/displayManagers/gdm.nix
|
||||
];
|
||||
}
|
49
nixos/modules/account.nix
Normal file
49
nixos/modules/account.nix
Normal file
|
@ -0,0 +1,49 @@
|
|||
{ config, lib, pkgs, unstablePkgs, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
./unstable-packages.nix
|
||||
];
|
||||
config = {
|
||||
users.users.wroclaw = {
|
||||
isNormalUser = true;
|
||||
description = "Rafał";
|
||||
group = "wroclaw";
|
||||
extraGroups = [
|
||||
"users"
|
||||
"wheel"
|
||||
] ++ lib.optional config.programs.adb.enable "adbusers";
|
||||
linger = true;
|
||||
initialPassword = "nixos";
|
||||
packages = with pkgs; [
|
||||
firefox
|
||||
(vivaldi.override {
|
||||
proprietaryCodecs = true;
|
||||
commandLineArgs = [ "--ozone-platform=wayland" ];
|
||||
})
|
||||
vesktop
|
||||
unstablePkgs.vscode
|
||||
gimp
|
||||
inkscape
|
||||
jitsi-meet-electron
|
||||
krita
|
||||
telegram-desktop
|
||||
unstablePkgs.zettlr
|
||||
];
|
||||
};
|
||||
users.groups.wroclaw.gid = 1000;
|
||||
|
||||
programs.steam = {
|
||||
enable = true;
|
||||
remotePlay.openFirewall = true;
|
||||
};
|
||||
|
||||
services.syncthing = {
|
||||
enable = true;
|
||||
user = "wroclaw";
|
||||
group = "wroclaw";
|
||||
dataDir = "/home/wroclaw";
|
||||
configDir = "/home/wroclaw/.config/syncthing";
|
||||
};
|
||||
};
|
||||
}
|
10
nixos/modules/adb.nix
Normal file
10
nixos/modules/adb.nix
Normal file
|
@ -0,0 +1,10 @@
|
|||
{ lib, config, pkgs, ... }:
|
||||
|
||||
{
|
||||
config = {
|
||||
programs.adb.enable = true;
|
||||
environment.systemPackages = with pkgs; [
|
||||
scrcpy
|
||||
];
|
||||
};
|
||||
}
|
176
nixos/modules/core-desktop.nix
Normal file
176
nixos/modules/core-desktop.nix
Normal file
|
@ -0,0 +1,176 @@
|
|||
{config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
./generic/mpv.nix
|
||||
./xdg-default-apps.nix
|
||||
];
|
||||
config = {
|
||||
services.printing.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;
|
||||
wireplumber.extraConfig = {
|
||||
"dont-switch-device-profiles"."wireplumber.settings"."bluetooth.autoswitch-to-headset-profile" = false;
|
||||
};
|
||||
};
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
kdePackages.kdeconnect-kde
|
||||
pcmanfm
|
||||
pwvucontrol
|
||||
qimgv
|
||||
];
|
||||
|
||||
programs.mpv = let
|
||||
fetchMpvScript = {url, hash, scriptName}: pkgs.fetchurl {
|
||||
inherit url hash;
|
||||
name = "mpv-script-${scriptName}";
|
||||
recursiveHash = true;
|
||||
downloadToTemp = true;
|
||||
postFetch = ''
|
||||
mkdir -p $out/share/mpv/scripts
|
||||
mv $downloadedFile $out/share/mpv/scripts/${scriptName}
|
||||
'';
|
||||
passthru.scriptName = scriptName;
|
||||
};
|
||||
in {
|
||||
enable = true;
|
||||
scripts = [
|
||||
pkgs.mpvScripts.sponsorblock
|
||||
pkgs.mpvScripts.mpris
|
||||
] ++ lib.map (script: fetchMpvScript {
|
||||
url = "https://raw.githubusercontent.com/occivink/mpv-scripts/d0390c8e802c2e888ff4a2e1d5e4fb040f855b89/scripts/${script.name}";
|
||||
hash = script.hash;
|
||||
scriptName = script.name;
|
||||
}) [
|
||||
{ name = "crop.lua"; hash = "sha256-/uaTCtV8Aanvnxrt8afBbO4uu2xp8Ec6DxApMb+fg2s="; }
|
||||
{ name = "encode.lua"; hash = "sha256-yK/DV0cpGhl4Uobl7xA1myZiECJpsShrHnsJftBqzAY="; }
|
||||
];
|
||||
settings = {
|
||||
mpv = {
|
||||
keep-open = "yes";
|
||||
volume = "40";
|
||||
osd-fractions = "yes";
|
||||
background = "none";
|
||||
border = "no";
|
||||
};
|
||||
input = lib.mkMerge [
|
||||
# mpv core
|
||||
''
|
||||
Alt+1 set window-scale 0.125
|
||||
Alt+2 set window-scale 0.25
|
||||
Alt+3 set window-scale 0.5
|
||||
Alt+4 set window-scale 1
|
||||
Alt+5 set window-scale 2
|
||||
''
|
||||
# crop.lua
|
||||
''
|
||||
c script-message-to crop start-crop hard
|
||||
alt+c script-message-to crop start-crop soft
|
||||
ctrl+shift+c script-message-to crop start-crop delogo
|
||||
C script-message-to crop toggle-crop hard
|
||||
''
|
||||
# encode.lua
|
||||
''
|
||||
b script-message-to encode encode_default
|
||||
alt+b script-message-to encode set-timestamp encode_default
|
||||
''
|
||||
];
|
||||
script-opts = {
|
||||
"encode_default.conf" = {
|
||||
only_active_tracks = "no";
|
||||
preserve_filters = "yes";
|
||||
append_filder = "";
|
||||
codec = "";
|
||||
output_format = "$f_$n.$x";
|
||||
output_dir = "/tmp";
|
||||
detached = "no";
|
||||
ffmpeg_command = lib.getExe pkgs.ffmpeg;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
# Fonts
|
||||
fonts.packages = with pkgs; [
|
||||
corefonts
|
||||
(nerdfonts.override { fonts = [ "Meslo" ]; })
|
||||
roboto
|
||||
];
|
||||
|
||||
# Pcmanfm configuration
|
||||
environment.etc."xdg/pcmanfm/default/pcmanfm.conf".text = ''
|
||||
[config]
|
||||
bm_open_method=0
|
||||
|
||||
[volume]
|
||||
mount_on_startup=0
|
||||
mount_removable=0
|
||||
autorun=0
|
||||
|
||||
[ui]
|
||||
always_show_tabs=1
|
||||
max_tab_chars=32
|
||||
media_in_new_tab=0
|
||||
desktop_folder_new_win=0
|
||||
change_tab_on_drop=1
|
||||
close_on_unmount=1
|
||||
focus_previous=1
|
||||
side_pane_mode=places
|
||||
view_mode=list
|
||||
show_hidden=1
|
||||
sort=name;ascending;
|
||||
toolbar=newwin;newtab;navigation;home;
|
||||
show_statusbar=1
|
||||
pathbar_mode_buttons=0
|
||||
'';
|
||||
|
||||
environment.etc."xdg/libfm/libfm.conf".text = ''
|
||||
[config]
|
||||
single_click=0
|
||||
use_trash=1
|
||||
confirm_del=1
|
||||
confirm_trash=1
|
||||
advanced_mode=0
|
||||
si_unit=0
|
||||
force_startup_notify=1
|
||||
backup_as_hidden=1
|
||||
no_usb_trash=1
|
||||
no_child_non_expandable=0
|
||||
show_full_names=0
|
||||
only_user_templates=0
|
||||
drop_default_action=auto
|
||||
terminal=${lib.optionalString (lib.elem pkgs.kitty config.environment.systemPackages) "kitty"}
|
||||
archiver=file-roller
|
||||
thumbnail_local=1
|
||||
thumbnail_max=16384
|
||||
|
||||
[ui]
|
||||
big_icon_size=48
|
||||
small_icon_size=16
|
||||
pane_icon_size=16
|
||||
thumbnail_size=128
|
||||
show_thumbnail=1
|
||||
shadow_hidden=1
|
||||
|
||||
[places]
|
||||
places_home=1
|
||||
places_desktop=1
|
||||
places_root=1
|
||||
places_computer=1
|
||||
places_trash=1
|
||||
places_applications=1
|
||||
places_network=1
|
||||
places_unmounted=1
|
||||
'';
|
||||
};
|
||||
}
|
93
nixos/modules/core.nix
Normal file
93
nixos/modules/core.nix
Normal file
|
@ -0,0 +1,93 @@
|
|||
{
|
||||
inputs,
|
||||
lib,
|
||||
pkgs,
|
||||
self,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
imports = [
|
||||
./module-overrides.nix
|
||||
./nix.nix
|
||||
];
|
||||
config = {
|
||||
|
||||
# kernel
|
||||
boot.kernelPackages = pkgs.linuxPackages_latest;
|
||||
|
||||
# Enable networking
|
||||
networking.networkmanager.enable = true;
|
||||
|
||||
# Allow unfree packages
|
||||
nixpkgs.config.allowUnfree = true;
|
||||
nix = {
|
||||
channel.enable = false;
|
||||
settings = {
|
||||
auto-optimise-store = true;
|
||||
experimental-features = [
|
||||
"no-url-literals"
|
||||
];
|
||||
};
|
||||
nixPath = [
|
||||
"nixpkgs=${pkgs.selfExpr { useConfig = false; }}"
|
||||
"systemNixpkgs=${pkgs.selfExpr { useConfig = true; name = "systemNixpkgs-self"; }}"
|
||||
# don't garbage collect the nixpkgs input
|
||||
"inputsNixpkgs=${inputs.nixpkgs}"
|
||||
"nixos-system=/etc/nixos/default.nix"
|
||||
];
|
||||
};
|
||||
|
||||
# List packages installed in system profile. To search, run:
|
||||
# $ nix search wget
|
||||
environment.systemPackages = with pkgs; [
|
||||
waypipe
|
||||
wget
|
||||
ffmpeg
|
||||
yt-dlp
|
||||
htop
|
||||
btop
|
||||
fastfetch
|
||||
smartmontools
|
||||
ddrescue
|
||||
];
|
||||
programs.git.enable = true;
|
||||
programs.git.config = {
|
||||
commit.verbose = true;
|
||||
init.defaultBranch = "main";
|
||||
merge.conflictstyle = "diff3";
|
||||
rerere.enabled = true;
|
||||
};
|
||||
|
||||
# Use nix-index for command-not-found handler
|
||||
programs.command-not-found.enable = false;
|
||||
programs.nix-index = {
|
||||
package = pkgs.nix-index.override {
|
||||
nix-index-unwrapped = pkgs.nix-index-unwrapped.overrideAttrs (oldAttrs: {
|
||||
patches = oldAttrs.patches or [] ++ [
|
||||
( builtins.path { path = "${self}/pkgs/by-name/ni/nix-index/cnfOutput.patch"; } )
|
||||
];
|
||||
});
|
||||
|
||||
};
|
||||
enable = true;
|
||||
enableBashIntegration = 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
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
162
nixos/modules/dconf-common.nix
Normal file
162
nixos/modules/dconf-common.nix
Normal file
|
@ -0,0 +1,162 @@
|
|||
{config, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
./generic/dconf.nix
|
||||
];
|
||||
|
||||
config = {
|
||||
proot.dconf.rules = with lib.gvariant; {
|
||||
"org/gnome/desktop/background" = {
|
||||
picture-options = "zoom";
|
||||
picture-uri = "file://${../media/wallpaper.png}";
|
||||
picture-uri-dark = "file://${../media/wallpaper.png}";
|
||||
};
|
||||
|
||||
"org/gnome/desktop/interface" = {
|
||||
clock-show-date = true;
|
||||
clock-show-seconds = true;
|
||||
clock-show-weekday = true;
|
||||
color-scheme = "prefer-dark";
|
||||
cursor-theme = "GoogleDot-White";
|
||||
};
|
||||
|
||||
"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/desktop/wm/preferences" = {
|
||||
button-layout = "appmenu:close";
|
||||
resize-with-right-button = 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"
|
||||
"top-bar-organizer@julian.gse.jsts.xyz"
|
||||
"color-picker@tuberry"
|
||||
];
|
||||
favorite-apps = [
|
||||
"kitty.desktop"
|
||||
"pcmanfm.desktop"
|
||||
"vivaldi-stable.desktop"
|
||||
"code.desktop"
|
||||
"org.gnome.Nautilus.desktop"
|
||||
"steam.desktop"
|
||||
"com.saivert.pwvucontrol.desktop"
|
||||
];
|
||||
};
|
||||
|
||||
"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;
|
||||
hint-color-rgba = "rgb(161,192,235)";
|
||||
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 16;
|
||||
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-keybindings/custom0/"
|
||||
else null
|
||||
)
|
||||
];
|
||||
help = mkEmptyArray "s";
|
||||
screensaver = ["<Control><Super>l"];
|
||||
};
|
||||
|
||||
"org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0" =
|
||||
if builtins.elem pkgs.kitty config.environment.systemPackages then {
|
||||
binding = "<Control><Alt>t";
|
||||
command = "kitty";
|
||||
name = "Terminal";
|
||||
} else null;
|
||||
};
|
||||
};
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
true
|
|
@ -0,0 +1,11 @@
|
|||
[
|
||||
"kitty",
|
||||
"vivaldi-stable",
|
||||
"pcmanfm",
|
||||
"code",
|
||||
"steam",
|
||||
"vesktop",
|
||||
"org.telegram.desktop",
|
||||
"jitsi-meet-electron",
|
||||
"com.saivert.pwvucontrol",
|
||||
]
|
|
@ -0,0 +1 @@
|
|||
None
|
|
@ -0,0 +1 @@
|
|||
true
|
|
@ -0,0 +1 @@
|
|||
true
|
|
@ -0,0 +1,9 @@
|
|||
(
|
||||
output: "all",
|
||||
source: Path("@wallpaper@"),
|
||||
filter_by_theme: true,
|
||||
rotation_frequency: 300,
|
||||
filter_method: Lanczos,
|
||||
scaling_mode: Zoom,
|
||||
sampling_method: Alphanumeric,
|
||||
)
|
|
@ -0,0 +1 @@
|
|||
true
|
|
@ -0,0 +1 @@
|
|||
true
|
|
@ -0,0 +1 @@
|
|||
PerWorkspace
|
|
@ -0,0 +1 @@
|
|||
true
|
|
@ -0,0 +1 @@
|
|||
50
|
|
@ -0,0 +1,4 @@
|
|||
(
|
||||
workspace_mode: OutputBound,
|
||||
workspace_layout: Horizontal,
|
||||
)
|
|
@ -0,0 +1,5 @@
|
|||
(
|
||||
show_content: false,
|
||||
show_mounted_drives: false,
|
||||
show_trash: false,
|
||||
)
|
|
@ -0,0 +1 @@
|
|||
Bottom
|
|
@ -0,0 +1 @@
|
|||
false
|
|
@ -0,0 +1,5 @@
|
|||
Some((
|
||||
wait_time: 1000,
|
||||
transition_time: 200,
|
||||
handle_size: 4,
|
||||
))
|
|
@ -0,0 +1 @@
|
|||
@corner_radii_panel@
|
|
@ -0,0 +1 @@
|
|||
false
|
|
@ -0,0 +1 @@
|
|||
Top
|
|
@ -0,0 +1,5 @@
|
|||
Some([
|
||||
"com.system76.CosmicAppList",
|
||||
"com.system76.CosmicAppletMinimize",
|
||||
"com.system76.CosmicPanelAppButton",
|
||||
])
|
|
@ -0,0 +1 @@
|
|||
None
|
|
@ -0,0 +1 @@
|
|||
Top
|
|
@ -0,0 +1 @@
|
|||
false
|
|
@ -0,0 +1 @@
|
|||
Top
|
|
@ -0,0 +1,3 @@
|
|||
Some([
|
||||
"com.system76.CosmicAppletTime",
|
||||
])
|
|
@ -0,0 +1,14 @@
|
|||
Some(([
|
||||
"com.system76.CosmicPanelAppButton",
|
||||
"com.system76.CosmicAppletWorkspaces",
|
||||
], [
|
||||
"com.system76.CosmicAppletStatusArea",
|
||||
"com.system76.CosmicAppletInputSources",
|
||||
"com.system76.CosmicAppletTiling",
|
||||
"com.system76.CosmicAppletAudio",
|
||||
"com.system76.CosmicAppletNetwork",
|
||||
"com.system76.CosmicAppletBattery",
|
||||
"com.system76.CosmicAppletNotifications",
|
||||
"com.system76.CosmicAppletBluetooth",
|
||||
"com.system76.CosmicAppletPower",
|
||||
]))
|
|
@ -0,0 +1,36 @@
|
|||
{
|
||||
(
|
||||
modifiers: [
|
||||
Ctrl,
|
||||
Alt,
|
||||
],
|
||||
key: "t",
|
||||
description: Some("Open terminal"),
|
||||
): Spawn("kitty"),
|
||||
(
|
||||
modifiers: [
|
||||
Super,
|
||||
Shift,
|
||||
],
|
||||
key: "s",
|
||||
): System(Screenshot),
|
||||
(
|
||||
modifiers: [
|
||||
Super,
|
||||
Ctrl,
|
||||
],
|
||||
key: "l",
|
||||
): System(LockScreen),
|
||||
(
|
||||
modifiers: [
|
||||
Super,
|
||||
],
|
||||
): System(Launcher),
|
||||
(
|
||||
modifiers: [
|
||||
Super,
|
||||
Alt,
|
||||
],
|
||||
key: "g",
|
||||
): ToggleSticky,
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
2
|
|
@ -0,0 +1,8 @@
|
|||
(
|
||||
radius_0: (0.0, 0.0, 0.0, 0.0),
|
||||
radius_xs: (@corner_radii_theme@, @corner_radii_theme@, @corner_radii_theme@, @corner_radii_theme@),
|
||||
radius_s: (@corner_radii_theme@, @corner_radii_theme@, @corner_radii_theme@, @corner_radii_theme@),
|
||||
radius_m: (@corner_radii_theme@, @corner_radii_theme@, @corner_radii_theme@, @corner_radii_theme@),
|
||||
radius_l: (@corner_radii_theme@, @corner_radii_theme@, @corner_radii_theme@, @corner_radii_theme@),
|
||||
radius_xl: (@corner_radii_theme@, @corner_radii_theme@, @corner_radii_theme@, @corner_radii_theme@),
|
||||
)
|
|
@ -0,0 +1 @@
|
|||
(0, 4)
|
|
@ -0,0 +1 @@
|
|||
2
|
|
@ -0,0 +1,8 @@
|
|||
(
|
||||
radius_0: (0.0, 0.0, 0.0, 0.0),
|
||||
radius_xs: (@corner_radii_theme@, @corner_radii_theme@, @corner_radii_theme@, @corner_radii_theme@),
|
||||
radius_s: (@corner_radii_theme@, @corner_radii_theme@, @corner_radii_theme@, @corner_radii_theme@),
|
||||
radius_m: (@corner_radii_theme@, @corner_radii_theme@, @corner_radii_theme@, @corner_radii_theme@),
|
||||
radius_l: (@corner_radii_theme@, @corner_radii_theme@, @corner_radii_theme@, @corner_radii_theme@),
|
||||
radius_xl: (@corner_radii_theme@, @corner_radii_theme@, @corner_radii_theme@, @corner_radii_theme@),
|
||||
)
|
|
@ -0,0 +1 @@
|
|||
(0, 4)
|
|
@ -0,0 +1 @@
|
|||
true
|
|
@ -0,0 +1 @@
|
|||
false
|
|
@ -0,0 +1 @@
|
|||
false
|
62
nixos/modules/desktopManagers/cosmic.nix
Normal file
62
nixos/modules/desktopManagers/cosmic.nix
Normal file
|
@ -0,0 +1,62 @@
|
|||
{
|
||||
inputs,
|
||||
lib,
|
||||
pkgs,
|
||||
self,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cosmic-configuration = pkgs.substituteAllFiles {
|
||||
name = "cosmic-configuration";
|
||||
src = ./cosmic-config;
|
||||
files = [ "." ]; # All files
|
||||
postInstall = ''
|
||||
mkdir -p $share/share/cosmic
|
||||
cp -rt $share/share/cosmic $out/*
|
||||
'';
|
||||
outputs = [ "out" "share" ];
|
||||
|
||||
wallpaper = builtins.path { path = "${self}/media/wallpaper.png"; };
|
||||
corner_radii_theme = "2.0";
|
||||
corner_radii_panel = "2";
|
||||
};
|
||||
in
|
||||
|
||||
{
|
||||
imports = [
|
||||
"${inputs.cosmic-modules}/nixos/cosmic/module.nix"
|
||||
"${self}/nixos/modules/generic/dconf.nix"
|
||||
];
|
||||
config = {
|
||||
services.desktopManager.cosmic.enable = true;
|
||||
environment.cosmic.excludePackages = with pkgs; [
|
||||
cosmic-edit
|
||||
cosmic-player
|
||||
cosmic-term
|
||||
];
|
||||
environment.systemPackages = with pkgs; [
|
||||
(lib.hiPrio cosmic-configuration.share)
|
||||
google-cursor
|
||||
];
|
||||
services.gnome.gnome-keyring.enable = true;
|
||||
|
||||
proot.dconf = {
|
||||
rules."org/gnome/desktop/interface".cursor-theme = "GoogleDot-White";
|
||||
profiles.user.rulesToApply = [
|
||||
"org/gnome/desktop/interface"
|
||||
];
|
||||
};
|
||||
|
||||
environment.sessionVariables = {
|
||||
XCURSOR_SIZE = "16";
|
||||
XCURSOR_THEME = "GoogleDot-White";
|
||||
};
|
||||
|
||||
environment.etc."xdg/gtk-3.0/settings.ini".text = ''
|
||||
[Settings]
|
||||
gtk-cursor-theme-name=GoogleDot-White
|
||||
gtk-application-prefer-dark-theme=true
|
||||
'';
|
||||
};
|
||||
}
|
93
nixos/modules/desktopManagers/gnome.nix
Normal file
93
nixos/modules/desktopManagers/gnome.nix
Normal file
|
@ -0,0 +1,93 @@
|
|||
{config, lib, pkgs, ... }:
|
||||
|
||||
let
|
||||
maxThumbnails = config.programs.gnome.extensions.workspaceIndicator.maxThumbnails;
|
||||
workspaceIndicator = pkgs.gnomeExtensions.workspace-indicator.overrideAttrs {
|
||||
postPatch = ''
|
||||
sed -i 's/const MAX_THUMBNAILS = 6;/const MAX_THUMBNAILS = '${builtins.toString maxThumbnails}'/' extension.js
|
||||
'';
|
||||
};
|
||||
in
|
||||
{
|
||||
options = {
|
||||
programs.gnome.extensions.workspaceIndicator.maxThumbnails = lib.mkOption {
|
||||
type = lib.types.int;
|
||||
default = 11;
|
||||
description = "The maximum number of thumbnails to show in the workspace indicator";
|
||||
};
|
||||
};
|
||||
imports = [
|
||||
../unstable-packages.nix
|
||||
../dconf-common.nix
|
||||
];
|
||||
config = {
|
||||
services.xserver.enable = true;
|
||||
services.xserver.desktopManager.gnome.enable = true;
|
||||
|
||||
# environment.sessionVariables.NIXOS_OZONE_WL = "1";
|
||||
|
||||
proot.dconf.profiles.user.rulesToApply = [
|
||||
"org/gnome/desktop/background"
|
||||
"org/gnome/desktop/interface"
|
||||
"org/gnome/desktop/media-handling"
|
||||
"org/gnome/desktop/peripherals/mouse"
|
||||
"org/gnome/desktop/sound"
|
||||
"org/gnome/desktop/wm/preferences"
|
||||
"org/gnome/mutter"
|
||||
"org/gnome/SessionManager"
|
||||
"org/gnome/settings-daemon/plugins/power"
|
||||
"org/gnome/shell"
|
||||
"org/gnome/shell/app-switcher"
|
||||
"org/gnome/shell/extensions/color-picker"
|
||||
"org/gnome/shell/extensions/pop-shell"
|
||||
"org/gnome/shell/extensions/top-bar-organizer"
|
||||
"org/gnome/shell/extensions/trayIconsReloaded"
|
||||
"org/gnome/shell/extensions/vitals"
|
||||
"org/gnome/shell/keybindings"
|
||||
"org/gnome/desktop/default-applications/terminal"
|
||||
"org/gnome/settings-daemon/plugins/media-keys"
|
||||
"org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom0"
|
||||
];
|
||||
|
||||
environment.gnome.excludePackages = with pkgs; [
|
||||
gnome.baobab
|
||||
gnome.cheese
|
||||
gnome.epiphany
|
||||
gnome.evince
|
||||
gnome.geary
|
||||
gedit
|
||||
gnome.gnome-characters
|
||||
gnome-connections
|
||||
gnome-console
|
||||
gnome.gnome-disk-utility
|
||||
gnome.gnome-font-viewer
|
||||
gnome.gnome-logs
|
||||
gnome.gnome-maps
|
||||
gnome-text-editor
|
||||
gnome-tour
|
||||
gnome.seahorse
|
||||
gnome.totem
|
||||
gnome.yelp
|
||||
gnome.nautilus
|
||||
];
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
workspaceIndicator
|
||||
gnomeExtensions.pop-shell
|
||||
gnomeExtensions.vitals
|
||||
gnomeExtensions.tray-icons-reloaded
|
||||
gnomeExtensions.color-picker
|
||||
gnomeExtensions.top-bar-organizer
|
||||
# unstablePkgs.gnomeExtensions.translate-indicator
|
||||
# translate-shell
|
||||
google-cursor
|
||||
];
|
||||
|
||||
environment.etc."xdg/gtk-3.0/settings.ini".text = ''
|
||||
[Settings]
|
||||
gtk-cursor-theme-name=${config.proot.dconf.rules."org/gnome/desktop/interface".cursor-theme}
|
||||
'' + lib.optionalString (lib.hasInfix "dark" config.proot.dconf.rules."org/gnome/desktop/interface".color-scheme) ''
|
||||
gtk-application-prefer-dark-theme=true
|
||||
'';
|
||||
};
|
||||
}
|
10
nixos/modules/displayManagers/cosmic-greeter.nix
Normal file
10
nixos/modules/displayManagers/cosmic-greeter.nix
Normal file
|
@ -0,0 +1,10 @@
|
|||
{ inputs, lib, pkgs, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
"${inputs.cosmic-modules}/nixos/cosmic-greeter/module.nix"
|
||||
];
|
||||
config = {
|
||||
services.displayManager.cosmic-greeter.enable = true;
|
||||
};
|
||||
}
|
25
nixos/modules/displayManagers/gdm.nix
Normal file
25
nixos/modules/displayManagers/gdm.nix
Normal file
|
@ -0,0 +1,25 @@
|
|||
{pkgs, ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
../dconf-common.nix
|
||||
];
|
||||
config = {
|
||||
services.xserver.displayManager.gdm = {
|
||||
enable = true;
|
||||
autoSuspend = false;
|
||||
};
|
||||
|
||||
proot.dconf.profiles.gdm.rulesToApply = [
|
||||
"org/gnome/desktop/interface"
|
||||
"org/gnome/desktop/peripherals/mouse"
|
||||
"org/gnome/desktop/sound"
|
||||
"org/gnome/settings-daemon/plugins/power"
|
||||
"org/gnome/shell/keybindings"
|
||||
];
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
google-cursor
|
||||
];
|
||||
};
|
||||
}
|
41
nixos/modules/docker.nix
Normal file
41
nixos/modules/docker.nix
Normal file
|
@ -0,0 +1,41 @@
|
|||
{ lib, config, pkgs, ... }:
|
||||
|
||||
{
|
||||
config = {
|
||||
virtualisation.docker = {
|
||||
enable = 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";
|
||||
};
|
||||
};
|
||||
users.users.indocker = {
|
||||
isSystemUser = true;
|
||||
hashedPassword = "!";
|
||||
uid = 900;
|
||||
group = "indocker";
|
||||
};
|
||||
users.groups.indocker = {
|
||||
gid = 900;
|
||||
};
|
||||
environment.systemPackages = with pkgs; [
|
||||
docker-compose
|
||||
];
|
||||
|
||||
# Docker enables firewall anyway, let's enable the firewall for it if it's disabled
|
||||
# TODO: Apply only when config.networking.firewall is false
|
||||
networking.firewall = {
|
||||
enable = lib.mkOverride 90 true;
|
||||
allowedTCPPorts = lib.mkOverride 90 [];
|
||||
allowedUDPPorts = lib.mkOverride 90 [];
|
||||
allowedTCPPortRanges = lib.mkOverride 90 [{ from = 0; to = 65535;}];
|
||||
allowedUDPPortRanges = lib.mkOverride 90 [{ from = 0; to = 65535;}];
|
||||
};
|
||||
};
|
||||
}
|
46
nixos/modules/generic/dconf.nix
Normal file
46
nixos/modules/generic/dconf.nix
Normal file
|
@ -0,0 +1,46 @@
|
|||
{ config, lib, pkgs, options, ... }:
|
||||
|
||||
# proot.dconf.rules
|
||||
# proot.dconf.profiles.<profile>.rulesToApply
|
||||
# proot.dconf.profiles.<profile>.extraRules
|
||||
let
|
||||
cfg = config.proot.dconf;
|
||||
profileOpts = lib.types.submodule {
|
||||
options = {
|
||||
rulesToApply = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.str;
|
||||
default = lib.attrNames cfg.rules;
|
||||
description = "A list of rules keys to apply for profile";
|
||||
};
|
||||
extraRules = lib.mkOption {
|
||||
type = lib.types.attrs;
|
||||
default = {};
|
||||
description = "An attrset of additional dconf rules to apply ontop of selected";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
mapper = _: value: {
|
||||
databases = lib.singleton {
|
||||
settings = lib.filterAttrs (key: _: lib.elem key value.rulesToApply) cfg.rules // value.extraRules;
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
options.proot.dconf = {
|
||||
rules = lib.mkOption {
|
||||
type = lib.types.attrs;
|
||||
default = {};
|
||||
description = "An attrset of dconf rules to pull from";
|
||||
};
|
||||
profiles = lib.mkOption {
|
||||
type = lib.types.attrsOf profileOpts;
|
||||
default = {};
|
||||
description = "An attret of profiles to create, with pulled rules";
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
programs.dconf.profiles = lib.mapAttrs mapper cfg.profiles;
|
||||
};
|
||||
}
|
91
nixos/modules/generic/mpv.nix
Normal file
91
nixos/modules/generic/mpv.nix
Normal file
|
@ -0,0 +1,91 @@
|
|||
{config, lib, options, pkgs, ... }:
|
||||
|
||||
let
|
||||
cfg = config.programs.mpv;
|
||||
opts = options.programs.mpv;
|
||||
|
||||
toMpvIniString = attrset: lib.pipe attrset [
|
||||
(lib.mapAttrsToList (name: value: "${name}=${value}"))
|
||||
(lib.concatStringsSep "\n")
|
||||
];
|
||||
|
||||
configDir = pkgs.symlinkJoin {
|
||||
name = "mpv-config-dir";
|
||||
paths = lib.optional opts.settings.mpv.isDefined (pkgs.writeTextFile {
|
||||
name = "mpv-config-dir-mpv.conf";
|
||||
destination = "/share/mpv/mpv.conf";
|
||||
text = toMpvIniString cfg.settings.mpv;
|
||||
}) ++ lib.optional opts.settings.input.isDefined (pkgs.writeTextFile {
|
||||
name = "mpv-config-dir-input.conf";
|
||||
destination = "/share/mpv/input.conf";
|
||||
text = cfg.settings.input;
|
||||
}) ++ lib.mapAttrsToList (filename: opts: pkgs.writeTextFile {
|
||||
name = "mpv-config-dir-script-opts-${filename}";
|
||||
destination = "/share/mpv/script-opts/${filename}";
|
||||
text = toMpvIniString opts;
|
||||
}) cfg.settings.script-opts;
|
||||
};
|
||||
|
||||
wrappedMpv = cfg.package.wrapper {
|
||||
mpv = cfg.package;
|
||||
youtubeSupport = cfg.youtubeSupport;
|
||||
scripts = cfg.scripts;
|
||||
extraMakeWrapperArgs = lib.optionals (lib.any (x: x) [
|
||||
opts.settings.mpv.isDefined
|
||||
opts.settings.input.isDefined
|
||||
(lib.length (lib.attrNames cfg.settings.script-opts) > 0)
|
||||
]) [
|
||||
"--add-flags" "--config-dir='${configDir}/share/mpv'"
|
||||
];
|
||||
};
|
||||
in
|
||||
{
|
||||
options.programs.mpv = {
|
||||
enable = lib.mkEnableOption "mpv";
|
||||
package = lib.mkPackageOption pkgs "mpv-unwrapped" {};
|
||||
scripts = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.package;
|
||||
default = [];
|
||||
};
|
||||
youtubeSupport = lib.mkEnableOption "yt-dlp support for mpv" // {
|
||||
default = true;
|
||||
};
|
||||
settings = let
|
||||
mpvini = lib.types.attrsOf lib.types.str;
|
||||
in {
|
||||
script-opts = lib.mkOption {
|
||||
type = lib.types.attrsOf mpvini;
|
||||
default = {};
|
||||
example = {
|
||||
"crop.conf".draw_crosshair = "yes";
|
||||
};
|
||||
description = ''
|
||||
A map of script options for mpv scripts.
|
||||
The key is the filename of the script, and the value is a map of options.
|
||||
'';
|
||||
};
|
||||
input = lib.mkOption {
|
||||
type = lib.types.separatedString "\n";
|
||||
example = ''
|
||||
Alt+1 set window-scale 0.125
|
||||
'';
|
||||
description = ''
|
||||
A list of input commands to be added to the input.conf file.
|
||||
'';
|
||||
};
|
||||
mpv = lib.mkOption {
|
||||
type = mpvini;
|
||||
example = {
|
||||
keep-open = "yes";
|
||||
osd-fractions = "yes";
|
||||
};
|
||||
description = ''
|
||||
A map of mpv options.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
config = lib.mkIf cfg.enable {
|
||||
environment.systemPackages = [ wrappedMpv ];
|
||||
};
|
||||
}
|
19
nixos/modules/gnupg.nix
Normal file
19
nixos/modules/gnupg.nix
Normal file
|
@ -0,0 +1,19 @@
|
|||
{ pkgs, ... }:
|
||||
|
||||
{
|
||||
config = {
|
||||
# Use pcscd for smartcard support
|
||||
services.pcscd.enable = true;
|
||||
|
||||
programs.gnupg = {
|
||||
package = pkgs.gnupg.overrideAttrs (superAttrs: {
|
||||
configureFlags = superAttrs.configureFlags or []
|
||||
++ [ "--disable-ccid-driver" ];
|
||||
});
|
||||
agent = {
|
||||
enable = true;
|
||||
pinentryPackage = pkgs.pinentry-qt;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
30
nixos/modules/locale.nix
Normal file
30
nixos/modules/locale.nix
Normal file
|
@ -0,0 +1,30 @@
|
|||
{
|
||||
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";
|
||||
};
|
||||
}
|
43
nixos/modules/module-overrides.nix
Normal file
43
nixos/modules/module-overrides.nix
Normal file
|
@ -0,0 +1,43 @@
|
|||
{
|
||||
lib,
|
||||
modulesPath,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
moduleOverrides = [
|
||||
# NIXPKGS-PR: 359882
|
||||
{
|
||||
disabledModules = [
|
||||
"${modulesPath}/system/boot/luksroot.nix"
|
||||
];
|
||||
replacementModules = [(builtins.fetchurl {
|
||||
url = "https://raw.githubusercontent.com/amozeo/nixpkgs/728d5806fe6f975ba3843297332d12e13119fe86/nixos/modules/system/boot/luksroot.nix";
|
||||
sha256 = "0s2k8k6rrlwn2zb02q6fkvswln8w4hvh02hm4krqvkh46amyasyy";
|
||||
})];
|
||||
}
|
||||
# NIXPKGS-PR: 394300
|
||||
{
|
||||
disabledModules = [
|
||||
"${modulesPath}/hardware/openrazer.nix"
|
||||
];
|
||||
replacementModules = [
|
||||
(builtins.fetchurl {
|
||||
url = "https://raw.githubusercontent.com/NixOS/nixpkgs/4a11562c20fbe7af7d5ac139dbf0f8d50ce276f6/nixos/modules/hardware/openrazer.nix";
|
||||
sha256 = "0n6kzrcwlmxgws4pmffyqagp2rxpfxmfjl11vgvlkjcbglg6fs7y";
|
||||
})
|
||||
];
|
||||
}
|
||||
];
|
||||
|
||||
toModule = entry: {
|
||||
imports = entry.replacementModules;
|
||||
disabledModules = entry.disabledModules;
|
||||
_file = let
|
||||
info = builtins.unsafeGetAttrPos "disabledModules" entry;
|
||||
in "${info.file}:L${info.line}";
|
||||
};
|
||||
in
|
||||
{
|
||||
imports = lib.map toModule moduleOverrides;
|
||||
}
|
66
nixos/modules/nix.nix
Normal file
66
nixos/modules/nix.nix
Normal file
|
@ -0,0 +1,66 @@
|
|||
{
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
# bool -> nixpkgs[]
|
||||
wrappedNixExecutables = inEnvironment: assert builtins.isBool inEnvironment; pkgs.symlinkJoin {
|
||||
name = "${pkgs.nix.name}-wrap";
|
||||
paths = [ pkgs.nix ];
|
||||
nativeBuildInputs = [
|
||||
pkgs.makeWrapper
|
||||
];
|
||||
postBuild = ''
|
||||
wrapProgram $out/bin/nix-build \
|
||||
--add-flags "--log-format" \
|
||||
--add-flags "bar${lib.optionalString inEnvironment "-with-logs"}"
|
||||
wrapProgram $out/bin/nix-shell \
|
||||
--add-flags "--log-format" \
|
||||
--add-flags "bar"
|
||||
wrapProgram $out/bin/nix-env \
|
||||
--add-flags "--log-format" \
|
||||
--add-flags "bar"
|
||||
'';
|
||||
passthru = {
|
||||
inherit (pkgs.nix) man meta version;
|
||||
};
|
||||
};
|
||||
|
||||
# NIXPKGS-PR: 389487
|
||||
futureNixosExecutables = let
|
||||
nixpkgs = builtins.fetchTarball {
|
||||
url = "https://github.com/NixOS/nixpkgs/archive/53a47a1c57b35bb5850cfb137d5c51ec6581152d.tar.gz";
|
||||
sha256 = "sha256-B2nuArKny9jHqEZewqlu61f/4/9lh65iGF9IKjeTc+c=";
|
||||
};
|
||||
in pkgs.callPackage "${nixpkgs}/pkgs/os-specific/linux/nixos-rebuild/default.nix" {};
|
||||
|
||||
wrappedNixosExecutables = pkgs.symlinkJoin {
|
||||
name = "${pkgs.nixos-rebuild.name}-wrap";
|
||||
paths = [ futureNixosExecutables ];
|
||||
nativeBuildInputs = [
|
||||
pkgs.makeWrapper
|
||||
];
|
||||
postBuild = ''
|
||||
wrapProgram $out/bin/nixos-rebuild \
|
||||
--add-flags "--log-format" \
|
||||
--add-flags "bar" \
|
||||
--add-flags "--use-remote-sudo"
|
||||
'';
|
||||
};
|
||||
in {
|
||||
config = {
|
||||
nix.package = wrappedNixExecutables false;
|
||||
environment.systemPackages = [
|
||||
pkgs.nix-output-monitor
|
||||
pkgs.nix-diff
|
||||
pkgs.nix-tree
|
||||
] ++ lib.map (lib.hiPrio) [
|
||||
(wrappedNixExecutables true)
|
||||
wrappedNixosExecutables
|
||||
];
|
||||
system.build.nixos-rebuild = lib.mkForce wrappedNixosExecutables;
|
||||
system.tools.nixos-rebuild.enable = false;
|
||||
};
|
||||
}
|
101
nixos/modules/nvidia.nix
Normal file
101
nixos/modules/nvidia.nix
Normal file
|
@ -0,0 +1,101 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
self,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
config = {
|
||||
hardware.graphics = {
|
||||
enable = true;
|
||||
enable32Bit = true;
|
||||
};
|
||||
|
||||
# Workaround for nvidia driver ghost display
|
||||
boot.kernelParams = [ "nvidia_drm.fbdev=1" ];
|
||||
|
||||
services.xserver.videoDrivers = ["nvidia"];
|
||||
hardware.nvidia = {
|
||||
modesetting.enable = true;
|
||||
powerManagement.enable = true;
|
||||
open = false;
|
||||
nvidiaSettings = true;
|
||||
package = let
|
||||
mkDriverArgs = {
|
||||
version = "575.51.02";
|
||||
sha256_64bit = "sha256-XZ0N8ISmoAC8p28DrGHk/YN1rJsInJ2dZNL8O+Tuaa0=";
|
||||
sha256_aarch64 = "sha256-NNeQU9sPfH1sq3d5RUq1MWT6+7mTo1SpVfzabYSVMVI=";
|
||||
openSha256 = "sha256-NQg+QDm9Gt+5bapbUO96UFsPnz1hG1dtEwT/g/vKHkw=";
|
||||
settingsSha256 = "sha256-6n9mVkEL39wJj5FB1HBml7TTJhNAhS/j5hqpNGFQE4w=";
|
||||
persistencedSha256 = "sha256-dgmco+clEIY8bedxHC4wp+fH5JavTzyI1BI8BxoeJJI=";
|
||||
};
|
||||
in ( config.boot.kernelPackages.nvidiaPackages.mkDriver mkDriverArgs ).overrideAttrs (super: {
|
||||
passthru = super.passthru or {} // {
|
||||
urls = {
|
||||
x86_64 = [
|
||||
"https://download.nvidia.com/XFree86/Linux-x86_64/${mkDriverArgs.version}/NVIDIA-Linux-x86_64-${mkDriverArgs.version}.run"
|
||||
"https://us.download.nvidia.com/XFree86/Linux-x86_64/${mkDriverArgs.version}/NVIDIA-Linux-x86_64-${mkDriverArgs.version}.run"
|
||||
];
|
||||
aarch64 = [
|
||||
"https://us.download.nvidia.com/XFree86/aarch64/${mkDriverArgs.version}/NVIDIA-Linux-aarch64-${mkDriverArgs.version}.run"
|
||||
"https://download.nvidia.com/XFree86/Linux-aarch64/${mkDriverArgs.version}/NVIDIA-Linux-aarch64-${mkDriverArgs.version}.run"
|
||||
];
|
||||
};
|
||||
updateScript = pkgs.den-http-get-updater {
|
||||
fileLocation = ( builtins.unsafeGetAttrPos "any" { any = null; } ).file;
|
||||
previousVersion = mkDriverArgs.version;
|
||||
versionUrl = "https://raw.githubusercontent.com/aaronp24/nvidia-versions/master/nvidia-versions.txt";
|
||||
extraPackages = with pkgs; [
|
||||
coreutils
|
||||
gawk
|
||||
gnugrep
|
||||
];
|
||||
contentParser = lib.concatStringsSep " | " [
|
||||
"echo \"$newVersion\""
|
||||
"grep current"
|
||||
"awk '{print $3}'"
|
||||
"sort -V"
|
||||
"tail -n 1"
|
||||
];
|
||||
unpack = false;
|
||||
prefetchList = lib.map (x: {
|
||||
inherit (x) previousHash;
|
||||
unpack = x.unpack or true;
|
||||
prefetchUrlLocation = {
|
||||
file = builtins.toString self + "/outputs.nix";
|
||||
# TODO: don't use already existing NixOS configuration
|
||||
attrpath = "nixosConfigurations.main.config.hardware.nvidia.package.${x.locationAttrpath}";
|
||||
};
|
||||
}) [
|
||||
{
|
||||
previousHash = mkDriverArgs.sha256_64bit;
|
||||
locationAttrpath = "urls.x86_64";
|
||||
unpack = false;
|
||||
}
|
||||
{
|
||||
previousHash = mkDriverArgs.sha256_aarch64;
|
||||
locationAttrpath = "urls.aarch64";
|
||||
unpack = false;
|
||||
}
|
||||
{
|
||||
previousHash = mkDriverArgs.openSha256;
|
||||
locationAttrpath = "open.src.urls";
|
||||
}
|
||||
{
|
||||
previousHash = mkDriverArgs.settingsSha256;
|
||||
locationAttrpath = "settings.src.urls";
|
||||
}
|
||||
{
|
||||
previousHash = mkDriverArgs.persistencedSha256;
|
||||
locationAttrpath = "persistenced.src.urls";
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
});
|
||||
};
|
||||
nixpkgs.config.nvidia.acceptLicense = true;
|
||||
};
|
||||
}
|
44
nixos/modules/polkit/disable-shutdown.nix
Normal file
44
nixos/modules/polkit/disable-shutdown.nix
Normal file
|
@ -0,0 +1,44 @@
|
|||
{
|
||||
config = {
|
||||
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-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;
|
||||
};
|
||||
});
|
||||
'';
|
||||
};
|
||||
}
|
17
nixos/modules/polkit/network.nix
Normal file
17
nixos/modules/polkit/network.nix
Normal file
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
config = {
|
||||
security.polkit.extraConfig = ''
|
||||
polkit.addRule(function(action, subject) {
|
||||
// Allow to start and stop wireguard client services
|
||||
if (
|
||||
action.id == "org.freedesktop.systemd1.manage-units" &&
|
||||
subject.isInGroup("users") &&
|
||||
action.lookup("unit") &&
|
||||
action.lookup("unit").match(/^wg-quick-.*\.service$/)
|
||||
) {
|
||||
return polkit.Result.YES;
|
||||
};
|
||||
});
|
||||
'';
|
||||
};
|
||||
}
|
36
nixos/modules/razer.nix
Normal file
36
nixos/modules/razer.nix
Normal file
|
@ -0,0 +1,36 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
config = {
|
||||
hardware.openrazer = {
|
||||
enable = true;
|
||||
users = [
|
||||
"wroclaw"
|
||||
];
|
||||
# NIXPKGS-PR: 384992
|
||||
packages = let
|
||||
oldVersion = pkgs.python3Packages.openrazer-daemon.version;
|
||||
version = "3.10.1";
|
||||
in lib.mapAttrs (_: package: package.overrideAttrs (oldAttrs: {
|
||||
version = lib.replaceStrings [ oldVersion ] [ version ] oldAttrs.version;
|
||||
src = pkgs.fetchFromGitHub {
|
||||
owner = "openrazer";
|
||||
repo = "openrazer";
|
||||
tag = "v${version}";
|
||||
hash = "sha256-igrGx7Y6ENtZatJCTAW43/0q6ZjljJ9/kU3QFli4yIU=";
|
||||
};
|
||||
})) {
|
||||
kernel = config.boot.kernelPackages.openrazer;
|
||||
daemon = pkgs.python3Packages.openrazer-daemon;
|
||||
};
|
||||
};
|
||||
environment.systemPackages = with pkgs; [
|
||||
polychromatic
|
||||
];
|
||||
};
|
||||
}
|
54
nixos/modules/services/nix-binary-cache.nix
Normal file
54
nixos/modules/services/nix-binary-cache.nix
Normal file
|
@ -0,0 +1,54 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
options = {
|
||||
services.nix-serve = {
|
||||
keyName = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = config.networking.fqdnOrHostName;
|
||||
defaultText = "config.networking.fqdnOrHostName";
|
||||
description = "Name of the key when generating (usually domain name)";
|
||||
};
|
||||
publicKeyFile = lib.mkOption {
|
||||
type = lib.types.path;
|
||||
default = "/var/cache-pub-key.pem";
|
||||
description = "Path to the public key file";
|
||||
};
|
||||
};
|
||||
};
|
||||
config = {
|
||||
services.nix-serve = {
|
||||
enable = true;
|
||||
package = pkgs.nix-serve-ng;
|
||||
secretKeyFile = "/var/cache-priv-key.pem";
|
||||
};
|
||||
systemd.services.nix-serve-generate-key = let
|
||||
inherit (config.services.nix-serve) keyName secretKeyFile publicKeyFile;
|
||||
in {
|
||||
description = "Ensure existence of nix binary cache signing key";
|
||||
wantedBy = [ config.systemd.services.nix-serve.name ];
|
||||
script = ''
|
||||
if [ -f ${secretKeyFile} ]; then
|
||||
echo "File ${secretKeyFile} already exists, nothing to do" >&2
|
||||
exit 0
|
||||
fi
|
||||
if [ -a ${secretKeyFile} ]; then
|
||||
echo "File ${secretKeyFile} is not a regular file" >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "Generating nix binary cache signing key" >&2
|
||||
touch ${secretKeyFile}
|
||||
chmod 600 ${secretKeyFile}
|
||||
mkdir -p $(dirname ${secretKeyFile})
|
||||
${lib.getExe' pkgs.nix "nix-store"} --generate-binary-cache-key \
|
||||
${keyName} ${secretKeyFile} ${publicKeyFile}
|
||||
'';
|
||||
restartIfChanged = true;
|
||||
};
|
||||
};
|
||||
}
|
173
nixos/modules/shell.nix
Normal file
173
nixos/modules/shell.nix
Normal file
|
@ -0,0 +1,173 @@
|
|||
{ config, pkgs, unstablePkgs, lib, ... }:
|
||||
|
||||
let
|
||||
aliasDrag = pkgs.writeScriptBin "drag" ''
|
||||
${pkgs.ripdrag}/bin/ripdrag -Axd $@
|
||||
'';
|
||||
in
|
||||
{
|
||||
imports = [
|
||||
./unstable-packages.nix
|
||||
];
|
||||
|
||||
config = {
|
||||
environment.systemPackages = ( with pkgs; [
|
||||
aliasDrag
|
||||
ranger-git
|
||||
ripgrep
|
||||
kitty
|
||||
zoxide
|
||||
]) ++ [
|
||||
(
|
||||
pkgs.writeScriptBin "nix-convert-hash" ''
|
||||
${lib.getExe' config.nix.package "nix"} --extra-experimental-features "nix-command" hash convert "$@"
|
||||
''
|
||||
)
|
||||
];
|
||||
|
||||
programs.bash.shellInit = ''
|
||||
HISTCONTROL=ignoreboth
|
||||
'';
|
||||
|
||||
programs.bash.interactiveShellInit = ''
|
||||
HISTCONTROL=ignoreboth
|
||||
if test -n "$KITTY_INSTALLATION_DIR"; then
|
||||
export KITTY_SHELL_INTEGRATION="enabled,no-sudo"
|
||||
source "$KITTY_INSTALLATION_DIR/shell-integration/bash/kitty.bash"
|
||||
fi
|
||||
eval "''$(zoxide init bash)"
|
||||
alias bye=exit
|
||||
'';
|
||||
|
||||
environment.etc."xdg/kitty/kitty.conf".text = ''
|
||||
font_family MesloLGS Nerd Font
|
||||
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 ""}
|
||||
background_opacity 0.8
|
||||
dynamic_background_opacity yes
|
||||
|
||||
map kitty_mod+alt+c copy_ansi_to_clipboard
|
||||
'';
|
||||
|
||||
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 ${pkgs.ripdrag}/bin/ripdrag -Axd %p &
|
||||
map <C-d> drag
|
||||
'';
|
||||
|
||||
environment.etc."ranger/plugins/zoxide.py".source = pkgs.fetchFromGitHub {
|
||||
owner = "jchook";
|
||||
repo = "ranger-zoxide";
|
||||
rev = "281828de060299f73fe0b02fcabf4f2f2bd78ab3";
|
||||
hash = "sha256-JEuyYSVa1NS3aftezEJx/k19lwwzf7XhqBCL0jH6VT4=";
|
||||
} + /__init__.py;
|
||||
|
||||
programs.direnv.enable = true;
|
||||
|
||||
programs.neovim = {
|
||||
enable = true;
|
||||
viAlias = true;
|
||||
vimAlias = true;
|
||||
configure = {
|
||||
customRC = ''
|
||||
set number
|
||||
set hlsearch
|
||||
set incsearch
|
||||
set tabstop=4
|
||||
set softtabstop=4
|
||||
set shiftwidth=4
|
||||
set expandtab
|
||||
set autoindent
|
||||
set updatetime=500
|
||||
colorscheme vim
|
||||
|
||||
syntax on
|
||||
set encoding=utf-8
|
||||
set wildmode=longest,list,full
|
||||
set listchars=space:·,tab:┄┄»
|
||||
set indentkeys-=0#
|
||||
|
||||
" rainbow-delimeters-nvim
|
||||
let g:rainbow_delimiters = {
|
||||
\ 'strategy': {
|
||||
\ ${"''"}: rainbow_delimiters#strategy.global,
|
||||
\ },
|
||||
\ }
|
||||
|
||||
" vim-gitguter
|
||||
set signcolumn=yes
|
||||
highlight SignColumn NONE
|
||||
highlight GitGutterAdd ctermfg=2 guifg=#2ea043
|
||||
highlight GitGutterChange ctermfg=4 guifg=#0078d4
|
||||
highlight GitGutterDelete ctermfg=1 guifg=#f85149
|
||||
|
||||
lua require('guess-indent').setup {}
|
||||
'';
|
||||
packages.myVimPackage = with pkgs.vimPlugins; {
|
||||
start = [
|
||||
guess-indent-nvim
|
||||
vim-visual-multi
|
||||
autoclose-nvim
|
||||
rainbow-delimiters-nvim
|
||||
vimagit
|
||||
vim-gitgutter
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
environment.variables = lib.mkIf config.programs.neovim.enable rec {
|
||||
EDITOR = "/run/current-system/sw/bin/nvim";
|
||||
VISUAL = EDITOR;
|
||||
};
|
||||
|
||||
programs.starship = {
|
||||
enable = true;
|
||||
settings = {
|
||||
format = lib.concatStrings [
|
||||
"$all"
|
||||
"\${custom.sshAuthSocket}"
|
||||
"$line_break"
|
||||
"\${custom.ranger}"
|
||||
"$jobs"
|
||||
"$battery"
|
||||
"$time"
|
||||
"$status"
|
||||
"$os"
|
||||
"$container"
|
||||
"$shell"
|
||||
"$character"
|
||||
];
|
||||
directory = {
|
||||
truncation_length = 5;
|
||||
truncation_symbol = "…/";
|
||||
};
|
||||
hostname = {
|
||||
ssh_only = false;
|
||||
};
|
||||
username = {
|
||||
show_always = true;
|
||||
};
|
||||
status.disabled = false;
|
||||
custom.ranger = {
|
||||
when = "test $RANGER_LEVEL";
|
||||
command = "echo \"✦\"";
|
||||
style = "bold 208";
|
||||
};
|
||||
custom.sshAuthSocket = {
|
||||
when = "test -S \"$SSH_AUTH_SOCK\"";
|
||||
command = "echo -e \"SSH Auth Agent\"";
|
||||
style = "124";
|
||||
format = "with [$output]($style) ";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
5
nixos/modules/udev.nix
Normal file
5
nixos/modules/udev.nix
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
config = {
|
||||
hardware.ledger.enable = true;
|
||||
};
|
||||
}
|
26
nixos/modules/unstable-packages.nix
Normal file
26
nixos/modules/unstable-packages.nix
Normal file
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
self,
|
||||
...
|
||||
}:
|
||||
|
||||
let
|
||||
cfg = config.unstable;
|
||||
unstableOverlay = self.overlays.unstableWithMeta;
|
||||
in
|
||||
{
|
||||
options.unstable = {
|
||||
enable = lib.mkEnableOption ''
|
||||
use of unstable packages in configuration. You can use `unstablePkgs` in configuration modules
|
||||
'' // { default = true; };
|
||||
};
|
||||
config = {
|
||||
_module.args.unstablePkgs = if config.unstable.enable then pkgs.unstable else pkgs;
|
||||
nixpkgs.overlays = lib.mkIf cfg.enable [ unstableOverlay ];
|
||||
system.extraSystemBuilderCmds = lib.mkIf config.unstable.enable ''
|
||||
echo ${pkgs.unstableVersion} > $out/nixos-unstable-version
|
||||
'';
|
||||
};
|
||||
}
|
18
nixos/modules/virtualization.nix
Normal file
18
nixos/modules/virtualization.nix
Normal file
|
@ -0,0 +1,18 @@
|
|||
|
||||
{ lib, config, pkgs, ... }:
|
||||
|
||||
{
|
||||
config = {
|
||||
#virtualisation.waydroid.enable = true;
|
||||
programs.virt-manager.enable = true;
|
||||
virtualisation.libvirtd = {
|
||||
enable = true;
|
||||
qemu.ovmf = {
|
||||
enable = true;
|
||||
packages = [
|
||||
pkgs.OVMFFull.fd
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
137
nixos/modules/xdg-default-apps.nix
Normal file
137
nixos/modules/xdg-default-apps.nix
Normal file
|
@ -0,0 +1,137 @@
|
|||
{
|
||||
config = {
|
||||
xdg.mime.enable = true;
|
||||
xdg.mime.defaultApplications = {
|
||||
# Browser
|
||||
"x-scheme-handler/http" = "vivaldi-stable.desktop";
|
||||
"application/xhtml+xml" = "vivaldi-stable.desktop";
|
||||
"text/html" = "vivaldi-stable.desktop";
|
||||
"x-scheme-handler/https" = "vivaldi-stable.desktop";
|
||||
"application/pdf" = "vivaldi-stable.desktop";
|
||||
|
||||
# Audio
|
||||
"audio/aiff" = "mpv.desktop";
|
||||
"audio/basic" = "mpv.desktop";
|
||||
"audio/it" = "mpv.desktop";
|
||||
"audio/make" = "mpv.desktop";
|
||||
"audio/make.my.funk" = "mpv.desktop";
|
||||
"audio/mid" = "mpv.desktop";
|
||||
"audio/midi" = "mpv.desktop";
|
||||
"audio/mod" = "mpv.desktop";
|
||||
"audio/mpeg" = "mpv.desktop";
|
||||
"audio/mpeg3" = "mpv.desktop";
|
||||
"audio/nspaudio" = "mpv.desktop";
|
||||
"audio/s3m" = "mpv.desktop";
|
||||
"audio/tsp-audio" = "mpv.desktop";
|
||||
"audio/tsplayer" = "mpv.desktop";
|
||||
"audio/vnd.qcelp" = "mpv.desktop";
|
||||
"audio/voc" = "mpv.desktop";
|
||||
"audio/voxware" = "mpv.desktop";
|
||||
"audio/wav" = "mpv.desktop";
|
||||
"audio/x-adpcm" = "mpv.desktop";
|
||||
"audio/x-aiff" = "mpv.desktop";
|
||||
"audio/x-au" = "mpv.desktop";
|
||||
"audio/x-gsm" = "mpv.desktop";
|
||||
"audio/x-jam" = "mpv.desktop";
|
||||
"audio/x-liveaudio" = "mpv.desktop";
|
||||
"audio/x-mid" = "mpv.desktop";
|
||||
"audio/x-midi" = "mpv.desktop";
|
||||
"audio/x-mod" = "mpv.desktop";
|
||||
"audio/x-mpeg" = "mpv.desktop";
|
||||
"audio/x-mpeg-3" = "mpv.desktop";
|
||||
"audio/x-mpequrl" = "mpv.desktop";
|
||||
"audio/x-nspaudio" = "mpv.desktop";
|
||||
"audio/x-pn-realaudio" = "mpv.desktop";
|
||||
"audio/x-pn-realaudio-plugin" = "mpv.desktop";
|
||||
"audio/x-psid" = "mpv.desktop";
|
||||
"audio/x-realaudio" = "mpv.desktop";
|
||||
"audio/x-twinvq" = "mpv.desktop";
|
||||
"audio/x-twinvq-plugin" = "mpv.desktop";
|
||||
"audio/x-vnd.audioexplosion.mjuicemediafile" = "mpv.desktop";
|
||||
"audio/x-voc" = "mpv.desktop";
|
||||
"audio/x-wav" = "mpv.desktop";
|
||||
"audio/xm" = "mpv.desktop";
|
||||
|
||||
# Video
|
||||
"video/animaflex" = "mpv.desktop";
|
||||
"video/avi" = "mpv.desktop";
|
||||
"video/avs-video" = "mpv.desktop";
|
||||
"video/dl" = "mpv.desktop";
|
||||
"video/fli" = "mpv.desktop";
|
||||
"video/gl" = "mpv.desktop";
|
||||
"video/mpeg" = "mpv.desktop";
|
||||
"video/msvideo" = "mpv.desktop";
|
||||
"video/quicktime" = "mpv.desktop";
|
||||
"video/vdo" = "mpv.desktop";
|
||||
"video/vivo" = "mpv.desktop";
|
||||
"video/vnd.rn-realvideo" = "mpv.desktop";
|
||||
"video/vnd.vivo" = "mpv.desktop";
|
||||
"video/vosaic" = "mpv.desktop";
|
||||
"video/x-amt-demorun" = "mpv.desktop";
|
||||
"video/x-amt-showrun" = "mpv.desktop";
|
||||
"video/x-atomic3d-feature" = "mpv.desktop";
|
||||
"video/x-dl" = "mpv.desktop";
|
||||
"video/x-dv" = "mpv.desktop";
|
||||
"video/x-fli" = "mpv.desktop";
|
||||
"video/x-gl" = "mpv.desktop";
|
||||
"video/x-isvideo" = "mpv.desktop";
|
||||
"video/x-motion-jpeg" = "mpv.desktop";
|
||||
"video/x-mpeg" = "mpv.desktop";
|
||||
"video/x-mpeq2a" = "mpv.desktop";
|
||||
"video/x-ms-asf" = "mpv.desktop";
|
||||
"video/x-ms-asf-plugin" = "mpv.desktop";
|
||||
"video/x-msvideo" = "mpv.desktop";
|
||||
"video/x-qtc" = "mpv.desktop";
|
||||
"video/x-scm" = "mpv.desktop";
|
||||
"video/x-sgi-movie" = "mpv.desktop";
|
||||
|
||||
# Image
|
||||
"image/bmp" = "qimgv.desktop";
|
||||
"image/cmu-raster" = "qimgv.desktop";
|
||||
"image/fif" = "qimgv.desktop";
|
||||
"image/florian" = "qimgv.desktop";
|
||||
"image/g3fax" = "qimgv.desktop";
|
||||
"image/gif" = "qimgv.desktop";
|
||||
"image/ief" = "qimgv.desktop";
|
||||
"image/jpeg" = "qimgv.desktop";
|
||||
"image/jutvision" = "qimgv.desktop";
|
||||
"image/naplps" = "qimgv.desktop";
|
||||
"image/pict" = "qimgv.desktop";
|
||||
"image/pjpeg" = "qimgv.desktop";
|
||||
"image/png" = "qimgv.desktop";
|
||||
"image/tiff" = "qimgv.desktop";
|
||||
"image/vasa" = "qimgv.desktop";
|
||||
"image/vnd.dwg" = "qimgv.desktop";
|
||||
"image/vnd.fpx" = "qimgv.desktop";
|
||||
"image/vnd.net-fpx" = "qimgv.desktop";
|
||||
"image/vnd.rn-realflash" = "qimgv.desktop";
|
||||
"image/vnd.rn-realpix" = "qimgv.desktop";
|
||||
"image/vnd.wap.wbmp" = "qimgv.desktop";
|
||||
"image/vnd.xiff" = "qimgv.desktop";
|
||||
"image/x-cmu-raster" = "qimgv.desktop";
|
||||
"image/x-dwg" = "qimgv.desktop";
|
||||
"image/x-icon" = "qimgv.desktop";
|
||||
"image/x-jg" = "qimgv.desktop";
|
||||
"image/x-jps" = "qimgv.desktop";
|
||||
"image/x-niff" = "qimgv.desktop";
|
||||
"image/x-pcx" = "qimgv.desktop";
|
||||
"image/x-pict" = "qimgv.desktop";
|
||||
"image/x-portable-anymap" = "qimgv.desktop";
|
||||
"image/x-portable-bitmap" = "qimgv.desktop";
|
||||
"image/x-portable-graymap" = "qimgv.desktop";
|
||||
"image/x-portable-greymap" = "qimgv.desktop";
|
||||
"image/x-portable-pixmap" = "qimgv.desktop";
|
||||
"image/x-quicktime" = "qimgv.desktop";
|
||||
"image/x-rgb" = "qimgv.desktop";
|
||||
"image/x-tiff" = "qimgv.desktop";
|
||||
"image/x-windows-bmp" = "qimgv.desktop";
|
||||
"image/x-xbitmap" = "qimgv.desktop";
|
||||
"image/x-xbm" = "qimgv.desktop";
|
||||
"image/x-xpixmap" = "qimgv.desktop";
|
||||
"image/x-xwd" = "qimgv.desktop";
|
||||
"image/x-xwindowdump" = "qimgv.desktop";
|
||||
"image/xbm" = "qimgv.desktop";
|
||||
"image/xpm" = "qimgv.desktop";
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue