diff --git a/README.md b/README.md index c065c2e..7a90dfc 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,26 @@ # -## Packages +## Nix Flake commands ```sh -nixe run "git+https://gitlab.com/codeguesser/code_guesser.sh.git?ref=flake&dir=pkgs/nix" examples/example.c +# nix flake are experimental and required following options --experimental-features 'nix-command flakes' +# create alias for nix --experimental-features 'nix-command flakes' -nixe run ./pkgs/nix examples/example.c +alias nixe && echo Alias for nixe exists || alias nixe="nix --experimental-features 'nix-command flakes'" -nixe run "gitlab:codeguesser/code_guesser.sh/flake?dir=pkgs/nix" examples/example.c +# build +nixe build + +# run +nixe run + +# open development shell +nixe develop + +# update flake.lock +nixe run .#devTasks.updateFlakeLock + +# tag project +nixe run .#devTasks.autoTag ``` \ No newline at end of file diff --git a/flake.nix b/flake.nix index e7fd664..cca53f4 100644 --- a/flake.nix +++ b/flake.nix @@ -4,9 +4,18 @@ outputs = { self, nixpkgs }: let + name = "example.sh"; + version = "0.0.1"; supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ]; forAllSystems = nixpkgs.lib.genAttrs supportedSystems; nixpkgsFor = forAllSystems (system: import nixpkgs { inherit system; }); + devTaskScripts = forAllSystems (system: + { + autoTag = nixpkgsFor.${system}.writeShellScriptBin "auto_tag.sh" '' + git tag --force v${version} + git push origin v${version} + ''; + }); in rec { packages = forAllSystems (system: @@ -30,11 +39,10 @@ default = { type = "app"; program = "${packages.${system}.default}/bin/hello.sh"; }; devTasks = { updateFlakeLock = { type = "app"; program = "${updateLockScript}/bin/update_flake_lock.sh"; }; + autoTag = { type = "app"; program = "${devTaskScripts.${system}.autoTag}/bin/auto_tag.sh"; }; }; }); - - devShells = forAllSystems (system: { default = nixpkgsFor.${system}.mkShell { @@ -47,10 +55,10 @@ }); hydraJobs = { - tarball = nixpkgsFor.x86_64-linux.releaseTools.sourceTarball rec { - name = "example.sh"; + tarball = nixpkgsFor.x86_64-linux.releaseTools.sourceTarball { + name = name; src = self; - version = "0.0.1"; + version = version; officialRelease = true; bootstrapBuildInputs = [ ]; distPhase = '' @@ -61,11 +69,7 @@ runCommandHook = { recurseForDerivations = { }; - example = forAllSystems (system: - nixpkgsFor.${system}.writeShellScriptBin "example_hook.sh" '' - echo foo - '' - ); + autoTag = devTaskScripts.x86_64-linux.autoTag; }; }; };