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", "pre-commit-hooks": "pre-commit-hooks",
"rust-overlay": "rust-overlay_2", "rust-overlay": "rust-overlay_2",
"sops": "sops", "sops": "sops",
"sunshine": "sunshine" "sunshine": "sunshine",
"treefmt-nix": "treefmt-nix"
} }
}, },
"rust-overlay": { "rust-overlay": {
@ -1030,6 +1031,26 @@
"repo": "default", "repo": "default",
"type": "github" "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", "root": "root",

View file

@ -25,6 +25,11 @@
}; };
}; };
treefmt-nix = {
url = "github:numtide/treefmt-nix";
inputs.nixpkgs.follows = "nixpkgs";
};
naersk = { naersk = {
url = "github:nix-community/naersk"; url = "github:nix-community/naersk";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
@ -173,7 +178,10 @@
"aarch64-linux" "aarch64-linux"
]; ];
imports = [ inputs.pre-commit-hooks.flakeModule ]; imports = [
inputs.pre-commit-hooks.flakeModule
inputs.treefmt-nix.flakeModule
];
flake = { flake = {
lib = import ./lib inputs; 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 = { packages = {
git-repo-go = pkgs.callPackage ./pkgs/git-repo-go { }; git-repo-go = pkgs.callPackage ./pkgs/git-repo-go { };
gitu = pkgs.callPackage ./pkgs/gitu { }; gitu = pkgs.callPackage ./pkgs/gitu { };
headscale-ui = pkgs.callPackage ./pkgs/headscale-ui { };
incus-ui = pkgs.callPackage ./pkgs/incus-ui { }; incus-ui = pkgs.callPackage ./pkgs/incus-ui { };
openfga = pkgs.callPackage ./pkgs/openfga { }; openfga = pkgs.callPackage ./pkgs/openfga { };
zed = pkgs.callPackage ./pkgs/zed { }; zed = pkgs.callPackage ./pkgs/zed { };
@ -312,8 +336,6 @@
name = "install"; name = "install";
packages = [ inputs'.disko.packages.disko ]; packages = [ inputs'.disko.packages.disko ];
}; };
formatter = pkgs.nixfmt-rfc-style;
}; };
}; };
} }

View file

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

View file

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

View file

@ -19,13 +19,11 @@ let
rcloneRemote = rcloneRemote =
with types; with types;
attrsOf ( attrsOf (oneOf [
oneOf [
str str
int int
bool bool
] ]);
);
rcloneMount = rcloneMount =
with types; with types;
@ -61,8 +59,7 @@ in
home.packages = [ pkgs.rclone ]; home.packages = [ pkgs.rclone ];
systemd.user.services = builtins.listToAttrs ( systemd.user.services = builtins.listToAttrs (
builtins.map builtins.map (
(
mount: mount:
let let
localPath = toString mount.local; 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}" "${pkgs.nitrogen}/bin/nitrogen --set-color=${cfg.backgroundColor} --set-tiled ${cfg.images}"
else else
builtins.concatStringsSep "\n" ( builtins.concatStringsSep "\n" (
map map (
(
{ fst, snd }: { fst, snd }:
let let
image = fst; image = fst;
monitor = toString snd; monitor = toString snd;
in in
"${pkgs.nitrogen}/bin/nitrogen --head=${monitor} --set-color=${cfg.backgroundColor} --set-tiled ${image}" "${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 = [ imports = [
(mkRemovedOptionModule (mkRemovedOptionModule [
[
"eboskma" "eboskma"
"nix-common" "nix-common"
"disable-cache" "disable-cache"
] ] "The option `disable-cache` is no longer used")
"The option `disable-cache` is no longer used"
)
]; ];
config = mkIf cfg.enable { config = mkIf cfg.enable {

View file

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

View file

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