chore: move flake-parts flake.* values into own directory

This commit is contained in:
Nydragon 2024-07-17 01:21:44 +02:00
parent bd64afd986
commit 6198e45171
12 changed files with 61 additions and 51 deletions

View file

@ -28,7 +28,10 @@
outputs =
inputs:
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
imports = [ ./hosts ];
imports = [
./hosts
./parts
];
systems = [
"x86_64-linux"
@ -36,12 +39,7 @@
];
perSystem =
{
inputs',
config,
pkgs,
...
}:
{ pkgs, ... }:
{
devShells.default = pkgs.mkShell {
buildInputs = with pkgs; [
@ -55,18 +53,5 @@
'';
};
};
flake = {
templates = import ./templates;
# TODO: move that somewhere else
lib = inputs.nixpkgs.lib.extend (
self: super: {
my = import ./lib {
lib = self;
inherit inputs;
};
}
);
};
};
}

6
parts/default.nix Normal file
View file

@ -0,0 +1,6 @@
{
imports = [
./lib
./templates
];
}

12
parts/lib/default.nix Normal file
View file

@ -0,0 +1,12 @@
{ inputs, ... }@args:
{
flake.lib = inputs.nixpkgs.lib.extend (
self: super: {
my = import ./functions.nix {
lib = self;
inherit inputs;
self = args.self;
};
}
);
}

View file

@ -1,4 +1,9 @@
{ lib, inputs, ... }:
{
lib,
inputs,
self,
...
}:
{
# Verify the existence of a binary inside of a derivation.
@ -19,11 +24,11 @@
lib.nixosSystem {
inherit system;
modules = [
../hosts/${hostname}/configuration.nix
"${self}/hosts/${hostname}/configuration.nix"
{ networking.hostName = hostname; }
] ++ extraModules;
specialArgs = {
inherit inputs;
inherit inputs self;
username = "nico";
};
};

View file

@ -0,0 +1,30 @@
{
flake.templates = rec {
basic = {
path = ./basic;
description = "A basic template";
welcomeText = ''
# A basic flake
## More Info
- [Nix Reference Manual](https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-flake)
'';
};
rust = {
path = ./rust;
description = "A basic rust cargo template";
welcomeText = ''
# A basic rust cargo template
Maybe consider setting a license in ./flake.nix
## More Info
- [Rust language](https://www.rust-lang.org/) - https://www.rust-lang.org/
- [Rust on the NixOS Wiki](https://nixos.wiki/wiki/Rust) - https://nixos.wiki/wiki/Rust
'';
};
defaultTemplate = basic;
};
}

View file

@ -1,28 +0,0 @@
rec {
basic = {
path = ./basic;
description = "A basic template";
welcomeText = ''
# A basic flake
## More Info
- [Nix Reference Manual](https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-flake)
'';
};
rust = {
path = ./rust;
description = "A basic rust cargo template";
welcomeText = ''
# A basic rust cargo template
Maybe consider setting a license in ./flake.nix
## More Info
- [Rust language](https://www.rust-lang.org/) - https://www.rust-lang.org/
- [Rust on the NixOS Wiki](https://nixos.wiki/wiki/Rust) - https://nixos.wiki/wiki/Rust
'';
};
defaultTemplate = basic;
}