Skip to content

Commit

Permalink
flake: partition for treefmt
Browse files Browse the repository at this point in the history
  • Loading branch information
moni-dz committed Nov 29, 2024
1 parent 873f192 commit da01f7a
Show file tree
Hide file tree
Showing 10 changed files with 155 additions and 110 deletions.
45 changes: 45 additions & 0 deletions dev/flake.lock

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

5 changes: 5 additions & 0 deletions dev/flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
description = "Stub flake for dev partition";
outputs = _: { };
inputs.treefmt-nix.url = "github:numtide/treefmt-nix";
}
23 changes: 23 additions & 0 deletions dev/module.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{ inputs, ... }:

{
imports = [ inputs.treefmt-nix.flakeModule ];

perSystem = _: {
treefmt = {
projectRootFile = ".git/config";
programs.nixfmt.enable = true;

settings.global.excludes = [
"LICENSE"
".github/CODEOWNERS"
"*.age"
"*.org"
"*.jpg"
"*.png"
"*.toml"
"*.yml"
];
};
};
}
9 changes: 7 additions & 2 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,17 @@
extraInputsFlake = ./packages;
module = ./packages/module.nix;
};

dev = {
extraInputsFlake = ./dev;
module = ./dev/module.nix;
};
};

partitionedAttrs = {
overlays = "drvs";
packages = "drvs";
formatter = "dev";
};
};

Expand All @@ -46,8 +52,6 @@

# Nixpkgs branches
master.url = "github:nixos/nixpkgs/master";
stable.url = "github:nixos/nixpkgs/release-24.11";
unstable.url = "github:nixos/nixpkgs/nixpkgs-unstable";

# Default Nixpkgs for packages and modules
nixpkgs.follows = "master";
Expand All @@ -56,6 +60,7 @@
agenix.inputs.nixpkgs.follows = "nixpkgs";
agenix.inputs.darwin.follows = "darwin";
darwin.inputs.nixpkgs.follows = "nixpkgs";
determinate.inputs.nixpkgs.follows = "nixpkgs";
home.inputs.nixpkgs.follows = "nixpkgs";
nix-index-database.inputs.nixpkgs.follows = "nixpkgs";
nix-minecraft.inputs.nixpkgs.follows = "nixpkgs";
Expand Down
28 changes: 2 additions & 26 deletions modules/parts/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -41,29 +41,8 @@

# Extra arguments passed to the module system for nix-darwin, NixOS, and home-manager
extraModuleArgs = {
inherit inputs' system;
inherit self' inputs' system;
inputs = lib.mkForce inputs;

/*
One can access these nixpkgs branches like so:
`branches.stable.mpd'
`branches.master.linuxPackages_xanmod'
*/
branches =
let
pkgsFrom =
branch: system:
import branch {
inherit system;
inherit (nixpkgs) config overlays;
};
in
{
master = pkgsFrom inputs.master system;
unstable = pkgsFrom inputs.unstable system;
stable = pkgsFrom inputs.stable system;
};
};

# NixOS and nix-darwin base environment.systemPackages
Expand All @@ -83,13 +62,10 @@

home-manager = inputs'.home.packages.home-manager.override { path = "${inputs.home}"; };

man-pages =
if pkgs.stdenv.isLinux then pkgs.man-pages else self'.packages.man-pages-xnu;
man-pages = if pkgs.stdenv.isLinux then pkgs.man-pages else self'.packages.man-pages-xnu;

gnu-coreutils = if pkgs.stdenv.isLinux then pkgs.coreutils else pkgs.coreutils-prefixed;
};
};

formatter = inputs.nixpkgs.legacyPackages.${system}.nixfmt-rfc-style;
};
}
5 changes: 2 additions & 3 deletions modules/shared/home-manager/default.nix
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
config,
self',
inputs,
inputs',
lib,
Expand All @@ -19,10 +20,8 @@
home = {
packages = __attrValues {
inherit (pkgs)
bat
ripgrep
difftastic
nixpkgs-fmt
nixpkgs-review
;

Expand All @@ -32,7 +31,7 @@
};

sessionVariables = {
EDITOR = "nano";
EDITOR = "nvim";
MANPAGER = "nvim +Man! -c 'nnoremap i <nop>'";
};
};
Expand Down
67 changes: 32 additions & 35 deletions packages/flake.lock

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

2 changes: 0 additions & 2 deletions packages/flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,9 @@
nixpkgs-f2k.url = "github:moni-dz/nixpkgs-f2k";
nixpkgs-wayland.url = "github:nix-community/nixpkgs-wayland";
nvim.url = "github:nix-community/neovim-nightly-overlay";
emacs.url = "github:nix-community/emacs-overlay";

nixpkgs-f2k.inputs.nixpkgs.follows = "nixpkgs";
nixpkgs-wayland.inputs.nixpkgs.follows = "nixpkgs";
nvim.inputs.nixpkgs.follows = "nixpkgs";
nixpkgs-f2k.inputs.emacs.follows = "emacs";
};
}
Loading

0 comments on commit da01f7a

Please sign in to comment.