Skip to content

Commit

Permalink
Add .envrc and update .gitignore and configs
Browse files Browse the repository at this point in the history
  • Loading branch information
yousiki committed Mar 20, 2024
1 parent 9f07b2d commit 4ad1f4d
Show file tree
Hide file tree
Showing 9 changed files with 174 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source $(fetchurl https://raw.githubusercontent.com/paisano-nix/direnv/main/lib sha256-IgQhKK7UHL1AfCUntJO2KCaIDJQotRnK2qC4Daxk+wI=)

use envreload //common/devshells/default
12 changes: 11 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
/result
/secrets/**/*.local

### Nixago ###
/.bin
/.cache
/.config
/.data
/.run

### Emacs ###
# -*- mode: gitignore; -*-
*~
Expand Down Expand Up @@ -73,7 +80,7 @@ flycheck_*.el
.AppleDouble
.LSOverride

# Icon must end with two \r
# Icon must end with two
Icon


Expand Down Expand Up @@ -167,3 +174,6 @@ $RECYCLE.BIN/

# End of https://www.toptal.com/developers/gitignore/api/linux,macos,windows,vim,emacs,visualstudiocode


# nixago: ignore-linked-files
/treefmt.toml
32 changes: 32 additions & 0 deletions cells/common/configs.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
inputs,
cell,
}: let
inherit (inputs) std nixpkgs;
in {
treefmt = std.lib.dev.mkNixago std.lib.cfg.treefmt {
data = {
global.excludes = [
"nvfetcher/generated.*"
];
formatter = {
nix = {
command = "alejandra";
includes = ["*.nix"];
};
prettier = {
command = "prettier";
includes = [
"*.json"
"*.md"
"*.yaml"
];
};
};
};
packages = [
inputs.nixpkgs.alejandra
inputs.nixpkgs.nodePackages.prettier
];
};
}
34 changes: 34 additions & 0 deletions cells/common/devshells.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# project. It solves the vital problem of, "works on my machine."
{
inputs,
cell,
}: {
default = inputs.std.lib.dev.mkShell {
name = "nichijou";

imports = [
inputs.std.std.devshellProfiles.default
];

packages = [
(inputs.nixpkgs.extend inputs.nvfetcher.overlays.default).nvfetcher
];

nixago = [
cell.configs.treefmt
];

commands = [
{
name = "fetch";
help = "Fetch latest sources with nvfetcher";
command = "nvfetcher -o nvfetcher";
}
{
name = "fmt";
help = "Format code with treefmt";
command = "treefmt";
}
];
};
}
1 change: 1 addition & 0 deletions cells/common/profiles/core.nix
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ in {
alejandra
cachix
curl
direnv
du-dust
duf
eza
Expand Down
7 changes: 7 additions & 0 deletions cells/home/profiles/shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,13 @@

programs.btop.enable = true;

programs.direnv = {
enable = true;
enableBashIntegration = true;
enableZshIntegration = true;
nix-direnv.enable = true;
};

programs.eza = {
enable = true;
enableBashIntegration = true;
Expand Down
1 change: 1 addition & 0 deletions cells/nixos/hosts/hakase/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
};
overlays = [
inputs.fenix.overlays.default
inputs.nvfetcher.overlays.default
];
};
};
Expand Down
72 changes: 72 additions & 0 deletions flake.lock

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

16 changes: 13 additions & 3 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
cellBlocks = [
(std.blockTypes.functions "lib")

(std.blockTypes.nixago "configs")

(std.blockTypes.devshells "devshells")

(std.blockTypes.functions "commonModules")
(std.blockTypes.functions "commonProfiles")
(std.blockTypes.functions "homeModules")
Expand All @@ -35,9 +39,10 @@
];
}
{
nixosModules = hive.pick self [
["nixos" "nixosModules"]
];
devShells = hive.harvest self [["common" "devshells"]];
}
{
nixosModules = hive.pick self [["nixos" "nixosModules"]];
}
{
nixosConfigurations = collect self "nixosConfigurations";
Expand Down Expand Up @@ -95,6 +100,11 @@
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};

nvfetcher = {
url = "github:berberman/nvfetcher";
inputs.nixpkgs.follows = "nixpkgs";
};
};

nixConfig = rec {
Expand Down

0 comments on commit 4ad1f4d

Please sign in to comment.