move home-manager components to their own sections; create new systemd service to sync rclone

This commit is contained in:
2024-12-27 15:35:18 +00:00
parent 5901535d77
commit 2c947ed70c
8 changed files with 273 additions and 214 deletions

View File

@@ -181,8 +181,8 @@
# services.openssh.enable = true; # services.openssh.enable = true;
# Open ports in the firewall. # Open ports in the firewall.
# networking.firewall.allowedTCPPorts = [ ... ]; networking.firewall.allowedTCPPorts = [ ];
# networking.firewall.allowedUDPPorts = [ ... ]; networking.firewall.allowedUDPPorts = [ ];
# Or disable the firewall altogether. # Or disable the firewall altogether.
# networking.firewall.enable = false; # networking.firewall.enable = false;

24
flake.lock generated
View File

@@ -7,11 +7,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1734343412, "lastModified": 1735048446,
"narHash": "sha256-b7G8oFp0Nj01BYUJ6ENC9Qf/HsYAIZvN9k/p0Kg/PFU=", "narHash": "sha256-Tc35Y8H+krA6rZeOIczsaGAtobSSBPqR32AfNTeHDRc=",
"owner": "nix-community", "owner": "nix-community",
"repo": "disko", "repo": "disko",
"rev": "a08bfe06b39e94eec98dd089a2c1b18af01fef19", "rev": "3a4de9fa3a78ba7b7170dda6bd8b4cdab87c0b21",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -61,11 +61,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1734344598, "lastModified": 1735053786,
"narHash": "sha256-wNX3hsScqDdqKWOO87wETUEi7a/QlPVgpC/Lh5rFOuA=", "narHash": "sha256-Gm+0DcbUS338vvkwyYWms5jsWlx8z8MeQBzcnIDuIkw=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "83ecd50915a09dca928971139d3a102377a8d242", "rev": "35b98d20ca8f4ca1f6a2c30b8a2c8bb305a36d84",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -81,11 +81,11 @@
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs"
}, },
"locked": { "locked": {
"lastModified": 1734400565, "lastModified": 1735177600,
"narHash": "sha256-vfyvUlF1wVVXy/Au3fQpa8NMQbocg/oTgNuPS7MoesA=", "narHash": "sha256-I51oo2juXWvbBHBwuisXlDelwPzSBghDc3hI/feRDk0=",
"owner": "nix-community", "owner": "nix-community",
"repo": "nix-vscode-extensions", "repo": "nix-vscode-extensions",
"rev": "c2efba4b42988d8573f914cad6431b5bd614935d", "rev": "abc6bc047bffc62632c043708ee23091bc500611",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -112,11 +112,11 @@
}, },
"nixpkgs_2": { "nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1734119587, "lastModified": 1734649271,
"narHash": "sha256-AKU6qqskl0yf2+JdRdD0cfxX4b9x3KKV5RqA6wijmPM=", "narHash": "sha256-4EVBRhOjMDuGtMaofAIqzJbg4Ql7Ai0PSeuVZTHjyKQ=",
"owner": "nixos", "owner": "nixos",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "3566ab7246670a43abd2ffa913cc62dad9cdf7d5", "rev": "d70bd19e0a38ad4790d3913bf08fcbfc9eeca507",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@@ -0,0 +1,20 @@
{ inputs, config, pkgs, ... }:
{
programs = {
firefox = {
enable = true;
languagePacks = [
"en-GB"
];
policies = {
"DisplayMenuBar" = true;
};
profiles.default = import ./firefox-profile.nix // {
id = 0;
name = "default";
isDefault = true;
};
};
};
}

119
home-manager/terminal.nix Normal file
View File

