Skip to content

Commit

Permalink
initial direnv setup
Browse files Browse the repository at this point in the history
  • Loading branch information
TheButlah committed Jan 7, 2025
1 parent 3c867ac commit a14cc25
Show file tree
Hide file tree
Showing 8 changed files with 183 additions and 0 deletions.
1 change: 1 addition & 0 deletions .envrc.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
Empty file added .github/workflows/upm.yaml
Empty file.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,7 @@ crashlytics-build.properties
# Temporary auto-generated Android Assets
/[Aa]ssets/[Ss]treamingAssets/aa.meta
/[Aa]ssets/[Ss]treamingAssets/aa/*

# nix stuff
.direnv/
.envrc
78 changes: 78 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

45 changes: 45 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
description = "BasisVR/UpmBuilds repo";

inputs = {
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:NixOS/nixpkgs/release-24.11";
nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
};

outputs = inputs-raw@{ flake-utils, ... }:
let
# All systems we may care about evaluating nixpkgs for
systems = with flake-utils.lib.system; [ x86_64-linux aarch64-linux aarch64-darwin x86_64-darwin ];
perSystem = (system: rec {
inputs = inputs-raw;
pkgs = import inputs.nixpkgs {
inherit system;
overlays = [
((import nix/overlays/nixpkgs-unstable.nix) { inherit inputs; })
];
config = {
# allowUnfree = true;
permittedInsecurePackages = [
# Needed for roslyn-ls, see
# https://github.com/NixOS/nixpkgs/blob/4989a246/pkgs/by-name/ro/roslyn-ls/package.nix#L21
"dotnet-sdk-6.0.428"
];
};
};
});
# This `s` helper variable caches each system we care about in one spot
inherit (flake-utils.lib.eachSystem systems (system: { s = perSystem system; })) s;
in
# System-specific stuff goes in here, by using the flake-utils helper functions
flake-utils.lib.eachSystem systems
(system:
let
inherit (s.${system}) pkgs inputs;
in
{
formatter = pkgs.nixpkgs-fmt;
devShells = import ./nix/devShells.nix { inherit system pkgs inputs; };
}
);
}
22 changes: 22 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Default recipe to run when just is called without arguments
default: build

# Set the project name
project := "SimpleBase"

# Clean build outputs
clean:
dotnet clean
rm -rf **/bin **/obj

# Restore NuGet packages
restore:
dotnet restore

# Build the project
build: restore
dotnet build --configuration Release

# Create a new release build
release: clean restore
dotnet publish --configuration Release --output ./publish
26 changes: 26 additions & 0 deletions nix/devShells.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Defines all devShells for the flake
{ system, pkgs, inputs }:
let
dotnet = (with pkgs.dotnetCorePackages;
# Multiple dotnet sdks can be provided here
combinePackages [
sdk_9_0
]);
in
{
default = pkgs.mkShell {
# These programs be available to the dev shell
buildInputs = (with pkgs; [
dotnet
nixpkgs-fmt
roslyn-ls
just
]) ++ pkgs.lib.optional pkgs.stdenv.isDarwin [
pkgs.libiconv
];

# Hook the shell to set custom env vars
shellHook = ''
'';
};
}
7 changes: 7 additions & 0 deletions nix/overlays/nixpkgs-unstable.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{ inputs, ... }:
final: _prev: {
unstable = import inputs.nixpkgs-unstable {
system = final.system;
config = final.config;
};
}

0 comments on commit a14cc25

Please sign in to comment.