Compare commits

..

No commits in common. "004975b3add96b77bca929c51d1c071eef632ca0" and "85263798eba9611c8ff7f41a603f356ccf74b983" have entirely different histories.

8 changed files with 70 additions and 49 deletions

1
.gitignore vendored
View file

@ -1,7 +1,6 @@
.direnv/ .direnv/
# nixago: ignore-linked-files # nixago: ignore-linked-files
/rustfmt.toml
/treefmt.toml /treefmt.toml
/.prettierrc.json /.prettierrc.json
/lefthook.yml /lefthook.yml

View file

@ -1,5 +1,19 @@
{ {
"nodes": { "nodes": {
"flake-schemas": {
"locked": {
"lastModified": 1697467827,
"narHash": "sha256-j8SR19V1SRysyJwpOBF4TLuAvAjF5t+gMiboN4gYQDU=",
"rev": "764932025c817d4e500a8d2a4d8c565563923d29",
"revCount": 29,
"type": "tarball",
"url": "https://api.flakehub.com/f/pinned/DeterminateSystems/flake-schemas/0.1.2/018b3da8-4cc3-7fbb-8ff7-1588413c53e2/source.tar.gz"
},
"original": {
"type": "tarball",
"url": "https://flakehub.com/f/DeterminateSystems/flake-schemas/0.1.2.tar.gz"
}
},
"flake-utils": { "flake-utils": {
"locked": { "locked": {
"lastModified": 1653893745, "lastModified": 1653893745,
@ -365,6 +379,7 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"flake-schemas": "flake-schemas",
"nixago": "nixago", "nixago": "nixago",
"nixago-exts": "nixago-exts_3", "nixago-exts": "nixago-exts_3",
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs"

View file

@ -9,6 +9,8 @@
nixago-exts.url = "github:nix-community/nixago-extensions"; nixago-exts.url = "github:nix-community/nixago-extensions";
nixago-exts.inputs.nixpkgs.follows = "nixpkgs"; nixago-exts.inputs.nixpkgs.follows = "nixpkgs";
flake-schemas.url = "https://flakehub.com/f/DeterminateSystems/flake-schemas/0.1.2.tar.gz";
}; };
outputs = inputs @ { self, nixpkgs, nixago, nixago-exts, ... }: outputs = inputs @ { self, nixpkgs, nixago, nixago-exts, ... }:
@ -20,51 +22,37 @@
pkgs = import nixpkgs { inherit system; }; pkgs = import nixpkgs { inherit system; };
}); });
in in
rec
{ {
# The schemes we use.
schemas = inputs.flake-schemas.schemas;
# Expose the configuration options for setup.
nixosModules = {
mfgames-project-setup = import ./src/modules/default.nix;
default = self.nixosModules.mfgames-project-setup;
};
# Expose the configuration information. # Expose the configuration information.
lib = { lib = {
mkConfig = sayHello = nixpkgs."x86_64-linux".lib.debug.traceVal (name: "Hello there, ${name}!");
{ system
, pkgs
, conform ? { }
, rust ? { }
, ...
}:
let
rustDefaults = { enable = false; };
conformDefaults = { scopes = [ ]; };
configs = import ./src/configs/default.nix {
inherit system pkgs nixago nixago-exts;
conform = conformDefaults // conform;
rust = rustDefaults // rust;
};
in
{
packages = [ pkgs.lefthook ];
shellHook = ''
${configs.shellHook}
${pkgs.lefthook}/bin/lefthook install
alias lefthook="${pkgs.lefthook}/bin/lefthook"
'';
};
}; };
configs =
forEachSupportedSystem ({ system, pkgs }:
(import ./src/configs/default.nix { inherit system pkgs nixago nixago-exts; }));
# Set up the developer shell. # Set up the developer shell.
devShells = forEachSupportedSystem ({ system, pkgs }: devShells = forEachSupportedSystem ({ system, pkgs }:
let let
config = lib.mkConfig { configs = import ./src/configs/default.nix { inherit system pkgs nixago nixago-exts; };
inherit system pkgs;
#rust.enable = false;
};
in in
{ {
# Shell # Shell
default = pkgs.mkShell { default = pkgs.mkShell {
packages = [ ] ++ config.packages; shellHook = ''
shellHook = config.shellHook; ${configs.shellHook}
lefthook install
'';
}; };
}); });

View file

@ -1,9 +1,7 @@
inputs @ { system, nixago-exts, conform, ... }: inputs @ { system, nixago, nixago-exts, ... }:
nixago-exts.conform.${system} { nixago-exts.conform.${system} {
commit = { commit = {
header.length = 89; header = { length = inputs.pkgs.lib.debug.traceVal 89; };
scopes = conform.scopes;
conventional = { conventional = {
types = [ types = [
"build" "build"
@ -17,6 +15,8 @@ nixago-exts.conform.${system} {
"style" "style"
"test" "test"
]; ];
scopes = [ "cli" ];
}; };
}; };
} }

View file

@ -1,12 +1,9 @@
inputs @ { pkgs, rust ? { enable = false; }, ... }: inputs:
let lib = pkgs.lib; in inputs.nixago.lib.${inputs.system}.makeAll [
inputs.nixago.lib.${inputs.system}.makeAll ([
(import ./conform.nix (inputs)) (import ./conform.nix (inputs))
(import ./editorconfig.nix (inputs)) (import ./editorconfig.nix (inputs))
(import ./lefthook.nix (inputs)) (import ./lefthook.nix (inputs))
(import ./prettier.nix (inputs)) (import ./prettier.nix (inputs))
#(import ./rustfmt.nix (inputs))
(import ./treefmt.nix (inputs)) (import ./treefmt.nix (inputs))
] ]
++ lib.optionals rust.enable [
(import ./rustfmt.nix (inputs))
])

View file

@ -1,4 +1,4 @@
inputs @ { pkgs, ... }: inputs:
let let
data = { data = {
brace_style = "AlwaysNextLine"; brace_style = "AlwaysNextLine";

View file

@ -1,9 +1,9 @@
inputs @ { pkgs, rust, ... }: inputs @ { pkgs, ... }:
let let
data = { data = {
formatter = { formatter = {
nix = { nix = {
command = "${pkgs.nixpkgs-fmt}/bin/nixpkgs-fmt"; command = "nixpkgs-fmt";
includes = [ "*.nix" ]; includes = [ "*.nix" ];
}; };
@ -24,8 +24,7 @@ let
]; ];
excludes = [ "**.min.js" ]; excludes = [ "**.min.js" ];
}; };
}
// pkgs.lib.attrsets.optionalAttrs rust.enable {
rust = { rust = {
command = "rustfmt"; command = "rustfmt";
options = [ "--edition" "2021" ]; options = [ "--edition" "2021" ];

23
src/modules/default.nix Normal file
View file

@ -0,0 +1,23 @@
{ config, lib, pkgs, ... }:
let
cfg = config.mfgames-project-setup;
secretType = types.submodule ({ config, ... }: {
options = {
rust = mkOption {
type = types.bool;
default = false;
};
};
});
in
{
options.mfgames-project-setup = {
rust = mkOption {
type = types.bool;
default = true;
description = ''
Enabling this option including tools for handling Rust projects.
'';
};
};
}