@@ -0,0 +1,119 @@
{ lib, inputs, config, pkgs, ... }:
with lib;
let
cfg = config.programs.atuin;
in
{
options.terminal = {
nixUpdateLocation = mkOption {
type = types.str;
};
flakeUpdateLocation = mkOption {
type = types.str;
};
};
config = {
home.packages = with pkgs;[
blesh
nerd-fonts.space-mono
];
programs = {
bash = {
enable = true;
bashrcExtra = ''
source $(blesh-share)/ble.sh
bleopt canvas_winch_action=redraw-prev
'';
};
starship.enable = true;
atuin.enable = true;
zellij = {
enable = true;
enableBashIntegration = true;
settings = {
theme = "dracula";
};
};
direnv = {
enable = true;
enableBashIntegration = true;
nix-direnv.enable = true;
};
git = {
enable = true;
delta.enable = true;
};
gitui = {
enable = true;
};
helix.enable = true;
bat = {
enable = true;
};
eza = {
enable = true;
enableBashIntegration = true;
git = true;
extraOptions = [
"--color=auto"
"--icons=always"
"--group-directories-first"
"--header"
];
};
bottom = {
enable = true;
};
fd = {
enable = true;
};
ripgrep = {
enable = true;
};
topgrade = {
enable = true;
settings = {
misc = {
assume_yes = true;
};
linux = {
nix_arguments = "--flake ${config.terminal.nixUpdateLocation}";
};
pre_commands = {
nix-flake-update = "sudo nix flake update --flake ${config.terminal.flakeUpdateLocation}";
};
};
};
alacritty = {
enable = true;
settings = {
font = {
normal = {
family = "SpaceMono Nerd Font";
style = "Regular";
};
size = 14;
};
};
};
};
};
}

45
home-manager/vscode.nix Normal file
View File

@@ -0,0 +1,45 @@
{ inputs, config, pkgs, ... }:
let
vs-extensions = inputs.nix-vscode-extensions.extensions.x86_64-linux.open-vsx;
in
{
home.packages = with pkgs;[
nerd-fonts.space-mono
];
programs = {
vscode = {
enable = true;
package = pkgs.vscodium;
mutableExtensionsDir = false;
extensions = [
vs-extensions.biomejs.biome
vs-extensions.mkhl.direnv
vs-extensions.dracula-theme.theme-dracula
vs-extensions.dbaeumer.vscode-eslint
vs-extensions.eamodio.gitlens
vs-extensions.pkief.material-icon-theme
vs-extensions.jnoortheen.nix-ide
vs-extensions.esbenp.prettier-vscode
vs-extensions.bradlc.vscode-tailwindcss
];
userSettings = {
"workbench.iconTheme" = "material-icon-theme";
"window.titleBarStyle" = "custom";
"workbench.colorTheme" = "Dracula Theme";
"editor.fontFamily" = "'SpaceMono Nerd Font', 'monospace', monospace";
"editor.fontSize" = 16;
"files.autoSave" = "onWindowChange";
"editor.formatOnSave" = true;
"editor.codeActionsOnSave" = {
"source.organizeImports" = "always";
};
"typescript.preferences.preferTypeOnlyAutoImports" = true;
};
};
};
}

View File

@@ -45,35 +45,10 @@
}; };
}; };
# [Unit] # Open ports in the firewall.
# Description=Systemd unit to watch a folder for new files # 443 Helldivers crashes internet otherwise
# 1900 UPNP discovery
# [Path] # 5001 Universal Media Server
# PathChanged=/path/to/folder/you/want/to/monitor/ networking.firewall.allowedTCPPorts = [ 443 1900 5001 ];
networking.firewall.allowedUDPPorts = [ 443 1900 ];
# [Install]
# WantedBy=multi-user.target
# systemd.user.paths.rclone-media = {
# enable = true;
# description = "rclone unit path for /mnt/HDD1/Videos/";
# after = [ "network.target" "mnt-HDD1.mount" ];
# wantedBy = [ "default.target" ];
# pathConfig = {
# PathChanged = "/mnt/HDD1/Videos/";
# };
# };
# systemd.user.services.rclone-media = {
# description = "rclone unit service for /mnt/HDD1/Videos/";
# serviceConfig = {
# Type = "oneshot";
# };
# path = [ pkgs.libnotify pkgs.rclone ];
# script = ''
# notify-send -a "rclone-media" "rclone for /mnt/HDD1/Videos/ triggered"
# rclone copy --max-age 24h --no-traverse "/mnt/HDD1/Videos/" media:"media-7gM2gcrxRjXqfj" -P --dry-run
# notify-send -a "rclone-media" "rclone for /mnt/HDD1/Videos/ complete"
# '';
# };
} }

View File

