Skip to content

Commit

Permalink
Prefer stable bash and official fmt for Nix (#171)
Browse files Browse the repository at this point in the history
  • Loading branch information
kachick committed Apr 24, 2024
1 parent 8860223 commit 192d4a3
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"nix.serverSettings": {
"nil": {
"formatting": {
"command": ["nixpkgs-fmt"]
"command": ["nixfmt"]
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,19 @@ tasks:
- typos . .github .vscode --write-changes
- dprint fmt
- go fmt ./...
- nixpkgs-fmt ./*.nix
- nix fmt ./**/*.nix
lint:
# go fmt does not have option for no effect - https://github.com/golang/go/issues/41189
# nix fmt does not have option for no effect - https://github.com/NixOS/nix/issues/6918
cmds:
- dprint check
- go vet ./...
- goreleaser check
- typos . .github .vscode
- nixpkgs-fmt --check ./*.nix
deps:
cmds:
- nix --version
- nixfmt --version
- task --version
- go version
- dprint --version
Expand Down
25 changes: 21 additions & 4 deletions flake.lock

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

39 changes: 23 additions & 16 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,38 +5,45 @@
# - https://discourse.nixos.org/t/differences-between-nix-channels/13998
# How to update the revision
# - `nix flake update --commit-lock-file` # https://nixos.org/manual/nix/stable/command-ref/new-cli/nix3-flake-update.html
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.11";
edge-nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
};

outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
outputs =
{
self,
nixpkgs,
edge-nixpkgs,
flake-utils,
}:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
updaterVersion =
if (self ? shortRev)
then self.shortRev
else "dev";
edge-pkgs = edge-nixpkgs.legacyPackages.${system};
updaterVersion = if (self ? shortRev) then self.shortRev else "dev";
in
rec {
devShells.default = with pkgs;
formatter = edge-pkgs.nixfmt-rfc-style;
devShells.default =
with pkgs;
mkShell {
buildInputs = [
# https://github.com/NixOS/nix/issues/730#issuecomment-162323824
bashInteractive

go_1_22
nil
nixpkgs-fmt
dprint
actionlint
edge-pkgs.nixfmt-rfc-style

edge-pkgs.go_1_22
edge-pkgs.dprint
edge-pkgs.goreleaser
edge-pkgs.typos
go-task
goreleaser
typos
];
};

packages.selfup = pkgs.buildGo122Module {
packages.selfup = edge-pkgs.buildGo122Module {
pname = "selfup";
version = updaterVersion;
src = pkgs.lib.cleanSource self;
Expand Down

0 comments on commit 192d4a3

Please sign in to comment.