Skip to content

Commit

Permalink
Update flake to nixos-24.11 and install selfup in devshell
Browse files Browse the repository at this point in the history
  • Loading branch information
kachick committed Dec 9, 2024
1 parent 7b2445f commit b6816f3
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 62 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ jobs:
- uses: actions/checkout@v4
- uses: dprint/[email protected]
with:
dprint-version: '0.45.1' # selfup {"extract":"\\d[^']+","replacer":["bash","-c","dprint --version | cut -d ' ' -f 2"]}
dprint-version: '0.47.2' # selfup {"extract":"\\d[^']+","replacer":["bash","-c","dprint --version | cut -d ' ' -f 2"]}

typos:
timeout-minutes: 15
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: crate-ci/typos@v1.21.0 # selfup {"extract":"\\d\\.\\d+\\.\\d+","replacer":["bash","-c","typos --version | cut -d ' ' -f 2"]}
- uses: crate-ci/typos@v1.27.3 # selfup {"extract":"\\d\\.\\d+\\.\\d+","replacer":["bash","-c","typos --version | cut -d ' ' -f 2"]}
with:
files: |
.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/update-nixpkgs-and-versions-in-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:

jobs:
update-nixpkgs:
uses: kachick/selfup/.github/workflows/[email protected].7
uses: kachick/selfup/.github/workflows/[email protected].8
with:
app_id: ${{ vars.APP_ID }}
dry-run: ${{ github.event_name == 'pull_request' }}
Expand Down
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@
},
"[nix]": {
"editor.defaultFormatter": "jnoortheen.nix-ide"
}
},
"nix.formatterPath": "nixfmt"
}
7 changes: 6 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,10 @@ desc 'Tests except ruby'
task :linters do
sh('typos . .github .vscode')
sh('dprint check')
sh('nixpkgs-fmt --check ./*.nix')
sh('nixfmt --check ./*.nix')
end

desc 'https://github.com/kachick/selfup'
task :selfup do
sh('git ls-files | xargs selfup run')
end
52 changes: 20 additions & 32 deletions flake.lock

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

74 changes: 49 additions & 25 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,58 @@
# - 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-24.05";
flake-utils.url = "github:numtide/flake-utils";
nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.11";
selfup = {
url = "github:kachick/selfup/v1.1.8";
inputs.nixpkgs.follows = "nixpkgs";
};
};

outputs = { self, nixpkgs, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
devShells.default = with pkgs;
mkShell {
buildInputs = [
# https://github.com/NixOS/nix/issues/730#issuecomment-162323824
bashInteractive
outputs =
{ self
, nixpkgs
, selfup
,
}:
let
inherit (nixpkgs) lib;
# List: https://github.com/NixOS/nixpkgs/blob/nixos-24.05/lib/systems/flake-systems.nix
#
# https://github.com/NixOS/nixpkgs/blob/475556854559746466df20d74eef189373816b67/flake.nix?plain=1#L11
# https://github.com/NixOS/nixpkgs/blob/475556854559746466df20d74eef189373816b67/lib/systems/default.nix?plain=1#L48-L56
forAllSystems = lib.genAttrs lib.systems.flakeExposed;
in
{
formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.nixfmt-rfc-style);
devShells = forAllSystems (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
default = pkgs.mkShellNoCC {
buildInputs =
(with pkgs; [
# https://github.com/NixOS/nix/issues/730#issuecomment-162323824
# https://github.com/kachick/dotfiles/pull/228
bashInteractive
findutils # xargs
nixfmt-rfc-style
nil

ruby_3_3
# Required to build psych via irb dependency
# https://github.com/kachick/rspec-matchers-power_assert_matchers/issues/122
# https://github.com/ruby/irb/pull/648
libyaml
ruby_3_3
# Required to build psych via irb dependency
# https://github.com/kachick/rspec-matchers-power_assert_matchers/issues/122
# https://github.com/ruby/irb/pull/648
libyaml

dprint
tree
nil
nixpkgs-fmt
typos
];

dprint
typos
])
++ [ selfup.packages.${system}.default ];
};
});
}
);
};
}

0 comments on commit b6816f3

Please sign in to comment.