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.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

21
flake.lock generated
View File

@@ -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"
}
}

View File

@@ -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;

View File

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