Skip to content

Commit

Permalink
Merge pull request #43 from the-nix-way/empty-template
Browse files Browse the repository at this point in the history
Add empty template and make various updates
  • Loading branch information
lucperkins authored Apr 15, 2024
2 parents 7e19222 + 48f8a53 commit 19eaf10
Show file tree
Hide file tree
Showing 43 changed files with 349 additions and 295 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
on:
pull_request:
push:
branches: [main]

jobs:
check:
runs-on: "ubuntu-22.04"
steps:
- uses: "actions/checkout@v4"
- uses: "DeterminateSystems/nix-installer-action@main"
- uses: "DeterminateSystems/magic-nix-cache-action@main"
- name: Flake check
run: nix develop --command check
5 changes: 3 additions & 2 deletions .github/workflows/flakehub-publish-tagged.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ on:

jobs:
publish:
runs-on: "ubuntu-latest"
runs-on: "ubuntu-22.04"
permissions:
id-token: "write"
contents: "read"
steps:
- uses: "actions/checkout@v3"
- uses: "actions/checkout@v4"
- uses: "DeterminateSystems/nix-installer-action@main"
- uses: "DeterminateSystems/magic-nix-cache-action@main"
- uses: "DeterminateSystems/flakehub-push@main"
with:
visibility: "public"
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Once your preferred template has been initialized, you can use the provided shel
| [Dhall] | [`dhall`](./dhall/) |
| [Elixir] | [`elixir`](./elixir/) |
| [Elm] | [`elm`](./elm/) |
| Empty (change at will) | [`empty`](./empty) |
| [Gleam] | [`gleam`](./gleam/) |
| [Go] | [`go`](./go/) |
| [Hashicorp] tools | [`hashi`](./hashi/) |
Expand Down Expand Up @@ -103,6 +104,10 @@ The sections below list what each template includes. In all cases, you're free t
- [Elm] 0.19.1
- [elm2nix]

### [Empty](./empty/)

A dev template that's fully customizable.

### [`gleam`](./gleam/)

- [Gleam] 0.30.0
Expand Down
10 changes: 5 additions & 5 deletions clojure/flake.lock

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

10 changes: 5 additions & 5 deletions csharp/flake.lock

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

10 changes: 5 additions & 5 deletions cue/flake.lock

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

10 changes: 5 additions & 5 deletions dhall/flake.lock

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

10 changes: 5 additions & 5 deletions elixir/flake.lock

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

8 changes: 5 additions & 3 deletions elixir/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,12 @@
default = pkgs.mkShell {
packages = (with pkgs; [ elixir ]) ++
# Linux only
pkgs.lib.optionals (pkgs.stdenv.isLinux) (with pkgs; [ gigalixir inotify-tools libnotify ]) ++
(pkgs.lib.optionals (pkgs.stdenv.isLinux)
(with pkgs; [ gigalixir inotify-tools libnotify ])) ++
# macOS only
pkgs.lib.optionals (pkgs.stdenv.isDarwin) (with pkgs; [ terminal-notifier ]) ++
(with pkgs.darwin.apple_sdk.frameworks; [ CoreFoundation CoreServices ]);
pkgs.lib.optionals (pkgs.stdenv.isDarwin)
((with pkgs; [ terminal-notifier ]) ++
(with pkgs.darwin.apple_sdk.frameworks; [ CoreFoundation CoreServices ]));
};
});
};
Expand Down
10 changes: 5 additions & 5 deletions elm/flake.lock

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

25 changes: 25 additions & 0 deletions empty/flake.lock

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

39 changes: 39 additions & 0 deletions empty/flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
description = "An empty flake template that you can adapt to your own environment";

# Flake inputs
inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1.*.tar.gz";

# Flake outputs
outputs = { self, nixpkgs }:
let
# The systems supported for this flake
supportedSystems = [
"x86_64-linux" # 64-bit Intel/AMD Linux
"aarch64-linux" # 64-bit ARM Linux
"x86_64-darwin" # 64-bit Intel macOS
"aarch64-darwin" # 64-bit ARM macOS
];

# Helper to provide system-specific attributes
forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f {
pkgs = import nixpkgs { inherit system; };
});
in
{
devShells = forEachSupportedSystem ({ pkgs }: {
default = pkgs.mkShell {
# The Nix packages provided in the environment
# Add any you need here
packages = with pkgs; [ ];

# Set any environment variables for your dev shell
env = { };

# Add any shell logic you want executed any time the environment is activated
shellHook = ''
'';
};
});
};
}
31 changes: 28 additions & 3 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,17 @@
format = prev.writeScriptBin "format" ''
${exec "nixpkgs-fmt"} **/*.nix
'';

check = prev.writeScriptBin "check" ''
for dir in `ls -d */`; do # Iterate through all the templates
(
cd $dir
nix flake check --all-systems --no-build
)
done
'';

dvt = prev.writeScriptBin "dvt" ''
if [ -z $1 ]; then
echo "no template specified"
Expand All @@ -28,12 +39,21 @@
--template \
"github:the-nix-way/dev-templates#''${TEMPLATE}"
'';

update = prev.writeScriptBin "update" ''
for dir in `ls -d */`; do # Iterate through all the templates
(
cd $dir
${exec "nix"} flake update # Update flake.lock
${exec "nix"} flake check # Make sure things work after the update
echo "updating ''${dir}"
# Update flake.lock
nix flake update
echo "checking ''${dir}"
# Make sure things work after the update
nix flake check --all-systems --no-build
)
done
'';
Expand All @@ -47,7 +67,7 @@
{
devShells = forEachSupportedSystem ({ pkgs }: {
default = pkgs.mkShell {
packages = with pkgs; [ format update ];
packages = with pkgs; [ check format update ];
};
});

Expand Down Expand Up @@ -91,6 +111,11 @@
description = "Elm development environment";
};

empty = {
path = ./empty;
description = "Empty dev template that you can customize at will";
};

gleam = {
path = ./gleam;
description = "Gleam development environment";
Expand Down
10 changes: 5 additions & 5 deletions gleam/flake.lock

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

10 changes: 5 additions & 5 deletions go/flake.lock

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

8 changes: 4 additions & 4 deletions go/flake.nix
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
description = "A Nix-flake-based Go 1.17 development environment";
description = "A Nix-flake-based Go 1.22 development environment";

inputs.nixpkgs.url = "https://flakehub.com/f/NixOS/nixpkgs/0.1.*.tar.gz";

outputs = { self, nixpkgs }:
let
goVersion = 20; # Change this to update the whole stack
goVersion = 22; # Change this to update the whole stack
overlays = [ (final: prev: { go = prev."go_1_${toString goVersion}"; }) ];
supportedSystems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ];
forEachSupportedSystem = f: nixpkgs.lib.genAttrs supportedSystems (system: f {
Expand All @@ -16,8 +16,8 @@
devShells = forEachSupportedSystem ({ pkgs }: {
default = pkgs.mkShell {
packages = with pkgs; [
# go 1.20 (specified by overlay)
go
# go 1.22 (specified by overlay)
go_1_22

# goimports, godoc, etc.
gotools
Expand Down
10 changes: 5 additions & 5 deletions hashi/flake.lock

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

Loading

0 comments on commit 19eaf10

Please sign in to comment.