forked from clan/clan-core
Merge pull request 'templates: add template for enw clan' (#20) from flake-template into main
This commit is contained in:
parent
d17ae02a43
commit
d99060695f
@ -22,6 +22,7 @@
|
||||
imports = [
|
||||
./flake-parts/packages.nix
|
||||
./flake-parts/formatting.nix
|
||||
./templates/flake-module.nix
|
||||
./templates/python-project/flake-module.nix
|
||||
./pkgs/clan-cli/flake-module.nix
|
||||
];
|
||||
|
12
templates/flake-module.nix
Normal file
12
templates/flake-module.nix
Normal file
@ -0,0 +1,12 @@
|
||||
{ ... }: {
|
||||
flake.templates = {
|
||||
new-clan = {
|
||||
description = "Initialize a new clan flake";
|
||||
path = ./new-clan;
|
||||
};
|
||||
python-project = {
|
||||
description = "Initialize a new internal python project";
|
||||
path = ./python-project;
|
||||
};
|
||||
};
|
||||
}
|
16
templates/new-clan/default.nix
Normal file
16
templates/new-clan/default.nix
Normal file
@ -0,0 +1,16 @@
|
||||
# This file provides backward compatibility to nix < 2.4 clients
|
||||
let
|
||||
flake =
|
||||
import
|
||||
(
|
||||
let
|
||||
lock = builtins.fromJSON (builtins.readFile ./flake.lock);
|
||||
in
|
||||
fetchTarball {
|
||||
url = "https://github.com/edolstra/flake-compat/archive/${lock.nodes.flake-compat.locked.rev}.tar.gz";
|
||||
sha256 = lock.nodes.flake-compat.locked.narHash;
|
||||
}
|
||||
)
|
||||
{ src = ./.; };
|
||||
in
|
||||
flake.defaultNix
|
25
templates/new-clan/flake.nix
Normal file
25
templates/new-clan/flake.nix
Normal file
@ -0,0 +1,25 @@
|
||||
{
|
||||
description = "";
|
||||
|
||||
inputs = {
|
||||
flake-parts.url = "github:hercules-ci/flake-parts";
|
||||
flake-compat = {
|
||||
url = "github:edolstra/flake-compat";
|
||||
flake = false;
|
||||
};
|
||||
nixpkgs.url = "nixpkgs/nixos-unstable";
|
||||
};
|
||||
|
||||
outputs = inputs @ { flake-parts, ... }:
|
||||
flake-parts.lib.mkFlake { inherit inputs; } {
|
||||
|
||||
systems = builtins.fromJSON (builtins.readFile ./systems.json);
|
||||
|
||||
imports =
|
||||
let
|
||||
relPaths = builtins.fromJSON (builtins.readFile ./imports.json);
|
||||
paths = map (path: ./. + path) relPaths;
|
||||
in
|
||||
paths;
|
||||
};
|
||||
}
|
1
templates/new-clan/imports.json
Normal file
1
templates/new-clan/imports.json
Normal file
@ -0,0 +1 @@
|
||||
[]
|
2
templates/new-clan/shell.nix
Normal file
2
templates/new-clan/shell.nix
Normal file
@ -0,0 +1,2 @@
|
||||
(import ./default.nix).devShells.${builtins.currentSystem}.default
|
||||
or (throw "dev-shell not defined. Cannot find flake attribute devShell.${builtins.currentSystem}.default")
|
3
templates/new-clan/systems.json
Normal file
3
templates/new-clan/systems.json
Normal file
@ -0,0 +1,3 @@
|
||||
[
|
||||
"x86_64-linux"
|
||||
]
|
Loading…
Reference in New Issue
Block a user