Add treefmt

Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
This commit is contained in:
2025-02-16 18:53:11 +00:00
parent 22c82653dd
commit 2888bb8b72
70 changed files with 414 additions and 291 deletions

View File

@@ -7,6 +7,7 @@ NixOS dotfiles and configuration for various hosts and users.
- [`flake.lock`](./flake.lock) and [`flake.nix`](./flake.nix): Core Nix flake files defining the repository's dependencies and entry points. - [`flake.lock`](./flake.lock) and [`flake.nix`](./flake.nix): Core Nix flake files defining the repository's dependencies and entry points.
- [`hosts/`](./hosts): All host-specific configurations. - [`hosts/`](./hosts): All host-specific configurations.
- [`common/`](./hosts/common): Shared configuration definitions. - [`common/`](./hosts/common): Shared configuration definitions.
- [`shells/`](./hosts/common/shells): Nix dev shells. - [`shells/`](./hosts/common/shells): Nix dev shells.
- [`configs/`](./hosts/common/configs): System configurations applicable to all hosts. - [`configs/`](./hosts/common/configs): System configurations applicable to all hosts.
@@ -19,6 +20,7 @@ NixOS dotfiles and configuration for various hosts and users.
- `secrets/<namespace>/`: Global secrets for individual namespaces that apply across all hosts. - `secrets/<namespace>/`: Global secrets for individual namespaces that apply across all hosts.
- [`lib/`](./lib): Nix library function definitions and utilities. - [`lib/`](./lib): Nix library function definitions and utilities.
- [`scripts/`](./lib/scripts): Utility scripts for managing the repository. - [`scripts/`](./lib/scripts): Utility scripts for managing the repository.
- [`add-host.sh`](./lib/scripts/add-host.sh): Instantiate the keys for a new host configuration. - [`add-host.sh`](./lib/scripts/add-host.sh): Instantiate the keys for a new host configuration.
- [`remove-host.sh`](./lib/scripts/remove-host.sh): Remove references to a host. - [`remove-host.sh`](./lib/scripts/remove-host.sh): Remove references to a host.
@@ -34,7 +36,7 @@ Any `options.nix` files create custom option definitions when present.
Below is a table of all hosts, with links to their respective README files, which may provide further details and/or post-installation checklists. Below is a table of all hosts, with links to their respective README files, which may provide further details and/or post-installation checklists.
| Host | README | | Host | README |
|-------------|----------------------------------------------------------| | ----------- | -------------------------------------------------------- |
| `installer` | [hosts/installer/README.md](./hosts/installer/README.md) | | `installer` | [hosts/installer/README.md](./hosts/installer/README.md) |
| `eirene` | [hosts/eirene/README.md](./hosts/eirene/README.md) | | `eirene` | [hosts/eirene/README.md](./hosts/eirene/README.md) |
| `elara` | [hosts/elara/README.md](./hosts/elara/README.md) | | `elara` | [hosts/elara/README.md](./hosts/elara/README.md) |

48
flake.lock generated
View File

@@ -19,6 +19,7 @@
}, },
"original": { "original": {
"owner": "aylur", "owner": "aylur",
"ref": "main",
"repo": "ags", "repo": "ags",
"type": "github" "type": "github"
} }
@@ -30,15 +31,16 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1739233175, "lastModified": 1739380580,
"narHash": "sha256-ZH9J3PtGi1iHoKbn6U1NHxTFU3+eJfRQRjKdvKGJDuQ=", "narHash": "sha256-wGtGEfdooudj74wn59Vu5Z2DLsrX9cxdGTFc9sJrP9M=",
"owner": "aylur", "owner": "aylur",
"repo": "astal", "repo": "astal",
"rev": "ee91402cabc994bb4fb7c3f5405a218ad0b57fd3", "rev": "956b74fd9ff8c607b6683b404860c4e6b30ffe2b",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "aylur", "owner": "aylur",
"ref": "main",
"repo": "astal", "repo": "astal",
"type": "github" "type": "github"
} }
@@ -50,15 +52,16 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1738765162, "lastModified": 1739634831,
"narHash": "sha256-3Z40qHaFScWUCVQrGc4Y+RdoPsh1R/wIh+AN4cTXP0I=", "narHash": "sha256-xFnU+uUl48Icas2wPQ+ZzlL2O3n8f6J2LrzNK9f2nng=",
"owner": "nix-community", "owner": "nix-community",
"repo": "disko", "repo": "disko",
"rev": "ff3568858c54bd306e9e1f2886f0f781df307dff", "rev": "fa5746ecea1772cf59b3f34c5816ab3531478142",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "nix-community", "owner": "nix-community",
"ref": "master",
"repo": "disko", "repo": "disko",
"type": "github" "type": "github"
} }
@@ -100,6 +103,7 @@
}, },
"original": { "original": {
"owner": "numtide", "owner": "numtide",
"ref": "main",
"repo": "flake-utils", "repo": "flake-utils",
"type": "github" "type": "github"
} }
@@ -150,15 +154,16 @@
"treefmt-nix": "treefmt-nix" "treefmt-nix": "treefmt-nix"
}, },
"locked": { "locked": {
"lastModified": 1739229047, "lastModified": 1739724221,
"narHash": "sha256-sSTgA86wdk8d544c2+gzrfvVPHQF4mbsomvLOW2thn0=", "narHash": "sha256-hu0SN4bqS1NDT70qUzDmBxpdQFeKYH1VH3ZKPABmJhc=",
"owner": "nix-community", "owner": "nix-community",
"repo": "NUR", "repo": "NUR",
"rev": "8348d89f30598a73fee7efb4b5d34c3de201e71b", "rev": "9b067eebe1e32f625fb43e218155ca60072a3a20",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "nix-community", "owner": "nix-community",
"ref": "master",
"repo": "NUR", "repo": "NUR",
"type": "github" "type": "github"
} }
@@ -174,7 +179,8 @@
"nur": "nur", "nur": "nur",
"sops-nix": "sops-nix", "sops-nix": "sops-nix",
"spicetify-nix": "spicetify-nix", "spicetify-nix": "spicetify-nix",
"systems": "systems" "systems": "systems",
"treefmt-nix": "treefmt-nix_2"
} }
}, },
"sops-nix": { "sops-nix": {
@@ -193,6 +199,7 @@
}, },
"original": { "original": {
"owner": "Mic92", "owner": "Mic92",
"ref": "master",
"repo": "sops-nix", "repo": "sops-nix",
"type": "github" "type": "github"
} }
@@ -257,6 +264,27 @@
"repo": "treefmt-nix", "repo": "treefmt-nix",
"type": "github" "type": "github"
} }
},
"treefmt-nix_2": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1738953846,
"narHash": "sha256-yrK3Hjcr8F7qS/j2F+r7C7o010eVWWlm4T1PrbKBOxQ=",
"owner": "numtide",
"repo": "treefmt-nix",
"rev": "4f09b473c936d41582dd744e19f34ec27592c5fd",
"type": "github"
},
"original": {
"owner": "numtide",
"ref": "main",
"repo": "treefmt-nix",
"type": "github"
}
} }
}, },
"root": "root", "root": "root",

