diff --git a/config/kde/theming.nix b/config/kde/theming.nix index 1a587dc3..bbeef09a 100644 --- a/config/kde/theming.nix +++ b/config/kde/theming.nix @@ -1,7 +1,12 @@ -{ ... }: +{ systemConfig, pkgs, ... }: { programs.plasma = { - workspace.lookAndFeel = "org.kde.breezedark.desktop"; + workspace = { + lookAndFeel = "org.kde.breezedark.desktop"; + wallpaperSlideShow = { + path = if systemConfig.isNSFW then "${pkgs.art-lotte-bgs-nsfw}" else "${pkgs.art-lotte-bgs-sfw}"; + }; + }; hotkeys.commands."launch-konsole" = { name = "Launch Konsole"; key = "Meta+Alt+K"; diff --git a/flake.nix b/flake.nix index 2d159aac..044b9ef9 100644 --- a/flake.nix +++ b/flake.nix @@ -101,6 +101,7 @@ in import nixpkgs { inherit system; + config.allowUnfree = true; overlays = [ ( @@ -110,6 +111,7 @@ inputs = inputs'; } ) + self.overlays.default ] ++ ( if system == "riscv64-linux" then @@ -218,7 +220,7 @@ in containers // systems; hydraJobs = { - inherit (self) checks devShells; + inherit (self) checks devShells packages; nixosConfigurations = nixpkgs.lib.mapAttrs ( _: v: v.config.system.build.toplevel ) self.nixosConfigurations; @@ -231,8 +233,34 @@ sops ssh-to-age nixfmt-rfc-style + nix-prefetch + nix-prefetch-git ]; }; formatter.x86_64-linux = (pkgsFor "x86_64-linux").nixfmt-rfc-style; + overlays.default = import ./packages; + packages = nixpkgs.lib.listToAttrs ( + map + (name: { + inherit name; + value = + let + pkgs = pkgsFor name; + in + { + inherit (pkgs) + art-lotte + art-lotte-bgs-nsfw + art-lotte-bgs-sfw + package-updater + ; + }; + }) + [ + "x86_64-linux" + "riscv64-linux" + "aarch64-linux" + ] + ); }; } diff --git a/machine/rainbow-resort/default.nix b/machine/rainbow-resort/default.nix index e18c7668..9c437bd4 100644 --- a/machine/rainbow-resort/default.nix +++ b/machine/rainbow-resort/default.nix @@ -1,5 +1,6 @@ { nixos-config, + lib, ... }: { @@ -20,5 +21,23 @@ } ]; }; + specialisation.sfw = { + configuration.imports = [ + { + nix.auto-update.specialisation = "sfw"; + isNSFW = lib.mkForce false; + } + ]; + }; + specialisation.quiet-sfw = { + configuration.imports = [ + "${nixos-config}/config/graphical/plymouth.nix" + { + nix.auto-update.specialisation = "quiet-sfw"; + isNSFW = lib.mkForce false; + } + ]; + }; home-manager.users.darkkirb.imports = [ ./home-manager.nix ]; + isNSFW = true; } diff --git a/machine/thinkrac/default.nix b/machine/thinkrac/default.nix index 4f910b87..a4aaa2f1 100644 --- a/machine/thinkrac/default.nix +++ b/machine/thinkrac/default.nix @@ -20,4 +20,21 @@ } ]; }; + specialisation.nsfw = { + configuration.imports = [ + { + nix.auto-update.specialisation = "nsfw"; + isNSFW = true; + } + ]; + }; + specialisation.quiet-nsfw = { + configuration.imports = [ + "${nixos-config}/config/graphical/plymouth.nix" + { + nix.auto-update.specialisation = "quiet-nsfw"; + isNSFW = true; + } + ]; + }; } diff --git a/modules/default.nix b/modules/default.nix index 8776cc18..46bc259a 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -2,6 +2,8 @@ disko, home-manager, lib, + inTester, + self, ... }: with lib; @@ -18,4 +20,15 @@ with lib; ]; options.isGraphical = mkEnableOption "Whether or not this configuration is a graphical install"; options.isInstaller = mkEnableOption "Whether or not this configuration is an installer and has no access to secrets"; + options.isNSFW = mkEnableOption "Whether or not this configuration is NSFW"; + + config = + if !inTester then + { + nixpkgs.overlays = [ + self.overlays.default + ]; + } + else + { }; } diff --git a/packages/art/lotte/bgs-nsfw.nix b/packages/art/lotte/bgs-nsfw.nix new file mode 100644 index 00000000..45dfb3bf --- /dev/null +++ b/packages/art/lotte/bgs-nsfw.nix @@ -0,0 +1,39 @@ +{ art-lotte, stdenvNoCC }: +stdenvNoCC.mkDerivation { + pname = "sfw-bgs"; + inherit (art-lotte) version; + src = art-lotte; + dontUnpack = true; + dontBuild = true; + nsfwBgs = [ + "2020-07-24-urbankitsune-bna-ych.jxl" + "2021-09-15-cloverhare-lotteplush.jxl" + "2021-10-29-butterskunk-lotte-scat-buffet.jxl" + "2021-11-27-theroguez-lottegassyvore1.jxl" + "2021-12-12-baltnwolf-christmas-diaper-messy.jxl" + "2021-12-12-baltnwolf-christmas-diaper.jxl" + "2022-04-20-cloverhare-mxbatty-maffsie-train-plush.jxl" + "2022-04-20-cloverhare-mxbatty-me-train-maffsie-plush.jxl" + "2022-05-02-anonfurryartist-giftart.jxl" + "2022-06-21-sammythetanuki-lotteplushpride.jxl" + "2022-08-12-deathtoaster-funpit-scat.jxl" + "2022-08-15-deathtoaster-funpit-mud.jxl" + "2022-11-15-wolfsifi-maff-me-leashed.jxl" + "2022-12-27-rexyi-scatych.jxl" + "2023-03-09-rexyi-voredisposal-ych.jxl" + "2023-08-09-coldquarantine-lotte-eating-trash.jxl" + "2023-08-10-coldquarantine-lotte-eating-trash-diapers.jxl" + "2023-08-20-coldquarantine-lotte-eating-trash-clean.jxl" + ]; + installPhase = '' + mkdir $out + for f in $nsfwBgs; do + ln -svf $src/$f $out/$f + done + ''; + + meta = { + description = "NSFW computer backgrounds"; + inherit (art-lotte.meta) license; + }; +} diff --git a/packages/art/lotte/bgs-sfw.nix b/packages/art/lotte/bgs-sfw.nix new file mode 100644 index 00000000..ac96531b --- /dev/null +++ b/packages/art/lotte/bgs-sfw.nix @@ -0,0 +1,26 @@ +{ art-lotte, stdenvNoCC }: +stdenvNoCC.mkDerivation { + pname = "sfw-bgs"; + inherit (art-lotte) version; + src = art-lotte; + dontUnpack = true; + dontBuild = true; + sfwBgs = [ + "2020-07-24-urbankitsune-bna-ych.jxl" + "2021-09-15-cloverhare-lotteplush.jxl" + "2022-05-02-anonfurryartist-giftart.jxl" + "2022-06-21-sammythetanuki-lotteplushpride.jxl" + "2022-11-15-wolfsifi-maff-me-leashed.jxl" + ]; + installPhase = '' + mkdir $out + for f in $sfwBgs; do + ln -svf $src/$f $out/$f + done + ''; + + meta = { + description = "SFW computer backgrounds"; + inherit (art-lotte.meta) license; + }; +} diff --git a/packages/art/lotte/default.nix b/packages/art/lotte/default.nix new file mode 100644 index 00000000..dfb0852e --- /dev/null +++ b/packages/art/lotte/default.nix @@ -0,0 +1,27 @@ +{ + fetchgit, + lib, +}: +let + srcInfo = lib.importJSON ./source.json; + src = fetchgit { + inherit (srcInfo) + url + rev + sha256 + fetchLFS + fetchSubmodules + deepClone + leaveDotGit + ; + }; +in +src.overrideAttrs (_: rec { + name = "${pname}-${version}"; + pname = "lotte-art"; + version = srcInfo.date; + meta = { + description = "Art I commissioned or made"; + license = lib.licenses.cc-by-nc-sa-40; + }; +}) diff --git a/packages/art/lotte/source.json b/packages/art/lotte/source.json new file mode 100644 index 00000000..731e053c --- /dev/null +++ b/packages/art/lotte/source.json @@ -0,0 +1,12 @@ +{ + "url": "https://git.chir.rs/darkkirb/lotte-art", + "rev": "9d341d1b44bfbd1305e66ac1f5a07f01413951d0", + "date": "2024-09-29T11:09:27+02:00", + "path": "/nix/store/s1j9hzifi3f7wc8w39619yvr6n4a0vv7-lotte-art", + "sha256": "1rzlvlyjqkbzpyl14v6hgiyb9xkx5rzvhgnbn1gwp0pv5r2lbsnn", + "hash": "sha256-1upFRS77gstfsMs+uH8uffa0fHzQbBKov39NLD3d9Oc=", + "fetchLFS": true, + "fetchSubmodules": false, + "deepClone": false, + "leaveDotGit": false +} diff --git a/packages/art/lotte/updater.nix b/packages/art/lotte/updater.nix new file mode 100644 index 00000000..3b3182eb --- /dev/null +++ b/packages/art/lotte/updater.nix @@ -0,0 +1,15 @@ +{ + nix-prefetch-git, + curl, + jq, +}: +'' + echo "lotte-art: Checking for updates" + set CURRENT_COMMIT $(${curl}/bin/curl https://git.chir.rs/api/v1/repos/darkkirb/lotte-art/commits | ${jq}/bin/jq -r '.[0].sha') + set KNOWN_COMMIT $(${jq}/bin/jq -r '.rev' packages/art/lotte/source.json) + if [ $CURRENT_COMMIT != $KNOWN_COMMIT ]; + echo "lotte-art: Updating from $KNOWN_COMMIT to $CURRENT_COMMIT" + ${nix-prefetch-git}/bin/nix-prefetch-git https://git.chir.rs/darkkirb/lotte-art --fetch-lfs | ${jq}/bin/jq > packages/art/lotte/source.json + end + echo "lotte-art: Done" +'' diff --git a/packages/art/updater.nix b/packages/art/updater.nix new file mode 100644 index 00000000..bf9022bc --- /dev/null +++ b/packages/art/updater.nix @@ -0,0 +1,5 @@ +{ + lib, + callPackage, +}: +lib.concatMapStringsSep "\n" (f: callPackage "${f}/updater.nix" { }) [ ./lotte ] diff --git a/packages/default.nix b/packages/default.nix new file mode 100644 index 00000000..45d21c67 --- /dev/null +++ b/packages/default.nix @@ -0,0 +1,6 @@ +self: super: { + art-lotte = self.callPackage ./art/lotte { }; + art-lotte-bgs-nsfw = self.callPackage ./art/lotte/bgs-nsfw.nix { }; + art-lotte-bgs-sfw = self.callPackage ./art/lotte/bgs-sfw.nix { }; + package-updater = self.callPackage ./updater.nix { }; +} diff --git a/packages/updater.nix b/packages/updater.nix new file mode 100644 index 00000000..443f2898 --- /dev/null +++ b/packages/updater.nix @@ -0,0 +1,13 @@ +{ + lib, + callPackage, + writeScriptBin, + fish, +}: +let + script = lib.concatMapStringsSep "\n" (f: callPackage "${f}/updater.nix" { }) [ ./art ]; +in +writeScriptBin "updater" '' + #!${fish}/bin/fish + ${script} +'' diff --git a/programs/desktop/home-manager.nix b/programs/desktop/home-manager.nix index 3e54f91d..bb7754ef 100644 --- a/programs/desktop/home-manager.nix +++ b/programs/desktop/home-manager.nix @@ -15,7 +15,7 @@ kdePackages.kalk kdePackages.kalgebra kdePackages.filelight - kdePackages.kdegraphics.thumbnailers + kdePackages.kdegraphics-thumbnailers kdePackages.ffmpegthumbs kdePackages.dolphin-plugins ];