Add treefmt, run formatter

This commit is contained in:
Erwin Boskma 2024-04-16 19:32:32 +02:00
parent b142fe2109
commit 5eef55d4f7
Signed by: erwin
SSH key fingerprint: SHA256:/Wk1WZdLg+vQHs3in9qq7PsIp8SMzwGSk/RLZ5zPuZk
9 changed files with 181 additions and 161 deletions

View file

@ -873,7 +873,8 @@
"pre-commit-hooks": "pre-commit-hooks",
"rust-overlay": "rust-overlay_2",
"sops": "sops",
"sunshine": "sunshine"
"sunshine": "sunshine",
"treefmt-nix": "treefmt-nix"
}
},
"rust-overlay": {
@ -1030,6 +1031,26 @@
"repo": "default",
"type": "github"
}
},
"treefmt-nix": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1711963903,
"narHash": "sha256-N3QDhoaX+paWXHbEXZapqd1r95mdshxToGowtjtYkGI=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "49dc4a92b02b8e68798abd99184f228243b6e3ac",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "treefmt-nix",
"type": "github"
}
}
},
"root": "root",

View file

@ -25,6 +25,11 @@
};
};
treefmt-nix = {
url = "github:numtide/treefmt-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
naersk = {
url = "github:nix-community/naersk";
inputs.nixpkgs.follows = "nixpkgs";
@ -173,7 +178,10 @@
"aarch64-linux"
];
imports = [ inputs.pre-commit-hooks.flakeModule ];
imports = [
inputs.pre-commit-hooks.flakeModule
inputs.treefmt-nix.flakeModule
];
flake = {
lib = import ./lib inputs;
@ -251,9 +259,25 @@
};
};
treefmt = {
projectRootFile = "flake.lock";
programs = {
black.enable = true;
deadnix.enable = true;
nixfmt = {
enable = true;
package = pkgs.nixfmt-rfc-style;
};
shellcheck.enable = true;
shfmt.enable = true;
};
};
packages = {
git-repo-go = pkgs.callPackage ./pkgs/git-repo-go { };
gitu = pkgs.callPackage ./pkgs/gitu { };
headscale-ui = pkgs.callPackage ./pkgs/headscale-ui { };
incus-ui = pkgs.callPackage ./pkgs/incus-ui { };
openfga = pkgs.callPackage ./pkgs/openfga { };
zed = pkgs.callPackage ./pkgs/zed { };
@ -312,8 +336,6 @@
name = "install";
packages = [ inputs'.disko.packages.disko ];
};
formatter = pkgs.nixfmt-rfc-style;
};
};
}

View file

@ -217,20 +217,16 @@ in
workspaceAutoBackAndForth = true;
workspaceOutputAssign = builtins.concatLists (
builtins.attrValues (
builtins.mapAttrs
(
builtins.mapAttrs (
name: workspaces:
let
output = if name == "right" then "DP-0" else "DP-4";
in
builtins.map
(ws: {
builtins.map (ws: {
inherit output;
workspace = toString ws;
})
workspaces
)
workspacePartition
}) workspaces
) workspacePartition
)
);
# [

View file

@ -17,8 +17,7 @@ in
programs.nnn = {
enable = true;
package =
(pkgs.nnn.overrideAttrs (
_prevAttrs: {
(pkgs.nnn.overrideAttrs (_prevAttrs: {
version = "unstable-2023-10-08";
src = pkgs.fetchFromGitHub {
owner = "jarun";
@ -26,8 +25,7 @@ in
rev = "7f63bef4d6c9f70b99a4c98435c9c0a68e05be44";
sha256 = "B9WRQW4wbs3+lJ9ACFheTaO+0+G/r67yJZJJPMDIQXI=";
};
}
)).override
})).override
{
withNerdIcons = true;
extraMakeFlags = [

View file

@ -19,13 +19,11 @@ let
rcloneRemote =
with types;
attrsOf (
oneOf [
attrsOf (oneOf [
str
int
bool
]
);
]);
rcloneMount =
with types;
@ -61,8 +59,7 @@ in
home.packages = [ pkgs.rclone ];
systemd.user.services = builtins.listToAttrs (
builtins.map
(
builtins.map (
mount:
let
localPath = toString mount.local;
@ -92,8 +89,7 @@ in
};
};
}
)
cfg.mounts
) cfg.mounts
);
};
}

View file

@ -13,16 +13,14 @@ let
"${pkgs.nitrogen}/bin/nitrogen --set-color=${cfg.backgroundColor} --set-tiled ${cfg.images}"
else
builtins.concatStringsSep "\n" (
map
(
map (
{ fst, snd }:
let
image = fst;
monitor = toString snd;
in
"${pkgs.nitrogen}/bin/nitrogen --head=${monitor} --set-color=${cfg.backgroundColor} --set-tiled ${image}"
)
(zipLists cfg.images (builtins.genList (x: x) (builtins.length cfg.images)))
) (zipLists cfg.images (builtins.genList (x: x) (builtins.length cfg.images)))
)
);

View file

@ -20,14 +20,11 @@ in
};
imports = [
(mkRemovedOptionModule
[
(mkRemovedOptionModule [
"eboskma"
"nix-common"
"disable-cache"
]
"The option `disable-cache` is no longer used"
)
] "The option `disable-cache` is no longer used")
];
config = mkIf cfg.enable {

View file

@ -87,19 +87,13 @@ in
listenPort = cfg.port;
privateKeyFile = cfg.privateKeyFile;
postSetup =
concatMapStringsSep "\n"
(range: ''
postSetup = concatMapStringsSep "\n" (range: ''
${pkgs.iptables}/bin/iptables -t nat -A POSTROUTING -s ${range} -o ${cfg.externalInterface} -j MASQUERADE
'')
cfg.internalIPs;
'') cfg.internalIPs;
postShutdown =
concatMapStringsSep "\n"
(range: ''
postShutdown = concatMapStringsSep "\n" (range: ''
${pkgs.iptables}/bin/iptables -t nat -D POSTROUTING -s ${range} -o ${cfg.externalInterface} -j MASQUERADE
'')
cfg.internalIPs;
'') cfg.internalIPs;
peers = cfg.peers;
};

View file

@ -10,8 +10,7 @@
rsync,
}:
stdenv.mkDerivation (
finalAttrs: {
stdenv.mkDerivation (finalAttrs: {
pname = "incus-ui";
version = "0.6";
@ -86,5 +85,4 @@ stdenv.mkDerivation (
maintainers = with maintainers; [ ];
platforms = platforms.linux;
};
}
)
})