diff --git a/flake.nix b/flake.nix index f579618..4b3103c 100644 --- a/flake.nix +++ b/flake.nix @@ -13,15 +13,15 @@ oxalica.url = github:oxalica/rust-overlay; }; - outputs = args@{ home-manager, nixpkgs, agenix, nixos-hardware, oxalica, ... }: with nixpkgs; { + outputs = args@{ home-manager, nixpkgs, agenix, nixos-hardware, oxalica, ... }: with nixpkgs; rec { # Configurations for NixOS machines. nixosConfigurations = - let mkUserConfig = path: { + let mkUserConfig = path: { config, ... }: { imports = [ home-manager.nixosModules.home-manager ]; config = { home-manager.users."riley" = (import "${path}/home.nix"); - home-manager.extraSpecialArgs = args; + home-manager.extraSpecialArgs = args // { age = config.age; }; home-manager.useGlobalPkgs = true; }; }; @@ -66,7 +66,7 @@ # Configurations for non-NixOS machines. homeConfigurations = with home-manager.lib; { "dev-lt-63" = homeManagerConfiguration { - extraSpecialArgs = args; + extraSpecialArgs = args // { age = args.config.age; }; pkgs = import nixpkgs { system = "x86_64-linux"; }; modules = [ ./system/dev-lt-63/home.nix diff --git a/secret/arl.age b/secret/arl.age new file mode 100644 index 0000000..71f92be Binary files /dev/null and b/secret/arl.age differ diff --git a/secret/backblaze.age b/secret/backblaze.age index 81cb2b0..7002a56 100644 Binary files a/secret/backblaze.age and b/secret/backblaze.age differ diff --git a/secrets.nix b/secrets.nix index 60f0b9f..5ffa2da 100644 --- a/secrets.nix +++ b/secrets.nix @@ -13,4 +13,6 @@ let strawberry = [ in { # Secrets for backup cloud storage provider "secret/backblaze.age".publicKeys = all; + # The ARL for my deezer account + "secret/arl.age".publicKeys = all; } \ No newline at end of file diff --git a/shared/core/nix.nix b/shared/core/nix.nix index 7ff1fe6..b2ae4d2 100644 --- a/shared/core/nix.nix +++ b/shared/core/nix.nix @@ -9,6 +9,7 @@ in with lib; { # TODO: Add strawberry as a build machine here config = { nixpkgs.config.allowUnfree = true; + nixpkgs.overlays = [ (import ../overlay.nix) ]; nix.extraOptions = '' experimental-features = nix-command flakes ''; diff --git a/shared/home/programs.nix b/shared/home/programs.nix index 7306ad0..a740298 100644 --- a/shared/home/programs.nix +++ b/shared/home/programs.nix @@ -3,13 +3,14 @@ # needed to do extra configuration for example, consider putting # the affected programs in their own modules. -{ pkgs, ... }: { +{ pkgs, age, ... }: { home.packages = (with pkgs; [ eva hyperfine du-dust pijul + python311Packages.deemix ]) ++ (import ../env.nix pkgs); # CLI for accessing my passwords @@ -44,4 +45,6 @@ }; }; + xdg.configFile."deemix/.arl".source = age.secrets."arl".path; + } diff --git a/shared/overlay.nix b/shared/overlay.nix index eaefb17..0e737b0 100644 --- a/shared/overlay.nix +++ b/shared/overlay.nix @@ -10,4 +10,7 @@ with (import ./lib.nix final); { prev.tor-browser-bundle-bin.override { useHardenedMalloc = false; }; + python311Packages.deemix = prev.python311Packages.deemix.overrideAttrs (old: { + patches = [./patch/dont_write_arl.patch]; + }); } diff --git a/shared/patch/dont_write_arl.patch b/shared/patch/dont_write_arl.patch new file mode 100644 index 0000000..d8b336c --- /dev/null +++ b/shared/patch/dont_write_arl.patch @@ -0,0 +1,18 @@ +diff --git a/deemix/__main__.py b/deemix/__main__.py +index 39a878a..74acf8d 100644 +--- a/deemix/__main__.py ++++ b/deemix/__main__.py +@@ -47,9 +47,10 @@ def download(url, bitrate, portable, path): + with open(configFolder / '.arl', 'r', encoding="utf-8") as f: + arl = f.readline().rstrip("\n").strip() + if not dz.login_via_arl(arl): arl = requestValidArl() +- else: arl = requestValidArl() +- with open(configFolder / '.arl', 'w', encoding="utf-8") as f: +- f.write(arl) ++ else: ++ arl = requestValidArl() ++ with open(configFolder / '.arl', 'w', encoding="utf-8") as f: ++ f.write(arl) + + plugins = {} + if Spotify: diff --git a/shared/secrets.nix b/shared/secrets.nix index 9d10595..7d89731 100644 --- a/shared/secrets.nix +++ b/shared/secrets.nix @@ -1,5 +1,10 @@ { age.secrets = { "backblaze".file = ../secret/backblaze.age; + "arl" = { + file = ../secret/arl.age; + owner = "riley"; + mode = "777"; # Fuck it we ball + }; }; } \ No newline at end of file diff --git a/system/lime/core.nix b/system/lime/core.nix index 90e01ee..991287d 100644 --- a/system/lime/core.nix +++ b/system/lime/core.nix @@ -26,5 +26,8 @@ home-manager.users."riley".home.stateVersion = "22.11"; + programs.adb.enable = true; + users.users."riley".extraGroups = ["adbusers"]; + }