View File

@@ -32,12 +32,20 @@
}; };
disko = { disko = {
url = "github:nix-community/disko"; type = "github";
owner = "nix-community";
repo = "disko";
ref = "master";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
sops-nix = { sops-nix = {
url = "github:Mic92/sops-nix"; type = "github";
owner = "Mic92";
repo = "sops-nix";
ref = "master";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
@@ -49,22 +57,47 @@
}; };
nur = { nur = {
url = "github:nix-community/NUR"; type = "github";
owner = "nix-community";
repo = "NUR";
ref = "master";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
flake-utils = { flake-utils = {
url = "github:numtide/flake-utils"; type = "github";
owner = "numtide";
repo = "flake-utils";
ref = "main";
inputs.systems.follows = "systems"; inputs.systems.follows = "systems";
}; };
treefmt-nix = {
type = "github";
owner = "numtide";
repo = "treefmt-nix";
ref = "main";
inputs.nixpkgs.follows = "nixpkgs";
};
astal = { astal = {
url = "github:aylur/astal"; type = "github";
owner = "aylur";
repo = "astal";
ref = "main";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
ags = { ags = {
url = "github:aylur/ags"; type = "github";
owner = "aylur";
repo = "ags";
ref = "main";
inputs = { inputs = {
nixpkgs.follows = "nixpkgs"; nixpkgs.follows = "nixpkgs";
astal.follows = "astal"; astal.follows = "astal";
@@ -115,10 +148,11 @@
}; };
}; };
} }
// inputs.flake-utils.lib.eachDefaultSystem ( // inputs.flake-utils.lib.eachSystem [ "x86_64-linux" ] (
system: system:
let let
pkgs = nixpkgs.legacyPackages.${system}; pkgs = nixpkgs.legacyPackages.${system};
treefmt = inputs.treefmt-nix.lib.evalModule pkgs ./treefmt.nix;
in in
{ {
devShells = { devShells = {
@@ -131,7 +165,8 @@
python = import ./hosts/common/shells/python { inherit pkgs; }; python = import ./hosts/common/shells/python { inherit pkgs; };
}; };
formatter = pkgs.nixfmt-rfc-style; formatter = treefmt.config.build.wrapper;
checks.formatting = treefmt.config.build.check self;
} }
); );

View File

@@ -1,3 +1,5 @@
# shellcheck shell=bash
if [[ "$EUID" -ne 0 ]]; then if [[ "$EUID" -ne 0 ]]; then
echo "Please run the script as root." echo "Please run the script as root."
exit 1 exit 1

View File

@@ -13,8 +13,6 @@
]; ];
home-manager.sharedModules = [ home-manager.sharedModules = [
{ { programs.zsh.initExtra = builtins.readFile ./backup.completion.zsh; }
programs.zsh.initExtra = builtins.readFile ./backup.completion.zsh;
}
]; ];
} }

View File

@@ -14,9 +14,5 @@
config.environment.persistence."/persist"."/var/lib/bluetooth".mount config.environment.persistence."/persist"."/var/lib/bluetooth".mount
]; ];
home-manager.sharedModules = [ home-manager.sharedModules = [ { services.mpris-proxy.enable = config.services.pipewire.enable; } ];
{
services.mpris-proxy.enable = config.services.pipewire.enable;
}
];
} }

View File

@@ -1,3 +1,6 @@
# shellcheck shell=bash
# shellcheck disable=SC2154
echo "Starting impermanence mount with source: $source, target: $target, path: $path." echo "Starting impermanence mount with source: $source, target: $target, path: $path."
source_current="$source" source_current="$source"

View File

@@ -1,3 +1,6 @@
# shellcheck shell=bash
# shellcheck disable=SC2154
echo "Stopping impermanence mount with source: $source, target: $target, path: $path." echo "Stopping impermanence mount with source: $source, target: $target, path: $path."
source_current="$source" source_current="$source"

View File

@@ -1,3 +1,5 @@
# shellcheck shell=bash
delete_subvolume_recursively() { delete_subvolume_recursively() {
IFS=$'\n' IFS=$'\n'
for i in $(btrfs subvolume list -o "$1" | cut -f 9- -d ' '); do for i in $(btrfs subvolume list -o "$1" | cut -f 9- -d ' '); do

View File

@@ -1,3 +1,5 @@
# shellcheck shell=bash
if [[ "${EUID}" -ne 0 ]]; then if [[ "${EUID}" -ne 0 ]]; then
echo "Please run the script as root." echo "Please run the script as root."
exit 1 exit 1

View File

@@ -15,8 +15,6 @@
]; ];
home-manager.sharedModules = [ home-manager.sharedModules = [
{ { programs.zsh.initExtra = builtins.readFile ./install.completion.zsh; }
programs.zsh.initExtra = builtins.readFile ./install.completion.zsh;
}
]; ];
} }

View File

