templates: add 'system-flake' template
This commit is contained in:
parent
4b8609385a
commit
3a3d73d5b6
15 changed files with 212 additions and 0 deletions
5
templates/system-flake/pkgs/config/default.nix
Normal file
5
templates/system-flake/pkgs/config/default.nix
Normal file
|
@ -0,0 +1,5 @@
|
|||
lib:
|
||||
with lib; {
|
||||
android_sdk.accept_license = true;
|
||||
allowUnfreePredicate = pkg: import ./unfree.nix lib (getName pkg);
|
||||
}
|
7
templates/system-flake/pkgs/config/unfree.nix
Normal file
7
templates/system-flake/pkgs/config/unfree.nix
Normal file
|
@ -0,0 +1,7 @@
|
|||
lib: name:
|
||||
with lib;
|
||||
elem name [
|
||||
"libproprietary-v3"
|
||||
"closed-source-pkg"
|
||||
"favorite-abandonware"
|
||||
]
|
12
templates/system-flake/pkgs/default.nix
Normal file
12
templates/system-flake/pkgs/default.nix
Normal file
|
@ -0,0 +1,12 @@
|
|||
final: prev:
|
||||
with prev.lib; let
|
||||
inherit (final) callPackage fetchpatch;
|
||||
in {
|
||||
lib = callPackage ./lib {};
|
||||
|
||||
hello-world = callPackage ./hello-world {};
|
||||
|
||||
override = {
|
||||
sl = prev.sl.overrideAttrs {pname = "my-sl";};
|
||||
};
|
||||
}
|
6
templates/system-flake/pkgs/hello-world/Makefile
Normal file
6
templates/system-flake/pkgs/hello-world/Makefile
Normal file
|
@ -0,0 +1,6 @@
|
|||
CFLAGS += -O3 -s
|
||||
|
||||
all: hello-world
|
||||
|
||||
%: %.c
|
||||
$(CC) $(CFLAGS) -o $@ $<
|
14
templates/system-flake/pkgs/hello-world/default.nix
Normal file
14
templates/system-flake/pkgs/hello-world/default.nix
Normal file
|
@ -0,0 +1,14 @@
|
|||
{stdenv, ...}:
|
||||
stdenv.mkDerivation {
|
||||
name = "hello-world";
|
||||
version = "1.0.0";
|
||||
|
||||
src = ./.;
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out/bin
|
||||
cp hello-world $out/bin
|
||||
'';
|
||||
|
||||
meta.mainProgram = "hello-world";
|
||||
}
|
7
templates/system-flake/pkgs/hello-world/hello-world.c
Normal file
7
templates/system-flake/pkgs/hello-world/hello-world.c
Normal file
|
@ -0,0 +1,7 @@
|
|||
#include <stdio.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
printf("Hello, world!\n");
|
||||
return 0;
|
||||
}
|
3
templates/system-flake/pkgs/lib/default.nix
Normal file
3
templates/system-flake/pkgs/lib/default.nix
Normal file
|
@ -0,0 +1,3 @@
|
|||
{callPackage}: {
|
||||
fibonacci = callPackage ./fibonacci.nix {};
|
||||
}
|
7
templates/system-flake/pkgs/lib/fibonacci.nix
Normal file
7
templates/system-flake/pkgs/lib/fibonacci.nix
Normal file
|
@ -0,0 +1,7 @@
|
|||
let
|
||||
fib = n:
|
||||
if n > 1
|
||||
then fib (n - 1) + fib (n - 2)
|
||||
else 1;
|
||||
in
|
||||
fib
|
Loading…
Add table
Add a link
Reference in a new issue