mirror of
https://github.com/Misterio77/Foundry.git
synced 2026-08-24 10:04:09 -05:00
rework templates
This commit is contained in:
@@ -20,23 +20,23 @@ $(BUILD_DIR)/$(TARGET_EXEC): $(OBJS)
|
||||
|
||||
# c source
|
||||
$(BUILD_DIR)/%.c.o: %.c
|
||||
$(MKDIR_P) $(dir $@)
|
||||
mkdir -p $(dir $@)
|
||||
$(CC) $(CPPFLAGS) $(CFLAGS) -c $< -o $@
|
||||
|
||||
# c++ source
|
||||
$(BUILD_DIR)/%.cpp.o: %.cpp
|
||||
$(MKDIR_P) $(dir $@)
|
||||
mkdir -p $(dir $@)
|
||||
$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@
|
||||
|
||||
.PHONY: clean install run
|
||||
|
||||
clean:
|
||||
$(RM) -r $(BUILD_DIR)
|
||||
rm -r $(BUILD_DIR)
|
||||
|
||||
install: $(BUILD_DIR)/$(TARGET_EXEC)
|
||||
install -d $(BIN_DIR)
|
||||
install -t $(BIN_DIR) $<
|
||||
install -Dt $(BIN_DIR) $<
|
||||
|
||||
run: $(BUILD_DIR)/$(TARGET_EXEC)
|
||||
./$<
|
||||
|
||||
-include $(DEPS)
|
||||
|
||||
MKDIR_P ?= mkdir -p
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
{ clangStdenv }: clangStdenv.mkDerivation rec {
|
||||
{ clangStdenv }:
|
||||
|
||||
clangStdenv.mkDerivation {
|
||||
pname = "foo-bar";
|
||||
version = "0.1.0";
|
||||
|
||||
|
||||
+17
-27
@@ -1,40 +1,30 @@
|
||||
{
|
||||
description = "Foo Bar C/C++ Project";
|
||||
|
||||
nixConfig = {
|
||||
extra-substituters = [ "https://cache.m7.rs" ];
|
||||
extra-trusted-public-keys = [ "cache.m7.rs:kszZ/NSwE/TjhOcPPQ16IuUiuRSisdiIwhKZCxguaWg=" ];
|
||||
};
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.05";
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.11";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs }:
|
||||
let
|
||||
inherit (nixpkgs.lib) genAttrs systems;
|
||||
forAllSystems = genAttrs systems.flakeExposed;
|
||||
pkgsFor = forAllSystems (system: import nixpkgs {
|
||||
inherit system; overlays = [ self.overlays.default ];
|
||||
});
|
||||
forAllSystems = nixpkgs.lib.genAttrs [ "x86_64-linux" "aarch64-linux" ];
|
||||
pkgsFor = nixpkgs.legacyPackages;
|
||||
in
|
||||
{
|
||||
overlays = rec {
|
||||
default = final: prev: {
|
||||
foo-bar = prev.callPackage ./. { };
|
||||
};
|
||||
};
|
||||
rec {
|
||||
packages = forAllSystems (system: {
|
||||
default = pkgsFor.${system}.callPackage ./default.nix { };
|
||||
});
|
||||
|
||||
packages = forAllSystems (s:
|
||||
let pkgs = pkgsFor.${s}; in
|
||||
rec {
|
||||
inherit (pkgs) foo-bar;
|
||||
default = foo-bar;
|
||||
});
|
||||
devShells = forAllSystems (system: {
|
||||
default = pkgsFor.${system}.callPackage ./shell.nix { };
|
||||
});
|
||||
|
||||
devShells = forAllSystems (s:
|
||||
let pkgs = pkgsFor.${s}; in
|
||||
rec {
|
||||
foo-bar = pkgs.mkShell {
|
||||
inputsFrom = [ pkgs.foo-bar ];
|
||||
buildInputs = with pkgs; [ clang-tools ];
|
||||
};
|
||||
default = foo-bar;
|
||||
});
|
||||
hydraJobs = packages;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
{ callPackage, clang-tools }:
|
||||
|
||||
let
|
||||
mainPkg = callPackage ./default.nix { };
|
||||
in
|
||||
mainPkg.overrideAttrs (oa: {
|
||||
nativeBuildInputs = [
|
||||
clang-tools
|
||||
] ++ (oa.nativeBuildInputs or [ ]);
|
||||
})
|
||||
+4
-24
@@ -1,26 +1,6 @@
|
||||
{
|
||||
c = {
|
||||
description = "C/C++ environment (clang)";
|
||||
path = ./c;
|
||||
};
|
||||
document = {
|
||||
description = "Document building environment (pandoc)";
|
||||
path = ./document;
|
||||
};
|
||||
haskell = {
|
||||
description = "Haskell environment (cabal)";
|
||||
path = ./haskell;
|
||||
};
|
||||
jekyll = {
|
||||
description = "Jekyll website";
|
||||
path = ./jekyll;
|
||||
};
|
||||
rust = {
|
||||
description = "Rust environment (cargo)";
|
||||
path = ./rust;
|
||||
};
|
||||
zip = {
|
||||
description = "Simple Zip package";
|
||||
path = ./zip;
|
||||
};
|
||||
c.path = ./c;
|
||||
rust.path = ./rust;
|
||||
haskell.path = ./haskell;
|
||||
node.path = ./node;
|
||||
}
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
# nix build
|
||||
result
|
||||
@@ -1,14 +0,0 @@
|
||||
{ stdenv, pandoc, texlive }: stdenv.mkDerivation {
|
||||
pname = "foo-bar";
|
||||
version = "0.1.0";
|
||||
src = ./.;
|
||||
buildInputs = [ pandoc texlive.combined.scheme-small ];
|
||||
buildPhase = ''
|
||||
shopt -s globstar
|
||||
pandoc src/**/*.md -o document.pdf
|
||||
'';
|
||||
installPhase = ''
|
||||
mkdir -p $out
|
||||
install -Dm644 *.pdf $out
|
||||
'';
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
{
|
||||
description = "Foo Bar Document";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.05";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs }:
|
||||
let
|
||||
inherit (nixpkgs.lib) genAttrs systems;
|
||||
forAllSystems = genAttrs systems.flakeExposed;
|
||||
pkgsFor = forAllSystems (system: import nixpkgs {
|
||||
inherit system; overlays = [ self.overlays.default ];
|
||||
});
|
||||
in
|
||||
{
|
||||
overlays = rec {
|
||||
default = final: prev: {
|
||||
foo-bar = prev.callPackage ./. { };
|
||||
};
|
||||
};
|
||||
|
||||
packages = forAllSystems (s:
|
||||
let pkgs = pkgsFor.${s}; in
|
||||
rec {
|
||||
inherit (pkgs) foo-bar;
|
||||
default = foo-bar;
|
||||
});
|
||||
|
||||
devShells = forAllSystems (s:
|
||||
let pkgs = pkgsFor.${s}; in
|
||||
rec {
|
||||
foo-bar = pkgs.mkShell {
|
||||
inputsFrom = [ pkgs.foo-bar ];
|
||||
};
|
||||
default = foo-bar;
|
||||
});
|
||||
};
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
# Foo Bar
|
||||
@@ -1 +1,3 @@
|
||||
{ haskellPackages }: haskellPackages.callCabal2nix "foo-bar" ./. { }
|
||||
{ haskellPackages }:
|
||||
|
||||
haskellPackages.callCabal2nix "foo-bar" ./. { }
|
||||
|
||||
+16
-27
@@ -1,41 +1,30 @@
|
||||
{
|
||||
description = "Foo Bar Haskell Project";
|
||||
|
||||
nixConfig = {
|
||||
extra-substituters = [ "https://cache.m7.rs" ];
|
||||
extra-trusted-public-keys = [ "cache.m7.rs:kszZ/NSwE/TjhOcPPQ16IuUiuRSisdiIwhKZCxguaWg=" ];
|
||||
};
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.05";
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.11";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs }:
|
||||
let
|
||||
inherit (nixpkgs.lib) genAttrs systems;
|
||||
forAllSystems = genAttrs systems.flakeExposed;
|
||||
pkgsFor = forAllSystems (system: import nixpkgs {
|
||||
inherit system; overlays = [ self.overlays.default ];
|
||||
});
|
||||
forAllSystems = nixpkgs.lib.genAttrs [ "x86_64-linux" "aarch64-linux" ];
|
||||
pkgsFor = nixpkgs.legacyPackages;
|
||||
in
|
||||
{
|
||||
overlays = rec {
|
||||
default = final: prev: {
|
||||
foo-bar = prev.callPackage ./. { };
|
||||
};
|
||||
};
|
||||
rec {
|
||||
packages = forAllSystems (system: {
|
||||
default = pkgsFor.${system}.callPackage ./default.nix { };
|
||||
});
|
||||
|
||||
packages = forAllSystems (s:
|
||||
let pkgs = pkgsFor.${s}; in
|
||||
rec {
|
||||
inherit (pkgs) foo-bar;
|
||||
default = foo-bar;
|
||||
});
|
||||
devShells = forAllSystems (system: {
|
||||
default = pkgsFor.${system}.callPackage ./shell.nix { };
|
||||
});
|
||||
|
||||
devShells = forAllSystems (s:
|
||||
let pkgs = pkgsFor.${s}; in
|
||||
rec {
|
||||
foo-bar = pkgs.mkShell {
|
||||
inputsFrom = [ pkgs.foo-bar ];
|
||||
buildInputs = with pkgs; [ haskell-language-server cabal-install ghc ];
|
||||
};
|
||||
default = foo-bar;
|
||||
});
|
||||
hydraJobs = packages;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -1,23 +1,19 @@
|
||||
cabal-version: 2.4
|
||||
name: foo-bar
|
||||
version: 0.1.0.0
|
||||
|
||||
synopsis: Example Foo Bar Project
|
||||
author: Gabriel Fontes
|
||||
maintainer: hi@m7.rs
|
||||
license: Unlicense
|
||||
version: 0.1.0
|
||||
license: MIT
|
||||
|
||||
library
|
||||
exposed-modules: FooBar
|
||||
hs-source-dirs: src
|
||||
default-language: Haskell2010
|
||||
build-depends:
|
||||
base >= 4.14
|
||||
base >= 4.15
|
||||
|
||||
executable foo-bar
|
||||
main-is: Main.hs
|
||||
hs-source-dirs: app
|
||||
default-language: Haskell2010
|
||||
build-depends:
|
||||
base >= 4.14,
|
||||
base >= 4.15,
|
||||
foo-bar
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
{ callPackage, haskell-language-server, cabal-install }:
|
||||
|
||||
let
|
||||
mainPkg = callPackage ./default.nix { };
|
||||
in
|
||||
mainPkg.overrideAttrs (oa: {
|
||||
nativeBuildInputs = [
|
||||
cabal-install
|
||||
haskell-language-server
|
||||
] ++ (oa.nativeBuildInputs or [ ]);
|
||||
})
|
||||
@@ -1,3 +0,0 @@
|
||||
.jekyll-cache
|
||||
_site
|
||||
result
|
||||
@@ -1,5 +0,0 @@
|
||||
name: Blabla
|
||||
exclude:
|
||||
- default.nix
|
||||
- flake.nix
|
||||
- flake.lock
|
||||
@@ -1,12 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="pt">
|
||||
<head>
|
||||
<meta charset="utf8"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||
<title>{{ page.title }}</title>
|
||||
<link rel="stylesheet" href="/assets/style.css"/>
|
||||
</head>
|
||||
<body>
|
||||
{{ content }}
|
||||
</body>
|
||||
</html>
|
||||
@@ -1 +0,0 @@
|
||||
// Irineu
|
||||
@@ -1,298 +0,0 @@
|
||||
/*! modern-normalize v1.1.0 | MIT License | https://github.com/sindresorhus/modern-normalize */
|
||||
|
||||
/*
|
||||
Document
|
||||
========
|
||||
*/
|
||||
|
||||
/**
|
||||
Use a better box model (opinionated).
|
||||
*/
|
||||
|
||||
*,
|
||||
::before,
|
||||
::after {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/**
|
||||
Use a more readable tab size (opinionated).
|
||||
*/
|
||||
|
||||
html {
|
||||
-moz-tab-size: 4;
|
||||
tab-size: 4;
|
||||
}
|
||||
|
||||
/**
|
||||
1. Correct the line height in all browsers.
|
||||
2. Prevent adjustments of font size after orientation changes in iOS.
|
||||
*/
|
||||
|
||||
html {
|
||||
line-height: 1.15; /* 1 */
|
||||
-webkit-text-size-adjust: 100%; /* 2 */
|
||||
}
|
||||
|
||||
/*
|
||||
Sections
|
||||
========
|
||||
*/
|
||||
|
||||
/**
|
||||
Remove the margin in all browsers.
|
||||
*/
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
/**
|
||||
Improve consistency of default fonts in all browsers. (https://github.com/sindresorhus/modern-normalize/issues/3)
|
||||
*/
|
||||
|
||||
body {
|
||||
font-family:
|
||||
system-ui,
|
||||
-apple-system, /* Firefox supports this but not yet `system-ui` */
|
||||
'Segoe UI',
|
||||
Roboto,
|
||||
Helvetica,
|
||||
Arial,
|
||||
sans-serif,
|
||||
'Apple Color Emoji',
|
||||
'Segoe UI Emoji';
|
||||
}
|
||||
|
||||
/*
|
||||
Grouping content
|
||||
================
|
||||
*/
|
||||
|
||||
/**
|
||||
1. Add the correct height in Firefox.
|
||||
2. Correct the inheritance of border color in Firefox. (https://bugzilla.mozilla.org/show_bug.cgi?id=190655)
|
||||
*/
|
||||
|
||||
hr {
|
||||
height: 0; /* 1 */
|
||||
color: inherit; /* 2 */
|
||||
}
|
||||
|
||||
/*
|
||||
Text-level semantics
|
||||
====================
|
||||
*/
|
||||
|
||||
/**
|
||||
Add the correct text decoration in Chrome, Edge, and Safari.
|
||||
*/
|
||||
|
||||
abbr[title] {
|
||||
text-decoration: underline dotted;
|
||||
}
|
||||
|
||||
/**
|
||||
Add the correct font weight in Edge and Safari.
|
||||
*/
|
||||
|
||||
b,
|
||||
strong {
|
||||
font-weight: bolder;
|
||||
}
|
||||
|
||||
/**
|
||||
1. Improve consistency of default fonts in all browsers. (https://github.com/sindresorhus/modern-normalize/issues/3)
|
||||
2. Correct the odd 'em' font sizing in all browsers.
|
||||
*/
|
||||
|
||||
code,
|
||||
kbd,
|
||||
samp,
|
||||
pre {
|
||||
font-family:
|
||||
ui-monospace,
|
||||
SFMono-Regular,
|
||||
Consolas,
|
||||
'Liberation Mono',
|
||||
Menlo,
|
||||
monospace; /* 1 */
|
||||
font-size: 1em; /* 2 */
|
||||
}
|
||||
|
||||
/**
|
||||
Add the correct font size in all browsers.
|
||||
*/
|
||||
|
||||
small {
|
||||
font-size: 80%;
|
||||
}
|
||||
|
||||
/**
|
||||
Prevent 'sub' and 'sup' elements from affecting the line height in all browsers.
|
||||
*/
|
||||
|
||||
sub,
|
||||
sup {
|
||||
font-size: 75%;
|
||||
line-height: 0;
|
||||
position: relative;
|
||||
vertical-align: baseline;
|
||||
}
|
||||
|
||||
sub {
|
||||
bottom: -0.25em;
|
||||
}
|
||||
|
||||
sup {
|
||||
top: -0.5em;
|
||||
}
|
||||
|
||||
/*
|
||||
Tabular data
|
||||
============
|
||||
*/
|
||||
|
||||
/**
|
||||
1. Remove text indentation from table contents in Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=999088, https://bugs.webkit.org/show_bug.cgi?id=201297)
|
||||
2. Correct table border color inheritance in all Chrome and Safari. (https://bugs.chromium.org/p/chromium/issues/detail?id=935729, https://bugs.webkit.org/show_bug.cgi?id=195016)
|
||||
*/
|
||||
|
||||
table {
|
||||
text-indent: 0; /* 1 */
|
||||
border-color: inherit; /* 2 */
|
||||
}
|
||||
|
||||
/*
|
||||
Forms
|
||||
=====
|
||||
*/
|
||||
|
||||
/**
|
||||
1. Change the font styles in all browsers.
|
||||
2. Remove the margin in Firefox and Safari.
|
||||
*/
|
||||
|
||||
button,
|
||||
input,
|
||||
optgroup,
|
||||
select,
|
||||
textarea {
|
||||
font-family: inherit; /* 1 */
|
||||
font-size: 100%; /* 1 */
|
||||
line-height: 1.15; /* 1 */
|
||||
margin: 0; /* 2 */
|
||||
}
|
||||
|
||||
/**
|
||||
Remove the inheritance of text transform in Edge and Firefox.
|
||||
1. Remove the inheritance of text transform in Firefox.
|
||||
*/
|
||||
|
||||
button,
|
||||
select { /* 1 */
|
||||
text-transform: none;
|
||||
}
|
||||
|
||||
/**
|
||||
Correct the inability to style clickable types in iOS and Safari.
|
||||
*/
|
||||
|
||||
button,
|
||||
[type='button'],
|
||||
[type='reset'],
|
||||
[type='submit'] {
|
||||
-webkit-appearance: button;
|
||||
}
|
||||
|
||||
/**
|
||||
Remove the inner border and padding in Firefox.
|
||||
*/
|
||||
|
||||
::-moz-focus-inner {
|
||||
border-style: none;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/**
|
||||
Restore the focus styles unset by the previous rule.
|
||||
*/
|
||||
|
||||
:-moz-focusring {
|
||||
outline: 1px dotted ButtonText;
|
||||
}
|
||||
|
||||
/**
|
||||
Remove the additional ':invalid' styles in Firefox.
|
||||
See: https://github.com/mozilla/gecko-dev/blob/2f9eacd9d3d995c937b4251a5557d95d494c9be1/layout/style/res/forms.css#L728-L737
|
||||
*/
|
||||
|
||||
:-moz-ui-invalid {
|
||||
box-shadow: none;
|
||||
}
|
||||
|
||||
/**
|
||||
Remove the padding so developers are not caught out when they zero out 'fieldset' elements in all browsers.
|
||||
*/
|
||||
|
||||
legend {
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/**
|
||||
Add the correct vertical alignment in Chrome and Firefox.
|
||||
*/
|
||||
|
||||
progress {
|
||||
vertical-align: baseline;
|
||||
}
|
||||
|
||||
/**
|
||||
Correct the cursor style of increment and decrement buttons in Safari.
|
||||
*/
|
||||
|
||||
::-webkit-inner-spin-button,
|
||||
::-webkit-outer-spin-button {
|
||||
height: auto;
|
||||
}
|
||||
|
||||
/**
|
||||
1. Correct the odd appearance in Chrome and Safari.
|
||||
2. Correct the outline style in Safari.
|
||||
*/
|
||||
|
||||
[type='search'] {
|
||||
-webkit-appearance: textfield; /* 1 */
|
||||
outline-offset: -2px; /* 2 */
|
||||
}
|
||||
|
||||
/**
|
||||
Remove the inner padding in Chrome and Safari on macOS.
|
||||
*/
|
||||
|
||||
::-webkit-search-decoration {
|
||||
-webkit-appearance: none;
|
||||
}
|
||||
|
||||
/**
|
||||
1. Correct the inability to style clickable types in iOS and Safari.
|
||||
2. Change font properties to 'inherit' in Safari.
|
||||
*/
|
||||
|
||||
::-webkit-file-upload-button {
|
||||
-webkit-appearance: button; /* 1 */
|
||||
font: inherit; /* 2 */
|
||||
}
|
||||
|
||||
/*
|
||||
Interactive
|
||||
===========
|
||||
*/
|
||||
|
||||
/*
|
||||
Add the correct display in Chrome and Safari.
|
||||
*/
|
||||
|
||||
summary {
|
||||
display: list-item;
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
---
|
||||
|
||||
@import "modern-normalize.scss";
|
||||
@import "main.scss";
|
||||
@@ -1,16 +0,0 @@
|
||||
{ stdenv, jekyll }:
|
||||
stdenv.mkDerivation rec {
|
||||
name = "foo-bar";
|
||||
src = ./.;
|
||||
|
||||
buildInputs = [ jekyll ];
|
||||
|
||||
JEKYLL_ENV = "production";
|
||||
|
||||
buildPhase = "jekyll build";
|
||||
|
||||
installPhase = ''
|
||||
mkdir -p $out
|
||||
cp -Tr _site $out
|
||||
'';
|
||||
}
|
||||
@@ -1,35 +0,0 @@
|
||||
{
|
||||
description = "Foo bar";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-22.05";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, nix-colors }:
|
||||
let
|
||||
supportedSystems = [ "x86_64-linux" "aarch64-linux" ];
|
||||
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
|
||||
pkgsFor = nixpkgs.legacyPackages;
|
||||
in
|
||||
rec {
|
||||
packages = forAllSystems (system: rec {
|
||||
default = site;
|
||||
site = pkgsFor.${system}.callPackage ./. { };
|
||||
serve = pkgsFor.${system}.writeShellScriptBin "serve" ''
|
||||
echo "Serving on http://localhost:4000"
|
||||
${pkgsFor.${system}.webfs}/bin/webfsd -p 4000 -F -f index.html -r ${site}
|
||||
'';
|
||||
});
|
||||
|
||||
apps = forAllSystems (system: {
|
||||
default = {
|
||||
type = "app";
|
||||
program = "${packages.${system}.serve}/bin/serve";
|
||||
};
|
||||
});
|
||||
|
||||
hydraJobs = {
|
||||
x86_64-linux.site = packages.x86_64-linux.site;
|
||||
};
|
||||
};
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
layout: default
|
||||
---
|
||||
|
||||
Hello, world!
|
||||
@@ -0,0 +1,3 @@
|
||||
result
|
||||
build
|
||||
node_modules
|
||||
@@ -0,0 +1,10 @@
|
||||
{ buildNpmPackage }:
|
||||
|
||||
buildNpmPackage {
|
||||
pname = "foo-bar";
|
||||
version = "0.1.0";
|
||||
|
||||
src = ./.;
|
||||
|
||||
npmDepsHash = "sha256-ykdiIuGYEUrWitBnV9Z89FZXpnJ3ODms9xiWOEtW+1s=";
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
{
|
||||
description = "Foo Bar NodeJS Project";
|
||||
|
||||
nixConfig = {
|
||||
extra-substituters = [ "https://cache.m7.rs" ];
|
||||
extra-trusted-public-keys = [ "cache.m7.rs:kszZ/NSwE/TjhOcPPQ16IuUiuRSisdiIwhKZCxguaWg=" ];
|
||||
};
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.11";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs }:
|
||||
let
|
||||
forAllSystems = nixpkgs.lib.genAttrs [ "x86_64-linux" "aarch64-linux" ];
|
||||
pkgsFor = nixpkgs.legacyPackages;
|
||||
in
|
||||
rec {
|
||||
packages = forAllSystems (system: {
|
||||
default = pkgsFor.${system}.callPackage ./default.nix { };
|
||||
});
|
||||
|
||||
devShells = forAllSystems (system: {
|
||||
default = pkgsFor.${system}.callPackage ./shell.nix { };
|
||||
});
|
||||
|
||||
hydraJobs = packages;
|
||||
};
|
||||
}
|
||||
|
||||
Generated
+52
@@ -0,0 +1,52 @@
|
||||
{
|
||||
"name": "foo-bar",
|
||||
"version": "0.1.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "foo-bar",
|
||||
"version": "0.1.0",
|
||||
"license": "MIT",
|
||||
"bin": {
|
||||
"foo-bar": "build/index.js"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^20.1.2",
|
||||
"typescript": "^5.0.4",
|
||||
"typescript-language-server": "^3.3.2"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/node": {
|
||||
"version": "20.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.1.2.tgz",
|
||||
"integrity": "sha512-CTO/wa8x+rZU626cL2BlbCDzydgnFNgc19h4YvizpTO88MFQxab8wqisxaofQJ/9bLGugRdWIuX/TbIs6VVF6g==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/typescript": {
|
||||
"version": "5.0.4",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.4.tgz",
|
||||
"integrity": "sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
"tsserver": "bin/tsserver"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12.20"
|
||||
}
|
||||
},
|
||||
"node_modules/typescript-language-server": {
|
||||
"version": "3.3.2",
|
||||
"resolved": "https://registry.npmjs.org/typescript-language-server/-/typescript-language-server-3.3.2.tgz",
|
||||
"integrity": "sha512-jzun53CIkTbpAki0nP+hk5baGW+86SNNlVhyIj2ZUy45zUkCnmoetWuAtfRRQYrlIr8x4QB3ymGJPuwDQSd/ew==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"typescript-language-server": "lib/cli.mjs"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.17"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"name": "foo-bar",
|
||||
"version": "0.1.0",
|
||||
"description": "Foo-bar node program",
|
||||
"bin": {
|
||||
"foo-bar": "build/index.js"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"start": "npm run build && node build/index.js"
|
||||
},
|
||||
"author": "",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@types/node": "^20.1.2",
|
||||
"typescript": "^5.0.4",
|
||||
"typescript-language-server": "^3.3.2"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{ callPackage, writeShellScriptBin }:
|
||||
|
||||
let
|
||||
mainPkg = callPackage ./default.nix { };
|
||||
npxAlias = name: writeShellScriptBin name "npx ${name} \"$@\"";
|
||||
in
|
||||
mainPkg.overrideAttrs (oa: {
|
||||
nativeBuildInputs = [
|
||||
(npxAlias "tsc")
|
||||
(npxAlias "tsserver")
|
||||
] ++ (oa.nativeBuildInputs or [ ]);
|
||||
|
||||
shellHook = ''
|
||||
npm install
|
||||
'';
|
||||
})
|
||||
@@ -0,0 +1 @@
|
||||
console.log("Hello world!")
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es2016",
|
||||
"lib": ["es6"],
|
||||
"module": "commonjs",
|
||||
"rootDir": "src",
|
||||
"resolveJsonModule": true,
|
||||
"allowJs": true,
|
||||
"outDir": "build",
|
||||
"esModuleInterop": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"strict": true,
|
||||
"noImplicitAny": true,
|
||||
"skipLibCheck": true
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
[*.rs]
|
||||
ident_style = space
|
||||
ident_size = 4
|
||||
@@ -1,4 +1,2 @@
|
||||
# nix build
|
||||
result
|
||||
# cargo build
|
||||
build
|
||||
target
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
[package]
|
||||
name = "foo-bar"
|
||||
version = "0.1.0"
|
||||
edition = "2018"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
license = "MIT"
|
||||
edition = "2021"
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
{ lib, system, naersk }:
|
||||
{ rustPlatform }:
|
||||
|
||||
let
|
||||
manifest = (lib.importTOML ./Cargo.toml).package;
|
||||
in
|
||||
naersk.lib."${system}".buildPackage {
|
||||
inherit (manifest) version;
|
||||
pname = manifest.name;
|
||||
root = lib.cleanSource ./.;
|
||||
rustPlatform.buildRustPackage {
|
||||
pname = "foo-bar";
|
||||
version = "0.1.0";
|
||||
|
||||
src = ./.;
|
||||
cargoLock.lockFile = ./Cargo.lock;
|
||||
}
|
||||
|
||||
+18
-31
@@ -1,43 +1,30 @@
|
||||
{
|
||||
description = "Foo Bar Rust Project";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.05";
|
||||
naersk.url = "github:nix-community/naersk";
|
||||
naersk.inputs.nixpkgs.follows = "nixpkgs";
|
||||
nixConfig = {
|
||||
extra-substituters = [ "https://cache.m7.rs" ];
|
||||
extra-trusted-public-keys = [ "cache.m7.rs:kszZ/NSwE/TjhOcPPQ16IuUiuRSisdiIwhKZCxguaWg=" ];
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs, naersk }:
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.11";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs }:
|
||||
let
|
||||
inherit (nixpkgs.lib) genAttrs systems;
|
||||
forAllSystems = genAttrs systems.flakeExposed;
|
||||
pkgsFor = forAllSystems (system: import nixpkgs {
|
||||
inherit system; overlays = [ self.overlays.default ];
|
||||
});
|
||||
forAllSystems = nixpkgs.lib.genAttrs [ "x86_64-linux" "aarch64-linux" ];
|
||||
pkgsFor = nixpkgs.legacyPackages;
|
||||
in
|
||||
{
|
||||
overlays = rec {
|
||||
default = final: prev: {
|
||||
foo-bar = prev.callPackage ./. { inherit naersk; };
|
||||
};
|
||||
};
|
||||
rec {
|
||||
packages = forAllSystems (system: {
|
||||
default = pkgsFor.${system}.callPackage ./default.nix { };
|
||||
});
|
||||
|
||||
packages = forAllSystems (s:
|
||||
let pkgs = pkgsFor.${s}; in
|
||||
rec {
|
||||
inherit (pkgs) foo-bar;
|
||||
default = foo-bar;
|
||||
});
|
||||
devShells = forAllSystems (system: {
|
||||
default = pkgsFor.${system}.callPackage ./shell.nix { };
|
||||
});
|
||||
|
||||
devShells = forAllSystems (s:
|
||||
let pkgs = pkgsFor.${s}; in
|
||||
rec {
|
||||
foo-bar = pkgs.mkShell {
|
||||
inputsFrom = [ pkgs.foo-bar ];
|
||||
buildInputs = with pkgs; [ rustc rust-analyzer cargo rustfmt clippy ];
|
||||
};
|
||||
default = foo-bar;
|
||||
});
|
||||
hydraJobs = packages;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
{ callPackage, rust-analyzer, rustfmt, clippy }:
|
||||
|
||||
let
|
||||
mainPkg = callPackage ./default.nix { };
|
||||
in
|
||||
mainPkg.overrideAttrs (oa: {
|
||||
nativeBuildInputs = [
|
||||
# Additional rust tooling
|
||||
rust-analyzer
|
||||
rustfmt
|
||||
clippy
|
||||
] ++ (oa.nativeBuildInputs or [ ]);
|
||||
})
|
||||
@@ -1,2 +0,0 @@
|
||||
# nix build
|
||||
result
|
||||
@@ -1,14 +0,0 @@
|
||||
{ stdenv, zip }: stdenv.mkDerivation rec {
|
||||
pname = "foo-bar";
|
||||
version = "0.1.0";
|
||||
src = ./.;
|
||||
buildInputs = [ zip ];
|
||||
buildPhase = ''
|
||||
# Do stuff
|
||||
zip -j ${pname}.zip src/*
|
||||
'';
|
||||
installPhase = ''
|
||||
mkdir -p $out
|
||||
install -Dm644 ${pname}.zip $out
|
||||
'';
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
{
|
||||
description = "Foo Bar Zip Project";
|
||||
|
||||
inputs = {
|
||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-22.05";
|
||||
};
|
||||
|
||||
outputs = { self, nixpkgs }:
|
||||
let
|
||||
inherit (nixpkgs.lib) genAttrs systems;
|
||||
forAllSystems = genAttrs systems.flakeExposed;
|
||||
pkgsFor = forAllSystems (system: import nixpkgs {
|
||||
inherit system; overlays = [ self.overlays.default ];
|
||||
});
|
||||
in
|
||||
{
|
||||
overlays = rec {
|
||||
default = final: prev: {
|
||||
foo-bar = prev.callPackage ./. { };
|
||||
};
|
||||
};
|
||||
|
||||
packages = forAllSystems (s:
|
||||
let pkgs = pkgsFor.${s}; in
|
||||
rec {
|
||||
inherit (pkgs) foo-bar;
|
||||
default = foo-bar;
|
||||
});
|
||||
|
||||
devShells = forAllSystems (s:
|
||||
let pkgs = pkgsFor.${s}; in
|
||||
rec {
|
||||
foo-bar = pkgs.mkShell {
|
||||
inputsFrom = [ pkgs.foo-bar ];
|
||||
buildInputs = with pkgs; [ unzip ];
|
||||
};
|
||||
default = foo-bar;
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user