Add treefmt, run formatter
This commit is contained in:
parent
b142fe2109
commit
5eef55d4f7
9 changed files with 181 additions and 161 deletions
23
flake.lock
23
flake.lock
|
@ -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",
|
||||||
|
|
28
flake.nix
28
flake.nix
|
@ -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;
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 (ws: {
|
||||||
builtins.map
|
inherit output;
|
||||||
(ws: {
|
workspace = toString ws;
|
||||||
inherit output;
|
}) workspaces
|
||||||
workspace = toString ws;
|
) workspacePartition
|
||||||
})
|
|
||||||
workspaces
|
|
||||||
)
|
|
||||||
workspacePartition
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
# [
|
# [
|
||||||
|
|
|
@ -17,17 +17,15 @@ 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";
|
repo = "nnn";
|
||||||
repo = "nnn";
|
rev = "7f63bef4d6c9f70b99a4c98435c9c0a68e05be44";
|
||||||
rev = "7f63bef4d6c9f70b99a4c98435c9c0a68e05be44";
|
sha256 = "B9WRQW4wbs3+lJ9ACFheTaO+0+G/r67yJZJJPMDIQXI=";
|
||||||
sha256 = "B9WRQW4wbs3+lJ9ACFheTaO+0+G/r67yJZJJPMDIQXI=";
|
};
|
||||||
};
|
})).override
|
||||||
}
|
|
||||||
)).override
|
|
||||||
{
|
{
|
||||||
withNerdIcons = true;
|
withNerdIcons = true;
|
||||||
extraMakeFlags = [
|
extraMakeFlags = [
|
||||||
|
|
|
@ -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,39 +59,37 @@ 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;
|
unitName = builtins.replaceStrings [ "/" ] [ "-" ] (
|
||||||
unitName = builtins.replaceStrings [ "/" ] [ "-" ] (
|
builtins.substring 1 (builtins.stringLength localPath) localPath
|
||||||
builtins.substring 1 (builtins.stringLength localPath) localPath
|
);
|
||||||
);
|
in
|
||||||
in
|
{
|
||||||
{
|
name = "rclone-${unitName}";
|
||||||
name = "rclone-${unitName}";
|
value = {
|
||||||
value = {
|
Unit = {
|
||||||
Unit = {
|
Description = "rclone mount ${unitName}";
|
||||||
Description = "rclone mount ${unitName}";
|
After = [ "network.target" ];
|
||||||
After = [ "network.target" ];
|
AssertPathIsDirectory = toString mount.local;
|
||||||
AssertPathIsDirectory = toString mount.local;
|
|
||||||
};
|
|
||||||
|
|
||||||
Service = {
|
|
||||||
Environment = [ "PATH=/run/wrappers/bin:$PATH" ];
|
|
||||||
ExecStart = "${pkgs.rclone}/bin/rclone mount --vfs-cache-mode full --vfs-cache-poll-interval 5s --poll-interval 5s --dir-cache-time 10s --umask 022 --allow-other ${rcloneConnectionString mount} ${mount.local}";
|
|
||||||
ExecStop = "/run/wrappers/bin/fusermount -zu ${mount.local}";
|
|
||||||
Restart = "on-failure";
|
|
||||||
RestartSec = 10;
|
|
||||||
};
|
|
||||||
|
|
||||||
Install = {
|
|
||||||
WantedBy = [ "default.target" ];
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}
|
|
||||||
)
|
Service = {
|
||||||
cfg.mounts
|
Environment = [ "PATH=/run/wrappers/bin:$PATH" ];
|
||||||
|
ExecStart = "${pkgs.rclone}/bin/rclone mount --vfs-cache-mode full --vfs-cache-poll-interval 5s --poll-interval 5s --dir-cache-time 10s --umask 022 --allow-other ${rcloneConnectionString mount} ${mount.local}";
|
||||||
|
ExecStop = "/run/wrappers/bin/fusermount -zu ${mount.local}";
|
||||||
|
Restart = "on-failure";
|
||||||
|
RestartSec = 10;
|
||||||
|
};
|
||||||
|
|
||||||
|
Install = {
|
||||||
|
WantedBy = [ "default.target" ];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
) cfg.mounts
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -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)))
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
|
@ -87,19 +87,13 @@ in
|
||||||
listenPort = cfg.port;
|
listenPort = cfg.port;
|
||||||
privateKeyFile = cfg.privateKeyFile;
|
privateKeyFile = cfg.privateKeyFile;
|
||||||
|
|
||||||
postSetup =
|
postSetup = concatMapStringsSep "\n" (range: ''
|
||||||
concatMapStringsSep "\n"
|
${pkgs.iptables}/bin/iptables -t nat -A POSTROUTING -s ${range} -o ${cfg.externalInterface} -j MASQUERADE
|
||||||
(range: ''
|
'') cfg.internalIPs;
|
||||||
${pkgs.iptables}/bin/iptables -t nat -A POSTROUTING -s ${range} -o ${cfg.externalInterface} -j MASQUERADE
|
|
||||||
'')
|
|
||||||
cfg.internalIPs;
|
|
||||||
|
|
||||||
postShutdown =
|
postShutdown = concatMapStringsSep "\n" (range: ''
|
||||||
concatMapStringsSep "\n"
|
${pkgs.iptables}/bin/iptables -t nat -D POSTROUTING -s ${range} -o ${cfg.externalInterface} -j MASQUERADE
|
||||||
(range: ''
|
'') cfg.internalIPs;
|
||||||
${pkgs.iptables}/bin/iptables -t nat -D POSTROUTING -s ${range} -o ${cfg.externalInterface} -j MASQUERADE
|
|
||||||
'')
|
|
||||||
cfg.internalIPs;
|
|
||||||
|
|
||||||
peers = cfg.peers;
|
peers = cfg.peers;
|
||||||
};
|
};
|
||||||
|
|
|
@ -10,81 +10,79 @@
|
||||||
rsync,
|
rsync,
|
||||||
}:
|
}:
|
||||||
|
|
||||||
stdenv.mkDerivation (
|
stdenv.mkDerivation (finalAttrs: {
|
||||||
finalAttrs: {
|
pname = "incus-ui";
|
||||||
pname = "incus-ui";
|
version = "0.6";
|
||||||
version = "0.6";
|
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
src = fetchFromGitHub {
|
||||||
owner = "canonical";
|
owner = "canonical";
|
||||||
repo = "lxd-ui";
|
repo = "lxd-ui";
|
||||||
rev = finalAttrs.version;
|
rev = finalAttrs.version;
|
||||||
# hash = "sha256-52MRf7bk8Un9wqz00+JjDmuJgPKYhgAhIbMbcAuf8W8=";
|
# hash = "sha256-52MRf7bk8Un9wqz00+JjDmuJgPKYhgAhIbMbcAuf8W8=";
|
||||||
hash = "sha256-3Ts6lKyzpMDVATCKD1fFIGTskWzWpQUT9S8cPFnlEOs=";
|
hash = "sha256-3Ts6lKyzpMDVATCKD1fFIGTskWzWpQUT9S8cPFnlEOs=";
|
||||||
};
|
};
|
||||||
|
|
||||||
offlineCache = fetchYarnDeps {
|
offlineCache = fetchYarnDeps {
|
||||||
yarnLock = "${finalAttrs.src}/yarn.lock";
|
yarnLock = "${finalAttrs.src}/yarn.lock";
|
||||||
hash = "sha256-0pyxwMGGqogEe1w3sail8NUDHtxLQZU9Wg8E6rQNy4o=";
|
hash = "sha256-0pyxwMGGqogEe1w3sail8NUDHtxLQZU9Wg8E6rQNy4o=";
|
||||||
};
|
};
|
||||||
|
|
||||||
patches = [
|
patches = [
|
||||||
./ui-canonical-0001-Branding.patch
|
./ui-canonical-0001-Branding.patch
|
||||||
./ui-canonical-0002-Update-navigation.patch
|
./ui-canonical-0002-Update-navigation.patch
|
||||||
./ui-canonical-0003-Update-certificate-generation.patch
|
./ui-canonical-0003-Update-certificate-generation.patch
|
||||||
./ui-canonical-0004-Remove-external-links.patch
|
./ui-canonical-0004-Remove-external-links.patch
|
||||||
./ui-canonical-0005-Remove-Canonical-image-servers.patch
|
./ui-canonical-0005-Remove-Canonical-image-servers.patch
|
||||||
./ui-canonical-0006-Remove-version-check.patch
|
./ui-canonical-0006-Remove-version-check.patch
|
||||||
];
|
];
|
||||||
|
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [
|
||||||
nodejs
|
nodejs
|
||||||
prefetch-yarn-deps
|
prefetch-yarn-deps
|
||||||
yarn
|
yarn
|
||||||
];
|
];
|
||||||
|
|
||||||
configurePhase = ''
|
configurePhase = ''
|
||||||
runHook preConfigure
|
runHook preConfigure
|
||||||
|
|
||||||
${gnused}/bin/sed -i "s/LXD/Incus/g" src/*/*.ts* src/*/*/*.ts* src/*/*/*/*.ts*
|
${gnused}/bin/sed -i "s/LXD/Incus/g" src/*/*.ts* src/*/*/*.ts* src/*/*/*/*.ts*
|
||||||
${gnused}/bin/sed -i "s/devlxd/guestapi/g" src/*/*.ts* src/*/*/*.ts* src/*/*/*/*.ts*
|
${gnused}/bin/sed -i "s/devlxd/guestapi/g" src/*/*.ts* src/*/*/*.ts* src/*/*/*/*.ts*
|
||||||
${gnused}/bin/sed -i "s/dev\/lxd/dev\/incus/g" src/*/*.ts* src/*/*/*.ts* src/*/*/*/*.ts*
|
${gnused}/bin/sed -i "s/dev\/lxd/dev\/incus/g" src/*/*.ts* src/*/*/*.ts* src/*/*/*/*.ts*
|
||||||
${gnused}/bin/sed -i "s/lxd_/incus_/g" src/*/*.ts* src/*/*/*.ts* src/*/*/*/*.ts*
|
${gnused}/bin/sed -i "s/lxd_/incus_/g" src/*/*.ts* src/*/*/*.ts* src/*/*/*/*.ts*
|
||||||
${gnused}/bin/sed -i "s/\"lxd\"/\"incus\"/g" src/*/*.ts* src/*/*/*.ts* src/*/*/*/*.ts*
|
${gnused}/bin/sed -i "s/\"lxd\"/\"incus\"/g" src/*/*.ts* src/*/*/*.ts* src/*/*/*/*.ts*
|
||||||
|
|
||||||
export HOME=$(mktemp -d)
|
export HOME=$(mktemp -d)
|
||||||
yarn config --offline set yarn-offline-mirror "$offlineCache"
|
yarn config --offline set yarn-offline-mirror "$offlineCache"
|
||||||
fixup-yarn-lock yarn.lock
|
fixup-yarn-lock yarn.lock
|
||||||
yarn --offline --frozen-lockfile --ignore-platform --ignore-scripts --no-progress --non-interactive install
|
yarn --offline --frozen-lockfile --ignore-platform --ignore-scripts --no-progress --non-interactive install
|
||||||
patchShebangs node_modules
|
patchShebangs node_modules
|
||||||
cp ${./favicon-32x32.png} public/assets/img/favicon-32x32.png
|
cp ${./favicon-32x32.png} public/assets/img/favicon-32x32.png
|
||||||
|
|
||||||
runHook postConfigure
|
runHook postConfigure
|
||||||
'';
|
'';
|
||||||
|
|
||||||
buildPhase = ''
|
buildPhase = ''
|
||||||
runHook preBuild
|
runHook preBuild
|
||||||
|
|
||||||
yarn --offline build
|
yarn --offline build
|
||||||
|
|
||||||
runHook postBuild
|
runHook postBuild
|
||||||
'';
|
'';
|
||||||
|
|
||||||
installPhase = ''
|
installPhase = ''
|
||||||
runHook preInstall
|
runHook preInstall
|
||||||
|
|
||||||
mkdir -p $out
|
mkdir -p $out
|
||||||
${rsync}/bin/rsync -a build/ui/ $out/
|
${rsync}/bin/rsync -a build/ui/ $out/
|
||||||
|
|
||||||
runHook postInstall
|
runHook postInstall
|
||||||
'';
|
'';
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
description = "Easy and accessible container and virtual machine management. A browser interface for LXD";
|
description = "Easy and accessible container and virtual machine management. A browser interface for LXD";
|
||||||
homepage = "https://github.com/canonical/lxd-ui";
|
homepage = "https://github.com/canonical/lxd-ui";
|
||||||
license = licenses.gpl3;
|
license = licenses.gpl3;
|
||||||
maintainers = with maintainers; [ ];
|
maintainers = with maintainers; [ ];
|
||||||
platforms = platforms.linux;
|
platforms = platforms.linux;
|
||||||
};
|
};
|
||||||
}
|
})
|
||||||
)
|
|
||||||
|
|
Loading…
Reference in a new issue