@@ -1,3 +1,5 @@
# shellcheck shell=bash
usage() { usage() {
echo "Usage: $0 flake -m install|repair -h host [-k key] [-p password_file] [-c] [-r]" echo "Usage: $0 flake -m install|repair -h host [-k key] [-p password_file] [-c] [-r]"
echo echo

View File

@@ -1,3 +1,5 @@
# shellcheck shell=bash
SEARCH_STRINGS=( SEARCH_STRINGS=(
"Mouse" "Mouse"
"Razer DeathAdder V3 HyperSpeed" "Razer DeathAdder V3 HyperSpeed"
@@ -6,8 +8,9 @@ SEARCH_STRINGS=(
for search_string in "${SEARCH_STRINGS[@]}"; do for search_string in "${SEARCH_STRINGS[@]}"; do
echo "Searching for devices matching: $search_string" echo "Searching for devices matching: $search_string"
for f in $(grep -l "$search_string" /sys/bus/usb/devices/*/product 2>/dev/null | sed "s/product/power\\/control/"); do grep -l "$search_string" /sys/bus/usb/devices/*/product 2>/dev/null | sed "s/product/power\\/control/" | while IFS= read -r device
echo "Setting power control to 'on' for: $f" do
echo on >| "$f" echo "Setting power control to 'on' for: $device"
echo on >| "$device"
done done
done done

View File

@@ -1,3 +1,5 @@
# shellcheck shell=bash
case "$2" in case "$2" in
connectivity-change) connectivity-change)
if timezone=$(curl --fail https://ipapi.co/timezone); then if timezone=$(curl --fail https://ipapi.co/timezone); then

View File

@@ -38,8 +38,6 @@ lib.mkMerge [
sessionVariables.DOCKER_CONFIG = "${home}/.config/docker"; sessionVariables.DOCKER_CONFIG = "${home}/.config/docker";
}; };
programs.vscode.languages.docker.enable = true;
}; };
} }
(lib.mkIf rootless { (lib.mkIf rootless {
@@ -54,7 +52,5 @@ lib.mkMerge [
]; ];
}; };
}) })
(lib.mkIf (!rootless) { (lib.mkIf (!rootless) { users.users.${user}.extraGroups = [ "docker" ]; })
users.users.${user}.extraGroups = [ "docker" ];
})
] ]

View File

@@ -1,3 +1,5 @@
# shellcheck shell=bash
git interpret-trailers --if-exists doNothing --trailer \ git interpret-trailers --if-exists doNothing --trailer \
"Signed-off-by: $(git config user.name) <$(git config user.email)>" \ "Signed-off-by: $(git config user.name) <$(git config user.email)>" \
--in-place "$1" --in-place "$1"

View File

@@ -1,3 +1,5 @@
# shellcheck shell=bash
install -d -m 700 "$GNUPGHOME" install -d -m 700 "$GNUPGHOME"
KEYS="$HOME/.config/sops-nix/secrets/gpg" KEYS="$HOME/.config/sops-nix/secrets/gpg"

View File

@@ -9,9 +9,7 @@
programs.dconf.enable = true; programs.dconf.enable = true;
home-manager = { home-manager = {
extraSpecialArgs = { extraSpecialArgs = { inherit inputs; };
inherit inputs;
};
backupFileExtension = "bak"; backupFileExtension = "bak";
useUserPackages = true; useUserPackages = true;
useGlobalPkgs = true; useGlobalPkgs = true;

View File

@@ -20,9 +20,7 @@
pkgs = nixpkgs.legacyPackages.${system}; pkgs = nixpkgs.legacyPackages.${system};
in in
{ {
devShells.default = pkgs.mkShell { devShells.default = pkgs.mkShell { packages = [ ]; };
packages = [ ];
};
formatter = pkgs.nixfmt-rfc-style; formatter = pkgs.nixfmt-rfc-style;
} }

View File

@@ -99,9 +99,7 @@
''; '';
"direnv/direnv.toml".source = ( "direnv/direnv.toml".source = (
(pkgs.formats.toml { }).generate "direnv.toml" { (pkgs.formats.toml { }).generate "direnv.toml" { global.warn_timeout = 0; }
global.warn_timeout = 0;
}
); );
}; };
}; };

View File

@@ -13,7 +13,5 @@
config.environment.persistence."/persist"."${home}/.config/sops-nix/key.txt".source; config.environment.persistence."/persist"."${home}/.config/sops-nix/key.txt".source;
home.sessionVariables.SOPS_AGE_KEY_FILE = home.sessionVariables.SOPS_AGE_KEY_FILE =
config.environment.persistence."/persist"."${home}/.config/sops-nix/key.txt".source; config.environment.persistence."/persist"."${home}/.config/sops-nix/key.txt".source;
programs.vscode.languages.sops.enable = true;
}; };
} }

View File

@@ -1,10 +1,10 @@
import { App } from "astal/gtk3" import { App } from "astal/gtk3";
import Bar from "./widget/Bar" import Bar from "./widget/Bar";
import { monitorFile } from "astal/file" import { monitorFile } from "astal/file";
import { exec } from "astal/process" import { exec } from "astal/process";
import GLib from "gi://GLib" import GLib from "gi://GLib";
const HOME = GLib.getenv("HOME") const HOME = GLib.getenv("HOME");
const css = `${HOME}/.config/astal/theme.css`; const css = `${HOME}/.config/astal/theme.css`;
const scss = `${HOME}/.config/astal/theme.sass`; const scss = `${HOME}/.config/astal/theme.sass`;
@@ -18,6 +18,6 @@ exec(`sassc ${scss} ${css}`);
App.start({ App.start({
css, css,
main() { main() {
App.get_monitors().map(Bar) App.get_monitors().map(Bar);
}, },
}) });

View File

@@ -1,26 +1,26 @@
export const SRC: string export const SRC: string;
declare module "inline:*" { declare module "inline:*" {
const content: string const content: string;
export default content export default content;
} }
declare module "*.scss" { declare module "*.scss" {
const content: string const content: string;
export default content export default content;
} }
declare module "*.sass" { declare module "*.sass" {
const content: string const content: string;
export default content export default content;
} }
declare module "*.blp" { declare module "*.blp" {
const content: string const content: string;
export default content export default content;
} }
declare module "*.css" { declare module "*.css" {
const content: string const content: string;
export default content export default content;
} }

View File

@@ -7,6 +7,6 @@
"module": "ES2022", "module": "ES2022",
"moduleResolution": "Bundler", "moduleResolution": "Bundler",
"jsx": "react-jsx", "jsx": "react-jsx",
"jsxImportSource": "astal/gtk3", "jsxImportSource": "astal/gtk3"
} }
} }

