1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2025-12-05 21:15:38 -05:00

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
This commit is contained in:
Lucas
2025-11-13 02:26:03 -03:00
committed by GitHub
parent 5efc1f9dad
commit 12365edcf0
5 changed files with 66 additions and 73 deletions

View File

@@ -6,7 +6,7 @@ on:
- "core/go.mod" - "core/go.mod"
- "core/go.sum" - "core/go.sum"
branches: branches:
- NOOP - master
jobs: jobs:
update-vendor-hash: update-vendor-hash:
@@ -20,14 +20,14 @@ jobs:
- name: Install Nix - name: Install Nix
uses: cachix/install-nix-action@v31 uses: cachix/install-nix-action@v31
- name: Update vendorHash in core/flake.nix - name: Update vendorHash in flake.nix
run: | run: |
set -euo pipefail set -euo pipefail
# Try to build and capture the expected hash from error message # Try to build and capture the expected hash from error message
echo "Attempting nix build to get new vendorHash..." 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" echo "Build succeeded, no hash update needed"
exit 0 exit 0
fi fi
@@ -58,7 +58,7 @@ jobs:
# Verify the build works with the new hash # Verify the build works with the new hash
echo "Verifying build with new vendorHash..." echo "Verifying build with new vendorHash..."
nix build .#dms-cli nix build .#dmsCli
echo "vendorHash updated successfully!" echo "vendorHash updated successfully!"
@@ -66,12 +66,12 @@ jobs:
run: | run: |
set -euo pipefail 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.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com" git config user.email "github-actions[bot]@users.noreply.github.com"
git add core/flake.nix git add flake.nix
git commit -m "flake: update vendorHash for go.mod changes" git commit -m "nix: update vendorHash for go.mod changes"
for attempt in 1 2 3; do for attempt in 1 2 3; do
if git push; then if git push; then
@@ -86,5 +86,5 @@ jobs:
echo "Failed to push after retries" >&2 echo "Failed to push after retries" >&2
exit 1 exit 1
else else
echo "No changes to core/flake.nix" echo "No changes to flake.nix"
fi fi

21
flake.lock generated
View File

@@ -20,26 +20,6 @@
"type": "github" "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": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1762363567, "lastModified": 1762363567,
@@ -59,7 +39,6 @@
"root": { "root": {
"inputs": { "inputs": {
"dgop": "dgop", "dgop": "dgop",
"dms-cli": "dms-cli",
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs"
} }
} }

View File

@@ -7,65 +7,79 @@
url = "github:AvengeMedia/dgop"; url = "github:AvengeMedia/dgop";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
dms-cli = {
url = "github:AvengeMedia/danklinux";
inputs.nixpkgs.follows = "nixpkgs";
};
}; };
outputs = { outputs = {
self, self,
nixpkgs, nixpkgs,
dgop, dgop,
dms-cli,
... ...
}: let }: let
forEachSystem = fn: forEachSystem = fn:
nixpkgs.lib.genAttrs nixpkgs.lib.genAttrs ["aarch64-darwin" "aarch64-linux" "x86_64-darwin" "x86_64-linux"] (
["aarch64-darwin" "aarch64-linux" "x86_64-darwin" "x86_64-linux"] system: fn system nixpkgs.legacyPackages.${system}
(system: fn system nixpkgs.legacyPackages.${system}); );
buildDmsPkgs = pkgs: { 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; dgop = dgop.packages.${pkgs.stdenv.hostPlatform.system}.dgop;
dankMaterialShell = self.packages.${pkgs.stdenv.hostPlatform.system}.dankMaterialShell; dankMaterialShell = self.packages.${pkgs.stdenv.hostPlatform.system}.dankMaterialShell;
}; };
in { in {
formatter = forEachSystem (_: pkgs: pkgs.alejandra); formatter = forEachSystem (_: pkgs: pkgs.alejandra);
packages = forEachSystem (system: pkgs: { packages = forEachSystem (
dankMaterialShell = let system: pkgs: let
mkDate = longDate: pkgs.lib.concatStringsSep "-" [ mkDate = longDate:
pkgs.lib.concatStringsSep "-" [
(builtins.substring 0 4 longDate) (builtins.substring 0 4 longDate)
(builtins.substring 4 2 longDate) (builtins.substring 4 2 longDate)
(builtins.substring 6 2 longDate) (builtins.substring 6 2 longDate)
]; ];
in pkgs.stdenvNoCC.mkDerivation { version =
pname = "dankMaterialShell"; pkgs.lib.removePrefix "v" (pkgs.lib.trim (builtins.readFile ./quickshell/VERSION))
version = pkgs.lib.removePrefix "v" (pkgs.lib.trim (builtins.readFile ./quickshell/VERSION)) + "+date="
+ "+date=" + mkDate (self.lastModifiedDate or "19700101") + mkDate (self.lastModifiedDate or "19700101")
+ "_" + (self.shortRev or "dirty"); + "_"
src = pkgs.lib.cleanSourceWith { + (self.shortRev or "dirty");
src = ./.; in {
filter = path: type: dmsCli = pkgs.buildGoModule (finalAttrs: {
!(builtins.any (prefix: pkgs.lib.path.hasPrefix (./. + prefix) (/. + path)) [ inherit version;
/.github
/.gitignore pname = "dmsCli";
/dms.spec src = ./core;
/dms-greeter.spec vendorHash = "sha256-XbCg6qQwD4g4R/hBReLGE4NOq9uv0LBqogmfpBs//Ic=";
/nix
/flake.nix subPackages = ["cmd/dms"];
/flake.lock
/alejandra.toml 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 = '' installPhase = ''
mkdir -p $out/etc/xdg/quickshell mkdir -p $out/etc/xdg/quickshell
cp -r ./quickshell $out/etc/xdg/quickshell/dms cp -r ./ $out/etc/xdg/quickshell/dms
''; '';
}; };
default = self.packages.${system}.dankMaterialShell; default = self.packages.${system}.dmsCli;
}); }
);
homeModules.dankMaterialShell.default = {pkgs, ...}: let homeModules.dankMaterialShell.default = {pkgs, ...}: let
dmsPkgs = buildDmsPkgs pkgs; dmsPkgs = buildDmsPkgs pkgs;

View File

@@ -122,7 +122,7 @@ in {
}; };
Service = { Service = {
ExecStart = lib.getExe dmsPkgs.dmsCli + " run"; ExecStart = lib.getExe dmsPkgs.dmsCli + " run --session";
Restart = "on-failure"; Restart = "on-failure";
}; };