1
0
Fork 0
mirror of https://github.com/hercules-ci/flake-parts.git synced 2025-03-31 04:04:55 +00:00

Add a dev flake

This commit is contained in:
Yang, Bo 2023-11-03 14:48:37 +00:00
parent 89c069df9e
commit 863f8b69be
6 changed files with 46 additions and 33 deletions

1
template/dogfood/.envrc Normal file
View file

@ -0,0 +1 @@
use flake ./dev --no-write-lock-file --show-trace

1
template/dogfood/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/.direnv/

View file

@ -0,0 +1,11 @@
{
description = "The dev flake to set up the devShell. It dogfoods modules provided by the public flake";
inputs = {
public.url = "path:..";
nixpkgs.follows = "public/nixpkgs";
flake-parts.follows = "public/flake-parts";
};
outputs = { public, flake-parts, nixpkgs, self, ... }@inputs: flake-parts.lib.mkFlake { inherit inputs; } public.flakeModules.dev;
}

View file

@ -5,14 +5,17 @@
nixpkgs_22_11.url = "github:NixOS/nixpkgs/nixos-22.11";
};
outputs = { flake-parts, self, ... }@inputs: let
bootstrap =
flake-parts.lib.mkFlake
{
inherit inputs;
moduleLocation = ./flake.nix;
}
./modules/dogfood.nix;
in
flake-parts.lib.mkFlake { inherit inputs; } bootstrap.flakeModules.dogfood;
outputs = { flake-parts, self, nixpkgs, ... }@inputs:
flake-parts.lib.mkFlake
{
inherit inputs;
moduleLocation = ./flake.nix;
}
{
imports = [
./modules/anotherFlakeModule.nix
./modules/dev.nix
./modules/hello.nix
];
};
}

View file

@ -0,0 +1,20 @@
{flake-parts-lib, lib, inputs, ...}@topLevel: {
imports = [
./hello.nix
inputs.flake-parts.flakeModules.flakeModules
];
flake.flakeModules.dev = {
config.systems = [ "x86_64-linux" "aarch64-darwin" ];
imports = [
topLevel.config.flake.flakeModules.hello
];
options.perSystem = flake-parts-lib.mkPerSystemOption ({pkgs, ...}@perSystem: {
devShells.default = pkgs.mkShell {
buildInputs = [ perSystem.config.packages.hello_22_11 ];
shellHook = ''
hello
'';
};
});
};
}

View file

@ -1,23 +0,0 @@
{flake-parts-lib, lib, inputs, ...}@topLevel: {
imports = [
./hello.nix
inputs.flake-parts.flakeModules.flakeModules
];
flake.flakeModules.dogfood = {
config.systems = [ "x86_64-linux" "aarch64-darwin" ];
imports = [
topLevel.config.flake.flakeModules.hello
# Expose flake modules
./dogfood.nix
./hello.nix
./anotherFlakeModule.nix
];
options.perSystem = flake-parts-lib.mkPerSystemOption (perSystem: {
apps.default = {
type = "app";
program = "${perSystem.config.packages.hello_22_11}/bin/hello";
};
});
};
}