View File

@@ -1,13 +1,12 @@
import { App, Astal, Gtk, Gdk } from 'astal/gtk3' import { App, Astal, Gtk, Gdk } from "astal/gtk3";
import Launcher from './components/Launcher'; import Launcher from "./components/Launcher";
import Workspace from './components/Workspaces'; import Workspace from "./components/Workspaces";
import Date from './components/Date'; import Date from "./components/Date";
import Systray from './components/Tray'; import Systray from "./components/Tray";
import Hyprland from "gi://AstalHyprland"; import Hyprland from "gi://AstalHyprland";
const anchor = Astal.WindowAnchor.TOP const anchor =
| Astal.WindowAnchor.LEFT Astal.WindowAnchor.TOP | Astal.WindowAnchor.LEFT | Astal.WindowAnchor.RIGHT;
| Astal.WindowAnchor.RIGHT;
const hyprland = Hyprland.get_default(); const hyprland = Hyprland.get_default();
@@ -20,22 +19,25 @@ function getHyprlandMonitor(gdkmonitor: Gdk.Monitor) {
} }
} }
export default (monitor: Gdk.Monitor) => <window export default (monitor: Gdk.Monitor) => (
className='bar' <window
gdkmonitor={monitor} className="bar"
exclusivity={Astal.Exclusivity.EXCLUSIVE} gdkmonitor={monitor}
anchor={anchor} exclusivity={Astal.Exclusivity.EXCLUSIVE}
application={App}> anchor={anchor}
<centerbox className='widgets'> application={App}
<box hexpand halign={Gtk.Align.START}> >
<Launcher /> <centerbox className="widgets">
<Workspace monitor={getHyprlandMonitor(monitor)!} /> <box hexpand halign={Gtk.Align.START}>
</box> <Launcher />
<box hexpand halign={Gtk.Align.CENTER}> <Workspace monitor={getHyprlandMonitor(monitor)!} />
<Date /> </box>
</box> <box hexpand halign={Gtk.Align.CENTER}>
<box hexpand halign={Gtk.Align.END}> <Date />
<Systray /> </box>
</box> <box hexpand halign={Gtk.Align.END}>
</centerbox> <Systray />
</window> </box>
</centerbox>
</window>
);

View File

@@ -1,13 +1,13 @@
import { Variable } from "astal/variable";
import { GLib } from "astal";
import { Variable } from 'astal/variable'; const time = Variable<string>("").poll(
import { GLib } from 'astal'; 1000,
() => GLib.DateTime.new_now_local().format("%H:%M - %A, %d %B %Y")!,
);
const time = Variable<string>("").poll(1000, () => GLib.DateTime.new_now_local().format('%H:%M - %A, %d %B %Y')!) export default () => (
<button className="date">
export default () => <button className='date'> <label className="label" onDestroy={() => time.drop()} label={time()} />
<label </button>
className='label' );
onDestroy={() => time.drop()}
label={time()}
/>
</button>;

View File

@@ -1,7 +1,12 @@
import { execAsync } from "astal/process" import { execAsync } from "astal/process";
export default () => <button export default () => (
className="launcher" <button
onClickRelease={() => execAsync('bash -c "rofi -cache-dir $XDG_CACHE_HOME/rofi -show drun"')}> className="launcher"
<icon className="icon" icon="nix-snowflake-symbolic" />; onClickRelease={() =>
</button>; execAsync('bash -c "rofi -cache-dir $XDG_CACHE_HOME/rofi -show drun"')
}
>
<icon className="icon" icon="nix-snowflake-symbolic" />;
</button>
);

View File

@@ -1,25 +1,28 @@
import { App } from 'astal/gtk3' import { App } from "astal/gtk3";
import { bind } from 'astal' import { bind } from "astal";
import Tray from 'gi://AstalTray' import Tray from "gi://AstalTray";
const tray = Tray.get_default() const tray = Tray.get_default();
const TrayButton = ({ item }: { item: Tray.TrayItem }) => ( const TrayButton = ({ item }: { item: Tray.TrayItem }) => (
<menubutton <menubutton
className='item' className="item"
tooltipMarkup={bind(item, 'tooltipMarkup')} tooltipMarkup={bind(item, "tooltipMarkup")}
usePopover={false} usePopover={false}
menuModel={bind(item, 'menuModel')} menuModel={bind(item, "menuModel")}
actionGroup={bind(item, 'actionGroup').as(ag => ['dbusmenu', ag])} actionGroup={bind(item, "actionGroup").as((ag) => ["dbusmenu", ag])}
> >
<icon gicon={bind(item, 'gicon')} /> <icon gicon={bind(item, "gicon")} />
</menubutton> </menubutton>
) );
export default () => <box className='systray'> export default () => (
{ <box className="systray">
bind(tray, 'items').as(items => items.map(item => { {bind(tray, "items").as((items) =>
if (item.iconThemePath) App.add_icons(item.iconThemePath); items.map((item) => {
return <TrayButton item={item} />; if (item.iconThemePath) App.add_icons(item.iconThemePath);
}))} return <TrayButton item={item} />;
</box>; }),
)}
</box>
);

View File

