Skip to content

Commit

Permalink
Merge pull request #48 from jwillikers/update
Browse files Browse the repository at this point in the history
Convert Bash script to Nushell
  • Loading branch information
jwillikers authored Nov 18, 2024
2 parents dc7c99e + 588632c commit cd5d5d0
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/update-nix-direnv.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- uses: DeterminateSystems/nix-installer-action@v16
- uses: DeterminateSystems/magic-nix-cache-action@v8
- name: Update nix-direnv to the latest version
run: nix run '.#update-nix-direnv'
run: nix run .#update-nix-direnv
- name: Create Pull Request
uses: peter-evans/create-pull-request@v7
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update-nixos-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Update NixOS Release

"on":
schedule:
- cron: "0 0 15 5,11 *"
- cron: "0 0 15 6,12 *"
workflow_dispatch:

permissions:
Expand Down
3 changes: 3 additions & 0 deletions .justfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ check: build && format
yamllint .
asciidoctor {CODE_OF_CONDUCT,LICENSE,README}.adoc
lychee --cache _site/ *.html
nix flake check

alias f := format
alias fmt := format
Expand All @@ -27,6 +28,8 @@ alias u := update
alias up := update

update:
nix run ".#update-nix-direnv"
nix run ".#update-nixos-release"
nix flake update
bundle update
bundix
Expand Down
10 changes: 10 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,7 @@
"pacman",
"passwd",
"Phoronix",
"Piceiver",
"Pinebook",
"pinentry",
"Pipenv",
Expand Down Expand Up @@ -285,6 +286,15 @@
"files.associations": {
"*.html": "liquid"
},
"files.watcherExclude": {
"_site/**": true,
".direnv/**": true,
".jekyll-cache/**": true,
".lycheecache": true,
".pre-commit-config.yaml": true,
"result": true,
"result/**": true
},
"nix.enableLanguageServer": true,
"nix.serverPath": "nil"
}
29 changes: 11 additions & 18 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -50,23 +50,17 @@
with pkgs;
{
apps = {
inherit (nix-update-scripts.apps.${system}) update-nix-direnv;
inherit (nix-update-scripts.apps.${system}) update-nixos-release;
default =
let
script = pkgs.writeShellApplication {
name = "serve";
text = ''
${gems}/bin/jekyll serve --destination ${
self.packages.${system}.default
}/srv --open-url --skip-initial-build
'';
};
in
{
type = "app";
program = "${script}/bin/serve";
};
inherit (nix-update-scripts.apps.${system}) update-nix-direnv update-nixos-release;
default = {
type = "app";
program = builtins.toString (
pkgs.writers.writeNu "serve" ''
^${gems}/bin/jekyll serve --destination ${
self.packages.${system}.default
}/srv --open-url --skip-initial-build
''
);
};
};
devShells.default = mkShell {
nativeBuildInputs =
Expand All @@ -80,7 +74,6 @@
gems.wrappedRuby
just
lychee
nil
nushell
treefmtEval.config.build.wrapper
(builtins.attrValues treefmtEval.config.build.programs)
Expand Down
8 changes: 6 additions & 2 deletions package.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{ stdenv, gems }:
stdenv.mkDerivation {
{ stdenvNoCC, gems }:
stdenvNoCC.mkDerivation {
pname = "jwillikers-blog";
version = "0.1.0";

Expand All @@ -11,11 +11,15 @@ stdenv.mkDerivation {
];

buildPhase = ''
runHook preBuild
jekyll build
runHook postBuild
'';

installPhase = ''
runHook preInstall
mkdir --parents $out
mv _site $out/srv
runHook postInstall
'';
}
2 changes: 1 addition & 1 deletion pre-commit-hooks.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# todo Not integrated with Nix?
check-format = {
enable = true;
entry = "${treefmtEval.config.build.wrapper}/bin/treefmt --fail-on-change";
entry = "${treefmtEval.config.build.wrapper}/bin/treefmt-nix --fail-on-change";
};

check-json.enable = true;
Expand Down

0 comments on commit cd5d5d0

Please sign in to comment.