Files
develnixos.new/flake.nix
2023-06-10 18:08:31 +00:00

68 lines
2.0 KiB
Nix

{
description = "";
inputs = {
nixpkgs.url = "nixpkgs/nixos-23.05";
};
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:
let
testConfig = import ./config { nixpkgs = nixpkgsFor.${system}; };
testapp = import ./playground/example { config = testConfig; };
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 = {
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
'';
};
});
};
}