@@ -1,6 +1,6 @@
import { bind, Variable } from "astal"; import { bind, Variable } from "astal";
import Hyprland from "gi://AstalHyprland"; import Hyprland from "gi://AstalHyprland";
import { range } from '../../lib'; import { range } from "../../lib";
const hyprland = Hyprland.get_default(); const hyprland = Hyprland.get_default();
const BLOCK_SIZE = 10; const BLOCK_SIZE = 10;
@@ -20,14 +20,14 @@ const Workspace = ({ id }: { id: number }) => {
const active = Variable.derive( const active = Variable.derive(
[bind(hyprland, "focusedWorkspace")], [bind(hyprland, "focusedWorkspace")],
focused => focused.id == id (focused) => focused.id == id,
); );
hyprland.connect("workspace-added", (_, workspace) => { hyprland.connect("workspace-added", (_, workspace) => {
if (workspace.id != id) return; if (workspace.id != id) return;
maybeWorkspace.set(workspace); maybeWorkspace.set(workspace);
occupied.set(workspace.clients.length > 0); occupied.set(workspace.clients.length > 0);
workspace.connect("clients", clients => occupied.set(clients.length > 0)) workspace.connect("clients", (clients) => occupied.set(clients.length > 0));
}); });
hyprland.connect("workspace-removed", (_, workspaceId) => { hyprland.connect("workspace-removed", (_, workspaceId) => {
@@ -36,37 +36,43 @@ const Workspace = ({ id }: { id: number }) => {
occupied.set(false); occupied.set(false);
}); });
const className = Variable.derive( const className = Variable.derive([active, occupied], (active, occupied) => {
[active, occupied], if (active) return "button active";
(active, occupied) => { if (occupied) return "button occupied";
if (active) return "button active"; return "button";
if (occupied) return "button occupied"; });
return "button";
}
);
return <box vertical> return (
<box vexpand /> <box vertical>
<eventbox onClickRelease={() => hyprland.dispatch("workspace", `${id}`)}> <box vexpand />
<label className={className()} /> <eventbox onClickRelease={() => hyprland.dispatch("workspace", `${id}`)}>
</eventbox> <label className={className()} />
<box vexpand /> </eventbox>
</box>; <box vexpand />
</box>
);
}; };
export default ({ monitor }: { monitor: Hyprland.Monitor }) => { export default ({ monitor }: { monitor: Hyprland.Monitor }) => {
const workspaces = hyprland.get_workspaces(); const workspaces = hyprland.get_workspaces();
const displayWorkspaces = workspaces.filter(w => w.monitor.id === monitor.id); const displayWorkspaces = workspaces.filter(
const displayWorkspaceBlockStart = Math.floor((displayWorkspaces[0].id - 1) / BLOCK_SIZE) * 10; (w) => w.monitor.id === monitor.id,
);
const displayWorkspaceBlockStart =
Math.floor((displayWorkspaces[0].id - 1) / BLOCK_SIZE) * 10;
return <eventbox return (
className="workspaces" <eventbox
onScroll={(_, e) => { className="workspaces"
hyprland.dispatch("workspace", e.delta_y > 0 ? "m+1" : "m-1"); onScroll={(_, e) => {
}} hyprland.dispatch("workspace", e.delta_y > 0 ? "m+1" : "m-1");
> }}
<box> >
{range(BLOCK_SIZE).map(i => <Workspace id={displayWorkspaceBlockStart + i} />)} <box>
</box> {range(BLOCK_SIZE).map((i) => (
</eventbox>; <Workspace id={displayWorkspaceBlockStart + i} />
))}
</box>
</eventbox>
);
}; };

View File

@@ -1,3 +1,5 @@
# shellcheck shell=bash
list() { list() {
echo -en "\0keep-selection\x1ftrue\n" echo -en "\0keep-selection\x1ftrue\n"
jq -r 'keys[]' "$BOOKMARKS" jq -r 'keys[]' "$BOOKMARKS"

View File

@@ -21,8 +21,6 @@ in
let let
clipbook-rofi = lib.meta.getExe hmConfig.programs.clipbook.finalPackage; clipbook-rofi = lib.meta.getExe hmConfig.programs.clipbook.finalPackage;
in in
[ [ "$mod, c, exec, ${clipbook-rofi}" ];
"$mod, c, exec, ${clipbook-rofi}"
];
}; };
} }

View File

@@ -1,3 +1,5 @@
# shellcheck shell=bash
list() { list() {
echo -en "\0keep-selection\x1ftrue\n" echo -en "\0keep-selection\x1ftrue\n"
cliphist list cliphist list

View File

@@ -1,3 +1,5 @@
# shellcheck shell=bash
list() { list() {
echo -en "\0keep-selection\x1ftrue\n" echo -en "\0keep-selection\x1ftrue\n"
cliphist list cliphist list

View File

@@ -1,9 +1,6 @@
import { Command } from "commander"; import { Command } from "commander";
import { createFileNode, createImageNode, createHeadingNode } from "./lexical"; import { createFileNode, createImageNode, createHeadingNode } from "./lexical";
import { import { extractShootingConditions, createImageCaption } from "./exif";
extractShootingConditions,
createImageCaption,
} from "./exif";
import { uploadFile, uploadImage, uploadPost } from "./api"; import { uploadFile, uploadImage, uploadPost } from "./api";
import { getBasenameWithExtension, prepareFiles } from "./files"; import { getBasenameWithExtension, prepareFiles } from "./files";

View File

@@ -1,3 +1,5 @@
# shellcheck shell=bash
STEAM="$HOME/.local/share/Steam/steamapps/common" STEAM="$HOME/.local/share/Steam/steamapps/common"
GAMES="$HOME/Games" GAMES="$HOME/Games"

View File

@@ -1,3 +1,5 @@
# shellcheck shell=bash
SELECTED_WORKSPACE_BASE="$1" SELECTED_WORKSPACE_BASE="$1"
ACTION="$2" ACTION="$2"

View File

@@ -1,3 +1,5 @@
# shellcheck shell=bash
handle() { handle() {
# shellcheck disable=SC2086 # shellcheck disable=SC2086
case $1 in case $1 in

View File

@@ -1,18 +1,24 @@
:root { :root {
--replete-custom-separators-vertical-padding: 4px; --replete-custom-separators-vertical-padding: 4px;
--replete-custom-separators-left-margin: -12px; --replete-custom-separators-left-margin: -12px;
} }
.nav-files-container [class*=nav-]:has(:is( .nav-files-container
[data-path="Inbox"], [class*="nav-"]:has(
[data-path="Dreams"], :is(
[data-path="Work"], [data-path="Inbox"],
[data-path="Random"], [data-path="Dreams"],
))::after { [data-path="Work"],
content:''; [data-path="Random"],
display:block;
height:1px; )
width:calc(100% + 32px); )::after {
background:linear-gradient(to right, var(--tab-outline-color), transparent); content: "";
margin:var(--replete-custom-separators-vertical-padding) 0 var(--replete-custom-separators-vertical-padding) var(--replete-custom-separators-left-margin); display: block;
height: 1px;
width: calc(100% + 32px);
background: linear-gradient(to right, var(--tab-outline-color), transparent);
margin: var(--replete-custom-separators-vertical-padding) 0
var(--replete-custom-separators-vertical-padding)
var(--replete-custom-separators-left-margin);
} }

View File

@@ -707,9 +707,7 @@ in
_: vault: _: vault:
lib.attrsets.nameValuePair lib.attrsets.nameValuePair
"${home}/${vault.target}/.obsidian/plugins/obsidian-style-settings/data.json" "${home}/${vault.target}/.obsidian/plugins/obsidian-style-settings/data.json"
{ { source = ./theme.json; }
source = ./theme.json;
}
) hmConfig.programs.obsidian.vaults; ) hmConfig.programs.obsidian.vaults;
sops.secrets."google/geocoding".sopsFile = ../../../../../../secrets/personal/secrets.yaml; sops.secrets."google/geocoding".sopsFile = ../../../../../../secrets/personal/secrets.yaml;

View File

@@ -35,7 +35,7 @@ in
theme = spicePkgs.themes.sleek // { theme = spicePkgs.themes.sleek // {
extraCommands = '' extraCommands = ''
export COLORS_CSS_PATH="${home}/.config/spotify/colors.css" export COLORS_CSS_PATH="${home}/.config/spotify/theme.css"
''; '';
additionalCss = '' additionalCss = ''
@@ -77,7 +77,7 @@ in
}; };
}; };
theme.template."${home}/.config/spotify/colors.css".source = ./colors.css; theme.template."${home}/.config/spotify/theme.css".source = ./theme.css;
wayland.windowManager.hyprland.settings.bind = [ wayland.windowManager.hyprland.settings.bind = [
"$mod, s, exec, ${lib.meta.getExe hmConfig.programs.spicetify.spicedSpotify}" "$mod, s, exec, ${lib.meta.getExe hmConfig.programs.spicetify.spicedSpotify}"

View File

@@ -1,3 +1,5 @@
# shellcheck shell=bash
wallpaper="" wallpaper=""
mode="" mode=""

View File

@@ -5,7 +5,5 @@
... ...
}: }:
lib.mkIf config.programs.vscode.languages.docker.enable { lib.mkIf config.programs.vscode.languages.docker.enable {
programs.vscode.extensions = with pkgs.vscode-extensions; [ programs.vscode.extensions = with pkgs.vscode-extensions; [ ms-azuretools.vscode-docker ];
ms-azuretools.vscode-docker
];
} }

