mirror of
https://github.com/Gerg-L/nixos.git
synced 2025-12-10 00:43:56 -05:00
fix mkPackages
move "lint" command to /packages
This commit is contained in:
parent
7f33afb985
commit
a132ccf4b6
4 changed files with 71 additions and 88 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
{nvim-flake, nixfmt, ...}:
|
{nvim-flake, self, ...}:
|
||||||
{pkgs, config, ...}:
|
{pkgs, config, ...}:
|
||||||
{
|
{
|
||||||
local = {
|
local = {
|
||||||
|
|
@ -44,15 +44,7 @@
|
||||||
];
|
];
|
||||||
|
|
||||||
environment = {
|
environment = {
|
||||||
systemPackages =
|
systemPackages = builtins.attrValues {
|
||||||
let
|
|
||||||
fmt = pkgs.nixfmt.overrideAttrs {
|
|
||||||
version = "0.6.0-${nixfmt.shortRev}";
|
|
||||||
|
|
||||||
src = nixfmt;
|
|
||||||
};
|
|
||||||
in
|
|
||||||
builtins.attrValues {
|
|
||||||
inherit (pkgs)
|
inherit (pkgs)
|
||||||
bitwarden # store stuff
|
bitwarden # store stuff
|
||||||
qbittorrent # steal stuff
|
qbittorrent # steal stuff
|
||||||
|
|
@ -75,27 +67,7 @@
|
||||||
qmk
|
qmk
|
||||||
;
|
;
|
||||||
inherit (nvim-flake.packages) neovim;
|
inherit (nvim-flake.packages) neovim;
|
||||||
inherit fmt;
|
inherit (self.packages) lint;
|
||||||
lint = pkgs.writeShellApplication {
|
|
||||||
name = "lint";
|
|
||||||
runtimeInputs = [
|
|
||||||
fmt
|
|
||||||
pkgs.deadnix
|
|
||||||
pkgs.statix
|
|
||||||
pkgs.fd
|
|
||||||
];
|
|
||||||
|
|
||||||
text = ''
|
|
||||||
if [ -z "''${1:-""}" ]; then
|
|
||||||
fd '.*\.nix' . -x statix fix -- {} \;
|
|
||||||
fd '.*\.nix' . -X deadnix -e -- {} \; -X nixfmt {} \;
|
|
||||||
else
|
|
||||||
statix fix -- "$1"
|
|
||||||
deadnix -e "$1"
|
|
||||||
nixfmt "$1"
|
|
||||||
fi
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
etc = {
|
etc = {
|
||||||
"jdks/17".source = "${pkgs.openjdk17}/bin";
|
"jdks/17".source = "${pkgs.openjdk17}/bin";
|
||||||
|
|
|
||||||
|
|
@ -127,19 +127,15 @@ rec {
|
||||||
(lib.mapAttrs (
|
(lib.mapAttrs (
|
||||||
n: _:
|
n: _:
|
||||||
let
|
let
|
||||||
addArgs =
|
callPackage = lib.callPackageWith (
|
||||||
x:
|
pkgs
|
||||||
lib.setFunctionArgs x (
|
// {
|
||||||
lib.mapAttrs
|
inherit inputs;
|
||||||
(
|
# maybe add self?
|
||||||
n: v:
|
# inherit self;
|
||||||
{
|
# npins sources if i need them
|
||||||
inherit inputs self;
|
# sources = import ./npins;
|
||||||
#sources = import ../npins;
|
|
||||||
}
|
}
|
||||||
.${n} or v
|
|
||||||
)
|
|
||||||
(lib.functionArgs x)
|
|
||||||
);
|
);
|
||||||
in
|
in
|
||||||
|
|
||||||
|
|
@ -147,9 +143,9 @@ rec {
|
||||||
let
|
let
|
||||||
x = import "${path}/${n}/call.nix" pkgs;
|
x = import "${path}/${n}/call.nix" pkgs;
|
||||||
in
|
in
|
||||||
(addArgs x.callPackage "${path}/${n}/package.nix") x.args
|
x.callPackage "${path}/${n}/package.nix" x.args
|
||||||
else
|
else
|
||||||
(addArgs pkgs.callPackage "${path}/${n}/package.nix") {}
|
callPackage "${path}/${n}/package.nix" {}
|
||||||
|
|
||||||
))
|
))
|
||||||
];
|
];
|
||||||
|
|
|
||||||
19
outputs.nix
19
outputs.nix
|
|
@ -18,25 +18,8 @@ lib.gerg-utils {} {
|
||||||
"game-desktop"
|
"game-desktop"
|
||||||
"media-laptop"
|
"media-laptop"
|
||||||
];
|
];
|
||||||
formatter =
|
|
||||||
pkgs:
|
|
||||||
pkgs.writeShellApplication {
|
|
||||||
name = "lint";
|
|
||||||
runtimeInputs = [
|
|
||||||
(pkgs.nixfmt.overrideAttrs {
|
|
||||||
version = "0.6.0-${inputs.nixfmt.shortRev}";
|
|
||||||
|
|
||||||
src = inputs.nixfmt;
|
formatter = pkgs: inputs.self.packages.${pkgs.stdenv.hostPlatform.system}.lint;
|
||||||
})
|
|
||||||
pkgs.deadnix
|
|
||||||
pkgs.statix
|
|
||||||
pkgs.fd
|
|
||||||
];
|
|
||||||
text = ''
|
|
||||||
fd '.*\.nix' . -x statix fix -- {} \;
|
|
||||||
fd '.*\.nix' . -X deadnix -e -- {} \; -X nixfmt {} \;
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
devShells = pkgs: {default = pkgs.mkShell {packages = [pkgs.sops];};};
|
devShells = pkgs: {default = pkgs.mkShell {packages = [pkgs.sops];};};
|
||||||
|
|
||||||
|
|
|
||||||
32
packages/lint/package.nix
Normal file
32
packages/lint/package.nix
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
{
|
||||||
|
inputs,
|
||||||
|
nixfmt,
|
||||||
|
writeShellApplication,
|
||||||
|
deadnix,
|
||||||
|
statix,
|
||||||
|
fd,
|
||||||
|
}:
|
||||||
|
|
||||||
|
writeShellApplication {
|
||||||
|
name = "lint";
|
||||||
|
runtimeInputs = [
|
||||||
|
(nixfmt.overrideAttrs {
|
||||||
|
version = "0.6.0-${inputs.nixfmt.shortRev}";
|
||||||
|
|
||||||
|
src = inputs.nixfmt;
|
||||||
|
})
|
||||||
|
deadnix
|
||||||
|
statix
|
||||||
|
fd
|
||||||
|
];
|
||||||
|
text = ''
|
||||||
|
if [ -z "''${1:-""}" ]; then
|
||||||
|
fd '.*\.nix' . -x statix fix -- {} \;
|
||||||
|
fd '.*\.nix' . -X deadnix -e -- {} \; -X nixfmt {} \;
|
||||||
|
else
|
||||||
|
statix fix -- "$1"
|
||||||
|
deadnix -e "$1"
|
||||||
|
nixfmt "$1"
|
||||||
|
fi
|
||||||
|
'';
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue