dotfiles/flake.nix

263 lines
8.8 KiB
Nix
Raw Normal View History

2025-09-09 18:03:42 +02:00
{
description = "A very basic flake";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
2025-09-12 19:23:10 +02:00
flake-parts.url = "github:hercules-ci/flake-parts";
2025-09-09 18:03:42 +02:00
c3d2-user-module.url = "git+https://gitea.c3d2.de/C3D2/nix-user-module.git";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
niri.url = "github:sodiboo/niri-flake";
nixos-hardware.url = "github:NixOS/nixos-hardware/master";
treefmt-nix = {
url = "github:numtide/treefmt-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
determinate.url = "https://flakehub.com/f/DeterminateSystems/determinate/*";
2025-09-09 18:21:35 +02:00
comin = {
url = "github:nlewo/comin";
inputs.nixpkgs.follows = "nixpkgs";
};
2025-09-09 18:38:16 +02:00
stylix = {
url = "github:nix-community/stylix";
inputs.nixpkgs.follows = "nixpkgs";
};
2025-09-09 23:43:59 +02:00
musnix.url = "github:musnix/musnix";
nix-mineral = {
url = "github:cynicsketch/nix-mineral";
flake = false;
};
2025-09-10 02:21:10 +02:00
mobile-nixos = {
url = "github:vlinkz/mobile-nixos/sdm845-6.14";
flake = false;
};
gnome-mobile.url = "github:chuangzhu/nixpkgs-gnome-mobile";
nix-flatpak.url = "github:gmodena/nix-flatpak";
2025-09-09 18:03:42 +02:00
};
outputs =
2025-09-12 19:23:10 +02:00
inputs@{ flake-parts, ... }:
flake-parts.lib.mkFlake { inherit inputs; } {
# Define supported systems
systems = [
"x86_64-linux"
"aarch64-linux"
];
2025-09-09 18:03:42 +02:00
2025-09-12 19:23:10 +02:00
imports = [
inputs.treefmt-nix.flakeModule
];
2025-09-09 18:03:42 +02:00
2025-09-12 19:23:10 +02:00
# 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;
};
2025-09-09 23:43:59 +02:00
2025-09-12 19:23:10 +02:00
settings = {
global.excludes = [
"*.lock"
"result"
".git/"
"*.md"
"*.sh"
"*.py"
"*.js"
"*.ts"
];
};
2025-09-09 23:43:59 +02:00
};
2025-09-09 21:20:12 +02:00
2025-09-12 19:23:10 +02:00
# 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";
2025-09-09 23:43:59 +02:00
2025-09-12 19:23:10 +02:00
src = pkgs.fetchzip {
url = "https://www.rw-designer.com/cursor-downloadset/hello-kitty.zip";
sha256 = "sha256-p4US/gftDL0ne4l0dHUIKKZy2oibkOqdJ3fMisySnNM=";
stripRoot = false;
};
2025-09-09 23:43:59 +02:00
2025-09-12 19:23:10 +02:00
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
2025-09-09 21:20:12 +02:00
2025-09-12 19:23:10 +02:00
# 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
'';
2025-09-09 21:20:12 +02:00
2025-09-12 19:23:10 +02:00
meta = with lib; {
description = "Hello Kitty Cursor theme";
homepage = "https://www.rw-designer.com/cursor-downloadset/hello-kitty.zip";
license = licenses.gpl2Only;
};
};
2025-09-09 21:20:12 +02:00
2025-09-12 19:23:10 +02:00
wallpapers = pkgs.stdenv.mkDerivation {
name = "wallpapers";
src = ./assets;
2025-09-09 21:20:12 +02:00
2025-09-12 19:23:10 +02:00
buildInputs = with pkgs; [ ffmpeg ];
2025-09-09 19:50:59 +02:00
2025-09-12 19:23:10 +02:00
buildPhase = ''
# Create output directory
mkdir -p $out/share/wallpapers
2025-09-09 21:20:12 +02:00
2025-09-12 19:23:10 +02:00
# Copy static wallpaper
cp "wp6553608.jpg" "$out/share/wallpapers/static-wallpaper.jpg"
2025-09-09 23:43:59 +02:00
2025-09-12 19:23:10 +02:00
# 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"
2025-09-09 23:43:59 +02:00
2025-09-12 19:23:10 +02:00
# 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"
'';
2025-09-09 23:43:59 +02:00
2025-09-12 19:23:10 +02:00
installPhase = ''
# Files are already in the right place from buildPhase
echo "Wallpapers installed to $out/share/wallpapers"
'';
2025-09-10 02:21:10 +02:00
2025-09-12 19:23:10 +02:00
meta = with lib; {
description = "Personal wallpaper collection";
platforms = platforms.linux;
};
};
};
2025-09-10 02:21:10 +02:00
2025-09-12 19:23:10 +02:00
# Development shell
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
git
];
2025-09-10 02:21:10 +02:00
2025-09-12 19:23:10 +02:00
shellHook = ''
echo "Development shell loaded!"
echo "Run 'nix fmt' to format all files"
'';
};
# Formatting check
checks.formatting = config.treefmt.build.check inputs.self;
2025-09-10 02:21:10 +02:00
};
2025-09-09 18:03:42 +02:00
2025-09-12 19:23:10 +02:00
# 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";
})
];
};
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
2025-09-10 02:21:10 +02:00
2025-09-12 19:23:10 +02:00
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
];
2025-09-09 18:03:42 +02:00
2025-09-12 19:23:10 +02:00
home.packages = [
inputs.self.packages.${pkgs.system}.wallpapers
];
2025-09-09 18:03:42 +02:00
2025-09-12 19:23:10 +02:00
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";
};
};
}
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
];
};
};
2025-09-09 18:03:42 +02:00
2025-09-12 19:23:10 +02:00
inherit (inputs.self.nixosConfigurations)
fajita-fastboot-images
fajita-minimal-image
uefi-x86_64-image
;
2025-09-09 18:03:42 +02:00
};
};
}