View File

@@ -5,7 +5,5 @@
... ...
}: }:
lib.mkIf config.programs.vscode.languages.go.enable { lib.mkIf config.programs.vscode.languages.go.enable {
programs.vscode.extensions = with pkgs.vscode-extensions; [ programs.vscode.extensions = with pkgs.vscode-extensions; [ golang.go ];
golang.go
];
} }

View File

@@ -5,7 +5,5 @@
... ...
}: }:
lib.mkIf config.programs.vscode.languages.jinja.enable { lib.mkIf config.programs.vscode.languages.jinja.enable {
programs.vscode.extensions = with pkgs.vscode-extensions; [ programs.vscode.extensions = with pkgs.vscode-extensions; [ wholroyd.jinja ];
wholroyd.jinja
];
} }

View File

@@ -5,7 +5,5 @@
... ...
}: }:
lib.mkIf config.programs.vscode.languages.lua.enable { lib.mkIf config.programs.vscode.languages.lua.enable {
programs.vscode.extensions = with pkgs.vscode-extensions; [ programs.vscode.extensions = with pkgs.vscode-extensions; [ sumneko.lua ];
sumneko.lua
];
} }

View File

@@ -5,7 +5,5 @@
... ...
}: }:
lib.mkIf config.programs.vscode.languages.markdown.enable { lib.mkIf config.programs.vscode.languages.markdown.enable {
programs.vscode.extensions = with pkgs.vscode-extensions; [ programs.vscode.extensions = with pkgs.vscode-extensions; [ yzhang.markdown-all-in-one ];
yzhang.markdown-all-in-one
];
} }

View File

