add templates
This commit is contained in:
parent
984654610a
commit
e67fb3b037
28
flake.nix
28
flake.nix
|
@ -91,7 +91,15 @@
|
|||
};
|
||||
|
||||
setNixpkgsFlakeAlias = lib.mkOption {
|
||||
description = "Set nix path entry for `nixpkgs` to self";
|
||||
description = "Set flake registry entry for `nixpkgs` to self";
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
defaultText = lib.literalExpression "true";
|
||||
example = lib.literalExpression "false";
|
||||
};
|
||||
|
||||
setTemplatesFlakeAlias = lib.mkOption {
|
||||
description = "Set flake registry entry for `templates` to self";
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
defaultText = lib.literalExpression "true";
|
||||
|
@ -99,12 +107,19 @@
|
|||
};
|
||||
};
|
||||
|
||||
config.nix.registry.dragnpkgs = lib.mkIf config.dragnpkgs.setFlakeRegistry self.meta.registry-entry;
|
||||
config.nix.registry.dragnpkgs =
|
||||
lib.mkIf config.dragnpkgs.setFlakeRegistry self.meta.registry-entry;
|
||||
|
||||
config.nix.registry.nixpkgs = lib.mkIf config.dragnpkgs.setNixpkgsFlakeAlias {
|
||||
from = { id = "nixpkgs"; type = "indirect"; };
|
||||
to = { id = "dragnpkgs"; type = "indirect"; };
|
||||
};
|
||||
|
||||
config.nix.registry.templates = lib.mkIf config.dragnpkgs.setTemplatesFlakeAlias {
|
||||
from = { id = "templates"; type = "indirect"; };
|
||||
to = { id = "dragnpkgs"; type = "indirect"; };
|
||||
};
|
||||
|
||||
config.nix.nixPath = lib.mkIf config.dragnpkgs.setNixPath [
|
||||
self.meta.path-entry
|
||||
];
|
||||
|
@ -139,5 +154,14 @@
|
|||
);
|
||||
|
||||
nixosModules = nixpkgs.nixosModules;
|
||||
|
||||
templates = {
|
||||
default = {
|
||||
path = ./templates/default;
|
||||
description = "A very basic flake (with dragnpkgs)";
|
||||
};
|
||||
};
|
||||
|
||||
defaultTemplate = self.templates.default;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
description = "A very basic flake";
|
||||
|
||||
outputs = { self, dragnpkgs } @ inputs: {
|
||||
packages.hello = { stdenv }: stdenv.mkDerivation {
|
||||
name = "hello";
|
||||
src = self;
|
||||
|
||||
installPhase = ''
|
||||
echo TODO
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue