generated from stubbfel/nix-project-template
test
This commit is contained in:
102
flake.nix
102
flake.nix
@@ -1,76 +1,58 @@
|
||||
{
|
||||
description = "";
|
||||
inputs.nixpkgs.url = "nixpkgs/nixos-22.05-small";
|
||||
|
||||
outputs = { self, nixpkgs }:
|
||||
inputs = {
|
||||
config.url = "./config";
|
||||
playground.url = "./playground/example/service";
|
||||
};
|
||||
outputs = { self, config, playground }:
|
||||
let
|
||||
name = "develnixos.new";
|
||||
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}.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";
|
||||
};
|
||||
});
|
||||
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 = playground.packages;
|
||||
|
||||
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 = [ ];
|
||||
shellHook = ''
|
||||
alias nixe="nix --experimental-features 'nix-command flakes'"
|
||||
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}";
|
||||
};
|
||||
};
|
||||
});
|
||||
|
||||
hydraJobs = {
|
||||
tarball = nixpkgsFor.x86_64-linux.releaseTools.sourceTarball {
|
||||
name = name;
|
||||
src = self;
|
||||
version = version;
|
||||
officialRelease = true;
|
||||
bootstrapBuildInputs = [ ];
|
||||
distPhase = ''
|
||||
mkdir $out/tarballs
|
||||
tar -czvf $out/tarballs/${name}-${version}.tar.gz *
|
||||
devShells = forAllSystems (system: {
|
||||
default = nixpkgsFor.${system}.mkShell {
|
||||
name = "dev-shell";
|
||||
packages = [ nixpkgsFor.${system}.nixfmt ];
|
||||
shellHook = ''
|
||||
. ./alias.sh
|
||||
'';
|
||||
};
|
||||
});
|
||||
|
||||
runCommandHook = {
|
||||
recurseForDerivations = { };
|
||||
autoTag = devTaskScripts.x86_64-linux.autoTag;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user