@@ -6,9 +6,7 @@
}: }:
lib.mkIf config.programs.vscode.languages.rest.enable { lib.mkIf config.programs.vscode.languages.rest.enable {
programs.vscode = { programs.vscode = {
extensions = with pkgs.vscode-extensions; [ extensions = with pkgs.vscode-extensions; [ humao.rest-client ];
humao.rest-client
];
userSettings = { userSettings = {
"rest-client.enableTelemetry" = false; "rest-client.enableTelemetry" = false;

View File

@@ -6,9 +6,7 @@
}: }:
lib.mkIf config.programs.vscode.languages.sas.enable { lib.mkIf config.programs.vscode.languages.sas.enable {
programs.vscode = { programs.vscode = {
extensions = with pkgs.vscode-extensions; [ extensions = with pkgs.vscode-extensions; [ sas.sas-lsp ];
sas.sas-lsp
];
userSettings = { userSettings = {
"SAS.connectionProfiles" = { "SAS.connectionProfiles" = {

View File

@@ -5,7 +5,5 @@
... ...
}: }:
lib.mkIf config.programs.vscode.languages.sops.enable { lib.mkIf config.programs.vscode.languages.sops.enable {
programs.vscode.extensions = with pkgs.vscode-extensions; [ programs.vscode.extensions = with pkgs.vscode-extensions; [ signageos.signageos-vscode-sops ];
signageos.signageos-vscode-sops
];
} }

View File

@@ -10,11 +10,6 @@ lib.mkIf config.programs.vscode.languages.svelte.enable {
"svelte.enable-ts-plugin" = true; "svelte.enable-ts-plugin" = true;
}; };
extensions = extensions = with pkgs; with vscode-extensions; [ svelte.svelte-vscode ];
with pkgs;
with vscode-extensions;
[
svelte.svelte-vscode
];
}; };
} }

View File

@@ -5,7 +5,5 @@
... ...
}: }:
lib.mkIf config.programs.vscode.languages.yaml.enable { lib.mkIf config.programs.vscode.languages.yaml.enable {
programs.vscode.extensions = with pkgs.vscode-extensions; [ programs.vscode.extensions = with pkgs.vscode-extensions; [ redhat.vscode-yaml ];
redhat.vscode-yaml
];
} }

View File

@@ -1,6 +1 @@
{ pkgs, ... }: { pkgs, ... }: pkgs.mkShell { packages = with pkgs; [ bun ]; }
pkgs.mkShell {
packages = with pkgs; [
bun
];
}

View File

@@ -1,6 +1 @@
{ pkgs, ... }: { pkgs, ... }: pkgs.mkShell { packages = with pkgs; [ nodejs ]; }
pkgs.mkShell {
packages = with pkgs; [
nodejs
];
}

View File

@@ -1,8 +1,6 @@
{ pkgs, ... }: { pkgs, ... }:
pkgs.mkShell { pkgs.mkShell {
packages = with pkgs; [ packages = with pkgs; [ (python3.withPackages (python-pkgs: with python-pkgs; [ pip ])) ];
(python3.withPackages (python-pkgs: with python-pkgs; [ pip ]))
];
shellHook = '' shellHook = ''
if git rev-parse --is-inside-work-tree &> /dev/null; then if git rev-parse --is-inside-work-tree &> /dev/null; then

View File

@@ -11,12 +11,15 @@
### Third-party Services ### Third-party Services
- [ ] Firefox - [ ] Firefox
- [ ] Authenticate - [ ] Authenticate
- [ ] Spotify - [ ] Spotify
- [ ] Authenticate - [ ] Authenticate
- [ ] Local Files - [ ] Local Files
- [ ] Steam - [ ] Steam
- [ ] Authenticate - [ ] Authenticate
- [ ] `protonup` - [ ] `protonup`

View File

@@ -1,3 +1,5 @@
# shellcheck shell=bash
AMD=/dev/dri/by-path/pci-0000:06:00.0-card AMD=/dev/dri/by-path/pci-0000:06:00.0-card
NVIDIA=/dev/dri/by-path/pci-0000:01:00.0-card NVIDIA=/dev/dri/by-path/pci-0000:01:00.0-card

View File

@@ -5,9 +5,7 @@
... ...
}: }:
{ {
imports = [ imports = [ ./display.nix ];
./display.nix
];
# https://github.com/NixOS/nixos-hardware/tree/master/lenovo/legion/16achg6 # https://github.com/NixOS/nixos-hardware/tree/master/lenovo/legion/16achg6
hardware = { hardware = {

View File

@@ -2,9 +2,7 @@
{ {
boot.kernelParams = [ "video=eDP-1:2560x1600@165" ]; boot.kernelParams = [ "video=eDP-1:2560x1600@165" ];
programs.steam.package = pkgs.steam.override { programs.steam.package = pkgs.steam.override { extraEnv.STEAM_FORCE_DESKTOPUI_SCALING = 1.25; };
extraEnv.STEAM_FORCE_DESKTOPUI_SCALING = 1.25;
};
home-manager.sharedModules = [ home-manager.sharedModules = [
{ {

View File

@@ -13,6 +13,7 @@
nix.enable = true; nix.enable = true;
python.enable = true; python.enable = true;
rest.enable = true; rest.enable = true;
sops.enable = true;
typescript.enable = true; typescript.enable = true;
yaml.enable = true; yaml.enable = true;
}; };

View File

@@ -20,8 +20,10 @@ You must build the system once with these imports commented out. Then, connect t
### Third-party Services ### Third-party Services
- [ ] Firefox - [ ] Firefox
- [ ] Authenticate - [ ] Authenticate
- [ ] Spotify - [ ] Spotify
- [ ] Authenticate - [ ] Authenticate
- [ ] Local Files - [ ] Local Files

View File

@@ -1,8 +1,6 @@
{ ... }: { ... }:
{ {
imports = [ imports = [ ./display.nix ];
./display.nix
];
hardware = { hardware = {
enableAllFirmware = true; enableAllFirmware = true;

View File

@@ -7,9 +7,7 @@
nixpkgs.overlays = [ nixpkgs.overlays = [
(final: prev: { (final: prev: {
telepresence = prev.telepresence.overrideAttrs (oldAttrs: { telepresence = prev.telepresence.overrideAttrs (oldAttrs: {
patches = oldAttrs.patches or [ ] ++ [ patches = oldAttrs.patches or [ ] ++ [ ./extend-timeout.patch ];
./extend-timeout.patch
];
}); });
}) })
]; ];

View File

@@ -18,6 +18,7 @@
python.enable = true; python.enable = true;
rest.enable = true; rest.enable = true;
sas.enable = true; sas.enable = true;
sops.enable = true;
typescript.enable = true; typescript.enable = true;
yaml.enable = true; yaml.enable = true;
}; };

View File

@@ -8,21 +8,23 @@ I have automated myself out of a job. How to use:
3. Connect to the internet with `nmcli` 3. Connect to the internet with `nmcli`
- Scan for available networks: - Scan for available networks:
```bash ```bash
nmcli device wifi list nmcli device wifi list
``` ```
- For an open network:
```bash - For an open network:
nmcli device wifi connect "<SSID>"
```
- For a secured network:
```bash ```bash
nmcli device wifi connect "<SSID>" password "<password>" nmcli device wifi connect "<SSID>"
``` ```
- For a secured network:
```bash
nmcli device wifi connect "<SSID>" password "<password>"
```
4. Run `sudo nix-install /etc/nixos -m install|repair -h host [-k key] [-c] [-r]"` 4. Run `sudo nix-install /etc/nixos -m install|repair -h host [-k key] [-c] [-r]"`
@@ -30,48 +32,49 @@ I have automated myself out of a job. How to use:
1. Download a Minimal Live Nix ISO 1. Download a Minimal Live Nix ISO
- Visit the official NixOS website: [https://nixos.org/download.html](https://nixos.org/download.html). - Visit the official NixOS website: [https://nixos.org/download.html](https://nixos.org/download.html).
- Download the "Minimal ISO image". - Download the "Minimal ISO image".
2. Burn the ISO 2. Burn the ISO
- On Windows, use [Rufus](https://rufus.ie) to burn the ISO to a USB drive. - On Windows, use [Rufus](https://rufus.ie) to burn the ISO to a USB drive.
- On Linux, use the `dd` command: - On Linux, use the `dd` command:
```bash ```bash
sudo dd if=<path-to-iso> of=/dev/sdX bs=4M status=progress sudo dd if=<path-to-iso> of=/dev/sdX bs=4M status=progress
``` ```
3. Boot into USB 3. Boot into USB
4. Connect to the Internet with `wpa_supplicant` 4. Connect to the Internet with `wpa_supplicant`
- Identify your network interface: - Identify your network interface:
```bash ```bash
ip link show | grep -E '^[0-9]+:' | awk '{print $2}' | tr -d ':' ip link show | grep -E '^[0-9]+:' | awk '{print $2}' | tr -d ':'
``` ```
- For an open network:
```bash - For an open network:
wpa_supplicant -i "${interface}" -c <(wpa_passphrase "${ssid}") -B
```
- For a secured network: ```bash
wpa_supplicant -i "${interface}" -c <(wpa_passphrase "${ssid}") -B
```
```bash - For a secured network:
config=$(mktemp)
wpa_passphrase "${ssid}" "${passphrase}" > "${config}"
wpa_supplicant -i "${interface}" -c "${config}" -B
rm "${config}"
```
- Obtain an IP address: ```bash
config=$(mktemp)
wpa_passphrase "${ssid}" "${passphrase}" > "${config}"
wpa_supplicant -i "${interface}" -c "${config}" -B
rm "${config}"
```
```bash - Obtain an IP address:
dhcpcd
``` ```bash
dhcpcd
```
5. Clone the flake repository 5. Clone the flake repository

View File

@@ -1,3 +1,5 @@
# shellcheck shell=bash
source=$(realpath -m "$1") source=$(realpath -m "$1")
target=$(realpath -m "$2") target=$(realpath -m "$2")

View File

@@ -1,4 +1,5 @@
#!/usr/bin/env -S nix shell nixpkgs#ssh-to-age -c bash #!/usr/bin/env -S nix shell nixpkgs#ssh-to-age -c bash
# shellcheck shell=bash
set -o errexit set -o errexit
set -o nounset set -o nounset
@@ -15,11 +16,11 @@ mkdir -p "./hosts/$host/secrets"
ssh-keygen -t ed25519 -f "./hosts/$host/secrets/ssh_host_ed25519_key" -N "" ssh-keygen -t ed25519 -f "./hosts/$host/secrets/ssh_host_ed25519_key" -N ""
age_key=$(cat './hosts/$host/secrets/ssh_host_ed25519_key.pub' | ssh-to-age) age_key=$(ssh-to-age < "./hosts/$host/secrets/ssh_host_ed25519_key.pub")
find . -type f -name "sops.yaml" | while IFS= read -r sops_file; do find . -type f -name "sops.yaml" | while IFS= read -r sops_file; do
sed -i "/- hosts:/a\ - &$host $age_key" "$sops_file" sed -i "/- hosts:/a\ - &$host $age_key" "$sops_file"
sed -i "/- age:/a\ - *$host" "$sops_file" sed -i "/- age:/a\ - *$host" "$sops_file"
done done
sed -i "/knownHosts = {/a\ $host.publicKeyFile = ../../../../$host/secrets/ssh_host_ed25519_key.pub;" ./hosts/common/configs/system/ssh/default.nix sed -i "/knownHosts = {/a\ $host.publicKeyFile = ../../../../$host/secrets/ssh_host_ed25519_key.pub;" ./hosts/common/configs/system/ssh/default.nix
@@ -29,4 +30,4 @@ sed -i "/userKnownHostsFile = lib.strings.concatStringsSep \" \" \[/a\ ..
echo "Host $host has been successfully added." echo "Host $host has been successfully added."
echo "You can generate SSH key pairs for any users that need to connect to user@host using the following command:" echo "You can generate SSH key pairs for any users that need to connect to user@host using the following command:"
echo "ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519_$host_<user>" echo "ssh-keygen -t ed25519 -f ~/.ssh/id_ed25519_${host}_<user>"

View File

@@ -1,4 +1,5 @@
#!/usr/bin/env -S nix shell nixpkgs#ssh-to-age -c bash #!/usr/bin/env -S nix shell nixpkgs#ssh-to-age -c bash
# shellcheck shell=bash
set -o errexit set -o errexit
set -o nounset set -o nounset
@@ -11,11 +12,11 @@ fi
host="$1" host="$1"
age_key=$(cat './hosts/$host/secrets/ssh_host_ed25519_key.pub' | ssh-to-age) age_key=$(ssh-to-age < "./hosts/$host/secrets/ssh_host_ed25519_key.pub")
find . -type f -name "sops.yaml" | while IFS= read -r sops_file; do find . -type f -name "sops.yaml" | while IFS= read -r sops_file; do
sed -i "/ - &$host $age_key/d" "$sops_file" sed -i "/ - &$host $age_key/d" "$sops_file"
sed -i "/ - \*$host/d" "$sops_file" sed -i "/ - \*$host/d" "$sops_file"
done done
sed -i "/$host/d" ./hosts/common/configs/system/ssh/default.nix sed -i "/$host/d" ./hosts/common/configs/system/ssh/default.nix

View File

@@ -1,4 +1,5 @@
#!/usr/bin/env -S nix shell nixpkgs#sops -c bash #!/usr/bin/env -S nix shell nixpkgs#sops -c bash
# shellcheck shell=bash
set -o errexit set -o errexit
set -o nounset set -o nounset

52
treefmt.nix Normal file
View File

@@ -0,0 +1,52 @@
{ ... }:
{
projectRootFile = "flake.nix";
programs = {
nixfmt = {
enable = true;
strict = true;
};
shellcheck.enable = true;
prettier.enable = true;
gofmt.enable = true;
};
settings = {
global = {
excludes = [
# Third-party
"submodules/*"
# Binary Files
"*.jpg"
"*.png"
"*.svg"
# Machine-generated
"*/secrets.yaml"
"*/secrets/*.pub"
# Theme Templates
"*/theme.css"
"*/theme.conf"
"*/theme.theme"
"*/theme.sass"
"*/*.kvconfig"
# Git
"*/.gitignore"
".gitattributes"
".envrc"
# One-offs
"hosts/*/users/*/uid"
"*/.stignore"
"*/spicetify/config/prefs*"
"*.zsh"
# Manifest Files
"*/package.json"
"*/go.mod"
"*/bun.lockb"
# Broken formatters
"*.lua"
];
};
};
}