generated from stubbfel/nix-project-template
add run pkgs script
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1 +1,2 @@
|
|||||||
result
|
result
|
||||||
|
*.zst
|
||||||
8
flake.lock
generated
8
flake.lock
generated
@@ -2,16 +2,16 @@
|
|||||||
"nodes": {
|
"nodes": {
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1668595291,
|
"lastModified": 1686059680,
|
||||||
"narHash": "sha256-j8cyfbtT5sAYPYwbERgTDzfD48ZernL0/V668eGpXAM=",
|
"narHash": "sha256-sp0WlCIeVczzB0G8f8iyRg3IYW7KG31mI66z7HIZwrI=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "6474d93e007e4d165bcf48e7f87de2175c93d10b",
|
"rev": "a558f7ac29f50c4b937fb5c102f587678ae1c9fb",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"id": "nixpkgs",
|
"id": "nixpkgs",
|
||||||
"ref": "nixos-22.05-small",
|
"ref": "nixos-23.05",
|
||||||
"type": "indirect"
|
"type": "indirect"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
55
flake.nix
55
flake.nix
@@ -3,7 +3,7 @@
|
|||||||
With `patch-manjaro-sway-mirror-for-arm`, users can easily observe the `/usr/bin/manjaro-sway-mirrors` file for changes and automatically execute a sed command to modify its contents.
|
With `patch-manjaro-sway-mirror-for-arm`, users can easily observe the `/usr/bin/manjaro-sway-mirrors` file for changes and automatically execute a sed command to modify its contents.
|
||||||
This ensures that the desired mirror configuration, specifically changing the output of `$(pacman-mirrors -G)` from "arm-stable" to "stable," is consistently maintained
|
This ensures that the desired mirror configuration, specifically changing the output of `$(pacman-mirrors -G)` from "arm-stable" to "stable," is consistently maintained
|
||||||
'';
|
'';
|
||||||
inputs.nixpkgs.url = "nixpkgs/nixos-22.05-small";
|
inputs.nixpkgs.url = "nixpkgs/nixos-23.05";
|
||||||
|
|
||||||
outputs = { self, nixpkgs }:
|
outputs = { self, nixpkgs }:
|
||||||
let
|
let
|
||||||
@@ -12,24 +12,52 @@
|
|||||||
supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
|
supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ];
|
||||||
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
|
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
|
||||||
nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; });
|
nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; });
|
||||||
|
packages = forAllSystems (system: rec
|
||||||
|
{
|
||||||
|
default = nixpkgsFor.${system}.stdenv.mkDerivation {
|
||||||
|
name = name;
|
||||||
|
src = self;
|
||||||
|
buildPhase = "";
|
||||||
|
installPhase = "mkdir -p $out/bin; install -t $out/bin src/patch-manjaro-sway-mirror-for-arm.sh";
|
||||||
|
};
|
||||||
|
pkgbuildFile = nixpkgsFor.${system}.writeTextFile {
|
||||||
|
name = "PKGBUILD";
|
||||||
|
text = ''
|
||||||
|
pkgname=patch-manjaro-sway-mirror-for-arm.sh
|
||||||
|
pkgver=${version}
|
||||||
|
pkgrel=1
|
||||||
|
pkgdesc="Monitors and updates manjaro-sway-mirrors"
|
||||||
|
arch=('any')
|
||||||
|
license=('MIT')
|
||||||
|
depends=()
|
||||||
|
|
||||||
|
package() {
|
||||||
|
install -Dm755 ${default.src}/src/patch-manjaro-sway-mirror-for-arm.sh "''${pkgdir}/usr/bin/patch-manjaro-sway-mirror-for-arm.sh"
|
||||||
|
}
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
buildScriptdFile = nixpkgsFor.${system}.writeShellScript "build-package.sh" ''
|
||||||
|
temp_folder=$(mktemp -d)
|
||||||
|
|
||||||
|
pushd "$temp_folder"
|
||||||
|
cp "${pkgbuildFile}" PKGBUILD
|
||||||
|
${nixpkgsFor.${system}.pacman}/bin/makepkg -s
|
||||||
|
popd
|
||||||
|
|
||||||
|
find "$temp_folder" -name *.zst -exec mv -f {} . \;
|
||||||
|
rm -rf "$temp_folder"
|
||||||
|
'';
|
||||||
|
});
|
||||||
devTaskScripts = forAllSystems (system:
|
devTaskScripts = forAllSystems (system:
|
||||||
{
|
{
|
||||||
autoTag = nixpkgsFor.${system}.writeScript "auto_tag.sh" ''
|
autoTag = nixpkgsFor.${system}.writeScript "auto_tag.sh" ''
|
||||||
git tag --force v${version}
|
git tag --force v${version}
|
||||||
git push origin v${version}
|
git push origin v${version}
|
||||||
'';
|
'';
|
||||||
});
|
});
|
||||||
in
|
in
|
||||||
rec {
|
{
|
||||||
packages = forAllSystems (system:
|
packages = packages;
|
||||||
{
|
|
||||||
default = nixpkgsFor.${system}.stdenv.mkDerivation {
|
|
||||||
name = name;
|
|
||||||
src = self;
|
|
||||||
buildPhase = "makepkg -s";
|
|
||||||
installPhase = "mkdir -p $out/bin; install -t $out/bin src/patch-manjaro-sway-mirror-for-arm.sh";
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
apps = forAllSystems (system:
|
apps = forAllSystems (system:
|
||||||
let
|
let
|
||||||
@@ -40,6 +68,7 @@
|
|||||||
in
|
in
|
||||||
{
|
{
|
||||||
default = { type = "app"; program = "${packages.${system}.default}/bin/patch-manjaro-sway-mirror-for-arm.sh"; };
|
default = { type = "app"; program = "${packages.${system}.default}/bin/patch-manjaro-sway-mirror-for-arm.sh"; };
|
||||||
|
buildPackage = { type = "app"; program = "${packages.${system}.buildScriptdFile}"; };
|
||||||
devTasks = {
|
devTasks = {
|
||||||
updateFlakeLock = { type = "app"; program = "${updateLockScript}/bin/update_flake_lock.sh"; };
|
updateFlakeLock = { type = "app"; program = "${updateLockScript}/bin/update_flake_lock.sh"; };
|
||||||
autoTag = { type = "app"; program = "${devTaskScripts.${system}.autoTag}"; };
|
autoTag = { type = "app"; program = "${devTaskScripts.${system}.autoTag}"; };
|
||||||
@@ -52,7 +81,7 @@
|
|||||||
name = "dev-shell";
|
name = "dev-shell";
|
||||||
packages = [ nixpkgsFor.${system}.nixpkgs-fmt nixpkgsFor.${system}.shellspec ];
|
packages = [ nixpkgsFor.${system}.nixpkgs-fmt nixpkgsFor.${system}.shellspec ];
|
||||||
shellHook = ''
|
shellHook = ''
|
||||||
alias nixe="nix --experimental-features 'nix-command flakes'"
|
. alias.sh
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user