This commit is contained in:
2024-01-10 21:21:58 +00:00
parent 23173d0875
commit 289d35a051
3 changed files with 89 additions and 55 deletions

View File

@@ -1,67 +1,62 @@
{
description = "";
inputs = {
nixpkgs.url = "nixpkgs/nixos-23.05";
inputs = {
nixpkgs.url = "nixpkgs/nixos-23.11";
flake-parts.url = "github:hercules-ci/flake-parts";
};
outputs = { self, nixpkgs }:
let
version = "0.0.1";
name = "develnixos";
supportedSystems = [ "x86_64-linux" "aarch64-linux" ];
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}
'';
});
space = forAllSystems (system: rec {
config = import ./config { nixpkgs = nixpkgsFor.${system}; };
playground = import ./playground/example { config = config; };
});
in rec {
packages = forAllSystems (system: {
default = space.${system}.playground.package;
});
apps = forAllSystems (system:
outputs = inputs:
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
systems = [ "x86_64-linux" "aarch64-linux" ];
perSystem = { config, pkgs, system, ... }:
let
testConfig = import ./config { nixpkgs = nixpkgsFor.${system}; };
testapp = import ./playground/example { config = testConfig; };
version = "0.0.1";
name = "develnixos";
updateLockScript = pkgs.writeShellScriptBin "update_flake_lock.sh" ''
nix --experimental-features 'nix-command flakes' flake lock --update-input nixpkgs
nix --experimental-features 'nix-command flakes' build
'';
autoTag = pkgs.writeScript "auto_tag.sh" ''
git tag --force v${version}
git push origin v${version}
'';
space = rec {
config = import ./config { nixpkgs = pkgs; };
playground = import ./playground/example { config = space.config; };
};
foo = pkgs.runCommand "linter" ''
echo the_linter
'';
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 = space.${system}.playground.app;
devTasks = {
packages.default = space.playground.package;
apps = {
default = space.playground.app;
updateFlakeLock = {
type = "app";
program = "${updateLockScript}/bin/update_flake_lock.sh";
type = "app";
program = "${updateLockScript}/bin/update_flake_lock.sh";
};
autoTag = {
type = "app";
program = "${devTaskScripts.${system}.autoTag}";
type = "app";
program = "${autoTag}";
};
};
});
devShells = forAllSystems (system: {
default = nixpkgsFor.${system}.mkShell {
name = "dev-shell";
packages = [ nixpkgsFor.${system}.nixfmt ];
shellHook = ''
. ./alias.sh
'';
devShells.default = pkgs.mkShell {
name = "dev-shell";
packages = [ pkgs.nixfmt ];
shellHook = ''
. ./alias.sh
'';
};
checks = {
package = space.playground.package;
};
};
});
};
}