Skip to content

Commit

Permalink
Mark treefmt-nix as optional by default
Browse files Browse the repository at this point in the history
Closes #3
  • Loading branch information
josh authored Aug 5, 2024
1 parent 67ae5e5 commit 127f496
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 30 deletions.
48 changes: 48 additions & 0 deletions flake-dev.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1722630782,
"narHash": "sha256-hMyG9/WlUi0Ho9VkRrrez7SeNlDzLxalm9FwY7n/Noo=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "d04953086551086b44b6f3c6b7eeb26294f207da",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"nixpkgs": "nixpkgs",
"treefmt-nix": "treefmt-nix"
}
},
"treefmt-nix": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1722330636,
"narHash": "sha256-uru7JzOa33YlSRwf9sfXpJG+UAV+bnBEYMjrzKrQZFw=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "768acdb06968e53aa1ee8de207fd955335c754b7",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "treefmt-nix",
"type": "github"
}
}
},
"root": "root",
"version": 7
}
13 changes: 13 additions & 0 deletions flake-update.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/sh

set -e
set -x

nix flake update \
--reference-lock-file flake.lock \
--output-lock-file flake.lock

nix flake update \
--reference-lock-file flake-dev.lock \
--override-input treefmt-nix 'github:numtide/treefmt-nix' \
--output-lock-file flake-dev.lock
28 changes: 4 additions & 24 deletions flake.lock

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

10 changes: 4 additions & 6 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,12 @@
treefmt-nix = {
url = "github:numtide/treefmt-nix";
inputs.nixpkgs.follows = "nixpkgs";
follows = "";
};
};

outputs =
{
self,
nixpkgs,
treefmt-nix,
}:
{ self, nixpkgs, ... }:
let
systems = [
"aarch64-darwin"
Expand All @@ -23,7 +20,8 @@
"x86_64-linux"
];
eachSystem = f: nixpkgs.lib.genAttrs systems (system: f nixpkgs.legacyPackages.${system});
treefmtEval = eachSystem (pkgs: treefmt-nix.lib.evalModule pkgs ./treefmt.nix);
treefmt-nix = import ./treefmt-nix.nix;
treefmtEval = eachSystem (pkgs: treefmt-nix.evalModule pkgs ./treefmt.nix);
lib = import ./lib.nix;
in
{
Expand Down
10 changes: 10 additions & 0 deletions treefmt-nix.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
let
lock = builtins.fromJSON (builtins.readFile ./flake-dev.lock);
node = lock.nodes.treefmt-nix.locked;
inherit (node) owner repo rev;
path = fetchTarball {
url = "https://github.com/${owner}/${repo}/archive/${rev}.tar.gz";
sha256 = node.narHash;
};
in
import path

0 comments on commit 127f496

Please sign in to comment.