@@ -1,9 +1,15 @@
{ inputs, config, pkgs, ... }: { inputs, config, pkgs, ... }:
let
vs-extensions = inputs.nix-vscode-extensions.extensions.x86_64-linux.open-vsx;
in
{ {
imports = [
../../home-manager/terminal.nix
../../home-manager/firefox/firefox.nix
../../home-manager/vscode.nix
];
terminal.nixUpdateLocation = "/home/worble/Projects/nixos#tuxedo";
terminal.flakeUpdateLocation = "/home/worble/Projects/nixos";
# Home Manager needs a bit of information about you and the paths it should # Home Manager needs a bit of information about you and the paths it should
# manage. # manage.
home.username = "worble"; home.username = "worble";
@@ -37,7 +43,6 @@ in
# (pkgs.writeShellScriptBin "my-hello" '' # (pkgs.writeShellScriptBin "my-hello" ''
# echo "Hello, ${config.home.username}!" # echo "Hello, ${config.home.username}!"
# '') # '')
blesh
nextcloud-client nextcloud-client
ubuntu-sans ubuntu-sans
ubuntu-sans-mono ubuntu-sans-mono
@@ -52,7 +57,10 @@ in
thunderbird thunderbird
git-credential-manager git-credential-manager
# dotnetCorePackages.sdk_8_0_4xx # dotnetCorePackages.sdk_8_0_4xx
dotnetCorePackages.dotnet_9.sdk (with dotnetCorePackages; combinePackages [
sdk_8_0
sdk_9_0
])
gimp-with-plugins gimp-with-plugins
ffmpeg-full ffmpeg-full
protonup-qt protonup-qt
@@ -69,6 +77,8 @@ in
jellyfin-media-player jellyfin-media-player
haruna haruna
azuredatastudio azuredatastudio
inotify-tools
libnotify
]; ];
fonts.fontconfig = { fonts.fontconfig = {
@@ -119,45 +129,8 @@ in
programs = { programs = {
home-manager.enable = true; home-manager.enable = true;
bat = {
enable = true;
};
eza = {
enable = true;
enableBashIntegration = true;
git = true;
extraOptions = [
"--color=auto"
"--icons=always"
"--group-directories-first"
"--header"
];
};
git = {
enable = true;
delta.enable = true;
};
gitui = {
enable = true;
};
firefox = { firefox = {
enable = true; profiles.work = import ../../home-manager/firefox/firefox-profile.nix // {
languagePacks = [
"en-GB"
];
policies = {
"DisplayMenuBar" = true;
};
profiles.default = import ./firefox-profile.nix // {
id = 0;
name = "default";
isDefault = true;
};
profiles.work = import ./firefox-profile.nix // {
id = 1; id = 1;
name = "work"; name = "work";
isDefault = false; isDefault = false;
@@ -175,95 +148,6 @@ in
package = pkgs.brave; package = pkgs.brave;
}; };
bash = {
enable = true;
bashrcExtra = ''
source $(blesh-share)/ble.sh
bleopt canvas_winch_action=redraw-prev
'';
};
starship.enable = true;
atuin.enable = true;
zellij = {
enable = true;
enableBashIntegration = true;
settings = {
theme = "dracula";
};
};
helix.enable = true;
alacritty = {
enable = true;
settings = {
font = {
normal = {
family = "SpaceMono Nerd Font";
style = "Regular";
};
size = 14;
};
};
};
direnv = {
enable = true;
enableBashIntegration = true;
nix-direnv.enable = true;
};
vscode = {
enable = true;
package = pkgs.vscodium;
mutableExtensionsDir = false;
extensions = [
vs-extensions.biomejs.biome
vs-extensions.mkhl.direnv
vs-extensions.dracula-theme.theme-dracula
vs-extensions.dbaeumer.vscode-eslint
vs-extensions.eamodio.gitlens
vs-extensions.pkief.material-icon-theme
vs-extensions.jnoortheen.nix-ide
vs-extensions.esbenp.prettier-vscode
vs-extensions.bradlc.vscode-tailwindcss
];
userSettings = {
"workbench.iconTheme" = "material-icon-theme";
"window.titleBarStyle" = "custom";
"workbench.colorTheme" = "Dracula Theme";
"editor.fontFamily" = "'SpaceMono Nerd Font', 'monospace', monospace";
"editor.fontSize" = 16;
"files.autoSave" = "onWindowChange";
"editor.formatOnSave" = true;
"editor.codeActionsOnSave" = {
"source.organizeImports" = "always";
};
"typescript.preferences.preferTypeOnlyAutoImports" = true;
};
};
topgrade = {
enable = true;
settings = {
misc = {
assume_yes = true;
};
linux = {
nix_arguments = "--flake /home/worble/Projects/nixos#tuxedo";
};
pre_commands = {
nix-flake-update = "sudo nix flake update --flake /home/worble/Projects/nixos";
};
};
};
# install the shaders from anime4k directory for this to work # install the shaders from anime4k directory for this to work
mpv = { mpv = {
enable = true; enable = true;
@@ -272,7 +156,7 @@ in
vo = "gpu-next"; vo = "gpu-next";
gpu-api = "vulkan"; gpu-api = "vulkan";
hwdec = "vulkan"; hwdec = "vulkan";
screenshot-directory = "/mnt/HDD1/Pictures/"; screenshot-directory = "~/Pictures/";
screenshot-template = "%F/%F_snapshot_%P"; screenshot-template = "%F/%F_snapshot_%P";
glsl-shaders = "~~/shaders/Anime4K_Clamp_Highlights.glsl:~~/shaders/Anime4K_Restore_CNN_VL.glsl:~~/shaders/Anime4K_Upscale_CNN_x2_VL.glsl:~~/shaders/Anime4K_AutoDownscalePre_x2.glsl:~~/shaders/Anime4K_AutoDownscalePre_x4.glsl:~~/shaders/Anime4K_Upscale_CNN_x2_M.glsl"; glsl-shaders = "~~/shaders/Anime4K_Clamp_Highlights.glsl:~~/shaders/Anime4K_Restore_CNN_VL.glsl:~~/shaders/Anime4K_Upscale_CNN_x2_VL.glsl:~~/shaders/Anime4K_AutoDownscalePre_x2.glsl:~~/shaders/Anime4K_AutoDownscalePre_x4.glsl:~~/shaders/Anime4K_Upscale_CNN_x2_M.glsl";
}; };
@@ -287,7 +171,7 @@ in
}; };
}; };
# systemd.user = { systemd.user = {
# enable = true; # enable = true;
# paths = { # paths = {
# rclone-media = { # rclone-media = {
@@ -305,27 +189,43 @@ in
# }; # };
# }; # };
# }; # };
# services = { services = {
# rclone-media = { rclone-media = {
# Unit = { Unit = {
# Description = "rclone unit service for /mnt/HDD1/Videos/"; Description = "rclone-media /mnt/HDD1/Videos/";
# }; After = [ "network.target" "mnt-HDD1.mount" ];
};
# Service = { Install = {
# Type = "oneshot"; WantedBy = [ "default.target" ];
# ExecStart = "${pkgs.writeShellApplication { };
# name = "rclone-media";
# runtimeInputs = [ pkgs.libnotify pkgs.rclone ]; Service = {
# text = '' Type = "exec";
# notify-send -a "rclone-media" "rclone for /mnt/HDD1/Videos/ triggered" ExecStart = "${pkgs.writeShellApplication {
# rclone copy --max-age 24h --no-traverse "/mnt/HDD1/Videos/" media:"media-7gM2gcrxRjXqfj" -P --dry-run name = "rclone-media";
# notify-send -a "rclone-media" "rclone for /mnt/HDD1/Videos/ complete" runtimeInputs = [ pkgs.inotify-tools pkgs.libnotify pkgs.rclone ];
# ''; text = ''
# }}/bin/rclone-media"; inotifywait -mr \
# }; --format '%w%f' \
# }; -e close_write \
# }; /mnt/HDD1/Videos/ |
# }; while read -r file; do
changed_rel=''${file#"/mnt/HDD1/Videos"}
notify-send -a "rclone-media" "rclone for $file triggered"
if rclone copyto "$file" media:"media-7gM2gcrxRjXqfj$changed_rel" ; then
notify-send -a "rclone-media" "rclone for $file complete"
else
notify-send -a "rclone-media" "rclone for $file failed"
fi
done
'';
}}/bin/rclone-media";
};
};
};
};
} }