diff --git a/flake-old.nix b/flake-old.nix deleted file mode 100644 index 4865558..0000000 --- a/flake-old.nix +++ /dev/null @@ -1,264 +0,0 @@ -{ - description = "Nixos config flake"; - - inputs = { - nixpkgs.url = "github:nixos/nixpkgs/nixos-25.11"; - nixpkgs-unstable.url = "github:nixos/nixpkgs/nixos-unstable"; - nixos-hardware.url = "github:NixOS/nixos-hardware/master"; - home-manager = { - url = "github:nix-community/home-manager/release-25.11"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - sops-nix = { - url = "github:Mic92/sops-nix"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - disko.url = "github:nix-community/disko"; - disko.inputs.nixpkgs.follows = "nixpkgs"; - plasma-manager = { - url = "github:pjones/plasma-manager"; - inputs.nixpkgs.follows = "nixpkgs"; - inputs.home-manager.follows = "home-manager"; - }; - firefox-addons = { - url = "gitlab:rycee/nur-expressions?dir=pkgs/firefox-addons"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - hyprland = { - url = "github:hyprwm/Hyprland"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - hyprland-plugins = { - url = "github:hyprwm/hyprland-plugins"; - inputs.hyprland.follows = "hyprland"; - }; - nixos-cosmic = { - url = "github:lilyinstarlight/nixos-cosmic"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - dzgui-nix = { - url = "github:lelgenio/dzgui-nix"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - audio = { - url = "github:polygon/audio.nix"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - nix-minecraft.url = "github:Infinidoge/nix-minecraft"; - nix-minecraft.inputs.nixpkgs.follows = "nixpkgs"; - }; - - outputs = { - self, - nixpkgs, - nixpkgs-unstable, - nixos-hardware, - home-manager, - nixos-cosmic, - audio, - ... - } @ inputs: let - system = "x86_64-linux"; - overlay-unstable = final: prev: { - unstable = import nixpkgs-unstable { - system = prev.system; - config.allowUnfree = true; - }; - }; - in { - nixosConfigurations = { - comfy-station = nixpkgs.lib.nixosSystem { - inherit system; - specialArgs = { - inherit inputs; - isHM = false; - }; - modules = [ - ({...}: {nixpkgs.overlays = [overlay-unstable self.overlays.default audio.overlays.default];}) - ({...}: {nixpkgs.config.allowUnfree = true;}) - nixos-hardware.nixosModules.msi-b550-a-pro - inputs.sops-nix.nixosModules.sops - inputs.nix-minecraft.overlay - inputs.nix-minecraft.nixosModules.minecraft-servers - ./modules - ./hosts/comfy-station/configuration.nix - ]; - }; - monolith = nixpkgs.lib.nixosSystem { - inherit system; - specialArgs = { - inherit inputs; - isHM = false; - }; - modules = [ - ({...}: { - nixpkgs.overlays = [ - overlay-unstable - self.overlays.default - audio.overlays.default - inputs.nix-minecraft.overlay - ]; - }) - ({...}: { - nixpkgs.config.allowUnfree = true; - nixpkgs.config.nvidia.acceptLicense = true; - }) - { - nix.settings = { - substituters = ["https://cosmic.cachix.org/"]; - trusted-public-keys = ["cosmic.cachix.org-1:Dya9IyXD4xdBehWjrkPv6rtxpmMdRel02smYzA85dPE="]; - }; - } - nixos-hardware.nixosModules.lenovo-thinkpad-t14-amd-gen1 - inputs.sops-nix.nixosModules.sops - nixos-cosmic.nixosModules.default - inputs.nix-minecraft.nixosModules.minecraft-servers - ./fixes/plasma-fix.nix - ./modules - ./hosts/monolith/configuration.nix - ]; - }; - harbor = nixpkgs.lib.nixosSystem { - inherit system; - specialArgs = { - inherit inputs; - isHM = false; - }; - modules = [ - ({...}: { - nixpkgs.overlays = [ - overlay-unstable - self.overlays.default - audio.overlays.default - inputs.nix-minecraft.overlay - ]; - }) - ({...}: {nixpkgs.config.allowUnfree = true;}) - inputs.sops-nix.nixosModules.sops - inputs.disko.nixosModules.disko - inputs.nix-minecraft.nixosModules.minecraft-servers - ./modules - ./hosts/harbor/configuration.nix - ]; - }; - vm = nixpkgs.lib.nixosSystem { - inherit system; - specialArgs = { - inherit inputs; - }; - modules = [ - ./hosts/vm/configuration.nix - ]; - }; - }; - homeConfigurations."jonas@comfy-station" = home-manager.lib.homeManagerConfiguration { - pkgs = nixpkgs.legacyPackages.${system}; - - # Specify your home configuration modules here, for example, - # the path to your home.nix. - modules = [ - ({...}: {nixpkgs.overlays = [overlay-unstable self.overlays.default audio.overlays.default];}) - ({...}: {nixpkgs.config.allowUnfree = true;}) - inputs.plasma-manager.homeManagerModules.plasma-manager - inputs.sops-nix.homeManagerModules.sops - ./modules - (./home + "/jonas@comfy-station.nix") - ]; - - # Optionally use extraSpecialArgs - # to pass through arguments to home.nix - extraSpecialArgs = { - inherit inputs; - isHM = true; - }; - }; - homeConfigurations."jonas@harbor" = home-manager.lib.homeManagerConfiguration { - pkgs = nixpkgs.legacyPackages.${system}; - - # Specify your home configuration modules here, for example, - # the path to your home.nix. - modules = [ - ({...}: {nixpkgs.overlays = [overlay-unstable self.overlays.default audio.overlays.default];}) - ({...}: {nixpkgs.config.allowUnfree = true;}) - inputs.plasma-manager.homeManagerModules.plasma-manager - inputs.sops-nix.homeManagerModules.sops - ./modules - (./home + "/jonas@harbor.nix") - ]; - - # Optionally use extraSpecialArgs - # to pass through arguments to home.nix - extraSpecialArgs = { - inherit inputs; - isHM = true; - }; - }; - homeConfigurations."jonas@monolith" = home-manager.lib.homeManagerConfiguration { - pkgs = nixpkgs.legacyPackages.${system}; - - # Specify your home configuration modules here, for example, - # the path to your home.nix. - modules = [ - ({...}: {nixpkgs.overlays = [overlay-unstable self.overlays.default audio.overlays.default];}) - ({...}: {nixpkgs.config.allowUnfree = true;}) - inputs.plasma-manager.homeManagerModules.plasma-manager - inputs.sops-nix.homeManagerModules.sops - ./modules - (./home + "/jonas@monolith.nix") - ]; - - # Optionally use extraSpecialArgs - # to pass through arguments to home.nix - extraSpecialArgs = { - inherit inputs; - isHM = true; - }; - }; - homeConfigurations."admin-jroeger" = home-manager.lib.homeManagerConfiguration { - pkgs = nixpkgs.legacyPackages.${system}; - - # Specify your home configuration modules here, for example, - # the path to your home.nix. - modules = [ - ({...}: {nixpkgs.overlays = [overlay-unstable self.overlays.default audio.overlays.default];}) - ({...}: {nixpkgs.config.allowUnfree = true;}) - inputs.plasma-manager.homeManagerModules.plasma-manager - inputs.sops-nix.homeManagerModules.sops - ./modules - ./home/admin-jroeger.nix - ]; - - # Optionally use extraSpecialArgs - # to pass through arguments to home.nix - extraSpecialArgs = { - inherit inputs; - isHM = true; - }; - }; - - devShells.${system} = { - bulk-transcode = (import ./pkgs/bulk-transcode/shell.nix) {pkgs = nixpkgs.legacyPackages.${system};}; - spotify-shortcuts = (import ./pkgs/spotify-shortcuts/shell.nix) {pkgs = nixpkgs.legacyPackages.${system};}; - }; - - overlays.default = import ./pkgs; - - templates = { - rust = { - path = ./templates/rust; - description = "A simple rust binary template"; - welcomeText = '' - # Rust template - This is a simple rust binary template. - To build the project run `cargo build`. - To run the project run `cargo run`. - Before running nix build, make sure to run `cargo generate-lockfile` first. - ''; - }; - cmake-c = { - path = ./templates/cmake-c; - description = "A simple cmake c project."; - }; - }; - }; -} diff --git a/flake.lock b/flake.lock index 9ed091a..8b92cc9 100644 --- a/flake.lock +++ b/flake.lock @@ -1,27 +1,5 @@ { "nodes": { - "audio": { - "inputs": { - "mucap": "mucap", - "nix-buildproxy": "nix-buildproxy", - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1773237019, - "narHash": "sha256-86wsDo6d4+pyETbjHTwTQ9w7YYGAuq7SVaN7BzH992w=", - "owner": "polygon", - "repo": "audio.nix", - "rev": "0c1b594b941dd46b29da107f03dfc91b34d820dd", - "type": "github" - }, - "original": { - "owner": "polygon", - "repo": "audio.nix", - "type": "github" - } - }, "disko": { "inputs": { "nixpkgs": [ @@ -62,30 +40,6 @@ "type": "github" } }, - "fenix": { - "inputs": { - "nixpkgs": [ - "audio", - "mucap", - "naersk", - "nixpkgs" - ], - "rust-analyzer-src": "rust-analyzer-src" - }, - "locked": { - "lastModified": 1752475459, - "narHash": "sha256-z6QEu4ZFuHiqdOPbYss4/Q8B0BFhacR8ts6jO/F/aOU=", - "owner": "nix-community", - "repo": "fenix", - "rev": "bf0d6f70f4c9a9cf8845f992105652173f4b617f", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "fenix", - "type": "github" - } - }, "firefox-addons": { "inputs": { "nixpkgs": [ @@ -178,74 +132,6 @@ "type": "github" } }, - "mucap": { - "inputs": { - "naersk": "naersk", - "nixpkgs": [ - "audio", - "nixpkgs" - ], - "rust-overlay": "rust-overlay" - }, - "locked": { - "lastModified": 1765670987, - "narHash": "sha256-LqcywUPXsQMrcl4zakVYHotLGfq2rzASMYuHrQp3KaY=", - "owner": "polygon", - "repo": "mucap", - "rev": "f798f8c4757e0dc80de5c1ddcb8be14aac916b99", - "type": "github" - }, - "original": { - "owner": "polygon", - "repo": "mucap", - "type": "github" - } - }, - "naersk": { - "inputs": { - "fenix": "fenix", - "nixpkgs": [ - "audio", - "mucap", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1763384566, - "narHash": "sha256-r+wgI+WvNaSdxQmqaM58lVNvJYJ16zoq+tKN20cLst4=", - "owner": "nix-community", - "repo": "naersk", - "rev": "d4155d6ebb70fbe2314959842f744aa7cabbbf6a", - "type": "github" - }, - "original": { - "owner": "nix-community", - "repo": "naersk", - "type": "github" - } - }, - "nix-buildproxy": { - "inputs": { - "nixpkgs": [ - "audio", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1708455753, - "narHash": "sha256-qP79WfPiTl92KrZkmvacba9Xas4WwSFln5DjkP2Q/Lg=", - "owner": "polygon", - "repo": "nix-buildproxy", - "rev": "77d486cb4b0458cb4c4a296c3140f7a6c36ab3e6", - "type": "github" - }, - "original": { - "owner": "polygon", - "ref": "v0.1.0", - "repo": "nix-buildproxy", - "type": "github" - } - }, "nix-minecraft": { "inputs": { "flake-compat": "flake-compat", @@ -333,7 +219,6 @@ }, "root": { "inputs": { - "audio": "audio", "disko": "disko", "dzgui-nix": "dzgui-nix", "firefox-addons": "firefox-addons", @@ -347,45 +232,6 @@ "sops-nix": "sops-nix" } }, - "rust-analyzer-src": { - "flake": false, - "locked": { - "lastModified": 1752428706, - "narHash": "sha256-EJcdxw3aXfP8Ex1Nm3s0awyH9egQvB2Gu+QEnJn2Sfg=", - "owner": "rust-lang", - "repo": "rust-analyzer", - "rev": "591e3b7624be97e4443ea7b5542c191311aa141d", - "type": "github" - }, - "original": { - "owner": "rust-lang", - "ref": "nightly", - "repo": "rust-analyzer", - "type": "github" - } - }, - "rust-overlay": { - "inputs": { - "nixpkgs": [ - "audio", - "mucap", - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1762655942, - "narHash": "sha256-hOM12KcQNQALrhB9w6KJmV5hPpm3GA763HRe9o7JUiI=", - "owner": "oxalica", - "repo": "rust-overlay", - "rev": "6ac961b02d4235572692241e333d0470637f5492", - "type": "github" - }, - "original": { - "owner": "oxalica", - "repo": "rust-overlay", - "type": "github" - } - }, "sops-nix": { "inputs": { "nixpkgs": [ diff --git a/flake.nix b/flake.nix index ddbe2ab..96095cc 100644 --- a/flake.nix +++ b/flake.nix @@ -25,10 +25,6 @@ url = "github:lelgenio/dzgui-nix"; inputs.nixpkgs.follows = "nixpkgs"; }; - audio = { - url = "github:polygon/audio.nix"; - inputs.nixpkgs.follows = "nixpkgs"; - }; nix-minecraft.url = "github:Infinidoge/nix-minecraft"; nix-minecraft.inputs.nixpkgs.follows = "nixpkgs"; }; @@ -48,6 +44,7 @@ (./home + "/jonas@comfy-station") (./home + "/jonas@monolith") (./home + "/jonas@harbor") + (./home + "/admin-jroeger") (import-tree ./modules) (import-tree ./templates) ]; diff --git a/old/home/admin-jroeger.nix b/home/admin-jroeger/configuration.nix similarity index 89% rename from old/home/admin-jroeger.nix rename to home/admin-jroeger/configuration.nix index 6dc6d51..18232ae 100644 --- a/old/home/admin-jroeger.nix +++ b/home/admin-jroeger/configuration.nix @@ -5,12 +5,7 @@ home.homeDirectory = "/home/admin-jroeger"; # hive modules - hive.kitty.enable = true; - hive.ranger.enable = true; - hive.yubikey.enable = true; hive.yubikey.pinentry = "gnome3"; - hive.nix-scripts.enable = true; - hive.zsh.enable = true; hive.doom.enable = true; hive.doom.asDefaultEditor = true; hive.doom.enableCopilot = true; @@ -18,7 +13,6 @@ hive.doom.withShellPkgs = true; hive.doom.withCXXPkgs = true; hive.doom.withPythonPkgs = true; - hive.jj.enable = true; # This value determines the Home Manager release that your configuration is # compatible with. This helps avoid breakage when a new Home Manager release diff --git a/home/admin-jroeger/default.nix b/home/admin-jroeger/default.nix new file mode 100644 index 0000000..273f1db --- /dev/null +++ b/home/admin-jroeger/default.nix @@ -0,0 +1,21 @@ +{ + self, + inputs, + ... +}: { + flake.homeConfigurations."admin-jroeger" = inputs.home-manager.lib.homeManagerConfiguration { + pkgs = import inputs.nixpkgs {system = "x86_64-linux";}; + modules = [ + ({...}: {nixpkgs.config.allowUnfree = true;}) + + ./configuration.nix + + self.homeModules.ranger + self.homeModules.yubikey + self.homeModules.zsh + self.homeModules.nix-scripts + self.homeModules.doom + self.homeModules.jj + ]; + }; +} diff --git a/modules/doom/doom.nix b/modules/doom/doom.nix index 20d432b..66def7e 100644 --- a/modules/doom/doom.nix +++ b/modules/doom/doom.nix @@ -1,4 +1,4 @@ -{ +{self, ...}: { flake.homeModules.doom = { config, pkgs, @@ -171,6 +171,11 @@ }; }; + imports = [ + # for copilot ls + self.homeModules.unstable-overlay + ]; + config = lib.mkIf cfg.enable { fonts.fontconfig.enable = true; diff --git a/old/home/jonas@comfy-station.nix b/old/home/jonas@comfy-station.nix deleted file mode 100644 index e983cc9..0000000 --- a/old/home/jonas@comfy-station.nix +++ /dev/null @@ -1,105 +0,0 @@ -{ - config, - lib, - ... -}: { - imports = [ - (./. + "/jonas@comfy-station/" + /borg.nix) - ]; - - # Home Manager needs a bit of information about you and the paths it should - # manage. - home.username = "jonas"; - home.homeDirectory = "/home/jonas"; - - sops = { - age.keyFile = "${config.home.homeDirectory}/.config/sops/age/keys.txt"; - }; - - # hive modules - hive.themes.layan.enable = true; - hive.themes.layan.pkgsInHome = true; - hive.hyprland.enable = true; - hive.swaync.enable = true; - hive.waybar.enable = true; - hive.wlogout.enable = true; - hive.wofi.enable = true; - hive.kitty.enable = true; - hive.nextcloud.enable = true; - hive.firefox = { - enable = true; - plasmaIntegration = true; - passFF = true; - }; - hive.kdeconnect.enable = true; - hive.ranger.enable = true; - hive.ssh = { - enable = true; - sopsFile = ../secrets/jonas/ssh.yaml; - keys = ["borg" "passgit"]; - }; - hive.yubikey.enable = true; - hive.yubikey.withCCID = false; - hive.zsh.enable = true; - hive.nix-scripts.enable = true; - hive.doom.enable = true; - hive.doom.asDefaultEditor = true; - hive.doom.enableCopilot = true; - hive.doom.withNixPkgs = true; - hive.doom.withShellPkgs = true; - hive.doom.withPythonPkgs = true; - hive.jj.enable = true; - - # Make session variables available in systemd units - # SEE: https://github.com/nix-community/home-manager/pull/5543 - # systemd.user.settings.Manager.DefaultEnvironment = - # lib.mapAttrs (_: lib.mkDefault) config.home.sessionVariables; - - xdg.mimeApps = { - enable = true; - - defaultApplications = { - "text/html" = "firefox.desktop"; - "x-scheme-handler/http" = "firefox.desktop"; - "x-scheme-handler/https" = "firefox.desktop"; - "x-scheme-handler/about" = "firefox.desktop"; - "x-scheme-handler/unknown" = "firefox.desktop"; - }; - }; - xdg.userDirs.enable = true; - xdg.userDirs.createDirectories = true; - xdg.userDirs.extraConfig = { - XDG_WORKSPACES_DIR = "${config.home.homeDirectory}/Workspaces"; - XDG_NEXTCLOUD_DIR = "${config.home.homeDirectory}/Nextcloud"; - XDG_NOTES_DIR = "${config.home.homeDirectory}/Notes"; - }; - - # This value determines the Home Manager release that your configuration is - # compatible with. This helps avoid breakage when a new Home Manager release - # introduces backwards incompatible changes. - # - # You should not change this value, even if you update Home Manager. If you do - # want to update the value, then make sure to first check the Home Manager - # release notes. - home.stateVersion = "24.11"; # Please read the comment before changing. - - home.sessionVariables = { - EDITOR = lib.mkDefault "vim"; - }; - - # Let Home Manager install and manage itself. - programs.home-manager.enable = true; - - # Git - programs.difftastic.enable = true; - programs.difftastic.git.enable = true; - programs.git = { - enable = true; - settings.user.name = "Jonas Röger"; - settings.user.email = "jonas.roeger@tu-dortmund.de"; - signing = { - signByDefault = true; - key = "4000EB35E1AE0F07"; - }; - }; -} diff --git a/old/home/jonas@comfy-station/borg.nix b/old/home/jonas@comfy-station/borg.nix deleted file mode 100644 index fb1fcfa..0000000 --- a/old/home/jonas@comfy-station/borg.nix +++ /dev/null @@ -1,131 +0,0 @@ -{config, ...}: let - defaultChecks = [ - { - name = "repository"; - frequency = "2 weeks"; - } - { - name = "archives"; - frequency = "4 weeks"; - } - { - name = "data"; - frequency = "6 weeks"; - } - { - name = "extract"; - frequency = "6 weeks"; - } - ]; - passwordFile = "${config.home.homeDirectory}/.config/borg/password"; - encCmd = ''cat ${passwordFile}''; - repo = "ssh://borg.jroeger.de/./comfy-station"; -in { - sops.secrets = { - "borg/password" = { - sopsFile = ../../secrets/jonas/borg.yaml; - key = "password"; - path = passwordFile; - }; - }; - - services.borgmatic.enable = true; - services.borgmatic.frequency = "hourly"; - - programs.borgmatic.enable = true; - programs.borgmatic.backups = { - workspaces = { - location = { - sourceDirectories = ["${config.xdg.userDirs.extraConfig.XDG_WORKSPACES_DIR}"]; - repositories = [repo]; - excludeHomeManagerSymlinks = true; - extraConfig = { - archive_name_format = "{hostname}-workspaces-{now}"; - exclude_patterns = [ - "*/.venv" - "__pycache__" - ]; - }; - }; - retention = { - keepDaily = 7; - keepHourly = 12; - keepWeekly = 4; - keepMonthly = 6; - }; - storage = { - encryptionPasscommand = encCmd; - }; - consistency.checks = defaultChecks; - }; - media = { - location = { - sourceDirectories = [ - "${config.xdg.userDirs.documents}" - "${config.xdg.userDirs.music}" - "${config.home.homeDirectory}/org" - "${config.home.homeDirectory}/Obsidian" - "${config.home.homeDirectory}/Zotero" - ]; - repositories = [repo]; - excludeHomeManagerSymlinks = true; - extraConfig = { - archive_name_format = "{hostname}-media-{now}"; - }; - }; - retention = { - keepDaily = 7; - keepWeekly = 2; - keepMonthly = 6; - }; - storage = { - encryptionPasscommand = encCmd; - }; - consistency.checks = defaultChecks; - }; - sec = { - location = { - sourceDirectories = [ - "${config.xdg.configHome}/sops" - "${config.home.homeDirectory}/Stuff/sec" - "${config.home.homeDirectory}/.password-store" - ]; - repositories = [repo]; - excludeHomeManagerSymlinks = true; - extraConfig = { - archive_name_format = "{hostname}-sec-{now}"; - }; - }; - retention = { - keepDaily = 7; - keepWeekly = 2; - keepMonthly = 6; - }; - storage = { - encryptionPasscommand = encCmd; - }; - consistency.checks = defaultChecks; - }; - var = { - location = { - sourceDirectories = [ - "${config.xdg.userDirs.desktop}" - ]; - repositories = [repo]; - excludeHomeManagerSymlinks = true; - extraConfig = { - archive_name_format = "{hostname}-var-{now}"; - }; - }; - retention = { - keepDaily = 7; - keepWeekly = 2; - keepMonthly = 6; - }; - storage = { - encryptionPasscommand = encCmd; - }; - consistency.checks = defaultChecks; - }; - }; -} diff --git a/old/home/jonas@harbor.nix b/old/home/jonas@harbor.nix deleted file mode 100644 index ce0b482..0000000 --- a/old/home/jonas@harbor.nix +++ /dev/null @@ -1,44 +0,0 @@ -{lib, ...}: { - # Home Manager needs a bit of information about you and the paths it should - # manage. - home.username = "jonas"; - home.homeDirectory = "/home/jonas"; - - # hive modules - hive.zsh.enable = true; - hive.nix-scripts.enable = true; - hive.ranger.enable = true; - hive.doom.enable = true; - hive.doom.asDefaultEditor = true; - hive.doom.withNixPkgs = true; - hive.doom.withShellPkgs = true; - - # This value determines the Home Manager release that your configuration is - # compatible with. This helps avoid breakage when a new Home Manager release - # introduces backwards incompatible changes. - # - # You should not change this value, even if you update Home Manager. If you do - # want to update the value, then make sure to first check the Home Manager - # release notes. - home.stateVersion = "24.11"; # Please read the comment before changing. - - home.sessionVariables = { - EDITOR = lib.mkDefault "vim"; - }; - - # Let Home Manager install and manage itself. - programs.home-manager.enable = true; - - # Git - programs.difftastic.enable = true; - programs.difftastic.git.enable = true; - programs.git = { - enable = true; - settings.user.name = "Jonas Röger"; - settings.user.email = "jonas.roeger@tu-dortmund.de"; - signing = { - signByDefault = true; - key = "4000EB35E1AE0F07"; - }; - }; -} diff --git a/old/home/jonas@monolith.nix b/old/home/jonas@monolith.nix deleted file mode 100644 index 0b2863a..0000000 --- a/old/home/jonas@monolith.nix +++ /dev/null @@ -1,105 +0,0 @@ -{ - config, - lib, - ... -}: rec { - # Home Manager needs a bit of information about you and the paths it should - # manage. - home.username = "jonas"; - home.homeDirectory = "/home/jonas"; - - sops = { - age.keyFile = "${home.homeDirectory}/.config/sops/age/keys.txt"; - }; - sops.secrets.gotifyDaemonToken = { - sopsFile = ../secrets/jonas/gotify.yaml; - key = "monolithDesktopToken"; - }; - sops.secrets.gotifyCLIToken = { - sopsFile = ../secrets/jonas/gotify.yaml; - key = "cliToken"; - }; - - # hive moduless - hive.doom.enable = true; - hive.doom.asDefaultEditor = true; - hive.doom.enableCopilot = false; - hive.doom.enableTidal = false; - hive.doom.withNixPkgs = true; - hive.doom.withShellPkgs = true; - hive.doom.withPythonPkgs = true; - hive.firefox = { - enable = true; - plasmaIntegration = false; - passFF = true; - }; - hive.kdeconnect.enable = false; - hive.kdeconnect.indicatorOnly = false; - hive.nextcloud.enable = false; # kwallet bug - hive.nix-scripts.enable = true; - hive.ranger.enable = true; - hive.themes.layan.enable = true; - hive.yubikey.enable = true; - hive.zsh.enable = true; - hive.jj.enable = true; - hive.gotify = { - cli.enable = true; - daemon.enable = true; - cli.tokenSopsKey = config.sops.secrets.gotifyCLIToken.name; - daemon.tokenSopsKey = config.sops.secrets.gotifyDaemonToken.name; - host = "gotify.jroeger.de"; - }; - - # Make session variables available in systemd units - # SEE: https://github.com/nix-community/home-manager/pull/5543 - # systemd.user.settings.Manager.DefaultEnvironment = - # lib.mapAttrs (_: lib.mkDefault) config.home.sessionVariables; - - xdg.mimeApps = { - enable = true; - - defaultApplications = { - "text/html" = "firefox.desktop"; - "x-scheme-handler/http" = "firefox.desktop"; - "x-scheme-handler/https" = "firefox.desktop"; - "x-scheme-handler/about" = "firefox.desktop"; - "x-scheme-handler/unknown" = "firefox.desktop"; - }; - }; - xdg.userDirs.enable = true; - xdg.userDirs.createDirectories = true; - xdg.userDirs.extraConfig = { - XDG_WORKSPACES_DIR = "${config.home.homeDirectory}/Workspaces"; - XDG_NEXTCLOUD_DIR = "${config.home.homeDirectory}/Nextcloud"; - XDG_NOTES_DIR = "${config.home.homeDirectory}/Notes"; - }; - - # This value determines the Home Manager release that your configuration is - # compatible with. This helps avoid breakage when a new Home Manager release - # introduces backwards incompatible changes. - # - # You should not change this value, even if you update Home Manager. If you do - # want to update the value, then make sure to first check the Home Manager - # release notes. - home.stateVersion = "24.11"; # Please read the comment before changing. - - home.sessionVariables = { - EDITOR = lib.mkDefault "vim"; - }; - - # Let Home Manager install and manage itself. - programs.home-manager.enable = true; - - # Git - programs.difftastic.enable = true; - programs.difftastic.git.enable = true; - programs.git = { - enable = true; - settings.user.name = "Jonas Röger"; - settings.user.email = "jonas.roeger@tu-dortmund.de"; - signing = { - signByDefault = true; - key = "4000EB35E1AE0F07"; - }; - }; -} diff --git a/old/hosts/comfy-station/configuration.nix b/old/hosts/comfy-station/configuration.nix deleted file mode 100644 index 9b3435c..0000000 --- a/old/hosts/comfy-station/configuration.nix +++ /dev/null @@ -1,177 +0,0 @@ -# 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. - ./hardware-configuration.nix - ]; - - # Secret management - sops.age.keyFile = "/var/lib/sops-nix/key.txt"; - sops.secrets.wg-priv = { - sopsFile = ../../secrets/comfy-station/wg.yaml; - key = "privateKey"; - }; - - # Users - users.users.jonas = { - isNormalUser = true; - description = "Jonas"; - extraGroups = ["networkmanager" "wheel" "docker" "dialout"]; - }; - users.defaultUserShell = pkgs.zsh; - programs.zsh.enable = true; - - # hive modules - hive.nix-scripts.enable = true; - hive.displayManager.name = "sddm"; - hive.hyprland.enable = true; - hive.kwallet.enable = true; - hive.kwallet.forUsers = ["jonas"]; - hive.virt-manager.enable = true; - hive.virt-manager.forUsers = ["jonas"]; - hive.bluetooth.enable = true; - hive.sound.enable = true; - hive.yubikey.enable = true; - hive.wg.client.enable = true; - hive.wg.client.privateKeyFile = config.sops.secrets.wg-priv.path; - hive.wg.client.peer = "comfy-station"; - hive.programs.games.enable = true; - hive.programs.games.steam = true; - hive.programs.creative = { - enable = true; - image-management = true; - image-raw-processing = true; - video-editing-light = true; - }; - - # system packages - environment.systemPackages = with pkgs; [ - age - alejandra - arduino - borgbackup - borgmatic - chromium - digikam - discord - docker - docker-compose - drawio - feh - ffmpeg - firefox - gimp - git - (gnome-network-displays.overrideAttrs (final: prev: {buildInputs = prev.buildInputs ++ [glib-networking];})) - insomnia - krita - libreoffice - mosquitto - mpv - mupdf - nh - nix-index - nix-output-monitor - obsidian - openhantek6022 - qalculate-qt - qtpass - ranger - sops - spotify - vim - vlc - vscode - wget - zoom - zotero - ]; - nixpkgs.config.permittedInsecurePackages = [ - "electron-25.9.0" # required by obsidian - ]; - services.avahi.enable = true; - services.udev.packages = [pkgs.openhantek6022]; - virtualisation.docker.enable = true; - - # 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 = "24.11"; # Did you read the comment? - - # gc settings and binary caches - nix = { - settings = { - substituters = [ - "https://aseipp-nix-cache.freetls.fastly.net" - "https://nix-community.cachix.org" - "https://cache.nixos.org/" - ]; - experimental-features = ["nix-command" "flakes"]; - auto-optimise-store = true; - trusted-users = [ - "@wheel" - ]; - max-jobs = 2; - cores = 8; - }; - gc = { - automatic = true; - dates = "weekly"; - options = "--delete-older-than 30d"; - }; - }; - - # boot - boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; - boot.plymouth.enable = true; - boot.initrd.systemd.enable = true; - boot.supportedFilesystems = ["ntfs"]; - - # Configure console keymap - console.keyMap = "de"; - - # Set your time zone. - time.timeZone = "Europe/Berlin"; - - # Select internationalisation properties. - i18n.defaultLocale = "en_US.UTF-8"; - i18n.extraLocaleSettings = { - LC_ADDRESS = "de_DE.UTF-8"; - LC_IDENTIFICATION = "de_DE.UTF-8"; - LC_MEASUREMENT = "de_DE.UTF-8"; - LC_MONETARY = "de_DE.UTF-8"; - LC_NAME = "de_DE.UTF-8"; - LC_NUMERIC = "de_DE.UTF-8"; - LC_PAPER = "de_DE.UTF-8"; - LC_TELEPHONE = "de_DE.UTF-8"; - LC_TIME = "de_DE.UTF-8"; - }; - - networking.hostName = "comfy-station"; # Define your hostname. - - # Enable networking - networking.networkmanager.enable = true; - - # printing - services.printing.enable = true; - - # touchpad - services.libinput.touchpad.naturalScrolling = true; - - # ld-fix - programs.nix-ld.enable = true; - programs.nix-ld.libraries = [ - # Add any missing dynamic libraries for unpackaged programs - # here, NOT in environment.systemPackages - ]; -} diff --git a/old/hosts/comfy-station/hardware-configuration.nix b/old/hosts/comfy-station/hardware-configuration.nix deleted file mode 100644 index ea64137..0000000 --- a/old/hosts/comfy-station/hardware-configuration.nix +++ /dev/null @@ -1,47 +0,0 @@ -# Do not modify this file! It was generated by ‘nixos-generate-config’ -# and may be overwritten by future invocations. Please make changes -# to /etc/nixos/configuration.nix instead. -{ - config, - lib, - pkgs, - modulesPath, - ... -}: { - imports = [ - (modulesPath + "/installer/scan/not-detected.nix") - ]; - - boot.initrd.availableKernelModules = ["nvme" "ehci_pci" "xhci_pci" "usb_storage" "sd_mod" "rtsx_pci_sdmmc"]; - boot.initrd.kernelModules = ["dm-snapshot"]; - boot.kernelModules = ["kvm-amd"]; - boot.extraModulePackages = []; - - boot.initrd.luks.devices."lvm-root".device = "/dev/disk/by-uuid/0b55681d-5c7b-4045-b895-d1eb7e306ffb"; - - fileSystems."/" = { - device = "/dev/disk/by-uuid/88f53721-1c3f-43fd-8875-59e597aacb10"; - fsType = "ext4"; - }; - - fileSystems."/boot" = { - device = "/dev/disk/by-uuid/583D-114B"; - fsType = "vfat"; - }; - - swapDevices = [ - {device = "/dev/disk/by-uuid/f81521e7-4c09-4e91-8914-3dcd9febdfff";} - ]; - - # Enables DHCP on each ethernet and wireless interface. In case of scripted networking - # (the default) this is the recommended approach. When using systemd-networkd it's - # still possible to use this option, but it's recommended to use it in conjunction - # with explicit per-interface declarations with `networking.interfaces..useDHCP`. - networking.useDHCP = lib.mkDefault true; - # networking.interfaces.enp2s0f0.useDHCP = lib.mkDefault true; - # networking.interfaces.enp5s0.useDHCP = lib.mkDefault true; - # networking.interfaces.wlp3s0.useDHCP = lib.mkDefault true; - - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; -} diff --git a/old/hosts/harbor/configuration.nix b/old/hosts/harbor/configuration.nix deleted file mode 100644 index adef884..0000000 --- a/old/hosts/harbor/configuration.nix +++ /dev/null @@ -1,151 +0,0 @@ -{ - config, - pkgs, - ... -}: { - imports = [ - ./hardware-configuration.nix - ./disko.nix - ]; - - # Secret management - sops.age.keyFile = "/var/lib/sops-nix/key.txt"; - sops.secrets."nextcloud-admin-pass" = { - sopsFile = ../../secrets/harbor/nextcloud.yaml; - owner = "nextcloud"; - key = "admin-pass"; - }; - sops.secrets."wg-priv" = { - sopsFile = ../../secrets/harbor/wg.yaml; - key = "privateKey"; - }; - sops.secrets."gitea-db-pass" = { - sopsFile = ../../secrets/harbor/gitea.yaml; - owner = config.services.gitea.user; - key = "databasePassword"; - }; - sops.secrets."gotify-admin-pass" = { - sopsFile = ../../secrets/harbor/gotify.yaml; - owner = config.hive.gotify-instance.user; - key = "adminPassword"; - }; - - # gc settings and binary caches - nix = { - settings = { - substituters = [ - "https://aseipp-nix-cache.freetls.fastly.net" - "https://nix-community.cachix.org" - "https://cache.nixos.org/" - ]; - experimental-features = ["nix-command" "flakes"]; - auto-optimise-store = true; - }; - gc = { - automatic = true; - dates = "weekly"; - options = "--delete-older-than 30d"; - }; - }; - - # user with ssh access - users.users.jonas = { - isNormalUser = true; - description = "Jonas"; - extraGroups = ["wheel"]; - openssh.authorizedKeys.keys = [ - "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCyCyYsMSiy7shcehlzJEbCyRiHk+cicFB35Bc2uc4PjjkCjswLh01fRAV2QcplrNkH/5F4GBTbOoZHHc7/AVLyUxgwDC9ffD2i7fevuGpfBFy9D30uz6jDekxXkmRmIlidXLdG1Fh4zwVejGlwdhUu/Zb7PonO/dktx3EFdf1SpnW+y75anN85zoGsld7KQk42wEd0zXtCgx4CKI6Vvt6heWCEiJ9wyw1sLpTJr4H8In236CUj1/r1qY9Gfa8n9NA0J9XCpcwSCEWGRKQNicoQIpnp5txrgzaUq4r6qBKHmImYXmSTVnDZ9dJLRYNu2lDvBtTXP4ztlR6Lpxs873fPg51qgaX9rRVMMo/gGjq8fOFWsDVaJZab9VY3hZYNCKIbWFqo4GKyCQs9Xfzr2AUACm09HWiYMTefwEypOzvUb4z+LF2B/0c5XmghLF/TOzLVgDXzAgWMH4mCnPh9EDLHTtoJaGNURler9VRV8yQyLH6oK9UpHZovCFs7HpFN+WPv2QVFfkK8aHg7tnklFsT78z154bjuspiEI/fFGmTxoQUGufmHlRy/9GQDusgNfe24ZEB2hHBVjKv29XdIfvFAhoPVpA6+O/N3feSlmVISaU+8QraVQEf/TuQjopDUWpJTmqSxKvQSTPwcyWDy6NtcJ85bGAu6jSUGC3ouH4Rb2Q== cardno:000609618602" - ]; - }; - users.defaultUserShell = pkgs.zsh; - programs.zsh.enable = true; - services.openssh = { - enable = true; - settings.PasswordAuthentication = false; - settings.KbdInteractiveAuthentication = false; - }; - - # hive modules - hive.gitea-instance.enable = true; - hive.gitea-instance.nativeRunner = true; - hive.gitea-instance.instanceFQDN = "git.jroeger.de"; - hive.gitea-instance.databasePasswordFile = config.sops.secrets.gitea-db-pass.path; - hive.gotify-instance.enable = true; - hive.gotify-instance.instanceFQDN = "gotify.jroeger.de"; - hive.gotify-instance.adminPasswordSopsKey = config.sops.secrets.gotify-admin-pass.name; - hive.nextcloud-instance.enable = true; - hive.nextcloud-instance.ssl = true; - hive.nextcloud-instance.adminPasswordFile = config.sops.secrets.nextcloud-admin-pass.path; - hive.nextcloud-instance.instanceFQDN = "nextcloud.jroeger.de"; - hive.minecraft-server.enable = true; - hive.nix-scripts.enable = true; - hive.borg-server.enable = true; - hive.borg-server.repositories.comfy-station.ssh_public_key = builtins.readFile (../../static/keys + "/borg-jonas@comfy-station.pub"); - hive.wg.server.enable = true; - hive.wg.server.privateKeyFile = config.sops.secrets.wg-priv.path; - - # 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 = "25.11"; # Did you read the comment? - - # VPS compat - boot.loader.grub.enable = true; - boot.loader.grub.device = "/dev/sda"; - boot.loader.grub.version = 2; - boot.kernelParams = [ - "net.ifnames=0" # ensure iface is called eth0 - "ip=173.249.42.252::173.249.42.1:255.255.255.0:harbor:eth0:none:8.8.8.8" - ]; - networking.networkmanager.enable = true; - networking = { - # Static network configuration - hostName = "harbor"; - domain = "jroeger.de"; - defaultGateway = "173.249.42.1"; - nameservers = ["8.8.8.8"]; - interfaces.eth0.ipv4.addresses = [ - { - address = "173.249.42.252"; - prefixLength = 24; - } - ]; - }; - # Temporary ssh server for disk unlock - boot.initrd = { - availableKernelModules = ["virtio_pci"]; - network = { - enable = true; - ssh = { - enable = true; - port = 2222; - authorizedKeys = [ - "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCyCyYsMSiy7shcehlzJEbCyRiHk+cicFB35Bc2uc4PjjkCjswLh01fRAV2QcplrNkH/5F4GBTbOoZHHc7/AVLyUxgwDC9ffD2i7fevuGpfBFy9D30uz6jDekxXkmRmIlidXLdG1Fh4zwVejGlwdhUu/Zb7PonO/dktx3EFdf1SpnW+y75anN85zoGsld7KQk42wEd0zXtCgx4CKI6Vvt6heWCEiJ9wyw1sLpTJr4H8In236CUj1/r1qY9Gfa8n9NA0J9XCpcwSCEWGRKQNicoQIpnp5txrgzaUq4r6qBKHmImYXmSTVnDZ9dJLRYNu2lDvBtTXP4ztlR6Lpxs873fPg51qgaX9rRVMMo/gGjq8fOFWsDVaJZab9VY3hZYNCKIbWFqo4GKyCQs9Xfzr2AUACm09HWiYMTefwEypOzvUb4z+LF2B/0c5XmghLF/TOzLVgDXzAgWMH4mCnPh9EDLHTtoJaGNURler9VRV8yQyLH6oK9UpHZovCFs7HpFN+WPv2QVFfkK8aHg7tnklFsT78z154bjuspiEI/fFGmTxoQUGufmHlRy/9GQDusgNfe24ZEB2hHBVjKv29XdIfvFAhoPVpA6+O/N3feSlmVISaU+8QraVQEf/TuQjopDUWpJTmqSxKvQSTPwcyWDy6NtcJ85bGAu6jSUGC3ouH4Rb2Q== cardno:000609618602" - ]; - hostKeys = ["/etc/secrets/initrd/ssh_host_rsa_key"]; - shell = "/bin/cryptsetup-askpass"; - }; - }; - }; - - # Set your time zone. - time.timeZone = "Europe/Berlin"; - - # Select internationalisation properties. - i18n.defaultLocale = "en_US.UTF-8"; - i18n.extraLocaleSettings = { - LC_ADDRESS = "de_DE.UTF-8"; - LC_IDENTIFICATION = "de_DE.UTF-8"; - LC_MEASUREMENT = "de_DE.UTF-8"; - LC_MONETARY = "de_DE.UTF-8"; - LC_NAME = "de_DE.UTF-8"; - LC_NUMERIC = "de_DE.UTF-8"; - LC_PAPER = "de_DE.UTF-8"; - LC_TELEPHONE = "de_DE.UTF-8"; - LC_TIME = "de_DE.UTF-8"; - }; - console.keyMap = "de"; -} diff --git a/old/hosts/harbor/disko.nix b/old/hosts/harbor/disko.nix deleted file mode 100644 index 9a3b8a8..0000000 --- a/old/hosts/harbor/disko.nix +++ /dev/null @@ -1,71 +0,0 @@ -let - btrfsopt = [ - "compress=zstd" - "noatime" - "ssd" - "space_cache=v2" - "user_subvol_rm_allowed" - ]; -in { - disko.devices = { - disk = { - main = { - type = "disk"; - device = "/dev/sda"; - content = { - type = "gpt"; - partitions = { - boot = { - name = "boot"; - size = "1M"; - type = "ef02"; - }; - esp = { - name = "esp"; - size = "500M"; - type = "ef00"; - content = { - type = "filesystem"; - format = "vfat"; - mountpoint = "/boot"; - }; - }; - luks = { - size = "100%"; - content = { - type = "luks"; - name = "nixos"; - passwordFile = "/tmp/pass"; - additionalKeyFiles = ["/nixos-enc.key"]; - extraFormatArgs = [ - "--type luks1" - "--iter-time 3000" - ]; - settings = { - allowDiscards = true; - }; - content = { - type = "btrfs"; - subvolumes = { - "@root" = { - mountpoint = "/"; - mountOptions = btrfsopt; - }; - "@home" = { - mountpoint = "/home"; - mountOptions = btrfsopt; - }; - "@nix" = { - mountpoint = "/nix"; - mountOptions = btrfsopt; - }; - }; - }; - }; - }; - }; - }; - }; - }; - }; -} diff --git a/old/hosts/harbor/hardware-configuration.nix b/old/hosts/harbor/hardware-configuration.nix deleted file mode 100644 index 4ed0dd5..0000000 --- a/old/hosts/harbor/hardware-configuration.nix +++ /dev/null @@ -1,21 +0,0 @@ -# Do not modify this file! It was generated by ‘nixos-generate-config’ -# and may be overwritten by future invocations. Please make changes -# to /etc/nixos/configuration.nix instead. -{ - config, - lib, - pkgs, - modulesPath, - ... -}: { - imports = [ - (modulesPath + "/profiles/qemu-guest.nix") - ]; - - boot.initrd.availableKernelModules = ["ata_piix" "uhci_hcd" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod"]; - boot.initrd.kernelModules = []; - boot.kernelModules = []; - boot.extraModulePackages = []; - - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; -} diff --git a/old/hosts/monolith/configuration.nix b/old/hosts/monolith/configuration.nix deleted file mode 100644 index 464c0bd..0000000 --- a/old/hosts/monolith/configuration.nix +++ /dev/null @@ -1,283 +0,0 @@ -# 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. - ./hardware-configuration.nix - ]; - - # Secret management - sops.age.keyFile = "/var/lib/sops-nix/key.txt"; - sops.secrets.wg-priv = { - sopsFile = ../../secrets/monolith/wg.yaml; - key = "privateKey"; - }; - sops.secrets.spotifyShortcutsClientId = { - sopsFile = ../../secrets/spotify-shortcuts.yaml; - key = "clientId"; - }; - sops.secrets.spotifyShortcutsClientSecret = { - sopsFile = ../../secrets/spotify-shortcuts.yaml; - key = "clientSecret"; - }; - - # Users - users.users.jonas = { - isNormalUser = true; - description = "Jonas"; - hashedPassword = ""; # passwordless login (sudo is now unusable without specifying NOPASSWD) - extraGroups = ["networkmanager" "wheel" "docker" "dialout"]; - }; - security.sudo.wheelNeedsPassword = false; - users.groups.data = { - gid = 1001; - members = ["jonas"]; - }; - users.defaultUserShell = pkgs.zsh; - programs.zsh.enable = true; - - # fonts - fonts.packages = with pkgs; [ - fira - fira-code-symbols - nerd-fonts.fira-code - ]; - - # hive modules - hive.nix-scripts.enable = true; - hive.displayManager.name = "sddm"; - hive.themes.layan.enable = true; - hive.plasma.enable = true; - hive.kwallet.enable = true; - hive.kwallet.forUsers = ["jonas"]; - hive.virt-manager.enable = true; - hive.virt-manager.forUsers = ["jonas"]; - hive.bluetooth.enable = true; - hive.sound.enable = true; - hive.sound.noisetorch = true; - hive.yubikey.enable = true; - hive.services.kdeconnect.enable = true; - hive.wg.client.enable = true; - hive.wg.client.privateKeyFile = config.sops.secrets.wg-priv.path; - hive.wg.client.peer = "monolith"; - hive.programs.games.enable = true; - hive.programs.games.dayz = true; - hive.programs.games.lutris = true; - hive.programs.games.steam = true; - hive.programs.games.wine = true; - hive.programs.creative = { - enable = true; - image-management = true; - image-editing = true; - image-raw-processing = true; - video-editing-light = true; - video-editing-heavy = true; - daws = true; - }; - hive.programs.utils = { - enable = true; - camera = true; - }; - hive.programs.spotify-shortcuts = { - enable = true; - clientIdSopsKey = config.sops.secrets.spotifyShortcutsClientId.name; - clientSecretSopsKey = config.sops.secrets.spotifyShortcutsClientSecret.name; - }; - - # system packages - environment.systemPackages = with pkgs; [ - age - alejandra - arduino - borgbackup - borgmatic - chromium - discord - docker - docker-compose - feh - firefox - git - gramps - insomnia - libreoffice - mosquitto - mpv - mupdf - nextcloud-client - nh - nix-index - nix-output-monitor - obsidian - openhantek6022 - qalculate-qt - qdirstat - qtpass - ranger - sops - spotify - vim - vlc - vscode - wget - zoom - zotero - ]; - nixpkgs.config.permittedInsecurePackages = [ - "electron-25.9.0" # required by obsidian - ]; - services.udev.packages = [pkgs.openhantek6022]; - virtualisation.docker.enable = true; - - # Corsair drivers - hardware.ckb-next = { - enable = true; - # Workarount until https://github.com/NixOS/nixpkgs/issues/444209 - # is fixed - package = pkgs.ckb-next.overrideAttrs (prev: { - cmakeFlags = - (prev.cmakeFlags or []) - ++ [ - "-DUSE_DBUS_MENU=0" - ]; - }); - }; - - # dpi correction - services.xserver.dpi = 91; - environment.variables = { - ## Used by GTK 3 - # `GDK_SCALE` is limited to integer values - GDK_SCALE = "1"; - # Inverse of GDK_SCALE - GDK_DPI_SCALE = "1"; - - # Used by Qt 5 - QT_AUTO_SCREEN_SCALE_FACTOR = "1"; - - _JAVA_OPTIONS = "-Dsun.java2d.uiScale=1"; - }; - # Expose variables to graphical systemd user services - services.xserver.displayManager.importedVariables = [ - "GDK_SCALE" - "GDK_DPI_SCALE" - "QT_AUTO_SCREEN_SCALE_FACTOR" - ]; - - # Enable OpenGL - hardware.graphics = { - enable = true; - enable32Bit = true; - extraPackages = [pkgs.rocmPackages.clr]; - }; - - # Load nvidia driver for Xorg and Wayland - services.xserver.videoDrivers = ["nvidia"]; - - hardware.nvidia = { - # Modesetting is required. - modesetting.enable = true; - - # Nvidia power management. Experimental, and can cause sleep/suspend to fail. - # Enable this if you have graphical corruption issues or application crashes after waking - # up from sleep. This fixes it by saving the entire VRAM memory to /tmp/ instead - # of just the bare essentials. - powerManagement.enable = false; - - # Fine-grained power management. Turns off GPU when not in use. - # Experimental and only works on modern Nvidia GPUs (Turing or newer). - powerManagement.finegrained = false; - - # Use the NVidia open source kernel module (not to be confused with the - # independent third-party "nouveau" open source driver). - # Support is limited to the Turing and later architectures. Full list of - # supported GPUs is at: - # https://github.com/NVIDIA/open-gpu-kernel-modules#compatible-gpus - # Only available from driver 515.43.04+ - open = false; - - # Enable the Nvidia settings menu, - # accessible via `nvidia-settings`. - nvidiaSettings = true; - - # Optionally, you may need to select the appropriate driver version for your specific GPU. - package = config.boot.kernelPackages.nvidiaPackages.stable; - }; - - # 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 = "24.11"; # Did you read the comment? - - # gc settings and binary caches - nix = { - settings = { - substituters = [ - "https://aseipp-nix-cache.freetls.fastly.net" - "https://nix-community.cachix.org" - "https://cache.nixos.org/" - ]; - experimental-features = ["nix-command" "flakes"]; - auto-optimise-store = true; - }; - gc = { - automatic = true; - dates = "weekly"; - options = "--delete-older-than 30d"; - }; - }; - - # boot - boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; - boot.plymouth.enable = true; - boot.initrd.systemd.enable = true; - boot.supportedFilesystems = ["ntfs"]; - - # Configure console keymap - console.keyMap = "de"; - - # Set your time zone. - time.timeZone = "Europe/Berlin"; - - # Select internationalisation properties. - i18n.defaultLocale = "en_US.UTF-8"; - i18n.extraLocaleSettings = { - LC_ADDRESS = "de_DE.UTF-8"; - LC_IDENTIFICATION = "de_DE.UTF-8"; - LC_MEASUREMENT = "de_DE.UTF-8"; - LC_MONETARY = "de_DE.UTF-8"; - LC_NAME = "de_DE.UTF-8"; - LC_NUMERIC = "de_DE.UTF-8"; - LC_PAPER = "de_DE.UTF-8"; - LC_TELEPHONE = "de_DE.UTF-8"; - LC_TIME = "de_DE.UTF-8"; - }; - - networking.firewall.enable = true; - networking.hostName = "monolith"; # Define your hostname. - networking.extraHosts = '' - 127.0.0.1 monolith - ''; - - # Enable networking - networking.networkmanager.enable = true; - - # printing - services.printing.enable = true; - - # ld-fix - programs.nix-ld.enable = true; - programs.nix-ld.libraries = [ - # Add any missing dynamic libraries for unpackaged programs - # here, NOT in environment.systemPackages - ]; -} diff --git a/old/hosts/monolith/hardware-configuration.nix b/old/hosts/monolith/hardware-configuration.nix deleted file mode 100644 index 0a595e0..0000000 --- a/old/hosts/monolith/hardware-configuration.nix +++ /dev/null @@ -1,57 +0,0 @@ -# Do not modify this file! It was generated by ‘nixos-generate-config’ -# and may be overwritten by future invocations. Please make changes -# to /etc/nixos/configuration.nix instead. -{ - config, - lib, - pkgs, - modulesPath, - ... -}: { - imports = [ - (modulesPath + "/installer/scan/not-detected.nix") - ]; - - boot.initrd.availableKernelModules = ["nvme" "xhci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" "sr_mod"]; - boot.initrd.kernelModules = []; - boot.kernelModules = ["kvm-amd"]; - boot.extraModulePackages = []; - - fileSystems."/" = { - device = "/dev/disk/by-uuid/11d59216-2e76-499f-853f-9801486e330a"; - fsType = "ext4"; - }; - - fileSystems."/boot" = { - device = "/dev/disk/by-uuid/0892-649B"; - fsType = "vfat"; - options = ["fmask=0022" "dmask=0022"]; - }; - - fileSystems."/data1" = { - device = "/dev/disk/by-uuid/8426515e-2be1-4c51-8b5f-d1850aa17270"; - fsType = "ext4"; - }; - - fileSystems."/data2" = { - device = "/dev/disk/by-uuid/4f39ed6d-74ed-420b-b542-89d432459f79"; - fsType = "ext4"; - }; - - swapDevices = [ - { - device = "/.swapfile"; - size = 24 * 1024; - } - ]; - - # Enables DHCP on each ethernet and wireless interface. In case of scripted networking - # (the default) this is the recommended approach. When using systemd-networkd it's - # still possible to use this option, but it's recommended to use it in conjunction - # with explicit per-interface declarations with `networking.interfaces..useDHCP`. - networking.useDHCP = lib.mkDefault true; - # networking.interfaces.enp42s0.useDHCP = lib.mkDefault true; - - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; -} diff --git a/old/hosts/vm/configuration.nix b/old/hosts/vm/configuration.nix deleted file mode 100644 index 3ea5efc..0000000 --- a/old/hosts/vm/configuration.nix +++ /dev/null @@ -1,113 +0,0 @@ -# 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’). -{ - pkgs, - inputs, - ... -}: { - imports = [ - # Include the results of the hardware scan. - ./hardware-configuration.nix - inputs.home-manager.nixosModules.home-manager - ../../modules/hardware/bluetooth.nix - ../../modules/hardware/printing.nix - ../../modules/hardware/sound.nix - ../../modules/services/docker.nix - ../../modules/desktop/dm - ../../modules/desktop/de - ]; - - desktop.dm.name = "sddm"; - desktop.dm.autologin = "jonas"; - desktop.de.plasma.enable = true; - - # Enable touchpad support (enabled default in most desktopManager). - # services.xserver.libinput.enable = true; - - # Define a user account. Don't forget to set a password with ‘passwd’. - users.users.jonas = { - isNormalUser = true; - description = "Jonas"; - extraGroups = ["networkmanager" "wheel" "docker"]; - packages = with pkgs; []; - }; - users.defaultUserShell = pkgs.zsh; - - programs.zsh.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; [ - docker - git - ranger - vim - wget - ]; - - # Some programs need SUID wrappers, can be configured further or are - # started in user sessions. - # programs.mtr.enable = true; - # programs.gnupg.agent = { - # enable = true; - # enableSSHSupport = true; - # }; - - # List services that you want to enable: - - # Enable the OpenSSH daemon. - # services.openssh.enable = true; - - # Open ports in the firewall. - # networking.firewall.allowedTCPPorts = [ ... ]; - # networking.firewall.allowedUDPPorts = [ ... ]; - # Or disable the firewall altogether. - # networking.firewall.enable = false; - - # 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 = "24.11"; # Did you read the comment? - - # boot - boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; - - # Configure console keymap - console.keyMap = "de"; - - # Set your time zone. - time.timeZone = "Europe/Berlin"; - - # Select internationalisation properties. - i18n.defaultLocale = "en_US.UTF-8"; - - i18n.extraLocaleSettings = { - LC_ADDRESS = "de_DE.UTF-8"; - LC_IDENTIFICATION = "de_DE.UTF-8"; - LC_MEASUREMENT = "de_DE.UTF-8"; - LC_MONETARY = "de_DE.UTF-8"; - LC_NAME = "de_DE.UTF-8"; - LC_NUMERIC = "de_DE.UTF-8"; - LC_PAPER = "de_DE.UTF-8"; - LC_TELEPHONE = "de_DE.UTF-8"; - LC_TIME = "de_DE.UTF-8"; - }; - - networking.hostName = "vm"; # Define your hostname. - # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. - - # Configure network proxy if necessary - # networking.proxy.default = "http://user:password@proxy:port/"; - # networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain"; - - # Enable networking - networking.networkmanager.enable = true; -} diff --git a/old/hosts/vm/hardware-configuration.nix b/old/hosts/vm/hardware-configuration.nix deleted file mode 100644 index 5b30829..0000000 --- a/old/hosts/vm/hardware-configuration.nix +++ /dev/null @@ -1,39 +0,0 @@ -# Do not modify this file! It was generated by ‘nixos-generate-config’ -# and may be overwritten by future invocations. Please make changes -# to /etc/nixos/configuration.nix instead. -{ - config, - lib, - pkgs, - modulesPath, - ... -}: { - imports = []; - - boot.initrd.availableKernelModules = ["ata_piix" "ohci_pci" "ehci_pci" "ahci" "sd_mod" "sr_mod"]; - boot.initrd.kernelModules = []; - boot.kernelModules = []; - boot.extraModulePackages = []; - - fileSystems."/" = { - device = "/dev/disk/by-uuid/a28cd2c0-67f3-4492-9cd9-996fdbe2b8ef"; - fsType = "ext4"; - }; - - fileSystems."/boot" = { - device = "/dev/disk/by-uuid/0134-2DF5"; - fsType = "vfat"; - }; - - swapDevices = []; - - # Enables DHCP on each ethernet and wireless interface. In case of scripted networking - # (the default) this is the recommended approach. When using systemd-networkd it's - # still possible to use this option, but it's recommended to use it in conjunction - # with explicit per-interface declarations with `networking.interfaces..useDHCP`. - networking.useDHCP = lib.mkDefault true; - # networking.interfaces.enp0s3.useDHCP = lib.mkDefault true; - - nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; - virtualisation.virtualbox.guest.enable = true; -} diff --git a/old/hosts/wsl/configuration.nix b/old/hosts/wsl/configuration.nix deleted file mode 100644 index 92e1d82..0000000 --- a/old/hosts/wsl/configuration.nix +++ /dev/null @@ -1 +0,0 @@ -{}: {} diff --git a/old/pkgs/bulk-transcode/.envrc b/old/pkgs/bulk-transcode/.envrc deleted file mode 100644 index 7ee6560..0000000 --- a/old/pkgs/bulk-transcode/.envrc +++ /dev/null @@ -1 +0,0 @@ -use flake ../../#bulk-transcode --show-trace diff --git a/old/pkgs/bulk-transcode/bulk-transcode.sh b/old/pkgs/bulk-transcode/bulk-transcode.sh deleted file mode 100644 index b8c6d5b..0000000 --- a/old/pkgs/bulk-transcode/bulk-transcode.sh +++ /dev/null @@ -1,96 +0,0 @@ -#!/usr/bin/env bash - -declare -rA presets=( - [davinci-resolve]="-c:v dnxhd -profile:v dnxhr_hq -pix_fmt yuv422p -c:a pcm_s16le" - [instagram]="-vf scale='if(gte(iw/ih,1),1920,-1)':'if(gte(iw/ih,1),-1,1920)':flags=lanczos -r 30 -c:v libx264 -profile:v high -level 4.1 -pix_fmt yuv420p -preset slow -crf 18 -bf 2 -g 15 -keyint_min 15 -x264-params \"open-gop=0:cabac=1:b-pyramid=none\" -movflags +faststart -c:a aac -b:a 96k" - [insta-4k]="-r 30 -c:v libx264 -profile:v high -level 4.1 -pix_fmt yuv420p -preset slow -crf 18 -bf 2 -g 15 -keyint_min 15 -x264-params \"open-gop=0:cabac=1:b-pyramid=none\" -movflags +faststart -c:a aac -b:a 96k" - [storage-hevc]="-c:v libx265 -preset slower -crf 18 -pix_fmt yuv420p10le -x265-params aq-mode=3:aq-strength=1.0:psy-rd=1.8:psy-rdoq=1.0 -c:a copy" - [storage-av1]="-c:v libsvtav1 -preset 6 -crf 28 -pix_fmt yuv420p -g 240 -svtav1-params tune=0:aq-mode=2 -c:a copy" - [storage-av1-1080p]="-vf scale='if(gte(iw/ih,1),1920,-1)':'if(gte(iw/ih,1),-1,1920)' -c:v libsvtav1 -preset 6 -crf 28 -pix_fmt yuv420p -g 240 -svtav1-params tune=0:aq-mode=2 -c:a copy" - [storage-av1-nvenc]="-c:v av1_nvenc -cq 28 -preset slow -pix_fmt yuv420p10le -c:a copy" - [network]="-c:v libx264 -preset slow -crf 22 -pix_fmt yuv420p -c:a aac -b:a 128k" - [network-1080p]="-vf scale='if(gte(iw/ih,1),1920,-1)':'if(gte(iw/ih,1),-1,1920)' -c:v libx264 -preset slow -crf 22 -pix_fmt yuv420p -c:a aac -b:a 128k" - [whatsapp]="-vf scale='if(gte(iw/ih,1),1920,-1)':'if(gte(iw/ih,1),-1,1920)' -c:v libx264 -preset slow -crf 30 -profile:v baseline -level 3.0 -pix_fmt yuv420p -r 25 -g 50 -c:a aac -b:a 160k -r:a 44100" -) - -declare -rA containers=( - [davinci-resolve]="mov" - [instagram]="mp4" - [insta-4k]="mp4" - [storage-hevc]="mkv" - [storage-av1]="mkv" - [storage-av1-1080p]="mkv" - [storage-av1-nvenc]="mkv" - [network]="mp4" - [network-1080p]="mp4" - [whatsapp]="mp4" -) - -where="${1:-.}" -dest="${2:-$where}" - -selection=$(find "$where" -type f | fzf --multi --preview 'ffprobe -v error -show_format -show_streams {}' --preview-window=up:wrap) - -preset=$( - printf '%s\n' "${!presets[@]}" | \ - fzf --multi --prompt "Select a preset" -) -flags="${presets[$preset]}" -container="${containers[$preset]}" - -output_dir=$(find "$dest" -type d ! -name '.*' ! -path '*/.*/*' | fzf --preview 'tree -C {}' --preview-window=up:wrap --prompt "Select output directory: ") - -if gum confirm "Flatten the directory structure?"; -then - flatten=true -else - flatten=false -fi - - -function transcode_job { - local ifile="$1" - local output_dir="$2" - local flatten="$3" - local where="$4" - local flags="$5" - local container="$6" - local fname=$(basename "$ifile") - local segment=$(realpath --relative-to="$where" "$ifile") - - - if [ "$flatten" = true ]; then - output_file="$output_dir/$fname.$container" - else - output_file="$output_dir/$segment.$container" - fi - - tmp_file=$(mktemp) - - echo "Running Command: ffmpeg -y -i $ifile $flags $output_file" >> "$tmp_file" - - mkdir -p "$(dirname "$output_file")" - - if ffmpeg -y -i "$ifile" $(echo -n "$flags") "$output_file" 2>> "$tmp_file"; - then - rm -f "$tmp_file" - else - # gum log "Failed to transcode $ifile. Check ./error.log for details." - cat "$tmp_file" >> error.log - rm -f "$tmp_file" - - fi -} -export -f transcode_job - -mapfile -t files <<< "$selection" -len=${#files[@]} -i=1 -for file in "${files[@]}"; do - if [[ -f "$file" ]]; then - gum spin --spinner dot --title "[$i/$len] Transcoding $file" -- bash -c "source <(declare -f transcode_job); transcode_job \"$file\" \"$output_dir\" \"$flatten\" \"$where\" \"$flags\" \"$container\"" - else - echo "Skipping invalid file: $file" >&2 - fi - ((i++)) -done diff --git a/old/pkgs/bulk-transcode/default.nix b/old/pkgs/bulk-transcode/default.nix deleted file mode 100644 index 1e1d8c0..0000000 --- a/old/pkgs/bulk-transcode/default.nix +++ /dev/null @@ -1,35 +0,0 @@ -{ - bash, - coreutils, - ffmpeg, - findutils, - fzf, - gum, - lib, - makeWrapper, - stdenv, - tree, - ... -}: -stdenv.mkDerivation (finalAttrs: { - name = "bulk-transcode"; - src = ./.; - - buildInputs = [ - bash - coreutils - ffmpeg - findutils - fzf - gum - makeWrapper - tree - ]; - - installPhase = '' - install -Dm755 bulk-transcode.sh $out/bin/bulk-transcode - - wrapProgram $out/bin/bulk-transcode \ - --set PATH "${lib.makeBinPath finalAttrs.buildInputs}" - ''; -}) diff --git a/old/pkgs/bulk-transcode/shell.nix b/old/pkgs/bulk-transcode/shell.nix deleted file mode 100644 index 327a200..0000000 --- a/old/pkgs/bulk-transcode/shell.nix +++ /dev/null @@ -1,7 +0,0 @@ -{pkgs ? import {}}: let - bin = pkgs.callPackage ./default.nix {}; -in - pkgs.mkShell { - name = "bulk-transcode"; - inputsFrom = [bin]; - } diff --git a/old/pkgs/crossover.nix b/old/pkgs/crossover.nix deleted file mode 100644 index d9185d0..0000000 --- a/old/pkgs/crossover.nix +++ /dev/null @@ -1,40 +0,0 @@ -{ - appimageTools, - fetchurl, - makeWrapper, - ... -}: let - pname = "crossover"; - version = "3.1.5"; - src = fetchurl { - url = "https://github.com/lacymorrow/crossover/releases/download/v${version}/CrossOver-${version}-x86_64.AppImage"; - sha256 = "sha256-64RPal8n1PJh1LB+CTyNFt04Pw1lVgcsyc63S8yQ/DA="; - }; - appimageContents = appimageTools.extract { - inherit pname version src; - }; -in - appimageTools.wrapType2 { - inherit pname version src; - - nativeBuildInputs = [makeWrapper]; - extraInstallCommands = '' - wrapProgram $out/bin/${pname} --add-flags "--no-sandbox" - - # Create a minimal .desktop file manually - mkdir -p $out/share/applications - cat > $out/share/applications/${pname}.desktop < {}}: -pkgs.callPackage ./derivation.nix {} diff --git a/old/pkgs/spotify-shortcuts/derivation.nix b/old/pkgs/spotify-shortcuts/derivation.nix deleted file mode 100644 index 4bfa123..0000000 --- a/old/pkgs/spotify-shortcuts/derivation.nix +++ /dev/null @@ -1,9 +0,0 @@ -{python3Packages}: -with python3Packages; - buildPythonApplication { - name = "spotify-shortcuts"; - propagatedBuildInputs = [spotipy pyxdg desktop-notifier]; - pyproject = true; - build-system = [setuptools]; - src = ./.; - } diff --git a/old/pkgs/spotify-shortcuts/setup.py b/old/pkgs/spotify-shortcuts/setup.py deleted file mode 100644 index 474c0fe..0000000 --- a/old/pkgs/spotify-shortcuts/setup.py +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env python - -from setuptools import setup, find_packages - -setup( - name="spotify_shortcuts", - version="1.0", - packages=find_packages(), - entry_points={ - "console_scripts": [ - "spotisc=spotify_shortcuts.run:main", - "spotify-like=spotify_shortcuts.spotify_like:main", - "spotify-pl-add=spotify_shortcuts.spotify_pl_add:main", - ], - }, -) diff --git a/old/pkgs/spotify-shortcuts/shell.nix b/old/pkgs/spotify-shortcuts/shell.nix deleted file mode 100644 index a863d83..0000000 --- a/old/pkgs/spotify-shortcuts/shell.nix +++ /dev/null @@ -1,15 +0,0 @@ -{pkgs ? import {}}: let - drv = pkgs.callPackage ./derivation.nix {}; -in - pkgs.mkShell { - packages = [ - pkgs.pyright - pkgs.black - ]; - - inputsFrom = [drv]; - - shellHook = '' - export PYTHONPATH="$PYTHONPATH:$(pwd)" - ''; - } diff --git a/old/pkgs/spotify-shortcuts/spotify_shortcuts/__init__.py b/old/pkgs/spotify-shortcuts/spotify_shortcuts/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/old/pkgs/spotify-shortcuts/spotify_shortcuts/__main__.py b/old/pkgs/spotify-shortcuts/spotify_shortcuts/__main__.py deleted file mode 100644 index 8f3c09e..0000000 --- a/old/pkgs/spotify-shortcuts/spotify_shortcuts/__main__.py +++ /dev/null @@ -1,4 +0,0 @@ -from spotify_shortcuts.run import main - -if __name__ == "__main__": - main() diff --git a/old/pkgs/spotify-shortcuts/spotify_shortcuts/config.py b/old/pkgs/spotify-shortcuts/spotify_shortcuts/config.py deleted file mode 100644 index 69901e1..0000000 --- a/old/pkgs/spotify-shortcuts/spotify_shortcuts/config.py +++ /dev/null @@ -1,74 +0,0 @@ -from pathlib import Path -from dataclasses import dataclass -from argparse import ArgumentParser -from typing import List -from os import getenv -from sys import argv -from xdg.BaseDirectory import xdg_cache_home -from json import loads - - -@dataclass -class Config: - cache_file: Path = Path(xdg_cache_home) / Path("spotify-shortcuts.json") - client_id: str | None = None - client_secret: str | None = None - notifications: bool = True - - @staticmethod - def from_file(path: Path): - if not path.exists(): - raise FileNotFoundError(f"Configuration file {path} does not exist.") - with open(path, "r") as f: - data = loads(f.read()) - - return Config( - cache_file=Path(data.get("cacheFile", Config.cache_file)), - client_id=data.get("clientId", Config.client_id), - client_secret=data.get("clientSecret", Config.client_secret), - ) - - -def load_config(args: List[str] = argv[1:]) -> Config: - parser = ArgumentParser(description="Spotify CLI Tool") - parser.add_argument( - "--cache-file", - type=Path, - default=Config.cache_file, - help="Path to the cache file for Spotify authentication", - ) - parser.add_argument( - "--client-id", - type=str, - default=Config.client_id, - help="Spotify API Client ID", - ) - parser.add_argument( - "--client-secret", - type=str, - default=Config.client_secret, - help="Spotify API Client Secret", - ) - parser.add_argument( - "--config-file", - type=str, - help="Path to a json configuration file with keys clientId and clientSecret", - ) - parser.add_argument( - "--no-notifications", - action="store_true", - help="Disable desktop notifications", - ) - - ns = parser.parse_args(args) - - cfg = Config() - if (cfg_file := ns.config_file or getenv("SPOTIFY_SHORTCUTS_CONFIG", None)) != None: - cfg = Config.from_file(Path(cfg_file)) - - return Config( - cache_file=ns.cache_file or cfg.cache_file, - client_id=ns.client_id or cfg.client_id, - client_secret=ns.client_secret or cfg.client_secret, - notifications=not ns.no_notifications or cfg.notifications, - ) diff --git a/old/pkgs/spotify-shortcuts/spotify_shortcuts/registry.py b/old/pkgs/spotify-shortcuts/spotify_shortcuts/registry.py deleted file mode 100644 index 7e6f694..0000000 --- a/old/pkgs/spotify-shortcuts/spotify_shortcuts/registry.py +++ /dev/null @@ -1,7 +0,0 @@ -from spotify_shortcuts.spotify_like import SpotifyLike -from spotify_shortcuts.spotify_pl_add import SpotifyPlAdd - -SHORTCUT_REGISTRY = { - "like": SpotifyLike(), - "pl_add": SpotifyPlAdd(), -} diff --git a/old/pkgs/spotify-shortcuts/spotify_shortcuts/run.py b/old/pkgs/spotify-shortcuts/spotify_shortcuts/run.py deleted file mode 100644 index 423ff6a..0000000 --- a/old/pkgs/spotify-shortcuts/spotify_shortcuts/run.py +++ /dev/null @@ -1,47 +0,0 @@ -from spotify_shortcuts.config import Config, load_config -from spotify_shortcuts.shortcut import Shortcut -from spotify_shortcuts.spotify_auth import authenticated_session -from itertools import chain - - -def all_scopes() -> list[str]: - from spotify_shortcuts.registry import SHORTCUT_REGISTRY - - return list( - set( - chain.from_iterable( - shortcut.get_scopes() for shortcut in SHORTCUT_REGISTRY.values() - ) - ) - ) - - -def run_shortcut(shortcut: Shortcut, config: Config): - client = authenticated_session( - config, scopes=all_scopes() # use all scopes to avoid re-authentication - ) - - shortcut.execute(client, config) - - -def main(): - from spotify_shortcuts.registry import SHORTCUT_REGISTRY - import sys - - if len(sys.argv) < 2: - print(f"Usage: {sys.argv[0]} ") - sys.exit(1) - - shortcut_name = sys.argv[1] - if shortcut_name not in SHORTCUT_REGISTRY: - print(f"Shortcut '{shortcut_name}' not found.") - sys.exit(1) - - shortcut = SHORTCUT_REGISTRY[shortcut_name] - config = load_config(args=sys.argv[2:]) - - run_shortcut(shortcut, config) - - -if __name__ == "__main__": - main() diff --git a/old/pkgs/spotify-shortcuts/spotify_shortcuts/shortcut.py b/old/pkgs/spotify-shortcuts/spotify_shortcuts/shortcut.py deleted file mode 100644 index e8d871b..0000000 --- a/old/pkgs/spotify-shortcuts/spotify_shortcuts/shortcut.py +++ /dev/null @@ -1,21 +0,0 @@ -from abc import ABC, abstractmethod - -from spotify_shortcuts.config import Config -from spotipy import Spotify - - -class Shortcut(ABC): - @abstractmethod - def execute(self, client: Spotify, config: Config): - """Execute the shortcut action.""" - pass - - @abstractmethod - def get_help(self) -> str: - """Return a description of the shortcut.""" - pass - - @abstractmethod - def get_scopes(self) -> list[str]: - """Return the spotify API scopes required for the shortcut.""" - pass diff --git a/old/pkgs/spotify-shortcuts/spotify_shortcuts/spotify_auth.py b/old/pkgs/spotify-shortcuts/spotify_shortcuts/spotify_auth.py deleted file mode 100644 index f4f6574..0000000 --- a/old/pkgs/spotify-shortcuts/spotify_shortcuts/spotify_auth.py +++ /dev/null @@ -1,20 +0,0 @@ -from spotipy.oauth2 import SpotifyOAuth -from spotipy import Spotify -from spotify_shortcuts.config import Config - -CALLBACK_URI = "http://127.0.0.1:45632/callback" - - -def authenticated_session(cfg: Config, scopes: list[str]) -> Spotify: - assert cfg.client_id, "Spotify client ID is required" - assert cfg.client_secret, "Spotify client secret is required" - - return Spotify( - auth_manager=SpotifyOAuth( - client_id=cfg.client_id, - client_secret=cfg.client_secret, - redirect_uri=CALLBACK_URI, - scope=" ".join(scopes), - cache_path=cfg.cache_file, - ) - ) diff --git a/old/pkgs/spotify-shortcuts/spotify_shortcuts/spotify_like.py b/old/pkgs/spotify-shortcuts/spotify_shortcuts/spotify_like.py deleted file mode 100644 index 32787ce..0000000 --- a/old/pkgs/spotify-shortcuts/spotify_shortcuts/spotify_like.py +++ /dev/null @@ -1,46 +0,0 @@ -from spotify_shortcuts.run import run_shortcut -from spotify_shortcuts.shortcut import Shortcut -from spotify_shortcuts.config import load_config -from desktop_notifier import DesktopNotifierSync - -SCOPES = [ - "user-library-read", - "user-library-modify", - "user-read-playback-state", -] - - -class SpotifyLike(Shortcut): - def execute(self, client, config): - if (playback := client.current_playback()) is None: - print("No current playback found.") - return - - if (uri := playback.get("item", {}).get("uri", None)) is None: - print("No track URI found in current playback.") - return - - client.current_user_saved_tracks_add(tracks=[uri]) - - if config.notifications: - dn = DesktopNotifierSync() - dn.send( - title="Track Liked", - message=f"Track \"{playback.get('item', {}).get('name', '')}\" by \"{ - ", ".join(a.get('name', '') for a in playback.get('item', {}).get('artists', [])) - }\" has been liked.", - ) - - def get_help(self) -> str: - return "Like the currently playing track." - - def get_scopes(self) -> list[str]: - return SCOPES - - -def main(): - run_shortcut(SpotifyLike(), load_config()) - - -if __name__ == "__main__": - main() diff --git a/old/pkgs/spotify-shortcuts/spotify_shortcuts/spotify_pl_add.py b/old/pkgs/spotify-shortcuts/spotify_shortcuts/spotify_pl_add.py deleted file mode 100644 index 63d5426..0000000 --- a/old/pkgs/spotify-shortcuts/spotify_shortcuts/spotify_pl_add.py +++ /dev/null @@ -1,57 +0,0 @@ -from spotify_shortcuts.shortcut import Shortcut -from spotify_shortcuts.config import load_config -from desktop_notifier import DesktopNotifierSync -from spotify_shortcuts.run import run_shortcut - -SCOPES = [ - "playlist-modify-public", - "playlist-modify-private", - "user-read-playback-state", -] - - -class SpotifyPlAdd(Shortcut): - def execute(self, client, config): - if (playback := client.current_playback()) is None: - print("No current playback found.") - return - - if (track_uri := playback.get("item", {}).get("uri", None)) is None: - print("No track URI found in current playback.") - return - - if (context_uri := playback.get("context", {}).get("uri", None)) is None: - print("No context URI found in current playback.") - return - - client.playlist_add_items(context_uri, items=[track_uri]) - - if config.notifications: - track_name = playback.get("item", {}).get("name", "") - artists = ", ".join( - a.get("name", "") - for a in playback.get("item", {}).get("artists", []) - ) - playlist_name = (client.playlist(context_uri) or {}).get( - "name", "" - ) - - dn = DesktopNotifierSync() - dn.send( - title="Track Added to Playlist", - message=f'Track "{track_name}" by "{artists}" has been added to {playlist_name}.', - ) - - def get_help(self) -> str: - return "Add the currently playing track to the current playlist." - - def get_scopes(self) -> list[str]: - return SCOPES - - -def main(): - run_shortcut(SpotifyPlAdd(), load_config()) - - -if __name__ == "__main__": - main()