1
0

update flake and readme

This commit is contained in:
stubbfelnewpc
2022-11-01 14:27:00 +00:00
parent 146b6b54d1
commit 7ba238713a
2 changed files with 32 additions and 14 deletions

View File

@@ -1,12 +1,26 @@
# <project-name>
## 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
```

View File

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