From 12365edcf06001cf0d73883eae6a4227cd2a2257 Mon Sep 17 00:00:00 2001 From: Lucas <43530291+LuckShiba@users.noreply.github.com> Date: Thu, 13 Nov 2025 02:26:03 -0300 Subject: [PATCH] flake: update to new monorepo structure (#701) * nix: move alejandra.toml to root * nix: build using local dms cli * workflow: update update-vendor-hash to new structure --- .github/workflows/update-vendor-hash.yml | 18 ++-- quickshell/alejandra.toml => alejandra.toml | 0 flake.lock | 21 ----- flake.nix | 98 ++++++++++++--------- nix/default.nix | 2 +- 5 files changed, 66 insertions(+), 73 deletions(-) rename quickshell/alejandra.toml => alejandra.toml (100%) diff --git a/.github/workflows/update-vendor-hash.yml b/.github/workflows/update-vendor-hash.yml index 0bd9b6d4..21e49ea1 100644 --- a/.github/workflows/update-vendor-hash.yml +++ b/.github/workflows/update-vendor-hash.yml @@ -6,7 +6,7 @@ on: - "core/go.mod" - "core/go.sum" branches: - - NOOP + - master jobs: update-vendor-hash: @@ -20,14 +20,14 @@ jobs: - name: Install Nix uses: cachix/install-nix-action@v31 - - name: Update vendorHash in core/flake.nix + - name: Update vendorHash in flake.nix run: | set -euo pipefail # Try to build and capture the expected hash from error message echo "Attempting nix build to get new vendorHash..." - cd core - if output=$(nix build .#dms-cli 2>&1); then + + if output=$(nix build .#dmsCli 2>&1); then echo "Build succeeded, no hash update needed" exit 0 fi @@ -58,7 +58,7 @@ jobs: # Verify the build works with the new hash echo "Verifying build with new vendorHash..." - nix build .#dms-cli + nix build .#dmsCli echo "vendorHash updated successfully!" @@ -66,12 +66,12 @@ jobs: run: | set -euo pipefail - if ! git diff --quiet core/flake.nix; then + if ! git diff --quiet flake.nix; then git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" - git add core/flake.nix - git commit -m "flake: update vendorHash for go.mod changes" + git add flake.nix + git commit -m "nix: update vendorHash for go.mod changes" for attempt in 1 2 3; do if git push; then @@ -86,5 +86,5 @@ jobs: echo "Failed to push after retries" >&2 exit 1 else - echo "No changes to core/flake.nix" + echo "No changes to flake.nix" fi diff --git a/quickshell/alejandra.toml b/alejandra.toml similarity index 100% rename from quickshell/alejandra.toml rename to alejandra.toml diff --git a/flake.lock b/flake.lock index d42436c8..0738f682 100644 --- a/flake.lock +++ b/flake.lock @@ -20,26 +20,6 @@ "type": "github" } }, - "dms-cli": { - "inputs": { - "nixpkgs": [ - "nixpkgs" - ] - }, - "locked": { - "lastModified": 1762491516, - "narHash": "sha256-oGLH5Gje/p2Hc1kO3m8P5eAZ7JldBI30EmwzEET4cNU=", - "owner": "AvengeMedia", - "repo": "danklinux", - "rev": "050cf28a2963a7698ed4759736fe5fe77eee7cc2", - "type": "github" - }, - "original": { - "owner": "AvengeMedia", - "repo": "danklinux", - "type": "github" - } - }, "nixpkgs": { "locked": { "lastModified": 1762363567, @@ -59,7 +39,6 @@ "root": { "inputs": { "dgop": "dgop", - "dms-cli": "dms-cli", "nixpkgs": "nixpkgs" } } diff --git a/flake.nix b/flake.nix index 2348a5b1..c76f2137 100644 --- a/flake.nix +++ b/flake.nix @@ -7,65 +7,79 @@ url = "github:AvengeMedia/dgop"; inputs.nixpkgs.follows = "nixpkgs"; }; - dms-cli = { - url = "github:AvengeMedia/danklinux"; - inputs.nixpkgs.follows = "nixpkgs"; - }; }; outputs = { self, nixpkgs, dgop, - dms-cli, ... }: let forEachSystem = fn: - nixpkgs.lib.genAttrs - ["aarch64-darwin" "aarch64-linux" "x86_64-darwin" "x86_64-linux"] - (system: fn system nixpkgs.legacyPackages.${system}); + nixpkgs.lib.genAttrs ["aarch64-darwin" "aarch64-linux" "x86_64-darwin" "x86_64-linux"] ( + system: fn system nixpkgs.legacyPackages.${system} + ); buildDmsPkgs = pkgs: { - dmsCli = dms-cli.packages.${pkgs.stdenv.hostPlatform.system}.default; + dmsCli = self.packages.${pkgs.stdenv.hostPlatform.system}.dmsCli; dgop = dgop.packages.${pkgs.stdenv.hostPlatform.system}.dgop; dankMaterialShell = self.packages.${pkgs.stdenv.hostPlatform.system}.dankMaterialShell; }; in { formatter = forEachSystem (_: pkgs: pkgs.alejandra); - packages = forEachSystem (system: pkgs: { - dankMaterialShell = let - mkDate = longDate: pkgs.lib.concatStringsSep "-" [ - (builtins.substring 0 4 longDate) - (builtins.substring 4 2 longDate) - (builtins.substring 6 2 longDate) - ]; - in pkgs.stdenvNoCC.mkDerivation { - pname = "dankMaterialShell"; - version = pkgs.lib.removePrefix "v" (pkgs.lib.trim (builtins.readFile ./quickshell/VERSION)) - + "+date=" + mkDate (self.lastModifiedDate or "19700101") - + "_" + (self.shortRev or "dirty"); - src = pkgs.lib.cleanSourceWith { - src = ./.; - filter = path: type: - !(builtins.any (prefix: pkgs.lib.path.hasPrefix (./. + prefix) (/. + path)) [ - /.github - /.gitignore - /dms.spec - /dms-greeter.spec - /nix - /flake.nix - /flake.lock - /alejandra.toml - ]); - }; - installPhase = '' - mkdir -p $out/etc/xdg/quickshell - cp -r ./quickshell $out/etc/xdg/quickshell/dms - ''; - }; + packages = forEachSystem ( + system: pkgs: let + mkDate = longDate: + pkgs.lib.concatStringsSep "-" [ + (builtins.substring 0 4 longDate) + (builtins.substring 4 2 longDate) + (builtins.substring 6 2 longDate) + ]; + version = + pkgs.lib.removePrefix "v" (pkgs.lib.trim (builtins.readFile ./quickshell/VERSION)) + + "+date=" + + mkDate (self.lastModifiedDate or "19700101") + + "_" + + (self.shortRev or "dirty"); + in { + dmsCli = pkgs.buildGoModule (finalAttrs: { + inherit version; - default = self.packages.${system}.dankMaterialShell; - }); + pname = "dmsCli"; + src = ./core; + vendorHash = "sha256-XbCg6qQwD4g4R/hBReLGE4NOq9uv0LBqogmfpBs//Ic="; + + subPackages = ["cmd/dms"]; + + ldflags = [ + "-s" + "-w" + "-X main.Version=${finalAttrs.version}" + ]; + + meta = { + description = "DankMaterialShell Command Line Interface"; + homepage = "https://github.com/AvengeMedia/danklinux"; + mainProgram = "dms"; + license = pkgs.lib.licenses.mit; + platforms = pkgs.lib.platforms.unix; + }; + }); + + dankMaterialShell = pkgs.stdenvNoCC.mkDerivation { + inherit version; + + pname = "dankMaterialShell"; + src = ./quickshell; + installPhase = '' + mkdir -p $out/etc/xdg/quickshell + cp -r ./ $out/etc/xdg/quickshell/dms + ''; + }; + + default = self.packages.${system}.dmsCli; + } + ); homeModules.dankMaterialShell.default = {pkgs, ...}: let dmsPkgs = buildDmsPkgs pkgs; diff --git a/nix/default.nix b/nix/default.nix index 5b81ae0e..da82c607 100644 --- a/nix/default.nix +++ b/nix/default.nix @@ -122,7 +122,7 @@ in { }; Service = { - ExecStart = lib.getExe dmsPkgs.dmsCli + " run"; + ExecStart = lib.getExe dmsPkgs.dmsCli + " run --session"; Restart = "on-failure"; };