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.
- [`hosts/`](./hosts): All host-specific configurations.
- [`common/`](./hosts/common): Shared configuration definitions.
- [`shells/`](./hosts/common/shells): Nix dev shells.
- [`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.
- [`lib/`](./lib): Nix library function definitions and utilities.
- [`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.
- [`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.
| Host | README |
|-------------|----------------------------------------------------------|
| ----------- | -------------------------------------------------------- |
| `installer` | [hosts/installer/README.md](./hosts/installer/README.md) |
| `eirene` | [hosts/eirene/README.md](./hosts/eirene/README.md) |
| `elara` | [hosts/elara/README.md](./hosts/elara/README.md) |

48
flake.lock generated
View File

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

View File

@@ -32,12 +32,20 @@
};
disko = {
url = "github:nix-community/disko";
type = "github";
owner = "nix-community";
repo = "disko";
ref = "master";
inputs.nixpkgs.follows = "nixpkgs";
};
sops-nix = {
url = "github:Mic92/sops-nix";
type = "github";
owner = "Mic92";
repo = "sops-nix";
ref = "master";
inputs.nixpkgs.follows = "nixpkgs";
};
@@ -49,22 +57,47 @@
};
nur = {
url = "github:nix-community/NUR";
type = "github";
owner = "nix-community";
repo = "NUR";
ref = "master";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-utils = {
url = "github:numtide/flake-utils";
type = "github";
owner = "numtide";
repo = "flake-utils";
ref = "main";
inputs.systems.follows = "systems";
};
treefmt-nix = {
type = "github";
owner = "numtide";
repo = "treefmt-nix";
ref = "main";
inputs.nixpkgs.follows = "nixpkgs";
};
astal = {
url = "github:aylur/astal";
type = "github";
owner = "aylur";
repo = "astal";
ref = "main";
inputs.nixpkgs.follows = "nixpkgs";
};
ags = {
url = "github:aylur/ags";
type = "github";
owner = "aylur";
repo = "ags";
ref = "main";
inputs = {
nixpkgs.follows = "nixpkgs";
astal.follows = "astal";
@@ -115,10 +148,11 @@
};
};
}
// inputs.flake-utils.lib.eachDefaultSystem (
// inputs.flake-utils.lib.eachSystem [ "x86_64-linux" ] (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
treefmt = inputs.treefmt-nix.lib.evalModule pkgs ./treefmt.nix;
in
{
devShells = {
@@ -131,7 +165,8 @@
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
echo "Please run the script as root."
exit 1

View File

@@ -13,8 +13,6 @@
];
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
];
home-manager.sharedModules = [
{
services.mpris-proxy.enable = config.services.pipewire.enable;
}
];
home-manager.sharedModules = [ { 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."
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."
source_current="$source"

View File

@@ -1,3 +1,5 @@
# shellcheck shell=bash
delete_subvolume_recursively() {
IFS=$'\n'
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
echo "Please run the script as root."
exit 1

View File

@@ -15,8 +15,6 @@
];
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() {
echo "Usage: $0 flake -m install|repair -h host [-k key] [-p password_file] [-c] [-r]"
echo

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -13,7 +13,5 @@
config.environment.persistence."/persist"."${home}/.config/sops-nix/key.txt".source;
home.sessionVariables.SOPS_AGE_KEY_FILE =
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 Bar from "./widget/Bar"
import { monitorFile } from "astal/file"
import { exec } from "astal/process"
import GLib from "gi://GLib"
import { App } from "astal/gtk3";
import Bar from "./widget/Bar";
import { monitorFile } from "astal/file";
import { exec } from "astal/process";
import GLib from "gi://GLib";
const HOME = GLib.getenv("HOME")
const HOME = GLib.getenv("HOME");
const css = `${HOME}/.config/astal/theme.css`;
const scss = `${HOME}/.config/astal/theme.sass`;
@@ -18,6 +18,6 @@ exec(`sassc ${scss} ${css}`);
App.start({
css,
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:*" {
const content: string
export default content
const content: string;
export default content;
}
declare module "*.scss" {
const content: string
export default content
const content: string;
export default content;
}
declare module "*.sass" {
const content: string
export default content
const content: string;
export default content;
}
declare module "*.blp" {
const content: string
export default content
const content: string;
export default content;
}
declare module "*.css" {
const content: string
export default content
const content: string;
export default content;
}

View File

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

View File

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

View File

@@ -1,13 +1,13 @@
import { Variable } from "astal/variable";
import { GLib } from "astal";
import { Variable } from 'astal/variable';
import { GLib } from 'astal';
const time = Variable<string>("").poll(
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'>
<label
className='label'
onDestroy={() => time.drop()}
label={time()}
/>
</button>;
export default () => (
<button className="date">
<label 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
className="launcher"
onClickRelease={() => execAsync('bash -c "rofi -cache-dir $XDG_CACHE_HOME/rofi -show drun"')}>
<icon className="icon" icon="nix-snowflake-symbolic" />;
</button>;
export default () => (
<button
className="launcher"
onClickRelease={() =>
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 { bind } from 'astal'
import Tray from 'gi://AstalTray'
import { App } from "astal/gtk3";
import { bind } from "astal";
import Tray from "gi://AstalTray";
const tray = Tray.get_default()
const tray = Tray.get_default();
const TrayButton = ({ item }: { item: Tray.TrayItem }) => (
<menubutton
className='item'
tooltipMarkup={bind(item, 'tooltipMarkup')}
className="item"
tooltipMarkup={bind(item, "tooltipMarkup")}
usePopover={false}
menuModel={bind(item, 'menuModel')}
actionGroup={bind(item, 'actionGroup').as(ag => ['dbusmenu', ag])}
menuModel={bind(item, "menuModel")}
actionGroup={bind(item, "actionGroup").as((ag) => ["dbusmenu", ag])}
>
<icon gicon={bind(item, 'gicon')} />
<icon gicon={bind(item, "gicon")} />
</menubutton>
)
);
export default () => <box className='systray'>
{
bind(tray, 'items').as(items => items.map(item => {
if (item.iconThemePath) App.add_icons(item.iconThemePath);
return <TrayButton item={item} />;
}))}
</box>;
export default () => (
<box className="systray">
{bind(tray, "items").as((items) =>
items.map((item) => {
if (item.iconThemePath) App.add_icons(item.iconThemePath);
return <TrayButton item={item} />;
}),
)}
</box>
);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,18 +1,24 @@
:root {
--replete-custom-separators-vertical-padding: 4px;
--replete-custom-separators-left-margin: -12px;
--replete-custom-separators-vertical-padding: 4px;
--replete-custom-separators-left-margin: -12px;
}
.nav-files-container [class*=nav-]:has(:is(
[data-path="Inbox"],
[data-path="Dreams"],
[data-path="Work"],
[data-path="Random"],
))::after {
content:'';
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);
.nav-files-container
[class*="nav-"]:has(
:is(
[data-path="Inbox"],
[data-path="Dreams"],
[data-path="Work"],
[data-path="Random"],
)
)::after {
content: "";
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:
lib.attrsets.nameValuePair
"${home}/${vault.target}/.obsidian/plugins/obsidian-style-settings/data.json"
{
source = ./theme.json;
}
{ source = ./theme.json; }
) hmConfig.programs.obsidian.vaults;
sops.secrets."google/geocoding".sopsFile = ../../../../../../secrets/personal/secrets.yaml;

View File

@@ -35,7 +35,7 @@ in
theme = spicePkgs.themes.sleek // {
extraCommands = ''
export COLORS_CSS_PATH="${home}/.config/spotify/colors.css"
export COLORS_CSS_PATH="${home}/.config/spotify/theme.css"
'';
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 = [
"$mod, s, exec, ${lib.meta.getExe hmConfig.programs.spicetify.spicedSpotify}"

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -13,6 +13,7 @@
nix.enable = true;
python.enable = true;
rest.enable = true;
sops.enable = true;
typescript.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
- [ ] Firefox
- [ ] Authenticate
- [ ] Spotify
- [ ] Authenticate
- [ ] Local Files

View File

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

View File

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

View File

@@ -18,6 +18,7 @@
python.enable = true;
rest.enable = true;
sas.enable = true;
sops.enable = true;
typescript.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`
- Scan for available networks:
- Scan for available networks:
```bash
nmcli device wifi list
```
- For an open network:
```bash
nmcli device wifi list
```
```bash
nmcli device wifi connect "<SSID>"
```
- For a secured network:
- For an open network:
```bash
nmcli device wifi connect "<SSID>" password "<password>"
```
```bash
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]"`
@@ -30,48 +32,49 @@ I have automated myself out of a job. How to use:
1. Download a Minimal Live Nix ISO
- Visit the official NixOS website: [https://nixos.org/download.html](https://nixos.org/download.html).
- Download the "Minimal ISO image".
- Visit the official NixOS website: [https://nixos.org/download.html](https://nixos.org/download.html).
- Download the "Minimal ISO image".
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
sudo dd if=<path-to-iso> of=/dev/sdX bs=4M status=progress
```
```bash
sudo dd if=<path-to-iso> of=/dev/sdX bs=4M status=progress
```
3. Boot into USB
4. Connect to the Internet with `wpa_supplicant`
- Identify your network interface:
- Identify your network interface:
```bash
ip link show | grep -E '^[0-9]+:' | awk '{print $2}' | tr -d ':'
```
- For an open network:
```bash
ip link show | grep -E '^[0-9]+:' | awk '{print $2}' | tr -d ':'
```
```bash
wpa_supplicant -i "${interface}" -c <(wpa_passphrase "${ssid}") -B
```
- For an open network:
- For a secured network:
```bash
wpa_supplicant -i "${interface}" -c <(wpa_passphrase "${ssid}") -B
```
```bash
config=$(mktemp)
wpa_passphrase "${ssid}" "${passphrase}" > "${config}"
wpa_supplicant -i "${interface}" -c "${config}" -B
rm "${config}"
```
- For a secured network:
- Obtain an IP address:
```bash
config=$(mktemp)
wpa_passphrase "${ssid}" "${passphrase}" > "${config}"
wpa_supplicant -i "${interface}" -c "${config}" -B
rm "${config}"
```
```bash
dhcpcd
```
- Obtain an IP address:
```bash
dhcpcd
```
5. Clone the flake repository

View File

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

View File

@@ -1,4 +1,5 @@
#!/usr/bin/env -S nix shell nixpkgs#ssh-to-age -c bash
# shellcheck shell=bash
set -o errexit
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 ""
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
sed -i "/- hosts:/a\ - &$host $age_key" "$sops_file"
sed -i "/- age:/a\ - *$host" "$sops_file"
sed -i "/- hosts:/a\ - &$host $age_key" "$sops_file"
sed -i "/- age:/a\ - *$host" "$sops_file"
done
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 "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
# shellcheck shell=bash
set -o errexit
set -o nounset
@@ -11,11 +12,11 @@ fi
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
sed -i "/ - &$host $age_key/d" "$sops_file"
sed -i "/ - \*$host/d" "$sops_file"
sed -i "/ - &$host $age_key/d" "$sops_file"
sed -i "/ - \*$host/d" "$sops_file"
done
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
# shellcheck shell=bash
set -o errexit
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"
];
};
};
}