feat: add nix flake

This commit is contained in:
Soramane
2025-07-15 17:16:53 +10:00
parent 4b666a797e
commit ca93616da7
4 changed files with 171 additions and 0 deletions
+1
View File
@@ -1,2 +1,3 @@
__pycache__/ __pycache__/
/dist/ /dist/
/result
+82
View File
@@ -0,0 +1,82 @@
{
rev,
lib,
python3,
installShellFiles,
swappy,
libnotify,
slurp,
wl-clipboard,
cliphist,
app2unit,
dart-sass,
grim,
fuzzel,
wl-screenrec,
dconf,
killall,
discordBin ? "discord",
qtctStyle ? "Fusion",
}:
python3.pkgs.buildPythonApplication {
pname = "caelestia-cli";
version = "${rev}";
src = ./.;
pyproject = true;
build-system = with python3.pkgs; [
hatch-vcs
hatchling
];
dependencies = with python3.pkgs; [
materialyoucolor
pillow
];
pythonImportsCheck = ["caelestia"];
nativeBuildInputs = [installShellFiles];
propagatedBuildInputs = [
swappy
libnotify
slurp
wl-clipboard
cliphist
app2unit
dart-sass
grim
fuzzel
wl-screenrec
dconf
killall
];
SETUPTOOLS_SCM_PRETEND_VERSION = 1;
patchPhase = ''
# Replace qs config call with nix shell pkg bin
substituteInPlace src/caelestia/subcommands/shell.py \
--replace-fail '"qs", "-c", "caelestia"' '"caelestia-shell"'
substituteInPlace src/caelestia/subcommands/screenshot.py \
--replace-fail '"qs", "-c", "caelestia"' '"caelestia-shell"'
# Use config bin instead of discord
substituteInPlace src/caelestia/subcommands/toggle.py \
--replace-fail 'discord' ${discordBin}
# Use config style instead of fusion
substituteInPlace src/caelestia/data/templates/qtct.conf \
--replace-fail 'Fusion' '${qtctStyle}'
'';
postInstall = "installShellCompletion completions/caelestia.fish";
meta = {
description = "The main control script for the Caelestia dotfiles";
homepage = "https://github.com/caelestia-dots/cli";
license = lib.licenses.gpl3Only;
mainProgram = "caelestia";
platforms = lib.platforms.all;
};
}
Generated
+48
View File
@@ -0,0 +1,48 @@
{
"nodes": {
"app2unit": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1752557494,
"narHash": "sha256-GIcH+k321WBUl//gBypaJkLRMrKDemcSpzADJoyUdec=",
"owner": "soramanew",
"repo": "app2unit",
"rev": "574d764446997e30218a29a6b9871fb1b9c6554d",
"type": "github"
},
"original": {
"owner": "soramanew",
"repo": "app2unit",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1752480373,
"narHash": "sha256-JHQbm+OcGp32wAsXTE/FLYGNpb+4GLi5oTvCxwSoBOA=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "62e0f05ede1da0d54515d4ea8ce9c733f12d9f08",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"app2unit": "app2unit",
"nixpkgs": "nixpkgs"
}
}
},
"root": "root",
"version": 7
}
+40
View File
@@ -0,0 +1,40 @@
{
description = "CLI for Caelestia dots";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
app2unit = {
url = "github:soramanew/app2unit";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = {
self,
nixpkgs,
...
} @ inputs: let
forAllSystems = fn:
nixpkgs.lib.genAttrs nixpkgs.lib.platforms.linux (
system: fn nixpkgs.legacyPackages.${system}
);
in {
formatter = forAllSystems (pkgs: pkgs.alejandra);
packages = forAllSystems (pkgs: rec {
caelestia-cli = pkgs.callPackage ./default.nix {
rev = self.rev or self.dirtyRev;
app2unit = inputs.app2unit.packages.${pkgs.system}.default;
};
default = caelestia-cli;
});
# devShells = forAllSystems (pkgs: {
# default = pkgs.mkShellNoCC {
# inputsFrom = [self.packages.${pkgs.system}.caelestia-cli];
# packages = [inputs.caelestia-shell.packages.${pkgs.system}.default];
# };
# });
};
}