This commit is contained in:
Lucy von Overheidt 2025-09-12 19:23:10 +02:00
parent 201f76f230
commit 81ada8b9f7
7 changed files with 283 additions and 421 deletions

423
flake.nix
View file

@ -3,6 +3,7 @@
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
c3d2-user-module.url = "git+https://gitea.c3d2.de/C3D2/nix-user-module.git";
home-manager = {
url = "github:nix-community/home-manager";
@ -37,229 +38,225 @@
};
outputs =
inputs@{
self,
nixpkgs,
c3d2-user-module,
home-manager,
niri,
nixos-hardware,
treefmt-nix,
determinate,
stylix,
comin,
musnix,
nix-mineral,
mobile-nixos,
gnome-mobile,
nix-flatpak,
}:
let
system = "x86_64-linux";
pkgs = import nixpkgs { inherit system; };
lib = pkgs.lib;
inputs@{ flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
# Define supported systems
systems = [
"x86_64-linux"
"aarch64-linux"
];
# Configure treefmt
treefmtEval = treefmt-nix.lib.evalModule pkgs {
projectRootFile = "flake.nix";
programs = {
nixpkgs-fmt.enable = true;
prettier = {
enable = true;
includes = [
"*.json"
"*.yaml"
"*.yml"
imports = [
inputs.treefmt-nix.flakeModule
];
# Per-system configuration
perSystem =
{
config,
pkgs,
lib,
...
}:
{
# Configure treefmt
treefmt = {
projectRootFile = "flake.nix";
programs = {
nixpkgs-fmt.enable = true;
prettier = {
enable = true;
includes = [
"*.json"
"*.yaml"
"*.yml"
];
};
taplo.enable = true;
};
settings = {
global.excludes = [
"*.lock"
"result"
".git/"
"*.md"
"*.sh"
"*.py"
"*.js"
"*.ts"
];
};
};
# Packages
packages = let cutieMobileImages = inputs.self.nixosConfigurations.cutie.config.mobile.outputs.android.android-fastboot-images; in {
default = cutieMobileImages;
cutie-mobile-images =
inputs.self.nixosConfigurations.cutie.config.mobile.outputs.android.android-fastboot-images;
hello-kitty-cursors = pkgs.stdenv.mkDerivation {
pname = "hello-kitty-cursors";
version = "1.0.0";
src = pkgs.fetchzip {
url = "https://www.rw-designer.com/cursor-downloadset/hello-kitty.zip";
sha256 = "sha256-p4US/gftDL0ne4l0dHUIKKZy2oibkOqdJ3fMisySnNM=";
stripRoot = false;
};
installPhase = ''
mkdir -p $out/share/icons/HelloKitty
for file in ${inputs.self}/cursors/*; do
if [ -e "$file" ]; then
cp "$file" "$out/share/icons/HelloKitty/"
else
echo "Warning: File $file does not exist."
fi
done
# Adjust the path to index.theme if necessary
if [ -e "${inputs.self}/index.theme" ]; then
cp "${inputs.self}/index.theme" "$out/share/icons/HelloKitty/"
else
echo "Warning: index.theme does not exist."
fi
'';
meta = with lib; {
description = "Hello Kitty Cursor theme";
homepage = "https://www.rw-designer.com/cursor-downloadset/hello-kitty.zip";
license = licenses.gpl2Only;
};
};
wallpapers = pkgs.stdenv.mkDerivation {
name = "wallpapers";
src = ./assets;
buildInputs = with pkgs; [ ffmpeg ];
buildPhase = ''
# Create output directory
mkdir -p $out/share/wallpapers
# Copy static wallpaper
cp "wp6553608.jpg" "$out/share/wallpapers/static-wallpaper.jpg"
# Copy original animated wallpaper
cp "Anime Live Wallpaper - Anime Cat Girl Snow - HD - no copyright [SiMc3l0ido0].mp4" \
"$out/share/wallpapers/anime-cat-girl-snow.mp4"
# Create optimized version
${pkgs.ffmpeg}/bin/ffmpeg -i "Anime Live Wallpaper - Anime Cat Girl Snow - HD - no copyright [SiMc3l0ido0].mp4" \
-vf "scale=1920:1080:force_original_aspect_ratio=increase,crop=1920:1080" \
-r 30 -c:v libx264 -crf 28 -preset medium \
-t 30 -an "$out/share/wallpapers/anime-cat-girl-snow-optimized.mp4"
'';
installPhase = ''
# Files are already in the right place from buildPhase
echo "Wallpapers installed to $out/share/wallpapers"
'';
meta = with lib; {
description = "Personal wallpaper collection";
platforms = platforms.linux;
};
};
};
# Development shell
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
git
];
shellHook = ''
echo "Development shell loaded!"
echo "Run 'nix fmt' to format all files"
'';
};
# Formatting check
checks.formatting = config.treefmt.build.check inputs.self;
};
# Flake-level configuration (not per-system)
flake = {
# NixOS configurations
nixosConfigurations = {
cutie = inputs.nixpkgs.lib.nixosSystem {
system = "aarch64-linux";
modules = [
./hosts/cutie/configuration.nix
inputs.gnome-mobile.nixosModules.gnome-mobile
inputs.nix-flatpak.nixosModules.nix-flatpak
(import "${inputs.mobile-nixos}/lib/configuration.nix" {
device = "oneplus-fajita";
})
];
};
taplo.enable = true;
};
settings = {
global.excludes = [
"*.lock"
"result"
".git/"
"*.md"
"*.sh"
"*.py"
"*.js"
"*.ts"
];
};
};
in
{
packages.${system} = {
hello-kitty-cursors = pkgs.stdenv.mkDerivation {
pname = "hello-kitty-cursors";
version = "1.0.0";
p50 = inputs.nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs; };
system = "x86_64-linux";
modules = [
"${inputs.nix-mineral}/nix-mineral.nix"
inputs.niri.nixosModules.niri
inputs.nixos-hardware.nixosModules.lenovo-thinkpad-p50
./hosts/p50/configuration.nix
inputs.determinate.nixosModules.default
inputs.musnix.nixosModules.musnix
src = pkgs.fetchzip {
url = "https://www.rw-designer.com/cursor-downloadset/hello-kitty.zip";
sha256 = "sha256-p4US/gftDL0ne4l0dHUIKKZy2oibkOqdJ3fMisySnNM="; # Replace with the actual hash of the zip file
stripRoot = false;
};
inputs.home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.backupFileExtension = "backup";
home-manager.extraSpecialArgs = { inherit inputs; };
home-manager.users.lucy =
{ pkgs, inputs, ... }:
{
imports = [
./modules/home.nix
./modules/bottom.nix
./modules/htop.nix
];
installPhase = ''
mkdir -p $out/share/icons/HelloKitty
for file in ${self}/cursors/*; do
if [ -e "$file" ]; then
cp "$file" "$out/share/icons/HelloKitty/"
else
echo "Warning: File $file does not exist."
fi
done
# Adjust the path to index.theme if necessary
if [ -e "${self}/index.theme" ]; then
cp "${self}/index.theme" "$out/share/icons/HelloKitty/"
else
echo "Warning: index.theme does not exist."
fi
'';
meta = with nixpkgs.lib; {
description = "Hello Kitty Cursor theme";
homepage = "https://www.rw-designer.com/cursor-downloadset/hello-kitty.zip";
license = licenses.gpl2Only;
maintainers = with maintainers; [ your-maintainer-name ]; # Replace with your name
};
};
wallpapers = pkgs.stdenv.mkDerivation {
name = "wallpapers";
src = ./assets;
buildInputs = with pkgs; [ ffmpeg ];
buildPhase = ''
# Create output directory
mkdir -p $out/share/wallpapers
# Copy static wallpaper
cp "wp6553608.jpg" "$out/share/wallpapers/static-wallpaper.jpg"
# Copy original animated wallpaper
cp "Anime Live Wallpaper - Anime Cat Girl Snow - HD - no copyright [SiMc3l0ido0].mp4" \
"$out/share/wallpapers/anime-cat-girl-snow.mp4"
# Create optimized version
${pkgs.ffmpeg}/bin/ffmpeg -i "Anime Live Wallpaper - Anime Cat Girl Snow - HD - no copyright [SiMc3l0ido0].mp4" \
-vf "scale=1920:1080:force_original_aspect_ratio=increase,crop=1920:1080" \
-r 30 -c:v libx264 -crf 28 -preset medium \
-t 30 -an "$out/share/wallpapers/anime-cat-girl-snow-optimized.mp4"
'';
installPhase = ''
# Files are already in the right place from buildPhase
echo "Wallpapers installed to $out/share/wallpapers"
'';
meta = with lib; {
description = "Personal wallpaper collection";
platforms = platforms.linux;
};
};
};
nixosConfigurations = {
cutie = nixpkgs.lib.nixosSystem {
system = "aarch64-linux";
modules = [
./hosts/cutie/configuration.nix
gnome-mobile.nixosModules.gnome-mobile
nix-flatpak.nixosModules.nix-flatpak
(import "${mobile-nixos}/lib/configuration.nix" {
device = "oneplus-fajita";
})
];
};
p50 = nixpkgs.lib.nixosSystem {
specialArgs = { inherit inputs; };
system = "x86_64-linux";
modules = [
"${nix-mineral}/nix-mineral.nix"
niri.nixosModules.niri
nixos-hardware.nixosModules.lenovo-thinkpad-p50
./hosts/p50/configuration.nix
determinate.nixosModules.default
musnix.nixosModules.musnix
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.backupFileExtension = "backup";
home-manager.extraSpecialArgs = { inherit inputs; };
home-manager.users.lucy =
{
pkgs,
inputs,
...
}:
{
imports = [
./modules/home.nix
./modules/bottom.nix
./modules/htop.nix
];
home.packages = with pkgs; [
inputs.self.packages.${pkgs.system}.wallpapers
];
home.file = {
".local/share/wallpapers/anime-cat-girl-snow.mp4".source = "${
home.packages = [
inputs.self.packages.${pkgs.system}.wallpapers
}/share/wallpapers/anime-cat-girl-snow.mp4";
".local/share/wallpapers/static-wallpaper.jpg".source = "${
inputs.self.packages.${pkgs.system}.wallpapers
}/share/wallpapers/static-wallpaper.jpg";
".local/share/wallpapers/anime-cat-girl-snow-optimized.mp4".source = "${
inputs.self.packages.${pkgs.system}.wallpapers
}/share/wallpapers/anime-cat-girl-snow-optimized.mp4";
];
home.file = {
".local/share/wallpapers/anime-cat-girl-snow.mp4".source = "${
inputs.self.packages.${pkgs.system}.wallpapers
}/share/wallpapers/anime-cat-girl-snow.mp4";
".local/share/wallpapers/static-wallpaper.jpg".source = "${
inputs.self.packages.${pkgs.system}.wallpapers
}/share/wallpapers/static-wallpaper.jpg";
".local/share/wallpapers/anime-cat-girl-snow-optimized.mp4".source = "${
inputs.self.packages.${pkgs.system}.wallpapers
}/share/wallpapers/anime-cat-girl-snow-optimized.mp4";
};
};
};
}
c3d2-user-module.nixosModule
./modules/nix.nix
./modules/fonts.nix
comin.nixosModules.comin
./modules/comin.nix
stylix.nixosModules.stylix
./modules/stylix.nix
./modules/firefox-nixos.nix
];
}
inputs.c3d2-user-module.nixosModule
./modules/nix.nix
./modules/fonts.nix
inputs.comin.nixosModules.comin
./modules/comin.nix
inputs.stylix.nixosModules.stylix
./modules/stylix.nix
./modules/firefox-nixos.nix
];
};
};
};
fajita-fastboot-images =
inputs.self.nixosConfigurations.fajita.config.mobile.outputs.android.android-fastboot-images;
fajita-minimal-image =
inputs.self.nixosConfigurations.fajita_minimal.config.mobile.outputs.android.android-fastboot-images;
uefi-x86_64-image = inputs.self.nixosConfigurations.uefi-x86_64.config.mobile.outputs.default;
# Add treefmt formatter
formatter.${system} = treefmtEval.config.build.wrapper;
# Optional: Add a dev shell with treefmt
devShells.${system}.default = pkgs.mkShell {
buildInputs = with pkgs; [
git
treefmtEval.config.build.wrapper
];
shellHook = ''
echo "Development shell loaded!"
echo "Run 'nix fmt' to format all files"
echo "Run 'treefmt' to format with treefmt directly"
'';
};
# Optional: Add formatting check
checks.${system} = {
formatting = treefmtEval.config.build.check self;
inherit (inputs.self.nixosConfigurations)
fajita-fastboot-images
fajita-minimal-image
uefi-x86_64-image
;
};
};
}