Skip to content
This repository has been archived by the owner on Jun 4, 2024. It is now read-only.

Commit

Permalink
feat(treefmt): add treefmt-nix (#21)
Browse files Browse the repository at this point in the history
- adds treefmt-nix that allows `nix fmt` and `nix flake check`
  • Loading branch information
storopoli authored Dec 19, 2023
1 parent c32f264 commit b7cc8a1
Show file tree
Hide file tree
Showing 25 changed files with 650 additions and 585 deletions.
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ Read more about this in the [NixOs Paranoid Guide](https://xeiaso.net/blog/paran
- [`Nerdfonts`](https://github.com/ryanoasis/nerd-fonts).

- Apps:

- [`foot`](https://codeberg.org/dnkl/foot)
- [`firefox`](https://www.mozilla.org/firefox) with the following add-ons:

Expand Down Expand Up @@ -286,8 +287,7 @@ As root:
### Wireguard VPN Configs
> Sources: [manpage of `wg-quick`](https://manpages.debian.org/unstable/wireguard-tools/wg-quick.8.en.html),
> [Mullvad WireGuard on Linux terminal](https://mullvad.net/en/help/easy-wireguard-mullvad-setup-linux/)
> [IVPN Autostart WireGuard in systemd](https://www.ivpn.net/knowledgebase/linux/linux-autostart-wireguard-in-systemd/),
> [Mullvad WireGuard on Linux terminal](https://mullvad.net/en/help/easy-wireguard-mullvad-setup-linux/) > [IVPN Autostart WireGuard in systemd](https://www.ivpn.net/knowledgebase/linux/linux-autostart-wireguard-in-systemd/),
> and [IVPN WireGuard Kill Switch](https://www.ivpn.net/knowledgebase/linux/linux-wireguard-kill-switch/)
For the extra paranoid, you can use VPNs without installing their apps.
Expand Down Expand Up @@ -412,6 +412,7 @@ Migrating to new hardware or rebuilding old hardware after a wipe is a breeze.
[Rectangle](https://github.com/rxhanson/Rectangle).
- Apps:
- [Alacritty](https://alacritty.org/)
- [Brave](https://brave.com/) with [Tor Browser](https://www.torproject.org/)
also available
Expand Down
53 changes: 52 additions & 1 deletion flake.lock

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

56 changes: 34 additions & 22 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
};

flake-parts.url = "github:hercules-ci/flake-parts";
flake-root.url = "github:srid/flake-root";
treefmt-nix.url = "github:numtide/treefmt-nix";
nixos-flake.url = "github:srid/nixos-flake";
rust-overlay.url = "github:oxalica/rust-overlay";
agenix.url = "github:ryantm/agenix";
Expand All @@ -28,26 +30,48 @@
};
};

outputs = inputs@{ self, ... }:
outputs = inputs @ { self, ... }:
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
systems = [ "x86_64-linux" "aarch64-darwin" "x86_64-darwin" ];
imports = [
inputs.nixos-flake.flakeModule
inputs.flake-root.flakeModule
inputs.treefmt-nix.flakeModule
];

perSystem = { config, inputs', pkgs, system, ... }:
perSystem =
{ config
, inputs'
, pkgs
, system
, ...
}:
let
pkgs = import inputs.nixpkgs {
inherit system;
};
pkgs = import inputs.nixpkgs { inherit system; };
in
{
devShells = {
# run by `nix develop` or `nix-shell`(legacy)
default = import ./shell.nix { inherit pkgs; };
tools = _:
{
treefmt = config.treefmt.build.wrapper;
}
// config.treefmt.build.programs;
};

formatter = pkgs.nixpkgs-fmt;
# treefmt config
treefmt.config = {
inherit (config.flake-root) projectRootFile;
package = pkgs.treefmt;

# Enable the formatters
programs.beautysh.enable = true;
programs.nixpkgs-fmt.enable = true;
programs.prettier.enable = true;
programs.stylua.enable = true;
programs.taplo.enable = true;
};
};

flake =
Expand Down Expand Up @@ -98,10 +122,7 @@
self.darwinModules_.home-manager
{
home-manager.users.user = {
imports = [
self.homeModules.common
self.homeModules.darwin
];
imports = [ self.homeModules.common self.homeModules.darwin ];
home.stateVersion = homeStateVersion;
};
}
Expand All @@ -116,10 +137,7 @@
self.darwinModules_.home-manager
{
home-manager.users.user = {
imports = [
self.homeModules.common
self.homeModules.darwin
];
imports = [ self.homeModules.common self.homeModules.darwin ];
home.stateVersion = homeStateVersion;
};
}
Expand Down Expand Up @@ -150,20 +168,14 @@
inputs.nur.nixosModules.nur
inputs.impermanence.nixosModules.impermanence
inputs.disko.nixosModules.disko
{
nixpkgs.overlays = [
inputs.nur.overlay
];
}
{ nixpkgs.overlays = [ inputs.nur.overlay ]; }
(import ./linux)
];
system.stateVersion = "${stateVersion}";
};
# nix-darwin specific configuration
darwin = {
imports = [
(import ./darwin)
];
imports = [ (import ./darwin) ];
system.stateVersion = darwinStateVersion;
};
};
Expand Down
6 changes: 2 additions & 4 deletions home-manager/darwin/karabiner/caps_esc_ctrl.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@
"from": {
"key_code": "caps_lock",
"modifiers": {
"optional": [
"any"
]
"optional": ["any"]
}
},
"to": [
Expand All @@ -28,4 +26,4 @@
]
}
]
}
}
6 changes: 2 additions & 4 deletions home-manager/darwin/karabiner/karabiner.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@
"from": {
"key_code": "caps_lock",
"modifiers": {
"optional": [
"any"
]
"optional": ["any"]
}
},
"to": [
Expand Down Expand Up @@ -266,4 +264,4 @@
}
}
]
}
}
Loading

0 comments on commit b7cc8a1

Please sign in to comment.