Files
develnixos.new/playground/example/service/flake.nix
2023-06-10 14:58:23 +00:00

63 lines
1.8 KiB
Nix

{
description = "";
inputs = { config.url = "./config"; };
outputs = { self, config }:
let
version = "0.0.1";
name = "develnixos";
forAllSystems = config.forAllSystems;
nixpkgsFor = config.nixpkgsFor;
devTaskScripts = forAllSystems (system: {
autoTag = nixpkgsFor.${system}.writeScript "auto_tag.sh" ''
git tag --force v${version}
git push origin v${version}
'';
});
in rec {
packages = forAllSystems (system: {
default = nixpkgsFor.${system}.stdenv.mkDerivation {
name = name;
src = self;
buildPhase = "echo nothing todo";
installPhase = "mkdir -p $out/bin; install -t $out/bin src/hello.sh";
};
});
apps = forAllSystems (system:
let
updateLockScript =
nixpkgsFor.${system}.writeShellScriptBin "update_flake_lock.sh" ''
nix --experimental-features 'nix-command flakes' flake lock --update-input nixpkgs
nix --experimental-features 'nix-command flakes' build
'';
in {
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}";
};
};
});
devShells = forAllSystems (system: {
default = nixpkgsFor.${system}.mkShell {
name = "dev-shell";
packages = [ nixpkgsFor.${system}.nixfmt ];
shellHook = ''
. ./alias.sh
'';
};
});
};
}