diff options
| author | Soramane <61896496+soramanew@users.noreply.github.com> | 2025-07-15 17:16:53 +1000 |
|---|---|---|
| committer | Soramane <61896496+soramanew@users.noreply.github.com> | 2025-07-15 17:16:53 +1000 |
| commit | ca93616da717f865cf708d1cf26d6964e4231d90 (patch) | |
| tree | efc8a110b8dd50881356e7a65a217660a39694a8 | |
| parent | theme: use dconf instead of gsettings (diff) | |
| download | caelestia-cli-ca93616da717f865cf708d1cf26d6964e4231d90.tar.gz caelestia-cli-ca93616da717f865cf708d1cf26d6964e4231d90.tar.bz2 caelestia-cli-ca93616da717f865cf708d1cf26d6964e4231d90.zip | |
feat: add nix flake
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | default.nix | 82 | ||||
| -rw-r--r-- | flake.lock | 48 | ||||
| -rw-r--r-- | flake.nix | 40 |
4 files changed, 171 insertions, 0 deletions
@@ -1,2 +1,3 @@ __pycache__/ /dist/ +/result diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..904b22d --- /dev/null +++ b/default.nix @@ -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; + }; +} diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..8c73182 --- /dev/null +++ b/flake.lock @@ -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 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..b1bfe58 --- /dev/null +++ b/flake.nix @@ -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]; + # }; + # }); + }; +} |