update flake and readme
This commit is contained in:
22
README.md
22
README.md
@@ -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
|
||||
|
||||
```
|
||||
24
flake.nix
24
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;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user