meta: refactor c and dotnet
This commit is contained in:
parent
599fe1903f
commit
a4368b5ddc
14 changed files with 53 additions and 252 deletions
|
@ -1,28 +1,21 @@
|
||||||
{
|
{
|
||||||
description = "REPLACE_DESC";
|
description = "REPLACE_DESC";
|
||||||
|
|
||||||
inputs = {
|
inputs = { nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; };
|
||||||
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
||||||
};
|
|
||||||
|
|
||||||
outputs = {
|
outputs = { self, nixpkgs, }:
|
||||||
self,
|
let
|
||||||
nixpkgs,
|
inherit (nixpkgs) lib;
|
||||||
}: let
|
forAllSystems = f:
|
||||||
inherit (nixpkgs) lib;
|
lib.genAttrs [ "x86_64-linux" "aarch64-linux" ]
|
||||||
forAllSystems = f:
|
(system: f { pkgs = import nixpkgs { inherit system; }; });
|
||||||
lib.genAttrs ["x86_64-linux" "aarch64-linux"] (system:
|
in {
|
||||||
f {
|
packages = forAllSystems ({ pkgs }: {
|
||||||
pkgs = import nixpkgs {
|
default = pkgs.callPackage ./flake/default.nix { };
|
||||||
inherit system;
|
REPLACE_ME = self.packages.${pkgs.system}.default;
|
||||||
};
|
});
|
||||||
});
|
|
||||||
in {
|
|
||||||
packages = forAllSystems ({pkgs}: {
|
|
||||||
default = pkgs.callPackage ./flake/default.nix {};
|
|
||||||
REPLACE_ME = self.packages.${pkgs.system}.default;
|
|
||||||
});
|
|
||||||
|
|
||||||
formatter = forAllSystems ({pkgs}: pkgs.callPackage ./flake/formatter.nix {});
|
formatter =
|
||||||
};
|
forAllSystems ({ pkgs }: pkgs.callPackage ./flake/formatter.nix { });
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,4 @@
|
||||||
{
|
{ stdenv, lib, meson, ninja, }:
|
||||||
stdenv,
|
|
||||||
lib,
|
|
||||||
meson,
|
|
||||||
ninja,
|
|
||||||
}:
|
|
||||||
stdenv.mkDerivation {
|
stdenv.mkDerivation {
|
||||||
pname = "REPLACE_ME";
|
pname = "REPLACE_ME";
|
||||||
version = "1";
|
version = "1";
|
||||||
|
@ -13,10 +8,7 @@ stdenv.mkDerivation {
|
||||||
filter = path: _type: baseNameOf path != ".git";
|
filter = path: _type: baseNameOf path != ".git";
|
||||||
};
|
};
|
||||||
|
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [ meson ninja ];
|
||||||
meson
|
|
||||||
ninja
|
|
||||||
];
|
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
mkdir -p $out/bin
|
mkdir -p $out/bin
|
||||||
|
|
|
@ -1,20 +1,10 @@
|
||||||
{
|
{ writeShellApplication, nixfmt, deadnix, statix, llvmPackages_19, fd, }:
|
||||||
writeShellApplication,
|
|
||||||
alejandra,
|
|
||||||
llvmPackages_19,
|
|
||||||
fd,
|
|
||||||
}:
|
|
||||||
writeShellApplication {
|
writeShellApplication {
|
||||||
name = "formatter";
|
name = "formatter";
|
||||||
runtimeInputs = [
|
runtimeInputs = [ nixfmt deadnix statix llvmPackages_19.clang-tools fd ];
|
||||||
alejandra
|
|
||||||
llvmPackages_19.clang-tools
|
|
||||||
fd
|
|
||||||
];
|
|
||||||
text = ''
|
text = ''
|
||||||
fd --extension nix -X alejandra -- {}
|
fd -e nix -X nixfmt {} \; -X deadnix -e {}
|
||||||
fd --extension nix -X deadnix -e -- {}
|
fd -e nix -x statix fix {}
|
||||||
fd --extension nix -x statix fix -- {}
|
fd -e c -e h -X clang-format --verbose -i {}
|
||||||
fd --extension c -X clang-format --verbose -i -- {}
|
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace DotnetApplication {
|
namespace CHANGE_NAME {
|
||||||
class Program {
|
class Program {
|
||||||
static void Main(string[] args) {
|
static void Main(string[] args) {
|
||||||
Console.WriteLine("Hello, world!");
|
Console.WriteLine("Hello, world!");
|
|
@ -1,68 +0,0 @@
|
||||||
{
|
|
||||||
"format": 1,
|
|
||||||
"restore": {
|
|
||||||
"/home/artur/Projects/C#/JSchlattVideoGame/JSchlattVideoGame.csproj": {}
|
|
||||||
},
|
|
||||||
"projects": {
|
|
||||||
"/home/artur/Projects/C#/JSchlattVideoGame/JSchlattVideoGame.csproj": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"restore": {
|
|
||||||
"projectUniqueName": "/home/artur/Projects/C#/JSchlattVideoGame/JSchlattVideoGame.csproj",
|
|
||||||
"projectName": "JSchlattVideoGame",
|
|
||||||
"projectPath": "/home/artur/Projects/C#/JSchlattVideoGame/JSchlattVideoGame.csproj",
|
|
||||||
"packagesPath": "/home/artur/.nuget/packages/",
|
|
||||||
"outputPath": "/home/artur/Projects/C#/JSchlattVideoGame/obj/",
|
|
||||||
"projectStyle": "PackageReference",
|
|
||||||
"configFilePaths": [
|
|
||||||
"/home/artur/.nuget/NuGet/NuGet.Config"
|
|
||||||
],
|
|
||||||
"originalTargetFrameworks": [
|
|
||||||
"net9.0"
|
|
||||||
],
|
|
||||||
"sources": {
|
|
||||||
"/nix/store/0w5k79zvjzingpnzz07ijqjbgsylcgfa-dotnet-sdk-9.0.100/share/dotnet/library-packs": {},
|
|
||||||
"https://api.nuget.org/v3/index.json": {}
|
|
||||||
},
|
|
||||||
"frameworks": {
|
|
||||||
"net9.0": {
|
|
||||||
"targetAlias": "net9.0",
|
|
||||||
"projectReferences": {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"warningProperties": {
|
|
||||||
"warnAsError": [
|
|
||||||
"NU1605"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"restoreAuditProperties": {
|
|
||||||
"enableAudit": "true",
|
|
||||||
"auditLevel": "low",
|
|
||||||
"auditMode": "all"
|
|
||||||
},
|
|
||||||
"SdkAnalysisLevel": "9.0.100"
|
|
||||||
},
|
|
||||||
"frameworks": {
|
|
||||||
"net9.0": {
|
|
||||||
"targetAlias": "net9.0",
|
|
||||||
"imports": [
|
|
||||||
"net461",
|
|
||||||
"net462",
|
|
||||||
"net47",
|
|
||||||
"net471",
|
|
||||||
"net472",
|
|
||||||
"net48",
|
|
||||||
"net481"
|
|
||||||
],
|
|
||||||
"assetTargetFallback": true,
|
|
||||||
"warn": true,
|
|
||||||
"frameworkReferences": {
|
|
||||||
"Microsoft.NETCore.App": {
|
|
||||||
"privateAssets": "all"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"runtimeIdentifierGraphPath": "/nix/store/0w5k79zvjzingpnzz07ijqjbgsylcgfa-dotnet-sdk-9.0.100/share/dotnet/sdk/9.0.100/PortableRuntimeIdentifierGraph.json"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,15 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
|
||||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
||||||
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
|
||||||
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
|
|
||||||
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
|
|
||||||
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
|
|
||||||
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">/home/artur/.nuget/packages/</NuGetPackageRoot>
|
|
||||||
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">/home/artur/.nuget/packages/</NuGetPackageFolders>
|
|
||||||
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
|
|
||||||
<NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.12.0</NuGetToolVersion>
|
|
||||||
</PropertyGroup>
|
|
||||||
<ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
|
|
||||||
<SourceRoot Include="/home/artur/.nuget/packages/" />
|
|
||||||
</ItemGroup>
|
|
||||||
</Project>
|
|
|
@ -1,2 +0,0 @@
|
||||||
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
|
||||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" />
|
|
|
@ -1,73 +0,0 @@
|
||||||
{
|
|
||||||
"version": 3,
|
|
||||||
"targets": {
|
|
||||||
"net9.0": {}
|
|
||||||
},
|
|
||||||
"libraries": {},
|
|
||||||
"projectFileDependencyGroups": {
|
|
||||||
"net9.0": []
|
|
||||||
},
|
|
||||||
"packageFolders": {
|
|
||||||
"/home/artur/.nuget/packages/": {}
|
|
||||||
},
|
|
||||||
"project": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"restore": {
|
|
||||||
"projectUniqueName": "/home/artur/Projects/C#/JSchlattVideoGame/JSchlattVideoGame.csproj",
|
|
||||||
"projectName": "JSchlattVideoGame",
|
|
||||||
"projectPath": "/home/artur/Projects/C#/JSchlattVideoGame/JSchlattVideoGame.csproj",
|
|
||||||
"packagesPath": "/home/artur/.nuget/packages/",
|
|
||||||
"outputPath": "/home/artur/Projects/C#/JSchlattVideoGame/obj/",
|
|
||||||
"projectStyle": "PackageReference",
|
|
||||||
"configFilePaths": [
|
|
||||||
"/home/artur/.nuget/NuGet/NuGet.Config"
|
|
||||||
],
|
|
||||||
"originalTargetFrameworks": [
|
|
||||||
"net9.0"
|
|
||||||
],
|
|
||||||
"sources": {
|
|
||||||
"/nix/store/0w5k79zvjzingpnzz07ijqjbgsylcgfa-dotnet-sdk-9.0.100/share/dotnet/library-packs": {},
|
|
||||||
"https://api.nuget.org/v3/index.json": {}
|
|
||||||
},
|
|
||||||
"frameworks": {
|
|
||||||
"net9.0": {
|
|
||||||
"targetAlias": "net9.0",
|
|
||||||
"projectReferences": {}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"warningProperties": {
|
|
||||||
"warnAsError": [
|
|
||||||
"NU1605"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"restoreAuditProperties": {
|
|
||||||
"enableAudit": "true",
|
|
||||||
"auditLevel": "low",
|
|
||||||
"auditMode": "all"
|
|
||||||
},
|
|
||||||
"SdkAnalysisLevel": "9.0.100"
|
|
||||||
},
|
|
||||||
"frameworks": {
|
|
||||||
"net9.0": {
|
|
||||||
"targetAlias": "net9.0",
|
|
||||||
"imports": [
|
|
||||||
"net461",
|
|
||||||
"net462",
|
|
||||||
"net47",
|
|
||||||
"net471",
|
|
||||||
"net472",
|
|
||||||
"net48",
|
|
||||||
"net481"
|
|
||||||
],
|
|
||||||
"assetTargetFallback": true,
|
|
||||||
"warn": true,
|
|
||||||
"frameworkReferences": {
|
|
||||||
"Microsoft.NETCore.App": {
|
|
||||||
"privateAssets": "all"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"runtimeIdentifierGraphPath": "/nix/store/0w5k79zvjzingpnzz07ijqjbgsylcgfa-dotnet-sdk-9.0.100/share/dotnet/sdk/9.0.100/PortableRuntimeIdentifierGraph.json"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,8 +0,0 @@
|
||||||
{
|
|
||||||
"version": 2,
|
|
||||||
"dgSpecHash": "1YIpH04Ngl4=",
|
|
||||||
"success": true,
|
|
||||||
"projectFilePath": "/home/artur/Projects/C#/JSchlattVideoGame/JSchlattVideoGame.csproj",
|
|
||||||
"expectedPackageFiles": [],
|
|
||||||
"logs": []
|
|
||||||
}
|
|
2
templates/dotnet/flake.lock
generated
2
templates/dotnet/flake.lock
generated
|
@ -9,7 +9,7 @@
|
||||||
"narHash": "sha256-4pDvzqnegAfRkPwO3wmwBhVi/Sye1mzps0zHWYnP88c=",
|
"narHash": "sha256-4pDvzqnegAfRkPwO3wmwBhVi/Sye1mzps0zHWYnP88c=",
|
||||||
"owner": "hercules-ci",
|
"owner": "hercules-ci",
|
||||||
"repo": "flake-parts",
|
"repo": "flake-parts",
|
||||||
"rev": "205b12d8b7cd4802fbcb8e8ef6a0f1408781a4f9",
|
"rev": "205b12d8b7cd4802fbcb8e8ef6aCHANGE_VER8781a4f9",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
|
@ -1,42 +1,27 @@
|
||||||
{
|
{
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||||
flake-parts.url = "github:hercules-ci/flake-parts";
|
systems.url = "github:nix-systems/default";
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = inputs @ {
|
outputs =
|
||||||
self,
|
{
|
||||||
nixpkgs,
|
self,
|
||||||
...
|
nixpkgs,
|
||||||
}:
|
systems
|
||||||
inputs.flake-parts.lib.mkFlake {inherit inputs;} {
|
}: let
|
||||||
systems = ["x86_64-linux"];
|
pkgsFor = nixpkgs.legacyPackages;
|
||||||
flake.overlays.default = final: prev: {
|
forAllSystems = f: nixpkgs.lib.genAttrs (import systems) (system: f system pkgsFor.${system});
|
||||||
dotnet-application = final.callPackage ./nix/derivation.nix {};
|
in {
|
||||||
};
|
packages = forAllSystems (system: pkgs: {
|
||||||
perSystem = {
|
default = pkgs.callPackage ./flake/package.nix { };
|
||||||
pkgs,
|
CHANGE_NAME = self.packages.${system}.default;
|
||||||
system,
|
});
|
||||||
self',
|
|
||||||
...
|
|
||||||
}: {
|
|
||||||
_module.args.pkgs = import nixpkgs {
|
|
||||||
inherit system;
|
|
||||||
overlays = [
|
|
||||||
self.overlays.default
|
|
||||||
];
|
|
||||||
};
|
|
||||||
|
|
||||||
packages = {
|
devShells = forAllSystems (_: pkgs: {
|
||||||
inherit (pkgs) dotnet-application;
|
default = pkgs.callPackage ./flake/shell.nix { };
|
||||||
default = self'.packages.dotnet-application;
|
});
|
||||||
};
|
|
||||||
|
|
||||||
devShells.default = pkgs.mkShell {
|
formatter = forAllSystems (_: pkgs: pkgs.callPackage ./flake/formatter.nix { });
|
||||||
packages = [
|
|
||||||
pkgs.dotnetCorePackages.dotnet_9.sdk
|
|
||||||
];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,11 +3,11 @@
|
||||||
dotnetCorePackages,
|
dotnetCorePackages,
|
||||||
}:
|
}:
|
||||||
buildDotnetModule {
|
buildDotnetModule {
|
||||||
pname = "DotnetApplication";
|
pname = "CHANGE_NAME";
|
||||||
version = "0.1.0";
|
version = "CHANGE_VER";
|
||||||
src = ../.;
|
src = ../.;
|
||||||
projectFile = "DotnetApplication/DotnetApplication.csproj";
|
projectFile = "CHANGE_NAME/CHANGE_NAME.csproj";
|
||||||
dotnet-sdk = dotnetCorePackages.dotnet_9.sdk;
|
dotnet-sdk = dotnetCorePackages.dotnet_9.sdk;
|
||||||
dotnet-runtime = dotnetCorePackages.dotnet_9.runtime;
|
dotnet-runtime = dotnetCorePackages.dotnet_9.runtime;
|
||||||
executables = ["DotnetApplication"];
|
executables = ["CHANGE_NAME"];
|
||||||
}
|
}
|
|
@ -1,9 +1,16 @@
|
||||||
{
|
{
|
||||||
mkShell,
|
mkShell,
|
||||||
dotnetCorePackages,
|
dotnetCorePackages,
|
||||||
|
nixfmt,
|
||||||
|
deadnix,
|
||||||
|
statix,
|
||||||
}:
|
}:
|
||||||
mkShell {
|
mkShell {
|
||||||
|
name = "dotnet";
|
||||||
packages = [
|
packages = [
|
||||||
dotnetCorePackages.dotnet_9.sdk
|
dotnetCorePackages.dotnet_9.sdk
|
||||||
|
nixfmt
|
||||||
|
deadnix
|
||||||
|
statix
|
||||||
];
|
];
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue